diff --git a/.shippable.yml b/.shippable.yml index a93871dea4bfc..bbf59684dab03 100644 --- a/.shippable.yml +++ b/.shippable.yml @@ -12,9 +12,9 @@ env: - USE_CCACHE=1 - secure: CaE0YOxMfS71yTJsLOUMAXyvrOfgPbT6NLakwXShPHFF+aqqu9UyrmwFE1UfNxDrFOa3h0gxmbMRJAdGPLdKeLmGlLiL96XMhpaZIWYmAD2/Kfx9wb+1zfYISrh9k11QIifbB5JpeiFzNrrwYLOv5Gqn2fkAgvSe0BEKoh6weCvMXHgxwJR/I5gtQYwZXI6arvOTWlVgRpXeqURcJbthsmp7/Bc4MctgiRXmBxeyvi+OTVe1u/sNPVf51ZYcNdaqw+xRp9xFeg09EP87QPlDHV+g9dPWuGvGHAwQ86TD8hkpjurLO3O8GHCXena7Ft0/t9iL4RBecUIBplISNuaK6Q== matrix: - - ARCH="" RUN_COMPLIANCE="1" + - ARCH="-a x86 -a riscv32 -a nios2" RUN_COMPLIANCE="1" + - ARCH="-a arm -a arc" #- ARCH="-a x86" RUN_COMPLIANCE="1" - #- ARCH="-a arm" #- ARCH="-a arc -a riscv32 -a nios2" build: @@ -37,19 +37,23 @@ build: - export PREBUILT_HOST_TOOLS=${ZEPHYR_BASE}/bin - > if [ "$RUN_COMPLIANCE" = "1" -a "$IS_PULL_REQUEST" = "true"]; then + echo "Building a Pull Request"; errors=$(./scripts/ci/check-compliance.py); cat compliance.xml fi; - > if [ "$JOB_TRIGGERED_BY_NAME" = "daily-verify-asserts" ]; then + echo "Building with --all --enable-slow -R"; COVERAGE="--all --enable-slow -R"; fi; - > if [ "$JOB_TRIGGERED_BY_NAME" = "daily-verify" ]; then + echo "Building with --all --enable-slow"; COVERAGE="--all --enable-slow"; fi; - > if [ "$JOB_TRIGGERED_BY_NAME" = "code-scan" ]; then + echo "Building basic sanitycheck"; wget https://scan.coverity.com/download/linux64 --post-data "token=${COVERITY_TOKEN}&project=Zephyr" -O coverity_tool.tgz; tar xvf coverity_tool.tgz; rm -f coverity_tool.tgz; diff --git a/README.rst b/README.rst new file mode 100644 index 0000000000000..e6c50b3a4147b --- /dev/null +++ b/README.rst @@ -0,0 +1,87 @@ +:orphan: + +Zephyr™ Project +############### + +The Zephyr™ Project is a scalable real-time operating system (RTOS) supporting +multiple hardware architectures, optimized for resource constrained devices, +and built with security in mind. + +The Zephyr OS is based on a small-footprint kernel designed for use on +resource-constrained systems: from simple embedded environmental sensors and +LED wearables to sophisticated smart watches and IoT wireless gateways. + +The Zephyr kernel supports multiple architectures, including ARM Cortex-M, +Intel x86, ARC, NIOS II and RISC V, and a large number of +`supported boards`_. + +Community Support +***************** + +The Zephyr Project Developer Community includes developers from member +organizations and the general community all joining in the development of +software within the Zephyr Project. Members contribute and discuss ideas, +submit bugs and bug fixes, and provide training. They also help those in need +through the community's forums such as mailing lists and IRC channels. Anyone +can join the developer community and the community is always willing to help +its members and the User Community to get the most out of the Zephyr Project. + +Welcome to the Zephyr community! + +Resources +********* + +Here’s a quick summary of resources to find your way around the Zephyr Project +support systems: + +* **Zephyr Project Website**: The https://zephyrproject.org website is the + central source of information about the Zephyr Project. On this site, you’ll + find background and current information about the project as well as all the + relevant links to project material. For a quick start, refer to the + `Zephyr Introduction`_ and `Getting Started Guide`_. + +* **Releases**: Source code for Zephyr kernel releases are available at + https://zephyrproject.org/downloads. On this page, + you'll find release information, and links to download or clone source + code from our GitHub repository. You'll also find links for the Zephyr + SDK, a moderated collection of tools and libraries used to develop your + applications. + +* **Source Code in GitHub**: Zephyr Project source code is maintained on a + public GitHub repository at https://github.com/zephyrproject-rtos/zephyr. + You'll find information about getting access to the repository and how to + contribute to the project in this `Contribution Guide`_ wiki article. + +* **Samples Code**: In addition to the kernel source code, there are also + many documented `Sample and Demo Code Examples`_ that can help show you + how to use Zephyr services and subsystems. + +* **Documentation**: Extensive Project technical documentation is developed + along with the Zephyr kernel itself, and can be found at + https://zephyrproject.org/doc. Additional documentation is maintained in + the `Zephyr GitHub wiki`_. + +* **Issue Reporting and Tracking**: Requirements and Issue tracking is done in + our JIRA system: https://jira.zephyrproject.org. You can browse through the + reported issues and submit issues of your own. + +* **Mailing List**: The `Zephyr Mailing Lists`_ are perhaps the most convenient + way to track developer discussions and to ask your own support questions to + the Zephyr project community. + You can also read through message archives to follow + past posts and discussions, a good thing to do to discover more about the + Zephyr project. + +* **IRC Chatting**: You can chat online with the Zephyr project developer + community and other users in our IRC channel #zephyrproject on the + freenode.net IRC server. You can use the http://webchat.freenode.net web + client or use a client-side application such as pidgin. + + +.. _supported boards: https://www.zephyrproject.org/doc/boards/boards.html +.. _Zephyr Introduction: https://www.zephyrproject.org/doc/introduction/introducing_zephyr.html +.. _Getting Started Guide: https://www.zephyrproject.org/doc/getting_started/getting_started.html +.. _Contribution Guide: https://github.com/zephyrproject-rtos/zephyr/wiki/Contribution-Guide +.. _Zephyr GitHub wiki: https://github.com/zephyrproject-rtos/zephyr/wiki +.. _Zephyr Mailing Lists: https://lists.zephyrproject.org/ +.. _Sample and Demo Code Examples: https://www.zephyrproject.org/doc/samples/samples.html diff --git a/arch/arm/soc/atmel_sam/Kconfig b/arch/arm/soc/atmel_sam/Kconfig index 759f70525c702..1988dd2005ab0 100644 --- a/arch/arm/soc/atmel_sam/Kconfig +++ b/arch/arm/soc/atmel_sam/Kconfig @@ -4,10 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 # -config SOC_ATMEL_SAM3 - bool - depends on ARM - default n - # Select SoC Part No. and configuration options source "arch/arm/soc/atmel_sam/*/Kconfig.soc" diff --git a/arch/arm/soc/atmel_sam/Kconfig.defconfig b/arch/arm/soc/atmel_sam/Kconfig.defconfig index 1f5550b230c4d..bdddffc438751 100644 --- a/arch/arm/soc/atmel_sam/Kconfig.defconfig +++ b/arch/arm/soc/atmel_sam/Kconfig.defconfig @@ -16,7 +16,7 @@ config SOC_FAMILY default atmel_sam config WATCHDOG - def_bool y if !SOC_ATMEL_SAM3X8E + def_bool y endif #SOC_FAMILY_SAM diff --git a/arch/arm/soc/atmel_sam/sam3x/Kconfig.defconfig.series b/arch/arm/soc/atmel_sam/sam3x/Kconfig.defconfig.series index 30159e2ebf0d6..724eed737673c 100644 --- a/arch/arm/soc/atmel_sam/sam3x/Kconfig.defconfig.series +++ b/arch/arm/soc/atmel_sam/sam3x/Kconfig.defconfig.series @@ -6,7 +6,7 @@ # SPDX-License-Identifier: Apache-2.0 # -if SOC_SERIES_SAM3X || SOC_ATMEL_SAM3X8E +if SOC_SERIES_SAM3X config SOC_SERIES string @@ -14,11 +14,7 @@ config SOC_SERIES config SOC_PART_NUMBER string - default sam3x8e if SOC_PART_NUMBER_SAM3X8E || SOC_ATMEL_SAM3X8E - -config NUM_IRQ_PRIO_BITS - int - default 3 + default sam3x8e if SOC_PART_NUMBER_SAM3X8E # # SAM3 family has total 45 peripherals capable of @@ -32,6 +28,12 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC int default 84000000 +config NUM_IRQ_PRIO_BITS + int + default 3 + +if !HAS_DTS + # # SRAM address depends on the processor. # @@ -42,66 +44,21 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC # to provide one continuous 96K block. # config SRAM_SIZE - default 96 if SOC_PART_NUMBER_SAM3X8E || SOC_ATMEL_SAM3X8E + default 96 if SOC_PART_NUMBER_SAM3X8E config SRAM_BASE_ADDRESS - default 0x20000000 if !SOC_PART_NUMBER_SAM3X8E && !SOC_ATMEL_SAM3X8E - default 0x20070000 if SOC_PART_NUMBER_SAM3X8E || SOC_ATMEL_SAM3X8E + default 0x20000000 if !SOC_PART_NUMBER_SAM3X8E + default 0x20070000 if SOC_PART_NUMBER_SAM3X8E # # Atmel SAM3X family has flash starting @ 0x00080000. # config FLASH_SIZE - default 512 if SOC_PART_NUMBER_SAM3X8E || SOC_ATMEL_SAM3X8E + default 512 if SOC_PART_NUMBER_SAM3X8E config FLASH_BASE_ADDRESS default 0x00080000 -if UART_ATMEL_SAM3 - -config UART_ATMEL_SAM3_BAUD_RATE - default 115200 - -config UART_ATMEL_SAM3_CLK_FREQ - default 84000000 - -endif # UART_ATMEL_SAM3 - -if GPIO - -config GPIO_ATMEL_SAM3 - def_bool y - -config GPIO_ATMEL_SAM3_PORTA - default y - -config GPIO_ATMEL_SAM3_PORTB - default y - -config GPIO_ATMEL_SAM3_PORTC - default y - -config GPIO_ATMEL_SAM3_PORTD - default y - -endif # GPIO - -if I2C - -config I2C_ATMEL_SAM3 - def_bool y - -config I2C_0 - default y -config I2C_0_IRQ_PRI - default 0 - -config I2C_1 - default y - -config I2C_1_IRQ_PRI - default 0 - -endif # I2C +endif # !HAS_DTS endif # SOC_SERIES_SAM3X diff --git a/arch/arm/soc/atmel_sam/sam3x/Kconfig.series b/arch/arm/soc/atmel_sam/sam3x/Kconfig.series index 59bb0f4ea8672..9d77cb7a8e814 100644 --- a/arch/arm/soc/atmel_sam/sam3x/Kconfig.series +++ b/arch/arm/soc/atmel_sam/sam3x/Kconfig.series @@ -16,13 +16,3 @@ config SOC_SERIES_SAM3X help Enable support for Atmel SAM3X Cortex-M3 microcontrollers. Part No.: SAM3X8E - -config SOC_ATMEL_SAM3X8E - bool "Atmel SAM3X8E Processor" - select SOC_PART_NUMBER_SAM3X8E - select CPU_CORTEX_M - select CPU_CORTEX_M3 - select SOC_FAMILY_SAM - select SYS_POWER_LOW_POWER_STATE_SUPPORTED - select CPU_HAS_SYSTICK - select SOC_ATMEL_SAM3 diff --git a/arch/arm/soc/atmel_sam/sam3x/Kconfig.soc b/arch/arm/soc/atmel_sam/sam3x/Kconfig.soc index 06bf046725faa..44e7f3857ace9 100644 --- a/arch/arm/soc/atmel_sam/sam3x/Kconfig.soc +++ b/arch/arm/soc/atmel_sam/sam3x/Kconfig.soc @@ -15,7 +15,7 @@ choice bool "SAM3X8E" endchoice -if SOC_SERIES_SAM3X || SOC_ATMEL_SAM3X8E +if SOC_SERIES_SAM3X config SOC_ATMEL_SAM3X_EXT_SLCK bool "Atmel SAM3 to use external crystal oscillator for slow clock" diff --git a/boards/arm/arduino_due/Kconfig.board b/boards/arm/arduino_due/Kconfig.board index 552742e6fb6bf..5818773a88228 100644 --- a/boards/arm/arduino_due/Kconfig.board +++ b/boards/arm/arduino_due/Kconfig.board @@ -1,4 +1,9 @@ +# Kconfig - Arduino Due Board configuration +# +# Copyright (c) 2017 Justin Watson +# SPDX-License-Identifier: Apache-2.0 +# config BOARD_ARDUINO_DUE bool "Arduino Due Board" - depends on SOC_ATMEL_SAM3X8E + depends on SOC_PART_NUMBER_SAM3X8E diff --git a/boards/arm/arduino_due/Kconfig.defconfig b/boards/arm/arduino_due/Kconfig.defconfig index 952d4e0d3e2c6..b5d1d0ebcacd2 100644 --- a/boards/arm/arduino_due/Kconfig.defconfig +++ b/boards/arm/arduino_due/Kconfig.defconfig @@ -1,14 +1,59 @@ +# Kconfig - Arduino Due Board configuration +# +# Copyright (c) 2017 Justin Watson +# SPDX-License-Identifier: Apache-2.0 +# if BOARD_ARDUINO_DUE config BOARD default arduino_due +if UART_ATMEL_SAM3 + +config UART_ATMEL_SAM3_BAUD_RATE + default 115200 + +config UART_ATMEL_SAM3_CLK_FREQ + default 84000000 + +endif # UART_ATMEL_SAM3 + +if GPIO + +config GPIO_ATMEL_SAM3 + def_bool y + +config GPIO_ATMEL_SAM3_PORTA + default y + +config GPIO_ATMEL_SAM3_PORTB + default y + +config GPIO_ATMEL_SAM3_PORTC + default y + +config GPIO_ATMEL_SAM3_PORTD + default y + +endif # GPIO + if I2C config I2C_ATMEL_SAM3 + def_bool y + +config I2C_0 + default y +config I2C_0_IRQ_PRI + default 0 + +config I2C_1 default y +config I2C_1_IRQ_PRI + default 0 + endif # I2C endif # BOARD_ARDUINO_DUE diff --git a/boards/arm/arduino_due/arduino_due_defconfig b/boards/arm/arduino_due/arduino_due_defconfig index 625064ef5be85..52c55efa4abba 100644 --- a/boards/arm/arduino_due/arduino_due_defconfig +++ b/boards/arm/arduino_due/arduino_due_defconfig @@ -1,10 +1,14 @@ CONFIG_ARM=y -CONFIG_SOC_ATMEL_SAM3X8E=y +CONFIG_SOC_FAMILY_SAM=y +CONFIG_SOC_SERIES_SAM3X=y +CONFIG_SOC_PART_NUMBER_SAM3X8E=y CONFIG_BOARD_ARDUINO_DUE=y CONFIG_CORTEX_M_SYSTICK=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_UART_ATMEL_SAM3=y -CONFIG_SOC_ATMEL_SAM3_EXT_MAINCK=y +CONFIG_SOC_ATMEL_SAM3X_EXT_MAINCK=y CONFIG_PINMUX=y +CONFIG_WATCHDOG=n +CONFIG_HAS_DTS=y diff --git a/drivers/bluetooth/hci/h4.c b/drivers/bluetooth/hci/h4.c index c3ef746891d0a..4edd011b51db4 100644 --- a/drivers/bluetooth/hci/h4.c +++ b/drivers/bluetooth/hci/h4.c @@ -42,15 +42,15 @@ static struct { struct net_buf *buf; struct k_fifo fifo; - u16_t remaining; - u16_t discard; + u16_t remaining; + u16_t discard; bool have_hdr; bool discardable; - u8_t hdr_len; + u8_t hdr_len; - u8_t type; + u8_t type; union { struct bt_hci_evt_hdr evt; struct bt_hci_acl_hdr acl; diff --git a/drivers/bluetooth/nble/gatt.c b/drivers/bluetooth/nble/gatt.c index 2d3a1484bdcbc..e1fa9e46ff8ea 100644 --- a/drivers/bluetooth/nble/gatt.c +++ b/drivers/bluetooth/nble/gatt.c @@ -814,8 +814,8 @@ static u16_t parse_service(struct bt_conn *conn, } static u16_t parse_characteristic(struct bt_conn *conn, - struct bt_gatt_discover_params *params, - const u8_t *data, u8_t len) + struct bt_gatt_discover_params *params, + const u8_t *data, u8_t len) { u16_t end_handle = 0; int i; @@ -847,8 +847,8 @@ static u16_t parse_characteristic(struct bt_conn *conn, } static u16_t parse_descriptor(struct bt_conn *conn, - struct bt_gatt_discover_params *params, - const u8_t *data, u8_t len) + struct bt_gatt_discover_params *params, + const u8_t *data, u8_t len) { u16_t end_handle = 0; int i; @@ -1404,7 +1404,7 @@ void bt_gatt_cancel(struct bt_conn *conn, void *params) } static s32_t prep_write_evt(const struct nble_gatts_write_evt *ev, - const u8_t *data, u8_t len) + const u8_t *data, u8_t len) { #if CONFIG_BLUETOOTH_ATT_PREPARE_COUNT > 0 const struct bt_gatt_attr *attr = ev->attr; diff --git a/drivers/gpio/Kconfig.atmel_sam3 b/drivers/gpio/Kconfig.atmel_sam3 index 8413a8b606ce0..3b33cdd99c004 100644 --- a/drivers/gpio/Kconfig.atmel_sam3 +++ b/drivers/gpio/Kconfig.atmel_sam3 @@ -8,7 +8,7 @@ menuconfig GPIO_ATMEL_SAM3 bool "Atmel SAM3 PIO Controllers" - depends on GPIO && SOC_ATMEL_SAM3 + depends on GPIO && SOC_SERIES_SAM3 default n help Enable config options to support the PIO controllers diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 30d59fe240199..f9540e15a1e25 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -14,64 +14,63 @@ menuconfig I2C prompt "I2C Drivers" default n help - Enable I2C Driver Configuration + Enable I2C Driver Configuration if I2C config I2C_DW bool "Design Ware I2C support" - depends on I2C default n help - Enable Design Ware I2C support on the selected board + Enable Design Ware I2C support on the selected board config I2C_QMSI_SS bool "QMSI I2C driver for the Sensor Subsystem" - depends on I2C && QMSI + depends on QMSI default n help - This option enable the Sensor QMSI I2C driver. + This option enable the Sensor QMSI I2C driver. - This driver is simply a shim driver based on the I2C driver - provided by the QMSI BSP. + This driver is simply a shim driver based on the I2C driver + provided by the QMSI BSP. config I2C_QMSI bool "QMSI I2C driver" - depends on I2C && QMSI + depends on QMSI default n help - This option enable the QMSI I2C driver. + This option enable the QMSI I2C driver. - This driver is simply a shim driver based on the I2C driver - provided by the QMSI BSP. + This driver is simply a shim driver based on the I2C driver + provided by the QMSI BSP. config I2C_ATMEL_SAM3 bool "Atmel SAM3 I2C Driver" - depends on I2C && SOC_ATMEL_SAM3 + depends on SOC_SERIES_SAM3X default n help - Enable I2C support on the Atmel SAM3 family processor. + Enable I2C support on the Atmel SAM3 family processor. - Says y to enable additional options to enable support - for individual controllers. + Says y to enable additional options to enable support + for individual controllers. config TWIHS_SAM bool "Atmel SAM I2C driver" - depends on I2C && SOC_FAMILY_SAM + depends on SOC_FAMILY_SAM default n help Enable Atmel SAM MCU Family I2C bus driver. config I2C_MCUX bool "MCUX I2C driver" - depends on I2C && HAS_MCUX + depends on HAS_MCUX default n help - Enable the mcux I2C driver. + Enable the mcux I2C driver. config I2C_NRF5 bool "NRF5 I2C driver" - depends on I2C && SOC_FAMILY_NRF5 + depends on SOC_FAMILY_NRF5 select GPIO default n help @@ -94,17 +93,17 @@ config I2C_NRF5_GPIO_SCL_PIN config I2C_STM32LX bool "STM32Lx MCU I2C Driver" - depends on I2C && SOC_FAMILY_STM32 && SOC_SERIES_STM32L4X + depends on SOC_FAMILY_STM32 && SOC_SERIES_STM32L4X default n help - Enable I2C support on the STM32Lxx family of processors. + Enable I2C support on the STM32Lxx family of processors. config I2C_STM32LX_INTERRUPT bool "STM32Lx MCU I2C Interrupt Support" depends on I2C_STM32LX default n help - Enable Interrupt support for the I2C Driver of STM32Lxx family. + Enable Interrupt support for the I2C Driver of STM32Lxx family. config I2C_BITBANG bool @@ -116,41 +115,34 @@ source "drivers/i2c/Kconfig.gpio" config I2C_INIT_PRIORITY int - depends on I2C default 60 prompt "Init priority" help - I2C device driver initialization priority. + I2C device driver initialization priority. config I2C_DW_CLOCK_SPEED int "Set the clock speed for I2C" default 32 - depends on I2C && I2C_DW + depends on I2C_DW config SYS_LOG_I2C_LEVEL int prompt "I2C log level" - depends on I2C && SYS_LOG + depends on SYS_LOG default 0 help - Sets log level for I2C connections - - Levels are: - - - 0 OFF, do not write - - - 1 ERROR, only write SYS_LOG_ERR - - - 2 WARNING, write SYS_LOG_WRN in addition to previous level - - - 3 INFO, write SYS_LOG_INF in addition to previous levels - - - 4 DEBUG, write SYS_LOG_DBG in addition to previous levels + Sets log level for I2C drivers. + Levels are: + - 0 OFF, do not write + - 1 ERROR, only write SYS_LOG_ERR + - 2 WARNING, write SYS_LOG_WRN in addition to previous level + - 3 INFO, write SYS_LOG_INF in addition to previous levels + - 4 DEBUG, write SYS_LOG_DBG in addition to previous levels config I2C_DW_SHARED_IRQ bool default n - depends on I2C && I2C_DW + depends on I2C_DW choice prompt "I2C_0 Interrupts via" @@ -160,16 +152,16 @@ choice config I2C_DW_0_IRQ_DIRECT bool "Direct Hardware Interrupt" help - When interrupts fire, the driver's ISR function is being called - directly. + When interrupts fire, the driver's ISR function is being called + directly. config I2C_DW_0_IRQ_SHARED bool "Shared IRQ" depends on SHARED_IRQ select I2C_DW_SHARED_IRQ help - When interrupts fire, the shared IRQ driver is notified. - Then the shared IRQ driver dispatches the interrupt to other drivers. + When interrupts fire, the shared IRQ driver is notified. + Then the shared IRQ driver dispatches the interrupt to other drivers. endchoice @@ -177,90 +169,87 @@ config I2C_DW_0_IRQ_SHARED_NAME string "Device name for Shared IRQ" depends on I2C_0 && I2C_DW_0_IRQ_SHARED help - Specify the device name for the shared IRQ driver. It is used - to register this driver with the shared IRQ driver, so interrupts - can be dispatched correctly. + Specify the device name for the shared IRQ driver. It is used + to register this driver with the shared IRQ driver, so interrupts + can be dispatched correctly. config I2C_0 - bool "Enable I2C_0" - depends on I2C + bool "Enable I2C Port 0" default n config I2C_0_NAME - string "Select a name for finding the device" + string "Port 0 device name" depends on I2C_0 default "I2C_0" config I2C_0_DEFAULT_CFG - hex "I2C default configuration" + hex "Port 0 default configuration" depends on I2C_0 default 0x0 help - Allows the I2C port to be brought up with a default configuration. - This is useful to set if other drivers depend upon using the I2C bus - before the application has a chance to custom configure the port. - Setting this value does not prohibit the application from customizing - the values later. Refer to the I2C datasheet for proper values. + Allows the I2C port to be brought up with a default configuration. + This is useful to set if other drivers depend upon using the I2C bus + before the application has a chance to custom configure the port. + Setting this value does not prohibit the application from customizing + the values later. Refer to include/i2c.h file for proper values. config I2C_0_IRQ_PRI - int "Controller interrupt priority" + int "Port 0 interrupt priority" depends on I2C_0 help - IRQ priority. + IRQ priority. config I2C_1 bool "Enable I2C Port 1" - depends on I2C default n config I2C_1_NAME - string "Select a name for finding the device" + string "Port 1 device name" default "I2C_1" depends on I2C_1 config I2C_1_DEFAULT_CFG - hex "I2C default configuration" + hex "Port 1 default configuration" depends on I2C_1 default 0x0 help - Allows the I2C port to be brought up with a default configuration. - This is useful to set if other drivers depend upon using the I2C bus - before the application has a chance to custom configure the port. - Setting this value does not prohibit the application from customizing - the values later. Refer to the I2C datasheet for proper values. + Allows the I2C port to be brought up with a default configuration. + This is useful to set if other drivers depend upon using the I2C bus + before the application has a chance to custom configure the port. + Setting this value does not prohibit the application from customizing + the values later. Refer to include/i2c.h file for proper values. config I2C_1_IRQ_PRI - int "Controller interrupt priority" + int "Port 1 interrupt priority" depends on I2C_1 help - IRQ priority. + IRQ priority. config I2C_2 bool "Enable I2C Port 2" - depends on I2C default n config I2C_2_NAME - string "Select a name for finding the device" + string "Port 2 device name" default "I2C_2" depends on I2C_2 config I2C_2_DEFAULT_CFG - hex "I2C default configuration" + hex "Port 2 default configuration" depends on I2C_2 default 0x0 help - Allows the I2C port to be brought up with a default configuration. - This is useful to set if other drivers depend upon using the I2C bus - before the application has a chance to custom configure the port. - Setting this value does not prohibit the application from customizing - the values later. Refer to the I2C datasheet for proper values. + Allows the I2C port to be brought up with a default configuration. + This is useful to set if other drivers depend upon using the I2C bus + before the application has a chance to custom configure the port. + Setting this value does not prohibit the application from customizing + the values later. Refer to include/i2c.h file for proper values. config I2C_2_IRQ_PRI - int "Controller interrupt priority" + int "Port 2 interrupt priority" depends on I2C_2 help - IRQ priority. + IRQ priority. config I2C_SS_0 bool "Enable I2C_SS_0" @@ -277,11 +266,11 @@ config I2C_SS_0_DEFAULT_CFG depends on I2C_SS_0 default 0x0 help - Allows the I2C port to be brought up with a default configuration. - This is useful to set if other drivers depend upon using the I2C bus - before the application has a chance to custom configure the port. - Setting this value does not prohibit the application from customizing - the values later. Refer to the I2C datasheet for proper values. + Allows the I2C port to be brought up with a default configuration. + This is useful to set if other drivers depend upon using the I2C bus + before the application has a chance to custom configure the port. + Setting this value does not prohibit the application from customizing + the values later. Refer to the I2C datasheet for proper values. config I2C_SS_1 bool "Enable I2C SS Port 1" @@ -298,47 +287,45 @@ config I2C_SS_1_DEFAULT_CFG depends on I2C_SS_1 default 0x0 help - Allows the I2C port to be brought up with a default configuration. - This is useful to set if other drivers depend upon using the I2C bus - before the application has a chance to custom configure the port. - Setting this value does not prohibit the application from customizing - the values later. Refer to the I2C datasheet for proper values. + Allows the I2C port to be brought up with a default configuration. + This is useful to set if other drivers depend upon using the I2C bus + before the application has a chance to custom configure the port. + Setting this value does not prohibit the application from customizing + the values later. Refer to the I2C datasheet for proper values. config I2C_SS_SDA_HOLD int depends on I2C_QMSI_SS help - The hold time on the data signal after a negative edge of i2c clock. - The unit is i2c module base clock. + The hold time on the data signal after a negative edge of i2c clock. + The unit is i2c module base clock. config I2C_SS_SDA_SETUP int depends on I2C_QMSI_SS help - The delay time of clock rising edge relative to i2c data signal change. - The unit is i2c module base clock. + The delay time of clock rising edge relative to i2c data signal + change. The unit is i2c module base clock. config I2C_SDA_SETUP int depends on I2C_QMSI help - The delay time of clock rising edge relative to i2c data signal change. - The unit is i2c module base clock. + The delay time of clock rising edge relative to i2c data signal + change. The unit is i2c module base clock. config I2C_SDA_TX_HOLD int depends on I2C_QMSI help - The hold time on the data signal after a negative edge of i2c clock - while i2c acts as transmitter. - The unit is i2c module base clock. + The hold time on the data signal after a negative edge of i2c clock + while i2c acts as transmitter. The unit is i2c module base clock. config I2C_SDA_RX_HOLD int depends on I2C_QMSI help - The hold time on the data signal after a negative edge of i2c clock - while i2c acts as receiver. - The unit is i2c module base clock. + The hold time on the data signal after a negative edge of i2c clock + while i2c acts as receiver. The unit is i2c module base clock. -endif +endif # I2C diff --git a/drivers/pinmux/dev/Kconfig b/drivers/pinmux/dev/Kconfig index 418b5eaa3cc45..45b3f5c804e14 100644 --- a/drivers/pinmux/dev/Kconfig +++ b/drivers/pinmux/dev/Kconfig @@ -24,7 +24,7 @@ config PINMUX_DEV_NAME config PINMUX_DEV_ATMEL_SAM3X bool "Enable pinmux dev driver for Atmel SAM3X boards" - depends on PINMUX_DEV && SOC_ATMEL_SAM3X8E + depends on PINMUX_DEV && SOC_SERIES_SAM3 help Enables the pinmux dev driver for boards based on the Atmel SAM3X family of microcontrollers. diff --git a/drivers/serial/Kconfig.atmel_sam3 b/drivers/serial/Kconfig.atmel_sam3 index ef678fd30e298..8c0c2229baf36 100644 --- a/drivers/serial/Kconfig.atmel_sam3 +++ b/drivers/serial/Kconfig.atmel_sam3 @@ -2,7 +2,7 @@ menuconfig UART_ATMEL_SAM3 bool "Atmel SAM3 family processor UART driver" default n select SERIAL_HAS_DRIVER - depends on SOC_ATMEL_SAM3 + depends on SOC_SERIES_SAM3 help This option enables the UART driver for Atmel SAM3 family processors. Note that there is only one diff --git a/dts/arm/Makefile b/dts/arm/Makefile index 392b1ee74f4dd..28cb52236cc14 100644 --- a/dts/arm/Makefile +++ b/dts/arm/Makefile @@ -29,6 +29,7 @@ dtb-$(CONFIG_BOARD_NRF51_BLENANO) = nrf51_blenano.dts_compiled dtb-$(CONFIG_BOARD_NRF51_PCA10028) = nrf51_pca10028.dts_compiled dtb-$(CONFIG_BOARD_QUARK_SE_C1000_BLE) = quark_se_c1000_ble.dts_compiled dtb-$(CONFIG_BOARD_QEMU_CORTEX_M3) = qemu_cortex_m3.dts_compiled +dtb-$(CONFIG_BOARD_ARDUINO_DUE) = arduino_due.dts_compiled always := $(dtb-y) endif diff --git a/dts/arm/arduino_due.dts b/dts/arm/arduino_due.dts new file mode 100644 index 0000000000000..947aa5cd36e4a --- /dev/null +++ b/dts/arm/arduino_due.dts @@ -0,0 +1,22 @@ +/dts-v1/; + +#include + +/ { + model = "Arduino Due with an Atmel SAM3X8E"; + compatible = "atmel,sam3x"; + + aliases { + uart_0 = &uart0; + }; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; +}; + +&uart0 { + status = "ok"; + current-speed = <115200>; +}; diff --git a/dts/arm/atmel/sam3x.dtsi b/dts/arm/atmel/sam3x.dtsi new file mode 100644 index 0000000000000..d5d7f56198341 --- /dev/null +++ b/dts/arm/atmel/sam3x.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017 Justin Watson + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + cpus { + cpu@0 { + compatible = "arm,cortex-m4"; + }; + }; + + sram0: memory { + compatible = "sram"; + reg = <0x20070000 0x18000>; + }; + + flash0: flash { + compatible = "flash"; + reg = <0x00080000 0x80000>; + }; + + soc { + uart0: uart@400E0800 { + compatible = "atmel,sam3x-uart"; + reg = <0x400E0800 0x124>; + interrupts = <8 0>; + status = "disabled"; + }; + }; +}; + +&nvic { + arm,num-irq-priority-bits = <3>; +}; diff --git a/dts/arm/yaml/atmel,sam3x-uart.yaml b/dts/arm/yaml/atmel,sam3x-uart.yaml new file mode 100644 index 0000000000000..cbe85bf2cdd92 --- /dev/null +++ b/dts/arm/yaml/atmel,sam3x-uart.yaml @@ -0,0 +1,30 @@ +--- +title: SAM3X UART +id: atmel,sam3x-uart +version: 0.1 + +description: > + This binding gives a base representation of the SAM3X UART + +inherits: + - !include uart.yaml + +properties: + - compatible: + type: string + category: required + description: compatible strings + constraint: "atmel,sam3x-uart" + + - reg: + type: array + description: mmio register space + generation: define + category: required + + - interrupts: + type: array + category: required + description: required interrupts + generation: define +... diff --git a/include/bluetooth/gatt.h b/include/bluetooth/gatt.h index 56877587fe2a6..28228768d49c6 100644 --- a/include/bluetooth/gatt.h +++ b/include/bluetooth/gatt.h @@ -134,7 +134,7 @@ struct bt_gatt_attr { /** Attribute user data */ void *user_data; /** Attribute handle */ - u16_t handle; + u16_t handle; /** Attribute permissions */ u8_t perm; #if defined(CONFIG_BLUETOOTH_GATT_DYNAMIC_DB) @@ -147,7 +147,7 @@ struct bt_gatt_service { /** Service UUID. */ const struct bt_uuid *uuid; /** Service end handle. */ - u16_t end_handle; + u16_t end_handle; }; /** @brief Include Attribute Value. */ @@ -155,9 +155,9 @@ struct bt_gatt_include { /** Service UUID. */ const struct bt_uuid *uuid; /** Service start handle. */ - u16_t start_handle; + u16_t start_handle; /** Service end handle. */ - u16_t end_handle; + u16_t end_handle; }; /* Characteristic Properties Bit field values */ @@ -783,8 +783,8 @@ struct bt_gatt_discover_params; * or BT_GATT_ITER_STOP to stop discovery procedure. */ typedef u8_t (*bt_gatt_discover_func_t)(struct bt_conn *conn, - const struct bt_gatt_attr *attr, - struct bt_gatt_discover_params *params); + const struct bt_gatt_attr *attr, + struct bt_gatt_discover_params *params); enum { BT_GATT_DISCOVER_PRIMARY, @@ -859,8 +859,8 @@ struct bt_gatt_read_params; * @param length Attribute value length. */ typedef u8_t (*bt_gatt_read_func_t)(struct bt_conn *conn, u8_t err, - struct bt_gatt_read_params *params, - const void *data, u16_t length); + struct bt_gatt_read_params *params, + const void *data, u16_t length); /** @brief GATT Read parameters * @param func Read attribute callback @@ -908,7 +908,7 @@ struct bt_gatt_write_params; * @param params Write parameters used. */ typedef void (*bt_gatt_write_func_t)(struct bt_conn *conn, u8_t err, - struct bt_gatt_write_params *params); + struct bt_gatt_write_params *params); /** @brief GATT Write parameters */ struct bt_gatt_write_params { @@ -968,8 +968,8 @@ struct bt_gatt_subscribe_params; * @param length Attribute value length. */ typedef u8_t (*bt_gatt_notify_func_t)(struct bt_conn *conn, - struct bt_gatt_subscribe_params *params, - const void *data, u16_t length); + struct bt_gatt_subscribe_params *params, + const void *data, u16_t length); /* Subscription flags */ enum { diff --git a/include/bluetooth/hci.h b/include/bluetooth/hci.h index 23c01cce3ec47..14d1125b38ccd 100644 --- a/include/bluetooth/hci.h +++ b/include/bluetooth/hci.h @@ -28,7 +28,7 @@ typedef struct { } bt_addr_t; typedef struct { - u8_t type; + u8_t type; bt_addr_t a; } bt_addr_le_t; @@ -324,14 +324,14 @@ struct bt_hci_cp_connect_cancel { bt_addr_t bdaddr; } __packed; struct bt_hci_rp_connect_cancel { - u8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; #define BT_HCI_OP_ACCEPT_CONN_REQ BT_OP(BT_OGF_LINK_CTRL, 0x0009) struct bt_hci_cp_accept_conn_req { bt_addr_t bdaddr; - u8_t role; + u8_t role; } __packed; #define BT_HCI_OP_SETUP_SYNC_CONN BT_OP(BT_OGF_LINK_CTRL, 0x0028) @@ -359,7 +359,7 @@ struct bt_hci_cp_accept_sync_conn_req { #define BT_HCI_OP_REJECT_CONN_REQ BT_OP(BT_OGF_LINK_CTRL, 0x000a) struct bt_hci_cp_reject_conn_req { bt_addr_t bdaddr; - u8_t reason; + u8_t reason; } __packed; #define BT_HCI_OP_LINK_KEY_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x000b) @@ -380,7 +380,7 @@ struct bt_hci_cp_pin_code_reply { u8_t pin_code[16]; } __packed; struct bt_hci_rp_pin_code_reply { - u8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; @@ -407,9 +407,9 @@ struct bt_hci_cp_set_conn_encrypt { #define BT_HCI_OP_REMOTE_NAME_REQUEST BT_OP(BT_OGF_LINK_CTRL, 0x0019) struct bt_hci_cp_remote_name_request { bt_addr_t bdaddr; - u8_t pscan_rep_mode; - u8_t reserved; - u16_t clock_offset; + u8_t pscan_rep_mode; + u8_t reserved; + u16_t clock_offset; } __packed; #define BT_HCI_OP_REMOTE_NAME_CANCEL BT_OP(BT_OGF_LINK_CTRL, 0x001a) @@ -417,7 +417,7 @@ struct bt_hci_cp_remote_name_cancel { bt_addr_t bdaddr; } __packed; struct bt_hci_rp_remote_name_cancel { - u8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; @@ -451,14 +451,14 @@ struct bt_hci_cp_user_confirm_reply { bt_addr_t bdaddr; } __packed; struct bt_hci_rp_user_confirm_reply { - u8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; #define BT_HCI_OP_USER_PASSKEY_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002e) struct bt_hci_cp_user_passkey_reply { bt_addr_t bdaddr; - u32_t passkey; + u32_t passkey; } __packed; #define BT_HCI_OP_USER_PASSKEY_NEG_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002f) @@ -590,7 +590,7 @@ struct bt_hci_rp_read_buffer_size { #define BT_HCI_OP_READ_BD_ADDR BT_OP(BT_OGF_INFO, 0x0009) struct bt_hci_rp_read_bd_addr { - u8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; @@ -640,19 +640,19 @@ struct bt_hci_cp_le_set_random_address { #define BT_HCI_OP_LE_SET_ADV_PARAM BT_OP(BT_OGF_LE, 0x0006) struct bt_hci_cp_le_set_adv_param { - u16_t min_interval; - u16_t max_interval; - u8_t type; - u8_t own_addr_type; + u16_t min_interval; + u16_t max_interval; + u8_t type; + u8_t own_addr_type; bt_addr_le_t direct_addr; - u8_t channel_map; - u8_t filter_policy; + u8_t channel_map; + u8_t filter_policy; } __packed; #define BT_HCI_OP_LE_READ_ADV_CHAN_TX_POWER BT_OP(BT_OGF_LE, 0x0007) struct bt_hci_rp_le_read_chan_tx_power { u8_t status; - s8_t tx_power_level; + s8_t tx_power_level; } __packed; #define BT_HCI_OP_LE_SET_ADV_DATA BT_OP(BT_OGF_LE, 0x0008) @@ -703,17 +703,17 @@ struct bt_hci_cp_le_set_scan_enable { #define BT_HCI_OP_LE_CREATE_CONN BT_OP(BT_OGF_LE, 0x000d) struct bt_hci_cp_le_create_conn { - u16_t scan_interval; - u16_t scan_window; - u8_t filter_policy; + u16_t scan_interval; + u16_t scan_window; + u8_t filter_policy; bt_addr_le_t peer_addr; - u8_t own_addr_type; - u16_t conn_interval_min; - u16_t conn_interval_max; - u16_t conn_latency; - u16_t supervision_timeout; - u16_t min_ce_len; - u16_t max_ce_len; + u8_t own_addr_type; + u16_t conn_interval_min; + u16_t conn_interval_max; + u16_t conn_latency; + u16_t supervision_timeout; + u16_t min_ce_len; + u16_t max_ce_len; } __packed; #define BT_HCI_OP_LE_CREATE_CONN_CANCEL BT_OP(BT_OGF_LE, 0x000e) @@ -893,8 +893,8 @@ struct bt_hci_cp_le_generate_dhkey { #define BT_HCI_OP_LE_ADD_DEV_TO_RL BT_OP(BT_OGF_LE, 0x0027) struct bt_hci_cp_le_add_dev_to_rl { bt_addr_le_t peer_id_addr; - u8_t peer_irk[16]; - u8_t local_irk[16]; + u8_t peer_irk[16]; + u8_t local_irk[16]; } __packed; #define BT_HCI_OP_LE_REM_DEV_FROM_RL BT_OP(BT_OGF_LE, 0x0028) @@ -915,7 +915,7 @@ struct bt_hci_cp_le_read_peer_rpa { bt_addr_le_t peer_id_addr; } __packed; struct bt_hci_rp_le_read_peer_rpa { - u8_t status; + u8_t status; bt_addr_t peer_rpa; } __packed; @@ -924,7 +924,7 @@ struct bt_hci_cp_le_read_local_rpa { bt_addr_le_t peer_id_addr; } __packed; struct bt_hci_rp_le_read_local_rpa { - u8_t status; + u8_t status; bt_addr_t local_rpa; } __packed; @@ -986,10 +986,10 @@ struct bt_hci_cp_le_set_default_phy { #define BT_HCI_OP_LE_SET_PHY BT_OP(BT_OGF_LE, 0x0032) struct bt_hci_cp_le_set_phy { u16_t conn_handle; - u8_t all_phys; - u8_t tx_phys; - u8_t rx_phys; - u8_t phy_opts; + u8_t all_phys; + u8_t tx_phys; + u8_t rx_phys; + u8_t phy_opts; } __packed; #define BT_HCI_LE_MOD_INDEX_STANDARD 0x00 @@ -1016,7 +1016,7 @@ struct bt_hci_cp_le_enh_tx_test { #define BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR BT_OP(BT_OGF_LE, 0x0035) struct bt_hci_cp_le_set_adv_set_random_addr { - u8_t handle; + u8_t handle; bt_addr_t bdaddr; } __packed; @@ -1030,24 +1030,24 @@ struct bt_hci_cp_le_set_adv_set_random_addr { #define BT_HCI_OP_LE_SET_EXT_ADV_PARAM BT_OP(BT_OGF_LE, 0x0036) struct bt_hci_cp_le_set_ext_adv_param { - u8_t handle; - u16_t props; - u8_t prim_min_interval[3]; - u8_t prim_max_interval[3]; - u8_t prim_channel_map; - u8_t own_addr_type; + u8_t handle; + u16_t props; + u8_t prim_min_interval[3]; + u8_t prim_max_interval[3]; + u8_t prim_channel_map; + u8_t own_addr_type; bt_addr_le_t peer_addr; - u8_t filter_policy; - s8_t tx_power; - u8_t prim_adv_phy; - u8_t sec_adv_max_skip; - u8_t sec_adv_phy; - u8_t sid; - u8_t scan_req_notify_enable; + u8_t filter_policy; + s8_t tx_power; + u8_t prim_adv_phy; + u8_t sec_adv_max_skip; + u8_t sec_adv_phy; + u8_t sid; + u8_t scan_req_notify_enable; } __packed; struct bt_hci_rp_le_set_ext_adv_param { u8_t status; - s8_t tx_power; + s8_t tx_power; } __packed; #define BT_HCI_LE_EXT_ADV_OP_INTERM_FRAG 0x00 @@ -1173,21 +1173,21 @@ struct bt_hci_ext_conn_phy { } __packed; struct bt_hci_cp_le_ext_create_conn { - u8_t filter_policy; - u8_t own_addr_type; + u8_t filter_policy; + u8_t own_addr_type; bt_addr_le_t peer_addr; - u8_t phys; + u8_t phys; struct bt_hci_ext_conn_phy p[0]; } __packed; #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC BT_OP(BT_OGF_LE, 0x0044) struct bt_hci_cp_le_per_adv_create_sync { - u8_t filter_policy; - u8_t sid; + u8_t filter_policy; + u8_t sid; bt_addr_le_t addr; - u16_t skip; - u16_t sync_timeout; - u8_t unused; + u16_t skip; + u16_t sync_timeout; + u8_t unused; } __packed; #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC_CANCEL BT_OP(BT_OGF_LE, 0x0045) @@ -1200,13 +1200,13 @@ struct bt_hci_cp_le_per_adv_terminate_sync { #define BT_HCI_OP_LE_ADD_DEV_TO_PER_ADV_LIST BT_OP(BT_OGF_LE, 0x0047) struct bt_hci_cp_le_add_dev_to_per_adv_list { bt_addr_le_t addr; - u8_t sid; + u8_t sid; } __packed; #define BT_HCI_OP_LE_REM_DEV_FROM_PER_ADV_LIST BT_OP(BT_OGF_LE, 0x0048) struct bt_hci_cp_le_rem_dev_from_per_adv_list { bt_addr_le_t addr; - u8_t sid; + u8_t sid; } __packed; #define BT_HCI_OP_LE_CLEAR_PER_ADV_LIST BT_OP(BT_OGF_LE, 0x0049) @@ -1220,15 +1220,15 @@ struct bt_hci_rp_le_read_per_adv_list_size { #define BT_HCI_OP_LE_READ_TX_POWER BT_OP(BT_OGF_LE, 0x004b) struct bt_hci_rp_le_read_tx_power { u8_t status; - s8_t min_tx_power; - s8_t max_tx_power; + s8_t min_tx_power; + s8_t max_tx_power; } __packed; #define BT_HCI_OP_LE_READ_RF_PATH_COMP BT_OP(BT_OGF_LE, 0x004c) struct bt_hci_rp_le_read_rf_path_comp { u8_t status; - s16_t tx_path_comp; - s16_t rx_path_comp; + s16_t tx_path_comp; + s16_t rx_path_comp; } __packed; #define BT_HCI_OP_LE_WRITE_RF_PATH_COMP BT_OP(BT_OGF_LE, 0x004d) @@ -1243,7 +1243,7 @@ struct bt_hci_cp_le_write_rf_path_comp { #define BT_HCI_OP_LE_SET_PRIVACY_MODE BT_OP(BT_OGF_LE, 0x004e) struct bt_hci_cp_le_set_privacy_mode { bt_addr_le_t id_addr; - u8_t mode; + u8_t mode; } __packed; /* Event definitions */ @@ -1257,18 +1257,18 @@ struct bt_hci_evt_inquiry_complete { #define BT_HCI_EVT_CONN_COMPLETE 0x03 struct bt_hci_evt_conn_complete { - u8_t status; - u16_t handle; + u8_t status; + u16_t handle; bt_addr_t bdaddr; - u8_t link_type; - u8_t encr_enabled; + u8_t link_type; + u8_t encr_enabled; } __packed; #define BT_HCI_EVT_CONN_REQUEST 0x04 struct bt_hci_evt_conn_request { bt_addr_t bdaddr; - u8_t dev_class[3]; - u8_t link_type; + u8_t dev_class[3]; + u8_t link_type; } __packed; #define BT_HCI_EVT_DISCONN_COMPLETE 0x05 @@ -1286,9 +1286,9 @@ struct bt_hci_evt_auth_complete { #define BT_HCI_EVT_REMOTE_NAME_REQ_COMPLETE 0x07 struct bt_hci_evt_remote_name_req_complete { - u8_t status; + u8_t status; bt_addr_t bdaddr; - u8_t name[248]; + u8_t name[248]; } __packed; #define BT_HCI_EVT_ENCRYPT_CHANGE 0x08 @@ -1333,9 +1333,9 @@ struct bt_hci_evt_cmd_status { #define BT_HCI_EVT_ROLE_CHANGE 0x12 struct bt_hci_evt_role_change { - u8_t status; + u8_t status; bt_addr_t bdaddr; - u8_t role; + u8_t role; } __packed; #define BT_HCI_EVT_NUM_COMPLETED_PACKETS 0x13 @@ -1366,20 +1366,20 @@ struct bt_hci_evt_link_key_req { #define BT_LK_AUTH_COMBINATION_P256 0x08 #define BT_HCI_EVT_LINK_KEY_NOTIFY 0x18 -struct bt_hci_ev_link_key_notify { +struct bt_hci_evt_link_key_notify { bt_addr_t bdaddr; - u8_t link_key[16]; - u8_t key_type; + u8_t link_key[16]; + u8_t key_type; } __packed; #define BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI 0x22 struct bt_hci_evt_inquiry_result_with_rssi { bt_addr_t addr; - u8_t pscan_rep_mode; - u8_t reserved; - u8_t cod[3]; - u16_t clock_offset; - s8_t rssi; + u8_t pscan_rep_mode; + u8_t reserved; + u8_t cod[3]; + u16_t clock_offset; + s8_t rssi; } __packed; #define BT_HCI_EVT_REMOTE_EXT_FEATURES 0x23 @@ -1393,27 +1393,27 @@ struct bt_hci_evt_remote_ext_features { #define BT_HCI_EVT_SYNC_CONN_COMPLETE 0x2c struct bt_hci_evt_sync_conn_complete { - u8_t status; - u16_t handle; + u8_t status; + u16_t handle; bt_addr_t bdaddr; - u8_t link_type; - u8_t tx_interval; - u8_t retansmission_window; - u16_t rx_pkt_length; - u16_t tx_pkt_length; - u8_t air_mode; + u8_t link_type; + u8_t tx_interval; + u8_t retansmission_window; + u16_t rx_pkt_length; + u16_t tx_pkt_length; + u8_t air_mode; } __packed; #define BT_HCI_EVT_EXTENDED_INQUIRY_RESULT 0x2f struct bt_hci_evt_extended_inquiry_result { - u8_t num_reports; + u8_t num_reports; bt_addr_t addr; - u8_t pscan_rep_mode; - u8_t reserved; - u8_t cod[3]; - u16_t clock_offset; - s8_t rssi; - u8_t eir[240]; + u8_t pscan_rep_mode; + u8_t reserved; + u8_t cod[3]; + u16_t clock_offset; + s8_t rssi; + u8_t eir[240]; } __packed; #define BT_HCI_EVT_ENCRYPT_KEY_REFRESH_COMPLETE 0x30 @@ -1430,15 +1430,15 @@ struct bt_hci_evt_io_capa_req { #define BT_HCI_EVT_IO_CAPA_RESP 0x32 struct bt_hci_evt_io_capa_resp { bt_addr_t bdaddr; - u8_t capability; - u8_t oob_data; - u8_t authentication; + u8_t capability; + u8_t oob_data; + u8_t authentication; } __packed; #define BT_HCI_EVT_USER_CONFIRM_REQ 0x33 struct bt_hci_evt_user_confirm_req { bt_addr_t bdaddr; - u32_t passkey; + u32_t passkey; } __packed; #define BT_HCI_EVT_USER_PASSKEY_REQ 0x34 @@ -1448,14 +1448,14 @@ struct bt_hci_evt_user_passkey_req { #define BT_HCI_EVT_SSP_COMPLETE 0x36 struct bt_hci_evt_ssp_complete { - u8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; #define BT_HCI_EVT_USER_PASSKEY_NOTIFY 0x3b struct bt_hci_evt_user_passkey_notify { bt_addr_t bdaddr; - u32_t passkey; + u32_t passkey; } __packed; #define BT_HCI_EVT_LE_META_EVENT 0x3e @@ -1473,26 +1473,26 @@ struct bt_hci_evt_auth_payload_timeout_exp { #define BT_HCI_EVT_LE_CONN_COMPLETE 0x01 struct bt_hci_evt_le_conn_complete { - u8_t status; - u16_t handle; - u8_t role; + u8_t status; + u16_t handle; + u8_t role; bt_addr_le_t peer_addr; - u16_t interval; - u16_t latency; - u16_t supv_timeout; - u8_t clock_accuracy; + u16_t interval; + u16_t latency; + u16_t supv_timeout; + u8_t clock_accuracy; } __packed; #define BT_HCI_EVT_LE_ADVERTISING_REPORT 0x02 -struct bt_hci_ev_le_advertising_info { - u8_t evt_type; +struct bt_hci_evt_le_advertising_info { + u8_t evt_type; bt_addr_le_t addr; - u8_t length; - u8_t data[0]; + u8_t length; + u8_t data[0]; } __packed; -struct bt_hci_ev_le_advertising_report { +struct bt_hci_evt_le_advertising_report { u8_t num_reports; - struct bt_hci_ev_le_advertising_info adv_info[0]; + struct bt_hci_evt_le_advertising_info adv_info[0]; } __packed; #define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE 0x03 @@ -1505,7 +1505,7 @@ struct bt_hci_evt_le_conn_update_complete { } __packed; #define BT_HCI_EV_LE_REMOTE_FEAT_COMPLETE 0x04 -struct bt_hci_ev_le_remote_feat_complete { +struct bt_hci_evt_le_remote_feat_complete { u8_t status; u16_t handle; u8_t features[8]; @@ -1550,28 +1550,28 @@ struct bt_hci_evt_le_generate_dhkey_complete { #define BT_HCI_EVT_LE_ENH_CONN_COMPLETE 0x0a struct bt_hci_evt_le_enh_conn_complete { - u8_t status; - u16_t handle; - u8_t role; + u8_t status; + u16_t handle; + u8_t role; bt_addr_le_t peer_addr; bt_addr_t local_rpa; bt_addr_t peer_rpa; - u16_t interval; - u16_t latency; - u16_t supv_timeout; - u8_t clock_accuracy; + u16_t interval; + u16_t latency; + u16_t supv_timeout; + u8_t clock_accuracy; } __packed; #define BT_HCI_EVT_LE_DIRECT_ADV_REPORT 0x0b -struct bt_hci_ev_le_direct_adv_info { - u8_t evt_type; +struct bt_hci_evt_le_direct_adv_info { + u8_t evt_type; bt_addr_le_t dir_addr; bt_addr_le_t addr; - s8_t rssi; + s8_t rssi; } __packed; -struct bt_hci_ev_le_direct_adv_report { +struct bt_hci_evt_le_direct_adv_report { u8_t num_reports; - struct bt_hci_ev_le_direct_adv_info direct_adv_info[0]; + struct bt_hci_evt_le_direct_adv_info direct_adv_info[0]; } __packed; #define BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE 0x0c @@ -1583,64 +1583,64 @@ struct bt_hci_evt_le_phy_update_complete { } __packed; #define BT_HCI_EVT_LE_EXT_ADVERTISING_REPORT 0x0d -struct bt_hci_ev_le_ext_advertising_info { - u8_t evt_type; +struct bt_hci_evt_le_ext_advertising_info { + u8_t evt_type; bt_addr_le_t addr; - u8_t prim_phy; - u8_t sec_phy; - u8_t sid; - s8_t tx_power; - s8_t rssi; - u16_t interval; + u8_t prim_phy; + u8_t sec_phy; + u8_t sid; + s8_t tx_power; + s8_t rssi; + u16_t interval; bt_addr_le_t direct_addr; - u8_t length; - u8_t data[0]; + u8_t length; + u8_t data[0]; } __packed; -struct bt_hci_ev_le_ext_advertising_report { +struct bt_hci_evt_le_ext_advertising_report { u8_t num_reports; - struct bt_hci_ev_le_ext_advertising_info adv_info[0]; + struct bt_hci_evt_le_ext_advertising_info adv_info[0]; } __packed; #define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED 0x0e struct bt_hci_evt_le_per_adv_sync_established { - u8_t status; - u16_t handle; - u8_t sid; + u8_t status; + u16_t handle; + u8_t sid; bt_addr_le_t adv_addr; - u8_t phy; - u16_t interval; - u8_t clock_accuracy; + u8_t phy; + u16_t interval; + u8_t clock_accuracy; } __packed; #define BT_HCI_EVT_LE_PER_ADVERTISING_REPORT 0x0f -struct bt_hci_ev_le_per_advertising_report { - u16_t handle; - s8_t tx_power; - s8_t rssi; - u8_t unused; - u8_t data_status; - u8_t length; - u8_t data[0]; +struct bt_hci_evt_le_per_advertising_report { + u16_t handle; + s8_t tx_power; + s8_t rssi; + u8_t unused; + u8_t data_status; + u8_t length; + u8_t data[0]; } __packed; #define BT_HCI_EVT_LE_PER_ADV_SYNC_LOST 0x10 struct bt_hci_evt_le_per_adv_sync_lost { - u16_t handle; + u16_t handle; } __packed; #define BT_HCI_EVT_LE_SCAN_TIMEOUT 0x11 #define BT_HCI_EVT_LE_ADV_SET_TERMINATED 0x12 struct bt_hci_evt_le_per_adv_set_terminated { - u8_t status; - u8_t adv_handle; - u16_t conn_handle; - u8_t num_completed_ext_adv_evts; + u8_t status; + u8_t adv_handle; + u16_t conn_handle; + u8_t num_completed_ext_adv_evts; } __packed; #define BT_HCI_EVT_LE_SCAN_REQ_RECEIVED 0x13 struct bt_hci_evt_le_scan_req_received { - u8_t handle; + u8_t handle; bt_addr_le_t addr; } __packed; @@ -1649,8 +1649,8 @@ struct bt_hci_evt_le_scan_req_received { #define BT_HCI_EVT_LE_CHAN_SEL_ALGO 0x14 struct bt_hci_evt_le_chan_sel_algo { - u16_t handle; - u8_t chan_sel_algo; + u16_t handle; + u8_t chan_sel_algo; } __packed; /* Event mask bits */ diff --git a/include/bluetooth/l2cap.h b/include/bluetooth/l2cap.h index addbc11192711..64405b852c2c9 100644 --- a/include/bluetooth/l2cap.h +++ b/include/bluetooth/l2cap.h @@ -116,7 +116,7 @@ struct bt_l2cap_le_chan { struct net_buf *tx_buf; /** Segment SDU packet from upper layer */ struct net_buf *_sdu; - u16_t _sdu_len; + u16_t _sdu_len; }; /** @def BT_L2CAP_LE_CHAN(_ch) @@ -215,7 +215,7 @@ struct bt_l2cap_chan_ops { /** @brief L2CAP Server structure. */ struct bt_l2cap_server { /** Server PSM */ - u16_t psm; + u16_t psm; /** Required minimim security level */ bt_security_t sec_level; diff --git a/include/bluetooth/rfcomm.h b/include/bluetooth/rfcomm.h index 560d28c036a9b..20591a6fa2857 100644 --- a/include/bluetooth/rfcomm.h +++ b/include/bluetooth/rfcomm.h @@ -90,10 +90,10 @@ struct bt_rfcomm_dlc { bt_security_t required_sec_level; bt_rfcomm_role_t role; - u16_t mtu; - u8_t dlci; - u8_t state; - u8_t rx_credit; + u16_t mtu; + u8_t dlci; + u8_t state; + u8_t rx_credit; /* Stack for TX fiber */ BT_STACK(stack, 256); diff --git a/include/bluetooth/sdp.h b/include/bluetooth/sdp.h index b9b18cebdf100..35372f88010ef 100644 --- a/include/bluetooth/sdp.h +++ b/include/bluetooth/sdp.h @@ -119,31 +119,31 @@ extern "C" { * Possible values for attribute-id are listed below. * See SDP Spec, section "Service Attribute Definitions" for more details. */ -#define BT_SDP_ATTR_RECORD_HANDLE 0x0000 -#define BT_SDP_ATTR_SVCLASS_ID_LIST 0x0001 -#define BT_SDP_ATTR_RECORD_STATE 0x0002 -#define BT_SDP_ATTR_SERVICE_ID 0x0003 -#define BT_SDP_ATTR_PROTO_DESC_LIST 0x0004 -#define BT_SDP_ATTR_BROWSE_GRP_LIST 0x0005 -#define BT_SDP_ATTR_LANG_BASE_ATTR_ID_LIST 0x0006 -#define BT_SDP_ATTR_SVCINFO_TTL 0x0007 -#define BT_SDP_ATTR_SERVICE_AVAILABILITY 0x0008 -#define BT_SDP_ATTR_PROFILE_DESC_LIST 0x0009 -#define BT_SDP_ATTR_DOC_URL 0x000a -#define BT_SDP_ATTR_CLNT_EXEC_URL 0x000b -#define BT_SDP_ATTR_ICON_URL 0x000c -#define BT_SDP_ATTR_ADD_PROTO_DESC_LIST 0x000d - -#define BT_SDP_ATTR_GROUP_ID 0x0200 -#define BT_SDP_ATTR_IP_SUBNET 0x0200 -#define BT_SDP_ATTR_VERSION_NUM_LIST 0x0200 -#define BT_SDP_ATTR_SUPPORTED_FEATURES_LIST 0x0200 -#define BT_SDP_ATTR_GOEP_L2CAP_PSM 0x0200 -#define BT_SDP_ATTR_SVCDB_STATE 0x0201 - -#define BT_SDP_ATTR_MPSD_SCENARIOS 0x0200 -#define BT_SDP_ATTR_MPMD_SCENARIOS 0x0201 -#define BT_SDP_ATTR_MPS_DEPENDENCIES 0x0202 +#define BT_SDP_ATTR_RECORD_HANDLE 0x0000 +#define BT_SDP_ATTR_SVCLASS_ID_LIST 0x0001 +#define BT_SDP_ATTR_RECORD_STATE 0x0002 +#define BT_SDP_ATTR_SERVICE_ID 0x0003 +#define BT_SDP_ATTR_PROTO_DESC_LIST 0x0004 +#define BT_SDP_ATTR_BROWSE_GRP_LIST 0x0005 +#define BT_SDP_ATTR_LANG_BASE_ATTR_ID_LIST 0x0006 +#define BT_SDP_ATTR_SVCINFO_TTL 0x0007 +#define BT_SDP_ATTR_SERVICE_AVAILABILITY 0x0008 +#define BT_SDP_ATTR_PROFILE_DESC_LIST 0x0009 +#define BT_SDP_ATTR_DOC_URL 0x000a +#define BT_SDP_ATTR_CLNT_EXEC_URL 0x000b +#define BT_SDP_ATTR_ICON_URL 0x000c +#define BT_SDP_ATTR_ADD_PROTO_DESC_LIST 0x000d + +#define BT_SDP_ATTR_GROUP_ID 0x0200 +#define BT_SDP_ATTR_IP_SUBNET 0x0200 +#define BT_SDP_ATTR_VERSION_NUM_LIST 0x0200 +#define BT_SDP_ATTR_SUPPORTED_FEATURES_LIST 0x0200 +#define BT_SDP_ATTR_GOEP_L2CAP_PSM 0x0200 +#define BT_SDP_ATTR_SVCDB_STATE 0x0201 + +#define BT_SDP_ATTR_MPSD_SCENARIOS 0x0200 +#define BT_SDP_ATTR_MPMD_SCENARIOS 0x0201 +#define BT_SDP_ATTR_MPS_DEPENDENCIES 0x0202 #define BT_SDP_ATTR_SERVICE_VERSION 0x0300 #define BT_SDP_ATTR_EXTERNAL_NETWORK 0x0301 @@ -176,28 +176,28 @@ extern "C" { #define BT_SDP_ATTR_PBAP_SUPPORTED_FEATURES 0x0317 #define BT_SDP_ATTR_MAP_SUPPORTED_FEATURES 0x0317 -#define BT_SDP_ATTR_SPECIFICATION_ID 0x0200 -#define BT_SDP_ATTR_VENDOR_ID 0x0201 -#define BT_SDP_ATTR_PRODUCT_ID 0x0202 -#define BT_SDP_ATTR_VERSION 0x0203 -#define BT_SDP_ATTR_PRIMARY_RECORD 0x0204 -#define BT_SDP_ATTR_VENDOR_ID_SOURCE 0x0205 - -#define BT_SDP_ATTR_HID_DEVICE_RELEASE_NUMBER 0x0200 -#define BT_SDP_ATTR_HID_PARSER_VERSION 0x0201 -#define BT_SDP_ATTR_HID_DEVICE_SUBCLASS 0x0202 -#define BT_SDP_ATTR_HID_COUNTRY_CODE 0x0203 -#define BT_SDP_ATTR_HID_VIRTUAL_CABLE 0x0204 -#define BT_SDP_ATTR_HID_RECONNECT_INITIATE 0x0205 -#define BT_SDP_ATTR_HID_DESCRIPTOR_LIST 0x0206 -#define BT_SDP_ATTR_HID_LANG_ID_BASE_LIST 0x0207 -#define BT_SDP_ATTR_HID_SDP_DISABLE 0x0208 -#define BT_SDP_ATTR_HID_BATTERY_POWER 0x0209 -#define BT_SDP_ATTR_HID_REMOTE_WAKEUP 0x020a -#define BT_SDP_ATTR_HID_PROFILE_VERSION 0x020b -#define BT_SDP_ATTR_HID_SUPERVISION_TIMEOUT 0x020c -#define BT_SDP_ATTR_HID_NORMALLY_CONNECTABLE 0x020d -#define BT_SDP_ATTR_HID_BOOT_DEVICE 0x020e +#define BT_SDP_ATTR_SPECIFICATION_ID 0x0200 +#define BT_SDP_ATTR_VENDOR_ID 0x0201 +#define BT_SDP_ATTR_PRODUCT_ID 0x0202 +#define BT_SDP_ATTR_VERSION 0x0203 +#define BT_SDP_ATTR_PRIMARY_RECORD 0x0204 +#define BT_SDP_ATTR_VENDOR_ID_SOURCE 0x0205 + +#define BT_SDP_ATTR_HID_DEVICE_RELEASE_NUMBER 0x0200 +#define BT_SDP_ATTR_HID_PARSER_VERSION 0x0201 +#define BT_SDP_ATTR_HID_DEVICE_SUBCLASS 0x0202 +#define BT_SDP_ATTR_HID_COUNTRY_CODE 0x0203 +#define BT_SDP_ATTR_HID_VIRTUAL_CABLE 0x0204 +#define BT_SDP_ATTR_HID_RECONNECT_INITIATE 0x0205 +#define BT_SDP_ATTR_HID_DESCRIPTOR_LIST 0x0206 +#define BT_SDP_ATTR_HID_LANG_ID_BASE_LIST 0x0207 +#define BT_SDP_ATTR_HID_SDP_DISABLE 0x0208 +#define BT_SDP_ATTR_HID_BATTERY_POWER 0x0209 +#define BT_SDP_ATTR_HID_REMOTE_WAKEUP 0x020a +#define BT_SDP_ATTR_HID_PROFILE_VERSION 0x020b +#define BT_SDP_ATTR_HID_SUPERVISION_TIMEOUT 0x020c +#define BT_SDP_ATTR_HID_NORMALLY_CONNECTABLE 0x020d +#define BT_SDP_ATTR_HID_BOOT_DEVICE 0x020e /* * These identifiers are based on the SDP spec stating that @@ -271,9 +271,9 @@ extern "C" { /** @brief SDP Generic Data Element Value. */ struct bt_sdp_data_elem { - u8_t type; - u32_t data_size; - u32_t total_size; + u8_t type; + u32_t data_size; + u32_t total_size; const void *data; }; @@ -285,10 +285,10 @@ struct bt_sdp_attribute { /** @brief SDP Service Record Value. */ struct bt_sdp_record { - u32_t handle; /* Redundant, for quick ref */ + u32_t handle; /* Redundant, for quick ref */ struct bt_sdp_attribute *attrs; /* Base addr of attr array */ size_t attr_count; /* Number of attributes */ - u8_t index; /* Index of the record in LL */ + u8_t index; /* Index of the record in LL */ struct bt_sdp_record *next; }; diff --git a/misc/Kconfig b/misc/Kconfig index 134d675d11af6..610861d44ed48 100644 --- a/misc/Kconfig +++ b/misc/Kconfig @@ -150,128 +150,6 @@ config KERNEL_BIN_NAME endmenu -menu "Debugging Options" - -config DEBUG - bool "Build kernel with debugging enabled" - default n - help - Build a kernel suitable for debugging. Right now, this option - only disables optimization, more debugging variants can be selected - from here to allow more debugging. - -config STACK_USAGE - bool "Generate stack usage information" - default n - help - Generate an extra file that specifies the maximum amount of stack used, - on a per-function basis. - -config PRINTK - bool - prompt "Send printk() to console" - depends on CONSOLE_HAS_DRIVER - default y - help - This option directs printk() debugging output to the supported - console device, rather than suppressing the generation - of printk() output entirely. Output is sent immediately, without - any mutual exclusion or buffering. - -config STDOUT_CONSOLE - bool - prompt "Send stdout to console" - depends on CONSOLE_HAS_DRIVER - default n - help - This option directs standard output (e.g. printf) to the console - device, rather than suppressing it entirely. - -config EARLY_CONSOLE - bool - prompt "Send stdout at the earliest stage possible" - default n - help - This option will enable stdout as early as possible, for debugging - purpose. For instance, in case of STDOUT_CONSOLE being set it will - initialize its driver earlier than normal, in order to get the stdout - sent through the console at the earliest stage possible. - -config ASSERT - bool - prompt "Enable __ASSERT() macro" - default n - help - This enables the __ASSERT() macro in the kernel code. If an assertion - fails, the calling thread is put on an infinite tight loop. Since - enabling this adds a significant footprint, it should only be enabled - in a non-production system. - -config ASSERT_LEVEL - int - prompt "__ASSERT() level" - default 2 - range 0 2 - depends on ASSERT - help - This option specifies the assertion level used by the __ASSERT() - macro. It can be set to one of three possible values: - - Level 0: off - Level 1: on + warning in every file that includes __assert.h - Level 2: on + no warning - -config DEBUG_TRACING_KERNEL_OBJECTS - bool "Kernel object tracing (deprecated)" - select OBJECT_TRACING - default n - help - For backward compatibility only - -config OBJECT_TRACING - bool - prompt "Kernel object tracing" - default n - help - This option enable the feature for tracing kernel objects. This option - is for debug purposes and increases the memory footprint of the kernel. - -config OVERRIDE_FRAME_POINTER_DEFAULT - bool - prompt "Override compiler defaults for -fomit-frame-pointer" - default n - help - Omitting the frame pointer prevents the compiler from putting the stack - frame pointer into a register. Saves a few instructions in function - prologues/epilogues and frees up a register for general-purpose use, - which can provide good performance improvements on register-constrained - architectures like x86. On some architectures (including x86) omitting - frame pointers impedes debugging as local variables are harder to - locate. At -O1 and above gcc will enable -fomit-frame-pointer - automatically but only if the architecture does not require if for - effective debugging. - - Choose Y if you want to override the default frame pointer behavior - of your compiler, otherwise choose N. - -config OMIT_FRAME_POINTER - bool - prompt "Omit frame pointer" - default n - depends on OVERRIDE_FRAME_POINTER_DEFAULT - help - Choose Y for best performance. On some architectures (including x86) - this will favor code size and performance over debugability. - - Choose N in you wish to retain the frame pointer. This option may - be useful if your application uses runtime backtracing and does not - support parsing unwind tables. - - If unsure, disable OVERRIDE_FRAME_POINTER_DEFAULT to allow the compiler - to adopt sensible defaults for your architecture. - -endmenu - menu "System Monitoring Options" config PERFORMANCE_METRICS diff --git a/samples/drivers/gpio/src/main.c b/samples/drivers/gpio/src/main.c index 8a19726bb1fb9..07ce642339d32 100644 --- a/samples/drivers/gpio/src/main.c +++ b/samples/drivers/gpio/src/main.c @@ -114,7 +114,7 @@ #define GPIO_OUT_PIN 16 #define GPIO_INT_PIN 19 #define GPIO_NAME "GPIO_" -#elif defined(CONFIG_SOC_ATMEL_SAM3) +#elif defined(CONFIG_SOC_PART_NUMBER_SAM3X8E) #define GPIO_OUT_PIN 25 #define GPIO_INT_PIN 27 #define GPIO_NAME "GPIO_" diff --git a/samples/drivers/lcd_hd44780/src/main.c b/samples/drivers/lcd_hd44780/src/main.c index 1ed57a7a5d10f..4b015bea08f51 100644 --- a/samples/drivers/lcd_hd44780/src/main.c +++ b/samples/drivers/lcd_hd44780/src/main.c @@ -71,13 +71,13 @@ #include -#if defined(CONFIG_GPIO_ATMEL_SAM3) +#if defined(CONFIG_SOC_PART_NUMBER_SAM3X8E) #define GPIO_DRV_NAME CONFIG_GPIO_ATMEL_SAM3_PORTC_DEV_NAME #else #error "Unsupported GPIO driver" #endif -#if defined(CONFIG_SOC_ATMEL_SAM3) +#if defined(CONFIG_SOC_PART_NUMBER_SAM3X8E) /* Define GPIO OUT to LCD */ #define GPIO_PIN_PC12_D0 12 /* PC12 - pin 51 */ #define GPIO_PIN_PC13_D1 13 /* PC13 - pin 50 */ diff --git a/samples/drivers/lcd_hd44780/testcase.ini b/samples/drivers/lcd_hd44780/testcase.ini index c0d4933d98dc5..b19ec92a78879 100644 --- a/samples/drivers/lcd_hd44780/testcase.ini +++ b/samples/drivers/lcd_hd44780/testcase.ini @@ -1,5 +1,5 @@ [test] tags = samples build_only = true -filter = CONFIG_SOC_ATMEL_SAM3 +filter = CONFIG_SOC_SERIES_SAM3 diff --git a/subsys/bluetooth/controller/hal/ccm.h b/subsys/bluetooth/controller/hal/ccm.h index 54abc4fab32d7..c3b3949e37d4e 100644 --- a/subsys/bluetooth/controller/hal/ccm.h +++ b/subsys/bluetooth/controller/hal/ccm.h @@ -9,11 +9,11 @@ #define _CCM_H_ struct ccm { - u8_t key[16]; + u8_t key[16]; u64_t counter; - u8_t direction:1; - u8_t resv1:7; - u8_t iv[8]; + u8_t direction:1; + u8_t resv1:7; + u8_t iv[8]; } __packed; #endif /* _CCM_H_ */ diff --git a/subsys/bluetooth/controller/hal/ecb.h b/subsys/bluetooth/controller/hal/ecb.h index 522fd177199b5..92e47267e3b0b 100644 --- a/subsys/bluetooth/controller/hal/ecb.h +++ b/subsys/bluetooth/controller/hal/ecb.h @@ -8,28 +8,24 @@ #ifndef _ECB_H_ #define _ECB_H_ -typedef void (*ecb_fp) (u32_t status, u8_t *cipher_be, - void *context); +typedef void (*ecb_fp) (u32_t status, u8_t *cipher_be, void *context); struct ecb { - u8_t in_key_be[16]; - u8_t in_clear_text_be[16]; - u8_t out_cipher_text_be[16]; + u8_t in_key_be[16]; + u8_t in_clear_text_be[16]; + u8_t out_cipher_text_be[16]; /* if not null reverse copy into in_key_be */ - u8_t *in_key_le; + u8_t *in_key_le; /* if not null reverse copy into in_clear_text_be */ - u8_t *in_clear_text_le; + u8_t *in_clear_text_le; ecb_fp fp_ecb; - void *context; + void *context; }; -void ecb_encrypt_be(u8_t const *const key_be, - u8_t const *const clear_text_be, +void ecb_encrypt_be(u8_t const *const key_be, u8_t const *const clear_text_be, u8_t * const cipher_text_be); -void ecb_encrypt(u8_t const *const key_le, - u8_t const *const clear_text_le, - u8_t * const cipher_text_le, - u8_t * const cipher_text_be); +void ecb_encrypt(u8_t const *const key_le, u8_t const *const clear_text_le, + u8_t * const cipher_text_le, u8_t * const cipher_text_be); u32_t ecb_encrypt_nonblocking(struct ecb *ecb); void isr_ecb(void *param); diff --git a/subsys/bluetooth/controller/hal/nrf5/ecb.c b/subsys/bluetooth/controller/hal/nrf5/ecb.c index ddf5fd3d09c5d..2717feeea02ec 100644 --- a/subsys/bluetooth/controller/hal/nrf5/ecb.c +++ b/subsys/bluetooth/controller/hal/nrf5/ecb.c @@ -40,8 +40,7 @@ static void do_ecb(struct ecb_param *ecb) NRF_ECB->ECBDATAPTR = 0; } -void ecb_encrypt_be(u8_t const *const key_be, - u8_t const *const clear_text_be, +void ecb_encrypt_be(u8_t const *const key_be, u8_t const *const clear_text_be, u8_t * const cipher_text_be) { struct ecb_param ecb; @@ -54,10 +53,8 @@ void ecb_encrypt_be(u8_t const *const key_be, memcpy(cipher_text_be, &ecb.cipher_text[0], sizeof(ecb.cipher_text)); } -void ecb_encrypt(u8_t const *const key_le, - u8_t const *const clear_text_le, - u8_t * const cipher_text_le, - u8_t * const cipher_text_be) +void ecb_encrypt(u8_t const *const key_le, u8_t const *const clear_text_le, + u8_t * const cipher_text_le, u8_t * const cipher_text_be) { struct ecb_param ecb; @@ -144,7 +141,7 @@ void isr_ecb(void *param) struct ecb_ut_context { u32_t volatile done; u32_t status; - u8_t cipher_text[16]; + u8_t cipher_text[16]; }; static void ecb_cb(u32_t status, u8_t *cipher_be, void *context) @@ -162,12 +159,11 @@ static void ecb_cb(u32_t status, u8_t *cipher_be, void *context) u32_t ecb_ut(void) { - u8_t key[16] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, - 0x11, 0x22, 0x33, 0x44, 0x55 }; - u8_t clear_text[16] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, - 0x11, 0x22, 0x33, 0x44, 0x55 }; + u8_t key[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, + 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; + u8_t clear_text[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, + 0x55 }; u8_t cipher_text[16]; u32_t status = 0; struct ecb ecb; diff --git a/subsys/bluetooth/controller/hal/nrf5/radio.c b/subsys/bluetooth/controller/hal/nrf5/radio.c index c203fa59a8954..e7c9a9c07e2e7 100644 --- a/subsys/bluetooth/controller/hal/nrf5/radio.c +++ b/subsys/bluetooth/controller/hal/nrf5/radio.c @@ -94,31 +94,41 @@ void radio_aa_set(u8_t *aa) NRF_RADIO->BASE0 = (aa[2] << 24) | (aa[1] << 16) | (aa[0] << 8); } -void radio_pkt_configure(u8_t preamble16, u8_t bits_len, u8_t max_len) +void radio_pkt_configure(u8_t bits_len, u8_t max_len, u8_t flags) { + u8_t p16 = (flags >> 1) & 0x01; /* 16-bit preamble */ + u8_t dc = flags & 0x01; /* Adv or Data channel */ + u32_t extra; + #if defined(CONFIG_SOC_SERIES_NRF51X) - ARG_UNUSED(preamble16); + ARG_UNUSED(p16); + + extra = 0; - if (bits_len == 8) { + /* nRF51 supports only 27 byte PDU when using h/w CCM for encryption. */ + if (dc) { bits_len = 5; } -#endif +#else /* !CONFIG_SOC_SERIES_NRF51X */ + extra = (((p16) ? RADIO_PCNF0_PLEN_16bit : RADIO_PCNF0_PLEN_8bit) << + RADIO_PCNF0_PLEN_Pos) & RADIO_PCNF0_PLEN_Msk; + + /* To use same Data Channel PDU structure with nRF5 specific overhead + * byte, include the S1 field in radio packet configuration. + */ + if (dc) { + extra |= (RADIO_PCNF0_S1INCL_Include << + RADIO_PCNF0_S1INCL_Pos) & RADIO_PCNF0_S1INCL_Msk; + } +#endif /* !CONFIG_SOC_SERIES_NRF51X */ - NRF_RADIO->PCNF0 = ((((1UL) << RADIO_PCNF0_S0LEN_Pos) & - RADIO_PCNF0_S0LEN_Msk) | - ((((u32_t)bits_len) << RADIO_PCNF0_LFLEN_Pos) & - RADIO_PCNF0_LFLEN_Msk) | -#if !defined(CONFIG_SOC_SERIES_NRF51X) - (((RADIO_PCNF0_S1INCL_Include) << - RADIO_PCNF0_S1INCL_Pos) & - RADIO_PCNF0_S1INCL_Msk) | - ((((preamble16) ? RADIO_PCNF0_PLEN_16bit : - RADIO_PCNF0_PLEN_8bit) << RADIO_PCNF0_PLEN_Pos) & - RADIO_PCNF0_PLEN_Msk) | -#endif - ((((u32_t)8-bits_len) << - RADIO_PCNF0_S1LEN_Pos) & - RADIO_PCNF0_S1LEN_Msk)); + NRF_RADIO->PCNF0 = (((1UL) << RADIO_PCNF0_S0LEN_Pos) & + RADIO_PCNF0_S0LEN_Msk) | + ((((u32_t)bits_len) << RADIO_PCNF0_LFLEN_Pos) & + RADIO_PCNF0_LFLEN_Msk) | + ((((u32_t)8-bits_len) << RADIO_PCNF0_S1LEN_Pos) & + RADIO_PCNF0_S1LEN_Msk) | + extra; NRF_RADIO->PCNF1 = (((((u32_t)max_len) << RADIO_PCNF1_MAXLEN_Pos) & RADIO_PCNF1_MAXLEN_Msk) | @@ -261,9 +271,8 @@ u32_t radio_rssi_is_ready(void) return NRF_RADIO->EVENTS_RSSIEND; } -void radio_filter_configure(u8_t bitmask_enable, - u8_t bitmask_addr_type, - u8_t *bdaddr) +void radio_filter_configure(u8_t bitmask_enable, u8_t bitmask_addr_type, + u8_t *bdaddr) { u8_t index; diff --git a/subsys/bluetooth/controller/hal/radio.h b/subsys/bluetooth/controller/hal/radio.h index afe3d63c70215..d66e26995ee67 100644 --- a/subsys/bluetooth/controller/hal/radio.h +++ b/subsys/bluetooth/controller/hal/radio.h @@ -31,7 +31,7 @@ void radio_tx_power_set(u32_t power); void radio_freq_chan_set(u32_t chan); void radio_whiten_iv_set(u32_t iv); void radio_aa_set(u8_t *aa); -void radio_pkt_configure(u8_t preamble16, u8_t bits_len, u8_t max_len); +void radio_pkt_configure(u8_t bits_len, u8_t max_len, u8_t flags); void radio_pkt_rx_set(void *rx_packet); void radio_pkt_tx_set(void *tx_packet); void radio_rx_enable(void); @@ -59,9 +59,8 @@ u32_t radio_rssi_get(void); void radio_rssi_status_reset(void); u32_t radio_rssi_is_ready(void); -void radio_filter_configure(u8_t bitmask_enable, - u8_t bitmask_addr_type, - u8_t *bdaddr); +void radio_filter_configure(u8_t bitmask_enable, u8_t bitmask_addr_type, + u8_t *bdaddr); void radio_filter_disable(void); void radio_filter_status_reset(void); u32_t radio_filter_has_match(void); diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index aea30c9c6d2c5..4709057d9218d 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -38,8 +38,8 @@ static u16_t _opcode; #if CONFIG_BLUETOOTH_CONTROLLER_DUP_FILTER_LEN > 0 /* Scan duplicate filter */ struct dup { - u8_t mask; - bt_addr_le_t addr; + u8_t mask; + bt_addr_le_t addr; }; static struct dup dup_filter[CONFIG_BLUETOOTH_CONTROLLER_DUP_FILTER_LEN]; static s32_t dup_count; @@ -273,7 +273,7 @@ static void read_bd_addr(struct net_buf *buf, struct net_buf **evt) rp = cmd_complete(evt, sizeof(*rp)); rp->status = 0x00; - ll_address_get(0, &rp->bdaddr.val[0]); + ll_addr_get(0, &rp->bdaddr.val[0]); } static int info_cmd_handle(u8_t ocf, struct net_buf *cmd, @@ -345,7 +345,7 @@ static void le_set_random_address(struct net_buf *buf, struct net_buf **evt) struct bt_hci_cp_le_set_random_address *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - ll_address_set(1, &cmd->bdaddr.val[0]); + ll_addr_set(1, &cmd->bdaddr.val[0]); ccst = cmd_complete(evt, sizeof(*ccst)); ccst->status = 0x00; @@ -355,14 +355,11 @@ static void le_set_adv_param(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_set_adv_param *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - u8_t const c_adv_type[] = { - PDU_ADV_TYPE_ADV_IND, PDU_ADV_TYPE_DIRECT_IND, - PDU_ADV_TYPE_SCAN_IND, PDU_ADV_TYPE_NONCONN_IND }; u16_t min_interval; min_interval = sys_le16_to_cpu(cmd->min_interval); - ll_adv_params_set(min_interval, c_adv_type[cmd->type], + ll_adv_params_set(min_interval, cmd->type, cmd->own_addr_type, cmd->direct_addr.type, &cmd->direct_addr.a.val[0], cmd->channel_map, cmd->filter_policy); @@ -1003,10 +1000,10 @@ static void le_advertising_report(struct pdu_data *pdu_data, u8_t *b, struct net_buf *buf) { const u8_t c_adv_type[] = { 0x00, 0x01, 0x03, 0xff, 0x04, - 0xff, 0x02 }; - struct bt_hci_ev_le_advertising_report *sep; + 0xff, 0x02 }; + struct bt_hci_evt_le_advertising_report *sep; struct pdu_adv *adv = (struct pdu_adv *)pdu_data; - struct bt_hci_ev_le_advertising_info *adv_info; + struct bt_hci_evt_le_advertising_info *adv_info; u8_t data_len; u8_t *rssi; u8_t info_len; @@ -1063,7 +1060,7 @@ static void le_advertising_report(struct pdu_data *pdu_data, u8_t *b, data_len = 0; } - info_len = sizeof(struct bt_hci_ev_le_advertising_info) + data_len + + info_len = sizeof(struct bt_hci_evt_le_advertising_info) + data_len + sizeof(*rssi); sep = meta_evt(buf, BT_HCI_EVT_LE_ADVERTISING_REPORT, sizeof(*sep) + info_len); @@ -1275,7 +1272,7 @@ static void encode_control(struct radio_pdu_node_rx *node_rx, } static void le_ltk_request(struct pdu_data *pdu_data, u16_t handle, - struct net_buf *buf) + struct net_buf *buf) { struct bt_hci_evt_le_ltk_request *sep; @@ -1313,7 +1310,7 @@ static void encrypt_change(u8_t err, u16_t handle, static void le_remote_feat_complete(u8_t status, struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { - struct bt_hci_ev_le_remote_feat_complete *sep; + struct bt_hci_evt_le_remote_feat_complete *sep; if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) || !(le_event_mask & BT_EVT_MASK_LE_REMOTE_FEAT_COMPLETE)) { diff --git a/subsys/bluetooth/controller/include/ll.h b/subsys/bluetooth/controller/include/ll.h index 6d7e3e932daf7..e67f0cec140b7 100644 --- a/subsys/bluetooth/controller/include/ll.h +++ b/subsys/bluetooth/controller/include/ll.h @@ -10,8 +10,8 @@ int ll_init(struct k_sem *sem_rx); void ll_reset(void); -void ll_address_get(u8_t addr_type, u8_t *p_bdaddr); -void ll_address_set(u8_t addr_type, u8_t const *const p_bdaddr); +u8_t *ll_addr_get(u8_t addr_type, u8_t *p_bdaddr); +void ll_addr_set(u8_t addr_type, u8_t const *const p_bdaddr); void ll_adv_params_set(u16_t interval, u8_t adv_type, u8_t own_addr_type, u8_t direct_addr_type, u8_t const *const p_direct_addr, u8_t chl_map, @@ -29,20 +29,20 @@ u32_t ll_filter_remove(u8_t addr_type, u8_t *addr); void ll_irk_clear(void); u32_t ll_irk_add(u8_t *irk); u32_t ll_create_connection(u16_t scan_interval, u16_t scan_window, - u8_t filter_policy, u8_t peer_addr_type, - u8_t *p_peer_addr, u8_t own_addr_type, - u16_t interval, u16_t latency, - u16_t timeout); + u8_t filter_policy, u8_t peer_addr_type, + u8_t *p_peer_addr, u8_t own_addr_type, + u16_t interval, u16_t latency, + u16_t timeout); u32_t ll_connect_disable(void); u32_t ll_conn_update(u16_t handle, u8_t cmd, u8_t status, - u16_t interval, u16_t latency, - u16_t timeout); + u16_t interval, u16_t latency, + u16_t timeout); u32_t ll_chm_update(u8_t *chm); u32_t ll_chm_get(u16_t handle, u8_t *chm); u32_t ll_enc_req_send(u16_t handle, u8_t *rand, u8_t *ediv, - u8_t *ltk); + u8_t *ltk); u32_t ll_start_enc_req_send(u16_t handle, u8_t err_code, - u8_t const *const ltk); + u8_t const *const ltk); u32_t ll_feature_req_send(u16_t handle); u32_t ll_version_ind_send(u16_t handle); u32_t ll_terminate_ind_send(u16_t handle, u8_t reason); @@ -52,7 +52,7 @@ u32_t ll_length_req_send(u16_t handle, u16_t tx_octets); void ll_length_default_get(u16_t *max_tx_octets, u16_t *max_tx_time); u32_t ll_length_default_set(u16_t max_tx_octets, u16_t max_tx_time); void ll_length_max_get(u16_t *max_tx_octets, u16_t *max_tx_time, - u16_t *max_rx_octets, u16_t *max_rx_time); + u16_t *max_rx_octets, u16_t *max_rx_time); #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ #endif /* _LL_H_ */ diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.c b/subsys/bluetooth/controller/ll_sw/ctrl.c index e622360b2dfa7..b9eb36d84b004 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.c +++ b/subsys/bluetooth/controller/ll_sw/ctrl.c @@ -97,20 +97,20 @@ struct advertiser { struct observer { struct shdr hdr; - u8_t scan_type:1; - u8_t scan_state:1; - u8_t scan_chan:2; - u8_t filter_policy:2; - u8_t adv_addr_type:1; - u8_t init_addr_type:1; - - u8_t adv_addr[BDADDR_SIZE]; - u8_t init_addr[BDADDR_SIZE]; + u8_t scan_type:1; + u8_t scan_state:1; + u8_t scan_chan:2; + u8_t filter_policy:2; + u8_t adv_addr_type:1; + u8_t init_addr_type:1; + + u8_t adv_addr[BDADDR_SIZE]; + u8_t init_addr[BDADDR_SIZE]; u32_t ticks_window; - u8_t filter_enable_bitmask; - u8_t filter_addr_type_bitmask; - u8_t filter_bdaddr[8][BDADDR_SIZE]; + u8_t filter_enable_bitmask; + u8_t filter_addr_type_bitmask; + u8_t filter_bdaddr[8][BDADDR_SIZE]; u16_t conn_interval; u16_t conn_latency; @@ -127,34 +127,34 @@ static struct { u32_t ticks_anchor; u32_t remainder_anchor; - u8_t volatile ticker_id_prepare; - u8_t volatile ticker_id_event; - u8_t volatile ticker_id_stop; + u8_t volatile ticker_id_prepare; + u8_t volatile ticker_id_event; + u8_t volatile ticker_id_stop; - enum role volatile role; - enum state state; + enum role volatile role; + enum state state; - u8_t filter_enable_bitmask; - u8_t filter_addr_type_bitmask; - u8_t filter_bdaddr[8][BDADDR_SIZE]; + u8_t filter_enable_bitmask; + u8_t filter_addr_type_bitmask; + u8_t filter_bdaddr[8][BDADDR_SIZE]; - u8_t nirk; - u8_t irk[RADIO_IRK_COUNT_MAX][16]; + u8_t nirk; + u8_t irk[RADIO_IRK_COUNT_MAX][16]; struct advertiser advertiser; struct observer observer; - void *conn_pool; - void *conn_free; - u8_t connection_count; + void *conn_pool; + void *conn_free; + u8_t connection_count; struct connection *conn_curr; - u8_t packet_counter; - u8_t crc_expire; + u8_t packet_counter; + u8_t crc_expire; - u8_t data_chan_map[5]; - u8_t data_chan_count; - u8_t sca; + u8_t data_chan_map[5]; + u8_t data_chan_count; + u8_t sca; #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) /* DLE global settings */ @@ -166,46 +166,46 @@ static struct { * Rx-es. */ /* Advertiser, Observer, and Connections Rx data pool */ - void *pkt_rx_data_pool; - void *pkt_rx_data_free; + void *pkt_rx_data_pool; + void *pkt_rx_data_free; u16_t packet_data_octets_max; u16_t packet_rx_data_pool_size; u16_t packet_rx_data_size; - u8_t packet_rx_data_count; + u8_t packet_rx_data_count; /* Free queue Rx data buffers */ struct radio_pdu_node_rx **packet_rx; - u8_t packet_rx_count; - u8_t volatile packet_rx_last; - u8_t packet_rx_acquire; + u8_t packet_rx_count; + u8_t volatile packet_rx_last; + u8_t packet_rx_acquire; /* Controller to Host event-cum-data queue */ - void *link_rx_pool; - void *link_rx_free; - void *link_rx_head; + void *link_rx_pool; + void *link_rx_free; + void *link_rx_head; - void *volatile link_rx_tail; - u8_t link_rx_data_quota; + void *volatile link_rx_tail; + u8_t link_rx_data_quota; /* Connections common Tx ctrl and data pool */ - void *pkt_tx_ctrl_pool; - void *pkt_tx_ctrl_free; - void *pkt_tx_data_pool; - void *pkt_tx_data_free; + void *pkt_tx_ctrl_pool; + void *pkt_tx_ctrl_free; + void *pkt_tx_data_pool; + void *pkt_tx_data_free; u16_t packet_tx_data_size; /* Host to Controller Tx, and Controller to Host Num complete queue */ struct pdu_data_q_tx *pkt_tx; struct pdu_data_q_tx *pkt_release; - u8_t packet_tx_count; - u8_t volatile packet_tx_first; - u8_t packet_tx_last; - u8_t packet_release_first; - u8_t volatile packet_release_last; + u8_t packet_tx_count; + u8_t volatile packet_tx_first; + u8_t packet_tx_last; + u8_t packet_release_first; + u8_t volatile packet_release_last; u16_t fc_handle[TRIPLE_BUFFER_SIZE]; - u8_t volatile fc_req; - u8_t fc_ack; - u8_t fc_ena; + u8_t volatile fc_req; + u8_t fc_ack; + u8_t fc_ena; u32_t ticks_active_to_start; @@ -229,24 +229,22 @@ static void chan_sel_2_ut(void); #endif /* CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2 */ static void adv_setup(void); -static void event_adv(u32_t ticks_at_expire, u32_t remainder, - u16_t lazy, void *context); -static void event_obs(u32_t ticks_at_expire, u32_t remainder, - u16_t lazy, void *context); -static void event_slave_prepare(u32_t ticks_at_expire, - u32_t remainder, u16_t lazy, - void *context); -static void event_slave(u32_t ticks_at_expire, u32_t remainder, - u16_t lazy, void *context); -static void event_master_prepare(u32_t ticks_at_expire, - u32_t remainder, u16_t lazy, - void *context); -static void event_master(u32_t ticks_at_expire, u32_t remainder, - u16_t lazy, void *context); +static void event_adv(u32_t ticks_at_expire, u32_t remainder, u16_t lazy, + void *context); +static void event_obs(u32_t ticks_at_expire, u32_t remainder, u16_t lazy, + void *context); +static void event_slave_prepare(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context); +static void event_slave(u32_t ticks_at_expire, u32_t remainder, u16_t lazy, + void *context); +static void event_master_prepare(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context); +static void event_master(u32_t ticks_at_expire, u32_t remainder, u16_t lazy, + void *context); static void rx_packet_set(struct connection *conn, struct pdu_data *pdu_data_rx); static void tx_packet_set(struct connection *conn, - struct pdu_data *pdu_data_tx); + struct pdu_data *pdu_data_tx); static void prepare_pdu_data_tx(struct connection *conn, struct pdu_data **pdu_data_tx); static void packet_rx_allocate(u8_t max); @@ -264,12 +262,11 @@ static void ctrl_tx_enqueue(struct connection *conn, static void pdu_node_tx_release(u16_t handle, struct radio_pdu_node_tx *node_tx); static void connection_release(struct connection *conn); -static u32_t conn_update(struct connection *conn, - struct pdu_data *pdu_data_rx); +static u32_t conn_update(struct connection *conn, struct pdu_data *pdu_data_rx); static u32_t is_peer_compatible(struct connection *conn); static u32_t conn_update_req(struct connection *conn); static u32_t chan_map_update(struct connection *conn, - struct pdu_data *pdu_data_rx); + struct pdu_data *pdu_data_rx); static void enc_req_reused_send(struct connection *conn, struct radio_pdu_node_tx *node_tx); static void terminate_ind_rx_enqueue(struct connection *conn, u8_t reason); @@ -285,28 +282,25 @@ static void version_ind_send(struct connection *conn); static void ping_resp_send(struct connection *conn); #endif /* CONFIG_BLUETOOTH_CONTROLLER_LE_PING */ -static void reject_ind_ext_send(struct connection *conn, - u8_t reject_opcode, +static void reject_ind_ext_send(struct connection *conn, u8_t reject_opcode, u8_t error_code); #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) -static void length_resp_send(struct connection *conn, - u16_t eff_rx_octets, - u16_t eff_tx_octets); +static void length_resp_send(struct connection *conn, u16_t eff_rx_octets, + u16_t eff_tx_octets); #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ -static u32_t role_disable(u8_t ticker_id_primary, - u8_t ticker_id_stop); +static u32_t role_disable(u8_t ticker_id_primary, u8_t ticker_id_stop); static void rx_fc_lock(u16_t handle); /***************************************************************************** *RADIO ****************************************************************************/ u32_t radio_init(void *hf_clock, u8_t sca, u8_t connection_count_max, - u8_t rx_count_max, u8_t tx_count_max, - u16_t packet_data_octets_max, - u16_t packet_tx_data_size, u8_t *mem_radio, - u16_t mem_size) + u8_t rx_count_max, u8_t tx_count_max, + u16_t packet_data_octets_max, + u16_t packet_tx_data_size, u8_t *mem_radio, + u16_t mem_size) { u32_t retcode; u8_t *mem_radio_end; @@ -583,7 +577,7 @@ static inline void isr_radio_state_tx(void) } static inline u32_t isr_rx_adv(u8_t devmatch_ok, u8_t irkmatch_ok, - u8_t irkmatch_id, u8_t rssi_ready) + u8_t irkmatch_id, u8_t rssi_ready) { struct pdu_adv *pdu_adv, *_pdu_adv; struct radio_pdu_node_rx *radio_pdu_node_rx; @@ -1173,7 +1167,7 @@ static inline u32_t isr_rx_obs(u8_t irkmatch_id, u8_t rssi_ready) } static inline u8_t isr_rx_conn_pkt_ack(struct pdu_data *pdu_data_tx, - struct radio_pdu_node_tx **node_tx) + struct radio_pdu_node_tx **node_tx) { u8_t terminate = 0; @@ -1394,7 +1388,7 @@ isr_rx_conn_pkt_ctrl_rej(struct radio_pdu_node_rx *radio_pdu_node_rx, #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) static inline u8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx, - u8_t *rx_enqueue) + u8_t *rx_enqueue) { u16_t eff_rx_octets; u16_t eff_tx_octets; @@ -2433,8 +2427,7 @@ static inline u32_t isr_close_adv(void) radio_filter_disable(); - pdu_adv = - (struct pdu_adv *) + pdu_adv = (struct pdu_adv *) &_radio.advertiser.adv_data.data[_radio.advertiser.adv_data.first][0]; if ((_radio.state == STATE_CLOSE) && (pdu_adv->type != PDU_ADV_TYPE_DIRECT_IND)) { @@ -3101,7 +3094,7 @@ static void mayfly_xtal_start(void *params) } static void event_xtal(u32_t ticks_at_expire, u32_t remainder, - u16_t lazy, void *context) + u16_t lazy, void *context) { static void *s_link[2]; static struct mayfly s_mfy_xtal_start = {0, 0, s_link, NULL, @@ -3210,9 +3203,8 @@ static void prepare_normal(u32_t status, void *op_context) } } -static void prepare_normal_set(struct shdr *hdr, - u8_t ticker_user_id, - u8_t ticker_id) +static void prepare_normal_set(struct shdr *hdr, u8_t ticker_user_id, + u8_t ticker_id) { if (hdr->ticks_xtal_to_start & ((u32_t)1 << 31)) { u32_t ticker_status; @@ -3237,7 +3229,7 @@ static void prepare_normal_set(struct shdr *hdr, #if (RADIO_TICKER_PREEMPT_PART_US <= RADIO_TICKER_PREEMPT_PART_MIN_US) static u32_t preempt_calc(struct shdr *hdr, u8_t ticker_id, - u32_t ticks_at_expire) + u32_t ticks_at_expire) { u32_t diff = ticker_ticks_diff_get(ticker_ticks_now_get(), ticks_at_expire); @@ -3581,11 +3573,11 @@ static void mayfly_sched_win_offset_use(void *params) } static void sched_free_win_offset_calc(struct connection *conn_curr, - u8_t is_select, - u32_t *ticks_to_offset_next, - u16_t conn_interval, - u8_t *offset_max, - u8_t *win_offset) + u8_t is_select, + u32_t *ticks_to_offset_next, + u16_t conn_interval, + u8_t *offset_max, + u8_t *win_offset) { u32_t ticks_prepare_reduced = 0; u32_t ticks_anchor; @@ -4082,9 +4074,8 @@ static u8_t chan_sel_remap(u8_t *chan_map, u8_t chan_index) return chan_next; } -static u8_t chan_sel_1(u8_t *chan_use, u8_t hop, - u16_t latency, u8_t *chan_map, - u8_t chan_count) +static u8_t chan_sel_1(u8_t *chan_use, u8_t hop, u16_t latency, u8_t *chan_map, + u8_t chan_count) { u8_t chan_next; @@ -4147,8 +4138,8 @@ static u16_t chan_prn(u16_t counter, u16_t chan_id) return prn_e; } -static u8_t chan_sel_2(u16_t counter, u16_t chan_id, - u8_t *chan_map, u8_t chan_count) +static u8_t chan_sel_2(u16_t counter, u16_t chan_id, u8_t *chan_map, + u8_t chan_count) { u8_t chan_next; u16_t prn_e; @@ -4318,7 +4309,7 @@ static void adv_obs_configure(u8_t phy) adv_obs_conn_configure(phy); radio_aa_set((u8_t *)&aa); - radio_pkt_configure(phy, 6, 37); + radio_pkt_configure(8, PDU_AC_PAYLOAD_SIZE_MAX, (phy << 1)); radio_crc_configure(((0x5bUL) | ((0x06UL) << 8) | ((0x00UL) << 16)), 0x555555); } @@ -4443,8 +4434,8 @@ static void event_adv(u32_t ticks_at_expire, u32_t remainder, DEBUG_RADIO_START_A(0); } -void event_adv_stop(u32_t ticks_at_expire, u32_t remainder, - u16_t lazy, void *context) +void event_adv_stop(u32_t ticks_at_expire, u32_t remainder, u16_t lazy, + void *context) { u32_t ticker_status; struct radio_pdu_node_rx *radio_pdu_node_rx; @@ -4553,8 +4544,8 @@ static void event_obs_prepare(u32_t ticks_at_expire, u32_t remainder, DEBUG_RADIO_PREPARE_O(0); } -static void event_obs(u32_t ticks_at_expire, u32_t remainder, - u16_t lazy, void *context) +static void event_obs(u32_t ticks_at_expire, u32_t remainder, u16_t lazy, + void *context) { u32_t ticker_status; @@ -4836,8 +4827,8 @@ static inline void event_conn_update_st_rsp(struct connection *conn, } static inline u32_t event_conn_update_prep(struct connection *conn, - u16_t event_counter, - u32_t ticks_at_expire) + u16_t event_counter, + u32_t ticks_at_expire) { struct connection *conn_upd; u16_t instant_latency; @@ -5843,8 +5834,8 @@ static void event_slave_prepare(u32_t ticks_at_expire, u32_t remainder, DEBUG_RADIO_PREPARE_S(0); } -static void event_slave(u32_t ticks_at_expire, u32_t remainder, - u16_t lazy, void *context) +static void event_slave(u32_t ticks_at_expire, u32_t remainder, u16_t lazy, + void *context) { u8_t data_chan_use = 0; struct connection *conn; @@ -5973,8 +5964,8 @@ static void event_master_prepare(u32_t ticks_at_expire, u32_t remainder, DEBUG_RADIO_PREPARE_M(0); } -static void event_master(u32_t ticks_at_expire, u32_t remainder, - u16_t lazy, void *context) +static void event_master(u32_t ticks_at_expire, u32_t remainder, u16_t lazy, + void *context) { u8_t data_chan_use = 0; struct pdu_data *pdu_data_tx; @@ -6121,19 +6112,18 @@ static void rx_packet_set(struct connection *conn, struct pdu_data *pdu_data_rx) phy = RADIO_PHY_CONN; if (conn->enc_rx) { - radio_pkt_configure(phy, 8, (max_rx_octets + 4)); + radio_pkt_configure(8, (max_rx_octets + 4), (phy << 1) | 0x01); radio_pkt_rx_set(radio_ccm_rx_pkt_set(&conn->ccm_rx, pdu_data_rx)); } else { - radio_pkt_configure(phy, 8, max_rx_octets); + radio_pkt_configure(8, max_rx_octets, (phy << 1) | 0x01); radio_pkt_rx_set(pdu_data_rx); } } -static void tx_packet_set(struct connection *conn, - struct pdu_data *pdu_data_tx) +static void tx_packet_set(struct connection *conn, struct pdu_data *pdu_data_tx) { u8_t phy; u16_t max_tx_octets; @@ -6146,12 +6136,12 @@ static void tx_packet_set(struct connection *conn, phy = RADIO_PHY_CONN; if (conn->enc_tx) { - radio_pkt_configure(phy, 8, (max_tx_octets + 4)); + radio_pkt_configure(8, (max_tx_octets + 4), (phy << 1) | 0x01); radio_pkt_tx_set(radio_ccm_tx_pkt_set(&conn->ccm_tx, pdu_data_tx)); } else { - radio_pkt_configure(phy, 8, max_tx_octets); + radio_pkt_configure(8, max_tx_octets, (phy << 1) | 0x01); radio_pkt_tx_set(pdu_data_tx); } @@ -6658,8 +6648,7 @@ static void terminate_ind_rx_enqueue(struct connection *conn, u8_t reason) packet_rx_callback(); } -static u32_t conn_update(struct connection *conn, - struct pdu_data *pdu_data_rx) +static u32_t conn_update(struct connection *conn, struct pdu_data *pdu_data_rx) { if (((pdu_data_rx->payload.llctrl.ctrldata.conn_update_ind.instant - conn->event_counter) & 0xFFFF) > 0x7FFF) { @@ -6740,7 +6729,7 @@ static u32_t conn_update_req(struct connection *conn) } static u32_t chan_map_update(struct connection *conn, - struct pdu_data *pdu_data_rx) + struct pdu_data *pdu_data_rx) { if (((pdu_data_rx->payload.llctrl.ctrldata.chan_map_ind.instant - conn->event_counter) & 0xffff) > 0x7fff) { @@ -7236,8 +7225,7 @@ static inline void role_active_disable(u8_t ticker_id_stop, } } -static u32_t role_disable(u8_t ticker_id_primary, - u8_t ticker_id_stop) +static u32_t role_disable(u8_t ticker_id_primary, u8_t ticker_id_stop) { u32_t volatile ret_cb = TICKER_STATUS_BUSY; u32_t ticks_active_to_start = 0; @@ -7324,8 +7312,7 @@ static u32_t role_disable(u8_t ticker_id_primary, return ret_cb; } -u32_t radio_adv_enable(u16_t interval, u8_t chl_map, - u8_t filter_policy) +u32_t radio_adv_enable(u16_t interval, u8_t chl_map, u8_t filter_policy) { u32_t volatile ret_cb = TICKER_STATUS_BUSY; u32_t ticks_slot_offset; @@ -7452,7 +7439,9 @@ u32_t radio_adv_enable(u16_t interval, u8_t chl_map, _radio.advertiser.hdr.ticks_xtal_to_start : _radio.advertiser.hdr.ticks_active_to_start; - if (pdu_adv->type == PDU_ADV_TYPE_DIRECT_IND) { + /* High Duty Cycle Directed Advertising if interval is 0. */ + if ((pdu_adv->type == PDU_ADV_TYPE_DIRECT_IND) && + !interval) { u32_t ticks_now = ticker_ticks_now_get(); ret = ticker_start(RADIO_TICKER_INSTANCE_ID_RADIO, @@ -7543,9 +7532,8 @@ u32_t radio_adv_disable(void) return status; } -u32_t radio_scan_enable(u8_t scan_type, u8_t init_addr_type, - u8_t *init_addr, u16_t interval, - u16_t window, u8_t filter_policy) +u32_t radio_scan_enable(u8_t scan_type, u8_t init_addr_type, u8_t *init_addr, + u16_t interval, u16_t window, u8_t filter_policy) { u32_t volatile ret_cb = TICKER_STATUS_BUSY; u32_t ticks_slot_offset; @@ -7652,9 +7640,8 @@ u32_t radio_scan_disable(void) return status; } -u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr, - u16_t interval, u16_t latency, - u16_t timeout) +u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr, u16_t interval, + u16_t latency, u16_t timeout) { void *link; struct connection *conn; @@ -7791,9 +7778,8 @@ u32_t ll_connect_disable(void) return status; } -u32_t ll_conn_update(u16_t handle, u8_t cmd, u8_t status, - u16_t interval, u16_t latency, - u16_t timeout) +u32_t ll_conn_update(u16_t handle, u8_t cmd, u8_t status, u16_t interval, + u16_t latency, u16_t timeout) { struct connection *conn; @@ -7878,8 +7864,7 @@ u32_t ll_chm_get(u16_t handle, u8_t *chm) return 0; } -u32_t ll_enc_req_send(u16_t handle, u8_t *rand, u8_t *ediv, - u8_t *ltk) +u32_t ll_enc_req_send(u16_t handle, u8_t *rand, u8_t *ediv, u8_t *ltk) { struct connection *conn; struct radio_pdu_node_tx *node_tx; @@ -7954,7 +7939,7 @@ u32_t ll_enc_req_send(u16_t handle, u8_t *rand, u8_t *ediv, } u32_t ll_start_enc_req_send(u16_t handle, u8_t error_code, - u8_t const *const ltk) + u8_t const *const ltk) { struct connection *conn; @@ -8148,8 +8133,7 @@ static u8_t tx_cmplt_get(u16_t *handle, u8_t *first, u8_t last) return cmplt; } -u8_t radio_rx_get(struct radio_pdu_node_rx **radio_pdu_node_rx, - u16_t *handle) +u8_t radio_rx_get(struct radio_pdu_node_rx **radio_pdu_node_rx, u16_t *handle) { u8_t cmplt; @@ -8316,8 +8300,7 @@ static void rx_fc_lock(u16_t handle) } } -u8_t do_radio_rx_fc_set(u16_t handle, u8_t req, - u8_t ack) +u8_t do_radio_rx_fc_set(u16_t handle, u8_t req, u8_t ack) { if (req == ack) { if (_radio.link_rx_head == _radio.link_rx_tail) { @@ -8397,8 +8380,7 @@ void radio_tx_mem_release(struct radio_pdu_node_tx *node_tx) mem_release(node_tx, &_radio.pkt_tx_data_free); } -static void ticker_op_latency_cancelled(u32_t ticker_status, - void *params) +static void ticker_op_latency_cancelled(u32_t ticker_status, void *params) { struct connection *conn; @@ -8408,8 +8390,7 @@ static void ticker_op_latency_cancelled(u32_t ticker_status, conn->role.slave.latency_cancel = 0; } -u32_t radio_tx_mem_enqueue(u16_t handle, - struct radio_pdu_node_tx *node_tx) +u32_t radio_tx_mem_enqueue(u16_t handle, struct radio_pdu_node_tx *node_tx) { u8_t last; struct connection *conn; diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.h b/subsys/bluetooth/controller/ll_sw/ctrl.h index c8080b3e0b074..c6fdb37428539 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.h +++ b/subsys/bluetooth/controller/ll_sw/ctrl.h @@ -224,21 +224,21 @@ enum radio_pdu_node_rx_type { }; struct radio_le_conn_cmplt { - u8_t status; - u8_t role; - u8_t peer_addr_type; - u8_t peer_addr[BDADDR_SIZE]; - u8_t own_addr_type; - u8_t own_addr[BDADDR_SIZE]; - u8_t peer_irk_index; + u8_t status; + u8_t role; + u8_t peer_addr_type; + u8_t peer_addr[BDADDR_SIZE]; + u8_t own_addr_type; + u8_t own_addr[BDADDR_SIZE]; + u8_t peer_irk_index; u16_t interval; u16_t latency; u16_t timeout; - u8_t mca; + u8_t mca; } __packed; struct radio_le_conn_update_cmplt { - u8_t status; + u8_t status; u16_t interval; u16_t latency; u16_t timeout; @@ -261,7 +261,7 @@ struct radio_pdu_node_rx_hdr { struct radio_pdu_node_rx { struct radio_pdu_node_rx_hdr hdr; - u8_t pdu_data[1]; + u8_t pdu_data[1]; }; /***************************************************************************** @@ -269,27 +269,27 @@ struct radio_pdu_node_rx { ****************************************************************************/ /* Downstream */ u32_t radio_init(void *hf_clock, u8_t sca, u8_t connection_count_max, - u8_t rx_count_max, u8_t tx_count_max, - u16_t packet_data_octets_max, - u16_t packet_tx_data_size, u8_t *mem_radio, - u16_t mem_size); + u8_t rx_count_max, u8_t tx_count_max, + u16_t packet_data_octets_max, + u16_t packet_tx_data_size, u8_t *mem_radio, + u16_t mem_size); void radio_ticks_active_to_start_set(u32_t ticks_active_to_start); struct radio_adv_data *radio_adv_data_get(void); struct radio_adv_data *radio_scan_data_get(void); u32_t radio_adv_enable(u16_t interval, u8_t chl_map, - u8_t filter_policy); + u8_t filter_policy); u32_t radio_adv_disable(void); u32_t radio_scan_enable(u8_t scan_type, u8_t init_addr_type, - u8_t *init_addr, u16_t interval, - u16_t window, u8_t filter_policy); + u8_t *init_addr, u16_t interval, + u16_t window, u8_t filter_policy); u32_t radio_scan_disable(void); u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr, - u16_t interval, u16_t latency, - u16_t timeout); + u16_t interval, u16_t latency, + u16_t timeout); /* Upstream */ u8_t radio_rx_get(struct radio_pdu_node_rx **radio_pdu_node_rx, - u16_t *handle); + u16_t *handle); void radio_rx_dequeue(void); void radio_rx_mem_release(struct radio_pdu_node_rx **radio_pdu_node_rx); u8_t radio_rx_fc_set(u16_t handle, u8_t fc); @@ -297,7 +297,7 @@ u8_t radio_rx_fc_get(u16_t *handle); struct radio_pdu_node_tx *radio_tx_mem_acquire(void); void radio_tx_mem_release(struct radio_pdu_node_tx *pdu_data_node_tx); u32_t radio_tx_mem_enqueue(u16_t handle, - struct radio_pdu_node_tx *pdu_data_node_tx); + struct radio_pdu_node_tx *pdu_data_node_tx); /* Callbacks */ extern void radio_active_callback(u8_t active); extern void radio_event_callback(void); diff --git a/subsys/bluetooth/controller/ll_sw/ctrl_internal.h b/subsys/bluetooth/controller/ll_sw/ctrl_internal.h index 613154d73ea6a..838c2f35edb6e 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ctrl_internal.h @@ -30,13 +30,13 @@ struct shdr { struct connection { struct shdr hdr; - u8_t access_addr[4]; - u8_t crc_init[3]; - u8_t data_chan_map[5]; + u8_t access_addr[4]; + u8_t crc_init[3]; + u8_t data_chan_map[5]; - u8_t data_chan_count:6; - u8_t data_chan_sel:1; - u8_t rfu:1; + u8_t data_chan_count:6; + u8_t data_chan_sel:1; + u8_t rfu:1; union { struct { @@ -74,13 +74,13 @@ struct connection { union { struct { - u8_t role:1; - u8_t connect_expire; + u8_t role:1; + u8_t connect_expire; } master; struct { - u8_t role:1; - u8_t sca:3; - u8_t latency_cancel:1; + u8_t role:1; + u8_t sca:3; + u8_t latency_cancel:1; u32_t window_widening_periodic_us; u32_t window_widening_max_us; u32_t window_widening_prepare_us; @@ -92,15 +92,15 @@ struct connection { } slave; } role; - u8_t llcp_req; - u8_t llcp_ack; - enum llcp llcp_type; + u8_t llcp_req; + u8_t llcp_ack; + enum llcp llcp_type; union { struct { u16_t interval; u16_t latency; u16_t timeout; - u8_t preferred_periodicity; + u8_t preferred_periodicity; u16_t instant; u16_t offset0; u16_t offset1; @@ -112,8 +112,8 @@ struct connection { u32_t ticks_to_offset_next; u32_t win_offset_us; u16_t *pdu_win_offset; - u8_t win_size; - u8_t state:3; + u8_t win_size; + u8_t state:3; #define LLCP_CONN_STATE_INPROG 0 /* master + slave proc in progress * until instant */ @@ -124,37 +124,37 @@ struct connection { #define LLCP_CONN_STATE_RSP_WAIT 5 /* master rsp or slave conn_update * or rej */ - u8_t is_internal:2; + u8_t is_internal:2; } connection_update; struct { - u8_t initiate; - u8_t chm[5]; + u8_t initiate; + u8_t chm[5]; u16_t instant; } chan_map; struct { - u8_t error_code; - u8_t rand[8]; - u8_t ediv[2]; - u8_t ltk[16]; - u8_t skd[16]; + u8_t error_code; + u8_t rand[8]; + u8_t ediv[2]; + u8_t ltk[16]; + u8_t skd[16]; } encryption; } llcp; u32_t llcp_features; struct { - u8_t tx:1; - u8_t rx:1; - u8_t version_number; + u8_t tx:1; + u8_t rx:1; + u8_t version_number; u16_t company_id; u16_t sub_version_number; } llcp_version; struct { - u8_t req; - u8_t ack; - u8_t reason_own; - u8_t reason_peer; + u8_t req; + u8_t ack; + u8_t reason_own; + u8_t reason_peer; struct { struct radio_pdu_node_rx_hdr hdr; u8_t reason; @@ -163,9 +163,9 @@ struct connection { #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) struct { - u8_t req; - u8_t ack; - u8_t state:2; + u8_t req; + u8_t ack; + u8_t state:2; #define LLCP_LENGTH_STATE_REQ 0 #define LLCP_LENGTH_STATE_ACK_WAIT 1 #define LLCP_LENGTH_STATE_RSP_WAIT 2 @@ -175,14 +175,14 @@ struct connection { } llcp_length; #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ - u8_t sn:1; - u8_t nesn:1; - u8_t pause_rx:1; - u8_t pause_tx:1; - u8_t enc_rx:1; - u8_t enc_tx:1; - u8_t refresh:1; - u8_t empty:1; + u8_t sn:1; + u8_t nesn:1; + u8_t pause_rx:1; + u8_t pause_tx:1; + u8_t enc_rx:1; + u8_t enc_tx:1; + u8_t refresh:1; + u8_t empty:1; struct ccm ccm_rx; struct ccm ccm_tx; @@ -191,19 +191,19 @@ struct connection { struct radio_pdu_node_tx *pkt_tx_ctrl; struct radio_pdu_node_tx *pkt_tx_data; struct radio_pdu_node_tx *pkt_tx_last; - u8_t packet_tx_head_len; - u8_t packet_tx_head_offset; + u8_t packet_tx_head_len; + u8_t packet_tx_head_offset; #if defined(CONFIG_BLUETOOTH_CONTROLLER_CONN_RSSI) - u8_t rssi_latest; - u8_t rssi_reported; - u8_t rssi_sample_count; + u8_t rssi_latest; + u8_t rssi_reported; + u8_t rssi_sample_count; #endif /* CONFIG_BLUETOOTH_CONTROLLER_CONN_RSSI */ }; #define CONNECTION_T_SIZE MROUND(sizeof(struct connection)) struct pdu_data_q_tx { - u16_t handle; + u16_t handle; struct radio_pdu_node_tx *node_tx; }; diff --git a/subsys/bluetooth/controller/ll_sw/ll.c b/subsys/bluetooth/controller/ll_sw/ll.c index a06bc947e3707..203149056dc2d 100644 --- a/subsys/bluetooth/controller/ll_sw/ll.c +++ b/subsys/bluetooth/controller/ll_sw/ll.c @@ -54,21 +54,21 @@ static struct { static struct { u16_t interval; - u8_t adv_type:4; - u8_t tx_addr:1; - u8_t rx_addr:1; - u8_t filter_policy:2; - u8_t chl_map:3; - u8_t adv_addr[BDADDR_SIZE]; - u8_t direct_addr[BDADDR_SIZE]; + u8_t pdu_adv_type:4; + u8_t tx_addr:1; + u8_t rx_addr:1; + u8_t filter_policy:2; + u8_t chl_map:3; + u8_t adv_addr[BDADDR_SIZE]; + u8_t direct_addr[BDADDR_SIZE]; } _ll_adv_params; static struct { u16_t interval; u16_t window; - u8_t scan_type:1; - u8_t tx_addr:1; - u8_t filter_policy:1; + u8_t scan_type:1; + u8_t tx_addr:1; + u8_t filter_policy:1; } _ll_scan_params; void mayfly_enable_cb(u8_t caller_id, u8_t callee_id, u8_t enable) @@ -246,21 +246,29 @@ int ll_init(struct k_sem *sem_rx) return 0; } -void ll_address_get(u8_t addr_type, u8_t *bdaddr) +u8_t *ll_addr_get(u8_t addr_type, u8_t *bdaddr) { if (addr_type) { - memcpy(bdaddr, &_ll_context.rnd_addr[0], BDADDR_SIZE); - } else { - memcpy(bdaddr, &_ll_context.pub_addr[0], BDADDR_SIZE); + if (bdaddr) { + memcpy(bdaddr, _ll_context.rnd_addr, BDADDR_SIZE); + } + + return _ll_context.rnd_addr; + } + + if (bdaddr) { + memcpy(bdaddr, _ll_context.pub_addr, BDADDR_SIZE); } + + return _ll_context.pub_addr; } -void ll_address_set(u8_t addr_type, u8_t const *const bdaddr) +void ll_addr_set(u8_t addr_type, u8_t const *const bdaddr) { if (addr_type) { - memcpy(&_ll_context.rnd_addr[0], bdaddr, BDADDR_SIZE); + memcpy(_ll_context.rnd_addr, bdaddr, BDADDR_SIZE); } else { - memcpy(&_ll_context.pub_addr[0], bdaddr, BDADDR_SIZE); + memcpy(_ll_context.pub_addr, bdaddr, BDADDR_SIZE); } } @@ -269,6 +277,11 @@ void ll_adv_params_set(u16_t interval, u8_t adv_type, u8_t const *const direct_addr, u8_t chl_map, u8_t filter_policy) { + u8_t const pdu_adv_type[] = {PDU_ADV_TYPE_ADV_IND, + PDU_ADV_TYPE_DIRECT_IND, + PDU_ADV_TYPE_SCAN_IND, + PDU_ADV_TYPE_NONCONN_IND, + PDU_ADV_TYPE_DIRECT_IND}; struct radio_adv_data *radio_adv_data; struct pdu_adv *pdu; @@ -281,29 +294,34 @@ void ll_adv_params_set(u16_t interval, u8_t adv_type, * interface can correctly update adv/scan data in the * double buffer between caller and controller context. */ - _ll_adv_params.interval = interval; + /* Set interval for Undirected or Low Duty Cycle Directed Advertising */ + if (adv_type != 0x01) { + _ll_adv_params.interval = interval; + } else { + _ll_adv_params.interval = 0; + } _ll_adv_params.chl_map = chl_map; _ll_adv_params.filter_policy = filter_policy; - _ll_adv_params.adv_type = adv_type; + _ll_adv_params.pdu_adv_type = pdu_adv_type[adv_type]; _ll_adv_params.tx_addr = own_addr_type; _ll_adv_params.rx_addr = 0; /* update the current adv data */ radio_adv_data = radio_adv_data_get(); pdu = (struct pdu_adv *)&radio_adv_data->data[radio_adv_data->last][0]; - pdu->type = _ll_adv_params.adv_type; + pdu->type = _ll_adv_params.pdu_adv_type; pdu->rfu = 0; if (IS_ENABLED(CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2) && - ((adv_type == PDU_ADV_TYPE_ADV_IND) || - (adv_type == PDU_ADV_TYPE_DIRECT_IND))) { + ((_ll_adv_params.pdu_adv_type == PDU_ADV_TYPE_ADV_IND) || + (_ll_adv_params.pdu_adv_type == PDU_ADV_TYPE_DIRECT_IND))) { pdu->chan_sel = 1; } else { pdu->chan_sel = 0; } pdu->tx_addr = _ll_adv_params.tx_addr; - if (adv_type == PDU_ADV_TYPE_DIRECT_IND) { + if (_ll_adv_params.pdu_adv_type == PDU_ADV_TYPE_DIRECT_IND) { _ll_adv_params.rx_addr = direct_addr_type; memcpy(&_ll_adv_params.direct_addr[0], direct_addr, BDADDR_SIZE); @@ -314,7 +332,6 @@ void ll_adv_params_set(u16_t interval, u8_t adv_type, pdu->len = BDADDR_SIZE; } pdu->rx_addr = _ll_adv_params.rx_addr; - pdu->resv = 0; /* update the current scan data */ radio_adv_data = radio_scan_data_get(); @@ -327,7 +344,6 @@ void ll_adv_params_set(u16_t interval, u8_t adv_type, if (pdu->len == 0) { pdu->len = BDADDR_SIZE; } - pdu->resv = 0; } void ll_adv_data_set(u8_t len, u8_t const *const data) @@ -351,12 +367,12 @@ void ll_adv_data_set(u8_t len, u8_t const *const data) /* update adv pdu fields. */ pdu = (struct pdu_adv *)&radio_adv_data->data[last][0]; - pdu->type = _ll_adv_params.adv_type; + pdu->type = _ll_adv_params.pdu_adv_type; pdu->rfu = 0; if (IS_ENABLED(CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2) && - ((_ll_adv_params.adv_type == PDU_ADV_TYPE_ADV_IND) || - (_ll_adv_params.adv_type == PDU_ADV_TYPE_DIRECT_IND))) { + ((_ll_adv_params.pdu_adv_type == PDU_ADV_TYPE_ADV_IND) || + (_ll_adv_params.pdu_adv_type == PDU_ADV_TYPE_DIRECT_IND))) { pdu->chan_sel = 1; } else { pdu->chan_sel = 0; @@ -366,7 +382,7 @@ void ll_adv_data_set(u8_t len, u8_t const *const data) pdu->rx_addr = _ll_adv_params.rx_addr; memcpy(&pdu->payload.adv_ind.addr[0], &_ll_adv_params.adv_addr[0], BDADDR_SIZE); - if (_ll_adv_params.adv_type == PDU_ADV_TYPE_DIRECT_IND) { + if (_ll_adv_params.pdu_adv_type == PDU_ADV_TYPE_DIRECT_IND) { memcpy(&pdu->payload.direct_ind.tgt_addr[0], &_ll_adv_params.direct_addr[0], BDADDR_SIZE); pdu->len = sizeof(struct pdu_adv_payload_direct_ind); @@ -374,7 +390,6 @@ void ll_adv_data_set(u8_t len, u8_t const *const data) memcpy(&pdu->payload.adv_ind.data[0], data, len); pdu->len = BDADDR_SIZE + len; } - pdu->resv = 0; /* commit the update so controller picks it. */ radio_adv_data->last = last; @@ -405,10 +420,9 @@ void ll_scan_data_set(u8_t len, u8_t const *const data) pdu->tx_addr = _ll_adv_params.tx_addr; pdu->rx_addr = 0; pdu->len = BDADDR_SIZE + len; - memcpy(&pdu->payload.scan_rsp.addr[0], - &_ll_adv_params.adv_addr[0], BDADDR_SIZE); + memcpy(&pdu->payload.scan_rsp.addr[0], &_ll_adv_params.adv_addr[0], + BDADDR_SIZE); memcpy(&pdu->payload.scan_rsp.data[0], data, len); - pdu->resv = 0; /* commit the update so controller picks it. */ radio_scan_data->last = last; @@ -440,23 +454,23 @@ u32_t ll_adv_enable(u8_t enable) [radio_scan_data->last][0]; if (_ll_adv_params.tx_addr) { memcpy(&_ll_adv_params.adv_addr[0], - &_ll_context.rnd_addr[0], BDADDR_SIZE); + &_ll_context.rnd_addr[0], BDADDR_SIZE); memcpy(&pdu_adv->payload.adv_ind.addr[0], - &_ll_context.rnd_addr[0], BDADDR_SIZE); + &_ll_context.rnd_addr[0], BDADDR_SIZE); memcpy(&pdu_scan->payload.scan_rsp.addr[0], - &_ll_context.rnd_addr[0], BDADDR_SIZE); + &_ll_context.rnd_addr[0], BDADDR_SIZE); } else { memcpy(&_ll_adv_params.adv_addr[0], - &_ll_context.pub_addr[0], BDADDR_SIZE); + &_ll_context.pub_addr[0], BDADDR_SIZE); memcpy(&pdu_adv->payload.adv_ind.addr[0], - &_ll_context.pub_addr[0], BDADDR_SIZE); + &_ll_context.pub_addr[0], BDADDR_SIZE); memcpy(&pdu_scan->payload.scan_rsp.addr[0], - &_ll_context.pub_addr[0], BDADDR_SIZE); + &_ll_context.pub_addr[0], BDADDR_SIZE); } status = radio_adv_enable(_ll_adv_params.interval, - _ll_adv_params.chl_map, - _ll_adv_params.filter_policy); + _ll_adv_params.chl_map, + _ll_adv_params.filter_policy); } else { status = radio_adv_disable(); } @@ -480,13 +494,13 @@ u32_t ll_scan_enable(u8_t enable) if (enable) { status = radio_scan_enable(_ll_scan_params.scan_type, - _ll_scan_params.tx_addr, - (_ll_scan_params.tx_addr) ? - &_ll_context.rnd_addr[0] : - &_ll_context.pub_addr[0], - _ll_scan_params.interval, - _ll_scan_params.window, - _ll_scan_params.filter_policy); + _ll_scan_params.tx_addr, + (_ll_scan_params.tx_addr) ? + &_ll_context.rnd_addr[0] : + &_ll_context.pub_addr[0], + _ll_scan_params.interval, + _ll_scan_params.window, + _ll_scan_params.filter_policy); } else { status = radio_scan_disable(); } @@ -495,22 +509,22 @@ u32_t ll_scan_enable(u8_t enable) } u32_t ll_create_connection(u16_t scan_interval, u16_t scan_window, - u8_t filter_policy, u8_t peer_addr_type, - u8_t *peer_addr, u8_t own_addr_type, - u16_t interval, u16_t latency, - u16_t timeout) + u8_t filter_policy, u8_t peer_addr_type, + u8_t *peer_addr, u8_t own_addr_type, + u16_t interval, u16_t latency, + u16_t timeout) { u32_t status; status = radio_connect_enable(peer_addr_type, peer_addr, interval, - latency, timeout); + latency, timeout); if (status) { return status; } return radio_scan_enable(0, own_addr_type, (own_addr_type) ? - &_ll_context.rnd_addr[0] : - &_ll_context.pub_addr[0], - scan_interval, scan_window, filter_policy); + &_ll_context.rnd_addr[0] : + &_ll_context.pub_addr[0], + scan_interval, scan_window, filter_policy); } diff --git a/subsys/bluetooth/controller/ll_sw/pdu.h b/subsys/bluetooth/controller/ll_sw/pdu.h index 6fa51ed2e3218..4ba91905cc48d 100644 --- a/subsys/bluetooth/controller/ll_sw/pdu.h +++ b/subsys/bluetooth/controller/ll_sw/pdu.h @@ -12,8 +12,9 @@ /* PDU Sizes */ #define PDU_EM_SIZE_MAX 3 -#define PDU_AC_SIZE_OVERHEAD 3 -#define PDU_AC_SIZE_MAX (37 + PDU_AC_SIZE_OVERHEAD) +#define PDU_AC_SIZE_OVERHEAD 2 +#define PDU_AC_PAYLOAD_SIZE_MAX 37 +#define PDU_AC_SIZE_MAX (PDU_AC_PAYLOAD_SIZE_MAX + PDU_AC_SIZE_OVERHEAD) struct pdu_adv_payload_adv_ind { u8_t addr[BDADDR_SIZE]; @@ -39,16 +40,16 @@ struct pdu_adv_payload_connect_ind { u8_t init_addr[BDADDR_SIZE]; u8_t adv_addr[BDADDR_SIZE]; struct { - u8_t access_addr[4]; - u8_t crc_init[3]; - u8_t win_size; + u8_t access_addr[4]; + u8_t crc_init[3]; + u8_t win_size; u16_t win_offset; u16_t interval; u16_t latency; u16_t timeout; - u8_t chan_map[5]; - u8_t hop:5; - u8_t sca:3; + u8_t chan_map[5]; + u8_t hop:5; + u8_t sca:3; } __packed lldata; } __packed; @@ -79,8 +80,6 @@ struct pdu_adv { u8_t len:8; - u8_t resv:8; /* TODO: remove nRF specific code */ - union { struct pdu_adv_payload_adv_ind adv_ind; struct pdu_adv_payload_direct_ind direct_ind; @@ -127,7 +126,7 @@ enum pdu_data_llctrl_type { }; struct pdu_data_llctrl_conn_update_ind { - u8_t win_size; + u8_t win_size; u16_t win_offset; u16_t interval; u16_t latency; @@ -136,7 +135,7 @@ struct pdu_data_llctrl_conn_update_ind { } __packed; struct pdu_data_llctrl_chan_map_ind { - u8_t chm[5]; + u8_t chm[5]; u16_t instant; } __packed; @@ -169,7 +168,7 @@ struct pdu_data_llctrl_feature_rsp { } __packed; struct pdu_data_llctrl_version_ind { - u8_t version_number; + u8_t version_number; u16_t company_id; u16_t sub_version_number; } __packed; @@ -183,7 +182,7 @@ struct pdu_data_llctrl_conn_param_req { u16_t interval_max; u16_t latency; u16_t timeout; - u8_t preferred_periodicity; + u8_t preferred_periodicity; u16_t reference_conn_event_count; u16_t offset0; u16_t offset1; @@ -198,7 +197,7 @@ struct pdu_data_llctrl_conn_param_rsp { u16_t interval_max; u16_t latency; u16_t timeout; - u8_t preferred_periodicity; + u8_t preferred_periodicity; u16_t reference_conn_event_count; u16_t offset0; u16_t offset1; @@ -226,8 +225,8 @@ struct pdu_data_llctrl_phy_req_rsp { } __packed; struct pdu_data_llctrl_phy_update_ind { - u8_t m_to_s_phy; - u8_t s_to_m_phy; + u8_t m_to_s_phy; + u8_t s_to_m_phy; u16_t instant; } __packed; diff --git a/subsys/bluetooth/controller/ticker/ticker.c b/subsys/bluetooth/controller/ticker/ticker.c index 203be66f3ee7c..2097b7ed23b26 100644 --- a/subsys/bluetooth/controller/ticker/ticker.c +++ b/subsys/bluetooth/controller/ticker/ticker.c @@ -29,15 +29,15 @@ * Types ****************************************************************************/ struct ticker_node { - u8_t next; + u8_t next; - u8_t req; - u8_t ack; - u8_t force; + u8_t req; + u8_t ack; + u8_t force; u32_t ticks_periodic; u32_t ticks_to_expire; ticker_timeout_func timeout_func; - void *context; + void *context; u16_t ticks_to_expire_minus; u16_t ticks_slot; @@ -64,7 +64,7 @@ struct ticker_user_op_start { u16_t lazy; u16_t ticks_slot; ticker_timeout_func fp_timeout_func; - void *context; + void *context; }; struct ticker_user_op_update { @@ -73,11 +73,11 @@ struct ticker_user_op_update { u16_t ticks_slot_plus; u16_t ticks_slot_minus; u16_t lazy; - u8_t force; + u8_t force; }; struct ticker_user_op_slot_get { - u8_t *ticker_id; + u8_t *ticker_id; u32_t *ticks_current; u32_t *ticks_to_expire; }; @@ -92,7 +92,7 @@ struct ticker_user_op { } params; u32_t status; ticker_op_func fp_op_func; - void *op_context; + void *op_context; }; struct ticker_user { @@ -106,20 +106,20 @@ struct ticker_user { struct ticker_instance { struct ticker_node *node; struct ticker_user *user; - u8_t count_node; - u8_t count_user; - u8_t ticks_elapsed_first; - u8_t ticks_elapsed_last; + u8_t count_node; + u8_t count_user; + u8_t ticks_elapsed_first; + u8_t ticks_elapsed_last; u32_t ticks_elapsed[DOUBLE_BUFFER_SIZE]; u32_t ticks_current; - u8_t ticker_id_head; - u8_t ticker_id_slot_previous; + u8_t ticker_id_head; + u8_t ticker_id_slot_previous; u16_t ticks_slot_previous; - u8_t job_guard; - u8_t worker_trigger; - u8_t (*fp_caller_id_get)(u8_t user_id); - void (*fp_sched)(u8_t caller_id, u8_t callee_id, u8_t chain); - void (*fp_cmp_set)(u32_t value); + u8_t job_guard; + u8_t worker_trigger; + u8_t (*fp_caller_id_get)(u8_t user_id); + void (*fp_sched)(u8_t caller_id, u8_t callee_id, u8_t chain); + void (*fp_cmp_set)(u32_t value); }; /***************************************************************************** @@ -130,9 +130,8 @@ static struct ticker_instance _instance[2]; /***************************************************************************** * Static Functions ****************************************************************************/ -static u8_t ticker_by_slot_get(struct ticker_node *node, - u8_t ticker_id_head, - u32_t ticks_slot) +static u8_t ticker_by_slot_get(struct ticker_node *node, u8_t ticker_id_head, + u32_t ticks_slot) { while (ticker_id_head != TICKER_NULL) { struct ticker_node *ticker; @@ -157,9 +156,8 @@ static u8_t ticker_by_slot_get(struct ticker_node *node, } static void ticker_by_next_slot_get(struct ticker_instance *instance, - u8_t *ticker_id_head, - u32_t *ticks_current, - u32_t *ticks_to_expire) + u8_t *ticker_id_head, u32_t *ticks_current, + u32_t *ticks_to_expire) { struct ticker_node *node; u8_t _ticker_id_head; @@ -195,8 +193,7 @@ static void ticker_by_next_slot_get(struct ticker_instance *instance, *ticks_to_expire = _ticks_to_expire; } -static u8_t ticker_enqueue(struct ticker_instance *instance, - u8_t id) +static u8_t ticker_enqueue(struct ticker_instance *instance, u8_t id) { struct ticker_node *node; struct ticker_node *ticker_new; @@ -269,8 +266,7 @@ static u8_t ticker_enqueue(struct ticker_instance *instance, return id; } -static u32_t ticker_dequeue(struct ticker_instance *instance, - u8_t id) +static u32_t ticker_dequeue(struct ticker_instance *instance, u8_t id) { struct ticker_node *ticker_current; struct ticker_node *node; @@ -418,8 +414,7 @@ static inline void ticker_worker(struct ticker_instance *instance) } static void prepare_ticks_to_expire(struct ticker_node *ticker, - u32_t ticks_current, - u32_t ticks_at_start) + u32_t ticks_current, u32_t ticks_at_start) { u32_t ticks_to_expire = ticker->ticks_to_expire; u16_t ticks_to_expire_minus = ticker->ticks_to_expire_minus; @@ -481,10 +476,10 @@ static u8_t ticker_remainder_decrement(struct ticker_node *ticker) } static inline void ticker_job_node_update(struct ticker_node *ticker, - struct ticker_user_op *user_op, - u32_t ticks_current, - u32_t ticks_elapsed, - u8_t *insert_head) + struct ticker_user_op *user_op, + u32_t ticks_current, + u32_t ticks_elapsed, + u8_t *insert_head) { u32_t ticks_now; u32_t ticks_to_expire = ticker->ticks_to_expire; @@ -545,10 +540,9 @@ static inline void ticker_job_node_update(struct ticker_node *ticker, *insert_head = user_op->id; } -static inline u8_t ticker_job_list_manage( - struct ticker_instance *instance, - u32_t ticks_elapsed, - u8_t *insert_head) +static inline u8_t ticker_job_list_manage(struct ticker_instance *instance, + u32_t ticks_elapsed, + u8_t *insert_head) { u8_t pending; struct ticker_node *node; @@ -778,9 +772,8 @@ static inline void ticker_job_worker_bottom_half( } } -static inline void ticker_job_list_insert( - struct ticker_instance *instance, - u8_t insert_head) +static inline void ticker_job_list_insert(struct ticker_instance *instance, + u8_t insert_head) { struct ticker_node *node; struct ticker_user *users; @@ -936,8 +929,7 @@ static inline void ticker_job_list_insert( } } -static inline void ticker_job_list_inquire( - struct ticker_instance *instance) +static inline void ticker_job_list_inquire(struct ticker_instance *instance) { struct ticker_user *users; u8_t count_user; @@ -1002,9 +994,8 @@ static inline void ticker_job_list_inquire( } } -static inline void ticker_job_compare_update( - struct ticker_instance *instance, - u8_t ticker_id_old_head) +static inline void ticker_job_compare_update(struct ticker_instance *instance, + u8_t ticker_id_old_head) { struct ticker_node *ticker; struct ticker_node *node; @@ -1218,8 +1209,7 @@ static u8_t ticker_instance1_caller_id_get(u8_t user_id) return 0; } -static void ticker_instance0_sched(u8_t caller_id, u8_t callee_id, - u8_t chain) +static void ticker_instance0_sched(u8_t caller_id, u8_t callee_id, u8_t chain) { /* return value not checked as we allow multiple calls to schedule * before being actually needing the work to complete before new @@ -1345,8 +1335,7 @@ static void ticker_instance0_sched(u8_t caller_id, u8_t callee_id, } } -static void ticker_instance1_sched(u8_t caller_id, u8_t callee_id, - u8_t chain) +static void ticker_instance1_sched(u8_t caller_id, u8_t callee_id, u8_t chain) { /* return value not checked as we allow multiple calls to schedule * before being actually needing the work to complete before new @@ -1486,8 +1475,7 @@ static void ticker_instance1_cmp_set(u32_t value) * Public Interface ****************************************************************************/ u32_t ticker_init(u8_t instance_index, u8_t count_node, void *node, - u8_t count_user, void *user, u8_t count_op, - void *user_op) + u8_t count_user, void *user, u8_t count_op, void *user_op) { struct ticker_instance *instance = &_instance[instance_index]; struct ticker_user *users; @@ -1559,13 +1547,11 @@ void ticker_trigger(u8_t instance_index) DEBUG_TICKER_ISR(0); } -u32_t ticker_start(u8_t instance_index, u8_t user_id, - u8_t _ticker_id, u32_t ticks_anchor, - u32_t ticks_first, u32_t ticks_periodic, - u32_t remainder_periodic, u16_t lazy, - u16_t ticks_slot, - ticker_timeout_func ticker_timeout_func, void *context, - ticker_op_func fp_op_func, void *op_context) +u32_t ticker_start(u8_t instance_index, u8_t user_id, u8_t _ticker_id, + u32_t ticks_anchor, u32_t ticks_first, u32_t ticks_periodic, + u32_t remainder_periodic, u16_t lazy, u16_t ticks_slot, + ticker_timeout_func ticker_timeout_func, void *context, + ticker_op_func fp_op_func, void *op_context) { u8_t last; struct ticker_instance *instance = &_instance[instance_index]; @@ -1605,11 +1591,10 @@ u32_t ticker_start(u8_t instance_index, u8_t user_id, return user_op->status; } -u32_t ticker_update(u8_t instance_index, u8_t user_id, - u8_t _ticker_id, u16_t ticks_drift_plus, - u16_t ticks_drift_minus, u16_t ticks_slot_plus, - u16_t ticks_slot_minus, u16_t lazy, u8_t force, - ticker_op_func fp_op_func, void *op_context) +u32_t ticker_update(u8_t instance_index, u8_t user_id, u8_t _ticker_id, + u16_t ticks_drift_plus, u16_t ticks_drift_minus, + u16_t ticks_slot_plus, u16_t ticks_slot_minus, u16_t lazy, + u8_t force, ticker_op_func fp_op_func, void *op_context) { struct ticker_instance *instance = &_instance[instance_index]; u8_t last; @@ -1647,9 +1632,8 @@ u32_t ticker_update(u8_t instance_index, u8_t user_id, return user_op->status; } -u32_t ticker_stop(u8_t instance_index, u8_t user_id, - u8_t _ticker_id, ticker_op_func fp_op_func, - void *op_context) +u32_t ticker_stop(u8_t instance_index, u8_t user_id, u8_t _ticker_id, + ticker_op_func fp_op_func, void *op_context) { struct ticker_instance *instance = &_instance[instance_index]; u8_t last; @@ -1681,11 +1665,9 @@ u32_t ticker_stop(u8_t instance_index, u8_t user_id, return user_op->status; } -u32_t ticker_next_slot_get(u8_t instance_index, u8_t user_id, - u8_t *_ticker_id, - u32_t *ticks_current, - u32_t *ticks_to_expire, - ticker_op_func fp_op_func, void *op_context) +u32_t ticker_next_slot_get(u8_t instance_index, u8_t user_id, u8_t *_ticker_id, + u32_t *ticks_current, u32_t *ticks_to_expire, + ticker_op_func fp_op_func, void *op_context) { struct ticker_instance *instance = &_instance[instance_index]; u8_t last; @@ -1721,7 +1703,7 @@ u32_t ticker_next_slot_get(u8_t instance_index, u8_t user_id, } u32_t ticker_job_idle_get(u8_t instance_index, u8_t user_id, - ticker_op_func fp_op_func, void *op_context) + ticker_op_func fp_op_func, void *op_context) { struct ticker_instance *instance = &_instance[instance_index]; u8_t last; diff --git a/subsys/bluetooth/controller/ticker/ticker.h b/subsys/bluetooth/controller/ticker/ticker.h index 299abe73f5f08..00d1ccb4b2484 100644 --- a/subsys/bluetooth/controller/ticker/ticker.h +++ b/subsys/bluetooth/controller/ticker/ticker.h @@ -76,9 +76,8 @@ /** \brief Timer timeout function type. */ -typedef void (*ticker_timeout_func) (u32_t ticks_at_expire, - u32_t remainder, u16_t lazy, - void *context); +typedef void (*ticker_timeout_func) (u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context); /** \brief Timer operation complete function type. */ @@ -96,31 +95,25 @@ typedef void (*ticker_op_func) (u32_t status, void *op_context); * \param[in] user_op */ u32_t ticker_init(u8_t instance_index, u8_t count_node, void *node, - u8_t count_user, void *user, u8_t count_op, - void *user_op); + u8_t count_user, void *user, u8_t count_op, void *user_op); void ticker_trigger(u8_t instance_index); -u32_t ticker_start(u8_t instance_index, u8_t user_id, - u8_t ticker_id, u32_t ticks_anchor, - u32_t ticks_first, u32_t ticks_periodic, - u32_t remainder_periodic, u16_t lazy, - u16_t ticks_slot, - ticker_timeout_func ticker_timeout_func, void *context, - ticker_op_func fp_op_func, void *op_context); -u32_t ticker_update(u8_t instance_index, u8_t user_id, - u8_t ticker_id, u16_t ticks_drift_plus, - u16_t ticks_drift_minus, u16_t ticks_slot_plus, - u16_t ticks_slot_minus, u16_t lazy, u8_t force, - ticker_op_func fp_op_func, void *op_context); -u32_t ticker_stop(u8_t instance_index, u8_t user_id, - u8_t ticker_id, ticker_op_func fp_op_func, - void *op_context); +u32_t ticker_start(u8_t instance_index, u8_t user_id, u8_t ticker_id, + u32_t ticks_anchor, u32_t ticks_first, u32_t ticks_periodic, + u32_t remainder_periodic, u16_t lazy, u16_t ticks_slot, + ticker_timeout_func ticker_timeout_func, void *context, + ticker_op_func fp_op_func, void *op_context); +u32_t ticker_update(u8_t instance_index, u8_t user_id, u8_t ticker_id, + u16_t ticks_drift_plus, u16_t ticks_drift_minus, + u16_t ticks_slot_plus, u16_t ticks_slot_minus, u16_t lazy, + u8_t force, ticker_op_func fp_op_func, void *op_context); +u32_t ticker_stop(u8_t instance_index, u8_t user_id, u8_t ticker_id, + ticker_op_func fp_op_func, void *op_context); u32_t ticker_next_slot_get(u8_t instance_index, u8_t user_id, - u8_t *ticker_id_head, - u32_t *ticks_current, - u32_t *ticks_to_expire, - ticker_op_func fp_op_func, void *op_context); + u8_t *ticker_id_head, u32_t *ticks_current, + u32_t *ticks_to_expire, + ticker_op_func fp_op_func, void *op_context); u32_t ticker_job_idle_get(u8_t instance_index, u8_t user_id, - ticker_op_func fp_op_func, void *op_context); + ticker_op_func fp_op_func, void *op_context); void ticker_job_sched(u8_t instance_index, u8_t user_id); u32_t ticker_ticks_now_get(void); u32_t ticker_ticks_diff_get(u32_t ticks_now, u32_t ticks_old); diff --git a/subsys/bluetooth/controller/util/mayfly.h b/subsys/bluetooth/controller/util/mayfly.h index 301dee38379fe..f11bfaefe2f48 100644 --- a/subsys/bluetooth/controller/util/mayfly.h +++ b/subsys/bluetooth/controller/util/mayfly.h @@ -26,11 +26,10 @@ struct mayfly { void mayfly_init(void); void mayfly_enable(u8_t caller_id, u8_t callee_id, u8_t enable); u32_t mayfly_enqueue(u8_t caller_id, u8_t callee_id, u8_t chain, - struct mayfly *m); + struct mayfly *m); void mayfly_run(u8_t callee_id); -extern void mayfly_enable_cb(u8_t caller_id, u8_t callee_id, - u8_t enable); +extern void mayfly_enable_cb(u8_t caller_id, u8_t callee_id, u8_t enable); extern u32_t mayfly_is_enabled(u8_t caller_id, u8_t callee_id); extern u32_t mayfly_prio_is_equal(u8_t caller_id, u8_t callee_id); extern void mayfly_pend(u8_t caller_id, u8_t callee_id); diff --git a/subsys/bluetooth/controller/util/mem.c b/subsys/bluetooth/controller/util/mem.c index e62f67d41cf08..3b5183733a4d5 100644 --- a/subsys/bluetooth/controller/util/mem.c +++ b/subsys/bluetooth/controller/util/mem.c @@ -20,8 +20,7 @@ void mem_init(void *mem_pool, u16_t mem_size, u16_t mem_count, /* Store free mem_count after the list's next pointer at an aligned * memory location to ensure atomic read/write (in ARM for now). */ - *((u16_t *)MROUND((u8_t *)mem_pool + sizeof(mem_pool))) = - mem_count; + *((u16_t *)MROUND((u8_t *)mem_pool + sizeof(mem_pool))) = mem_count; /* Initialize next pointers to form a free list, * next pointer is stored in the first 32-bit of each block @@ -32,9 +31,9 @@ void mem_init(void *mem_pool, u16_t mem_size, u16_t mem_count, u32_t next; next = (u32_t)((u8_t *) mem_pool + - (mem_size * (mem_count + 1))); + (mem_size * (mem_count + 1))); memcpy(((u8_t *)mem_pool + (mem_size * mem_count)), - (void *)&next, sizeof(next)); + (void *)&next, sizeof(next)); } } @@ -47,7 +46,7 @@ void *mem_acquire(void **mem_head) /* Get the free count from the list and decrement it */ free_count = *((u16_t *)MROUND((u8_t *)*mem_head + - sizeof(mem_head))); + sizeof(mem_head))); free_count--; mem = *mem_head; @@ -73,7 +72,7 @@ void mem_release(void *mem, void **mem_head) /* Get the free count from the list and increment it */ if (*mem_head) { free_count = *((u16_t *)MROUND((u8_t *)*mem_head + - sizeof(mem_head))); + sizeof(mem_head))); } free_count++; @@ -92,7 +91,7 @@ u16_t mem_free_count_get(void *mem_head) /* Get the free count from the list */ if (mem_head) { free_count = *((u16_t *)MROUND((u8_t *)mem_head + - sizeof(mem_head))); + sizeof(mem_head))); } return free_count; @@ -105,8 +104,7 @@ void *mem_get(void *mem_pool, u16_t mem_size, u16_t index) u16_t mem_index_get(void *mem, void *mem_pool, u16_t mem_size) { - return ((u16_t)((u8_t *)mem - (u8_t *)mem_pool) / - mem_size); + return ((u16_t)((u8_t *)mem - (u8_t *)mem_pool) / mem_size); } void mem_rcopy(u8_t *dst, u8_t const *src, u16_t len) diff --git a/subsys/bluetooth/controller/util/mem.h b/subsys/bluetooth/controller/util/mem.h index 443a26b1e628a..f86672a64f7f9 100644 --- a/subsys/bluetooth/controller/util/mem.h +++ b/subsys/bluetooth/controller/util/mem.h @@ -16,8 +16,7 @@ #define MROUND(x) (((u32_t)(x)+3) & (~((u32_t)3))) #endif -void mem_init(void *mem_pool, u16_t mem_size, u16_t mem_count, - void **mem_head); +void mem_init(void *mem_pool, u16_t mem_size, u16_t mem_count, void **mem_head); void *mem_acquire(void **mem_head); void mem_release(void *mem, void **mem_head); diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 078f1d17eb19a..6703807078366 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -446,7 +446,7 @@ static u8_t find_info_cb(const struct bt_gatt_attr *attr, void *user_data) } static u8_t att_find_info_rsp(struct bt_att *att, u16_t start_handle, - u16_t end_handle) + u16_t end_handle) { struct bt_conn *conn = att->chan.chan.conn; struct find_info_data data; @@ -565,8 +565,8 @@ static u8_t find_type_cb(const struct bt_gatt_attr *attr, void *user_data) } static u8_t att_find_type_rsp(struct bt_att *att, u16_t start_handle, - u16_t end_handle, const void *value, - u8_t value_len) + u16_t end_handle, const void *value, + u8_t value_len) { struct bt_conn *conn = att->chan.chan.conn; struct find_type_data data; @@ -657,7 +657,7 @@ static bool uuid_create(struct bt_uuid *uuid, struct net_buf *buf) } static u8_t check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr, - u8_t mask) + u8_t mask) { if ((mask & BT_GATT_PERM_READ) && (!(attr->perm & BT_GATT_PERM_READ_MASK) || !attr->read)) { @@ -780,7 +780,7 @@ static u8_t read_type_cb(const struct bt_gatt_attr *attr, void *user_data) } static u8_t att_read_type_rsp(struct bt_att *att, struct bt_uuid *uuid, - u16_t start_handle, u16_t end_handle) + u16_t start_handle, u16_t end_handle) { struct bt_conn *conn = att->chan.chan.conn; struct read_type_data data; @@ -898,8 +898,8 @@ static u8_t read_cb(const struct bt_gatt_attr *attr, void *user_data) return BT_GATT_ITER_CONTINUE; } -static u8_t att_read_rsp(struct bt_att *att, u8_t op, u8_t rsp, - u16_t handle, u16_t offset) +static u8_t att_read_rsp(struct bt_att *att, u8_t op, u8_t rsp, u16_t handle, + u16_t offset) { struct bt_conn *conn = att->chan.chan.conn; struct read_data data; @@ -1082,7 +1082,7 @@ static u8_t read_group_cb(const struct bt_gatt_attr *attr, void *user_data) } static u8_t att_read_group_rsp(struct bt_att *att, struct bt_uuid *uuid, - u16_t start_handle, u16_t end_handle) + u16_t start_handle, u16_t end_handle) { struct bt_conn *conn = att->chan.chan.conn; struct read_group_data data; @@ -1205,8 +1205,8 @@ static u8_t write_cb(const struct bt_gatt_attr *attr, void *user_data) } static u8_t att_write_rsp(struct bt_conn *conn, u8_t op, u8_t rsp, - u16_t handle, u16_t offset, - const void *value, u8_t len) + u16_t handle, u16_t offset, const void *value, + u8_t len) { struct write_data data; @@ -1319,9 +1319,8 @@ static u8_t prep_write_cb(const struct bt_gatt_attr *attr, void *user_data) return BT_GATT_ITER_CONTINUE; } -static u8_t att_prep_write_rsp(struct bt_att *att, u16_t handle, - u16_t offset, const void *value, - u8_t len) +static u8_t att_prep_write_rsp(struct bt_att *att, u16_t handle, u16_t offset, + const void *value, u8_t len) { struct bt_conn *conn = att->chan.chan.conn; struct prep_data data; @@ -1592,56 +1591,49 @@ static u8_t att_error_rsp(struct bt_att *att, struct net_buf *buf) return att_handle_rsp(att, NULL, 0, err); } -static u8_t att_handle_find_info_rsp(struct bt_att *att, - struct net_buf *buf) +static u8_t att_handle_find_info_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); return att_handle_rsp(att, buf->data, buf->len, 0); } -static u8_t att_handle_find_type_rsp(struct bt_att *att, - struct net_buf *buf) +static u8_t att_handle_find_type_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); return att_handle_rsp(att, buf->data, buf->len, 0); } -static u8_t att_handle_read_type_rsp(struct bt_att *att, - struct net_buf *buf) +static u8_t att_handle_read_type_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); return att_handle_rsp(att, buf->data, buf->len, 0); } -static u8_t att_handle_read_rsp(struct bt_att *att, - struct net_buf *buf) +static u8_t att_handle_read_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); return att_handle_rsp(att, buf->data, buf->len, 0); } -static u8_t att_handle_read_blob_rsp(struct bt_att *att, - struct net_buf *buf) +static u8_t att_handle_read_blob_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); return att_handle_rsp(att, buf->data, buf->len, 0); } -static u8_t att_handle_read_mult_rsp(struct bt_att *att, - struct net_buf *buf) +static u8_t att_handle_read_mult_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); return att_handle_rsp(att, buf->data, buf->len, 0); } -static u8_t att_handle_write_rsp(struct bt_att *att, - struct net_buf *buf) +static u8_t att_handle_write_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1649,15 +1641,14 @@ static u8_t att_handle_write_rsp(struct bt_att *att, } static u8_t att_handle_prepare_write_rsp(struct bt_att *att, - struct net_buf *buf) + struct net_buf *buf) { BT_DBG(""); return att_handle_rsp(att, buf->data, buf->len, 0); } -static u8_t att_handle_exec_write_rsp(struct bt_att *att, - struct net_buf *buf) +static u8_t att_handle_exec_write_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1707,10 +1698,10 @@ static u8_t att_confirm(struct bt_att *att, struct net_buf *buf) } static const struct att_handler { - u8_t op; - u8_t expect_len; + u8_t op; + u8_t expect_len; att_type_t type; - u8_t (*func)(struct bt_att *att, struct net_buf *buf); + u8_t (*func)(struct bt_att *att, struct net_buf *buf); } handlers[] = { { BT_ATT_OP_ERROR_RSP, sizeof(struct bt_att_error_rsp), diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 9aa766096cbd3..0f13876586522 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -412,14 +412,14 @@ struct bt_conn *bt_conn_add_sco(const bt_addr_t *peer, int link_type) if (link_type == BT_HCI_SCO) { if (BT_FEAT_LMP_ESCO_CAPABLE(bt_dev.features)) { - sco_conn->sco.pkt_type = (bt_dev.esco.pkt_type & + sco_conn->sco.pkt_type = (bt_dev.br.esco_pkt_type & ESCO_PKT_MASK); } else { - sco_conn->sco.pkt_type = (bt_dev.esco.pkt_type & + sco_conn->sco.pkt_type = (bt_dev.br.esco_pkt_type & SCO_PKT_MASK); } } else if (link_type == BT_HCI_ESCO) { - sco_conn->sco.pkt_type = (bt_dev.esco.pkt_type & + sco_conn->sco.pkt_type = (bt_dev.br.esco_pkt_type & ~EDR_ESCO_PKT_MASK); } @@ -2044,8 +2044,6 @@ int bt_conn_init(void) /* Initialize background scan */ if (IS_ENABLED(CONFIG_BLUETOOTH_CENTRAL)) { - int i; - for (i = 0; i < ARRAY_SIZE(conns); i++) { struct bt_conn *conn = &conns[i]; diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index de0c5accc1c1b..a2c488fba6125 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -35,12 +35,12 @@ struct bt_conn_le { bt_addr_le_t init_addr; bt_addr_le_t resp_addr; - u16_t interval; - u16_t interval_min; - u16_t interval_max; + u16_t interval; + u16_t interval_min; + u16_t interval_max; - u16_t latency; - u16_t timeout; + u16_t latency; + u16_t timeout; u8_t features[1][8]; @@ -80,7 +80,7 @@ struct bt_conn_tx { }; struct bt_conn { - u16_t handle; + u16_t handle; u8_t type; u8_t role; diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index fc81c202d11d5..80a86d12e45f7 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -560,7 +560,7 @@ int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr, { struct notify_data nfy; - __ASSERT(attr && attr->handler, "invalid parameters\n"); + __ASSERT(attr && attr->handle, "invalid parameters\n"); if (conn) { return gatt_notify(conn, attr->handle, data, len); @@ -990,8 +990,8 @@ static int read_included_uuid(struct bt_conn *conn, } static u16_t parse_include(struct bt_conn *conn, const void *pdu, - struct bt_gatt_discover_params *params, - u16_t length) + struct bt_gatt_discover_params *params, + u16_t length) { const struct bt_att_read_type_rsp *rsp = pdu; u16_t handle = 0; @@ -1082,8 +1082,8 @@ static u16_t parse_include(struct bt_conn *conn, const void *pdu, } static u16_t parse_characteristic(struct bt_conn *conn, const void *pdu, - struct bt_gatt_discover_params *params, - u16_t length) + struct bt_gatt_discover_params *params, + u16_t length) { const struct bt_att_read_type_rsp *rsp = pdu; u16_t handle = 0; diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 3a414bdaeeb09..fe0757afa7a76 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -774,7 +774,7 @@ static void le_conn_complete(struct net_buf *buf) static void le_remote_feat_complete(struct net_buf *buf) { - struct bt_hci_ev_le_remote_feat_complete *evt = (void *)buf->data; + struct bt_hci_evt_le_remote_feat_complete *evt = (void *)buf->data; u16_t handle = sys_le16_to_cpu(evt->handle); struct bt_conn *conn; @@ -1223,7 +1223,7 @@ static void pin_code_req(struct net_buf *buf) static void link_key_notify(struct net_buf *buf) { - struct bt_hci_ev_link_key_notify *evt = (void *)buf->data; + struct bt_hci_evt_link_key_notify *evt = (void *)buf->data; struct bt_conn *conn; conn = bt_conn_lookup_addr_br(&evt->bdaddr); @@ -2502,7 +2502,7 @@ int bt_le_scan_update(bool fast_scan) static void le_adv_report(struct net_buf *buf) { u8_t num_reports = net_buf_pull_u8(buf); - struct bt_hci_ev_le_advertising_info *info; + struct bt_hci_evt_le_advertising_info *info; BT_DBG("Adv number of reports %u", num_reports); @@ -3145,36 +3145,36 @@ void device_supported_pkt_type(void) { /* Device supported features and sco packet types */ if (BT_FEAT_HV2_PKT(bt_dev.features)) { - bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_HV2); + bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_HV2); } if (BT_FEAT_HV3_PKT(bt_dev.features)) { - bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_HV3); + bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_HV3); } if (BT_FEAT_LMP_ESCO_CAPABLE(bt_dev.features)) { - bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_EV3); + bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_EV3); } if (BT_FEAT_EV4_PKT(bt_dev.features)) { - bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_EV4); + bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_EV4); } if (BT_FEAT_EV5_PKT(bt_dev.features)) { - bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_EV5); + bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_EV5); } if (BT_FEAT_2EV3_PKT(bt_dev.features)) { - bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_2EV3); + bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_2EV3); } if (BT_FEAT_3EV3_PKT(bt_dev.features)) { - bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_3EV3); + bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_3EV3); } if (BT_FEAT_3SLOT_PKT(bt_dev.features)) { - bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_2EV5 | - HCI_PKT_TYPE_ESCO_3EV5); + bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_2EV5 | + HCI_PKT_TYPE_ESCO_3EV5); } } diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index e8b33c3a7dfc9..b987423ca8fde 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -56,24 +56,21 @@ struct bt_dev_le { /* LE features */ u8_t features[1][8]; /* LE states */ - u64_t states; + u64_t states; #if defined(CONFIG_BLUETOOTH_CONN) /* Controller buffer information */ - u16_t mtu; + u16_t mtu; struct k_sem pkts; #endif /* CONFIG_BLUETOOTH_CONN */ }; #if defined(CONFIG_BLUETOOTH_BREDR) -struct bt_dev_esco { - u16_t pkt_type; -}; - struct bt_dev_br { /* Max controller's acceptable ACL packet length */ - u16_t mtu; - struct k_sem pkts; + u16_t mtu; + struct k_sem pkts; + u16_t esco_pkt_type; }; #endif @@ -88,9 +85,9 @@ struct bt_dev { /* Controller version & manufacturer information */ u8_t hci_version; u8_t lmp_version; - u16_t hci_revision; - u16_t lmp_subversion; - u16_t manufacturer; + u16_t hci_revision; + u16_t lmp_subversion; + u16_t manufacturer; /* LMP features (pages 0, 1, 2) */ u8_t features[LMP_FEAT_PAGES_COUNT][8]; @@ -108,7 +105,6 @@ struct bt_dev { #if defined(CONFIG_BLUETOOTH_BREDR) /* BR/EDR controller specific features */ struct bt_dev_br br; - struct bt_dev_esco esco; #endif /* Number of commands controller can accept */ diff --git a/subsys/bluetooth/host/keys.h b/subsys/bluetooth/host/keys.h index 9c5b205cdeadf..a2470753c738d 100644 --- a/subsys/bluetooth/host/keys.h +++ b/subsys/bluetooth/host/keys.h @@ -28,8 +28,8 @@ enum { }; struct bt_ltk { - u64_t rand; - u16_t ediv; + u64_t rand; + u16_t ediv; u8_t val[16]; }; @@ -40,14 +40,14 @@ struct bt_irk { struct bt_csrk { u8_t val[16]; - u32_t cnt; + u32_t cnt; }; struct bt_keys { bt_addr_le_t addr; u8_t enc_size; ATOMIC_DEFINE(flags, BT_KEYS_NUM_FLAGS); - u16_t keys; + u16_t keys; struct bt_ltk ltk; struct bt_irk irk; #if defined(CONFIG_BLUETOOTH_SIGNING) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 8cacac5a8356e..125030c89b087 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -41,28 +41,21 @@ #define L2CAP_CONN_TIMEOUT K_SECONDS(40) #define L2CAP_DISC_TIMEOUT K_SECONDS(1) +static sys_slist_t le_channels; + +#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) /* Size of MTU is based on the maximum amount of data the buffer can hold * excluding ACL and driver headers. */ -#define BT_L2CAP_MAX_LE_MPS BT_L2CAP_RX_MTU +#define L2CAP_MAX_LE_MPS BT_L2CAP_RX_MTU /* For now use MPS - SDU length to disable segmentation */ -#define BT_L2CAP_MAX_LE_MTU (BT_L2CAP_MAX_LE_MPS - 2) +#define L2CAP_MAX_LE_MTU (L2CAP_MAX_LE_MPS - 2) -#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) #define l2cap_lookup_ident(conn, ident) __l2cap_lookup_ident(conn, ident, false) #define l2cap_remove_ident(conn, ident) __l2cap_lookup_ident(conn, ident, true) -#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */ -static sys_slist_t le_channels; -#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) static sys_slist_t servers; -#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */ -#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) -/* Pool for outgoing LE data packets, MTU is 23 */ -NET_BUF_POOL_DEFINE(le_data_pool, CONFIG_BLUETOOTH_MAX_CONN, - BT_L2CAP_BUF_SIZE(BT_L2CAP_MAX_LE_MPS), - BT_BUF_USER_DATA_MIN, NULL); #endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */ /* L2CAP signalling channel specific context */ @@ -634,7 +627,7 @@ static void l2cap_chan_rx_init(struct bt_l2cap_le_chan *chan) /* Use existing MTU if defined */ if (!chan->rx.mtu) { - chan->rx.mtu = BT_L2CAP_MAX_LE_MTU; + chan->rx.mtu = L2CAP_MAX_LE_MTU; } /* Use existing credits if defined */ @@ -642,13 +635,13 @@ static void l2cap_chan_rx_init(struct bt_l2cap_le_chan *chan) if (chan->chan.ops->alloc_buf) { /* Auto tune credits to receive a full packet */ chan->rx.init_credits = chan->rx.mtu / - BT_L2CAP_MAX_LE_MPS; + L2CAP_MAX_LE_MPS; } else { chan->rx.init_credits = L2CAP_LE_MAX_CREDITS; } } - chan->rx.mps = BT_L2CAP_MAX_LE_MPS; + chan->rx.mps = L2CAP_MAX_LE_MPS; k_sem_init(&chan->rx.credits, 0, UINT_MAX); } @@ -1008,7 +1001,7 @@ static inline struct net_buf *l2cap_alloc_seg(struct net_buf *buf) /* Try to use original pool if possible */ if (buf->pool->user_data_size >= BT_BUF_USER_DATA_MIN && - buf->pool->buf_size >= BT_L2CAP_BUF_SIZE(BT_L2CAP_MAX_LE_MPS)) { + buf->pool->buf_size >= BT_L2CAP_BUF_SIZE(L2CAP_MAX_LE_MPS)) { seg = net_buf_alloc(buf->pool, K_NO_WAIT); if (seg) { net_buf_reserve(seg, BT_L2CAP_CHAN_SEND_RESERVE); @@ -1016,7 +1009,8 @@ static inline struct net_buf *l2cap_alloc_seg(struct net_buf *buf) } } - return bt_l2cap_create_pdu(&le_data_pool, 0); + /* Fallback to using global connection tx pool */ + return bt_l2cap_create_pdu(NULL, 0); } static struct net_buf *l2cap_chan_create_seg(struct bt_l2cap_le_chan *ch, @@ -1083,11 +1077,8 @@ static int l2cap_chan_le_send(struct bt_l2cap_le_chan *ch, struct net_buf *buf, } buf = l2cap_chan_create_seg(ch, buf, sdu_hdr_len); - if (!buf) { - return -ENOMEM; - } - /* Channel may have been disconnected while waiting for credits */ + /* Channel may have been disconnected while waiting for a buffer */ if (!ch->chan.conn) { net_buf_unref(buf); return -ECONNRESET; diff --git a/subsys/bluetooth/host/l2cap_br.c b/subsys/bluetooth/host/l2cap_br.c index 0f89d17d45bdb..f2111de7c83ce 100644 --- a/subsys/bluetooth/host/l2cap_br.c +++ b/subsys/bluetooth/host/l2cap_br.c @@ -89,7 +89,7 @@ struct bt_l2cap_br { struct bt_l2cap_br_chan chan; u8_t info_ident; u8_t info_fixed_chan; - u32_t info_feat_mask; + u32_t info_feat_mask; }; static struct bt_l2cap_br bt_l2cap_br_pool[CONFIG_BLUETOOTH_MAX_CONN]; @@ -893,7 +893,7 @@ static void l2cap_br_send_reject(struct bt_conn *conn, u8_t ident, } static u16_t l2cap_br_conf_opt_mtu(struct bt_l2cap_chan *chan, - struct net_buf *buf, size_t len) + struct net_buf *buf, size_t len) { u16_t mtu, result = BT_L2CAP_CONF_SUCCESS; diff --git a/subsys/bluetooth/host/l2cap_internal.h b/subsys/bluetooth/host/l2cap_internal.h index 24c6ae03329c1..7fe6a06441fac 100644 --- a/subsys/bluetooth/host/l2cap_internal.h +++ b/subsys/bluetooth/host/l2cap_internal.h @@ -198,8 +198,7 @@ struct bt_l2cap_le_credits { struct bt_l2cap_fixed_chan { u16_t cid; int (*accept)(struct bt_conn *conn, struct bt_l2cap_chan **chan); - - sys_snode_t node; + sys_snode_t node; }; /* Register a fixed L2CAP channel for L2CAP */ diff --git a/subsys/bluetooth/host/monitor.h b/subsys/bluetooth/host/monitor.h index 1fcb998cc264a..b884994b78173 100644 --- a/subsys/bluetooth/host/monitor.h +++ b/subsys/bluetooth/host/monitor.h @@ -65,7 +65,7 @@ struct bt_monitor_new_index { u8_t type; u8_t bus; u8_t bdaddr[6]; - char name[8]; + char name[8]; } __packed; struct bt_monitor_user_logging { diff --git a/subsys/bluetooth/host/sdp.c b/subsys/bluetooth/host/sdp.c index e9d19476bb5d3..514e16a0df187 100644 --- a/subsys/bluetooth/host/sdp.c +++ b/subsys/bluetooth/host/sdp.c @@ -75,7 +75,7 @@ struct bt_sdp_client { /* list of waiting to be resolved UUID params */ sys_slist_t reqs; /* required SDP transaction ID */ - u16_t tid; + u16_t tid; /* UUID params holder being now resolved */ const struct bt_sdp_discover_params *param; /* PDU continuation state object */ @@ -104,11 +104,11 @@ struct select_attrs_data { struct bt_sdp *sdp; struct bt_sdp_data_elem_seq *seq; struct search_state *state; - u32_t *filter; - u16_t max_att_len; - u16_t att_list_len; - u8_t cont_state_size; - u8_t num_filters; + u32_t *filter; + u16_t max_att_len; + u16_t att_list_len; + u8_t cont_state_size; + u8_t num_filters; bool new_service; }; @@ -123,7 +123,7 @@ struct select_attrs_data { * or BT_SDP_ITER_STOP to stop. */ typedef u8_t (*bt_sdp_attr_func_t)(struct bt_sdp_attribute *attr, - u8_t att_idx, void *user_data); + u8_t att_idx, void *user_data); /* @typedef bt_sdp_svc_func_t * @brief SDP service record iterator callback. @@ -135,7 +135,7 @@ typedef u8_t (*bt_sdp_attr_func_t)(struct bt_sdp_attribute *attr, * or BT_SDP_ITER_STOP to stop. */ typedef u8_t (*bt_sdp_svc_func_t)(struct bt_sdp_record *rec, - void *user_data); + void *user_data); /* @brief Callback for SDP connection * @@ -329,7 +329,7 @@ static u16_t parse_data_elem(struct net_buf *buf, * (used in recursion) */ static u32_t search_uuid(struct bt_sdp_data_elem *elem, struct bt_uuid *uuid, - bool *found, u8_t nest_level) + bool *found, u8_t nest_level) { const u8_t *cur_elem; u32_t seq_size, size; @@ -565,7 +565,7 @@ static u16_t find_services(struct net_buf *buf, * @return 0 for success, or relevant error code */ static u16_t sdp_svc_search_req(struct bt_sdp *sdp, struct net_buf *buf, - u16_t tid) + u16_t tid) { struct bt_sdp_svc_rsp *rsp; struct net_buf *resp_buf; @@ -701,7 +701,7 @@ static u16_t sdp_svc_search_req(struct bt_sdp *sdp, struct net_buf *buf, * (used in recursion) */ static u32_t copy_attribute(struct bt_sdp_data_elem *elem, - struct net_buf *buf, u8_t nest_level) + struct net_buf *buf, u8_t nest_level) { const u8_t *cur_elem; u32_t size, seq_size, total_size; @@ -773,7 +773,7 @@ static u32_t copy_attribute(struct bt_sdp_data_elem *elem, * @return Index of the attribute where the iterator stopped */ static u8_t bt_sdp_foreach_attr(struct bt_sdp_record *record, u8_t idx, - bt_sdp_attr_func_t func, void *user_data) + bt_sdp_attr_func_t func, void *user_data) { for (; idx < record->attr_count; idx++) { if (func(&record->attrs[idx], idx, user_data) == @@ -799,7 +799,7 @@ static u8_t bt_sdp_foreach_attr(struct bt_sdp_record *record, u8_t idx, * or BT_SDP_ITER_STOP to stop. */ static u8_t select_attrs(struct bt_sdp_attribute *attr, u8_t att_idx, - void *user_data) + void *user_data) { struct select_attrs_data *sad = user_data; u16_t att_id_lower, att_id_upper, att_id_cur, space; @@ -928,12 +928,11 @@ static u8_t select_attrs(struct bt_sdp_attribute *attr, u8_t att_idx, * * @return len Length of the attribute list created */ -static u16_t create_attr_list(struct bt_sdp *sdp, - struct bt_sdp_record *record, - u32_t *filter, u8_t num_filters, - u16_t max_att_len, u8_t cont_state_size, - u8_t next_att, struct search_state *state, - struct net_buf *rsp_buf) +static u16_t create_attr_list(struct bt_sdp *sdp, struct bt_sdp_record *record, + u32_t *filter, u8_t num_filters, + u16_t max_att_len, u8_t cont_state_size, + u8_t next_att, struct search_state *state, + struct net_buf *rsp_buf) { struct select_attrs_data sad; u8_t idx_att; @@ -974,7 +973,7 @@ static u16_t create_attr_list(struct bt_sdp *sdp, * @return 0 for success, or relevant error code */ static u16_t get_att_search_list(struct net_buf *buf, u32_t *filter, - u8_t *num_filters) + u8_t *num_filters) { struct bt_sdp_data_elem data_elem; u16_t res; @@ -1054,7 +1053,7 @@ static u8_t find_handle(struct bt_sdp_record *rec, void *user_data) * @return 0 for success, or relevant error code */ static u16_t sdp_svc_att_req(struct bt_sdp *sdp, struct net_buf *buf, - u16_t tid) + u16_t tid) { u32_t filter[MAX_NUM_ATT_ID_FILTER]; struct search_state state = { @@ -1168,7 +1167,7 @@ static u16_t sdp_svc_att_req(struct bt_sdp *sdp, struct net_buf *buf, * @return 0 for success, or relevant error code */ static u16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf, - u16_t tid) + u16_t tid) { u32_t filter[MAX_NUM_ATT_ID_FILTER]; struct bt_sdp_record *matching_recs[BT_SDP_MAX_SERVICES]; @@ -1313,8 +1312,7 @@ static u16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf, static const struct { u8_t op_code; - u16_t (*func)(struct bt_sdp *sdp, struct net_buf *buf, - u16_t tid); + u16_t (*func)(struct bt_sdp *sdp, struct net_buf *buf, u16_t tid); } handlers[] = { { BT_SDP_SVC_SEARCH_REQ, sdp_svc_search_req }, { BT_SDP_SVC_ATTR_REQ, sdp_svc_att_req }, @@ -1588,7 +1586,7 @@ static void sdp_client_params_iterator(struct bt_sdp_client *session) } static u16_t sdp_client_get_total(struct bt_sdp_client *session, - struct net_buf *buf, u16_t *total) + struct net_buf *buf, u16_t *total) { u16_t pulled; u8_t seq; @@ -2170,9 +2168,9 @@ struct bt_sdp_uuid_desc { struct bt_uuid_16 uuid16; struct bt_uuid_32 uuid32; }; - u16_t attr_id; - u8_t *params; - u16_t params_len; + u16_t attr_id; + u8_t *params; + u16_t params_len; }; /* Generic attribute item collector. */ diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 61c3db4711754..30ecceedf10ac 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -677,9 +677,9 @@ static void sc_derive_link_key(struct bt_smp *smp) if (atomic_test_bit(smp->flags, SMP_FLAG_CT2)) { /* constants as specified in Core Spec Vol.3 Part H 2.4.2.4 */ static const u8_t salt[16] = { 0x31, 0x70, 0x6d, 0x74, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 }; + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; if (smp_h7(salt, conn->le.keys->ltk.val, ilk)) { bt_keys_link_key_clear(link_key); @@ -836,9 +836,9 @@ static void smp_br_derive_ltk(struct bt_smp_br *smp) if (atomic_test_bit(smp->flags, SMP_FLAG_CT2)) { /* constants as specified in Core Spec Vol.3 Part H 2.4.2.5 */ static const u8_t salt[16] = { 0x32, 0x70, 0x6d, 0x74, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 }; + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; if (smp_h7(salt, link_key->val, ilk)) { bt_keys_link_key_clear(link_key); diff --git a/subsys/debug/Kconfig b/subsys/debug/Kconfig index 3ca9d9239f51b..67b540b112371 100644 --- a/subsys/debug/Kconfig +++ b/subsys/debug/Kconfig @@ -6,6 +6,125 @@ # SPDX-License-Identifier: Apache-2.0 # +menu "Debugging Options" + +config DEBUG + bool "Build kernel with debugging enabled" + default n + help + Build a kernel suitable for debugging. Right now, this option + only disables optimization, more debugging variants can be selected + from here to allow more debugging. + +config STACK_USAGE + bool "Generate stack usage information" + default n + help + Generate an extra file that specifies the maximum amount of stack used, + on a per-function basis. + +config PRINTK + bool + prompt "Send printk() to console" + depends on CONSOLE_HAS_DRIVER + default y + help + This option directs printk() debugging output to the supported + console device, rather than suppressing the generation + of printk() output entirely. Output is sent immediately, without + any mutual exclusion or buffering. + +config STDOUT_CONSOLE + bool + prompt "Send stdout to console" + depends on CONSOLE_HAS_DRIVER + default n + help + This option directs standard output (e.g. printf) to the console + device, rather than suppressing it entirely. + +config EARLY_CONSOLE + bool + prompt "Send stdout at the earliest stage possible" + default n + help + This option will enable stdout as early as possible, for debugging + purpose. For instance, in case of STDOUT_CONSOLE being set it will + initialize its driver earlier than normal, in order to get the stdout + sent through the console at the earliest stage possible. + +config ASSERT + bool + prompt "Enable __ASSERT() macro" + default n + help + This enables the __ASSERT() macro in the kernel code. If an assertion + fails, the calling thread is put on an infinite tight loop. Since + enabling this adds a significant footprint, it should only be enabled + in a non-production system. + +config ASSERT_LEVEL + int + prompt "__ASSERT() level" + default 2 + range 0 2 + depends on ASSERT + help + This option specifies the assertion level used by the __ASSERT() + macro. It can be set to one of three possible values: + + Level 0: off + Level 1: on + warning in every file that includes __assert.h + Level 2: on + no warning + +config DEBUG_TRACING_KERNEL_OBJECTS + bool "Kernel object tracing (deprecated)" + select OBJECT_TRACING + default n + help + For backward compatibility only + +config OBJECT_TRACING + bool + prompt "Kernel object tracing" + default n + help + This option enable the feature for tracing kernel objects. This option + is for debug purposes and increases the memory footprint of the kernel. + +config OVERRIDE_FRAME_POINTER_DEFAULT + bool + prompt "Override compiler defaults for -fomit-frame-pointer" + default n + help + Omitting the frame pointer prevents the compiler from putting the stack + frame pointer into a register. Saves a few instructions in function + prologues/epilogues and frees up a register for general-purpose use, + which can provide good performance improvements on register-constrained + architectures like x86. On some architectures (including x86) omitting + frame pointers impedes debugging as local variables are harder to + locate. At -O1 and above gcc will enable -fomit-frame-pointer + automatically but only if the architecture does not require if for + effective debugging. + + Choose Y if you want to override the default frame pointer behavior + of your compiler, otherwise choose N. + +config OMIT_FRAME_POINTER + bool + prompt "Omit frame pointer" + default n + depends on OVERRIDE_FRAME_POINTER_DEFAULT + help + Choose Y for best performance. On some architectures (including x86) + this will favor code size and performance over debugability. + + Choose N in you wish to retain the frame pointer. This option may + be useful if your application uses runtime backtracing and does not + support parsing unwind tables. + + If unsure, disable OVERRIDE_FRAME_POINTER_DEFAULT to allow the compiler + to adopt sensible defaults for your architecture. menu "Safe memory access" @@ -129,3 +248,5 @@ config OPENOCD_SUPPORT This option exports an array of offsets to kernel structs, used by OpenOCD to determine the state of running threads. (This option selects CONFIG_THREAD_MONITOR, so all of its caveats are implied.) + +endmenu diff --git a/tests/bluetooth/shell/src/main.c b/tests/bluetooth/shell/src/main.c index d1a8e9f961bc3..68dc2b2659069 100644 --- a/tests/bluetooth/shell/src/main.c +++ b/tests/bluetooth/shell/src/main.c @@ -2130,6 +2130,11 @@ static int cmd_l2cap_connect(int argc, char *argv[]) return -EINVAL; } + if (l2cap_chan.chan.conn) { + printk("Channel already in use\n"); + return -EINVAL; + } + psm = strtoul(argv[1], NULL, 16); err = bt_l2cap_chan_connect(default_conn, &l2cap_chan.chan, psm); diff --git a/tests/kernel/test_tickless/src/timestamps.c b/tests/kernel/test_tickless/src/timestamps.c index 8c097c4b324f2..46122ba6399a6 100644 --- a/tests/kernel/test_tickless/src/timestamps.c +++ b/tests/kernel/test_tickless/src/timestamps.c @@ -237,7 +237,7 @@ void _TimestampClose(void) _TIMESTAMP_CTRL = 0x0; /* disable oscillator */ } -#elif defined(CONFIG_SOC_ATMEL_SAM3) +#elif defined(CONFIG_SOC_SERIES_SAM3) /* Atmel SAM3 family processor - use RTT (Real-time Timer) */ #include diff --git a/tests/kernel/test_tickless/testcase.ini b/tests/kernel/test_tickless/testcase.ini index d217bfd1d61ae..987143844690f 100644 --- a/tests/kernel/test_tickless/testcase.ini +++ b/tests/kernel/test_tickless/testcase.ini @@ -2,5 +2,5 @@ tags = core arch_exclude = nios2 filter = CONFIG_X86 or (CONFIG_ARM and - (CONFIG_SOC_MK64F12 or CONFIG_SOC_ATMEL_SAM3)) or + (CONFIG_SOC_MK64F12 or CONFIG_SOC_SERIES_SAM3)) or (CONFIG_ARC and CONFIG_SOC_QUARK_SE_C1000_SS)