diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c451b53 --- /dev/null +++ b/.gitignore @@ -0,0 +1,53 @@ +*.a +*.bak +*.db +*.flash +*.gcda +*.gcno +*.log +*.o +*.lo +*.la +*.ninja* +*.opendb +*.orig +*.pcap +*.pyc +*.suo +*.swn +*.swo +*.swp +*.trs +*.user +*.bak +*~ +.deps +.dirstamp +.DS_Store +.local-version +.libs +.vagrant +.hg +.hgignore + +# CMake +Software/OpenThread/build/ +CMakeCache.txt +CMakeFiles +cmake_install.cmake + +# IDE / editor files +.idea/** +.vscode/** +cmake-build-*/** +/tags +.project +.pydevproject + +# Python bytecodes +__pycache__ + +# Images +*.hex +*.zip + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f468414 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,7 @@ +[submodule "third_party/openthread"] + branch = main + path = ThirdParty/openthread + url = https://github.com/openthread/openthread.git +[submodule "ThirdParty/tool_rpi"] + path = ThirdParty/tool_rpi + url = https://github.com/raspberrypi/tools.git diff --git a/Certification.md b/Certification.md new file mode 100644 index 0000000..518c321 --- /dev/null +++ b/Certification.md @@ -0,0 +1,80 @@ +## Certified components + +### Bluetooth Low Energy + +**Certification overview:** + +| | QDID | Declaration ID | Specification | Link | +| --- | --- | --- | --- | --- | +| BLE Controller QPG7015M | 163591 | D056523 | 5.2 | [https://launchstudio.bluetooth.com/ListingDetails/123871](https://launchstudio.bluetooth.com/ListingDetails/123871) | +| BLE Host Stack | 146344 | D049426 | 5.2 | [https://launchstudio.bluetooth.com/ListingDetails/103670](https://launchstudio.bluetooth.com/ListingDetails/103670) | +| BLE profiles subsystem | N/A | N/A | N/A | Not certified but verified with the TCRL.2018-2 compliance tester using Bluetooth Profile Tuning Suites 7.3.0. **Please include testing for the BLE profiles included in your end-product listing.** | + +**End-product certification instructions** + +SDK users can reference Qorvo QDIDs (see above) in their End Product Listing (EPL) +- 1 BLE controller subsystem: Supplied by Qorvo SDK +- 1 BLE host subsystem: Supplied by Qorvo SDK +- \[optional\] Profile subsystem: **No certified subsystem in this SDK** + - When modifying the profiles from the SDK or when the subsystem was not certified, one should selectively test the modified/non-certified profiles using the [profile-tuning-suite](https://www.bluetooth.com/develop-with-bluetooth/qualification-listing/qualification-test-tools/profile-tuning-suite/). Results of the Profile Tuning Suite tests should be verified by a [Bluetooth Qualification Test Facility (BQTF)](https://www.bluetooth.com/develop-with-bluetooth/qualification-listing/qualification-test-facilities). +### Thread + +**Certification overview:** + +| | Certification ID | Test Harness | Specification | Link | +| --- | --- | --- | --- | --- | +| QPG7015M Thread Component | 13A072.1 | v58.0 | 1.3 |[https://www.threadgroup.org](https://www.threadgroup.org/What-is-Thread/Developers#dnn_ctr1464_Thread_CompDataDefault_rptrProductData_tdcn_50)| + + +**Thread Device Roles** + +| | | +|--- |---| +|Border Router |X| +|FTD-REED |X| +|FTD-FED || +|MED || +|SED || +|SSED || +|On-Mesh Commissioner|X| +|Thread Joiner |X| + +**Optional Features** + +| | | +|--- |---| +|DUA Management (BR) |X| +|DUA Registration (MTD) |X| +|Link Metrics Initiator (FTD) |X| +|DHCPv6 Agent || +|DHCPv6 Client |X| +|Joiner Provisioning (Joiner) || + +**End-product certification instructions** + +Qorvo provides a PR SDK that has been certified as "Thread Component" (tested by a [Authorized-Test-Lab](https://www.threadgroup.org/Authorized-Test-Lab) and certification requested at the ThreadGroup). The seleced *device roles* and *optional features* are tailored for generic Thread usage, but can be reduced for e.g. Matter-only devices (no need for Thread Joiner role) + +Qorvo provides maintenance SDKs that have been verified by running the certification tests in-house using a Thread Test Harness. This offers confidence for customers to use this SDK, but does not allow for inheritance. + +Qorvo does not provide "end product" certified modules or white-label products. A customer is expected to apply for "end product" certification which may require different tests methods than "Thread Component" certification. + +**Certification by similarity (inheritance)** + +The SDK offers the Thread stack in 2 ways: +- \[No inheritance possible\] Source code to run natively on your platform agter cross-compilation and porting +- \[Inheritance possible\] OpenThread Border Router docker image + +### Zigbee + +**Certification overview:** + +| | Certification ID | Specification | Link | +| --- | --- | --- | --- | +| QPG7015M Zigbee Compliant Platform reference | ZIG22013ZCP27336-24 | R22 |[https://csa-iot.org/csa_product/qpg6105/](https://csa-iot.org/csa_product/qpg6105/)| + +Note: Qorvo certified QPG6105 as parent of our Zigbee Pro R22 compliant platform family. We reference this when certifying derivitive compliant platforms by similarity. + +**End-product certification instructions** + +Qorvo's SDKs for their Zigbee compliant platforms can be used to apply for end-product certification. +The SDKs come with test applications and instructions that enable an [Authorized-Test-Lab](https://www.threadgroup.org/Authorized-Test-Lab) to run end-product certification testing on a Zigbee Unified Test Harness (ZUTH) diff --git a/Documents/Guides/setup_ot_borderrouter.md b/Documents/Guides/setup_ot_borderrouter.md new file mode 100644 index 0000000..4dbd431 --- /dev/null +++ b/Documents/Guides/setup_ot_borderrouter.md @@ -0,0 +1,97 @@ +# Setup OpenThread Border Router on Qorvo's QPG7015M Gateway development kit + +In this guide, step by step instructions are given to setup an OpenThread Border Router, using Qorvo's QPG7015M Gateway Development Kit. +This enables the user to set up a Matter network and control Matter devices over Wi-Fi/ethernet with the QPG7015M operating as an OpenThread Border Router, using the [Android chip-tool](https://github.com/Qorvo/QMatter/blob/v0.7.1.0/Documents/Guides/commissioning_android_chiptool.md), or the [POSIX CLI chip-tool](https://github.com/Qorvo/QMatter/blob/v0.7.1.0/Documents/Guides/commissioning_posix_cli_chiptool.md). + +Required Hardware: +- Access point/Router to connect your QPG7015M Gateway development kit to a local area network (LAN). +- Qorvo's QPG7015M Gateway development kit: + +
+ QPG7015M Gateway Development Kit +
+ +## Index + +1. [Step 1: Establish access to the QPG7015M Gateway Development Kit](#step-1-establish-access-to-the-qpg7015m-gateway-development-kit) +2. [Step 2: Configure the QPG7015M Gateway Development Kit for OpenThread Border Router](#step-2-configure-the-qpg7015m-gateway-development-kit-for-openthread-border-router) +3. [Step 3: Start the OpenThread Border Router](#step-3-start-the-openthread-border-router) +4. [Step 4: Stop the OpenThread Border Router](#step-4-stop-the-openthread-border-router) +5. [Step 5: Factory reset the OpenThread Border Router](#step-5-factory-reset-the-openthread-border-router) + + +## Step 1: Establish access to the QPG7015M Gateway Development Kit + +Described in the section "[Accessing the QPG7015M Gateway Development Kit's terminal](./setup_qpg7015m_dk.md#accessing-the-qpg7015m-gateway-development-kits-terminal)" of the QPG7015M Gateway DK Setup guide. + +## Step 2: Configure the QPG7015M Gateway Development Kit for OpenThread Border Router + +How to edit the configuration file is described in the section "[Configure the QPG7015M Gateway Development Kit](./setup_qpg7015m_dk.md#configure-the-qpg7015m-gateway-development-kit)" of the QPG7015M Gateway DK Setup guide. +In [Stack configuration](./setup_qpg7015m_dk.md#stack-configuration) disable the unwanted stacks and enable following parameters: + +```shell +QORVO_OT_BR=1 +QORVO_OT_BRBB_INTERFACE=wlan0 +``` + +## Step 3: Start the OpenThread Border Router + +Now the QPG7015M Gateway Development Kit, must be started to run with the configuration set in [Step 2](#step-2-configure-the-qpg7015m-gateway-development-kit-for-openthread-border-router). +This is described in the section "[Start the QPG7015M Gateway Development Kit](./setup_qpg7015m_dk.md#start-the-qpg7015m-gateway-development-kit)" of the QPG7015M Gateway DK Setup guide. +Make sure you see following logging: + +```shell + +Loading ot-br docker image from file! +3a7cc06ad581: Loading layer [==================================================>] 48.07MB/48.07MB +57fa7918522d: Loading layer [==================================================>] 81.91MB/81.91MB +d626ab464e19: Loading layer [==================================================>] 197.7MB/197.7MB +Loaded image: connectedhomeip/otbr:te7 +55dbfafd48f5297dbceb19d76e407d873e6657bf47de246908a705515164f9ba +Gateway does not start automatically at boot + +------- + +Docker container otbr_docker_0 is running and Up 6 seconds. + +You can now start ot-ctl command-line utility, and get logs by entering the following commands: + +docker exec -it otbr_docker_0 ot-ctl +docker logs otbr_docker_0 + +------- +GATEWAY STARTED AND READY TO USE! + +``` + +The OpenThread Border Router launches a Wi-Fi Access Point `BorderRouter-AP` with password `Qorvo_QPG7015M`. The user is now able to access the OpenThread Border Router via its IP address or hostname on a device that's connected to that Wi-Fi Access point. Matter devices can be joined to the network using the [Android chip-tool](https://github.com/Qorvo/QMatter/blob/v0.7.1.0/Documents/Guides/commissioning_android_chiptool.md) or the [POSIX CLI chip-tool](https://github.com/Qorvo/QMatter/blob/v0.7.1.0/Documents/Guides/commissioning_posix_cli_chiptool.md). + +## Step 4: Stop the OpenThread Border Router + +This is described in the section "[Stop the QPG7015M Gateway Development Kit](./setup_qpg7015m_dk.md#stop-the-qpg7015m-gateway-development-kit)" of the QPG7015M Gateway DK Setup guide. +Stopping the DK will **NOT** delete the info of the joined devices. + +## Step 5: Factory reset the OpenThread Border Router + +This is described in the section "[Factory reset the QPG7015M Gateway Development Kit](./setup_qpg7015m_dk.md#factory-reset-the-qpg7015m-gateway-development-kit)" of the QPG7015M Gateway DK Setup guide. +This action **WILL** delete the info of all joined devices. +Pay attention to following logging: + +```shell +pi@[hostname]:~ $ ./factory_reset_gateway.sh +FACTORY RESETTING GATEWAY... +STOPPING GATEWAY... + +... + +Total reclaimed space: 0B +Deleted Images: +untagged: connectedhomeip/otbr:te7 +deleted: sha256:ba054de35dcad1ffaf528a028f2310411f24715880cef036f8351cfbebeb5bfd +deleted: sha256:b033431b9748e9f80ee127caf8596b3a5746cc44d7165ed94f98cef8a9eb8797 +deleted: sha256:f8263691911c51510a7fe67946455f6a068093a0249acbfba1f6365e9eeea937 +deleted: sha256:3a7cc06ad5817e6e36c96383ae1de75e1c9fc86fcb1fa65892fb30c7194a096e + +Total reclaimed space: 318.1MB +GATEWAY IS FACTORY RESET! +``` diff --git a/Documents/Guides/setup_qpg7015m_dk.md b/Documents/Guides/setup_qpg7015m_dk.md new file mode 100644 index 0000000..350d767 --- /dev/null +++ b/Documents/Guides/setup_qpg7015m_dk.md @@ -0,0 +1,528 @@ +# Setup Qorvo's QPG7015M Gateway development kit +In this guide, step by step instructions are given to setup up Qorvo's QPG7015M Gateway Development Kit (DK). + +Required Hardware: +- Qorvo's QPG7015M Gateway development kit: + + 1 QPG7015M Radio Board + + 1 Raspberry Pi 4 single board computer + + 1 Raspberry Pi 4 Power supply + + 1 USB C to USB A cable + +
+ QPG7015M Gateway Development Kit +
+ +## Index + +1. [Accessing the QPG7015M Gateway Development Kit's terminal](#accessing-the-qpg7015m-gateway-development-kits-terminal) +2. [Configure the QPG7015M Gateway Development Kit](#configure-the-qpg7015m-gateway-development-kit) +3. [Start the QPG7015M Gateway Development Kit](#start-the-qpg7015m-gateway-development-kit) +4. [Stop the QPG7015M Gateway Development Kit](#stop-the-qpg7015m-gateway-development-kit) +5. [Factory reset the QPG7015M Gateway Development Kit](#factory-reset-the-qpg7015m-gateway-development-kit) + +## Accessing the QPG7015M Gateway Development Kit's terminal + +The QPG7015M Gateway DK comes with a power supply to power the device. Insert the power supply in the USB C port on the front of the QPG7015M Gateway DK. This side is indicated by the label and shown in [the image below](../Images/qpg7015m_dk_power_supply.png). +
+ Power the QPG7015M Gateway DK +
+ +Access to the QPG7015M Gateway Development Kit terminal is required to configure, start and stop applications. +There are two options to access the terminal of the QPG7015M Gateway Development Kit: + +- Secure SHell (SSH): Connect the QPG7015M DK to your local area network using an ethernet cable. From a computer that has an SSH client application installed the QPG7015M DK can be accessed over SSH by running from a command prompt (Windows) or terminal (Linux): +```shell +ssh pi@raspberrypi- +``` +The hostname can be found on the casing as depicted in [the image above](../Images/qpg7015m_dk_casing.png). The user of the QPG7015M DK is *pi*, the password is *raspberry*. +In this example the hostname is `raspberrypi-db99`. + +- Keyboard and screen: Connect a USB keyboard to any of the USB A ports of the QPG7015M DK and attach a screen to a High-Definition Multimedia Interface (HDMI) Micro port. Please ensure the screen is connected before applying power to the QPG7015M DK. The user of the QPG7015M DK is *pi*, the password is *raspberry*. If for some reason the hostname cannot be accessed over ethernet, this is an option to retrieve the IP address running: +```shell +ifconfig +``` + +## Configure the QPG7015M Gateway Development Kit + +The QPG7015M Gateway Development Kit comes preinstalled with several communication stacks and example applications. These can each be enabled or disabled pending on the user preference using a configuration file: `qorvo_stack_config`. +The configuration file is located in the home director: `/home/pi`. +From a terminal, the user can modify the configuration file by running: + +```shell +sudo nano qorvo_stack_config +``` + +To save the file run `ctrl + o` followed by `ctrl + x`. + +The file exists out of several sections: + +### Communication Interface Configuration + +```shell +# HARDWARE CONFIGURATION +#------ + +# Qorvo chip +QORVO_CHIP="QPG7015M" + +# Qorvo host interface selection +# "USB" +# "SPI" (default) +# QORVO_HOST_INTERFACE="SPI" +``` + +The QPG7015M supports two interface protocols: USB and SPI. By default Serial Peripheral Interface (SPI) is configured. Changing the interface protocol is done by modifying the qorvo_stack_config file AND modifying the jumper configuration on the QPG7015M Gateway DK. + +#### Access jumper configuration + +To open the QPG7015M Gateway DK, remove the [4 screws](../Images/qpg7015m_dk_screws.png) on the bottom with a cross tip screwdriver. No need to remove the nut. Afterwards the top of the plastic casing can be removed. + +
+ QPG7015M Gateway DK screws +
+ +The jumpers CFG1 and CFG2 can be found by opening the case. They're shown in [the image below](../Images/qpg7015m_radio_board_cfg1_cfg2.png) + +
+ CFG1 and CFG2 on QPG7015M Radio Board +
+ + +#### Set SPI in configuration file + +To enable SPI, the user must set the the QORVO_HOST_INTERFACE in the qorvo_stack_config file as such: + +```shell +QORVO_HOST_INTERFACE="SPI" +``` + + +#### Set jumpers to SPI + +Additionally, the user needs to set the correct HW configuration. +The jumpers for CFG1 and CFG2 need to be set as shown in [the SPI jumper configuration](../Images/pin_cfg_spi.png) + +
+ SPI Interface configuration +
+ +#### Set USB in configuration file + +To enable the Universal Serial Bus (USB) interface, the user must configure the QORVO_HOST_INTERFACE as such: + +```shell +QORVO_HOST_INTERFACE="USB" +``` + +#### Set jumpers to USB + +Aditionally the jumpers for CFG1 and CFG2 need to be set as shown in [the USB jumper configuration](../Images/pin_cfg_usb.png). +The user will also need to connect the USB C to USB A cable, show on [the image of the QPG7015M DK](../Images/qpg7015m_dk_casing.png) + +
+ USB Interface configuration +
+ +### Application location on the filesystem + +These parameters are used to give input to the Qorvo startup, stop and reset scripts about the path of the application executables and kernel drivers on the filesystem. +> **WARNING:** These locations should not be changed when using the QPG7015M Gateway Development Kit, but can be modified when building a custom filesystem when porting the QPG7015M DK SW to a custom platform. + + +``` +# LOCATIONS +#------ + +# ZigBee 3.0 stack location: "ZigBee3.0" (default) +# "ZigBee3.0_OSHS" +# QORVO_ZB3="ZigBee3.0" + +# OpenThread stack location: "OpenThread" (default) +# QORVO_OPENTHREAD="OpenThread" + +# Ble stack location: "Bluetooth_LE" (default) +# QORVO_BLE="Bluetooth_LE" + +# FirmwareUpdater location: "FirmwareUpdater" (default) +# QORVO_FIRMWAREUPDATER="FirmwareUpdater" + +# Firmware image location: "${QORVO_FIRMWAREUPDATER}/Firmware_${QORVO_CHIP}${QORVO_DEBUG_POSTFIX}.hex" (default) +# QORVO_FW_IMAGE="FirmwareUpdater/Firmware_QPG7015M.hex" + +# Qorvo drivers location: "Drivers" (default) +# QORVO_DRIVERS="Drivers" + +# Qorvo Driver Path string: "${QORVO_DRIVERS}/${RUNTIME_PI_MODEL}/${RUNTIME_KERNEL_VERSION}/${QORVO_CHIP}${QORVO_DRIVER_EXT}" (default) +# QORVO_DRIVER_PATH="Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4" + +# Qorvo socket IPC location: "/dev/socket" (default) +# QORVO_SOCKET_IPC="/dev/socket" + +# PTC location: "Ptc" (default) +# QORVO_PTC_APP="Ptc" + +# CTC location: "Ctc" (default) +# QORVO_CTC_APP="Ctc" + +# Override Osal Driver kernel module name: "OsalDriver${QORVO_DRIVER_EXT}" (default) +# OSAL_DRIVER="" + +# Override OsalOem Driver kernel module name: "OsalOemDriver_${QORVO_CHIP}${QORVO_FEM}${QORVO_DRIVER_EXT}" (default) +# OSALOEM_DRIVER="" + +# Override App Driver kernel module name: "DrvComKernel_${QORVO_CHIP}${QORVO_FEM}${QORVO_DRIVER_EXT}" (default) +# APP_DRIVER="" + +``` + +### Stack configuration + +The stack configuration section is used to configure which communication stacks will be loaded at startup. Combinations of these protocols are possible. + +```shell +# STACK CONFIGURATION +#------ + +# Enable ZigBee 3.0 stack: 0 +# 1 (default) +# QORVO_ZIGBEE=1 + +# Enable Thread stack (CLI): 0 (default) +# 1 +# QORVO_OT_CLI=0 + +# Enable OpenThread Border Router: 0 (default) +# 1 +# QORVO_OT_BR=0 + +# OpenThread Border Router Backbone Interface +# eth0 (default) +# wlan0 +# QORVO_OT_BRBB_INTERFACE=eth0 + +# Enable Bluetooth LE (Host) stack: 0 +# 1 (default) +# QORVO_BLUETOOTHLE=1 + +# When QORVO_BLUETOOTHLE and one of the 802.15.4 stacks (QORVO_ZIGBEE or QORVO_OT_CLI or QORVO_OT_BR) is enabled, the QPG7015M will be configured in +# ConcurrentConnect mode. In ConcurrentConnect mode, the radio will be able to concurrently do BLE scanning and listen to a single +# 802.15.4 channel. +# If no BLE scanning is required, disable the configuration below to configure the QPG7015M in multi-channel mode, allowing the Thread +# and Zigbee stack to operate on separate channels. See GP_P1053_UM_17952_Multi_Protocol_Configuration.pdf for more information. +# 0 +# 1 (default) +# QORVO_BLUETOOTHLE_SCANNING=1 +``` + +Some additional parameters are also available here: + +- The OpenThread Border Router has two possibilities: + +1. Ethernet, the Border Router is now part of the network it is wired to. + +``` +QORVO_OT_BRBB_INTERFACE=eth0 +``` + +2. Wi-Fi, the Border Router will form a new network named `BorderRouter-AP`, with password `Qorvo_QPG7015M`. The Border Router can be accessed by connecting over Wi-Fi to this new network. + +``` +QORVO_OT_BRBB_INTERFACE=wlan0 +``` + +- When the user has configured **Bluetooth®** Low Energy as active, it is also required to specify if background scanning is required (for instance when the application is running a **Bluetooth®** LE central use case or is scanning for beacons). +Enabling **Bluetooth®** LE scanning while at least one IEEE802.15.4 protocol is enabled will enable Qorvo's ConcurrentConnect™ functionality. +ConcurrentConnect™ enables concurrently listening to a **Bluetooth®** LE advertising channel (i.e. for scanning) and an IEEE802.15.4 channel (i.e. for Zigbee or Thread). + +``` +QORVO_BLUETOOTHLE_SCANNING=0 +``` + +### Software configuration + +This section enables additional configuration for the software. + +``` +# SOFTWARE CONFIGURATION +#------ + +# Qorvo Configuration File Path string: "" (default) = /etc +# QORVO_CONFIG_PATH="" + +# Qorvo Startup XML File string: "" (default) = "start.xml" +# QORVO_STARTUP_XML="" + +# Qorvo SUDO string: "sudo" (default) +# "NONE" no sudo +# QORVO_SUDO="sudo" + +# Enable debugging options: 0 (default) +# 1 +# QORVO_DEBUG=0 + +# Enable crash dumps: 1 (default) +# 0 +# QORVO_CRASHREPORT=1 + + +# Enable Direct Test Mode 0 (default) +# 1 +# QORVO_DTM=0 + +# Configurable interference threshold for channel selection. +# The gateway scans RF energy levels at startup to select a channel. +# Channels with energy level above this threshold will not be considered. +# +# Range 0 to 255 (0: -95 dBm, 254: -45 dBm, 255: threshold disabled). +# The recommended setting is 192. +# Do not change this unless the gateway must be specifically tuned for noisy environments. +# QORVO_INTERFERENCE_THRESHOLD="192" + +# Start Gateway at boot: 0 (default) +# 1 +# QORVO_GW_AT_BOOT=0 + +# Dump COM packets in file 0 (default) +# 1 +# QORVO_COMDUMP=0 + +``` + +Three categories: + +1. Zigbee Coordinator configuration + +``` +QORVO_CONFIG_PATH="" +QORVO_STARTUP_XML="" +``` + +These parameters indicate where to find the default start configuration of the Zigbee Coordinator + +2. Debug logging + +``` +QORVO_DEBUG=0 +``` + +This parameter shows additional logging of the firmware and the kernel drivers in the kernel logging accessible via `dmesg`. + +3. Crash report generation + +``` +QORVO_CRASHREPORT=1 +``` + +This parameter generates a report when the QPG7015M Gateway DK crashes. These reports are stored at `/home/pi`. + +4. Host<>Controller traffic dump + +``` +QORVO_COMDUMP=0 +``` + +This parameter captures all traffic between the host and controller and stores it in `~/Logs`. The required application is not by default present on the QPG7015M Gateway DK and must be build from its source package. After building `ComDumpTool_RPi.elf` make sure it is in the correct folder: + +``` +pi@[hostname]:~ $ mkdir ComDumpTool +pi@[hostname]:~ $ mv ComDumpTool_RPi.elf ComDumpTool/ +``` + +> **WARNING:** ComDumpTool has an impact on the performance and should be used only during development for debug purposes. + +5. **Bluetooth®** LE Direct Test Mode + +``` +# QORVO_DTM=0 +``` + +These parameters enables **Bluetooth®** LE Direct Test Mode. This mode is used for Bluetooth® LE certifications and cannot be combined with other active stacks. + +6. Interference Threshold + +``` +# QORVO_INTERFERENCE_THRESHOLD="192" +``` + +This parameter configures the energy detect threshold used by the Zigbee stack to pick the correct channel. Its range is from 0 to 255 and is linear with the measures power. (0: -95 dBm, 254: -45 dBm, 255: threshold disabled). The recommended setting is 192. + +> **WARNING:** Do not change this unless the gateway must be specifically tuned for noisy environments. + +7. Start gateway at boot + +``` +# QORVO_GW_AT_BOOT=0 +``` + +This setting will automatically start the Qorvo QPG7015M drivers and applications upon boot. The startup behavior described in [section 3](#start-the-qpg7015m-development-kit) will be automatically triggered. + +> **WARNING:** All configurations are enabled when running the start_gateway.sh script. Meaning that disabling this feature also requires to run this script after configuration. + +## Start the QPG7015M Gateway Development Kit + +To start the QPG7015M Gateway Development Kit with the configuration set in [section 2](#configure-the-qpg7015m-gateway-development-kit), Qorvo provides a script called start_gateway.sh. +When executing the script, expect following logging (qorvo_stack_config set to the default settings): + +``` +pi@[hostname]:~ $ ./start_gateway.sh +CONFIGURING GATEWAY SERVER... +Please don't stop the process, This can take a few minutes. +Run time configuration: +QORVO_CHIP=QPG7015M +QORVO_DRIVER_EXT=_RPi4 +QORVO_ZB3=ZigBee3.0 +QORVO_HOST_INTERFACE=SPI +QORVO_BLE=Bluetooth_LE +QORVO_FIRMWAREUPDATER=FirmwareUpdater +QORVO_FW_IMAGE=FirmwareUpdater/Firmware_QPG7015M.hex +QORVO_PTC=0 +QORVO_CTC=0 +QORVO_PTC_APP=Ptc +QORVO_CTC_APP=Ctc +QORVO_BOARDCONFIG_DIR=/home/pi/BoardConfigTool +QORVO_BOARDCONFIG_BIN=BoardConfigTool_RPi.elf +QORVO_DRIVERS=Drivers +QORVO_DRIVER_PATH=Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4 +OSAL_DRIVER=OsalDriver_RPi4 +OSALOEM_DRIVER=OsalOemDriver_QPG7015M_SPI_RPi4 +APP_DRIVER=DrvComKernel_QPG7015M_SPI_RPi4 +QORVO_ZIGBEE=1 +QORVO_OT_CLI=0 +QORVO_OT_BR=0 +QORVO_OPENTHREAD=OpenThread +OPENTHREAD_CLI=qpg7015m-ot-cli-ftd.elf +OPENTHREAD_RCP=qpg7015m-ot-rcp.elf +QORVO_COMDUMP= +QORVO_CONFIG_PATH= +QORVO_STARTUP_XML= +QORVO_SUDO=sudo +QORVO_DEBUG=0 +QORVO_INTERFERENCE_THRESHOLD=192 +QORVO_GW_AT_BOOT=0 +QORVO_SOCKET_IPC=/dev/socket +QORVO_MAC_NVM_PATH=/etc/mac/macNvm.dat +APP_DRIVER_DEFAULT=DrvComKernel_QPG7015M_SPI_RPi4 +Copied zgdd factory block +STARTING GATEWAY SERVER... + PID TTY STAT TIME COMMAND + 941 ? Ss 0:00 /lib/systemd/systemd --user + 942 ? S 0:00 (sd-pam) + 957 ? S 0:00 sshd: pi@pts/0 + 958 pts/0 Ss 0:00 -bash + 1696 pts/0 S+ 0:00 /bin/sh ./start_gateway.sh + 1699 pts/0 S+ 0:00 /bin/sh ./qorvo_stack_init start + 1783 pts/0 S+ 0:00 /bin/sh ./qorvo_stack_init start + 1784 pts/0 S+ 0:00 sleep 1 + 1786 pts/0 R+ 0:00 ps x +DrvComKernel_QPG7015M_SPI_RPi4 module is not loaded. +OsalOemDriver_QPG7015M_SPI_RPi4 module is not loaded. +OsalDriver_RPi4 module is not loaded. +Loading OsalDriver_RPi4 ... +Loading GreenPeak Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalDriver_RPi4.ko for (/dev/gp) kernel module... +No dev node created for module +Loading OsalOemDriver_QPG7015M_SPI_RPi4 ... +Loading GreenPeak Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalOemDriver_QPG7015M_SPI_RPi4.ko for (/dev/gp) kernel module... +No dev node created for module +Loading DrvComKernel_QPG7015M_SPI_RPi4 ... +Loading GreenPeak Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/DrvComKernel_QPG7015M_SPI_RPi4.ko for (/dev/gp) kernel module... +17:32:11:537 01 ============================ +17:32:11:537 01 FirmwareUpdater +17:32:11:537 01 vX.X.X.X Change:XXXXXX +17:32:11:538 01 ============================ +17:32:11:538 01 loading FirmwareUpdater/Firmware_QPG7015M.hex +17:32:11:684 01 INFO: Bootloader reports ready and valid +17:32:11:685 01 Bootloader is active +17:32:11:685 01 Bootloader Stage 2: v0.9.2.6 Change:151145 +17:32:11:685 01 Bootloader Stage1: version data unavailable (request not supported by this stage2 bootloader) +17:32:11:685 01 ProductId: QPG7015 +17:32:11:685 01 IEEE 15.4 MAC: XX:XX:XX:XX:XX:XX +17:32:11:685 01 BLE MAC: XX:XX:XX:XX:XX:XX +17:32:11:697 01 Verifying CRC... +17:32:12:300 01 image matches +17:32:12:300 01 Starting application... +17:32:17:329 01 Received cbDeviceReady from firmware +17:32:17:329 01 Firmware update SUCCEEDED vX.X.X.X Change:XXXXXX +Firmware update finished successfully (0) ... +Firmware STARTING ... +gateway not running - starting! +NOTICE: Enabling ConcurrentConnect mode +17:32:17:350 01 Settings applied +17:32:17:351 01 Enabling concurrentconnect mode +zgdd: no process found +lrwx------ 1 pi pi 64 Dec 28 17:32 0 -> /tmp/zgdd_input +Copying template start.xml to tmp_start.xml for keeping (tmp_start.xml gets deleted after it was used). +Gateway does not start automatically at boot + +------- +WARNING! Enabling 802.15.4 (Zigbee or Thread) and Bluetooth LE scanning (central or observer) requires additional configuration!!! +------- +Combining 802.15.4 (Zigbee or Thread) and Bluetooth LE scanning (central or observer) limits the 802.15.4 protocols to a single common channel. +See GP_P1053_UM_17952_Multi_Protocol_Configuration.pdf for more information. +If you are using only BLE peripheral functionality, the two 802.15.4 stacks can have different channels if QORVO_BLUETOOTHLE_SCANNING=0 is added to qorvo_stack_config. +If you are combining Bluetooth LE scanning with 2 802.15.4 stacks, you may have to update the individual stack channel configuration to fix the two 802.15.4 stacks to a single channel. + +You can retrieve the configured channel of a previously used stack this way: +* OpenThread: on ot-cli or ot-ctl issue the 'channel' command +* ZigBee: check the inventory>gateway XML node's channel attribute in/etc/facilityd/inventory.xml (see GP_P332_AN_12712_Smart_Home_Gateway_XML_Files.pdf) +To change the channel the 802.15.4 stack is using, you can use: +* OpenThread: on ot-cli or ot-ctl issue the 'channel' command +* ZigBee: modify the channelmask in ZigBee3.0/start.xml and issue a factory reset +------- +------- + +OPENING ENROLLMENT WINDOW FOR 380 SECONDS WITH PINCODE 1234... +NOTE THAT AUTHENTICATION IS REQUIRED ONLY FOR EXTERNAL CONNECTIONS. + +You can now start the Smart Home Gateway Client, by entering the following command: + +cd ZigBee3.0 && LD_LIBRARY_PATH=/home/pi/ZigBee3.0/lib ./SmartHomeGatewayClient_RPi.elf connect --host=localhost --port=8888 + +------- + +You can now start the BLE stack, by entering the following command: + +cd Bluetooth_LE && ./Bluetooth_LE_Test_Qorvo_rpi.elf +------- +GATEWAY STARTED AND READY TO USE! + +``` + +## Stop the QPG7015M Gateway Development Kit + +To stop the QPG7015M Gateway Development Kit, Qorvo provides a script called stop_gateway.sh, which must be executed. +Running this script will **NOT** delete the info of bonded or joined devices. + +``` +pi@[hostname]:~ $ ./stop_gateway.sh +STOPPING GATEWAY... +Unloading DrvComKernel_QPG7015M_SPI_RPi4 ... +found Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/DrvComKernel_QPG7015M_SPI_RPi4.ko +Unloading GreenPeak 'Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/DrvComKernel_QPG7015M_SPI_RPi4.ko' kernel module... +Unloading OsalOemDriver_QPG7015M_SPI_RPi4 ... +found Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalOemDriver_QPG7015M_SPI_RPi4.ko +Unloading GreenPeak 'Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalOemDriver_QPG7015M_SPI_RPi4.ko' kernel module... +Unloading OsalDriver_RPi4 ... +found Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalDriver_RPi4.ko +Unloading GreenPeak 'Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalDriver_RPi4.ko' kernel module... +``` + +## Factory reset the QPG7015M Gateway Development Kit + +To stop and factory reset the QPG7015M Gateway Development Kit, Qorvo provides a script called factory_reset.sh, which must be executed. +Running this script **WILL** delete the info of bonded or joined devices. + +``` +pi@[hostname]:~ $ ./factory_reset_gateway.sh +FACTORY RESETTING GATEWAY... +STOPPING GATEWAY... +Unloading DrvComKernel_QPG7015M_SPI_RPi4 ... +found Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/DrvComKernel_QPG7015M_SPI_RPi4.ko +Unloading GreenPeak 'Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/DrvComKernel_QPG7015M_SPI_RPi4.ko' kernel module... +Unloading OsalOemDriver_QPG7015M_SPI_RPi4 ... +found Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalOemDriver_QPG7015M_SPI_RPi4.ko +Unloading GreenPeak 'Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalOemDriver_QPG7015M_SPI_RPi4.ko' kernel module... +Unloading OsalDriver_RPi4 ... +found Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalDriver_RPi4.ko +Unloading GreenPeak 'Drivers/RPi4/5.10.17-v7l+-qorvo/QPG7015M_RPi4/OsalDriver_RPi4.ko' kernel module... +GATEWAY IS FACTORY RESET! +``` diff --git a/Documents/Guides/thread_validation.md b/Documents/Guides/thread_validation.md new file mode 100644 index 0000000..9ee8401 --- /dev/null +++ b/Documents/Guides/thread_validation.md @@ -0,0 +1,360 @@ +# Validating Thread + +After building and programming the Thread executable, we will have to verify the proper operation thereof. + +--- + +- [Validating Thread](#validating-thread) + - [Nomenclature](#nomenclature) + - [Interacting with the Thread stack through the Command Line Interface](#interacting-with-the-thread-stack-through-the-command-line-interface) + - [Getting `help`](#getting-help) + - [The `dataset` api](#the-dataset-api) + - [Forming a Thread network](#forming-a-thread-network) + - [Starting a Thread Network](#starting-a-thread-network) + - [Joining a second node to the Thread Network](#joining-a-second-node-to-the-thread-network) + - [Device information](#device-information) + - [Common](#common) + - [Router](#router) + - [Parent](#parent) + - [Child](#child) + - [Ping between devices](#ping-between-devices) + - [Reset a device and validate reattachment](#reset-a-device-and-validate-reattachment) + +--- + +## Nomenclature + +- **FTD**: Full Thread Device +- **MTD**: Minimal Thread Device + - **MED**: Minimal End Device + - **SED**: Sleepy End Device + +## Interacting with the Thread stack through the Command Line Interface + +To interact with the Thread stack, commands need to be typed on the Command Line Interface (CLI). The format in which these commands and there output will be presented is as follows: + + > some_command argA argB + optional_output + return_value + +The lines that start with `>` will be the actual commands to be typed on the CLI. The lines that follow will contain the output of the CLI. Note that the output based on random values such as the generated Thread Master Key will observed while running the commands will differ from the values used in this manual. +The final line will contain a return code. The value is `Done` when everything went well. Other possibilities are (but not limited to) + +- `Error 6: Parse`: when a provided argument is in the wrong format +- `Error 7: InvalidArgs`: when a provided argument is of the wrong type +- `Error 23: NotFound`: when requested data does not exist +- `Error 35: InvalidCommand`: when the command is not recognized + +The error `Error 35: InvalidCommand` is also returned when a valid command is not supported by a certain build. E.g. with the build + + script/build gp712 -DOT_JOINER=1 + +a commissioner command will result in + + > commissioner start + InvalidCommand + +Whereas with the build + + script/build gp712 -DOT_JOINER=1 -DOT_COMMISSIONER=1 + +a commissioner command will result in + + > commissioner start + Done + +**Note**: The CLI server doesn’t contain an echo. This results in the commands results only being displayed after `enter` is pressed. + +### Getting `help` + +To know the most common commands supported by CLI, the `help` command can be used + + > help + bufferinfo + ... + version + Done + +Additional info on all the commands can be found in the [CLI Reference Manual](https://github.com/openthread/openthread/blob/main/src/cli/README.md) + +### The `dataset` api + +Currently there are two ways for setting the the `panid`, the `masterkey` and some other network variables. There is the older, direct way e.g. + + > channel 15 + Done + > panid 0xf00d + Done + +and the newer, recommended api through the `dataset` command e.g. + + > dataset channel 15 + Done + > dataset panid 0xf00d + Done + +In the below examples the latter, newer and more extensive dataset api will be used + +## Forming a Thread network + +To form a first Thread network we will use two devices. The first, more capable, device will fulfill the *Leader* role, will act as *Commissioner* and also as a parent. + +The first device needs to be build as follows + + script/build -DOT_COMMISSIONER=1 -DOT_JOINER=1 + +Note the explicit enabling of the *Commissioner* role through `-DOT_COMMISSIONER=1`. +It is very important that the *FTD* executable (`-ot-cli-ftd`) is programmed on the device under test. + +The second device can be less capable + + script/build -DOT_JOINER=1 + +Here, it is up to the reader to either program the *FTD* or the *MTD* executable. Both will work in the below scenarios. + +### Starting a Thread Network + +Demonstrate successful protocol timers by forming a Thread network and verifying the node has transitioned to the Leader state. + +Over the serial interface type in the following commands (here prepended with `>` and followed by the expected output): + + > dataset channel 15 + Done + > dataset panid 0xf00d + Done + > dataset init new + Done + > ifconfig up + Done + > thread start + Done + > state + leader + Done + +This will, in order, specify the channel and panid of the new Thread network, enable the new dataset, bring up the WPAN Thread interface and start the Thread Network. + +To display all the information about the newly formed Thread network, type + + > dataset active + Active Timestamp: 0 + Channel: 11 + Channel Mask: 0x07fff800 + Ext PAN ID: dead00beef00cafe + Mesh Local Prefix: fdde:ad00:beef:0::/64 + Master Key: d5d1efe77855947c03b3bac50f48e9e3 + Network Name: OpenThread + PAN ID: 0xf00d + PSKc: a7e44fe41bd7a7b0502337d4038a9d3d + Security Policy: 672, onrcb + Done + +**Note:** In the above example, because we did not specify them up front, the Thread Network Master Key and the Thread Mesh Local Prefix are selected at random by the node. They can be queried (and set) through the `dataset masterkey` and `dataset meshlocalprefix` commands. + + > dataset masterkey + d5d1efe77855947c03b3bac50f48e9e3 + Done + > dataset meshlocalprefix + fdde:ad00:beef:0::/64 + Done + +### Joining a second node to the Thread Network + +In the CLI on the first device, type: + + > commissioner start + Commissioner petitioning + Done + > commissioner joiner add * J01NME + Done + +The first command makes the device request the network for approval to be the commissioner on the Network. The second command opens joining for any device (`*`) with the passphrase `J01NME` The joining window will be open for the default 30 seconds. + +If the second devices has to function as a *MTD*, first type + + > mode r + +for a *MED* and + + > mode - + +for a *SED*. + +Now, on the second device, with the enabled Joiner role (we assume a *FTD*), run: + + > ifconfig up + Done + > joiner start J01NME + Done + > thread start + Done + > state + router + Done + +The above sequence, in order, + +- brings up the radio interface +- joins the device to the network with the passphrase `J01NME`. This takes some time. At the end of this step the device has all the required network information (Master Key, Mesh-local Prefix, …). At this point the device is not yet connected to the network, though +- starts the Thread stack. After this step the device will be fully connected to the network. +- checks the state of the device. + **Note:** becoming a router takes some time (can be well over a minute, as per the specification). If the device is not a *FTD*, the device will never become a router (by design). In this case the output of the `state` command will be `child`. + +## Device information + +The CLI provides some commands to get insight in both the devices and the network. + +### Common + +Network information is obtained through + + > dataset active + +Each device can list its own addresses + + > ipaddr + fdde:ad00:beef:0:0:ff:fe00:fc00 + fdde:ad00:beef:0:0:ff:fe00:800 + fdde:ad00:beef:0:5b:3bcd:deff:7786 + fe80:0:0:0:6447:6e10:cf7:ee29 + Done + +Or a specific ip address can be queried through a second parameter + + > ipaddr rloc + fdde:ad00:beef:0:0:ff:fe00:800 + Done + +A list of neighbors (both routers and children) + + > neighbor table + | Role | RLOC16 | Age | Avg RSSI | Last RSSI |R|D|N| Extended MAC | + +------+--------+-----+----------+-----------+-+-+-+--------------+ + Done + +### Router + + > router table + | ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended Mac |Link | + +----+--------+----------+-----------+-------+--------+-----+--------------+-----+ + Done + +### Parent + +On the parent (the *FTD*), we can get the list of children (this will be zero if the second device became a router) + + > child list + 1 + Done + +And for each of the listed IDs we can query device information + + > child + Child ID: 1 + Rloc: 0801 + Ext Addr: 2e5e8adffa9a7ad8 + Mode: rdn + Net Data: 38 + Timeout: 300 + Age: 55 + Link Quality In: 3 + RSSI: -55 + Done + +The ip addresses of the children can be obtained with + + > childip + ... + Done + +### Child + +The child can display information on its parent + + > parent + Ext Addr: 66476e10cf7ee29 + Rloc: 0800 + Link Quality In: 3 + Link Quality Out: 3 + Age: 7 + Done + +## Ping between devices + +To obtain the IPv6 addresses of the first device run + + > ipaddr + fdde:ad00:beef:0:0:ff:fe00:fc00 + fdde:ad00:beef:0:0:ff:fe00:800 + fdde:ad00:beef:0:5b:3bcd:deff:7786 + fe80:0:0:0:6447:6e10:cf7:ee29 + Done + +On the second device, now run: + + > ping fdde:ad00:beef:0:5b:3bcd:deff:7786 + 16 bytes from fdde:ad00:beef:0:5b:3bcd:deff:7786: icmp_seq=1 hlim=64 + time=24ms + +Of course the flow can be reversed as well + +**Note:** if one of the devices is a SED, the ping command will likely fail because the default ping timeout is shorter than the default SED `childtimeout`. The `ping` command can take some more parameters + + > ping [size] [count] [interval] [hoplimit] [timeout] + +by assuring `[timeout]` is larger than `childtimeout`, the ping should succeed. +`childtimeout` is a CLI command used to both set and query the current value of the Child timeout. + +## Reset a device and validate reattachment + +Demonstrate non-volatile functionality by resetting the device and validating its reattachment to the same network without user intervention. + +On the second device first run + + > reset + Done + +This will reset the device but will keep the Active Dataset in non-volatile memory. This can be easily verified by running + + > dataset active + Active Timestamp: 0 + Channel: 11 + Channel Mask: 0x07fff800 + Ext PAN ID: dead00beef00cafe + Mesh Local Prefix: fdde:ad00:beef:0::/64 + Master Key: d5d1efe77855947c03b3bac50f48e9e3 + Network Name: OpenThread + PAN ID: 0xf00d + PSKc: a7e44fe41bd7a7b0502337d4038a9d3d + Security Policy: 672, onrcb + Done + +Since resetting will disable the network interface and the Thread stack, run the following to enable both: + + > ifconfig up + Done + > thread start + Done + +After bringing up the network interface and the Thread stack again. The device will reattach to the Thread Network and after a while become a router again (Same remarks as in the [_Joining a second node_](#joining-a-second-node-to-the-thread-network) case apply). + +Power cycling the device will have the same effect as running the `reset` command. So, similarly + + > ifconfig up + Done + > thread start + Done + +has to be run, to rejoin the device to the network. + +On the other hand + + > factoryreset + Done + +will remove the Active Dataset from non-volatile memory. This can easily seen by running + + > dataset active + Error 23: NotFound + +To rejoin the device to the network, a full join procedure as described in [_Joining a second node_](#joining-a-second-node-to-the-thread-network) has to be executed. diff --git a/Documents/Images/architecture_ftd.png b/Documents/Images/architecture_ftd.png new file mode 100755 index 0000000..55bc606 Binary files /dev/null and b/Documents/Images/architecture_ftd.png differ diff --git a/Documents/Images/architecture_rcp.png b/Documents/Images/architecture_rcp.png new file mode 100755 index 0000000..8b2e9df Binary files /dev/null and b/Documents/Images/architecture_rcp.png differ diff --git a/Documents/Images/gp712.png b/Documents/Images/gp712.png new file mode 100644 index 0000000..5a47c91 Binary files /dev/null and b/Documents/Images/gp712.png differ diff --git a/Documents/Images/pin_cfg_spi.png b/Documents/Images/pin_cfg_spi.png new file mode 100644 index 0000000..ba0a9fd Binary files /dev/null and b/Documents/Images/pin_cfg_spi.png differ diff --git a/Documents/Images/pin_cfg_usb.png b/Documents/Images/pin_cfg_usb.png new file mode 100644 index 0000000..3482c10 Binary files /dev/null and b/Documents/Images/pin_cfg_usb.png differ diff --git a/Documents/Images/qorvo_logo.png b/Documents/Images/qorvo_logo.png new file mode 100755 index 0000000..724cee8 Binary files /dev/null and b/Documents/Images/qorvo_logo.png differ diff --git a/Documents/Images/qpg7015m.png b/Documents/Images/qpg7015m.png new file mode 100644 index 0000000..8a7552e Binary files /dev/null and b/Documents/Images/qpg7015m.png differ diff --git a/Documents/Images/qpg7015m_dk_casing.png b/Documents/Images/qpg7015m_dk_casing.png new file mode 100644 index 0000000..a531ad8 Binary files /dev/null and b/Documents/Images/qpg7015m_dk_casing.png differ diff --git a/Documents/Images/qpg7015m_dk_power_supply.png b/Documents/Images/qpg7015m_dk_power_supply.png new file mode 100644 index 0000000..be13dbb Binary files /dev/null and b/Documents/Images/qpg7015m_dk_power_supply.png differ diff --git a/Documents/Images/qpg7015m_dk_screws.png b/Documents/Images/qpg7015m_dk_screws.png new file mode 100644 index 0000000..414809a Binary files /dev/null and b/Documents/Images/qpg7015m_dk_screws.png differ diff --git a/Documents/Images/qpg7015m_radio_board_cfg1_cfg2.png b/Documents/Images/qpg7015m_radio_board_cfg1_cfg2.png new file mode 100644 index 0000000..8a7552e Binary files /dev/null and b/Documents/Images/qpg7015m_radio_board_cfg1_cfg2.png differ diff --git a/Documents/Programmer Manuals/GP_P1053_UM_17043_Programmer_Manual.pdf b/Documents/Programmer Manuals/GP_P1053_UM_17043_Programmer_Manual.pdf new file mode 100644 index 0000000..56644b7 Binary files /dev/null and b/Documents/Programmer Manuals/GP_P1053_UM_17043_Programmer_Manual.pdf differ diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..a387271 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,250 @@ +# Software Development Kit License + +## Software Development Kit License Agreement +THIS LEGALLY BINDING AGREEMENT, FOR THE USE OF THE LICENSED SOFTWARE INSTALLED +UPON ACCEPTANCE OF THIS AGREEMENT, IS BETWEEN QORVO INTERNATIONAL PTE LTD. +("LICENSOR"), INCLUDING ITS AFFILIATES, AND EITHER AN INDIVIDUAL OR LEGAL ENTITY +("LICENSEE"), INCLUDING EACH AFFILIATE OF SUCH, AS APPLICABLE, ON WHOSE BEHALF +YOU ARE LEGALLY AUTHORIZED TO ACCEPT THIS LICENSE AGREEMENT. AS USED HEREIN, +"YOU," "YOUR", OR "LICENSEE" SHALL MEAN SUCH INDIVIDUAL OR ENTITY, INCLUDING AFFILIATES +OF SUCH ENTITY. LICENSOR IS ONLY WILLING TO LICENSE THE LICENSED SOFTWARE TO +YOU ON CONDITION THAT YOU ACCEPT ALL OF THE TERMS IN THIS AGREEMENT. BY INSTALLING +OR OTHERWISE USING OR COPYING THE LICENSED SOFTWARE, YOU EXPRESSLY AGREE +TO BE BOUND BY ALL OF THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO +THE TERMS OF THIS AGREEMENT, YOU MAY NOT INSTALL, USE, OR COPY THE LICENSED +SOFTWARE, AND YOU MUST DELETE ANY DOWNLOADS OR COPIES OF THE LICENSED +SOFTWARE. + +### Definitions +**Confidential Information** means all information (whether written, electronic, visual, or oral) disclosed +by Licensor that is marked or identified as "confidential" or with a similar legend or designation, or that +the Licensor otherwise considers in good faith to be confidential. + +**Documentation** means all documents, in any form, associated with the Licensed Software, including, +but not limited to, user manuals, instruction manuals, specifications, and other software-associated +documentation. + +**Licensed Software** means the Software Development Kit ("SDK") of Licensor as provided to Licensee +under this Agreement. Licensed Software also includes any additions, updates, and releases thereto +issued by Licensor from time-to-time. + +**Licensee Product** means a product developed by Licensee embodying Licensee Software. + +**Licensee Software** means software developed by Licensee using the Licensed Software. + +**Licensor Silicon** means a Licensor integrated circuit that runs Licensor Software and/or Licensee +Software. + +### Intellectual Property Rights +**Intellectual Property Rights** means all intellectual property rights, including, intellectual property +rights associated with patents, utility models, know-how, trade and service marks, trade or business +names, domain names, and rights in designs, copyrights, moral rights, topography rights, and database +rights, in all cases whether or not registered or registerable in any country for the full term of such +rights including any extension to or renewal of the terms of such rights including registrations and +applications for registrations of any of these and rights to apply for the same and all rights and forms +of protection of a similar nature or having equivalent effect to any of these anywhere in the world. + +### License +**Use of Licensed Software.** Licensor hereby grants to Licensee a worldwide, fully paid-up, non-exclusive, +non-transferable license to use the Licensed Software to develop Licensee Software and to incorporate +the Licensee Software into Licensee Products and PROVIDED FURTHER that Licensee only uses +Licensee and/or Licensed Software in combination with Licensor Silicon, and, for such purposes, +to distribute the Licensed Software and/or Licensee Software to its subcontractors for the purpose +of designing or manufacturing the Licensee Products on Licensee’s behalf, or programming the +Licensed Software and/or Licensee Software, thereby producing programmed software, which will +then be integrated into the Licensee Products, PROVIDED HOWEVER that Licensee obtains the +express acknowledgement and undertaking of each such subcontractor to be bound by terms and +conditions of confidentiality and limited use that are no broader in scope and duration than the +confidentiality and limited use and conditions in this Agreement, and Licensee remains responsible +for any breach by such subcontractor and PROVIDED FURTHER that Licensee’s subcontractor only +uses the programmed software in combination with Licensor Silicon. + +**No Sale.** The licenses granted under this Agreement do not constitute a sale of the Licensed Software +or any portion or copy of it. + +### Ownership and Restrictions +**Ownership and Retention of Rights.** Licensee acknowledges Licensor owns and shall retain all +right, title, and interest in and to: (i) the Licensed Software and updates, and Documentation, including +all Intellectual Property Rights embodied therein; (ii) all of the service marks, trade-marks, trade +names or any other designations associated with the Licensed Software; and (iii) all copyrights, +patent rights, trade secret rights, and other proprietary rights relating to the Licensed Software, the +Documentation, or Licensor’s Confidential Information. Licensee further acknowledges and agrees +that it shall have no rights with respect to any of the foregoing other than the rights expressly set forth +in this Agreement. + +**Restrictions on Use.** Licensee agrees: (i) not to remove any Licensor identification or notices of +any proprietary, patent or copyright restrictions from the Licensed Software, Documentation, or any +support material; or (ii) not to develop methods to enable unauthorized parties to use Licensor Silicon. + + +## Warranty and Disclaimers + +### Warranty Disclaimer +**WARRANTY DISCLAIMER.** THE LICENSED SOFTWARE IS PROVIDED ’AS IS’; LICENSOR MAKES +NO WARRANTIES WITH RESPECT TO ANY LICENSED SOFTWARE OR SERVICE AND DISCLAIMS +ALL STATUTORY OR IMPLIED WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ARISING FROM A COURSE +OF DEALING OR USAGE OF TRADE AND ANY WARRANTIES OF NONINFRINGEMENT. LICENSOR +DOES NOT WARRANT THAT THE LICENSED SOFTWARE WILL MEET ANY REQUIREMENTS OR +THAT THE OPERATION OF THE LICENSED SOFTWARE WILL BE UNINTERRUPTED OR ERROR +FREE. + +### Limitation of Liability +**LIMITATION OF LIABILITY.** NOTWITHSTANDING ANYTHING ELSE IN THIS AGREEMENT OR +OTHERWISE, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR WILL IN NO +EVENT BE LIABLE WITH RESPECT TO ANY SUBJECT MATTER OF THIS AGREEMENT UNDER +ANY CONTRACT, TORT, OR OTHER LEGAL OR EQUITABLE THEORY FOR: (I) ANY DIRECT, +INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND +WHETHER OR NOT ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES; OR +(II) DAMAGES FOR LOST PROFITS OR LOST DATA; OR (III) COST OF PROCUREMENT OF +SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES. + +### Indemnification +You agree to fully defend and indemnify Licensor and its employees, subcontractors, licensors and +agents from any and all claims, liabilities, and costs (including reasonable attorney’s fees) related +to: (i) Your use (including Your sublicensee’s use, if permitted) of the Licensed Software; or (ii) Your +violation of the terms and conditions of this Agreement. + +## Confidential Information +**Protection of Confidential Information.** Licensee will protect Licensor’s Confidential Information +from unauthorized dissemination and use the same degree of care that Licensee uses to protect its +own like information, but in no event less than a reasonable degree of care. Licensee will not disclose +to third parties Licensor’s Confidential Information without the prior written consent of Licensor. Licensee +will not use Licensor’s Confidential Information for purposes other than those necessary to use +the Licensed Software. Notwithstanding the foregoing, Licensee may use or disclose Confidential +Information to the extent Licensee is legally required to disclose such Confidential Information provided, +however, that prior to any such required disclosure, the Licensee will notify Licensor and will cooperate +fully with Licensor in protecting against any such disclosure and/or obtaining a protective order narrowing +the scope of such disclosure and/or use of the Confidential Information. Licensee agrees that any +breach of this Section would cause irreparable harm to Licensor for which monetary damages would +not be adequate and therefore, in the event of a breach of this Section, Licensor shall be entitled to +equitable relief in addition to any remedies it may have hereunder or at law. + +**Security.** Licensee shall implement reasonable security measures to prevent unauthorized use or +disclosure of Licensed Software. + +**Notification of Employees.** Licensee will take appropriate action by instruction, agreement or +otherwise with its employees, agents and contractors allowed access to the Confidential Information +to satisfy its obligations under this Section. + +## Trademarks, Copyrights and Notices + +### Trademarks and Use of Marks +**Trademarks.** Licensee is not granted any ownership in or license to the trademarks, marks, service +marks or trade names, or good will associated with such marks or names (collectively, "Marks") of +the Licensor. Licensee shall not use the Marks or confusingly similar marks in con-nection with any +goods or services other than the Licensed Software or in a manner that dilutes, disparages, or harms +the reputation of the Licensor. Licensee agrees that any goodwill arising from its use of the Marks +shall inure to the benefit of the Licensor who will be the sole and exclusive owner of such goodwill. + +**Use of Marks.** All advertising and other materials in which Licensor’s Marks are used shall be subject +to the prior written approval of Licensor. Whenever a Licensee uses the Mark of the Licensor, Licensor +shall indicate that such Mark is the property of the Licensor. + +**Defense of Trademarks.** Licensee will not at any time contest, or assist others in contesting, the +validity or enforceability of the Marks of Licensor or do, cause to be done, or tolerate any act or thing +contesting or in any way impairing or tending to impair any said right, title, an interest of Licensor in +such Marks. + +### Copyright Notice +**Copyright Notice.** Licensee shall include Licensor’s copyright notice as required herein. The following +copyright notice is required in Licensee Software: Copyright (c) 2017-2021, Qorvo Inc. + +### Third Party Notices +**Third Party Notice.** This license does not apply to any open source software contained in Licensed +Software. Rather, the terms and conditions in the applicable open source software license shall apply +to the open source software. Nothing in this Agreement limits your rights under, or grants you rights +that supersede, any open source software license. You acknowledge that the open source software +license is solely between you and the applicable licensor of the open source software. You shall +comply with the terms of all applicable open source software licenses, if any. License and copyright +information for the open source software are disclosed in the Licensed Software documentation. +Licensed Software may include open source software licensed under the General Public License +and/or the Lesser General Public License (or any other license requiring us to make a written offer to +provide corresponding source code to you). You may obtain the corresponding source code for any +such open source software from us for a period of three years after our last shipment of Licensed +Software and without charge except for the cost of media, shipping, and handling, upon written +request to Licensor. This offer is valid to anyone in receipt of Licensed Software. You may send +your request in writing to the address below. Please make sure your request includes the version and +name associated with the Licensed Software. + +Qorvo Belgium NV +Senior Manager, Applications Engineering +Spinnerijstraat 14 +9240 Zele, Belgium + +## Governing Law and Jurisdiction +**Governing Law.** This Agreement is made in, governed by and shall be construed in accordance +with the laws of the Republic of Singapore without regard to conflicts of laws principles. The Parties +agree that the United Nations Convention on Contracts for the International Sale of Goods is hereby +excluded in its entirety from this Agreement. + +**Jurisdiction.** Any dispute arising out of or in connection with this Agreement, including any question +regarding its existence, validity or termination, shall be referred to and finally resolved by arbitration +administered by the Singapore International Arbitration Centre ("SIAC") in accordance with the Arbitration +Rules of the Singapore International Arbitration Centre ("SIAC Rules"), which rules are deemed to be +incorporated by reference in this clause. The seat and venue of the arbitration shall be Singapore. +The tribunal shall consist of one arbitrator to be appointed by the chairman of the SIAC, upon the +recommendation of Licensor. The language of the arbitration shall be English. + +**Injunctive Relief.** A breach of this Agreement adversely affecting Licensor’s Intellectual Property +Rights in the Licensed Software, Licensor’s Products or Documentation may cause irreparable injury +to Licensor for which monetary damages may not be an adequate remedy and Licensor. shall be +entitled to equitable relief in addition to any remedies it may have hereunder or at law. + +**Entire Agreement.** This Agreement constitutes the entire agreement between Licensee and Licensor +regarding the subject matter of this Agreement, and supersedes all prior communications, negotiations, +understandings, agreements or representations, either written or oral, if any. This Agreement may only +be amended in a signed writing, duly executed by Licensee and Licensor. + +# Exceptions +This Software Development Kit contains software licensed under open source licenses and licenses +other than the terms listed in chapter [Software Development Kit License Agreement](#software-development-kit-license-agreement). +This section provides an overview of these other licenses and the applications and/or components +that contain software licensed under those licenses. + +## OpenThread-BSD-3-Clause +Copyright (c) 2016, The OpenThread Authors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holder nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +# Important Notices +The information contained herein is believed to be reliable; however, Qorvo makes no warranties regarding the information +contained herein and assumes no responsibility or liability whatsoever for the use of the information contained herein. All +information contained herein is subject to change without notice. Customers should obtain and verify the latest relevant +information before placing orders for Qorvo products. The information contained herein or any use of such information does +not grant, explicitly or implicitly, to any party any patent rights, licenses, or any other intellectual property rights, whether with +regard to such information itself or anything described by such information. THIS INFORMATION DOES NOT CONSTITUTE +A WARRANTY WITH RESPECT TO THE PRODUCTS DESCRIBED HEREIN, AND QORVO HEREBY DISCLAIMS ANY AND +ALL WARRANTIES WITH RESPECT TO SUCH PRODUCTS WHETHER EXPRESS OR IMPLIED BY LAW, COURSE OF +DEALING, COURSE OF PERFORMANCE, USAGE OF TRADE OR OTHERWISE, INCLUDING THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +Without limiting the generality of the foregoing, Qorvo products are not warranted or authorized for use as critical components +in medical, life-saving, or life-sustaining applications, or other applications where a failure would reasonably be expected to +cause severe personal injury or death. + +**Copyright 2022 © Qorvo, Inc. | Qorvo is a registered trademark of Qorvo, Inc.** + +Arm and Cortex are registered trademarks of Arm Limited (or its subsidiaries) in the US and/or elsewhere. All other product +or service names are the property of their respective owners. diff --git a/README.md b/README.md new file mode 100644 index 0000000..4b9ff23 --- /dev/null +++ b/README.md @@ -0,0 +1,406 @@ +# Qorvo® Smart Home Gateway for QPG7015M and GP712 + +Welcome to the Qorvo Smart Home Gateway for [Qorvo QPG7015M](https://www.qorvo.com/products/p/QPG7015M) and [Qorvo GP712](https://www.qorvo.com/products/p/GP712) repository! This repository contains the OpenThread software development kit for Qorvo QPG7015M and GP712. + +
+ Qorvo +
+ +--- +- [Qorvo® Smart Home Gateway for QPG7015M and GP712](#qorvo®-smart-home-gateway-for-qpg7015m-and-gp712) + - [Introduction](#introduction) + - [Getting started with the Qorvo Smart Home Gateway SDK for QPG7015M and GP712](#getting-started-with-the-qorvo-smart-home-gateway-sdk-for-qpg7015m-and-gp712) + - [Installation](#installation) + - [How to use this repository?](#how-to-use-this-repository) + - [Folder structure](#folder-structure) + - [Architecture: Thread Border Router RCP](#architecture-thread-border-router-rcp) + - [Architecture: Qorvo Full Thread Device](#architecture-qorvo-full-thread-device) + - [Building and programming the example applications](#building-and-programming-the-example-applications) + - [Prerequisites](#prerequisites) + - [Building: Thread Border Router RCP](#building-thread-border-router-rcp) + - [Build Qorvo virtual RCP](#build-qorvo-virtual-rcp) + - [Build OTBR docker image](#build-otbr-docker-image) + - [Create OTBR docker container](#create-otbr-docker-container) + - [Building: Qorvo Full Thread Device](#building-qorvo-full-thread-device) + - [Build CLI FTD executables](#build-cli-ftd-executables) + - [Programming the CLI FTD executables](#programming-the-cli-ftd-executables) + - [Interacting with the Thread Network through the CLI FTD executables](#interacting-with-the-thread-network-through-the-cli-ftd-executables) + - [Enable Firmware logging](#enable-firmware-logging) + - [Debugging the example application](#debugging-the-example-application) + - [Thread test setup](#thread-test-setup) + - [Thread Border Router RCP](#thread-border-router-rcp) + - [Qorvo Full Thread Device](#qorvo-full-thread-device) + - [Product Test Component](#product-test-component) + - [Interesting reads](#interesting-reads) + - [FCC Notice](#fcc-notice) + - [More information](#more-information) +--- + +## Introduction + +OpenThread is an open-source implementation of the Thread networking protocols developed by the Thread group. It allows IEEE 802.15.4-capable devices to build robust, dynamic mesh networks. +This document provides the reader with instructions on how to run a Thread application using the OpenThread stack with Qorvo QPG7015M and GP712. + +To run the examples in this repository, you will need one of the following dev kits: + +- Qorvo® IoT Dev Kit Pro + + + + The Qorvo ([QPG7015M](https://www.qorvo.com/products/p/QPG7015M)) is an IEEE 802.15.4 / Bluetooth® Low Energy Multi-Protocol Multi-Channel Communications Controller for ultra-low power wireless communications for gateways, Smart speakers, Zigbee®/Thread nodes, and other Smart Home devices, featuring Qorvo’s ConcurrentConnect™ technology. For IEEE 802.15.4 communications, antenna diversity offers additional robustness in a crowded wireless 2.4 GHz environment. The integrated Power Amplifier (PA) delivers transmit power up to +20 dBm for extended range.ConcurrentConnect™ technology: allowing instantaneous switching between Bluetooth Low Energy and IEEE 802.15.4 protocols with no observable blind spots. + +- Qorvo® GP712 Development Kit + + + + The Qorvo ([GP712](https://www.qorvo.com/products/p/GP712)) is an IEEE 802.15.4 multi-stack multi-channel communications controller for integration into a Zigbee® or Thread node. The GP712 interference robustness and antenna diversity offer superior performance in a crowded wireless 2.4 GHz environment. + +--- + +## Getting started with the Qorvo Smart Home Gateway SDK for QPG7015M and GP712 + +**Matter or Thread Border Router evaluation** + +The Qorvo QPG7015M Gateway development kit can be used as an OpenThread Border Router which is a mandatory device for bringing Thread-based Matter nodes into the Matter Network. Instructions to set up a Matter network can be found on [QMatter](https://github.com/Qorvo/QMatter). + +> **WARNING:** This release does not contain a Matter commissioner. Please resort to the CHIP-tool in the open source Matter SDK on GitHub. + +**Full Thread Device evaluation** + +Set up a Thread network and connect a Thread device to it using the instructions in the [Programmer Manual](Documents/Programmer%20Manuals/GP_P1053_UM_17043_Programmer_Manual.pdf) + +--- + +## Installation + +Currently, OpenThread can only be built using a Unix-based system. In this manual, we will use a *Debian-based* environment (as does OpenThread). + +--- + +## How to use this repository? + +- Ensure that *Git* is installed + + ```shell + sudo apt-get update && sudo apt-get install git -y + ``` + +- Clone the repository + + To get the latest version of *QGateway* and its submodules, use the following command: + + ```shell + git clone --recurse-submodules -j8 https://github.com/Qorvo/QGateway.git -b v1.5.2.0 + ``` + - The `--recurse-submodules` option will populate the [ThirdParty](./ThirdParty/) directory with the required submodules. + - The cross-compiler toolchain for Raspberry Pi is available as _Git Submodule_ at [ThirdParty/tool_rpi](./ThirdParty/tool_rpi/) + +- To resolve any outstanding dependencies to build OpenThread, run the optional + + ```shell + cd Software/OpenThread + ./script/bootstrap + ``` + > **WARNING:** The script will install a _gnu embedded toolchain_, but the one in [ThirdParty/tool_rpi](./ThirdParty/tool_rpi/) will be used in this example. + + > **WARNING:** The final step of this script will fail if _Linuxbrew_ is not installed. The error can be ignored. + +--- + +## Folder structure + +The Qorvo Smart Home Gateway for the QPG7015M/GP712 repository is structured as follows: + +| Folder | Contents | +| -------------------------------------- | ---------------------------------------------------------------------------------- | +| **[Documents](Documents/)** | Comprehensive documentation such as Programmer Manuals, developer guides, API manuals, etc. can be found under this folder. | +| **[Software](Software/)** | Build tools, Qorvo proprietary software and OpenThread platform code for Qorvo's Thread-capable products| +| **[ThirdParty](ThirdParty/)** | Submodules used to build and compile deliverables from this SDK | + +--- + +## Architecture: Thread Border Router RCP + +
+ Qorvo +
+ +- The Application: + - Location: Docker Hub or See build instructions below. This architecture runs an OpenThread Border Router in a docker container. It interfaces with Qorvo's virtual RCP node using the Spinel protocol. +- The virtual RCP node: + - Qorvo provides a virtual RCP node in _user space_ to expose Qorvo's Thread-capable products via the standard Spinel protocol. + - Location: `Software/OpenThread/src/` OpenThread Platform Layer which forwards radio specifics to _libQorvo_ and interfaces with the host OS. + - Location: `Software/OpenThread/src//GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_` _libQorvo_ implements platform-specific functionality and abstracts OpenThread from the Operating System (OS) and hardware. It provides timers, random and radio APIs in a way the OpenThread platform glue code can use it. +- Kernel drivers + - Qorvo's proprietary communication drivers offer a centralized point-of-control of the Thread-capable hardware. It handles full-duplex communication between the communication stacks and configuration applications running simultaneously in the host and Qorvo's hardware. Qorvo offers its unique ConcurrentConnect™ technology to optimize RF performance, which can only be configured using Qorvo's proprietary communication drivers. + +--- + +## Architecture: Qorvo Full Thread Device + +Running Thread on a QPG7015M/GP712 is split into two major blocks: the *Host* and the QPG7015M/GP712 firmware. The latter is preprogrammed and requires no user interaction. + +
+ Qorvo +
+ +- The Application: + - Will be compiled into a single *OpenThread CLI* executable + - Location: `ThirdParty/openthread/examples/apps` The *OpenThread CLI* application allows the evaluation of a full thread device. + - Location: `ThirdParty/openthread/src` The OpenThread Stack Implements the [Thread specification](https://www.threadgroup.org/ThreadSpec). It can be configured through a set of [configure switches](https://github.com/openthread/openthread/tree/master/examples/common-switches.mk). + - Location: `Software/OpenThread/src/` OpenThread Platform Layer which forwards radio specifics to _libQorvo_ and interfaces with the host OS. + - Location: `Software/OpenThread/src//GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_` _libQorvo_ implements platform-specific functionality and abstracts OpenThread from the Operating System (OS) and hardware. It provides timers, random and radio APIs in a way the OpenThread platform glue code can use it. +- Kernel drivers + - Qorvo's proprietary communication drivers offer a centralized point-of-control of the Thread-capable hardware. It handles full-duplex communication between the communication stacks and configuration applications running simultaneously in the host and Qorvo's hardware. Qorvo offers its unique ConcurrentConnect™ technology to optimize RF performance, which can only be configured using Qorvo's proprietary communication drivers. + +--- + +## Building and programming the example applications + +### Prerequisites + +- **Toolchain** + + The cross-compiler toolchain for Raspberry Pi is available as a _Git Submodule_ at [ThirdParty/tool_rpi](./ThirdParty/tool_rpi/). + > **INFO:** This guide will cross compile for the Raspberry Pi. It is possible to make the builds natively on a Raspberry Pi, but we found the cross compilation to be faster. + +- **Obtain Kernel drivers** + + The necessary deploy instructions and other documentation need to be obtained through your business contact. + +- **Using buildall.sh script** + + [Software/OpenThread/buildall.sh](./Software/OpenThread/buildall.sh) script automates the process of building OpenThread for QPG7015M and GP712. You can also choose to build for different types: [_(CLI)_](#build-cli-ftd-executables) or [_(RCP)_](#build-qorvo-virtual-rcp), please refer to [build_steps_and_customization.md](build_steps_and_customization.md) for information on the steps used in the `buildall.sh` script and for instructions on building for custom platforms. + + - **Usage** + + - Run the script with the following options: + + ```shell + cd Software/OpenThread + ./buildall.sh [options] + + Options: + --help: Display help message and exit. + --platform : Specify the platform to build for: qpg7015m ,gp712, or omit for both. + --type : Specify the build type: cli, rcp, or omit for both. + ``` + + - Run the script with no options to build for both platforms and both types + ```shell + cd Software/OpenThread + ./buildall.sh + ``` + +### Building: Thread Border Router RCP + +#### Build Qorvo virtual RCP + +- Build for QPG7015M + ```shell + cd Software/OpenThread + ./buildall.sh --platform qpg7015m --type rcp + ``` +- Build for GP712 + ```shell + cd Software/OpenThread + ./buildall.sh --platform gp712 --type rcp + ``` +This will build the RCP applications. The output will be the following `.elf` files located in `Software/OpenThread/build/bin` + - `qpg7015m-ot-rcp.elf` + - `gp712-ot-rcp.elf` + +#### Build OTBR docker image + +The OpenThread Border Router can be built by following [OpenThread Border Router Build and Configuration](https://openthread.io/guides/border-router/build) + +Note that the QPG7015M DK is using a docker image built by Qorvo using the following instructions: +This set of instructions will guide you through building an OTBR Docker image `(tested on Raspberry Pi4 running Ubuntu)`. + +1. **Clone the OTBR repository:** + + - Clone the OTBR repository using Git. + ``` + git clone https://github.com/openthread/ot-br-posix.git + cd ot-br-posix + ``` + +1. **Checkout a specific commit:** + + - Check out a specific commit in the repository. + `Note: The reason we are checking out this commit is that Qorvo used this commit for Thread certification` + ``` + git checkout 76bf458d3901b9748abfbc0f0682b6afdcafc3cc + ``` + +1. **Initialize submodules:** + + - Initialize and update the project's submodules. + ``` + git submodule update --init + ``` + +1. **Enable TCP in third_party/openthread/CMakeLists.txt:** + + - Change the line **"-DOPENTHREAD_CONFIG_TCP_ENABLE=0"** to **"-DOPENTHREAD_CONFIG_TCP_ENABLE=1"** manually or using the following `sed` command. + - The option to enable TCP from a higher level `OT_TCP` was later added in [this commit](https://github.com/openthread/openthread/commit/e3f5bd56a15deccb82dc36c9e84525d2f8527b11) and could be used with the docker build command. + ``` + sed -i s:'"-DOPENTHREAD_CONFIG_TCP_ENABLE=0"':'"-DOPENTHREAD_CONFIG_TCP_ENABLE=1"':g third_party/openthread/CMakeLists.txt + ``` + +1. **Change the mDNSResponder URL in `script/bootstrap` file** + + The reason for this is that Apple has changed the location of their mDNSResponder. This was fixed in a later commit, please see [this commit](https://github.com/openthread/ot-br-posix/commit/22d4f4e488b4f59cd2541ee5b4bee69591053609) for more information. + ``` + git cherry-pick --no-commit 22d4f4e488b4f59cd2541ee5b4bee69591053609 + ``` + +1. **Apply the security patch for CVE-2023-2626** + + Please refer to [OpenThread Security](https://github.com/openthread/openthread/security/advisories/GHSA-vr3r-363g-72j9) and [The CVE database](https://cve.report/CVE-2023-2626) for more information. + ``` + cd third_party/openthread/repo + git fetch origin main + git cherry-pick --no-commit 3d5cb364f22f0881d5eb528aea01b8db40cc6dd2 + cd ../../../../ot-br-posix + ``` + +1. **Build the docker image:** + + - Build a docker image using specific build arguments. + ``` + docker build -t qorvo_smarthome_gateway/otbr:ot_76bf458_FIX_TG_CM01 -f etc/docker/Dockerfile . --build-arg REFERENCE_DEVICE=1 --build-arg=OTBR_OPTIONS='-DOT_DNS_CLIENT=ON -DOT_SRP_CLIENT=ON -DOT_LINK_METRICS_INITIATOR=ON' + ``` + +#### Create OTBR docker container + +Below is an example of creating an OTBR docker container from the QPG7015M DK. + +```shell +docker create \ + --mount type=bind,source=/home,target=/home \ + --mount type=bind,source=/dev/gp,target=/dev/gp \ + --name otbr_wlan \ + --network host \ + -it \ + -e NAT64=0 \ + --privileged \ + qorvo_smarthome_gateway/otbr:ot_76bf458_FIX_TG_CM01 \ + --backbone-interface wlan0 \ + --radio-url spinel+hdlc+forkpty:///home/pi//OpenThread/qpg7015m-ot-rcp.elf +``` + +- The OpenThread Border Router can be configured and managed with `ot-ctl` [command line interface](..ThirdParty/openthread/src/cli/README.md). +- The OpenThread Border Router can be also configured with [OpenThread Border Router Web GUI](https://openthread.io/guides/border-router/web-gui). + + +### Building: Qorvo Full Thread Device + +#### Build CLI FTD executables + +This build enables the user to control the thread stack parameters, to join/commission devices, etc. by connecting to a Command Line Interface (CLI) server. + +- Build for QPG7015M + ```shell + cd Software/OpenThread + ./buildall.sh --platform qpg7015m --type cli + ``` +- Build for GP712 + ```shell + cd Software/OpenThread + ./buildall.sh --platform gp712 --type cli + ``` +This will build the CLI applications for the *Full Thread Device*. The output will be the following `.elf` files located in `Software/OpenThread/build/bin` + - `qpg7015m-ot-cli-ftd.elf` + - `gp712-ot-cli-ftd.elf` + +#### Programming the CLI FTD executables + +Programming the executable means just copying it to a Raspberry Pi and making sure it is executable using the following command. + +```shell +chmod +x qpg7015m-ot-cli-ftd.elf +``` + +To run it, one first has to make sure the kernel drivers are loaded and have a communications channel with the `*.elf`. +Instructions for this come with the [Qorvo® IoT Dev Kit Pro](#qorvo®-iot-dev-kit-pro). + +#### Interacting with the Thread Network through the CLI FTD executables + +Run the executable + +```shell +./qpg7015m-ot-cli-ftd.elf +``` + +This launches the CLI client. + +Validating the Thread operation can be done by running the scenarios [here](./Documents/Guides/thread_validation.md). + +--- + +## Enable Firmware logging + +The Qorvo® IoT Dev Kit Pro comes with two different flavors of the firmware, please refer to [Qorvo® IoT Dev Kit Pro Programmer Manual](Documents/Programmer%20Manuals/GP_P1053_UM_17043_Programmer_Manual.pdf) section `2.1.4 Configure the QPG7015M Gateway` for instructions on how to use the debug firmware version. + +--- + +## Debugging the example application + +Please refer to [OpenThread Logs](https://openthread.io/guides/build/logs) for instructions on how to enable OpenThread logs. + +--- + +## Thread test setup + +To start evaluating the thread applications, we need at least two nodes: + +1. One node acts as a router to form the network, this could either be [Thread Border Router RCP](#thread-border-router-rcp) or [Qorvo Full Thread Device](#qorvo-full-thread-device). + +2. One node acts as an end device to join the network, this could be any thread-enabled device like a light bulb or a door switch. + > **Note:** The Qorvo® IoT Dev Kit Pro could also be used as an end device, please refer to [Qorvo® IoT Dev Kit Pro Programmer Manual](Documents/Programmer%20Manuals/GP_P1053_UM_17043_Programmer_Manual.pdf) section `2.2.7 Thread` for more information. + +### Thread Border Router RCP + +Instructions to build OpenThread Border Router docker image and Qorvo virtual RCP can be found in the following section: [Building: Thread Border Router RCP](#building-thread-border-router-rcp). + +PLease refer to [this guide](Documents/Guides/setup_ot_borderrouter.md) for information on how to setup OpenThread Border Router on Qorvo® IoT Dev Kit Pro. + +### Qorvo Full Thread Device + +Instructions to build and use Qorvo Full Thread Device could be found in the following section: [Building: Qorvo Full Thread Device](#building-qorvo-full-thread-device). + +The [Qorvo® IoT Dev Kit Pro Programmer Manual](Documents/Programmer%20Manuals/GP_P1053_UM_17043_Programmer_Manual.pdf) section `2.2.7 Thread` showcases an example to form a Thread network using the Thread CLI Application and ping a node in the network. + +--- + +## Product Test Component + +`Product Test Component (PTC)` is Qorvo's tool for RF PHY compliance certification and verification and can be used for factory testing. To get started with PTC, please refer to [Qorvo® IoT Dev Kit Pro Programmer Manual](Documents/Programmer%20Manuals/GP_P1053_UM_17043_Programmer_Manual.pdf) section `2.2.3 RF Evaluation (PTC)` + +> **NOTE:** When PTC is enabled, the communication stacks are not functional. +> **NOTE:** The PTC system architecture requires a Windows PC, a host (e.g. raspberry pi) and its connected Qorvo product. The PC will run Radio Control Console (RCC), a CLI application, the host will bridge the RCC application to the firmware running on the Qorvo product (TCP to SPI/USB). + +--- + +## Interesting reads + +- [Qorvo® IoT Dev Kit Pro Programmer Manual](Documents/Programmer%20Manuals/GP_P1053_UM_17043_Programmer_Manual.pdf) +- [Setup Qorvo® IoT Dev Kit Pro](Documents/Guides/setup_qpg7015m_dk.md) +- [Setup OpenThread Border Router on Qorvo® IoT Dev Kit Pro](Documents/Guides/setup_ot_borderrouter.md) +- [Thread validation on Qorvo® IoT Dev Kit Pro](Documents/Guides/thread_validation.md) + +--- + +## FCC Notice + +This kit is designed to allow: + +1. Product developers to evaluate electronic components, circuitry, or software associated with the kit to determine whether to incorporate such items in a finished product and +2. Software developers to write software applications for use with the end product. This kit is not a finished product and when assembled may not be resold or otherwise marketed unless all required FCC equipment authorizations are first obtained. Operation is subject to the condition that this product not cause harmful interference to licensed radio stations and that this product accept harmful interference. Unless the assembled kit is designed to operate under part 15, part 18 or part 95 of this chapter, the operator of the kit must operate under the authority of an FCC license holder or must secure an experimental authorization [under part 5 of this chapter](https://www.govinfo.gov/content/pkg/CFR-2013-title47-vol1/pdf/CFR-2013-title47-vol1-sec2-803.pdf). + +--- + +## More information + +Please visit www.qorvo.com for more information on our product line and support options. diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md new file mode 100644 index 0000000..9415300 --- /dev/null +++ b/RELEASE_NOTES.md @@ -0,0 +1,29 @@ +# Release Notes + +## Smart Home Gateway SDK - v1.5.2.0 + +### New Features + +- Feat(HAL): Block radio from sending and receiving when reaching a threshold in the outgoing communication buffer (over SPI, USB) to avoid a state mismatch between host and controller as the controller would continue responding while the host would not be informed of this. When the outgoing communication buffer drops below the threshold, the radio is re-enabled, allowing the controller to recover the communication. Closes: APPSCS-1389 + +- Feat(driver): new versioning scheme: appVersion is fixed to v0.0.0.0, GP_CHANGELIST is defined as a GIT_SHA presented by a unique short + +- Feat(BleAdapter): A start scanning request can now wait (blocking function) until an ongoing scanning stop request is handled. Closes APPSCS-1150 + +### Fixed Bugs + +- Fix(Thread): Pulled in a security fix from OpenThread which blocks the security gap that allowed injection of arbitrary IPv6 datagrams without possession of the Thread Network Key. Closes: SDP011-1773 + +- Fix(Thread): Eliminated a corner case where at radio reset an incorrect frame pending bit is sent by the openthread on the first device trying to attach. Closes: SDP011-1317 + +- Fix(Thread): Fixed an incorrect frame counter in the OpenThread builds for QPG7015M, which could cause radio communications to break down. The DataConfirmCallback was extended to append the FrameCounter (which was received from the OpenThread stack before this callback) to the packet. Closes: SDP011-1318 + +- Fix(Thread): Fixed CSL timing for RCP (used by OpenThread Border Router) by making otPlatGetNow() function unconditionally available. Closes: SDP011-1204 + +- Fix(BLE): Fixed an issue where the Qorvo BLE+Zigbee+Thread transceiver QPG7015M failed to maintain an active BLE connection while active scanning in the background. Due to a timing conflict in handling the transmission of the connection event and the scan request, the Bluetooth LE Real-Time Link Layer failed to send the connection event PDU and became unresponsive until reset. Closes: SDP004-3051 + +- Fix(BLE Host memory): Aligned the WSF memory chunk size with maximum possible size for ATT write request, ATT notification and ATT indication. When a GATT characteristics of maximum value-length was used, it would result in a memory allocation failure, leading to a failing assert that reset the system. Closes: APPSCS-1825 + +### Known Issues + +- N/A diff --git a/Software/OpenThread/.clang-format b/Software/OpenThread/.clang-format new file mode 100644 index 0000000..dce55a8 --- /dev/null +++ b/Software/OpenThread/.clang-format @@ -0,0 +1,113 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: InlineOnly +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: false +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: true + BeforeCatch: false + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeCategories: + - Regex: '^ Specify the platform to build for: gp712, qpg7015m (default: both)" + echo " --type Specify the build type: cli, rcp (default: both)" +} + +# Process command line arguments +while [[ $# -gt 0 ]]; do + case $1 in + --help) + usage + exit 0 + ;; + --platform) + shift + PLATFORM="$1" + shift + ;; + --type) + shift + TYPE="$1" + shift + ;; + *) + usage + exit 1 + ;; + esac +done + +# Validate and set platform +case "$PLATFORM" in + gp712) + BUILD_GP712=1 + BUILD_QPG7015M=0 + ;; + qpg7015m) + BUILD_GP712=0 + BUILD_QPG7015M=1 + ;; + "") + # No platform specified, building for both platforms + BUILD_GP712=1 + BUILD_QPG7015M=1 + ;; + *) + echo "Invalid platform: $PLATFORM." + usage + exit 1 + ;; +esac + +# Validate and set build type +case "$TYPE" in + cli) + BUILD_CLI=1 + BUILD_RCP=0 + ;; + rcp) + BUILD_CLI=0 + BUILD_RCP=1 + ;; + "") + # No build type specified, building for both types + BUILD_CLI=1 + BUILD_RCP=1 + ;; + *) + echo "Invalid build type: $TYPE." + usage + exit 1 + ;; +esac + + +FIX_TG_CM01=3d5cb364f22f0881d5eb528aea01b8db40cc6dd2 +cherry ${THIRDPARTY}/openthread ${FIX_TG_CM01} + +if [ "${BUILD_QPG7015M}" = 1 ] ; then + if [ "${BUILD_CLI}" = 1 ] ; then + platform_build "qpg7015m" "${QPG7015M_LIB_PACKAGE}" "${QPG7015M_LIB_SOURCE}" "${QPG7015M_LIB_TARGET}" "ftd" + fi + if [ "${BUILD_RCP}" = 1 ] ; then + platform_build "qpg7015m" "${QPG7015M_LIB_PACKAGE}" "${QPG7015M_LIB_RCP_SOURCE}" "${QPG7015M_LIB_RCP_TARGET}" "rcp" + fi +fi +if [ "${BUILD_GP712}" = 1 ] ; then + if [ "${BUILD_CLI}" = 1 ] ; then + platform_build "gp712" "${GP712_LIB_PACKAGE}" "${GP712_LIB_SOURCE}" "${GP712_LIB_TARGET}" "ftd" + fi + if [ "${BUILD_RCP}" = 1 ] ; then + platform_build "gp712" "${GP712_LIB_PACKAGE}" "${GP712_LIB_RCP_SOURCE}" "${GP712_LIB_RCP_TARGET}" "rcp" + fi +fi + +unset TOOLCHAIN +unset TOOLCHAIN_RPI +unset CROSS_COMPILE +unset SYSTEMROOT diff --git a/Software/OpenThread/etc/options.cmake b/Software/OpenThread/etc/options.cmake new file mode 100644 index 0000000..7344aa8 --- /dev/null +++ b/Software/OpenThread/etc/options.cmake @@ -0,0 +1,50 @@ +# +# Copyright (c) 2019, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# Additional debugging option +option(OT_MBEDTLS_DEBUG "enable Mbedtls debugging" OFF) +if (OT_MBEDTLS_DEBUG) + add_definitions(-DQORVO_MBEDTLS_DEBUG) +endif() + +# Uart transport option +# option(OT_QORVO_SOCKET "enable socket interface for uart transport on RPi based platforms" ON) + + +# WARN: the below options are only used for target control in internal repos, they overrule +# the existing options in openthread/etc/.../options.cmake + +# Application options +option(OT_APP_CLI "enable CLI app" OFF) +option(OT_APP_NCP "enable NCP app" OFF) +option(OT_APP_RCP "enable RCP app" OFF) + +# Device Role options +option(OT_FTD "enable FTD" OFF) +option(OT_MTD "enable MTD" OFF) + diff --git a/Software/OpenThread/library/CMakeLists.txt b/Software/OpenThread/library/CMakeLists.txt new file mode 100644 index 0000000..b789c80 --- /dev/null +++ b/Software/OpenThread/library/CMakeLists.txt @@ -0,0 +1,69 @@ +# +# Copyright (c) 2020, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +message(STATUS "Qorvo ${QORVO_PLATFORM} libs in ${SDK_DIR}/${QORVO_PLATFORM}") +string(TOUPPER ${QORVO_PLATFORM} QORVO_PLATFORM_UPPER) + +# setting defaults for the variables +set(MBEDTLSALT "") +set(MBEDCRYPTO "") + +if((OT_MTD) AND (OT_FTD)) + message(FATAL_ERROR "Building ${QORVO_PLATFORM} with both OT_MTD and OT_FTD flags set is not supported") +endif() +if (OT_MTD) + set(QORVO_PLATFORM_LIB "${SDK_DIR}/${QORVO_PLATFORM}/lib/libQorvo${QORVO_PLATFORM_UPPER}_mtd.a") + set(TYPE "mtd") +elseif (OT_FTD) + set(QORVO_PLATFORM_LIB "${SDK_DIR}/${QORVO_PLATFORM}/lib/libQorvo${QORVO_PLATFORM_UPPER}_ftd.a") + set(TYPE "ftd") +elseif (OT_RCP) + set(QORVO_PLATFORM_LIB "${SDK_DIR}/${QORVO_PLATFORM}/lib/libQorvo${QORVO_PLATFORM_UPPER}_rcp.a") + # openthread uses an ftd-named lib for rcp + set(TYPE "ftd") +else() + message(FATAL_ERROR "Unsupported library") +endif() + +# QPG6100 and QPG6105 use mbedtls_alt +if (QORVO_PLATFORM MATCHES "qpg6100" OR QORVO_PLATFORM MATCHES "qpg6105") + set(MBEDTLSALT "${SDK_DIR}/${QORVO_PLATFORM}/lib/libmbedtls_alt.a") + set(MBEDCRYPTO "mbedcrypto") +endif() + +message( STATUS "Building platform ${QORVO_PLATFORM} with ${QORVO_PLATFORM_LIB}" ) + + +add_library(${QORVO_PLATFORM}-driver-${TYPE} INTERFACE) +target_link_libraries(${QORVO_PLATFORM}-driver-${TYPE} + INTERFACE + ${QORVO_PLATFORM_LIB} + ${MBEDTLSALT} + ${MBEDCRYPTO} +) + diff --git a/Software/OpenThread/script/bootstrap b/Software/OpenThread/script/bootstrap new file mode 100755 index 0000000..fd9a660 --- /dev/null +++ b/Software/OpenThread/script/bootstrap @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (c) 2020, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +set -euxo pipefail + +"$(dirname "$0")"../../../third_party/openthread/script/bootstrap diff --git a/Software/OpenThread/script/build b/Software/OpenThread/script/build new file mode 100755 index 0000000..38a11f5 --- /dev/null +++ b/Software/OpenThread/script/build @@ -0,0 +1,158 @@ +#!/bin/bash +# +# Copyright (c) 2021, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +set -euxo pipefail + +OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET:-} + +readonly QORVO_PLATFORMS=(gp712 qpg6095 qpg6100 qpg6105 qpg7015m) + +readonly OT_SRCDIR="$(pwd)" +readonly OT_OPTIONS=( + "-DCMAKE_BUILD_TYPE=MinSizeRel" + "-DOT_PLATFORM=external" + "-DOT_SLAAC=ON" +) + +die() +{ + echo " ** ERROR: $1" + exit 1 +} + +build() +{ + builddir="${OT_CMAKE_BUILD_DIR:-build}" + + mkdir -p "${builddir}" + cd "${builddir}" + + cmake -GNinja -DOT_COMPILE_WARNING_AS_ERROR=ON "$@" "${OT_SRCDIR}" + + if [[ -n ${OT_CMAKE_NINJA_TARGET[*]} ]]; then + ninja "${OT_CMAKE_NINJA_TARGET[@]}" + else + ninja + fi + + cd "${OT_SRCDIR}" +} + +select_targets() +{ + local cli=0 + local rcp=0 + local ftd=0 + local mtd=0 + + local cmdline_options=("$@") + + if [[ "${cmdline_options[*]}" == *"OT_FTD=1"* ]]; then + # cli/ftd/mtd are used with bash $ { ! indirection + # shellcheck disable=SC2034 + ftd=1 + fi + if [[ "${cmdline_options[*]}" == *"OT_MTD=1"* ]]; then + # shellcheck disable=SC2034 + mtd=1 + fi + if [[ "${cmdline_options[*]}" == *"OT_RCP=1"* ]]; then + # shellcheck disable=SC2034 + rcp=1 + fi + if [[ "${cmdline_options[*]}" == *"OT_APP_CLI=1"* ]]; then + # shellcheck disable=SC2034 + cli=1 + fi + + local apps=('cli' 'rcp') + local devs=('ftd' 'mtd') + + if [ $((cli + rcp)) -eq 0 ] || [ $((ftd + mtd)) -eq 0 ]; then + # when no target is selected add the empty target. This is required + # for bash versions prior to 4.4 + OT_CMAKE_NINJA_TARGET=("") + else + OT_CMAKE_NINJA_TARGET=() + for app in "${apps[@]}"; do + for dev in "${devs[@]}"; do + if [ "${!app}" -eq 1 ] && [ "${!dev}" -eq 1 ]; then + OT_CMAKE_NINJA_TARGET+=("ot-${app}-${dev}") + fi + done + done + fi +} + +main() +{ + if [[ $# == 0 ]]; then + echo "Please specify a platform: ${QORVO_PLATFORMS[*]}" + exit 1 + fi + + local platform="$1" + echo "${QORVO_PLATFORMS[@]}" | grep -wq "${platform}" || die "Unsupported platform ${platform}" + shift + + local options=("${OT_OPTIONS[@]}") + local cmdline_options=("$@") + + select_targets "${cmdline_options[@]}" + + case "${platform}" in + gp712) + options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-linux-gnueabihf.cmake") + build -DQORVO_PLATFORM="${platform}" -DOT_THREAD_VERSION="1.1" "${options[@]}" "${cmdline_options[@]}" + ;; + qpg7015m) + options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-linux-gnueabihf.cmake") + build -DQORVO_PLATFORM="${platform}" "${options[@]}" "${cmdline_options[@]}" + ;; + qpg6095 | qpg6100) + options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-none-eabi.cmake") + build -DQORVO_PLATFORM="${platform}" -DOT_THREAD_VERSION="1.1" "${options[@]}" "${cmdline_options[@]}" + ;; + qpg6105) + options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-none-eabi.cmake") + build -DQORVO_PLATFORM="${platform}" "${options[@]}" "${cmdline_options[@]}" + ;; + esac + + case "${platform}" in + qpg6095 | qpg6100 | qpg6105) + find "${builddir}/bin" -type f -executable -not -name '*.*' -not -name "${platform}-*" \ + -execdir sh -c 'x="$1"; arm-none-eabi-objcopy -O ihex "$1" "$2-$(basename ${x}).hex"' _ {} "${platform}" \; + ;; + esac + find "${builddir}/bin" -type f -executable -not -name '*.*' -not -name "${platform}-*" \ + -execdir sh -c 'x="$1"; mv "$x" "$2-$(basename ${x}).elf"' _ {} "${platform}" \; +} + +main "$@" diff --git a/Software/OpenThread/script/make-pretty b/Software/OpenThread/script/make-pretty new file mode 100755 index 0000000..ca0b841 --- /dev/null +++ b/Software/OpenThread/script/make-pretty @@ -0,0 +1,175 @@ +#!/bin/bash +# +# Copyright (c) 2019, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# The script to check or format source code of OpenThread. +# +# Format c/c++, markdown, and shell: +# +# script/make-pretty +# +# Format c/c++ only: +# +# script/make-pretty clang-format +# +# Format markdown only: +# +# script/make-pretty markdown +# +# Format shell only: +# +# script/make-pretty shell +# +# Check only: +# +# script/make-pretty check clang-format +# script/make-pretty check markdown +# script/make-pretty check shell +# + +set -euo pipefail + +readonly OT_BUILD_JOBS=$(getconf _NPROCESSORS_ONLN) +readonly OT_EXCLUDE_DIRS=(openthread third_party) + +readonly OT_CLANG_SOURCES=('*.c' '*.cc' '*.cpp' '*.h' '*.hpp') +readonly OT_MARKDOWN_SOURCES=('*.md') + +readonly OT_SCRIPT_DIR="$(dirname "$0")"/../openthread/script + +do_clang_format() +{ + echo -e '========================================' + echo -e ' format c/c++ (clang-format)' + echo -e '========================================' + + git ls-files "${OT_CLANG_SOURCES[@]}" | grep -v -E "^($(echo "${OT_EXCLUDE_DIRS[@]}" | tr ' ' '|'))" \ + | xargs -n3 -P"$OT_BUILD_JOBS" "$OT_SCRIPT_DIR"/clang-format -style=file -i -verbose +} + +do_clang_format_check() +{ + echo -e '========================================' + echo -e ' check c/c++ (clang-format)' + echo -e '========================================' + + git ls-files "${OT_CLANG_SOURCES[@]}" | grep -v -E "^($(echo "${OT_EXCLUDE_DIRS[@]}" | tr ' ' '|'))" \ + | xargs -n3 -P"$OT_BUILD_JOBS" "$OT_SCRIPT_DIR"/clang-format-check +} + +do_markdown_format() +{ + echo -e '========================================' + echo -e ' format markdown' + echo -e '========================================' + + git ls-files "${OT_MARKDOWN_SOURCES[@]}" | grep -v -E "^($(echo "${OT_EXCLUDE_DIRS[@]}" | tr ' ' '|'))" \ + | xargs -n10 -P"$OT_BUILD_JOBS" npx prettier@2.0.4 --write +} + +do_markdown_check() +{ + echo -e '========================================' + echo -e ' check markdown' + echo -e '========================================' + + git ls-files "${OT_MARKDOWN_SOURCES[@]}" | grep -v -E "^($(echo "${OT_EXCLUDE_DIRS[@]}" | tr ' ' '|'))" \ + | xargs -n10 -P"$OT_BUILD_JOBS" npx prettier@2.0.4 --check +} + +do_shell_format() +{ + echo -e '========================================' + echo -e ' format shell' + echo -e '========================================' + + git ls-files | xargs shfmt -f | grep -v -E "^($(echo "${OT_EXCLUDE_DIRS[@]}" | tr ' ' '|'))" \ + | xargs -n10 -P"$OT_BUILD_JOBS" shfmt -i 4 -bn -ci -fn -s -w +} + +do_shell_check() +{ + echo -e '========================================' + echo -e ' check shell' + echo -e '========================================' + + git ls-files | xargs shfmt -f | grep -v -E "^($(echo "${OT_EXCLUDE_DIRS[@]}" | tr ' ' '|'))" \ + | xargs -n10 -P"$OT_BUILD_JOBS" shfmt -i 4 -bn -ci -fn -s -d + + git ls-files | xargs shfmt -f | grep -v -E "^($(echo "${OT_EXCLUDE_DIRS[@]}" | tr ' ' '|'))" \ + | xargs -n10 -P"$OT_BUILD_JOBS" shellcheck +} + +do_check() +{ + if [ $# == 0 ]; then + do_clang_format_check + do_markdown_check + do_shell_check + elif [ "$1" == 'clang' ]; then + do_clang_format_check + elif [ "$1" == 'clang-format' ]; then + do_clang_format_check + elif [ "$1" == 'markdown' ]; then + do_markdown_check + elif [ "$1" == 'shell' ]; then + do_shell_check + else + echo >&2 "Unsupported check: $1. Supported: clang-format, markdown, shell" + # 128 for Invalid arguments + exit 128 + fi +} + +main() +{ + if [ $# == 0 ]; then + do_clang_format + do_markdown_format + do_shell_format + elif [ "$1" == 'clang' ]; then + do_clang_format + elif [ "$1" == 'clang-format' ]; then + do_clang_format + elif [ "$1" == 'markdown' ]; then + do_markdown_format + elif [ "$1" == 'shell' ]; then + do_shell_format + elif [ "$1" == 'check' ]; then + shift + do_check "$@" + else + echo >&2 "Unsupported action: $1. Supported: clang-format, markdown, shell" + # 128 for Invalid arguments + exit 128 + fi + +} + +main "$@" diff --git a/Software/OpenThread/script/test b/Software/OpenThread/script/test new file mode 100755 index 0000000..2d335e2 --- /dev/null +++ b/Software/OpenThread/script/test @@ -0,0 +1,63 @@ +#!/bin/bash +# +# Copyright (c) 2021, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +set -euxo pipefail + +readonly QORVO_PLATFORMS=(gp712 qpg6095 qpg6100 qpg6105 qpg7015m) + +readonly OT_BUILDDIR="$(pwd)/build" + +readonly OT_OPTIONS=( + "-DOT_COMPILE_WARNING_AS_ERROR=ON" +) + +die() +{ + echo " ** ERROR: $1" + exit 1 +} + +main() +{ + if [[ $# == 0 ]]; then + echo "Please specify a platform: ${QORVO_PLATFORMS[*]}" + exit 1 + fi + + local platform="$1" + echo "${QORVO_PLATFORMS[@]}" | grep -wq "${platform}" || die "Unsupported platform ${platform}" + shift + + export CPPFLAGS="${CPPFLAGS:-} -DNDEBUG" + + rm -rf "$OT_BUILDDIR" + "$(dirname "$0")"/build "${platform}" "${OT_OPTIONS[@]}" +} + +main "$@" diff --git a/Software/OpenThread/src/.gitignore b/Software/OpenThread/src/.gitignore new file mode 100644 index 0000000..aabc323 --- /dev/null +++ b/Software/OpenThread/src/.gitignore @@ -0,0 +1,4 @@ +qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Kbuild +qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Work/ +gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Kbuild +gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Work/ diff --git a/Software/OpenThread/src/gp712/CMakeLists.txt b/Software/OpenThread/src/gp712/CMakeLists.txt new file mode 100644 index 0000000..cebbcf8 --- /dev/null +++ b/Software/OpenThread/src/gp712/CMakeLists.txt @@ -0,0 +1,162 @@ +# +# Copyright (c) 2020, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +list(APPEND OT_PLATFORM_DEFINES + "_BSD_SOURCE=1" + "_DEFAULT_SOURCE=1" + "OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1" +) + +target_compile_definitions(ot-config INTERFACE + "MBEDTLS_USER_CONFIG_FILE=\"gp712-mbedtls-config.h\"" +) + +list(APPEND OT_PUBLIC_INCLUDES + "${CMAKE_CURRENT_SOURCE_DIR}/crypto" + "${CMAKE_CURRENT_SOURCE_DIR}/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread" +) + +set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE) + +set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE) + +if(OT_CFLAGS MATCHES "-pedantic-errors") + string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}") +endif() + +if(OT_CFLAGS MATCHES "-Wno-c\\+\\+14-compat") + string(REPLACE "-Wno-c++14-compat" "" OT_CFLAGS "${OT_CFLAGS}") +endif() + +set(PLATFORM_SOURCES + alarm.c + diag.c + entropy.c + flash.c + logging.c + misc.c + radio.c + system.c +) + +if(OT_QORVO_SOCKET) + list(APPEND PLATFORM_SOURCES + uart-socket.c + ) +else() + list(APPEND PLATFORM_SOURCES + uart-posix.c + ) +endif() + +add_library(openthread-gp712-ftd + STATIC + ${PLATFORM_SOURCES} +) + +set_target_properties( + openthread-gp712-ftd + PROPERTIES + C_STANDARD 99 + CXX_STANDARD 11 +) + +target_link_libraries(openthread-gp712-ftd + PRIVATE + -Wl,--start-group + gp712-driver-ftd + ${OT_MBEDTLS} + ot-config + -Wl,--end-group + PUBLIC + -lrt + -pthread + -Wl,--gc-sections + -Wl,-Map=$.map +) + +target_compile_definitions(openthread-gp712-ftd + PUBLIC + ${OT_PLATFORM_DEFINES} +) + +target_compile_options(openthread-gp712-ftd + PRIVATE + ${OT_CFLAGS} +) + +target_include_directories(openthread-gp712-ftd + PRIVATE + ${OT_PUBLIC_INCLUDES} + ${OPENTHREAD_DIR}/examples/platforms +) + +add_library(openthread-gp712-mtd + STATIC + ${PLATFORM_SOURCES} +) + +set_target_properties( + openthread-gp712-mtd + PROPERTIES + C_STANDARD 99 + CXX_STANDARD 11 +) + +target_link_libraries(openthread-gp712-mtd + PRIVATE + -Wl,--start-group + gp712-driver-mtd + ${OT_MBEDTLS} + ot-config + -Wl,--end-group + PUBLIC + -lrt + -pthread + -Wl,--gc-sections + -Wl,-Map=$.map +) + +target_compile_definitions(openthread-gp712-mtd + PUBLIC + ${OT_PLATFORM_DEFINES} +) + +target_compile_options(openthread-gp712-mtd + PRIVATE + ${OT_CFLAGS} +) + +target_include_directories(openthread-gp712-mtd + PRIVATE + ${OT_PUBLIC_INCLUDES} + ${OPENTHREAD_DIR}/examples/platforms +) + +target_include_directories(ot-config INTERFACE ${OT_PUBLIC_INCLUDES}) +target_compile_definitions(ot-config INTERFACE ${OT_PLATFORM_DEFINES}) diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Documents/ReleaseNotes/ReleaseNotes.pdf b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Documents/ReleaseNotes/ReleaseNotes.pdf new file mode 100644 index 0000000..43808fa Binary files /dev/null and b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Documents/ReleaseNotes/ReleaseNotes.pdf differ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Documents/User Manuals/GP_P1053_AN_14876_Open_Thread.pdf b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Documents/User Manuals/GP_P1053_AN_14876_Open_Thread.pdf new file mode 100644 index 0000000..e494af9 Binary files /dev/null and b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Documents/User Manuals/GP_P1053_AN_14876_Open_Thread.pdf differ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Documents/document_overview.txt b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Documents/document_overview.txt new file mode 100644 index 0000000..c506cfa --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Documents/document_overview.txt @@ -0,0 +1,5 @@ + +document revisions: +------------------- +User Manuals/GP_P1053_AN_14876_Open_Thread.pdf - rev. 1.8 +../GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf - rev. 1.19 diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/End_User_License_Agreement.pdf b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/End_User_License_Agreement.pdf new file mode 100644 index 0000000..71ab61f Binary files /dev/null and b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/End_User_License_Agreement.pdf differ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf new file mode 100644 index 0000000..deca380 Binary files /dev/null and b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf differ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/README.txt b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/README.txt new file mode 100644 index 0000000..2dbfeec --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/README.txt @@ -0,0 +1,11 @@ + +Getting started: +=============== +* Discover new features, resolved and known issues: GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf +* Explore the projects + + +Folder structure: +================ + Software Example projects + Documents diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Makefile.QorvoGP712_rpi_cli_ftd_socket b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Makefile.QorvoGP712_rpi_cli_ftd_socket new file mode 100644 index 0000000..758a25f --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Makefile.QorvoGP712_rpi_cli_ftd_socket @@ -0,0 +1,374 @@ +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/gp712_rpi_cli_ftd_socket.py + +ifndef BASEDIR +BASEDIR:=$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) +endif +# Global vars +OS_USED?=LINUX +ROOTDIR?=$(BASEDIR) +WORKDIR=$(BASEDIR)/Work/QorvoGP712_rpi_cli_ftd_socket +ENV_PATH?=$(BASEDIR) +PYTHON_BIN?=/usr/bin/python3 +CURRENT_CONF:=gp712_rpi_cli_ftd_socket.py +EXTRA_CONF:= + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_config.h + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +FLAGS= + +# Main target file +APPLIB:=$(BASEDIR)/Work/QorvoGP712_rpi_cli_ftd_socket/libQorvoGP712_rpi_cli_ftd_socket.a + + +# Compiler specifics +COMPILER?=rpi_bcm2708 +COMPILER_VERSION:= +TOOLCHAIN?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf +CROSS_COMPILE?=arm-linux-gnueabihf- +SYSTEMROOT?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot +PROGRAMMER?=linux +PROGRAM_EXT:=a +LIB_EXT:=a + +SRC= +SRC_NOWARNING= +ASRC= +INC= +AINC= +LIB= + +# Application defines +APPNAME:=QorvoGP712_rpi_cli_ftd_socket +SRC_APP:= +SRC_APP+=$(BASEDIR)/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c +SRC+=$(SRC_APP) +INC_APP:= +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708 +INC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen +INC+=$(INC_APP) +AINC_APP:= +AINC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen +AINC+=$(AINC_APP) + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_config.h +FLAGS+=-DGP_CONFIG_HEADER +APPFIRMWARE:= + +COMPS:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +SRC_gpAssert:= +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c +SRC+=$(SRC_gpAssert) +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) +SRC_NOWARNING+=$(SRC_gpAssert) + +#Depends on: +# src: +COMPS+=gpBaseComps +SRC_gpBaseComps:= +SRC_gpBaseComps+=$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c +SRC+=$(SRC_gpBaseComps) +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) +SRC_NOWARNING+=$(SRC_gpBaseComps) + +#Depends on: +# src: +COMPS+=gpBsp +SRC_gpBsp:= +SRC_gpBsp+=$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c +SRC+=$(SRC_gpBsp) +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) +SRC_NOWARNING+=$(SRC_gpBsp) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +SRC_gpCom:= +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c +SRC+=$(SRC_gpCom) +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) +SRC_NOWARNING+=$(SRC_gpCom) + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +SRC_gpEncryption:= +SRC_gpEncryption+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c +SRC+=$(SRC_gpEncryption) +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) +SRC_NOWARNING+=$(SRC_gpEncryption) + +#Depends on: +# src: gpAssert +COMPS+=gpLog +SRC_gpLog:= +SRC_gpLog+=$(BASEDIR)/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c +SRC+=$(SRC_gpLog) +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) +SRC_NOWARNING+=$(SRC_gpLog) + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +SRC_gpMacCore:= +SRC_gpMacCore+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c +SRC+=$(SRC_gpMacCore) +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC+=$(INC_gpMacCore) +SRC_NOWARNING_EXCLUDES_gpMacCore:= +SRC_NOWARNING+=$(filter-out $(SRC_NOWARNING_EXCLUDES_gpMacCore), $(SRC_gpMacCore)) + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +SRC_gpMacDispatcher:= +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c +SRC+=$(SRC_gpMacDispatcher) +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC+=$(INC_gpMacDispatcher) + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +SRC_gpPd:= +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c +SRC+=$(SRC_gpPd) +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +SRC_gpPoolMem:= +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c +SRC+=$(SRC_gpPoolMem) +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) +SRC_NOWARNING+=$(SRC_gpPoolMem) + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +SRC_gpRandom:= +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c +SRC+=$(SRC_gpRandom) +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +SRC_gpRxArbiter:= +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c +SRC+=$(SRC_gpRxArbiter) +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) +SRC_NOWARNING+=$(SRC_gpRxArbiter) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +SRC_gpSched:= +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c +SRC+=$(SRC_gpSched) +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) +SRC_NOWARNING+=$(SRC_gpSched) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +SRC_gpStat:= +SRC_gpStat+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c +SRC+=$(SRC_gpStat) +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) +SRC_NOWARNING+=$(SRC_gpStat) + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +SRC_gpUtils:= +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c +SRC+=$(SRC_gpUtils) +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) +SRC_NOWARNING+=$(SRC_gpUtils) + +#Depends on: +# src: +COMPS+=gpVersion +SRC_gpVersion:= +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c +SRC+=$(SRC_gpVersion) +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC+=$(INC_gpVersion) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + +#Depends on: +# src: gpAssert, gpReset, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +SRC_gphal:= +SRC_gphal+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c +SRC+=$(SRC_gphal) +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +SRC_halLinux:= +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Timer.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c +SRC+=$(SRC_halLinux) +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=pthread +LIB_halLinux+=rt +LIB+=$(LIB_halLinux) + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +SRC_qvOT:= +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c +SRC+=$(SRC_qvOT) +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/gp712 +INC+=$(INC_qvOT) +SRC_NOWARNING+=$(SRC_qvOT) + + +-include $(BASEDIR)/custom.mk +include $(ENV_PATH)/make/gpcommon.mk diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Makefile.QorvoGP712_rpi_cli_mtd_socket b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Makefile.QorvoGP712_rpi_cli_mtd_socket new file mode 100644 index 0000000..c9e7ece --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Makefile.QorvoGP712_rpi_cli_mtd_socket @@ -0,0 +1,374 @@ +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/gp712_rpi_cli_mtd_socket.py + +ifndef BASEDIR +BASEDIR:=$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) +endif +# Global vars +OS_USED?=LINUX +ROOTDIR?=$(BASEDIR) +WORKDIR=$(BASEDIR)/Work/QorvoGP712_rpi_cli_mtd_socket +ENV_PATH?=$(BASEDIR) +PYTHON_BIN?=/usr/bin/python3 +CURRENT_CONF:=gp712_rpi_cli_mtd_socket.py +EXTRA_CONF:= + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_config.h + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +FLAGS= + +# Main target file +APPLIB:=$(BASEDIR)/Work/QorvoGP712_rpi_cli_mtd_socket/libQorvoGP712_rpi_cli_mtd_socket.a + + +# Compiler specifics +COMPILER?=rpi_bcm2708 +COMPILER_VERSION:= +TOOLCHAIN?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf +CROSS_COMPILE?=arm-linux-gnueabihf- +SYSTEMROOT?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot +PROGRAMMER?=linux +PROGRAM_EXT:=a +LIB_EXT:=a + +SRC= +SRC_NOWARNING= +ASRC= +INC= +AINC= +LIB= + +# Application defines +APPNAME:=QorvoGP712_rpi_cli_mtd_socket +SRC_APP:= +SRC_APP+=$(BASEDIR)/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c +SRC+=$(SRC_APP) +INC_APP:= +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708 +INC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen +INC+=$(INC_APP) +AINC_APP:= +AINC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen +AINC+=$(AINC_APP) + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_config.h +FLAGS+=-DGP_CONFIG_HEADER +APPFIRMWARE:= + +COMPS:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +SRC_gpAssert:= +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c +SRC+=$(SRC_gpAssert) +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) +SRC_NOWARNING+=$(SRC_gpAssert) + +#Depends on: +# src: +COMPS+=gpBaseComps +SRC_gpBaseComps:= +SRC_gpBaseComps+=$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c +SRC+=$(SRC_gpBaseComps) +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) +SRC_NOWARNING+=$(SRC_gpBaseComps) + +#Depends on: +# src: +COMPS+=gpBsp +SRC_gpBsp:= +SRC_gpBsp+=$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c +SRC+=$(SRC_gpBsp) +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) +SRC_NOWARNING+=$(SRC_gpBsp) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +SRC_gpCom:= +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c +SRC+=$(SRC_gpCom) +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) +SRC_NOWARNING+=$(SRC_gpCom) + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +SRC_gpEncryption:= +SRC_gpEncryption+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c +SRC+=$(SRC_gpEncryption) +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) +SRC_NOWARNING+=$(SRC_gpEncryption) + +#Depends on: +# src: gpAssert +COMPS+=gpLog +SRC_gpLog:= +SRC_gpLog+=$(BASEDIR)/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c +SRC+=$(SRC_gpLog) +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) +SRC_NOWARNING+=$(SRC_gpLog) + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +SRC_gpMacCore:= +SRC_gpMacCore+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c +SRC+=$(SRC_gpMacCore) +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC+=$(INC_gpMacCore) +SRC_NOWARNING_EXCLUDES_gpMacCore:= +SRC_NOWARNING+=$(filter-out $(SRC_NOWARNING_EXCLUDES_gpMacCore), $(SRC_gpMacCore)) + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +SRC_gpMacDispatcher:= +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c +SRC+=$(SRC_gpMacDispatcher) +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC+=$(INC_gpMacDispatcher) + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +SRC_gpPd:= +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c +SRC+=$(SRC_gpPd) +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +SRC_gpPoolMem:= +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c +SRC+=$(SRC_gpPoolMem) +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) +SRC_NOWARNING+=$(SRC_gpPoolMem) + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +SRC_gpRandom:= +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c +SRC+=$(SRC_gpRandom) +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +SRC_gpRxArbiter:= +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c +SRC+=$(SRC_gpRxArbiter) +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) +SRC_NOWARNING+=$(SRC_gpRxArbiter) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +SRC_gpSched:= +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c +SRC+=$(SRC_gpSched) +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) +SRC_NOWARNING+=$(SRC_gpSched) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +SRC_gpStat:= +SRC_gpStat+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c +SRC+=$(SRC_gpStat) +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) +SRC_NOWARNING+=$(SRC_gpStat) + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +SRC_gpUtils:= +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c +SRC+=$(SRC_gpUtils) +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) +SRC_NOWARNING+=$(SRC_gpUtils) + +#Depends on: +# src: +COMPS+=gpVersion +SRC_gpVersion:= +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c +SRC+=$(SRC_gpVersion) +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC+=$(INC_gpVersion) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + +#Depends on: +# src: gpAssert, gpReset, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +SRC_gphal:= +SRC_gphal+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c +SRC+=$(SRC_gphal) +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +SRC_halLinux:= +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Timer.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c +SRC+=$(SRC_halLinux) +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=pthread +LIB_halLinux+=rt +LIB+=$(LIB_halLinux) + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +SRC_qvOT:= +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c +SRC+=$(SRC_qvOT) +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/gp712 +INC+=$(INC_qvOT) +SRC_NOWARNING+=$(SRC_qvOT) + + +-include $(BASEDIR)/custom.mk +include $(ENV_PATH)/make/gpcommon.mk diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Makefile.QorvoGP712_rpi_rcp_socket b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Makefile.QorvoGP712_rpi_rcp_socket new file mode 100644 index 0000000..368d467 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/Makefile.QorvoGP712_rpi_rcp_socket @@ -0,0 +1,374 @@ +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/gp712_rpi_rcp_socket.py + +ifndef BASEDIR +BASEDIR:=$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) +endif +# Global vars +OS_USED?=LINUX +ROOTDIR?=$(BASEDIR) +WORKDIR=$(BASEDIR)/Work/QorvoGP712_rpi_rcp_socket +ENV_PATH?=$(BASEDIR) +PYTHON_BIN?=/usr/bin/python3 +CURRENT_CONF:=gp712_rpi_rcp_socket.py +EXTRA_CONF:= + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_config.h + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +FLAGS= + +# Main target file +APPLIB:=$(BASEDIR)/Work/QorvoGP712_rpi_rcp_socket/libQorvoGP712_rpi_rcp_socket.a + + +# Compiler specifics +COMPILER?=rpi_bcm2708 +COMPILER_VERSION:= +TOOLCHAIN?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf +CROSS_COMPILE?=arm-linux-gnueabihf- +SYSTEMROOT?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot +PROGRAMMER?=linux +PROGRAM_EXT:=a +LIB_EXT:=a + +SRC= +SRC_NOWARNING= +ASRC= +INC= +AINC= +LIB= + +# Application defines +APPNAME:=QorvoGP712_rpi_rcp_socket +SRC_APP:= +SRC_APP+=$(BASEDIR)/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c +SRC+=$(SRC_APP) +INC_APP:= +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708 +INC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen +INC+=$(INC_APP) +AINC_APP:= +AINC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen +AINC+=$(AINC_APP) + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_config.h +FLAGS+=-DGP_CONFIG_HEADER +APPFIRMWARE:= + +COMPS:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +SRC_gpAssert:= +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c +SRC+=$(SRC_gpAssert) +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) +SRC_NOWARNING+=$(SRC_gpAssert) + +#Depends on: +# src: +COMPS+=gpBaseComps +SRC_gpBaseComps:= +SRC_gpBaseComps+=$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c +SRC+=$(SRC_gpBaseComps) +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) +SRC_NOWARNING+=$(SRC_gpBaseComps) + +#Depends on: +# src: +COMPS+=gpBsp +SRC_gpBsp:= +SRC_gpBsp+=$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c +SRC+=$(SRC_gpBsp) +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) +SRC_NOWARNING+=$(SRC_gpBsp) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +SRC_gpCom:= +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c +SRC+=$(SRC_gpCom) +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) +SRC_NOWARNING+=$(SRC_gpCom) + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +SRC_gpEncryption:= +SRC_gpEncryption+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c +SRC+=$(SRC_gpEncryption) +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) +SRC_NOWARNING+=$(SRC_gpEncryption) + +#Depends on: +# src: gpAssert +COMPS+=gpLog +SRC_gpLog:= +SRC_gpLog+=$(BASEDIR)/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c +SRC+=$(SRC_gpLog) +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) +SRC_NOWARNING+=$(SRC_gpLog) + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +SRC_gpMacCore:= +SRC_gpMacCore+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c +SRC+=$(SRC_gpMacCore) +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC+=$(INC_gpMacCore) +SRC_NOWARNING_EXCLUDES_gpMacCore:= +SRC_NOWARNING+=$(filter-out $(SRC_NOWARNING_EXCLUDES_gpMacCore), $(SRC_gpMacCore)) + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +SRC_gpMacDispatcher:= +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c +SRC+=$(SRC_gpMacDispatcher) +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC+=$(INC_gpMacDispatcher) + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +SRC_gpPd:= +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c +SRC+=$(SRC_gpPd) +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +SRC_gpPoolMem:= +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c +SRC+=$(SRC_gpPoolMem) +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) +SRC_NOWARNING+=$(SRC_gpPoolMem) + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +SRC_gpRandom:= +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c +SRC+=$(SRC_gpRandom) +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +SRC_gpRxArbiter:= +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c +SRC+=$(SRC_gpRxArbiter) +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) +SRC_NOWARNING+=$(SRC_gpRxArbiter) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +SRC_gpSched:= +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c +SRC+=$(SRC_gpSched) +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) +SRC_NOWARNING+=$(SRC_gpSched) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +SRC_gpStat:= +SRC_gpStat+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c +SRC+=$(SRC_gpStat) +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) +SRC_NOWARNING+=$(SRC_gpStat) + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +SRC_gpUtils:= +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c +SRC+=$(SRC_gpUtils) +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) +SRC_NOWARNING+=$(SRC_gpUtils) + +#Depends on: +# src: +COMPS+=gpVersion +SRC_gpVersion:= +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c +SRC+=$(SRC_gpVersion) +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC+=$(INC_gpVersion) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + +#Depends on: +# src: gpAssert, gpReset, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +SRC_gphal:= +SRC_gphal+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c +SRC+=$(SRC_gphal) +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +SRC_halLinux:= +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Timer.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c +SRC+=$(SRC_halLinux) +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=pthread +LIB_halLinux+=rt +LIB+=$(LIB_halLinux) + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +SRC_qvOT:= +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c +SRC+=$(SRC_qvOT) +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/gp712 +INC+=$(INC_qvOT) +SRC_NOWARNING+=$(SRC_qvOT) + + +-include $(BASEDIR)/custom.mk +include $(ENV_PATH)/make/gpcommon.mk diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c new file mode 100644 index 0000000..5702985 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c @@ -0,0 +1,17 @@ +#define GP_COMPONENT_ID GP_COMPONENT_ID_APP + +#include "gpLog.h" + +#include + +// #define GP_LOCAL_LOG + +void qorvoThreadApp_Main() +{ + GP_LOG_PRINTF(">> TEST APP STARTED", 0); +} + +void qorvoThreadApp_Init(otInstance *sInstance) +{ + GP_LOG_PRINTF(">> TEST APP INIT", 0); +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/alarm_qorvo.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/alarm_qorvo.h new file mode 100644 index 0000000..5a157b5 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/alarm_qorvo.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the declarations of the Alarm functions from the Qorvo library. + * + */ + +#ifndef _ALARM_QORVO_H_ +#define _ALARM_QORVO_H_ + +#include +#include +#include +#include + +typedef void (*qorvoAlarmCallback_t)(void *); + +/** + * This function initializes the alarm service used by OpenThread. + * + */ +void qorvoAlarmInit(void); + +/** + * This function retrieves the current host time in milliseconds. + * + * @param[out] The current time in ms. + * + */ +uint32_t qorvoAlarmGetTimeMs(void); + +/** + * This function retrieves the current host time in microseconds. + * + * @param[out] The current time in us. + * + */ +uint32_t qorvoAlarmGetTimeUs(void); + +/** + * This function schedules a callback after a relative amount of time. + * + * @param[in] rel_time The relative time in ms. + * @param[in] callback A callback function which will be called. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +void qorvoAlarmMilliStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); + +/** + * This function schedules a callback after a relative amount of time. + * + * @param[in] rel_time The relative time in us. + * @param[in] callback A callback function which will be called. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +void qorvoAlarmMicroStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); + +/** + * This function unschedules the callback. + * + * @param[in] callback A callback function which will be removed from the list. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +bool qorvoAlarmStop(qorvoAlarmCallback_t callback, void *arg); + +/** + * This function schedules a callback after a relative amount of time. + * This function exists for backwards compatibility reasons + * + * @param[in] rel_time The relative time in ms. + * @param[in] callback A callback function which will be called. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +void qorvoAlarmScheduleEventArg(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); + +/** + * This function unschedules the callback. + * This function exists for backwards compatibility reasons + * + * @param[in] callback A callback function which will be removed from the list. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +bool qorvoAlarmUnScheduleEventArg(qorvoAlarmCallback_t callback, void *arg); + +#endif // _ALARM_QORVO_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/openthread-core-config.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/openthread-core-config.h new file mode 100644 index 0000000..62feaeb --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/openthread-core-config.h @@ -0,0 +1,10 @@ +#ifndef _OPENTHREAD_CORE_CONFIG_H_ +#define _OPENTHREAD_CORE_CONFIG_H_ +// +// Qorvo created file: +// +// This file is required to jailbreak the OpenThread build process +// So we don't need to be build OpenThread twice just to have the +// the file of the same name, which we don't need for our driver, +// generated in 'build/' +#endif // _OPENTHREAD_CORE_CONFIG_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/platform_qorvo.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/platform_qorvo.h new file mode 100644 index 0000000..f163642 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/platform_qorvo.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the platform-specific initializers. + * + */ + +#ifndef _PLATFORM_QORVO_H_ +#define _PLATFORM_QORVO_H_ + +#include + +#include +#include +#include + +typedef void (*qorvoPlatPollFunction_t)(uint8_t); +typedef uint8_t (*qorvoPlatGotoSleepCheckCallback_t)(void); + +/** + * This function registers a callback to a file descriptor. + * + * @param[in] fd The file descriptor. + * @param[in] pollFunction The callback which should be called when data is ready or needed for the file descriptor. + * + */ +void qorvoPlatRegisterPollFunction(int fd, qorvoPlatPollFunction_t pollFunction); + +/** + * This function unregisters a callback for a file descriptor. + * + * @param[in] fd The file descriptor. + * + */ +void qorvoPlatUnRegisterPollFunction(int fd); + +/** + * This function initializes the platform. + * + * @param[in] gotoSleepCheckCallback The callback which needs to return if sleep is allowed. + * + */ +void qorvoPlatInit(qorvoPlatGotoSleepCheckCallback_t gotoSleepCheckCallback); + +/** + * This function runs the main loop of the platform once. + * + * @param[in] canGoToSleep Indicates if the platform can got to sleep. + * + */ +void qorvoPlatMainLoop(bool canGoToSleep); + +#endif // _PLATFORM_QORVO_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/radio_qorvo.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/radio_qorvo.h new file mode 100644 index 0000000..51bdf1f --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/radio_qorvo.h @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the declarations of the radio functions from the Qorvo library. + * + */ + +#ifndef _RADIO_QORVO_H_ +#define _RADIO_QORVO_H_ + +#include +#include + +#include +#include + +/** + * This function initializes the radio. + * + */ +void qorvoRadioInit(void); + +/** + * This function resets the radio. + * + */ +void qorvoRadioReset(void); + +/** + * This function processes event to/from the radio. + * + */ +void qorvoRadioProcess(void); + +/** + * This function starts an ED scan. + * + * @param[in] aScanChannel The channel which needs to be scanned. + * @param[in] aScanDuration The amount of time in ms which needs to be scanned. + * + */ +otError qorvoRadioEnergyScan(uint8_t aScanChannel, uint16_t aScanDuration); + +/** + * This function sets the current channel. + * + * @param[in] channel The channel index. + * + */ +void qorvoRadioSetCurrentChannel(uint8_t channel); + +/** + * This function sets the idle behaviour of the radio. + * + * @param[in] rxOnWhenIdle If true, the radio remains on which not transmitting. + * + */ +void qorvoRadioSetRxOnWhenIdle(bool rxOnWhenIdle); + +/** + * This function retrieves the MAC address of the radio. + * + * @param[out] aIeeeEui64 The MAC address of the radio. + * + */ +void qorvoRadioGetIeeeEui64(uint8_t *aIeeeEui64); + +/** + * This function transmits a frame. + * + * @param[in] aFrame The frame which needs to be transmitted. + * + */ +otError qorvoRadioTransmit(otRadioFrame *aFrame); + +/** + * This function sets the PanId. + * + * @param[in] panid The panId. + * + */ +void qorvoRadioSetPanId(uint16_t panid); + +/** + * This function sets the short address. + * + * @param[in] address The short address. + * + */ +void qorvoRadioSetShortAddress(uint16_t address); + +/** + * This function sets the extended address. + * + * @param[in] address The extended address. + * + */ +void qorvoRadioSetExtendedAddress(const uint8_t *address); + +/** + * This function enables source address matching for indirect transmit. + * + * @param[in] aEnable if True will enable source address matching, false will disable. + * + */ +void qorvoRadioEnableSrcMatch(bool aEnable); + +/** + * This function clears all entries from the source address match list. + * + */ +void qorvoRadioClearSrcMatchEntries(void); + +/** + * This function adds an short address plus panid to the source address match list. + * + * @param[in] aShortAddress The short address which should be added. + * @param[in] panid The panid. + * + */ +otError qorvoRadioAddSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid); + +/** + * This function adds an extended address plus panid to the source address match list. + * + * @param[in] aExtAddress The extended address which should be added. + * @param[in] panid The panid. + * + */ +otError qorvoRadioAddSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid); + +/** + * This function removes an short address plus panid from the source address match list. + * + * @param[in] aShortAddress The short address which should be removed. + * @param[in] panid The panid. + * + */ +otError qorvoRadioClearSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid); + +/** + * This function removes an extended address plus panid from the source address match list. + * + * @param[in] aExtAddress The extended address which should be removed. + * @param[in] panid The panid. + * + */ +otError qorvoRadioClearSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid); + +/** + * This function gets the transmit power for current channel + * + * @param[out] aPower The transmit power + * + */ +otError qorvoRadioGetTransmitPower(int8_t *aPower); + +/** + * This function sets the transmit power for current channel + * + * @param[in] aPower The transmit power + * + */ +otError qorvoRadioSetTransmitPower(int8_t aPower); + +/** + * Get the status of promiscuous mode. + * + * @retval TRUE Promiscuous mode is enabled. + * @retval FALSE Promiscuous mode is disabled. + * + */ +bool qorvoRadioGetPromiscuous(void); + +/** + * Enable or disable promiscuous mode. + * + * @param[in] aEnable TRUE to enable or FALSE to disable promiscuous mode. + * + */ +void qorvoRadioSetPromiscuous(bool aEnable); + +/** + * Update MAC keys and key index + * + * This function is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability. + * + * @param[in] aKeyIdMode The key ID mode. + * @param[in] aKeyId Current MAC key index. + * @param[in] aPrevKey A pointer to the previous MAC key. + * @param[in] aCurrKey A pointer to the current MAC key. + * @param[in] aNextKey A pointer to the next MAC key. + * @param[in] aKeyType Key Type used. + * + */ +void qorvoRadioSetMacKey(uint8_t aKeyIdMode, + uint8_t aKeyId, + const uint8_t *aPrevKey, + const uint8_t *aCurrKey, + const uint8_t *aNextKey, + uint8_t aKeyType); + +/** + * This method sets the current MAC frame counter value. + * + * This function is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability. + * + * @param[in] aMacFrameCounter The MAC frame counter value. + * + */ +void qorvoRadioSetMacFrameCounter(uint32_t aMacFrameCounter); + +/** + * Enable or disable CSL receiver. + * + * @param[in] aCslPeriod CSL period, 0 for disabling CSL. + * @param[in] aShortAddr The short source address of CSL receiver's peer. + * @param[in] aExtAddr The extended source address of CSL receiver's peer. + * + * @note Platforms should use CSL peer addresses to include CSL IE when generating enhanced acks. + * + * @retval kErrorNotImplemented Radio driver doesn't support CSL. + * @retval kErrorFailed Other platform specific errors. + * @retval kErrorNone Successfully enabled or disabled CSL. + * + */ +otError qorvoRadioEnableCsl(uint32_t aCslPeriod, + uint16_t aShortAddr, + const uint8_t *aExtAddr); + +/** + * Update CSL sample time in radio driver. + * + * Sample time is stored in radio driver as a copy to calculate phase when sending ACK with CSL IE. + * + * @param[in] aCslSampleTime The latest sample time. + * + */ +void qorvoRadioUpdateCslSampleTime(uint32_t aCslSampleTime); + +/** + * Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator. + * + * After Enhanced-ACK Based Probing is configured by a specific Probing Initiator, the Enhanced-ACK sent to that + * node should include Vendor-Specific IE containing Link Metrics data. This method informs the radio to start/stop to + * collect Link Metrics data and include Vendor-Specific IE that containing the data in Enhanced-ACK sent to that + * Probing Initiator. + * + * @param[in] aLinkMetrics This parameter specifies what metrics to query. Per spec 4.11.3.4.4.6, at most 2 metrics + * can be specified. The probing would be disabled if @p `aLinkMetrics` is bitwise 0. + * @param[in] aShortAddr The short address of the Probing Initiator. + * @param[in] aExtAddr The extended source address of the Probing Initiator. @p aExtAddr MUST NOT be `NULL`. + * + * @retval OT_ERROR_NONE Successfully configured the Enhanced-ACK Based Probing. + * @retval OT_ERROR_INVALID_ARGS @p aExtAddress is `NULL`. + * @retval OT_ERROR_NOT_FOUND The Initiator indicated by @p aShortAddress is not found when trying to clear. + * @retval OT_ERROR_NO_BUFS No more Initiator can be supported. + * + */ +otError qorvoRadioConfigureEnhAckProbing(otLinkMetrics aLinkMetrics, + uint16_t aShortAddress, + const uint8_t *aExtAddress); + +/** + * Get the current estimated time (in microseconds) of the radio chip. + * + * This microsecond timer must be a free-running timer. The timer must continue to advance with microsecond precision + * even when the radio is in the sleep state. + * + * @returns The current time in microseconds. UINT64_MAX when platform does not support or radio time is not ready. + * + */ +uint64_t qorvoRadioGetNow(void); + +/** + * Schedule a radio reception window at a specific time and duration. + * + * @param[in] aChannel The radio channel on which to receive. + * @param[in] aStart The receive window start time, in microseconds. + * @param[in] aDuration The receive window duration, in microseconds + * + * @retval OT_ERROR_NONE Successfully scheduled receive window. + * @retval OT_ERROR_FAILED The receive window could not be scheduled. + */ +otError qorvoRadioReceiveAt(uint8_t aChannel, uint32_t aStart, uint32_t aDuration); + +/** + * Retrieve the radio capabilities of the radio + * + * @returns caps The radio capabilities as described in include/openthread/platform/radio.h + */ +otRadioCaps qorvoRadioGetCaps(void); + +/** + * This callback is called when the energy scan is finished. + * + * @param[in] aEnergyScanMaxRssi The amount of energy detected during the ED scan. + * + */ +void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi); + +/** + * This callback is called after a transmission is completed (and if required an ACK is received). + * + * @param[in] aFrame The packet which was transmitted. + * @param[in] aFramePending Indicates if the FP bit was set in the ACK frame or not. + * @param[in] aError Indicates if an error occurred during transmission. + * + */ +void cbQorvoRadioTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError); + +/** + * This callback is called after a transmission is completed (and if required an ACK is received). + * + * @param[in] aFrame The packet which was transmitted. + * @param[in] aAckFrame The complete 802.15.4-2015 enhanced ack frame. + * @param[in] aError Indicates if an error occurred during transmission. + * + */ +void cbQorvoRadioTransmitDone_AckFrame(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); + +/** + * This callback is called after a frame is received. + * + * @param[in] aFrame The packet which was received. + * @param[in] aError Any error which occurred during reception of the packet. + * + */ +void cbQorvoRadioReceiveDone(otRadioFrame *aFrame, otError aError); + +/** + * This callback is called to notify OpenThread that the transmission has started. + * + * @note This function should be called by the same thread that executes all of the other OpenThread code. It should + * not be called by ISR or any other task. + * + * @param[in] aFrame A pointer to the frame that is being transmitted. + * + */ +void cbQorvoRadioTxStarted(otRadioFrame *aFrame); + +#endif // _RADIO_QORVO_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/uart_qorvo.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/uart_qorvo.h new file mode 100644 index 0000000..be21438 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/inc/uart_qorvo.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the declarations of the uart functions from the Qorvo library. + * + */ + +#ifndef _UART_QORVO_H_ +#define _UART_QORVO_H_ + +#include +#include +#include +#include + +/** + * This function enables the UART driver. + * + */ +void qorvoUartInit(void); + +/** + * This function disables the UART driver. + * + */ +void qorvoUartDeInit(void); + +/** + * Callback function which will be called when uart transmission is done. + * + */ +void cbQorvoUartTxDone(void); + +/** + * Callback function which will be called when uart data is received. + * + * @param[in] aBuf A pointer to an array of received bytes. + * @param[in] aBufLength The number of bytes received from the uart. + * + */ +void qorvoUartSendInput(uint8_t *aBuf, uint16_t aBufLength); + +/** + * Function which transmits data via the uart. + * + * @param[out] aBuf A pointer to an array of bytes which need to be transmitted. + * @param[in] aBufLength The number of bytes to be transmitted via the uart. + * + */ +void qorvoUartSendOutput(const uint8_t *aBuf, uint16_t aBufLength); + +/** + * Function which transmits logging via the qorvo platform. + * + * @param[in] aLogLevel The severity level of logging. + * @param[in] aLogRegion The code region where the logging originated from. + * @param[in] aFormat The format strings. + * @param[in] args The arguments for the format string. + * + */ +void qorvoUartLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list args); + +/** + * Flush the outgoing transmit buffer and wait for the data to be sent. + * This is called when the CLI UART interface has a full buffer but still + * wishes to send more data. + * + * @retval OT_ERROR_NONE Flush succeeded, we can proceed to write more + * data to the buffer. + * + * @retval OT_ERROR_NOT_IMPLEMENTED Driver does not support synchronous flush. + * @retval OT_ERROR_INVALID_STATE Driver has no data to flush. + */ +otError qorvoUartFlush(void); +#endif // _UART_QORVO_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c new file mode 100644 index 0000000..2679fda --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2017-2018, 2020-2021, Qorvo Inc + * + * alarm_qorvo.c + * This file contains the implementation of the qorvo alarm api for openthread. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_QVOT + +// #define GP_LOCAL_LOG +#define LOG_PREFIX "[Q] Alarm---------: " + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "gpAssert.h" +#include "gpLog.h" +#include "gpSched.h" + +#include "alarm_qorvo.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define QORVO_ALARM_MILLI_WRAP ((uint32_t)(0xFFFFFFFF / 1000UL)) +#define QORVO_ALARM_KEEP_ALIVE_PERIOD ((uint32_t)QORVO_ALARM_MILLI_WRAP - 10000) // in milliseconds + +#define us_to_ms(x) ((x) / 1000UL) +#define ms_to_us(x) ((x) * 1000UL) +#define ms_to_s(x) ((x) / 1000UL) +#define us_to_s(x) ((x) / 1000000UL) +#define ms_remaining(x) ((x) % 1000UL) +#define us_remaining(x) ((x) % 1000000UL) + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static uint16_t qorvoAlarmWrapCounter; +static uint32_t qorvoAlarmPrev; + +typedef struct TimeSAndUS +{ + uint32_t sec; + uint32_t usec; +} TimeSAndUs_t; + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +static void qorvoAlarmResetWrapCounter(void); +static void qorvoAlarmKeepAlive(void); +static void qorvoAlarmUpdateWrapAround(uint32_t now); +static void qorvoAlarmScheduleKeepAlive(void); +static TimeSAndUs_t qorvoGetSecondsAndMicrosecondsFromMilliseconds(uint32_t milliseconds); +static TimeSAndUs_t qorvoGetSecondsAndMicrosecondsFromMicroseconds(uint32_t microseconds); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +TimeSAndUs_t qorvoGetSecondsAndMicrosecondsFromMilliseconds(uint32_t milliseconds) +{ + TimeSAndUs_t time = {ms_to_s(milliseconds), ms_to_us(ms_remaining(milliseconds))}; + return time; +} + +TimeSAndUs_t qorvoGetSecondsAndMicrosecondsFromMicroseconds(uint32_t microseconds) +{ + TimeSAndUs_t time = {us_to_s(microseconds), us_remaining(microseconds)}; + return time; +} + +void qorvoAlarmScheduleKeepAlive(void) +{ + TimeSAndUs_t time = qorvoGetSecondsAndMicrosecondsFromMilliseconds(QORVO_ALARM_KEEP_ALIVE_PERIOD); + gpSched_UnscheduleEventArg((gpSched_EventCallback_t)qorvoAlarmKeepAlive, NULL); + gpSched_ScheduleEventInSecAndUs(time.sec, time.usec, (gpSched_EventCallback_t)qorvoAlarmKeepAlive, NULL); +} + +void qorvoAlarmResetWrapCounter(void) +{ + qorvoAlarmWrapCounter = 0; + GP_LOG_PRINTF(LOG_PREFIX "QorvoAlarm: internal timer reset. cnt=%u", 0, qorvoAlarmWrapCounter); + + qorvoAlarmPrev = gpSched_GetCurrentTime(); + qorvoAlarmScheduleKeepAlive(); +} + +void qorvoAlarmKeepAlive(void) +{ + GP_LOG_PRINTF(LOG_PREFIX "QorvoAlarm: Keep Alive triggered", 0); + qorvoAlarmGetTimeMs(); +} + +void qorvoAlarmUpdateWrapAround(uint32_t now) +{ + if(now < qorvoAlarmPrev) + { + qorvoAlarmWrapCounter += (qorvoAlarmWrapCounter < 1000 ? 1 : -1000); + GP_LOG_PRINTF(LOG_PREFIX "QorvoAlarm: internal timer wrap. cnt=%u", 0, qorvoAlarmWrapCounter); + GP_ASSERT_DEV_INT(qorvoAlarmWrapCounter <= 1000); + } + qorvoAlarmPrev = now; + + qorvoAlarmScheduleKeepAlive(); +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void qorvoAlarmInit(void) +{ + qorvoAlarmResetWrapCounter(); +} + +uint32_t qorvoAlarmGetTimeMs(void) +{ + uint32_t now = gpSched_GetCurrentTime(); + + qorvoAlarmUpdateWrapAround(now); + return (uint32_t)((uint32_t)us_to_ms(now) + qorvoAlarmWrapCounter * QORVO_ALARM_MILLI_WRAP); +} + +uint32_t qorvoAlarmGetTimeUs(void) +{ + return gpSched_GetCurrentTime(); +} + +void qorvoAlarmMilliStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void* arg) +{ + TimeSAndUs_t time = qorvoGetSecondsAndMicrosecondsFromMilliseconds(rel_time); + GP_LOG_PRINTF(LOG_PREFIX "Start milli timer for %lu ms -> %lu s, %lu us", 0, (unsigned long)rel_time, (unsigned long)time.sec, (unsigned long)time.usec); + gpSched_ScheduleEventInSecAndUs(time.sec, time.usec, (gpSched_EventCallback_t)callback, arg); +} + +void qorvoAlarmMicroStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void* arg) +{ + TimeSAndUs_t time = qorvoGetSecondsAndMicrosecondsFromMicroseconds(rel_time); + GP_LOG_PRINTF(LOG_PREFIX "Start micro timer for %lu us -> %lu s, %lu us", 0, (unsigned long)rel_time, (unsigned long)time.sec, (unsigned long)time.usec); + gpSched_ScheduleEventInSecAndUs(time.sec, time.usec, (gpSched_EventCallback_t)callback, arg); +} + +bool qorvoAlarmStop(qorvoAlarmCallback_t callback, void* arg) +{ + return (bool)gpSched_UnscheduleEventArg((gpSched_EventCallback_t)callback, arg); +} + +/***************************************************************************** + * Public functions for backwards compatibility + *****************************************************************************/ +void qorvoAlarmScheduleEventArg(uint32_t rel_time, qorvoAlarmCallback_t callback, void* arg) +{ + qorvoAlarmMilliStart(rel_time, callback, arg); +} + +bool qorvoAlarmUnScheduleEventArg(qorvoAlarmCallback_t callback, void* arg) +{ + return qorvoAlarmStop(callback, arg); +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c new file mode 100644 index 0000000..217c479 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2017-2021, Qorvo Inc + * + * platform_qorvo.c + * This file contains the implementation of the qorvo platform api for openthread. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_APP + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "platform_qorvo.h" +#include "gpLog.h" +#include "hal.h" +#include "gpSched.h" +#include "gpUtils.h" +#include "gpBaseComps.h" +#if defined(GP_DIVERSITY_JUMPTABLES) +#include "gpJumpTables.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void qorvoPlatMainLoop(bool canGoToSleep) +{ +#ifndef GP_DIVERSITY_FREERTOS + if(canGoToSleep) + { + //printf("sleep\n"); + gpSched_GoToSleep(); + //printf("wake\n"); + } + gpSched_Main_Body(); +#endif //GP_DIVERSITY_FREERTOS +} + +void qorvoPlatInit(qorvoPlatGotoSleepCheckCallback_t gotoSleepCheckCallback) +{ +#ifndef GP_DIVERSITY_FREERTOS + HAL_INITIALIZE_GLOBAL_INT(); + + //Hardware initialisation + HAL_INIT(); + + //Radio interrupts that occur will only be handled later on in the main loop + //Other interrupt source do not trigger any calls to blocks that are not initialized yet + HAL_ENABLE_GLOBAL_INT(); + + //Application_Init(); + gpBaseComps_StackInit(); + GP_UTILS_DUMP_STACK_POINTER(); + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); + + + gpSched_SetGotoSleepCheckCallback((gpSched_GotoSleepCheckCallback_t)gotoSleepCheckCallback); +#endif //GP_DIVERSITY_FREERTOS +#if defined(GP_DIVERSITY_JUMPTABLES) + gpJumpTables_GetRomVersionFromRom(); +#endif // defined(GP_DIVERSITY_JUMPTABLES) +} + +void qorvoPlatRegisterPollFunction(int fd, qorvoPlatPollFunction_t pollFunction) +{ + hal_RegisterPollFunction(fd, (hal_PollFunction_t)pollFunction); +} +void qorvoPlatUnRegisterPollFunction(int fd) +{ + hal_UnRegisterPollFunction(fd); +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c new file mode 100644 index 0000000..9852eef --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c @@ -0,0 +1,971 @@ +/* + * Copyright (c) 2017-2020, Qorvo Inc + * + * radio_qorvo.c + * This file contains the implementation of the qorvo radio api for openthread. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_APP + +// #define GP_LOCAL_LOG +#define LOG_PREFIX "[Q] Radio---------: " + +// #define DEBUG + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "platform_qorvo.h" +#include +#include + +#include "global.h" +#include "radio_qorvo.h" +#include "alarm_qorvo.h" +#include "gpMacDispatcher.h" +#include "gpMacCore_defsDefines.h" +#include "gpLog.h" +#include "gpEncryption.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpPd.h" + +/***************************************************************************** + * Compile Time Verifications + *****************************************************************************/ + +#ifndef GP_SCHED_FREE_CPU_TIME +GP_COMPILE_TIME_VERIFY(GP_SCHED_DEFAULT_GOTOSLEEP_THRES>0); +#endif //GP_SCHED_FREE_CPU_TIME + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +#define QVOT_IS_MAC_2015_FRAME(frameControl) (gpMacCore_MacVersion2015 == (MACCORE_FRAMECONTROL_FRAMEVERSION_GET((frameControl)))) +#define QVOT_IS_ACK_FRAME(frameControl) (gpMacCore_FrameTypeAcknowledge == (MACCORE_FRAMECONTROL_FRAMETYPE_GET((frameControl)))) +#define QVOT_ACKED_WITH_FP(frameControl) (MACCORE_FRAMECONTROL_FRAMEPENDING_GET((frameControl))) +#define QVOT_SECURITY_ENABLED(frameControl) (MACCORE_FRAMECONTROL_SECURITY_GET((frameControl))) +#define QVOT_FRAME_GET_FCTRL(psdu) ((uint16_t)(((psdu)[1] << 8) + (psdu)[0])) +#define QVOT_FRAME_GET_PANID(psdu) ((uint16_t)(((psdu)[4] << 8) + (psdu)[3])) + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +static void gpMacDispatcher_cbDataIndication(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, uint8_t dsn, + gpMacCore_Security_t* pSecOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId); +static void gpMacDispatcher_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, uint32_t unscannedChannels, + UInt8 resultListSize, UInt8* pResultList, gpMacCore_StackId_t stackId); +static void gpMacDispatcher_cbDataConfirm(gpMacCore_Result_t status, uint8_t msduHandle, gpMacCore_StackId_t stackId); + +static void gpMacDispatcher_cbDriverResetIndication(gpMacCore_Result_t status, gpMacCore_StackId_t stackId); + +static void gpMacDispatcher_cbSecurityFrameCounterIndication(uint32_t framecounter, gpMacDispatcher_StackId_t stackId); + +gpMacDispatcher_Callbacks_t mac802154_callbacks = { + gpMacDispatcher_cbDataIndication, + gpMacDispatcher_cbDataConfirm, + NULL, // gpMacDispatcher_cbPollIndication, + NULL, // gpMacDispatcher_cbPollConfirm, + NULL, // gpMacDispatcher_cbPurgeConfirm, + NULL, // gpMacDispatcher_cbBeaconNotifyIndication, + gpMacDispatcher_cbScanConfirm, + NULL, // gpMacDispatcher_cbAssocIndication, + NULL, // gpMacDispatcher_cbAssocConfirm, + NULL, // gpMacDispatcher_cbOrphanIndication_t + NULL, // gpMacDispatcher_cbSecurityFailureCommStatusIndication, + NULL, // gpMacDispatcher_cbAssociateCommStatusIndication_t + NULL, // gpMacDispatcher_cbOrphanCommStatusIndication_t + gpMacDispatcher_cbDriverResetIndication, + NULL, // gpMacDispatcher_cbPollNotify, + gpMacDispatcher_cbSecurityFrameCounterIndication +}; + +static gpMacCore_StackId_t qorvoGetStackId(void); +static void qorvoSetStackId(gpMacCore_StackId_t stackId); +static bool qorvoValidStackId(gpMacCore_StackId_t stackId); +static otError qorvoToThreadError(gpMacCore_Result_t res); +static uint8_t qorvoGetFrameCounterIndex(uint8_t* frame); + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static otRadioFrame sReceiveFrame; + +static uint8_t sTransmitPsdu[OT_RADIO_FRAME_MAX_SIZE]; +static uint8_t sReceivePsdu[OT_RADIO_FRAME_MAX_SIZE]; +static otError sTransmitStatus; +static uint32_t sFrameCounter; +static bool sFrameCounterSet; + +#ifdef QVOT_THREAD_1_2 +#define QVOT_THREAD_1_2_ENABLED 1 +#else +#define QVOT_THREAD_1_2_ENABLED 0 +#endif // QVOT_THREAD_1_2 + +#ifdef QVOT_THREAD_1_2 +static bool qorvoDataConfirmReceived; +static bool qorvoDataIndicationReceived; +#endif // QVOT_THREAD_1_2 + +static uint32_t qorvoTimePreviousValue; +static uint32_t qorvoTimeWrapAroundCounter; + +// Storage of MAC settings changed by OT +static MACAddress_t qorvoOriginalExtendedMac; +static MACAddress_t qorvoRadioExtendedMac; +static uint16_t qorvoRadioPanId; +static uint16_t qorvoRadioShortAddress; +static bool qorvoRadioRxOnWhenIdle; + +static uint8_t qorvoScanResult[1]; +static uint8_t qorvoThreadChannel; + +#define OPENTHREAD_STRING_IDENTIFIER OTHR +static gpMacCore_StackId_t openThreadStackId = GP_MAC_DISPATCHER_INVALID_STACK_ID; + + +/***************************************************************************** + * Public Data Definitions + *****************************************************************************/ + +// Accessed from radio.c OpenThread glue +otRadioFrame sTransmitFrame; + + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +gpMacCore_StackId_t qorvoGetStackId(void) +{ + return openThreadStackId; +} + +void qorvoSetStackId(gpMacCore_StackId_t stackId) +{ + openThreadStackId = stackId; +} + +static bool qorvoValidStackId(gpMacCore_StackId_t stackId) +{ + bool result = true; + if(stackId != qorvoGetStackId()) + { + GP_LOG_SYSTEM_PRINTF(LOG_PREFIX "CRIT: stackId %u != qorvoStackId %u", 0, stackId, qorvoGetStackId()); + GP_ASSERT_DEV_INT(0); + result = false; + } + return result; +} + +otError qorvoToThreadError(gpMacCore_Result_t res) +{ + switch(res) + { + case gpMacCore_ResultSuccess: + { + return OT_ERROR_NONE; + break; + } + case gpMacCore_ResultTransactionOverflow: + { + return OT_ERROR_BUSY; + break; + } + case gpMacCore_ResultInvalidParameter: + { + return OT_ERROR_INVALID_ARGS; + break; + } + case gpMacCore_ResultChannelAccessFailure: + { + return OT_ERROR_CHANNEL_ACCESS_FAILURE; + break; + } + case gpMacCore_ResultNoAck: + { + return OT_ERROR_NO_ACK; + break; + } + default: + { + return OT_ERROR_GENERIC; + break; + } + } +} + +static uint8_t qorvoGetFrameCounterIndex(uint8_t* frame) +{ + uint8_t idx = 4; // FrameControl(2) + SequenceNumber(1) + SecurityHeader(1) + + uint16_t frameControl = QVOT_FRAME_GET_FCTRL(frame); + + // if there is a panid it is in bytes 3 and 4 + // we ignore the possibility of a second panid here + if(QVOT_FRAME_GET_PANID(frame) == qorvoRadioPanId) + { + idx += 2; + } + + if (MACCORE_FRAMECONTROL_DSTADDRMODE_GET(frameControl) == gpMacCore_AddressModeShortAddress) + { + idx += 2; + } + else if (MACCORE_FRAMECONTROL_DSTADDRMODE_GET(frameControl) == gpMacCore_AddressModeExtendedAddress) + { + idx += 8; + } + + if (MACCORE_FRAMECONTROL_SRCADDRMODE_GET(frameControl) == gpMacCore_AddressModeShortAddress) + { + idx += 2; + } + else if (MACCORE_FRAMECONTROL_SRCADDRMODE_GET(frameControl) == gpMacCore_AddressModeExtendedAddress) + { + idx += 8; + } + return idx; +} + + + +/***************************************************************************** + * gpMacDispatcher callbacks + *****************************************************************************/ + +void gpMacDispatcher_cbDataIndication(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, uint8_t dsn, + gpMacCore_Security_t* pSecOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId) +{ + // Note: the cbDataIndication is used for reporting + // * Received data/command frames + // * Received Enhanced Acks + + NOT_USED(pSecOptions); + NOT_USED(pSrcAddrInfo); + NOT_USED(pDstAddrInfo); + NOT_USED(dsn); + + if(!qorvoValidStackId(stackId)) + { + return; + } + + // Copy packet into OT structure + gpPd_ReadByteStream(pdLoh.handle, pdLoh.offset, pdLoh.length, &sReceiveFrame.mPsdu[0]); + + // Frame Control bytes of the received frame + uint16_t fctrlPsdu = (sReceiveFrame.mPsdu[1] << 8) + sReceiveFrame.mPsdu[0]; + + sReceiveFrame.mPsdu[pdLoh.length] = 0x00; // dummy crc byte + sReceiveFrame.mPsdu[pdLoh.length + 1] = 0x00; // dummy crc byte + sReceiveFrame.mLength = pdLoh.length + 2; + sReceiveFrame.mChannel = gpPd_GetRxChannel(pdLoh.handle); + sReceiveFrame.mInfo.mRxInfo.mRssi = gpPd_GetRssi(pdLoh.handle); + sReceiveFrame.mInfo.mRxInfo.mLqi = gpPd_GetLqi(pdLoh.handle); +#ifdef QVOT_THREAD_1_2 + UInt32 rxTs = gpPd_GetRxTimestamp(pdLoh.handle); + sReceiveFrame.mInfo.mRxInfo.mTimestamp = + (uint64_t)rxTs + ((uint64_t)(qorvoTimeWrapAroundCounter + ((rxTs < qorvoTimePreviousValue ? 1 : 0))) << 32); +#else + sReceiveFrame.mInfo.mRxInfo.mTimestamp = (uint64_t)gpPd_GetRxTimestamp(pdLoh.handle); +#endif // QVOT_THREAD_1_2 + +#ifdef QVOT_THREAD_1_2 + uint16_t fctrlAck = 0; +#endif // QVOT_THREAD_1_2 + + if(!QVOT_IS_ACK_FRAME(fctrlPsdu)) + { +#ifdef QVOT_THREAD_1_2 + // Frame Control bytes of the transmitted Ack frame (in response the received pdLoh) + fctrlAck = gpPd_GetFrameControlFromTxAckAfterRx(pdLoh.handle); + + sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending = QVOT_ACKED_WITH_FP(fctrlAck); + sReceiveFrame.mInfo.mRxInfo.mAckedWithSecEnhAck = QVOT_SECURITY_ENABLED(fctrlAck); + sReceiveFrame.mInfo.mRxInfo.mAckFrameCounter = gpPd_GetFrameCounterFromTxAckAfterRx(pdLoh.handle); +#else + sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending = true; + sReceiveFrame.mInfo.mRxInfo.mAckedWithSecEnhAck = false; +#endif // QVOT_THREAD_1_2 + } + + gpPd_FreePd(pdLoh.handle); + + GP_LOG_PRINTF(LOG_PREFIX "cbDataInd: sn:%u ch:%u t:%u fp:%u secAck:%u ts: %llu", 0, + sReceiveFrame.mPsdu[2], + sReceiveFrame.mChannel, + MACCORE_FRAMECONTROL_FRAMETYPE_GET(fctrlPsdu), +#ifdef QVOT_THREAD_1_2 + QVOT_ACKED_WITH_FP((!QVOT_IS_ACK_FRAME(fctrlPsdu)) ? fctrlAck : fctrlPsdu), +#else + false, +#endif // QVOT_THREAD_1_2 + sReceiveFrame.mInfo.mRxInfo.mAckedWithSecEnhAck, + sReceiveFrame.mInfo.mRxInfo.mTimestamp); + +#ifdef QVOT_THREAD_1_2 + bool isEnhancedAckFrame = (QVOT_IS_MAC_2015_FRAME(fctrlPsdu) && QVOT_IS_ACK_FRAME(fctrlPsdu)); + + + if(isEnhancedAckFrame) + { + if(qorvoDataConfirmReceived) + { + cbQorvoRadioTransmitDone_AckFrame(&sTransmitFrame, &sReceiveFrame, sTransmitStatus); + qorvoDataIndicationReceived = false; + qorvoDataConfirmReceived = false; + } + else + { + qorvoDataIndicationReceived = true; + qorvoDataConfirmReceived = false; + } + } + else +#endif // QVOT_THREAD_1_2 + { + cbQorvoRadioReceiveDone(&sReceiveFrame, OT_ERROR_NONE); + } +} + +void gpMacDispatcher_cbDataConfirm(gpMacCore_Result_t status, uint8_t msduHandle, gpMacCore_StackId_t stackId) +{ + if(!qorvoValidStackId(stackId)) + { + return; + } + + // We reuse the value from the DataRequest, which is already written + // in @sTransmitFrame + + sTransmitStatus = qorvoToThreadError(status); + + // Copy the transmitted frame from the Pd to the sTransmitFrame + // But the length of the transmitted frame was already stored in the sTransmitFrame + // when receiving the transmit request + gpPd_ReadByteStream(msduHandle, 0, sTransmitFrame.mLength, sTransmitFrame.mPsdu); + + uint16_t fctrl = QVOT_FRAME_GET_FCTRL(sTransmitFrame.mPsdu); + + if(!sTransmitFrame.mInfo.mTxInfo.mIsHeaderUpdated) + { + // if mIsHeaderUpdated was already `1`, then OpenThread handled the frameCounter and IEs already + // We don't need to update frameCounter nor this flag + + if(sFrameCounterSet) + { + // The frame counter as written by RT is not in the gpPd. We can only extract + // it through cbSecurityFrameCounterIndication (which set @sFrameCounterSet). + // sTransmitFrame still needs to be updated + uint8_t fc_idx = qorvoGetFrameCounterIndex(sTransmitFrame.mPsdu); + MEMCPY(&sTransmitFrame.mPsdu[fc_idx], &sFrameCounter, sizeof(sFrameCounter)); + sFrameCounterSet = false; + sTransmitFrame.mInfo.mTxInfo.mIsHeaderUpdated = true; + } + if(MACCORE_FRAMECONTROL_IE_PRESENT_GET(fctrl)) + { + // IEs are present, but not set by OpenThread, so we updated the Header + sTransmitFrame.mInfo.mTxInfo.mIsHeaderUpdated = true; + } + } + + GP_LOG_PRINTF(LOG_PREFIX "cbDataCfm: sn:%u res:%x l:%u ch:%u rtx: %u", 0, + gpPd_ReadByte(msduHandle, 2), + status, + sTransmitFrame.mLength, + sTransmitFrame.mChannel, + gpPd_GetTxRetryCntr(msduHandle)); + +#ifdef QVOT_THREAD_1_2 + if (QVOT_IS_MAC_2015_FRAME(fctrl)) + { + if(qorvoDataIndicationReceived) + { + cbQorvoRadioTransmitDone_AckFrame(&sTransmitFrame, &sReceiveFrame, sTransmitStatus); + qorvoDataConfirmReceived = false; + qorvoDataIndicationReceived = false; + } + else if(status != gpMacCore_ResultSuccess) + { + // Transmission failed, we don't expect the ack anymore + cbQorvoRadioTransmitDone_AckFrame(&sTransmitFrame, &sReceiveFrame, sTransmitStatus); + qorvoDataConfirmReceived = false; + qorvoDataIndicationReceived = false; + } + else + { + qorvoDataConfirmReceived = true; + qorvoDataIndicationReceived = false; + } + } + else +#endif // QVOT_THREAD_1_2 + { + bool aFramePending = true; + uint8_t fp; + + fp = gpPd_GetFramePendingAfterTx(msduHandle); + /* use the fp value unless it's invalid (0xff), then use 'true' */ + aFramePending = (fp == 0xff) ? true : (fp == 1); + + cbQorvoRadioTransmitDone(&sTransmitFrame, aFramePending, sTransmitStatus); + } + gpPd_FreePd(msduHandle); +} + +void gpMacDispatcher_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, uint32_t unscannedChannels, + uint8_t resultListSize, uint8_t* pResultList, gpMacCore_StackId_t stackId) +{ + NOT_USED(status); + NOT_USED(scanType); + NOT_USED(unscannedChannels); + NOT_USED(resultListSize); + NOT_USED(pResultList); + + if(!qorvoValidStackId(stackId)) + { + return; + } + + int8_t aEnergyScanMaxRssi = ((uint8_t*)pResultList)[0]; + + cbQorvoRadioEnergyScanDone(aEnergyScanMaxRssi); +} + +void gpMacDispatcher_cbDriverResetIndication(gpMacCore_Result_t status, gpMacCore_StackId_t stackId) +{ + NOT_USED(status); + + if(!qorvoValidStackId(stackId)) + { + return; + } + + gpMacDispatcher_StringIdentifier_t openThreadStringId = {{XSTRINGIFY(OPENTHREAD_STRING_IDENTIFIER)}}; + + //register NWK layer to MAC layer + qorvoSetStackId(gpMacDispatcher_RegisterNetworkStack(&openThreadStringId)); + gpMacDispatcher_RegisterCallbacks(qorvoGetStackId(), &mac802154_callbacks); + + qorvoRadioReset(); + gpMacDispatcher_SetRxOnWhenIdle(qorvoRadioRxOnWhenIdle, qorvoGetStackId()); + gpMacDispatcher_SetExtendedAddress(&qorvoRadioExtendedMac, qorvoGetStackId()); + gpMacDispatcher_SetShortAddress(qorvoRadioShortAddress, qorvoGetStackId()); + gpMacDispatcher_SetPanId(qorvoRadioPanId, qorvoGetStackId()); +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void qorvoRadioReset(void) +{ + gpMacDispatcher_Reset(true, qorvoGetStackId()); + gpMacDispatcher_SetDataPendingMode(gpMacCore_DataPendingModeMac802154, qorvoGetStackId()); + + GP_LOG_PRINTF(LOG_PREFIX "otst=%d bl=%x", 0, qorvoGetStackId(), 0xFF); + gpMacDispatcher_SetStackInRawMode(1, qorvoGetStackId()); + + gpMacDispatcher_SetRetransmitOnCcaFail(QVOT_THREAD_1_2_ENABLED, qorvoGetStackId()); + gpMacDispatcher_SetRetransmitRandomBackoff(QVOT_THREAD_1_2_ENABLED, qorvoGetStackId()); + gpMacDispatcher_EnableEnhancedFramePending(QVOT_THREAD_1_2_ENABLED, qorvoGetStackId()); + + gpMacDispatcher_SetTransactionPersistenceTime(0, qorvoGetStackId()); + gpMacDispatcher_SetMacVersion(gpMacCore_MacVersion2006, qorvoGetStackId()); + +#ifdef QVOT_THREAD_1_2 + qorvoTimePreviousValue = gpMacDispatcher_GetCurrentTimeUs(); + qorvoTimeWrapAroundCounter = 0; +#endif // QVOT_THREAD_1_2 + qorvoThreadChannel = GP_MACCORE_INVALID_CHANNEL; + +} + +void qorvoRadioInit(void) +{ + gpMacDispatcher_StringIdentifier_t openThreadStringId = {{XSTRINGIFY(OPENTHREAD_STRING_IDENTIFIER)}}; + + sTransmitFrame.mLength = 0; + sTransmitFrame.mPsdu = sTransmitPsdu; + sReceiveFrame.mLength = 0; + sReceiveFrame.mPsdu = sReceivePsdu; + + //register NWK layer to MAC layer + qorvoSetStackId(gpMacDispatcher_RegisterNetworkStack(&openThreadStringId)); + gpMacDispatcher_RegisterCallbacks(qorvoGetStackId(), &mac802154_callbacks); + + qorvoRadioReset(); + + // Save initial IEEE MAC address + gpMacDispatcher_GetExtendedAddress(&qorvoOriginalExtendedMac, qorvoGetStackId()); + MEMCPY(&qorvoRadioExtendedMac, &qorvoOriginalExtendedMac, sizeof(MACAddress_t)); + qorvoRadioShortAddress = GP_MACCORE_SHORT_ADDR_UNALLOCATED; + qorvoRadioPanId = GP_MACCORE_SHORT_ADDR_UNALLOCATED; + + // Set sleep behavior + gpSched_SetGotoSleepEnable(true); + +} + +otError qorvoRadioTransmit(otRadioFrame* aFrame) +{ + uint8_t offset = 0; + gpPd_Loh_t pdLoh; + gpMacCore_Security_t secOptions; + gpMacCore_MultiChannelOptions_t multiChannelOptions; + gpMacCore_AddressMode_t srcAddrMode; + gpMacCore_AddressInfo_t dstAddrInfo; + uint8_t txOptions = GP_MACCORE_TX_OPT_NONE; + + pdLoh.handle = gpPd_GetPd(); + if(pdLoh.handle == GP_PD_INVALID_HANDLE) + { + GP_LOG_SYSTEM_PRINTF(LOG_PREFIX "WARN: no more pd handles!", 0); + return OT_ERROR_NO_BUFS; + } + + pdLoh.length = aFrame->mLength - offset; + pdLoh.length -= 2; // drop the 2 crc bytes + + pdLoh.offset = 0; + gpPd_WriteByteStream(pdLoh.handle, pdLoh.offset, pdLoh.length, aFrame->mPsdu + offset); + + if (aFrame->mChannel < 11 || aFrame->mChannel > 26) + { + GP_ASSERT_DEV_INT(aFrame->mChannel >= 11); + GP_ASSERT_DEV_INT(aFrame->mChannel <= 26); + return OT_ERROR_INVALID_ARGS; + } + multiChannelOptions.channel[0] = aFrame->mChannel; + multiChannelOptions.channel[1] = GP_MACCORE_INVALID_CHANNEL; + multiChannelOptions.channel[2] = GP_MACCORE_INVALID_CHANNEL; + + MEMSET(&secOptions, 0, sizeof(gpMacCore_Security_t)); + + uint16_t fctrl = QVOT_FRAME_GET_FCTRL(aFrame->mPsdu); + srcAddrMode = MACCORE_FRAMECONTROL_SRCADDRMODE_GET(fctrl); + dstAddrInfo.addressMode = MACCORE_FRAMECONTROL_DSTADDRMODE_GET(fctrl); + + // Handle mIsSecurityProcessed + if(QVOT_SECURITY_ENABLED(fctrl) && !aFrame->mInfo.mTxInfo.mIsSecurityProcessed) + { + secOptions.securityLevel = gpEncryption_SecLevelENC_MIC32; + } + else + { + // No absolute need to set it, the memset took care or this, but it's clearer + secOptions.securityLevel = gpEncryption_SecLevelNothing; + } + + // Set the Raw option for the frame + txOptions |= GP_MACCORE_TX_OPT_RAW; + + gpMacDispatcher_SetNumberOfRetries(aFrame->mInfo.mTxInfo.mMaxFrameRetries, qorvoGetStackId()); + + { + gpMacDispatcher_SetMaxCsmaBackoffs(aFrame->mInfo.mTxInfo.mMaxCsmaBackoffs, qorvoGetStackId()); + } + + GP_LOG_PRINTF(LOG_PREFIX "DataReq: sn:%u fctrl:%04x l:%u csma:%u csl:%u sec:%u|%u hdrU:%u retr:%u bT:%lu dt:%lu", 0, + aFrame->mPsdu[2], + fctrl, + aFrame->mLength, + aFrame->mInfo.mTxInfo.mCsmaCaEnabled, + aFrame->mInfo.mTxInfo.mCslPresent, + aFrame->mInfo.mTxInfo.mIsSecurityProcessed, + QVOT_SECURITY_ENABLED(fctrl), + aFrame->mInfo.mTxInfo.mIsHeaderUpdated, + aFrame->mInfo.mTxInfo.mMaxFrameRetries, + (unsigned long)aFrame->mInfo.mTxInfo.mTxDelayBaseTime, + (unsigned long)aFrame->mInfo.mTxInfo.mTxDelay); + + // Handle mIsHeaderUpdated + if(aFrame->mInfo.mTxInfo.mIsHeaderUpdated) + { + // OpenThread has set the CSL IEs and/or FrameCounter, + // MacCore/RT should not update those anymore + txOptions |= GP_MACCORE_TX_OPT_RAW_KEEP_FRAMECOUNTER; + } + + // Reset FrameCounter, will be set by the cbFrameCounterIndication + sFrameCounterSet = false; + + gpMacDispatcher_DataRequest(srcAddrMode, &dstAddrInfo, txOptions, &secOptions, multiChannelOptions, pdLoh, qorvoGetStackId()); + + + sTransmitFrame.mLength = aFrame->mLength; + return OT_ERROR_NONE; +} + +void gpMacDispatcher_cbSecurityFrameCounterIndication(uint32_t frameCounter, gpMacDispatcher_StackId_t stackId) +{ + if(!qorvoValidStackId(stackId)) + { + return; + } + sFrameCounter = frameCounter; + sFrameCounterSet = true; +} + +void qorvoRadioProcess(void) +{ +} + +void qorvoRadioGetIeeeEui64(uint8_t* aIeeeEui64) +{ + for(uint8_t i = 0; i < OT_EXT_ADDRESS_SIZE; i++) + { + aIeeeEui64[i] = ((uint8_t*)(&qorvoOriginalExtendedMac))[7 - i]; + } + GP_LOG_PRINTF(LOG_PREFIX "otPlatRadioGetIeeeEui64 = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", 0, + aIeeeEui64[0], aIeeeEui64[1], aIeeeEui64[2], aIeeeEui64[3], + aIeeeEui64[4], aIeeeEui64[5], aIeeeEui64[6], aIeeeEui64[7]); +} + +void qorvoRadioSetCurrentChannel(uint8_t channel) +{ + if (qorvoThreadChannel == GP_MACCORE_INVALID_CHANNEL) + { + // No Thread channel known, accept channel + GP_LOG_PRINTF(LOG_PREFIX "initiate channel to %u", 0, channel); + gpMacDispatcher_SetCurrentChannel(channel, qorvoGetStackId()); + qorvoThreadChannel = channel; + } + else if (qorvoThreadChannel != gpMacDispatcher_GetCurrentChannel(qorvoGetStackId())) + { + // We assume CSL is ongoing, so we store the new channel, but do not switch + qorvoThreadChannel = channel; + GP_LOG_PRINTF(LOG_PREFIX "update thread channel to %u, working on csl channel %u", 0, channel, gpMacDispatcher_GetCurrentChannel(qorvoGetStackId())); + } + else if (qorvoThreadChannel != channel) + { + GP_LOG_PRINTF(LOG_PREFIX "update channel to %u", 0, channel); + gpMacDispatcher_SetCurrentChannel(channel, qorvoGetStackId()); + qorvoThreadChannel = channel; + } + else + { + // Channel doesn't change + } +} + +void qorvoRadioSetRxOnWhenIdle(bool rxOnWhenIdle) +{ + qorvoRadioRxOnWhenIdle = rxOnWhenIdle; + // GP_LOG_PRINTF(LOG_PREFIX "RxOnWhenIdle: %u", 0, rxOnWhenIdle); + gpMacDispatcher_SetRxOnWhenIdle(rxOnWhenIdle, qorvoGetStackId()); +} + +void qorvoRadioSetPanId(uint16_t panid) +{ + GP_LOG_PRINTF(LOG_PREFIX "SetPanId: 0x%04x", 0, panid); + qorvoRadioPanId = panid; + gpMacDispatcher_SetPanId(panid, qorvoGetStackId()); +} + +void qorvoRadioSetExtendedAddress(const uint8_t* address) +{ + MEMCPY(&qorvoRadioExtendedMac, address, sizeof(MACAddress_t)); + GP_LOG_PRINTF(LOG_PREFIX "SetExtendedAddress: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", 0, + address[0], address[1], address[2], address[3], + address[4], address[5], address[6], address[7]); + gpMacDispatcher_SetExtendedAddress(&qorvoRadioExtendedMac, qorvoGetStackId()); +} + +void qorvoRadioSetShortAddress(uint16_t address) +{ + GP_LOG_PRINTF(LOG_PREFIX "SetShortAddress: 0x%04x", 0, address); + qorvoRadioShortAddress = address; + gpMacDispatcher_SetShortAddress(address, qorvoGetStackId()); +} + +void qorvoRadioEnableSrcMatch(bool aEnable) +{ + // We are already in gpMacCore_DataPendingModeMac802154, no need to change it +} + +otError qorvoRadioAddSrcMatchShortEntry(const uint16_t aShortAddress, uint16_t panid) +{ + gpMacCore_Result_t res = gpMacCore_ResultSuccess; + gpMacCore_AddressInfo_t addrInfo; + + addrInfo.addressMode = gpMacCore_AddressModeShortAddress; + addrInfo.panId = panid; + addrInfo.address.Short = aShortAddress; + + res = gpMacDispatcher_DataPending_QueueAdd(&addrInfo, qorvoGetStackId()); + GP_LOG_PRINTF(LOG_PREFIX "Add SrcMatchEntry (res: %u): panid: %04x, addr: %04x", 0, + res, panid, aShortAddress); + return qorvoToThreadError(res); +} + +otError qorvoRadioAddSrcMatchExtEntry(const uint8_t* aExtAddress, uint16_t panid) +{ + gpMacCore_Result_t res = gpMacCore_ResultSuccess; + gpMacCore_AddressInfo_t addrInfo; + + addrInfo.addressMode = gpMacCore_AddressModeExtendedAddress; + addrInfo.panId = panid; + MEMCPY(&addrInfo.address.Extended, aExtAddress, sizeof(MACAddress_t)); + + res = gpMacDispatcher_DataPending_QueueAdd(&addrInfo, qorvoGetStackId()); + GP_LOG_PRINTF(LOG_PREFIX "Add SrcMatchEntry (res: %u): panid: %04x, addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", 0, + res, panid, + aExtAddress[0], aExtAddress[1], aExtAddress[2], aExtAddress[3], + aExtAddress[4], aExtAddress[5], aExtAddress[6], aExtAddress[7]); + return qorvoToThreadError(res); +} + +otError qorvoRadioClearSrcMatchShortEntry(const uint16_t aShortAddress, uint16_t panid) +{ + gpMacCore_Result_t res = gpMacCore_ResultSuccess; + gpMacCore_AddressInfo_t addrInfo; + + addrInfo.addressMode = gpMacCore_AddressModeShortAddress; + addrInfo.panId = panid; + addrInfo.address.Short = aShortAddress; + + res = gpMacDispatcher_DataPending_QueueRemove(&addrInfo, qorvoGetStackId()); + GP_LOG_PRINTF(LOG_PREFIX "Del SrcMatchEntry (res: %u): panid: %04x, addr: %04x", 0, + res, panid, aShortAddress); + return qorvoToThreadError(res); +} + +otError qorvoRadioClearSrcMatchExtEntry(const uint8_t* aExtAddress, uint16_t panid) +{ + gpMacCore_Result_t res = gpMacCore_ResultSuccess; + gpMacCore_AddressInfo_t addrInfo; + + addrInfo.addressMode = gpMacCore_AddressModeExtendedAddress; + addrInfo.panId = panid; + MEMCPY(&addrInfo.address.Extended, aExtAddress, sizeof(MACAddress_t)); + + res = gpMacDispatcher_DataPending_QueueRemove(&addrInfo, qorvoGetStackId()); + GP_LOG_PRINTF(LOG_PREFIX "Del SrcMatchEntry (res: %u): panid: %04x, addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", 0, + res, panid, + aExtAddress[0], aExtAddress[1], aExtAddress[2], aExtAddress[3], + aExtAddress[4], aExtAddress[5], aExtAddress[6], aExtAddress[7]); + return qorvoToThreadError(res); +} + +void qorvoRadioClearSrcMatchEntries(void) +{ + /* clear both short and extended addresses here */ + GP_LOG_PRINTF(LOG_PREFIX "Clear all SrcMatchEntries", 0); + gpMacDispatcher_DataPending_QueueClear(qorvoGetStackId()); +} + +otError qorvoRadioGetTransmitPower(int8_t* aPower) +{ + uint8_t channel = gpMacDispatcher_GetCurrentChannel(qorvoGetStackId()); + if(channel == GP_MACCORE_INVALID_CHANNEL) + { + return OT_ERROR_INVALID_STATE; + } + *aPower = gpMacDispatcher_GetTransmitPower(qorvoGetStackId()); + return OT_ERROR_NONE; +} + +otError qorvoRadioSetTransmitPower(int8_t aPower) +{ + uint8_t channel = gpMacDispatcher_GetCurrentChannel(qorvoGetStackId()); + if(channel == GP_MACCORE_INVALID_CHANNEL) + { + return OT_ERROR_INVALID_STATE; + } + gpMacDispatcher_SetTransmitPower(aPower, qorvoGetStackId()); + return OT_ERROR_NONE; +} + +otError qorvoRadioEnergyScan(uint8_t aScanChannel, uint16_t aScanDuration) +{ + uint32_t scanChannels = 1 << aScanChannel; + uint8_t scanDuration = 0; + uint32_t durationInUs = (((uint32_t)GP_MACCORE_BASE_SUPERFRAME_DURATION * ((uint32_t)(((uint16_t)1) << scanDuration) + 1)) * GP_MACCORE_SYMBOL_DURATION); + uint8_t resultListSize = 1; + uint8_t* pResultList = qorvoScanResult; + + GP_ASSERT_DEV_INT(scanDuration < 16); + + while((durationInUs < ((uint32_t)aScanDuration * 1000)) && (scanDuration < 15)) + { + scanDuration++; + durationInUs = (((uint32_t)GP_MACCORE_BASE_SUPERFRAME_DURATION * ((uint32_t)(((uint16_t)1) << scanDuration) + 1)) * GP_MACCORE_SYMBOL_DURATION); + } + + gpMacDispatcher_ScanRequest(gpMacCore_ScanTypeED, scanChannels, scanDuration, resultListSize, pResultList, qorvoGetStackId()); + + return OT_ERROR_NONE; +} + +bool qorvoRadioGetPromiscuous(void) +{ + return gpMacDispatcher_GetPromiscuousMode(qorvoGetStackId()); +} + +void qorvoRadioSetPromiscuous(bool aEnable) +{ + gpMacDispatcher_SetPromiscuousMode(aEnable, qorvoGetStackId()); +} + +void qorvoRadioSetMacKey(uint8_t aKeyIdMode, + uint8_t aKeyId, + const uint8_t *aPrevKey, + const uint8_t *aCurrKey, + const uint8_t *aNextKey, + uint8_t aKeyType) +{ + NOT_USED(aPrevKey); + NOT_USED(aNextKey); + NOT_USED(aKeyIdMode); + NOT_USED(aKeyId); + NOT_USED(aCurrKey); + NOT_USED(aKeyType); +} + +uint64_t qorvoRadioGetNow(void) +{ + uint32_t newValue = gpMacDispatcher_GetCurrentTimeUs(); + if (newValue < qorvoTimePreviousValue) + { + qorvoTimeWrapAroundCounter++; + } + qorvoTimePreviousValue = newValue; + uint64_t time = ((uint64_t)qorvoTimeWrapAroundCounter << 32) + newValue; + GP_LOG_PRINTF(LOG_PREFIX "qorvoRadioGetNow: %llu", 0, time); + return time; +} + +otError qorvoRadioReceiveAt(uint8_t aChannel, uint32_t aStart, uint32_t aDuration) +{ + NOT_USED(aChannel); + NOT_USED(aStart); + NOT_USED(aDuration); + GP_LOG_PRINTF(LOG_PREFIX "RxWindows not implemented", 0); + return OT_ERROR_NOT_IMPLEMENTED; +} + + +void qorvoRadioSetMacFrameCounter(uint32_t aMacFrameCounter) +{ + NOT_USED(aMacFrameCounter); +} + +otError qorvoRadioEnableCsl(uint32_t aCslPeriod, + uint16_t aShortAddr, + const uint8_t *aExtAddr) +{ + NOT_USED(aShortAddr); + NOT_USED(aExtAddr); + NOT_USED(aCslPeriod); + return OT_ERROR_NOT_IMPLEMENTED; +} + +void qorvoRadioUpdateCslSampleTime(uint32_t aCslSampleTime) +{ + NOT_USED(aCslSampleTime); +} + +otError qorvoRadioConfigureEnhAckProbing(otLinkMetrics aLinkMetrics, + uint16_t aShortAddress, + const uint8_t *aExtAddress) +{ +#ifndef QVOT_THREAD_1_2 + NOT_USED(aLinkMetrics); + NOT_USED(aShortAddress); + NOT_USED(aExtAddress); + return OT_ERROR_NOT_IMPLEMENTED; +#else + if (aExtAddress == NULL) + { + GP_LOG_PRINTF(LOG_PREFIX "WARN: Invalid extended address", 0); + return OT_ERROR_INVALID_ARGS; + } + + gpMacCore_Result_t res; + + MACAddress_t extendedAddress; + MEMCPY(&extendedAddress, aExtAddress, sizeof(MACAddress_t)); + + uint8_t link_metrics = 0; + if(aLinkMetrics.mPduCount) + { + BIT_SET(link_metrics, 0); + } + if(aLinkMetrics.mLqi) + { + BIT_SET(link_metrics, 1); + } + if(aLinkMetrics.mLinkMargin) + { + BIT_SET(link_metrics, 2); + } + if(aLinkMetrics.mRssi) + { + BIT_SET(link_metrics, 3); + } + + res = gpMacDispatcher_ConfigureEnhAckProbing(link_metrics, &extendedAddress, (uint16_t)aShortAddress, qorvoGetStackId()); +#ifdef GP_LOCAL_LOG + uint8_t* a = (uint8_t*)aExtAddress; + if (res == gpMacCore_ResultSuccess) + { + GP_LOG_PRINTF(LOG_PREFIX "link metrics %02x configuration for 0x%04x | %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x succeeded", 0, + link_metrics, aShortAddress, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]); + } + else + { + GP_LOG_PRINTF(LOG_PREFIX "link metrics %02x configuration for 0x%04x | %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x failed: 0x%02x", 0, + link_metrics, aShortAddress, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], res); + } +#endif // GP_LOCAL_LOG + return qorvoToThreadError(res); +#endif // QVOT_THREAD_1_2 +} + +otRadioCaps qorvoRadioGetCaps(void) +{ + otRadioCaps caps = OT_RADIO_CAPS_NONE; ///< Radio supports no capability. + caps |= OT_RADIO_CAPS_ACK_TIMEOUT; ///< Radio supports AckTime event. + caps |= OT_RADIO_CAPS_TRANSMIT_RETRIES; ///< Radio supports tx retry logic with collision avoidance (CSMA). + caps |= OT_RADIO_CAPS_CSMA_BACKOFF; ///< Radio supports CSMA backoff for frame transmission (but no retry). + caps |= OT_RADIO_CAPS_ENERGY_SCAN; ///< Radio supports Energy Scans. + + return caps; +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c new file mode 100644 index 0000000..26b77cb --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * uart_rpi_qorvo.c + * This file contains the implementation of the qorvo uart api for openthread. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_QVOT + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "platform_qorvo.h" +#include "uart_qorvo.h" +#include "gpLog.h" +#include "hal.h" + +#include +#include +#include + +#include +#include + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void qorvoUartLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list args) +{ + NOT_USED(aLogLevel); + NOT_USED(aLogRegion); + + char logString[512]; + + vsnprintf(&logString[0], sizeof(logString), aFormat, args); + + GP_LOG_SYSTEM_PRINTF("%s", 0, logString); + gpLog_Flush(); +} + +void myPlatLog(const char *aFormat, ...) +{ + va_list args; + + va_start(args, aFormat); + qorvoUartLog(OT_LOG_LEVEL_CRIT, OT_LOG_REGION_PLATFORM, aFormat, args); + va_end(args); +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen/gpMacCore_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen/gpMacCore_marshalling.h new file mode 100644 index 0000000..542ce82 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen/gpMacCore_marshalling.h @@ -0,0 +1,2610 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPMACCORE_MARSHALLING_H_ +#define _GPMACCORE_MARSHALLING_H_ + +//DOCUMENTATION MACCORE: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpMacCore.h" +/* AdditionalIncludes */ +#include "gpPd_marshalling.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpMacCore_DeviceDescriptor_t data[1]; +} gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeyUsageDescriptor_t data[1]; +} gpMacCore_KeyUsageDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeyDeviceDescriptor_t data[1]; +} gpMacCore_KeyDeviceDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_Security_t data[1]; +} gpMacCore_Security_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_AddressInfo_t data[1]; +} gpMacCore_AddressInfo_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_PanDescriptor_t data[1]; +} gpMacCore_PanDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeyIdLookupDescriptor_t data[1]; +} gpMacCore_KeyIdLookupDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeyDescriptor_t data[1]; +} gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_SecurityLevelDescriptor_t data[1]; +} gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_MultiChannelOptions_t data[1]; +} gpMacCore_MultiChannelOptions_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_TxTimingOptions_t data[1]; +} gpMacCore_TxTimingOptions_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_DiagRxCntr_t data[1]; +} gpMacCore_DiagRxCntr_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_DiagTxCntr_t data[1]; +} gpMacCore_DiagTxCntr_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_Address_t data[1]; +} gpMacCore_Address_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeySource_t data[1]; +} gpMacCore_KeySource_t_l1_pointer_marshall_t; + + +typedef union { + UInt16 Short; + MACAddress_t Extended; +} gpMacCore_Address_t_marshall_t; + +typedef union { + UInt8 pKeySource4; + UInt8 pKeySource8; +} gpMacCore_KeySource_t_marshall_t; + +typedef struct { + Bool setDefaultPib; + gpMacCore_StackId_t stackId; +} gpMacCore_Reset_Input_struct_t; + +typedef struct { + gpMacCore_Reset_Input_struct_t data; +} gpMacCore_Reset_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_Reset_Output_struct_t; + +typedef struct { + gpMacCore_Reset_Output_struct_t data; +} gpMacCore_Reset_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressMode_t srcAddrMode; + gpMacCore_AddressInfo_t* pDstAddressInfo; + UInt8 txOptions; + gpMacCore_Security_t* pSecOptions; + gpMacCore_MultiChannelOptions_t multiChannelOptions; + gpPd_Loh_t pdLoh; + gpMacCore_StackId_t stackId; +} gpMacCore_DataRequest_Input_struct_t; + +typedef struct { + gpMacCore_DataRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; + gpMacCore_MultiChannelOptions_t_l1_pointer_marshall_t multiChannelOptions; + gpPd_Loh_t_l1_pointer_marshall_t pdLoh; +} gpMacCore_DataRequest_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_ScanType_t scanType; + UInt32 scanChannels; + UInt8 scanDuration; + UInt8 resultListSize; + UInt8* pEdScanResultList; + gpMacCore_StackId_t stackId; +} gpMacCore_ScanRequest_Input_struct_t; + +typedef struct { + gpMacCore_ScanRequest_Input_struct_t data; +} gpMacCore_ScanRequest_Input_marshall_struct_t; + + +typedef struct { + UInt8 logicalChannel; + gpMacCore_AddressInfo_t* coordAddrInfo; + UInt8 capabilityInformation; + gpMacCore_StackId_t stackId; +} gpMacCore_AssociateRequest_Input_struct_t; + +typedef struct { + gpMacCore_AssociateRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; +} gpMacCore_AssociateRequest_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pDeviceAddress; + UInt16 associateShortAddress; + gpMacCore_Result_t status; + gpMacCore_StackId_t stackId; +} gpMacCore_AssociateResponse_Input_struct_t; + +typedef struct { + gpMacCore_AssociateResponse_Input_struct_t data; + MACAddress_t pDeviceAddress[1]; +} gpMacCore_AssociateResponse_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* coordAddrInfo; + gpMacCore_Security_t* pSecOptions; + gpMacCore_StackId_t stackId; +} gpMacCore_PollRequest_Input_struct_t; + +typedef struct { + gpMacCore_PollRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; +} gpMacCore_PollRequest_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_PanId_t panId; + UInt8 logicalChannel; + Bool panCoordinator; + gpMacCore_StackId_t stackId; +} gpMacCore_Start_Input_struct_t; + +typedef struct { + gpMacCore_Start_Input_struct_t data; +} gpMacCore_Start_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_Start_Output_struct_t; + +typedef struct { + gpMacCore_Start_Output_struct_t data; +} gpMacCore_Start_Output_marshall_struct_t; + + +typedef struct { + Bool securityEnabled; + gpMacCore_StackId_t stackId; +} gpMacCore_SetSecurityEnabled_Input_struct_t; + +typedef struct { + gpMacCore_SetSecurityEnabled_Input_struct_t data; +} gpMacCore_SetSecurityEnabled_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceDescriptor_t* pDeviceDescriptor; + gpMacCore_Index_t index; +} gpMacCore_SetDeviceDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_SetDeviceDescriptor_Input_struct_t data; + gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t pDeviceDescriptor; +} gpMacCore_SetDeviceDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetDeviceDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_SetDeviceDescriptor_Output_struct_t data; +} gpMacCore_SetDeviceDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; +} gpMacCore_GetDeviceDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_GetDeviceDescriptor_Input_struct_t data; +} gpMacCore_GetDeviceDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_DeviceDescriptor_t* pDeviceDescriptor; +} gpMacCore_GetDeviceDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_GetDeviceDescriptor_Output_struct_t data; + gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t pDeviceDescriptor; +} gpMacCore_GetDeviceDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceTablesEntries_t deviceTableEntries; +} gpMacCore_SetDeviceTableEntries_Input_struct_t; + +typedef struct { + gpMacCore_SetDeviceTableEntries_Input_struct_t data; +} gpMacCore_SetDeviceTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceTablesEntries_t deviceTableEntries; +} gpMacCore_GetDeviceTableEntries_Output_struct_t; + +typedef struct { + gpMacCore_GetDeviceTableEntries_Output_struct_t data; +} gpMacCore_GetDeviceTableEntries_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_KeyDescriptor_t* pKeyDescriptor; + gpMacCore_Index_t index; +} gpMacCore_SetKeyDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_SetKeyDescriptor_Input_struct_t data; + gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t pKeyDescriptor; +} gpMacCore_SetKeyDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetKeyDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_SetKeyDescriptor_Output_struct_t data; +} gpMacCore_SetKeyDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; +} gpMacCore_GetKeyDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_GetKeyDescriptor_Input_struct_t data; +} gpMacCore_GetKeyDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_KeyDescriptor_t* pKeyDescriptor; +} gpMacCore_GetKeyDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_GetKeyDescriptor_Output_struct_t data; + gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t pKeyDescriptor; +} gpMacCore_GetKeyDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_KeyTablesEntries_t keyTableEntries; +} gpMacCore_SetKeyTableEntries_Input_struct_t; + +typedef struct { + gpMacCore_SetKeyTableEntries_Input_struct_t data; +} gpMacCore_SetKeyTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor; + gpMacCore_Index_t index; +} gpMacCore_SetSecurityLevelDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_SetSecurityLevelDescriptor_Input_struct_t data; + gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t pSecurityLevelDescriptor; +} gpMacCore_SetSecurityLevelDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetSecurityLevelDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_SetSecurityLevelDescriptor_Output_struct_t data; +} gpMacCore_SetSecurityLevelDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; +} gpMacCore_GetSecurityLevelDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_GetSecurityLevelDescriptor_Input_struct_t data; +} gpMacCore_GetSecurityLevelDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor; +} gpMacCore_GetSecurityLevelDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_GetSecurityLevelDescriptor_Output_struct_t data; + gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t pSecurityLevelDescriptor; +} gpMacCore_GetSecurityLevelDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; +} gpMacCore_SetSecurityLevelTableEntries_Input_struct_t; + +typedef struct { + gpMacCore_SetSecurityLevelTableEntries_Input_struct_t data; +} gpMacCore_SetSecurityLevelTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; +} gpMacCore_GetSecurityLevelTableEntries_Output_struct_t; + +typedef struct { + gpMacCore_GetSecurityLevelTableEntries_Output_struct_t data; +} gpMacCore_GetSecurityLevelTableEntries_Output_marshall_struct_t; + + +typedef struct { + UInt8* pDefaultKeySource; +} gpMacCore_SetDefaultKeySource_Input_struct_t; + +typedef struct { + gpMacCore_SetDefaultKeySource_Input_struct_t data; + UInt8 pDefaultKeySource[8]; +} gpMacCore_SetDefaultKeySource_Input_marshall_struct_t; + + +typedef struct { + UInt16 shortAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_SetShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetShortAddress_Input_struct_t data; +} gpMacCore_SetShortAddress_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pExtendedAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_SetExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetExtendedAddress_Input_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacCore_SetExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + UInt16 panId; + gpMacCore_StackId_t stackId; +} gpMacCore_SetPanId_Input_struct_t; + +typedef struct { + gpMacCore_SetPanId_Input_struct_t data; +} gpMacCore_SetPanId_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetPanId_Input_struct_t; + +typedef struct { + gpMacCore_GetPanId_Input_struct_t data; +} gpMacCore_GetPanId_Input_marshall_struct_t; + +typedef struct { + gpMacCore_PanId_t panId; +} gpMacCore_GetPanId_Output_struct_t; + +typedef struct { + gpMacCore_GetPanId_Output_struct_t data; +} gpMacCore_GetPanId_Output_marshall_struct_t; + + +typedef struct { + UInt32 frameCounter; + gpMacCore_StackId_t stackId; +} gpMacCore_SetFrameCounter_Input_struct_t; + +typedef struct { + gpMacCore_SetFrameCounter_Input_struct_t data; +} gpMacCore_SetFrameCounter_Input_marshall_struct_t; + + +typedef struct { + UInt8 dsn; + gpMacCore_StackId_t stackId; +} gpMacCore_SetDsn_Input_struct_t; + +typedef struct { + gpMacCore_SetDsn_Input_struct_t data; +} gpMacCore_SetDsn_Input_marshall_struct_t; + + +typedef struct { + UInt8 channel; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCurrentChannel_Input_struct_t; + +typedef struct { + gpMacCore_SetCurrentChannel_Input_struct_t data; +} gpMacCore_SetCurrentChannel_Input_marshall_struct_t; + + +typedef struct { + UInt8* pBeaconPayload; + gpMacCore_StackId_t stackId; +} gpMacCore_SetBeaconPayload_Input_struct_t; + +typedef struct { + gpMacCore_SetBeaconPayload_Input_struct_t data; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} gpMacCore_SetBeaconPayload_Input_marshall_struct_t; + + +typedef struct { + UInt8 beaconPayloadLength; + gpMacCore_StackId_t stackId; +} gpMacCore_SetBeaconPayloadLength_Input_struct_t; + +typedef struct { + gpMacCore_SetBeaconPayloadLength_Input_struct_t data; +} gpMacCore_SetBeaconPayloadLength_Input_marshall_struct_t; + + +typedef struct { + Bool rxOnWhenIdle; + gpMacCore_StackId_t stackId; +} gpMacCore_SetRxOnWhenIdle_Input_struct_t; + +typedef struct { + gpMacCore_SetRxOnWhenIdle_Input_struct_t data; +} gpMacCore_SetRxOnWhenIdle_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_GetExtendedAddress_Input_struct_t data; +} gpMacCore_GetExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pExtendedAddress; +} gpMacCore_GetExtendedAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetExtendedAddress_Output_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacCore_GetExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxCsmaBackoffs; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMaxCsmaBackoffs_Input_struct_t; + +typedef struct { + gpMacCore_SetMaxCsmaBackoffs_Input_struct_t data; +} gpMacCore_SetMaxCsmaBackoffs_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMaxCsmaBackoffs_Input_struct_t; + +typedef struct { + gpMacCore_GetMaxCsmaBackoffs_Input_struct_t data; +} gpMacCore_GetMaxCsmaBackoffs_Input_marshall_struct_t; + +typedef struct { + UInt8 maxCsmaBackoffs; +} gpMacCore_GetMaxCsmaBackoffs_Output_struct_t; + +typedef struct { + gpMacCore_GetMaxCsmaBackoffs_Output_struct_t data; +} gpMacCore_GetMaxCsmaBackoffs_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetDsn_Input_struct_t; + +typedef struct { + gpMacCore_GetDsn_Input_struct_t data; +} gpMacCore_GetDsn_Input_marshall_struct_t; + +typedef struct { + UInt8 dsn; +} gpMacCore_GetDsn_Output_struct_t; + +typedef struct { + gpMacCore_GetDsn_Output_struct_t data; +} gpMacCore_GetDsn_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCurrentChannel_Input_struct_t; + +typedef struct { + gpMacCore_GetCurrentChannel_Input_struct_t data; +} gpMacCore_GetCurrentChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 channel; +} gpMacCore_GetCurrentChannel_Output_struct_t; + +typedef struct { + gpMacCore_GetCurrentChannel_Output_struct_t data; +} gpMacCore_GetCurrentChannel_Output_marshall_struct_t; + + +typedef struct { + UInt8 numberOfRetries; + gpMacCore_StackId_t stackId; +} gpMacCore_SetNumberOfRetries_Input_struct_t; + +typedef struct { + gpMacCore_SetNumberOfRetries_Input_struct_t data; +} gpMacCore_SetNumberOfRetries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetNumberOfRetries_Input_struct_t; + +typedef struct { + gpMacCore_GetNumberOfRetries_Input_struct_t data; +} gpMacCore_GetNumberOfRetries_Input_marshall_struct_t; + +typedef struct { + UInt8 numberOfRetries; +} gpMacCore_GetNumberOfRetries_Output_struct_t; + +typedef struct { + gpMacCore_GetNumberOfRetries_Output_struct_t data; +} gpMacCore_GetNumberOfRetries_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetFrameCounter_Input_struct_t; + +typedef struct { + gpMacCore_GetFrameCounter_Input_struct_t data; +} gpMacCore_GetFrameCounter_Input_marshall_struct_t; + +typedef struct { + UInt32 frameCounter; +} gpMacCore_GetFrameCounter_Output_struct_t; + +typedef struct { + gpMacCore_GetFrameCounter_Output_struct_t data; +} gpMacCore_GetFrameCounter_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetRxOnWhenIdle_Input_struct_t; + +typedef struct { + gpMacCore_GetRxOnWhenIdle_Input_struct_t data; +} gpMacCore_GetRxOnWhenIdle_Input_marshall_struct_t; + +typedef struct { + Bool rxOnWhenIdle; +} gpMacCore_GetRxOnWhenIdle_Output_struct_t; + +typedef struct { + gpMacCore_GetRxOnWhenIdle_Output_struct_t data; +} gpMacCore_GetRxOnWhenIdle_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_GetShortAddress_Input_struct_t data; +} gpMacCore_GetShortAddress_Input_marshall_struct_t; + +typedef struct { + UInt16 address; +} gpMacCore_GetShortAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetShortAddress_Output_struct_t data; +} gpMacCore_GetShortAddress_Output_marshall_struct_t; + + +typedef struct { + UInt16 panCoordShortAddress; +} gpMacCore_SetPanCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetPanCoordShortAddress_Input_struct_t data; +} gpMacCore_SetPanCoordShortAddress_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; +} gpMacCore_SetPanCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetPanCoordExtendedAddress_Input_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacCore_SetPanCoordExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + Bool associationPermit; + gpMacCore_StackId_t stackId; +} gpMacCore_SetAssociationPermit_Input_struct_t; + +typedef struct { + gpMacCore_SetAssociationPermit_Input_struct_t data; +} gpMacCore_SetAssociationPermit_Input_marshall_struct_t; + + +typedef struct { + Int8* pDefaultTransmitPowerTable; +} gpMacCore_SetDefaultTransmitPowers_Input_struct_t; + +typedef struct { + gpMacCore_SetDefaultTransmitPowers_Input_struct_t data; + Int8 pDefaultTransmitPowerTable[16]; +} gpMacCore_SetDefaultTransmitPowers_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_TxPower_t transmitPower; + gpMacCore_StackId_t stackId; +} gpMacCore_SetTransmitPower_Input_struct_t; + +typedef struct { + gpMacCore_SetTransmitPower_Input_struct_t data; +} gpMacCore_SetTransmitPower_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetTransmitPower_Input_struct_t; + +typedef struct { + gpMacCore_GetTransmitPower_Input_struct_t data; +} gpMacCore_GetTransmitPower_Input_marshall_struct_t; + +typedef struct { + Int8 transmitPower; +} gpMacCore_GetTransmitPower_Output_struct_t; + +typedef struct { + gpMacCore_GetTransmitPower_Output_struct_t data; +} gpMacCore_GetTransmitPower_Output_marshall_struct_t; + + + +typedef struct { + Bool panCoordinator; + gpMacCore_StackId_t stackId; +} gpMacCore_SetPanCoordinator_Input_struct_t; + +typedef struct { + gpMacCore_SetPanCoordinator_Input_struct_t data; +} gpMacCore_SetPanCoordinator_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetPanCoordinator_Input_struct_t; + +typedef struct { + gpMacCore_GetPanCoordinator_Input_struct_t data; +} gpMacCore_GetPanCoordinator_Input_marshall_struct_t; + +typedef struct { + Bool panCoordinator; +} gpMacCore_GetPanCoordinator_Output_struct_t; + +typedef struct { + gpMacCore_GetPanCoordinator_Output_struct_t data; +} gpMacCore_GetPanCoordinator_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pOrphanAddress; + UInt16 shortAddress; + Bool associatedMember; + gpMacCore_StackId_t stackId; +} gpMacCore_OrphanResponse_Input_struct_t; + +typedef struct { + gpMacCore_OrphanResponse_Input_struct_t data; + MACAddress_t pOrphanAddress[1]; +} gpMacCore_OrphanResponse_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetSecurityEnabled_Input_struct_t; + +typedef struct { + gpMacCore_GetSecurityEnabled_Input_struct_t data; +} gpMacCore_GetSecurityEnabled_Input_marshall_struct_t; + +typedef struct { + Bool securityEnabled; +} gpMacCore_GetSecurityEnabled_Output_struct_t; + +typedef struct { + gpMacCore_GetSecurityEnabled_Output_struct_t data; +} gpMacCore_GetSecurityEnabled_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetTransactionPersistenceTime_Input_struct_t; + +typedef struct { + gpMacCore_GetTransactionPersistenceTime_Input_struct_t data; +} gpMacCore_GetTransactionPersistenceTime_Input_marshall_struct_t; + +typedef struct { + UInt16 time; +} gpMacCore_GetTransactionPersistenceTime_Output_struct_t; + +typedef struct { + gpMacCore_GetTransactionPersistenceTime_Output_struct_t data; +} gpMacCore_GetTransactionPersistenceTime_Output_marshall_struct_t; + + +typedef struct { + UInt16 time; + gpMacCore_StackId_t stackId; +} gpMacCore_SetTransactionPersistenceTime_Input_struct_t; + +typedef struct { + gpMacCore_SetTransactionPersistenceTime_Input_struct_t data; +} gpMacCore_SetTransactionPersistenceTime_Input_marshall_struct_t; + + + + +typedef struct { + Bool BeaconStarted; + gpMacCore_StackId_t stackId; +} gpMacCore_SetBeaconStarted_Input_struct_t; + +typedef struct { + gpMacCore_SetBeaconStarted_Input_struct_t data; +} gpMacCore_SetBeaconStarted_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetBeaconStarted_Input_struct_t; + +typedef struct { + gpMacCore_GetBeaconStarted_Input_struct_t data; +} gpMacCore_GetBeaconStarted_Input_marshall_struct_t; + +typedef struct { + Bool BeaconStarted; +} gpMacCore_GetBeaconStarted_Output_struct_t; + +typedef struct { + gpMacCore_GetBeaconStarted_Output_struct_t data; +} gpMacCore_GetBeaconStarted_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; +} gpMacCore_GetPanCoordExtendedAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetPanCoordExtendedAddress_Output_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacCore_GetPanCoordExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetCoordExtendedAddress_Input_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacCore_SetCoordExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_GetCoordExtendedAddress_Input_struct_t data; +} gpMacCore_GetCoordExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; +} gpMacCore_GetCoordExtendedAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetCoordExtendedAddress_Output_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacCore_GetCoordExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + UInt16 panCoordShortAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetCoordShortAddress_Input_struct_t data; +} gpMacCore_SetCoordShortAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_GetCoordShortAddress_Input_struct_t data; +} gpMacCore_GetCoordShortAddress_Input_marshall_struct_t; + +typedef struct { + UInt16 panCoordShortAddress; +} gpMacCore_GetCoordShortAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetCoordShortAddress_Output_struct_t data; +} gpMacCore_GetCoordShortAddress_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetAssociationPermit_Input_struct_t; + +typedef struct { + gpMacCore_GetAssociationPermit_Input_struct_t data; +} gpMacCore_GetAssociationPermit_Input_marshall_struct_t; + +typedef struct { + Bool associationPermit; +} gpMacCore_GetAssociationPermit_Output_struct_t; + +typedef struct { + gpMacCore_GetAssociationPermit_Output_struct_t data; +} gpMacCore_GetAssociationPermit_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetBeaconPayload_Input_struct_t; + +typedef struct { + gpMacCore_GetBeaconPayload_Input_struct_t data; +} gpMacCore_GetBeaconPayload_Input_marshall_struct_t; + +typedef struct { + UInt8* pBeaconPayload; +} gpMacCore_GetBeaconPayload_Output_struct_t; + +typedef struct { + gpMacCore_GetBeaconPayload_Output_struct_t data; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} gpMacCore_GetBeaconPayload_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetBeaconPayloadLength_Input_struct_t; + +typedef struct { + gpMacCore_GetBeaconPayloadLength_Input_struct_t data; +} gpMacCore_GetBeaconPayloadLength_Input_marshall_struct_t; + +typedef struct { + UInt8 beaconPayloadLength; +} gpMacCore_GetBeaconPayloadLength_Output_struct_t; + +typedef struct { + gpMacCore_GetBeaconPayloadLength_Output_struct_t data; +} gpMacCore_GetBeaconPayloadLength_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacCore_SetIndicateBeaconNotifications_Input_struct_t; + +typedef struct { + gpMacCore_SetIndicateBeaconNotifications_Input_struct_t data; +} gpMacCore_SetIndicateBeaconNotifications_Input_marshall_struct_t; + + +typedef struct { + UInt8 promiscuousMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetPromiscuousMode_Input_struct_t; + +typedef struct { + gpMacCore_SetPromiscuousMode_Input_struct_t data; +} gpMacCore_SetPromiscuousMode_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_MacVersion_t macVersion; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMacVersion_Input_struct_t; + +typedef struct { + gpMacCore_SetMacVersion_Input_struct_t data; +} gpMacCore_SetMacVersion_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMacVersion_Input_struct_t; + +typedef struct { + gpMacCore_GetMacVersion_Input_struct_t data; +} gpMacCore_GetMacVersion_Input_marshall_struct_t; + +typedef struct { + gpMacCore_MacVersion_t macVersion; +} gpMacCore_GetMacVersion_Output_struct_t; + +typedef struct { + gpMacCore_GetMacVersion_Output_struct_t data; +} gpMacCore_GetMacVersion_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_StackAdded_Input_struct_t; + +typedef struct { + gpMacCore_StackAdded_Input_struct_t data; +} gpMacCore_StackAdded_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_StackRemoved_Input_struct_t; + +typedef struct { + gpMacCore_StackRemoved_Input_struct_t data; +} gpMacCore_StackRemoved_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetIndicateBeaconNotifications_Input_struct_t; + +typedef struct { + gpMacCore_GetIndicateBeaconNotifications_Input_struct_t data; +} gpMacCore_GetIndicateBeaconNotifications_Input_marshall_struct_t; + +typedef struct { + Bool enabled; +} gpMacCore_GetIndicateBeaconNotifications_Output_struct_t; + +typedef struct { + gpMacCore_GetIndicateBeaconNotifications_Output_struct_t data; +} gpMacCore_GetIndicateBeaconNotifications_Output_marshall_struct_t; + + +typedef struct { + UInt8 cCAMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCCAMode_Input_struct_t; + +typedef struct { + gpMacCore_SetCCAMode_Input_struct_t data; +} gpMacCore_SetCCAMode_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCCAMode_Input_struct_t; + +typedef struct { + gpMacCore_GetCCAMode_Input_struct_t data; +} gpMacCore_GetCCAMode_Input_marshall_struct_t; + +typedef struct { + UInt8 cCAMode; +} gpMacCore_GetCCAMode_Output_struct_t; + +typedef struct { + gpMacCore_GetCCAMode_Output_struct_t data; +} gpMacCore_GetCCAMode_Output_marshall_struct_t; + + +typedef struct { + UInt8 minBE; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMinBE_Input_struct_t; + +typedef struct { + gpMacCore_SetMinBE_Input_struct_t data; +} gpMacCore_SetMinBE_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMinBE_Input_struct_t; + +typedef struct { + gpMacCore_GetMinBE_Input_struct_t data; +} gpMacCore_GetMinBE_Input_marshall_struct_t; + +typedef struct { + UInt8 minBE; +} gpMacCore_GetMinBE_Output_struct_t; + +typedef struct { + gpMacCore_GetMinBE_Output_struct_t data; +} gpMacCore_GetMinBE_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetPromiscuousMode_Input_struct_t; + +typedef struct { + gpMacCore_GetPromiscuousMode_Input_struct_t data; +} gpMacCore_GetPromiscuousMode_Input_marshall_struct_t; + +typedef struct { + Bool promiscuousMode; +} gpMacCore_GetPromiscuousMode_Output_struct_t; + +typedef struct { + gpMacCore_GetPromiscuousMode_Output_struct_t data; +} gpMacCore_GetPromiscuousMode_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpMacCore_StackId_t stackId; +} gpMacCore_PurgeRequest_Input_struct_t; + +typedef struct { + gpMacCore_PurgeRequest_Input_struct_t data; +} gpMacCore_PurgeRequest_Input_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacCore_SetForwardPollIndications_Input_struct_t; + +typedef struct { + gpMacCore_SetForwardPollIndications_Input_struct_t data; +} gpMacCore_SetForwardPollIndications_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetForwardPollIndications_Input_struct_t; + +typedef struct { + gpMacCore_GetForwardPollIndications_Input_struct_t data; +} gpMacCore_GetForwardPollIndications_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacCore_GetForwardPollIndications_Output_struct_t; + +typedef struct { + gpMacCore_GetForwardPollIndications_Output_struct_t data; +} gpMacCore_GetForwardPollIndications_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxBE; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMaxBE_Input_struct_t; + +typedef struct { + gpMacCore_SetMaxBE_Input_struct_t data; +} gpMacCore_SetMaxBE_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMaxBE_Input_struct_t; + +typedef struct { + gpMacCore_GetMaxBE_Input_struct_t data; +} gpMacCore_GetMaxBE_Input_marshall_struct_t; + +typedef struct { + UInt8 maxBE; +} gpMacCore_GetMaxBE_Output_struct_t; + +typedef struct { + gpMacCore_GetMaxBE_Output_struct_t data; +} gpMacCore_GetMaxBE_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacCore_AddNeighbour_Input_struct_t; + +typedef struct { + gpMacCore_AddNeighbour_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacCore_AddNeighbour_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacCore_AddNeighbour_Output_struct_t; + +typedef struct { + gpMacCore_AddNeighbour_Output_struct_t data; +} gpMacCore_AddNeighbour_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacCore_RemoveNeighbour_Input_struct_t; + +typedef struct { + gpMacCore_RemoveNeighbour_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacCore_RemoveNeighbour_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacCore_RemoveNeighbour_Output_struct_t; + +typedef struct { + gpMacCore_RemoveNeighbour_Output_struct_t data; +} gpMacCore_RemoveNeighbour_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DataPendingMode_t dataPendingMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetDataPendingMode_Input_struct_t; + +typedef struct { + gpMacCore_SetDataPendingMode_Input_struct_t data; +} gpMacCore_SetDataPendingMode_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetDataPendingMode_Output_struct_t; + +typedef struct { + gpMacCore_SetDataPendingMode_Output_struct_t data; +} gpMacCore_SetDataPendingMode_Output_marshall_struct_t; + + + +typedef struct { + UInt8 addressMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetAddressModeOverrideForBeacons_Input_struct_t; + +typedef struct { + gpMacCore_SetAddressModeOverrideForBeacons_Input_struct_t data; +} gpMacCore_SetAddressModeOverrideForBeacons_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_ClearNeighbours_Input_struct_t; + +typedef struct { + gpMacCore_ClearNeighbours_Input_struct_t data; +} gpMacCore_ClearNeighbours_Input_marshall_struct_t; + + +typedef struct { + UInt8 csmaMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCsmaMode_Input_struct_t; + +typedef struct { + gpMacCore_SetCsmaMode_Input_struct_t data; +} gpMacCore_SetCsmaMode_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCsmaMode_Input_struct_t; + +typedef struct { + gpMacCore_GetCsmaMode_Input_struct_t data; +} gpMacCore_GetCsmaMode_Input_marshall_struct_t; + +typedef struct { + UInt8 csmaMode; +} gpMacCore_GetCsmaMode_Output_struct_t; + +typedef struct { + gpMacCore_GetCsmaMode_Output_struct_t data; +} gpMacCore_GetCsmaMode_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpMacCore_TxTimingOptions_t timingOptions; + gpMacCore_StackId_t stackId; +} gpMacCore_ScheduleTimedTx_Input_struct_t; + +typedef struct { + gpMacCore_ScheduleTimedTx_Input_struct_t data; + gpMacCore_TxTimingOptions_t_l1_pointer_marshall_t timingOptions; +} gpMacCore_ScheduleTimedTx_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_ScheduleTimedTx_Output_struct_t; + +typedef struct { + gpMacCore_ScheduleTimedTx_Output_struct_t data; +} gpMacCore_ScheduleTimedTx_Output_marshall_struct_t; + + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacCore_DataPending_QueueAdd_Input_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueAdd_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacCore_DataPending_QueueAdd_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_DataPending_QueueAdd_Output_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueAdd_Output_struct_t data; +} gpMacCore_DataPending_QueueAdd_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacCore_DataPending_QueueRemove_Input_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueRemove_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacCore_DataPending_QueueRemove_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_DataPending_QueueRemove_Output_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueRemove_Output_struct_t data; +} gpMacCore_DataPending_QueueRemove_Output_marshall_struct_t; + + + + + +typedef struct { + Int8* pInterferenceLevels; +} gpMacCore_SetMinInterferenceLevels_Input_struct_t; + +typedef struct { + gpMacCore_SetMinInterferenceLevels_Input_struct_t data; + Int8 pInterferenceLevels[16]; +} gpMacCore_SetMinInterferenceLevels_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetMinInterferenceLevels_Output_struct_t; + +typedef struct { + gpMacCore_SetMinInterferenceLevels_Output_struct_t data; +} gpMacCore_SetMinInterferenceLevels_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_DataPending_QueueClear_Input_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueClear_Input_struct_t data; +} gpMacCore_DataPending_QueueClear_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_DataPending_QueueClear_Output_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueClear_Output_struct_t data; +} gpMacCore_DataPending_QueueClear_Output_marshall_struct_t; + + +typedef struct { + Bool pending; +} gpMacCore_DataPendingGetAckDataPending_Output_struct_t; + +typedef struct { + gpMacCore_DataPendingGetAckDataPending_Output_struct_t data; +} gpMacCore_DataPendingGetAckDataPending_Output_marshall_struct_t; + + +typedef struct { + Bool rawModeEnabled; + gpMacCore_StackId_t stackId; +} gpMacCore_SetStackInRawMode_Input_struct_t; + +typedef struct { + gpMacCore_SetStackInRawMode_Input_struct_t data; +} gpMacCore_SetStackInRawMode_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetStackInRawMode_Input_struct_t; + +typedef struct { + gpMacCore_GetStackInRawMode_Input_struct_t data; +} gpMacCore_GetStackInRawMode_Input_marshall_struct_t; + +typedef struct { + Bool rawModeEnabled; +} gpMacCore_GetStackInRawMode_Output_struct_t; + +typedef struct { + gpMacCore_GetStackInRawMode_Output_struct_t data; +} gpMacCore_GetStackInRawMode_Output_marshall_struct_t; + + +typedef struct { + Bool enableEnhancedFramePending; + gpMacCore_StackId_t stackId; +} gpMacCore_EnableEnhancedFramePending_Input_struct_t; + +typedef struct { + gpMacCore_EnableEnhancedFramePending_Input_struct_t data; +} gpMacCore_EnableEnhancedFramePending_Input_marshall_struct_t; + + + + + + +typedef struct { + UInt32 currentTime; +} gpMacCore_GetCurrentTimeUs_Output_struct_t; + +typedef struct { + gpMacCore_GetCurrentTimeUs_Output_struct_t data; +} gpMacCore_GetCurrentTimeUs_Output_marshall_struct_t; + + +typedef struct { + UInt8 linkMetrics; + MACAddress_t* pExtendedAddress; + UInt16 shortAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_ConfigureEnhAckProbing_Input_struct_t; + +typedef struct { + gpMacCore_ConfigureEnhAckProbing_Input_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacCore_ConfigureEnhAckProbing_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_ConfigureEnhAckProbing_Output_struct_t; + +typedef struct { + gpMacCore_ConfigureEnhAckProbing_Output_struct_t data; +} gpMacCore_ConfigureEnhAckProbing_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacCore_SetRetransmitOnCcaFail_Input_struct_t; + +typedef struct { + gpMacCore_SetRetransmitOnCcaFail_Input_struct_t data; +} gpMacCore_SetRetransmitOnCcaFail_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetRetransmitOnCcaFail_Input_struct_t; + +typedef struct { + gpMacCore_GetRetransmitOnCcaFail_Input_struct_t data; +} gpMacCore_GetRetransmitOnCcaFail_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacCore_GetRetransmitOnCcaFail_Output_struct_t; + +typedef struct { + gpMacCore_GetRetransmitOnCcaFail_Output_struct_t data; +} gpMacCore_GetRetransmitOnCcaFail_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacCore_SetRetransmitRandomBackoff_Input_struct_t; + +typedef struct { + gpMacCore_SetRetransmitRandomBackoff_Input_struct_t data; +} gpMacCore_SetRetransmitRandomBackoff_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetRetransmitRandomBackoff_Input_struct_t; + +typedef struct { + gpMacCore_GetRetransmitRandomBackoff_Input_struct_t data; +} gpMacCore_GetRetransmitRandomBackoff_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacCore_GetRetransmitRandomBackoff_Output_struct_t; + +typedef struct { + gpMacCore_GetRetransmitRandomBackoff_Output_struct_t data; +} gpMacCore_GetRetransmitRandomBackoff_Output_marshall_struct_t; + + +typedef struct { + UInt8 minBERetransmit; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMinBeRetransmit_Input_struct_t; + +typedef struct { + gpMacCore_SetMinBeRetransmit_Input_struct_t data; +} gpMacCore_SetMinBeRetransmit_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMinBeRetransmit_Input_struct_t; + +typedef struct { + gpMacCore_GetMinBeRetransmit_Input_struct_t data; +} gpMacCore_GetMinBeRetransmit_Input_marshall_struct_t; + +typedef struct { + UInt8 minBERetransmit; +} gpMacCore_GetMinBeRetransmit_Output_struct_t; + +typedef struct { + gpMacCore_GetMinBeRetransmit_Output_struct_t data; +} gpMacCore_GetMinBeRetransmit_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxBERetransmit; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMaxBeRetransmit_Input_struct_t; + +typedef struct { + gpMacCore_SetMaxBeRetransmit_Input_struct_t data; +} gpMacCore_SetMaxBeRetransmit_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMaxBeRetransmit_Input_struct_t; + +typedef struct { + gpMacCore_GetMaxBeRetransmit_Input_struct_t data; +} gpMacCore_GetMaxBeRetransmit_Input_marshall_struct_t; + +typedef struct { + UInt8 maxBERetransmit; +} gpMacCore_GetMaxBeRetransmit_Output_struct_t; + +typedef struct { + gpMacCore_GetMaxBeRetransmit_Output_struct_t data; +} gpMacCore_GetMaxBeRetransmit_Output_marshall_struct_t; + + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Result_t status; + gpPd_Handle_t pdHandle; +} gpMacCore_cbDataConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbDataConfirm_Input_struct_t data; +} gpMacCore_cbDataConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + UInt8 dsn; + gpMacCore_Security_t* pSecOptions; + gpPd_Loh_t pdLoh; + gpMacCore_StackId_t stackId; +} gpMacCore_cbDataIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbDataIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; + gpPd_Loh_t_l1_pointer_marshall_t pdLoh; +} gpMacCore_cbDataIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Result_t status; + gpMacCore_ScanType_t scanType; + UInt32 unscannedChannels; + UInt8 resultListSize; + UInt8* pEdScanResultList; +} gpMacCore_cbScanConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbScanConfirm_Input_struct_t data; + UInt8 pEdScanResultList[27]; +} gpMacCore_cbScanConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + UInt8 bsn; + gpMacCore_PanDescriptor_t* pPanDescriptor; + gpMacCore_StackId_t stackId; + UInt8 beaconPayloadLength; + UInt8* pBeaconPayload; +} gpMacCore_cbBeaconNotifyIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbBeaconNotifyIndication_Input_struct_t data; + gpMacCore_PanDescriptor_t_l1_pointer_marshall_t pPanDescriptor; + UInt8 pBeaconPayload[52]; +} gpMacCore_cbBeaconNotifyIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + MACAddress_t* pOrphanAddress; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t rxTime; +} gpMacCore_cbOrphanIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbOrphanIndication_Input_struct_t data; + MACAddress_t pOrphanAddress[1]; +} gpMacCore_cbOrphanIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddressInfo; + gpMacCore_AddressInfo_t* pDstAddressInfo; + gpMacCore_Result_t status; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbSecurityFailureCommStatusIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbSecurityFailureCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddressInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; +} gpMacCore_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Result_t status; + gpMacCore_AddressInfo_t* coordAddrInfo; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbPollConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbPollConfirm_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; +} gpMacCore_cbPollConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* addressInfo; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t rxTime; +} gpMacCore_cbPollIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbPollIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t addressInfo; +} gpMacCore_cbPollIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + UInt16 assocShortAddress; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbAssociateConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbAssociateConfirm_Input_struct_t data; +} gpMacCore_cbAssociateConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Address_t* pDeviceAddress; + UInt8 capabilityInformation; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t rxTime; +} gpMacCore_cbAssociateIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbAssociateIndication_Input_struct_t data; + gpMacCore_Address_t_l1_pointer_marshall_t pDeviceAddress; +} gpMacCore_cbAssociateIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddressInfo; + gpMacCore_AddressInfo_t* pDstAddressInfo; + gpMacCore_Result_t status; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbAssociateCommStatusIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbAssociateCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddressInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; +} gpMacCore_cbAssociateCommStatusIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddressInfo; + gpMacCore_AddressInfo_t* pDstAddressInfo; + gpMacCore_Result_t status; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbOrphanCommStatusIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbOrphanCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddressInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; +} gpMacCore_cbOrphanCommStatusIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_SCAN_ORPHAN_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_cbValidStack_Input_struct_t; + +typedef struct { + gpMacCore_cbValidStack_Input_struct_t data; +} gpMacCore_cbValidStack_Input_marshall_struct_t; + +typedef struct { + Bool valid; +} gpMacCore_cbValidStack_Output_struct_t; + +typedef struct { + gpMacCore_cbValidStack_Output_struct_t data; +} gpMacCore_cbValidStack_Output_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Result_t status; + gpPd_Handle_t pdHandle; +} gpMacCore_cbPurgeConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbPurgeConfirm_Input_struct_t data; +} gpMacCore_cbPurgeConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* addressInfo; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t rxTime; + gpPd_Handle_t pdHandle; + Bool fromNeighbour; +} gpMacCore_cbPollNotify_Input_struct_t; + +typedef struct { + gpMacCore_cbPollNotify_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t addressInfo; +} gpMacCore_cbPollNotify_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !(defined(GP_COMP_MACDISPATCHER)) +typedef struct { + UInt32 frameCounter; + gpMacCore_StackId_t stackId; +} gpMacCore_cbSecurityFrameCounterIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbSecurityFrameCounterIndication_Input_struct_t data; +} gpMacCore_cbSecurityFrameCounterIndication_Input_marshall_struct_t; + +#endif /* !(defined(GP_COMP_MACDISPATCHER)) */ + +typedef union { + gpMacCore_Reset_Input_marshall_struct_t gpMacCore_Reset; + gpMacCore_DataRequest_Input_marshall_struct_t gpMacCore_DataRequest; + gpMacCore_ScanRequest_Input_marshall_struct_t gpMacCore_ScanRequest; + gpMacCore_AssociateRequest_Input_marshall_struct_t gpMacCore_AssociateRequest; + gpMacCore_AssociateResponse_Input_marshall_struct_t gpMacCore_AssociateResponse; + gpMacCore_PollRequest_Input_marshall_struct_t gpMacCore_PollRequest; + gpMacCore_Start_Input_marshall_struct_t gpMacCore_Start; + gpMacCore_SetSecurityEnabled_Input_marshall_struct_t gpMacCore_SetSecurityEnabled; + gpMacCore_SetDeviceDescriptor_Input_marshall_struct_t gpMacCore_SetDeviceDescriptor; + gpMacCore_GetDeviceDescriptor_Input_marshall_struct_t gpMacCore_GetDeviceDescriptor; + gpMacCore_SetDeviceTableEntries_Input_marshall_struct_t gpMacCore_SetDeviceTableEntries; + gpMacCore_SetKeyDescriptor_Input_marshall_struct_t gpMacCore_SetKeyDescriptor; + gpMacCore_GetKeyDescriptor_Input_marshall_struct_t gpMacCore_GetKeyDescriptor; + gpMacCore_SetKeyTableEntries_Input_marshall_struct_t gpMacCore_SetKeyTableEntries; + gpMacCore_SetSecurityLevelDescriptor_Input_marshall_struct_t gpMacCore_SetSecurityLevelDescriptor; + gpMacCore_GetSecurityLevelDescriptor_Input_marshall_struct_t gpMacCore_GetSecurityLevelDescriptor; + gpMacCore_SetSecurityLevelTableEntries_Input_marshall_struct_t gpMacCore_SetSecurityLevelTableEntries; + gpMacCore_SetDefaultKeySource_Input_marshall_struct_t gpMacCore_SetDefaultKeySource; + gpMacCore_SetShortAddress_Input_marshall_struct_t gpMacCore_SetShortAddress; + gpMacCore_SetExtendedAddress_Input_marshall_struct_t gpMacCore_SetExtendedAddress; + gpMacCore_SetPanId_Input_marshall_struct_t gpMacCore_SetPanId; + gpMacCore_GetPanId_Input_marshall_struct_t gpMacCore_GetPanId; + gpMacCore_SetFrameCounter_Input_marshall_struct_t gpMacCore_SetFrameCounter; + gpMacCore_SetDsn_Input_marshall_struct_t gpMacCore_SetDsn; + gpMacCore_SetCurrentChannel_Input_marshall_struct_t gpMacCore_SetCurrentChannel; + gpMacCore_SetBeaconPayload_Input_marshall_struct_t gpMacCore_SetBeaconPayload; + gpMacCore_SetBeaconPayloadLength_Input_marshall_struct_t gpMacCore_SetBeaconPayloadLength; + gpMacCore_SetRxOnWhenIdle_Input_marshall_struct_t gpMacCore_SetRxOnWhenIdle; + gpMacCore_GetExtendedAddress_Input_marshall_struct_t gpMacCore_GetExtendedAddress; + gpMacCore_SetMaxCsmaBackoffs_Input_marshall_struct_t gpMacCore_SetMaxCsmaBackoffs; + gpMacCore_GetMaxCsmaBackoffs_Input_marshall_struct_t gpMacCore_GetMaxCsmaBackoffs; + gpMacCore_GetDsn_Input_marshall_struct_t gpMacCore_GetDsn; + gpMacCore_GetCurrentChannel_Input_marshall_struct_t gpMacCore_GetCurrentChannel; + gpMacCore_SetNumberOfRetries_Input_marshall_struct_t gpMacCore_SetNumberOfRetries; + gpMacCore_GetNumberOfRetries_Input_marshall_struct_t gpMacCore_GetNumberOfRetries; + gpMacCore_GetFrameCounter_Input_marshall_struct_t gpMacCore_GetFrameCounter; + gpMacCore_GetRxOnWhenIdle_Input_marshall_struct_t gpMacCore_GetRxOnWhenIdle; + gpMacCore_GetShortAddress_Input_marshall_struct_t gpMacCore_GetShortAddress; + gpMacCore_SetPanCoordShortAddress_Input_marshall_struct_t gpMacCore_SetPanCoordShortAddress; + gpMacCore_SetPanCoordExtendedAddress_Input_marshall_struct_t gpMacCore_SetPanCoordExtendedAddress; + gpMacCore_SetAssociationPermit_Input_marshall_struct_t gpMacCore_SetAssociationPermit; + gpMacCore_SetDefaultTransmitPowers_Input_marshall_struct_t gpMacCore_SetDefaultTransmitPowers; + gpMacCore_SetTransmitPower_Input_marshall_struct_t gpMacCore_SetTransmitPower; + gpMacCore_GetTransmitPower_Input_marshall_struct_t gpMacCore_GetTransmitPower; + gpMacCore_SetPanCoordinator_Input_marshall_struct_t gpMacCore_SetPanCoordinator; + gpMacCore_GetPanCoordinator_Input_marshall_struct_t gpMacCore_GetPanCoordinator; + gpMacCore_OrphanResponse_Input_marshall_struct_t gpMacCore_OrphanResponse; + gpMacCore_GetSecurityEnabled_Input_marshall_struct_t gpMacCore_GetSecurityEnabled; + gpMacCore_GetTransactionPersistenceTime_Input_marshall_struct_t gpMacCore_GetTransactionPersistenceTime; + gpMacCore_SetTransactionPersistenceTime_Input_marshall_struct_t gpMacCore_SetTransactionPersistenceTime; + gpMacCore_SetBeaconStarted_Input_marshall_struct_t gpMacCore_SetBeaconStarted; + gpMacCore_GetBeaconStarted_Input_marshall_struct_t gpMacCore_GetBeaconStarted; + gpMacCore_SetCoordExtendedAddress_Input_marshall_struct_t gpMacCore_SetCoordExtendedAddress; + gpMacCore_GetCoordExtendedAddress_Input_marshall_struct_t gpMacCore_GetCoordExtendedAddress; + gpMacCore_SetCoordShortAddress_Input_marshall_struct_t gpMacCore_SetCoordShortAddress; + gpMacCore_GetCoordShortAddress_Input_marshall_struct_t gpMacCore_GetCoordShortAddress; + gpMacCore_GetAssociationPermit_Input_marshall_struct_t gpMacCore_GetAssociationPermit; + gpMacCore_GetBeaconPayload_Input_marshall_struct_t gpMacCore_GetBeaconPayload; + gpMacCore_GetBeaconPayloadLength_Input_marshall_struct_t gpMacCore_GetBeaconPayloadLength; + gpMacCore_SetIndicateBeaconNotifications_Input_marshall_struct_t gpMacCore_SetIndicateBeaconNotifications; + gpMacCore_SetPromiscuousMode_Input_marshall_struct_t gpMacCore_SetPromiscuousMode; + gpMacCore_SetMacVersion_Input_marshall_struct_t gpMacCore_SetMacVersion; + gpMacCore_GetMacVersion_Input_marshall_struct_t gpMacCore_GetMacVersion; + gpMacCore_StackAdded_Input_marshall_struct_t gpMacCore_StackAdded; + gpMacCore_StackRemoved_Input_marshall_struct_t gpMacCore_StackRemoved; + gpMacCore_GetIndicateBeaconNotifications_Input_marshall_struct_t gpMacCore_GetIndicateBeaconNotifications; + gpMacCore_SetCCAMode_Input_marshall_struct_t gpMacCore_SetCCAMode; + gpMacCore_GetCCAMode_Input_marshall_struct_t gpMacCore_GetCCAMode; + gpMacCore_SetMinBE_Input_marshall_struct_t gpMacCore_SetMinBE; + gpMacCore_GetMinBE_Input_marshall_struct_t gpMacCore_GetMinBE; + gpMacCore_GetPromiscuousMode_Input_marshall_struct_t gpMacCore_GetPromiscuousMode; + gpMacCore_PurgeRequest_Input_marshall_struct_t gpMacCore_PurgeRequest; + gpMacCore_SetForwardPollIndications_Input_marshall_struct_t gpMacCore_SetForwardPollIndications; + gpMacCore_GetForwardPollIndications_Input_marshall_struct_t gpMacCore_GetForwardPollIndications; + gpMacCore_SetMaxBE_Input_marshall_struct_t gpMacCore_SetMaxBE; + gpMacCore_GetMaxBE_Input_marshall_struct_t gpMacCore_GetMaxBE; + gpMacCore_AddNeighbour_Input_marshall_struct_t gpMacCore_AddNeighbour; + gpMacCore_RemoveNeighbour_Input_marshall_struct_t gpMacCore_RemoveNeighbour; + gpMacCore_SetDataPendingMode_Input_marshall_struct_t gpMacCore_SetDataPendingMode; + gpMacCore_SetAddressModeOverrideForBeacons_Input_marshall_struct_t gpMacCore_SetAddressModeOverrideForBeacons; + gpMacCore_ClearNeighbours_Input_marshall_struct_t gpMacCore_ClearNeighbours; + gpMacCore_SetCsmaMode_Input_marshall_struct_t gpMacCore_SetCsmaMode; + gpMacCore_GetCsmaMode_Input_marshall_struct_t gpMacCore_GetCsmaMode; + gpMacCore_ScheduleTimedTx_Input_marshall_struct_t gpMacCore_ScheduleTimedTx; + gpMacCore_DataPending_QueueAdd_Input_marshall_struct_t gpMacCore_DataPending_QueueAdd; + gpMacCore_DataPending_QueueRemove_Input_marshall_struct_t gpMacCore_DataPending_QueueRemove; + gpMacCore_SetMinInterferenceLevels_Input_marshall_struct_t gpMacCore_SetMinInterferenceLevels; + gpMacCore_DataPending_QueueClear_Input_marshall_struct_t gpMacCore_DataPending_QueueClear; + gpMacCore_SetStackInRawMode_Input_marshall_struct_t gpMacCore_SetStackInRawMode; + gpMacCore_GetStackInRawMode_Input_marshall_struct_t gpMacCore_GetStackInRawMode; + gpMacCore_EnableEnhancedFramePending_Input_marshall_struct_t gpMacCore_EnableEnhancedFramePending; + gpMacCore_ConfigureEnhAckProbing_Input_marshall_struct_t gpMacCore_ConfigureEnhAckProbing; + gpMacCore_SetRetransmitOnCcaFail_Input_marshall_struct_t gpMacCore_SetRetransmitOnCcaFail; + gpMacCore_GetRetransmitOnCcaFail_Input_marshall_struct_t gpMacCore_GetRetransmitOnCcaFail; + gpMacCore_SetRetransmitRandomBackoff_Input_marshall_struct_t gpMacCore_SetRetransmitRandomBackoff; + gpMacCore_GetRetransmitRandomBackoff_Input_marshall_struct_t gpMacCore_GetRetransmitRandomBackoff; + gpMacCore_SetMinBeRetransmit_Input_marshall_struct_t gpMacCore_SetMinBeRetransmit; + gpMacCore_GetMinBeRetransmit_Input_marshall_struct_t gpMacCore_GetMinBeRetransmit; + gpMacCore_SetMaxBeRetransmit_Input_marshall_struct_t gpMacCore_SetMaxBeRetransmit; + gpMacCore_GetMaxBeRetransmit_Input_marshall_struct_t gpMacCore_GetMaxBeRetransmit; + UInt8 dummy; //ensure none empty union definition +} gpMacCore_Server_Input_union_t; + +typedef union { + gpMacCore_Reset_Output_marshall_struct_t gpMacCore_Reset; + gpMacCore_Start_Output_marshall_struct_t gpMacCore_Start; + gpMacCore_SetDeviceDescriptor_Output_marshall_struct_t gpMacCore_SetDeviceDescriptor; + gpMacCore_GetDeviceDescriptor_Output_marshall_struct_t gpMacCore_GetDeviceDescriptor; + gpMacCore_GetDeviceTableEntries_Output_marshall_struct_t gpMacCore_GetDeviceTableEntries; + gpMacCore_SetKeyDescriptor_Output_marshall_struct_t gpMacCore_SetKeyDescriptor; + gpMacCore_GetKeyDescriptor_Output_marshall_struct_t gpMacCore_GetKeyDescriptor; + gpMacCore_SetSecurityLevelDescriptor_Output_marshall_struct_t gpMacCore_SetSecurityLevelDescriptor; + gpMacCore_GetSecurityLevelDescriptor_Output_marshall_struct_t gpMacCore_GetSecurityLevelDescriptor; + gpMacCore_GetSecurityLevelTableEntries_Output_marshall_struct_t gpMacCore_GetSecurityLevelTableEntries; + gpMacCore_GetPanId_Output_marshall_struct_t gpMacCore_GetPanId; + gpMacCore_GetExtendedAddress_Output_marshall_struct_t gpMacCore_GetExtendedAddress; + gpMacCore_GetMaxCsmaBackoffs_Output_marshall_struct_t gpMacCore_GetMaxCsmaBackoffs; + gpMacCore_GetDsn_Output_marshall_struct_t gpMacCore_GetDsn; + gpMacCore_GetCurrentChannel_Output_marshall_struct_t gpMacCore_GetCurrentChannel; + gpMacCore_GetNumberOfRetries_Output_marshall_struct_t gpMacCore_GetNumberOfRetries; + gpMacCore_GetFrameCounter_Output_marshall_struct_t gpMacCore_GetFrameCounter; + gpMacCore_GetRxOnWhenIdle_Output_marshall_struct_t gpMacCore_GetRxOnWhenIdle; + gpMacCore_GetShortAddress_Output_marshall_struct_t gpMacCore_GetShortAddress; + gpMacCore_GetTransmitPower_Output_marshall_struct_t gpMacCore_GetTransmitPower; + gpMacCore_GetPanCoordinator_Output_marshall_struct_t gpMacCore_GetPanCoordinator; + gpMacCore_GetSecurityEnabled_Output_marshall_struct_t gpMacCore_GetSecurityEnabled; + gpMacCore_GetTransactionPersistenceTime_Output_marshall_struct_t gpMacCore_GetTransactionPersistenceTime; + gpMacCore_GetBeaconStarted_Output_marshall_struct_t gpMacCore_GetBeaconStarted; + gpMacCore_GetPanCoordExtendedAddress_Output_marshall_struct_t gpMacCore_GetPanCoordExtendedAddress; + gpMacCore_GetCoordExtendedAddress_Output_marshall_struct_t gpMacCore_GetCoordExtendedAddress; + gpMacCore_GetCoordShortAddress_Output_marshall_struct_t gpMacCore_GetCoordShortAddress; + gpMacCore_GetAssociationPermit_Output_marshall_struct_t gpMacCore_GetAssociationPermit; + gpMacCore_GetBeaconPayload_Output_marshall_struct_t gpMacCore_GetBeaconPayload; + gpMacCore_GetBeaconPayloadLength_Output_marshall_struct_t gpMacCore_GetBeaconPayloadLength; + gpMacCore_GetMacVersion_Output_marshall_struct_t gpMacCore_GetMacVersion; + gpMacCore_GetIndicateBeaconNotifications_Output_marshall_struct_t gpMacCore_GetIndicateBeaconNotifications; + gpMacCore_GetCCAMode_Output_marshall_struct_t gpMacCore_GetCCAMode; + gpMacCore_GetMinBE_Output_marshall_struct_t gpMacCore_GetMinBE; + gpMacCore_GetPromiscuousMode_Output_marshall_struct_t gpMacCore_GetPromiscuousMode; + gpMacCore_GetForwardPollIndications_Output_marshall_struct_t gpMacCore_GetForwardPollIndications; + gpMacCore_GetMaxBE_Output_marshall_struct_t gpMacCore_GetMaxBE; + gpMacCore_AddNeighbour_Output_marshall_struct_t gpMacCore_AddNeighbour; + gpMacCore_RemoveNeighbour_Output_marshall_struct_t gpMacCore_RemoveNeighbour; + gpMacCore_SetDataPendingMode_Output_marshall_struct_t gpMacCore_SetDataPendingMode; + gpMacCore_GetCsmaMode_Output_marshall_struct_t gpMacCore_GetCsmaMode; + gpMacCore_ScheduleTimedTx_Output_marshall_struct_t gpMacCore_ScheduleTimedTx; + gpMacCore_DataPending_QueueAdd_Output_marshall_struct_t gpMacCore_DataPending_QueueAdd; + gpMacCore_DataPending_QueueRemove_Output_marshall_struct_t gpMacCore_DataPending_QueueRemove; + gpMacCore_SetMinInterferenceLevels_Output_marshall_struct_t gpMacCore_SetMinInterferenceLevels; + gpMacCore_DataPending_QueueClear_Output_marshall_struct_t gpMacCore_DataPending_QueueClear; + gpMacCore_DataPendingGetAckDataPending_Output_marshall_struct_t gpMacCore_DataPendingGetAckDataPending; + gpMacCore_GetStackInRawMode_Output_marshall_struct_t gpMacCore_GetStackInRawMode; + gpMacCore_GetCurrentTimeUs_Output_marshall_struct_t gpMacCore_GetCurrentTimeUs; + gpMacCore_ConfigureEnhAckProbing_Output_marshall_struct_t gpMacCore_ConfigureEnhAckProbing; + gpMacCore_GetRetransmitOnCcaFail_Output_marshall_struct_t gpMacCore_GetRetransmitOnCcaFail; + gpMacCore_GetRetransmitRandomBackoff_Output_marshall_struct_t gpMacCore_GetRetransmitRandomBackoff; + gpMacCore_GetMinBeRetransmit_Output_marshall_struct_t gpMacCore_GetMinBeRetransmit; + gpMacCore_GetMaxBeRetransmit_Output_marshall_struct_t gpMacCore_GetMaxBeRetransmit; + UInt8 dummy; //ensure none empty union definition +} gpMacCore_Server_Output_union_t; + +typedef union { +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbDataConfirm_Input_marshall_struct_t gpMacCore_cbDataConfirm; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbDataIndication_Input_marshall_struct_t gpMacCore_cbDataIndication; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbScanConfirm_Input_marshall_struct_t gpMacCore_cbScanConfirm; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbBeaconNotifyIndication_Input_marshall_struct_t gpMacCore_cbBeaconNotifyIndication; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbOrphanIndication_Input_marshall_struct_t gpMacCore_cbOrphanIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t gpMacCore_cbSecurityFailureCommStatusIndication; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbPollConfirm_Input_marshall_struct_t gpMacCore_cbPollConfirm; +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbPollIndication_Input_marshall_struct_t gpMacCore_cbPollIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbAssociateConfirm_Input_marshall_struct_t gpMacCore_cbAssociateConfirm; +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbAssociateIndication_Input_marshall_struct_t gpMacCore_cbAssociateIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbAssociateCommStatusIndication_Input_marshall_struct_t gpMacCore_cbAssociateCommStatusIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbOrphanCommStatusIndication_Input_marshall_struct_t gpMacCore_cbOrphanCommStatusIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_SCAN_ORPHAN_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbValidStack_Input_marshall_struct_t gpMacCore_cbValidStack; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbPurgeConfirm_Input_marshall_struct_t gpMacCore_cbPurgeConfirm; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbPollNotify_Input_marshall_struct_t gpMacCore_cbPollNotify; +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !(defined(GP_COMP_MACDISPATCHER)) + gpMacCore_cbSecurityFrameCounterIndication_Input_marshall_struct_t gpMacCore_cbSecurityFrameCounterIndication; +#endif /* !(defined(GP_COMP_MACDISPATCHER)) */ + UInt8 dummy; //ensure none empty union definition +} gpMacCore_Client_Input_union_t; + + +typedef union { +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbValidStack_Output_marshall_struct_t gpMacCore_cbValidStack; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + UInt8 dummy; //ensure none empty union definition +} gpMacCore_Client_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpMacCore_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_FrameType_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_FrameType_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_FrameType_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_FrameType_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_Command_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_Command_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_Command_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_Command_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_AddressMode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_AddressMode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_AddressMode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_AddressMode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIdLookupListEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIdLookupListEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIdLookupListEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIdLookupListEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyDeviceListEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyDeviceListEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyDeviceListEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyDeviceListEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyUsageListEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyUsageListEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyUsageListEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyUsageListEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyTablesEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyTablesEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyTablesEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyTablesEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_SecurityLevelTableEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_SecurityLevelTableEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_SecurityLevelTableEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_SecurityLevelTableEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIndex_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIndex_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIndex_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIndex_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIdMode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIdMode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIdMode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIdMode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_ScanType_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_ScanType_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_ScanType_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_ScanType_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_Attribute_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_Attribute_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_Attribute_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_Attribute_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_Index_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_Index_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_Index_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_Index_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_DeviceTablesEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_DeviceTablesEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_DeviceTablesEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_DeviceTablesEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_StackId_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_StackId_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_StackId_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_StackId_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_PanId_t_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_PanId_t_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_PanId_t_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_PanId_t_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_SuperFrameSpec_t_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_SuperFrameSpec_t_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_SuperFrameSpec_t_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_SuperFrameSpec_t_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_MacVersion_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_MacVersion_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_MacVersion_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_MacVersion_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_DataPendingMode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_DataPendingMode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_DataPendingMode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_DataPendingMode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_TxPower_t_buf2api(pDest, pSource, length, pIndex) Int8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_TxPower_t_api2buf(pDest, pSource, length, pIndex) Int8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_TxPower_t_buf2api_1(pDest, pSource, pIndex) Int8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_TxPower_t_api2buf_1(pDest, pSource, pIndex) Int8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +gpMarshall_AckStatus_t gpMacCore_DeviceDescriptor_t_buf2api(gpMacCore_DeviceDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_DeviceDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DeviceDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeyUsageDescriptor_t_buf2api(gpMacCore_KeyUsageDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_KeyUsageDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyUsageDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeyDeviceDescriptor_t_buf2api(gpMacCore_KeyDeviceDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_KeyDeviceDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyDeviceDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_Security_t_buf2api(gpMacCore_Security_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_Security_t_api2buf(UInt8Buffer* pDest , const gpMacCore_Security_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_AddressInfo_t_buf2api(gpMacCore_AddressInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_AddressInfo_t_api2buf(UInt8Buffer* pDest , const gpMacCore_AddressInfo_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_PanDescriptor_t_buf2api(gpMacCore_PanDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_PanDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_PanDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeyIdLookupDescriptor_t_buf2api(gpMacCore_KeyIdLookupDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_KeyIdLookupDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyIdLookupDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeyDescriptor_t_buf2api(gpMacCore_KeyDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_KeyDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SecurityLevelDescriptor_t_buf2api(gpMacCore_SecurityLevelDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_SecurityLevelDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_SecurityLevelDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_MultiChannelOptions_t_buf2api(gpMacCore_MultiChannelOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_MultiChannelOptions_t_api2buf(UInt8Buffer* pDest , const gpMacCore_MultiChannelOptions_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_TxTimingOptions_t_buf2api(gpMacCore_TxTimingOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_TxTimingOptions_t_api2buf(UInt8Buffer* pDest , const gpMacCore_TxTimingOptions_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DiagRxCntr_t_buf2api(gpMacCore_DiagRxCntr_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_DiagRxCntr_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DiagRxCntr_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DiagTxCntr_t_buf2api(gpMacCore_DiagTxCntr_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_DiagTxCntr_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DiagTxCntr_t* pSource , UInt16 length , UInt16* pIndex); + +// Union copy functions +gpMarshall_AckStatus_t gpMacCore_Address_t_buf2api(UInt8 unionid , gpMacCore_Address_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex); +void gpMacCore_Address_t_api2buf(UInt8 unionid , UInt8Buffer* pDest , const gpMacCore_Address_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeySource_t_buf2api(UInt8 unionid , gpMacCore_KeySource_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex); +void gpMacCore_KeySource_t_api2buf(UInt8 unionid , UInt8Buffer* pDest , const gpMacCore_KeySource_t* pSource , UInt16 length , UInt16* pIndex); + +// Server functions +gpMarshall_AckStatus_t gpMacCore_Reset_Input_buf2api(gpMacCore_Reset_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_Reset_Output_api2buf(UInt8Buffer* pDest , gpMacCore_Reset_Output_marshall_struct_t* pSourceoutput , gpMacCore_Reset_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DataRequest_Input_buf2api(gpMacCore_DataRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_ScanRequest_Input_buf2api(gpMacCore_ScanRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_AssociateRequest_Input_buf2api(gpMacCore_AssociateRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_AssociateResponse_Input_buf2api(gpMacCore_AssociateResponse_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_PollRequest_Input_buf2api(gpMacCore_PollRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_Start_Input_buf2api(gpMacCore_Start_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_Start_Output_api2buf(UInt8Buffer* pDest , gpMacCore_Start_Output_marshall_struct_t* pSourceoutput , gpMacCore_Start_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetSecurityEnabled_Input_buf2api(gpMacCore_SetSecurityEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDeviceDescriptor_Input_buf2api(gpMacCore_SetDeviceDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDeviceDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetDeviceDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetDeviceDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetDeviceDescriptor_Input_buf2api(gpMacCore_GetDeviceDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDeviceDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetDeviceDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetDeviceDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDeviceTableEntries_Input_buf2api(gpMacCore_SetDeviceTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDeviceTableEntries_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetDeviceTableEntries_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetKeyDescriptor_Input_buf2api(gpMacCore_SetKeyDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetKeyDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetKeyDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetKeyDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetKeyDescriptor_Input_buf2api(gpMacCore_GetKeyDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetKeyDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetKeyDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetKeyDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetKeyTableEntries_Input_buf2api(gpMacCore_SetKeyTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetSecurityLevelDescriptor_Input_buf2api(gpMacCore_SetSecurityLevelDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetSecurityLevelDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetSecurityLevelDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetSecurityLevelDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetSecurityLevelDescriptor_Input_buf2api(gpMacCore_GetSecurityLevelDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetSecurityLevelDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetSecurityLevelDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetSecurityLevelDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetSecurityLevelTableEntries_Input_buf2api(gpMacCore_SetSecurityLevelTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetSecurityLevelTableEntries_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetSecurityLevelTableEntries_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDefaultKeySource_Input_buf2api(gpMacCore_SetDefaultKeySource_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetShortAddress_Input_buf2api(gpMacCore_SetShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetExtendedAddress_Input_buf2api(gpMacCore_SetExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPanId_Input_buf2api(gpMacCore_SetPanId_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetPanId_Input_buf2api(gpMacCore_GetPanId_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPanId_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetPanId_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetPanId_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetFrameCounter_Input_buf2api(gpMacCore_SetFrameCounter_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDsn_Input_buf2api(gpMacCore_SetDsn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCurrentChannel_Input_buf2api(gpMacCore_SetCurrentChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetBeaconPayload_Input_buf2api(gpMacCore_SetBeaconPayload_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetBeaconPayloadLength_Input_buf2api(gpMacCore_SetBeaconPayloadLength_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetRxOnWhenIdle_Input_buf2api(gpMacCore_SetRxOnWhenIdle_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetExtendedAddress_Input_buf2api(gpMacCore_GetExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMaxCsmaBackoffs_Input_buf2api(gpMacCore_SetMaxCsmaBackoffs_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMaxCsmaBackoffs_Input_buf2api(gpMacCore_GetMaxCsmaBackoffs_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMaxCsmaBackoffs_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMaxCsmaBackoffs_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMaxCsmaBackoffs_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetDsn_Input_buf2api(gpMacCore_GetDsn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDsn_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetDsn_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetDsn_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCurrentChannel_Input_buf2api(gpMacCore_GetCurrentChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCurrentChannel_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCurrentChannel_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCurrentChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetNumberOfRetries_Input_buf2api(gpMacCore_SetNumberOfRetries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetNumberOfRetries_Input_buf2api(gpMacCore_GetNumberOfRetries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetNumberOfRetries_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetNumberOfRetries_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetNumberOfRetries_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetFrameCounter_Input_buf2api(gpMacCore_GetFrameCounter_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetFrameCounter_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetFrameCounter_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetFrameCounter_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetRxOnWhenIdle_Input_buf2api(gpMacCore_GetRxOnWhenIdle_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetRxOnWhenIdle_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetRxOnWhenIdle_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetRxOnWhenIdle_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetShortAddress_Input_buf2api(gpMacCore_GetShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetShortAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetShortAddress_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetShortAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPanCoordShortAddress_Input_buf2api(gpMacCore_SetPanCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPanCoordExtendedAddress_Input_buf2api(gpMacCore_SetPanCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetAssociationPermit_Input_buf2api(gpMacCore_SetAssociationPermit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDefaultTransmitPowers_Input_buf2api(gpMacCore_SetDefaultTransmitPowers_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetTransmitPower_Input_buf2api(gpMacCore_SetTransmitPower_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetTransmitPower_Input_buf2api(gpMacCore_GetTransmitPower_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetTransmitPower_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetTransmitPower_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetTransmitPower_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPanCoordinator_Input_buf2api(gpMacCore_SetPanCoordinator_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetPanCoordinator_Input_buf2api(gpMacCore_GetPanCoordinator_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPanCoordinator_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetPanCoordinator_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetPanCoordinator_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_OrphanResponse_Input_buf2api(gpMacCore_OrphanResponse_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetSecurityEnabled_Input_buf2api(gpMacCore_GetSecurityEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetSecurityEnabled_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetSecurityEnabled_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetSecurityEnabled_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetTransactionPersistenceTime_Input_buf2api(gpMacCore_GetTransactionPersistenceTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetTransactionPersistenceTime_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetTransactionPersistenceTime_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetTransactionPersistenceTime_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetTransactionPersistenceTime_Input_buf2api(gpMacCore_SetTransactionPersistenceTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetBeaconStarted_Input_buf2api(gpMacCore_SetBeaconStarted_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetBeaconStarted_Input_buf2api(gpMacCore_GetBeaconStarted_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconStarted_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetBeaconStarted_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetBeaconStarted_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpMacCore_GetPanCoordExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetPanCoordExtendedAddress_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCoordExtendedAddress_Input_buf2api(gpMacCore_SetCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCoordExtendedAddress_Input_buf2api(gpMacCore_GetCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCoordExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCoordExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCoordExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCoordShortAddress_Input_buf2api(gpMacCore_SetCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCoordShortAddress_Input_buf2api(gpMacCore_GetCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCoordShortAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCoordShortAddress_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCoordShortAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetAssociationPermit_Input_buf2api(gpMacCore_GetAssociationPermit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetAssociationPermit_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetAssociationPermit_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetAssociationPermit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetBeaconPayload_Input_buf2api(gpMacCore_GetBeaconPayload_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconPayload_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetBeaconPayload_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetBeaconPayload_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetBeaconPayloadLength_Input_buf2api(gpMacCore_GetBeaconPayloadLength_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconPayloadLength_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetBeaconPayloadLength_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetBeaconPayloadLength_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetIndicateBeaconNotifications_Input_buf2api(gpMacCore_SetIndicateBeaconNotifications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPromiscuousMode_Input_buf2api(gpMacCore_SetPromiscuousMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMacVersion_Input_buf2api(gpMacCore_SetMacVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMacVersion_Input_buf2api(gpMacCore_GetMacVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMacVersion_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMacVersion_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMacVersion_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_StackAdded_Input_buf2api(gpMacCore_StackAdded_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_StackRemoved_Input_buf2api(gpMacCore_StackRemoved_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetIndicateBeaconNotifications_Input_buf2api(gpMacCore_GetIndicateBeaconNotifications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetIndicateBeaconNotifications_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetIndicateBeaconNotifications_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetIndicateBeaconNotifications_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCCAMode_Input_buf2api(gpMacCore_SetCCAMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCCAMode_Input_buf2api(gpMacCore_GetCCAMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCCAMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCCAMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCCAMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMinBE_Input_buf2api(gpMacCore_SetMinBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMinBE_Input_buf2api(gpMacCore_GetMinBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMinBE_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMinBE_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMinBE_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetPromiscuousMode_Input_buf2api(gpMacCore_GetPromiscuousMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPromiscuousMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetPromiscuousMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetPromiscuousMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_PurgeRequest_Input_buf2api(gpMacCore_PurgeRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetForwardPollIndications_Input_buf2api(gpMacCore_SetForwardPollIndications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetForwardPollIndications_Input_buf2api(gpMacCore_GetForwardPollIndications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetForwardPollIndications_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetForwardPollIndications_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetForwardPollIndications_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMaxBE_Input_buf2api(gpMacCore_SetMaxBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMaxBE_Input_buf2api(gpMacCore_GetMaxBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMaxBE_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMaxBE_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMaxBE_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_AddNeighbour_Input_buf2api(gpMacCore_AddNeighbour_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_AddNeighbour_Output_api2buf(UInt8Buffer* pDest , gpMacCore_AddNeighbour_Output_marshall_struct_t* pSourceoutput , gpMacCore_AddNeighbour_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_RemoveNeighbour_Input_buf2api(gpMacCore_RemoveNeighbour_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_RemoveNeighbour_Output_api2buf(UInt8Buffer* pDest , gpMacCore_RemoveNeighbour_Output_marshall_struct_t* pSourceoutput , gpMacCore_RemoveNeighbour_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDataPendingMode_Input_buf2api(gpMacCore_SetDataPendingMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDataPendingMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetDataPendingMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetDataPendingMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetAddressModeOverrideForBeacons_Input_buf2api(gpMacCore_SetAddressModeOverrideForBeacons_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_ClearNeighbours_Input_buf2api(gpMacCore_ClearNeighbours_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCsmaMode_Input_buf2api(gpMacCore_SetCsmaMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCsmaMode_Input_buf2api(gpMacCore_GetCsmaMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCsmaMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCsmaMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCsmaMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_ScheduleTimedTx_Input_buf2api(gpMacCore_ScheduleTimedTx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_ScheduleTimedTx_Output_api2buf(UInt8Buffer* pDest , gpMacCore_ScheduleTimedTx_Output_marshall_struct_t* pSourceoutput , gpMacCore_ScheduleTimedTx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DataPending_QueueAdd_Input_buf2api(gpMacCore_DataPending_QueueAdd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueAdd_Output_api2buf(UInt8Buffer* pDest , gpMacCore_DataPending_QueueAdd_Output_marshall_struct_t* pSourceoutput , gpMacCore_DataPending_QueueAdd_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DataPending_QueueRemove_Input_buf2api(gpMacCore_DataPending_QueueRemove_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueRemove_Output_api2buf(UInt8Buffer* pDest , gpMacCore_DataPending_QueueRemove_Output_marshall_struct_t* pSourceoutput , gpMacCore_DataPending_QueueRemove_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMinInterferenceLevels_Input_buf2api(gpMacCore_SetMinInterferenceLevels_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMinInterferenceLevels_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetMinInterferenceLevels_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetMinInterferenceLevels_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DataPending_QueueClear_Input_buf2api(gpMacCore_DataPending_QueueClear_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueClear_Output_api2buf(UInt8Buffer* pDest , gpMacCore_DataPending_QueueClear_Output_marshall_struct_t* pSourceoutput , gpMacCore_DataPending_QueueClear_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpMacCore_DataPendingGetAckDataPending_Output_api2buf(UInt8Buffer* pDest , gpMacCore_DataPendingGetAckDataPending_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetStackInRawMode_Input_buf2api(gpMacCore_SetStackInRawMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetStackInRawMode_Input_buf2api(gpMacCore_GetStackInRawMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetStackInRawMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetStackInRawMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetStackInRawMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_EnableEnhancedFramePending_Input_buf2api(gpMacCore_EnableEnhancedFramePending_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCurrentTimeUs_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCurrentTimeUs_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_ConfigureEnhAckProbing_Input_buf2api(gpMacCore_ConfigureEnhAckProbing_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_ConfigureEnhAckProbing_Output_api2buf(UInt8Buffer* pDest , gpMacCore_ConfigureEnhAckProbing_Output_marshall_struct_t* pSourceoutput , gpMacCore_ConfigureEnhAckProbing_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetRetransmitOnCcaFail_Input_buf2api(gpMacCore_SetRetransmitOnCcaFail_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetRetransmitOnCcaFail_Input_buf2api(gpMacCore_GetRetransmitOnCcaFail_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetRetransmitOnCcaFail_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetRetransmitOnCcaFail_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetRetransmitOnCcaFail_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetRetransmitRandomBackoff_Input_buf2api(gpMacCore_SetRetransmitRandomBackoff_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetRetransmitRandomBackoff_Input_buf2api(gpMacCore_GetRetransmitRandomBackoff_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetRetransmitRandomBackoff_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetRetransmitRandomBackoff_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetRetransmitRandomBackoff_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMinBeRetransmit_Input_buf2api(gpMacCore_SetMinBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMinBeRetransmit_Input_buf2api(gpMacCore_GetMinBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMinBeRetransmit_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMinBeRetransmit_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMinBeRetransmit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMaxBeRetransmit_Input_buf2api(gpMacCore_SetMaxBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMaxBeRetransmit_Input_buf2api(gpMacCore_GetMaxBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMaxBeRetransmit_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMaxBeRetransmit_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMaxBeRetransmit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbDataConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpPd_Handle_t pdHandle , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbDataIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddrInfo , gpMacCore_AddressInfo_t* pDstAddrInfo , UInt8 dsn , gpMacCore_Security_t* pSecOptions , gpPd_Loh_t pdLoh , gpMacCore_StackId_t stackId , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbScanConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpMacCore_ScanType_t scanType , UInt32 unscannedChannels , UInt8 resultListSize , UInt8* pEdScanResultList , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbBeaconNotifyIndication_Input_par2api(UInt8Buffer* pDest , UInt8 bsn , gpMacCore_PanDescriptor_t* pPanDescriptor , gpMacCore_StackId_t stackId , UInt8 beaconPayloadLength , UInt8* pBeaconPayload , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbOrphanIndication_Input_par2api(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t rxTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbSecurityFailureCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddressInfo , gpMacCore_AddressInfo_t* pDstAddressInfo , gpMacCore_Result_t status , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbPollConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpMacCore_AddressInfo_t* coordAddrInfo , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbPollIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* addressInfo , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t rxTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbAssociateConfirm_Input_par2api(UInt8Buffer* pDest , UInt16 assocShortAddress , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbAssociateIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_Address_t* pDeviceAddress , UInt8 capabilityInformation , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t rxTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbAssociateCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddressInfo , gpMacCore_AddressInfo_t* pDstAddressInfo , gpMacCore_Result_t status , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbOrphanCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddressInfo , gpMacCore_AddressInfo_t* pDstAddressInfo , gpMacCore_Result_t status , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_SCAN_ORPHAN_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbValidStack_Input_par2api(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_cbValidStack_Output_buf2par(Bool* valid , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbPurgeConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpPd_Handle_t pdHandle , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbPollNotify_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* addressInfo , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t rxTime , gpPd_Handle_t pdHandle , Bool fromNeighbour , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !(defined(GP_COMP_MACDISPATCHER)) +void gpMacCore_cbSecurityFrameCounterIndication_Input_par2api(UInt8Buffer* pDest , UInt32 frameCounter , gpMacCore_StackId_t stackId , UInt16* pIndex); +#endif /* !(defined(GP_COMP_MACDISPATCHER)) */ + +// Client functions +void gpMacCore_Reset_Input_par2buf(UInt8Buffer* pDest , Bool setDefaultPib , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_Reset_Output_buf2par(gpMacCore_Result_t* result , Bool setDefaultPib , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressMode_t srcAddrMode , gpMacCore_AddressInfo_t* pDstAddressInfo , UInt8 txOptions , gpMacCore_Security_t* pSecOptions , gpMacCore_MultiChannelOptions_t multiChannelOptions , gpPd_Loh_t pdLoh , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_ScanRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_ScanType_t scanType , UInt32 scanChannels , UInt8 scanDuration , UInt8 resultListSize , UInt8* pEdScanResultList , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_AssociateRequest_Input_par2buf(UInt8Buffer* pDest , UInt8 logicalChannel , gpMacCore_AddressInfo_t* coordAddrInfo , UInt8 capabilityInformation , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_AssociateResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pDeviceAddress , UInt16 associateShortAddress , gpMacCore_Result_t status , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_PollRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* coordAddrInfo , gpMacCore_Security_t* pSecOptions , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_Start_Input_par2buf(UInt8Buffer* pDest , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_Start_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , Bool securityEnabled , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_SetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_GetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceTablesEntries_t deviceTableEntries , UInt16* pIndex); +void gpMacCore_GetDeviceTableEntries_Output_buf2par(gpMacCore_DeviceTablesEntries_t* deviceTableEntries , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_SetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_GetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetKeyTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyTablesEntries_t keyTableEntries , UInt16* pIndex); +void gpMacCore_SetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_SetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_GetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries , UInt16* pIndex); +void gpMacCore_GetSecurityLevelTableEntries_Output_buf2par(gpMacCore_SecurityLevelTableEntries_t* securityLevelTableEntries , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDefaultKeySource_Input_par2buf(UInt8Buffer* pDest , UInt8* pDefaultKeySource , UInt16* pIndex); +void gpMacCore_SetShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 shortAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pExtendedAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetPanId_Input_par2buf(UInt8Buffer* pDest , UInt16 panId , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPanId_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPanId_Output_buf2par(gpMacCore_PanId_t* panId , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetFrameCounter_Input_par2buf(UInt8Buffer* pDest , UInt32 frameCounter , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetDsn_Input_par2buf(UInt8Buffer* pDest , UInt8 dsn , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , UInt8* pBeaconPayload , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , UInt8 beaconPayloadLength , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , Bool rxOnWhenIdle , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetExtendedAddress_Output_buf2par(MACAddress_t* pExtendedAddress , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , UInt8 maxCsmaBackoffs , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxCsmaBackoffs_Output_buf2par(UInt8* maxCsmaBackoffs , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDsn_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetDsn_Output_buf2par(UInt8* dsn , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCurrentChannel_Output_buf2par(UInt8* channel , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , UInt8 numberOfRetries , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetNumberOfRetries_Output_buf2par(UInt8* numberOfRetries , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetFrameCounter_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetFrameCounter_Output_buf2par(UInt32* frameCounter , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRxOnWhenIdle_Output_buf2par(Bool* rxOnWhenIdle , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetShortAddress_Output_buf2par(UInt16* address , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetPanCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 panCoordShortAddress , UInt16* pIndex); +void gpMacCore_SetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pPanCoordExtendedAddress , UInt16* pIndex); +void gpMacCore_SetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , Bool associationPermit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetDefaultTransmitPowers_Input_par2buf(UInt8Buffer* pDest , Int8* pDefaultTransmitPowerTable , UInt16* pIndex); +void gpMacCore_SetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacCore_TxPower_t transmitPower , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetTransmitPower_Output_buf2par(Int8* transmitPower , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , Bool panCoordinator , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPanCoordinator_Output_buf2par(Bool* panCoordinator , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_OrphanResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , UInt16 shortAddress , Bool associatedMember , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetSecurityEnabled_Output_buf2par(Bool* securityEnabled , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetTransactionPersistenceTime_Output_buf2par(UInt16* time , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , UInt16 time , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , Bool BeaconStarted , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetBeaconStarted_Output_buf2par(Bool* BeaconStarted , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPanCoordExtendedAddress_Output_buf2par(MACAddress_t* pPanCoordExtendedAddress , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pPanCoordExtendedAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCoordExtendedAddress_Output_buf2par(MACAddress_t* pPanCoordExtendedAddress , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 panCoordShortAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCoordShortAddress_Output_buf2par(UInt16* panCoordShortAddress , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetAssociationPermit_Output_buf2par(Bool* associationPermit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetBeaconPayload_Output_buf2par(UInt8* pBeaconPayload , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetBeaconPayloadLength_Output_buf2par(UInt8* beaconPayloadLength , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , UInt8 promiscuousMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacCore_MacVersion_t macVersion , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMacVersion_Output_buf2par(gpMacCore_MacVersion_t* macVersion , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_StackAdded_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_StackRemoved_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetIndicateBeaconNotifications_Output_buf2par(Bool* enabled , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetCCAMode_Input_par2buf(UInt8Buffer* pDest , UInt8 cCAMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCCAMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCCAMode_Output_buf2par(UInt8* cCAMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMinBE_Input_par2buf(UInt8Buffer* pDest , UInt8 minBE , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMinBE_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMinBE_Output_buf2par(UInt8* minBE , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPromiscuousMode_Output_buf2par(Bool* promiscuousMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_PurgeRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetForwardPollIndications_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMaxBE_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBE , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxBE_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxBE_Output_buf2par(UInt8* maxBE , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_AddNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_AddNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_RemoveNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_RemoveNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDataPendingMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetDataPendingMode_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetAddressModeOverrideForBeacons_Input_par2buf(UInt8Buffer* pDest , UInt8 addressMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_ClearNeighbours_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetCsmaMode_Input_par2buf(UInt8Buffer* pDest , UInt8 csmaMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCsmaMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCsmaMode_Output_buf2par(UInt8* csmaMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_ScheduleTimedTx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacCore_TxTimingOptions_t timingOptions , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_ScheduleTimedTx_Output_buf2par(gpMacCore_Result_t* result , gpPd_Handle_t pdHandle , gpMacCore_TxTimingOptions_t timingOptions , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueAdd_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_DataPending_QueueAdd_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueRemove_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_DataPending_QueueRemove_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMinInterferenceLevels_Input_par2buf(UInt8Buffer* pDest , Int8* pInterferenceLevels , UInt16* pIndex); +void gpMacCore_SetMinInterferenceLevels_Output_buf2par(gpMacCore_Result_t* result , Int8* pInterferenceLevels , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueClear_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_DataPending_QueueClear_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPendingGetAckDataPending_Output_buf2par(Bool* pending , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , Bool rawModeEnabled , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetStackInRawMode_Output_buf2par(Bool* rawModeEnabled , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_EnableEnhancedFramePending_Input_par2buf(UInt8Buffer* pDest , Bool enableEnhancedFramePending , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCurrentTimeUs_Output_buf2par(UInt32* currentTime , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_ConfigureEnhAckProbing_Input_par2buf(UInt8Buffer* pDest , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_ConfigureEnhAckProbing_Output_buf2par(gpMacCore_Result_t* result , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRetransmitOnCcaFail_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRetransmitRandomBackoff_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 minBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMinBeRetransmit_Output_buf2par(UInt8* minBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxBeRetransmit_Output_buf2par(UInt8* maxBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbDataConfirm_Input_buf2api(gpMacCore_cbDataConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbDataIndication_Input_buf2api(gpMacCore_cbDataIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbScanConfirm_Input_buf2api(gpMacCore_cbScanConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbBeaconNotifyIndication_Input_buf2api(gpMacCore_cbBeaconNotifyIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbOrphanIndication_Input_buf2api(gpMacCore_cbOrphanIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbSecurityFailureCommStatusIndication_Input_buf2api(gpMacCore_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbPollConfirm_Input_buf2api(gpMacCore_cbPollConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbPollIndication_Input_buf2api(gpMacCore_cbPollIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbAssociateConfirm_Input_buf2api(gpMacCore_cbAssociateConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbAssociateIndication_Input_buf2api(gpMacCore_cbAssociateIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbAssociateCommStatusIndication_Input_buf2api(gpMacCore_cbAssociateCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbOrphanCommStatusIndication_Input_buf2api(gpMacCore_cbOrphanCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_SCAN_ORPHAN_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbValidStack_Input_buf2api(gpMacCore_cbValidStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_cbValidStack_Output_api2buf(UInt8Buffer* pDest , gpMacCore_cbValidStack_Output_marshall_struct_t* pSourceoutput , gpMacCore_cbValidStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbPurgeConfirm_Input_buf2api(gpMacCore_cbPurgeConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbPollNotify_Input_buf2api(gpMacCore_cbPollNotify_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !(defined(GP_COMP_MACDISPATCHER)) +gpMarshall_AckStatus_t gpMacCore_cbSecurityFrameCounterIndication_Input_buf2api(gpMacCore_cbSecurityFrameCounterIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* !(defined(GP_COMP_MACDISPATCHER)) */ + +void gpMacCore_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPMACCORE_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/inc/gpMacCore.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/inc/gpMacCore.h new file mode 100644 index 0000000..952189d --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/inc/gpMacCore.h @@ -0,0 +1,1731 @@ +/* + * Copyright (c) 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2022, Qorvo Inc + * + * gpMacCore.h + * This file contains the definitions of the public functions and enumerations of the gpMacCore.(based on IEEE802.15.4-2006) + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GP_MACCORE_H_ +#define _GP_MACCORE_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpEncryption.h" +/** + * @file gpMacCore.h + * + * The Core functionality of the Mac layer is implemented in these functions. + * + * @defgroup INIT Initialization + * This module groups the primitives for the Initialization procedure. + * + * @defgroup MLME_DATA MLME-DATA primitives + * This module groups the primitives for data transmission. + * + * To transmit a data package the origniator needs to: + * - use gpPd_GetPd() to claim memory that will be used to write the data payload into the radio chip + * - trigger gpMacCore_DataRequest() with the claimed memory handle + * - wait until the gpMacCore_cbDataConfirm() callback has been called + * - use gpPd_FreePd(pdHandle) to free the claimed memory + * + * The receiving device should handle an incomming packet as follows: + * - gpMacCore_cbDataIndication() callback indicating the data was received + * - after reading the data from the radio chip with the gpPd_ReadByteStream((pdHandle, nsduOffset) function, + * use gpPd_FreePd(pdHandle) to free the memory + * + * @defgroup MLME_SAP MLME-SAP primitives + * This module groups the primitives for management commands. + * + * - gpMacCore_AssociateRequest() to initiate the association procedure + * - gpMacCore_AssociateResponse() the response + * - gpMacCore_cbBeaconNotifyIndication() + * - gpMacCore_PollRequest() + * - gpMacCore_Reset() + * - gpMacCore_ScanRequest() to initiate a scan process + * +*/ + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_DIVERSITY_NR_OF_STACKS +#define GP_DIVERSITY_NR_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS + +#define GP_MACCORE_PANID_BROADCAST 0xFFFF +#define GP_MACCORE_SHORT_ADDR_BROADCAST 0xFFFF +#define GP_MACCORE_SHORT_ADDR_UNALLOCATED 0xFFFE + +#define GP_MACCORE_MULTICHANNEL_MAX_CHANNELS 3 +#define GP_MACCORE_INVALID_CHANNEL 0xFF + +// phy definitions +/** @brief The minimal value that the header overhead can be in a frame (2 bytes framecontrol + 1 byte sequence number + 2 bytes FCS), as specified in the IEEE802.15.4-2006 spec.*/ +#define GP_MACCORE_MIN_FRAME_OVERHEAD 5 /* 2 framecontrol + 1 sequence number + 2 FCS */ +/** @brief The maximal number of bytes the header overhead can be in a beacon, as specified in the IEEE802.15.4-2006 spec.*/ +#define GP_MACCORE_MAX_BEACON_OVERHEAD 75 +/** @brief The maximal PHY length of a packet (in bytes), as specified in the IEEE802.15.4-2006 spec.*/ +#define GP_MACCORE_MAX_PHY_PACKET_SIZE 127 +/** @brief The maximal PHY length of a packet (in bytes), as specified in the IEEE802.15.4-2006 spec without the CRC bytes.*/ +#define GP_MACCORE_MAX_PHY_PACKET_SIZE_NO_FCS 125 +/** @brief The maximal length of the MAC payload (in bytes), as specified in the IEEE802.15.4-2006 spec.*/ +#define GP_MACCORE_MAX_MAC_FRAME_SIZE (GP_MACCORE_MAX_PHY_PACKET_SIZE - GP_MACCORE_MIN_FRAME_OVERHEAD) +/** @brief The maximal length of the beacon payload (in bytes), as specified in the IEEE802.15.4-2006 spec*/ +#define GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH GP_MACCORE_MAX_PHY_PACKET_SIZE - GP_MACCORE_MAX_BEACON_OVERHEAD +/** @brief The maximum number of octets added by the MAC sublayer to the PSDU without security, as specified in the IEEE 802.15.4 spec*/ +#define GP_MACCORE_MAX_MPDU_UNSECURED_OVERHEAD 25 // 23 bytes MAC Header + 2 bytes MAC footer +/** @brief The maximum number of octets that can be transmitted in the MAC Payload field of an unsecured MAC frame that will be guaranteed not to exceed aMaxPHYPacketSize., as specified in the IEEE 802.15.4 spec*/ +#define GP_MACCORE_MAX_MAC_SAVE_PAYLOAD_SIZE (GP_MACCORE_MAX_PHY_PACKET_SIZE - GP_MACCORE_MAX_MPDU_UNSECURED_OVERHEAD) + +/** @brief The number of symbols forming a superframe slot when the superframe order is equal to 0. */ +#define GP_MACCORE_BASE_SLOT_DURATION 60 +/** @brief The number of slots contained in any superframe. */ +#define GP_MACCORE_NUM_SUPERFRAME_SLOTS 16 +/** @brief The number of symbols forming a superframe when the superframe order is equal to 0. + * As it's defined in symbols, 960 needs to be multipled by 16us to get time in us = 15360us */ +#define GP_MACCORE_BASE_SUPERFRAME_DURATION GP_MACCORE_BASE_SLOT_DURATION*GP_MACCORE_NUM_SUPERFRAME_SLOTS +/** @brief Maximum scan duration that can be given to a San Request primitive. + * Actual scan window time is calculated with 'aBaseSuperframeDuration * (2^n + 1)' = 960 * 16 * (2^n + 1). + * A scanduration of 4 will give +- 260ms. */ +#define GP_MACCORE_MAX_SCAN_DURATION 14 + +/** @brief Maximum header byte size without security fields (23 bytes) */ +#define GP_MACCORE_MAX_MAC_HEADER_SIZE 23 +/** @brief Maximum security header byte size, consisting of security control (1), frame contorl (4) and keyIdentifier (0/1/5/9). */ +#define GP_MAC_MAX_MACCORE_SECURITY_PART_HEADER_SIZE 14 +/** @brief Maximum header byte size including security fields (23+14 = 37 bytes) */ +#define GP_MACCORE_MAX_MAC_SECURED_HEADER_SIZE (GP_MACCORE_MAX_MAC_HEADER_SIZE + GP_MAC_MAX_MACCORE_SECURITY_PART_HEADER_SIZE) + +// MAC constants +/** @brief The symbol duration in microseconds. Two symbols correspond to 1 transmitted byte. */ +#define GP_MACCORE_SYMBOL_DURATION 16 //us/symbool + +/** @brief RX-to-TX or TX-to-RX maximum turnaround time (in symbol periods). + * As specified in IEEE802.15.4-2006 paragraph 6.4.1. + */ +#define GP_MACCORE_TX_TO_RX_TURNAROUNDTIME 12 /* symbols */ +#define GP_MACCORE_RX_TO_TX_TURNAROUNDTIME 12 /* symbols */ +/** @brief The PHY header size in octets. + * As specified in IEEE802.15.4-2006 paragraph 6.3 PPDU format. + */ +#define GP_MACCORE_PHYHEADER_OCTETS (4 + 1 + 1) /* actual preamble + sdf + len field */ + +/** @brief The number of bits per modulation symbol. + * As specified in IEEE802.15.4-2006 paragraph 6.5 2450 MHz PHY specifications. + */ +#define GP_MACCORE_PHY_BITS_PER_SYMBOL 4 + +/** @brief The size of an ACK frame PDU without an encryption header in octets. + * As specified in IEEE802.15.4-2006 paragraph 7.2.2.3 Acknowledgment frame format. + */ +#define GP_MACCORE_MAX_PHY_ACK_PACKET_SIZE 5 + +/** @brief The size of an Enhanced ACK frame PDU with an encryption header in octets. + * As specified in IEEE802.15.4-2015 paragraph 7.3.3 Acknowledgment frame format. + * The current max value is the value with: + * Short Source addressing, Source Dest addressing, PanID compression, Aux header, + * One Thread CSL IE, and HT2 header termination. + */ +#define GP_MACCORE_MAX_PHY_ENHACK_PACKET_SIZE 29 + +/** @brief Max duration in us for transmitting a frame and receiving the corresponding ACK, without the CSMA time + */ +#define GP_MACCORE_MAX_TXFRAME_PLUS_RXACK_TIME(ack_size) ( (GP_MACCORE_RX_TO_TX_TURNAROUNDTIME * GP_MACCORE_SYMBOL_DURATION) + \ + ( ( GP_MACCORE_PHYHEADER_OCTETS + GP_MACCORE_MAX_PHY_PACKET_SIZE ) * \ + 8 / GP_MACCORE_PHY_BITS_PER_SYMBOL * GP_MACCORE_SYMBOL_DURATION) + \ + (GP_MACCORE_TX_TO_RX_TURNAROUNDTIME * GP_MACCORE_SYMBOL_DURATION) + \ + ( ( GP_MACCORE_PHYHEADER_OCTETS + ack_size ) * \ + 8 / GP_MACCORE_PHY_BITS_PER_SYMBOL * GP_MACCORE_SYMBOL_DURATION) \ + ) + +#define GP_MACCORE_MAX_TXFRAME_PLUS_RXNORMALACK_TIME GP_MACCORE_MAX_TXFRAME_PLUS_RXACK_TIME(GP_MACCORE_MAX_PHY_ACK_PACKET_SIZE) +#define GP_MACCORE_MAX_TXFRAME_PLUS_RXENHACK_TIME GP_MACCORE_MAX_TXFRAME_PLUS_RXACK_TIME(GP_MACCORE_MAX_PHY_ENHACK_PACKET_SIZE) + + +/** @brief The acknowledge duration time is used to define the time that the receiver stays + * enable waiting for an acknowledge frame after a transmitted packet that requires + * an acknowledge frame. + */ +#define GP_MACCORE_ACK_WAIT_DURATION 54 +/** @brief The channel mask of the supported channels. Bit 0 correspond to channel 0, bit 1 to channel 1,.... */ +#define GP_MACCORE_CHANNELS_SUPPORTED 0x3FF800 + +/** Scan duration for ScanTypeEDWifiBeacon in microseconds (typical Wifi beacon interval is 100 ms) */ +#define GP_MACCORE_WIFI_BEACON_SCAN_DURATION MS_TO_US(103) + +/** @brief The maximum number of octets that can be transmitted in the MAC Payload field.*/ +#define GP_MACCORE_MAX_MAC_SAFE_PAYLOAD_SIZE (GP_MACCORE_MAX_PHY_PACKET_SIZE - GP_MACCORE_MAX_MPDU_UNSECURED_OVERHEAD) + +// Scan related defines +#ifndef GP_MACCORE_SCAN_RXOFFWINDOW_TIME_US +#define GP_MACCORE_SCAN_RXOFFWINDOW_TIME_US 0 +#endif //GP_MACCORE_SCAN_RXOFFWINDOW_TIME_US + +// Security related defines +#ifndef GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS 5 +#endif //GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS + +#ifndef GP_MACCORE_NUMBER_OF_DEVICE_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_DEVICE_DESCRIPTORS 5 +#endif //GP_MACCORE_NUMBER_OF_DEVICE_DESCRIPTORS + +#ifndef GP_MACCORE_NUMBER_OF_KEY_DESCRIPTOR_ENTRIES +#define GP_MACCORE_NUMBER_OF_KEY_DESCRIPTOR_ENTRIES 5 +#endif //GP_MACCORE_NUMBER_OF_KEY_DESCRIPTOR_ENTRIES + +#ifndef GP_MACCORE_NUMBER_OF_SECURITY_LEVEL_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_SECURITY_LEVEL_DESCRIPTORS 1 +#endif //GP_MACCORE_NUMBER_OF_SECURITY_LEVEL_DESCRIPTORS + +#ifndef GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS 3 +#endif //GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS + +#ifndef GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS 2 +#endif //GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS + +/** @brief Return stack identifier when no stack is found */ +#define GP_MACCORE_STACK_UNDEFINED 0xff + +// Compile time definitions to optimize single stack code size +#if (GP_DIVERSITY_NR_OF_STACKS > 1) || (defined(GP_DIVERSITY_JUMPTABLES)) +#define MACCORE_STACKID_REF stackId +#define MACCORE_STACKID_ARG_1 gpMacCore_StackId_t MACCORE_STACKID_REF +#define MACCORE_STACKID_ARG_2 ,gpMacCore_StackId_t MACCORE_STACKID_REF +#define MACCORE_STACKID_MAP_1(stackId) stackId +#define MACCORE_STACKID_MAP_2(a,stackId) a,stackId +#define MACCORE_STACKID_MAP_4(a,b,c,stackId) a,b,c,stackId +#else //(GP_DIVERSITY_NR_OF_STACKS > 1) || (defined(GP_DIVERSITY_JUMPTABLES)) +#define MACCORE_STACKID_REF 0 +#define MACCORE_STACKID_ARG_1 void +#define MACCORE_STACKID_ARG_2 +#define MACCORE_STACKID_MAP_1(stackId) +#define MACCORE_STACKID_MAP_2(a,stackId) a +#define MACCORE_STACKID_MAP_4(a,b,c,stackId) a,b,c +#endif //(GP_DIVERSITY_NR_OF_STACKS > 1) || (defined(GP_DIVERSITY_JUMPTABLES)) + +// Different Tx option settings +#define GP_MACCORE_TX_OPT_NONE 0x00 +/** @brief Enable ACK request for this packet Data Request */ +#define GP_MACCORE_TX_OPT_ACK_REQ 0x01 +/** @brief Enable GTS transmission for this packet Data Request */ +#define GP_MACCORE_TX_OPT_GTS 0x02 +/** @brief Send packet as an indirect transmission. Packet will be buffered untill polled successfully or expired. */ +#define GP_MACCORE_TX_OPT_INDIRECT 0x04 +/** @brief Keep the framecounter value as specified by the higher layers in the frame during the raw encryption. */ +#define GP_MACCORE_TX_OPT_RAW_KEEP_FRAMECOUNTER 0x08 +//Following options are not defined in spec - added for DataRequest API purposes +/** @brief Enable Transmission via scheduled HW TX queue. */ +#define GP_MACCORE_TX_OPT_TIMEDTX 0x10 +/** @brief Use a raw transmission of the payload. No MAC header is added or security applied. + * To be used when above layer handles the full packet formatting.*/ +#define GP_MACCORE_TX_OPT_RAW 0x20 +/** @brief Perform a direct transmission, but as a response to a previous poll/datarequest. */ +#define GP_MACCORE_TX_OPT_INJECT 0x40 +/** @brief Set the data pending bit in the Packet header. + This is handled automatically for indirect queued packets according to the queue contents. */ +#define GP_MACCORE_TX_OPT_MORE_DATA_PENDING 0x80 + +#define GP_MACCORE_INDIRECT_TRANSMISSION_ENABLED(txOptions) (txOptions & GP_MACCORE_TX_OPT_INDIRECT) +#define GP_MACCORE_INDIRECT_TRANSMISSION_CLEAR(txOptions) (txOptions&=~GP_MACCORE_TX_OPT_INDIRECT) + +#define GP_MACCORE_INJECT_ENABLED(txOptions) (txOptions & GP_MACCORE_TX_OPT_INJECT) +#define GP_MACCORE_INJECT_CLEAR(txOptions) (txOptions&=~GP_MACCORE_TX_OPT_INJECT) + +#define GP_MACCORE_TIMEDTX_ENABLED(txOptions) (txOptions & GP_MACCORE_TX_OPT_TIMEDTX) + +#define GP_MACCORE_ADDRESSMODE_NONE(mode) (mode == gpMacCore_AddressModeNoAddress) +#define GP_MACCORE_ADDRESSMODE_RESERVED(mode) (mode == gpMacCore_AddressModeReserved) +#define GP_MACCORE_ADDRESSMODE_SHORT(mode) (mode == gpMacCore_AddressModeShortAddress) +#define GP_MACCORE_ADDRESSMODE_EXTENDED(mode) (mode == gpMacCore_AddressModeExtendedAddress) + +#define GP_MACCORE_IS_SHORT_ADDR_BROADCAST(addr) (addr == GP_MACCORE_SHORT_ADDR_BROADCAST) +#define GP_MACCORE_IS_SHORT_ADDR_UNALLOCATED(addr) (addr == GP_MACCORE_SHORT_ADDR_UNALLOCATED) + +#define GP_MACCORE_NO_SECURITY_SPECIFIED(pSecOptions) (pSecOptions == NULL || pSecOptions->securityLevel == gpEncryption_SecLevelNothing) + +#define GP_MACCORE_CHECK_CHANNEL_VALID(channel) (((channel) >= 11) && ((channel) <= 26)) + +// shortcut to use checks in if statement (that can be omitted when assert level does not match) +#define GP_MACCORE_CHECK_IF(check) (GP_ASSERT_IF(GP_DIVERSITY_ASSERT_LEVEL_DEV_EXT, check)) + +// regular check macro's (to be used anywhere, cannot be ommitted during compilation) +#define GP_MACCORE_CHECK_ADDRESSMODE_NONE(mode) (mode != gpMacCore_AddressModeNoAddress) +#define GP_MACCORE_CHECK_ADDRESSMODE_VALID(mode) (mode != gpMacCore_AddressModeReserved && mode <= gpMacCore_AddressModeExtendedAddress) +#define GP_MACCORE_CHECK_ADDRESSINFO_VALID(info) (info != NULL && GP_MACCORE_CHECK_ADDRESSMODE_VALID(info->addressMode)) +#define GP_MACCORE_CHECK_ADDRESSMODE_PRESENT(mode) (mode == gpMacCore_AddressModeShortAddress || mode == gpMacCore_AddressModeExtendedAddress) +#define GP_MACCORE_CHECK_SCANTYPE_VALID(type) ((type != gpMacCore_ScanTypePassive && type <= gpMacCore_ScanTypeOrphan) || (type >= gpMacCore_ScanTypeRSSI && type <= gpMacCore_ScanTypeAIMasked) ) +#define GP_MACCORE_CHECK_SCANDURATION_VALID(duration) (duration <= GP_MACCORE_MAX_SCAN_DURATION || duration == 0xFF) +#define GP_MACCORE_CHECK_TXOPTIONS_VALID(options) (!GP_MACCORE_INDIRECT_TRANSMISSION_ENABLED(options)) + +// special check-if macro's that return true when check is false (to be used inside if statement, can be ommited when assert level does not match) +#define GP_MACCORE_CHECK_IF_ADDRESSMODE_NOT_NONE(mode) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_ADDRESSMODE_NONE(mode))) +#define GP_MACCORE_CHECK_IF_ADDRESSMODE_INVALID(mode) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_ADDRESSMODE_VALID(mode))) +#define GP_MACCORE_CHECK_IF_ADDRESSINFO_INVALID(info) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_ADDRESSINFO_VALID(info))) +#define GP_MACCORE_CHECK_IF_ADDRESSMODE_NOT_PRESENT(mode) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_ADDRESSMODE_PRESENT(mode))) +#define GP_MACCORE_CHECK_IF_SCANTYPE_INVALID(type) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_SCANTYPE_VALID(type))) +#define GP_MACCORE_CHECK_IF_SCANDURATION_INVALID(duration) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_SCANDURATION_VALID(duration))) +#define GP_MACCORE_CHECK_IF_TXOPTIONS_INVALID(options) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_TXOPTIONS_VALID(options))) + +#define GP_MACCORE_DEFAULT_TRANSACTION_PERSISTENCE_TIME 0x01F4 + +#define GP_MACCORE_STATISTICS_ALL_DEVICES 0xFFFF + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt8 gpMacCore_StackId_t; + +/** @name gpMacCore_Result_t */ +//@{ +//PHY results +/** @brief The requested operation was completed successfully. For instance if a transmission was requested, this value indicates a successful transmission.*/ +#define gpMacCore_ResultSuccess 0x0 +//MAC results +/** @brief The frame counter purportedly applied by the originator of the received frame is invalid. */ +#define gpMacCore_ResultCounterError 0xdb +/** @brief The key purportedly applied by the originator of the received frame is not allowed to be used with that frame type according to the key usage policy of the recipient.*/ +#define gpMacCore_ResultImproperKeyType 0xdc +/** @brief The security level purportedly applied by the originator of the received frame does not meet the minimum security level required/expected by the recipient for that frame type.*/ +#define gpMacCore_ResultImproperSecurityLevel 0xdd +/** @brief The received frame was purportedly secured using security based on IEEE Std 802.15.4-2003, and such security is not supported by this standard. */ +#define gpMacCore_ResultUnsupportedLegacy 0xde +/** @brief The security purportedly applied by the originator of the received frame is not supported. */ +#define gpMacCore_ResultUnsupportedSecurity 0xdf +/** @brief The beacon was lost following a synchronization request. */ +#define gpMacCore_ResultBeaconLoss 0xe0 +/** @brief A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed. */ +#define gpMacCore_ResultChannelAccessFailure 0xe1 +/** @brief The GTS request has been denied by the PAN coordinator. */ +#define gpMacCore_ResultDenied 0xe2 +/** @brief The attempt to disable the transceiver has failed. */ +#define gpMacCore_ResultDisableTrxFailure 0xe3 +/** @brief The received frame induces a failed security check according to the security suite. */ +#define gpMacCore_ResultSecurityError 0xe4 +/** @brief The frame resulting from secure processing has a length that is greater than aMACMaxFrameSize. */ +#define gpMacCore_ResultFrameTooLong 0xe5 +/** @brief The requested GTS transmission failed because the specified GTS either did not have a transmit GTS direction or was not defined. */ +#define gpMacCore_ResultInvalidGTS 0xe6 +/** @brief A request to purge an MSDU from the transaction queue wasmade using an MSDU handle that was not found in the transaction table. */ +#define gpMacCore_ResultInvalidHandle 0xe7 +/** @brief A parameter in the primitive is out of the valid range. */ +#define gpMacCore_ResultInvalidParameter 0xe8 +/** @brief No acknowledgment was received after aMaxFrameRetries. */ +#define gpMacCore_ResultNoAck 0xe9 +/** @brief A scan operation failed to find any network beacons. */ +#define gpMacCore_ResultNoBeacon 0xea +/** @brief No response data was available following a request. */ +#define gpMacCore_ResultNoData 0xeb +/** @brief The operation failed because a short address was not allocated. */ +#define gpMacCore_ResultNoShortAddress 0xec +/** @brief A request to enable the receiver was unsuccessful because it could not be completed within the CAP. */ +#define gpMacCore_ResultOutOfCAP 0xed +/** @brief A PAN identifier conflict has been detected and communicated to the PAN coordinator. */ +#define gpMacCore_ResultPanIdConflict 0xee +/** @brief A coordinator realignment command has been received. */ +#define gpMacCore_ResultRealignment 0xef +/** @brief The transaction has expired and its information is discarded. */ +#define gpMacCore_ResultTransactionExpired 0xf0 +/** @brief There is no capacity to store the transaction. */ +#define gpMacCore_ResultTransactionOverflow 0xf1 +/** @brief The transceiver was transmitting when the receiver was requested to be enabled. */ +#define gpMacCore_ResultTxActive 0xf2 +/** @brief The appropriate key is not available in the ACL. */ +#define gpMacCore_ResultUnavailableKey 0xf3 +/** @brief A SET/GET request was issued with the identifier of a PIBattribute that is not supported. */ +#define gpMacCore_ResultUnsupportedAttribute 0xf4 +/** @brief A request to send data was unsuccessful because neither the source address parameters nor the destination address parameters were present.*/ +#define gpMacCore_ResultInvalidAddress 0xf5 +/** @brief A receiver enable request was unsuccessful because it specified a number of symbols that was longer than the beacon interval. */ +#define gpMacCore_ResultOnTimeTooLong 0xf6 +/** @brief A receiver enable request was unsuccessful because it could not be completed within the current superframe and was not permitted to be deferred until the next superframe. */ +#define gpMacCore_ResultPastTime 0xf7 +/** @brief The device was instructed to start sending beacons based on the timing of the beacon transmissions of its coordinator, but the device is not currently tracking the beacon of its coordinator.*/ +#define gpMacCore_ResultTrackingOff 0xf8 +/** @brief An attempt to write to a MAC PIB attribute that is in a table failed because the specified table index was out of range.*/ +#define gpMacCore_ResultInvalidIndex 0xf9 +/** @brief A scan operation terminated prematurely because the number of PAN descriptors stored reached an implementation specified maximum.*/ +#define gpMacCore_ResultLimitReached 0xfa +/** @brief A SET/GET request was issued with the identifier of an attribute that is read only. */ +#define gpMacCore_ResultReadOnly 0xfb +/** @brief A request to perform a scan operation failed because the MLME was in the process of performing a previously initiated scan operation. */ +#define gpMacCore_ResultScanInProgress 0xfc +/** @brief The device was instructed to start sending beacons based on the timing of the beacon transmissions of its coordinator, but the instructed start time overlapped the transmission time of the beacon of its coordinator. */ +#define gpMacCore_ResultSuperframeOverlap 0xfd +/** @typedef gpMacCore_Result_t + * @brief The gpMacCore_Result_t type defines the result as defined by the IEEE802.15.4 MAC. Not all the possible values are used by the non-beaconed MAC. +*/ +typedef UInt8 gpMacCore_Result_t; +//@} + +/** @name gpMacCore_Attribute_t */ +//@{ +// phy attr +/** @brief The IEEE802.15.4-2006 channel to use for all following transmissions and receptions.*/ +#define gpMacCore_AttributeCurrentChannel 0x0 /* The RF channel to be used for all following transmissions and receptions */ +/** @brief The 5 most significant bits (MSBs) (b27,... ,b31) of ChannelsSupported shall be reserved and set to 0, and the 27 LSBs (b0,b1, ... b26) shall indicate the status(1=available, 0=unavailable) for each of the 27 valid channels. */ +#define gpMacCore_AttributeChannelsSupported 0x1 /* Supported channel mask from bit 0 to bit 27 */ +/** @brief The 2 MSBs represent the tolerance on the transmit power: 00 = +- 1 dB 01 = +- 3 dB 10 = +- 6 dB The 6 LSBs represent a signed integer in twos-complement format, corresponding to the nominal transmit power of the device in decibels relative to 1 mW. The lowest value of phyTransmitPower shall be interpreted as less than or equal to +-32 dBm. */ +#define gpMacCore_AttributeTransmitPower 0x2 /* Transmit pozer in mdB */ +/** @brief The CCA mode to use. Three CCA modes (1-3) are defined as specified in the IEEE802.15.4-2006 standard. */ +#define gpMacCore_AttributeCCAMode 0x3 /* CCA mode */ +// mac attr +/** @brief The maximum number of symbols to wait for an acknowledgment frame to arrive following a transmitted data frame. */ +#define gpMacCore_AttributeAckWaitDuration 0x40 +//#define gpMacCore_AttributeMacBattLifeExt 0x43 +//#define gpMacCore_AttributeBattLifeExtPeriods 0x44 +/** @brief The extended 64 bit IEEE802.15.4-2006 MAC address of the coordinator of the network the device has joined. */ +#define gpMacCore_AttributeCoordExtendedAddress 0x4A +/** @brief The 16 bit short address assigned to the coordinator with which the device is associated. A value of 0xfffe indicates that the coordinator is only using its 64 bit extended address. A value of 0xffff indicates that this value is unknown. */ +#define gpMacCore_AttributeCoordShortAddress 0x4B +/** @brief The sequence number added to the data or MAC command frames to be transmitted. */ +#define gpMacCore_AttributeDSN 0x4C +/** @brief The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access failure. */ +#define gpMacCore_AttributeMaxCsmaBackoffs 0x4E +/** @brief The minimum value of the backoff exponent in the CSMA-CA algorithm. Note that if this value is set to 0, collision avoidance is disabled during the first iteration of the algorithm. Also note that for the slotted version of the CSMA-CA algorithm with batterylife extension enabled, the minimum value of the backoff exponent will be the lesser of 2 and the value of macMinBE. */ +#define gpMacCore_AttributeMinBE 0x4F +/** @brief The 16 bit identifier of the PAN (Personal Area Network) on which the device is operating. If this value is 0xffff, the device is not associated to a network. */ +#define gpMacCore_AttributePANId 0x50 +/** @brief This attribute indicates whether the MAC sublayer is to enable its receiver during idle periods. */ +#define gpMacCore_AttributeRxOnWhenIdle 0x52 +/** @brief The 16 bit address that the device uses to communicate in the PAN. If the device is a PAN coordinator, this value shall be chosen before a PAN is started. Otherwise, the address is allocated by a coordinator during association. A value of 0xfffe indicates that the device has associated but has not been allocated a short address. A value of 0xffff indicates that the device is not associated to a network. */ +#define gpMacCore_AttributeShortAddress 0x53 +//#define gpMacCore_AttributeACLEntryDescriptorSet 0x70 +//#define gpMacCore_AttributeACLEntryDescriptorSetSize 0x71 +/** @brief Indication of whether a coordinator is currently allowing association. A value of TRUE indicates that association is permitted. */ +#define gpMacCore_AttributeAssociationPermit 0x41 +/** @brief The contents of the beacon payload. The length of the beacon payload is specified through the 'beacon payload length' attribute.*/ +#define gpMacCore_AttributeBeaconPayload 0x45 +/** @brief The length, in octets, of the beacon payload. */ +#define gpMacCore_AttributeBeaconPayloadLength 0x46 +/** @brief Specification of how often the coordinator transmits a beacon. The macBeaconOrder, BO, and the beacon interval, BI, are related as follows: for 0 <= BO <= 14, BI = aBaseSuperframeDuration * 2BO symbols. If BO = 15, the coordinator will not transmit a beacon. */ +#define gpMacCore_AttributeBeaconOrder 0x47 +//#define gpMacCore_AttributeBeaconTxTime 0x48 +//#define gpMacCore_AttributeBSN 0x49 +/** @brief TRUE if the PAN coordinator is to accept GTS requests. FALSE otherwise. */ +#define gpMacCore_AttributeGTSPermit 0x4D +/** @brief This indicates whether the MAC sublayer is in a promiscuous (receive all) mode. A value of TRUE indicates that the MAC sublayer accepts all frames received from the PHY, regardless of the source/destination address fields. */ +#define gpMacCore_AttributePromiscuousMode 0x51 +/** @brief This specifies the length of the active portion of the superframe, including the beacon frame. The superframe order, SO, and the superframe duration, SD, are related as follows: for 0 <= SO <= BO <= 14, SD = aBaseSuperframeDuration*2SO symbols. If SO = 15, the superframe will not be active after the beacon.*/ +#define gpMacCore_AttributeSuperFrameOrder 0x54 +/** @brief The maximum time (in superframe periods) that a transaction is stored by a coordinator and it is indicated in the beacon that data is pending. */ +#define gpMacCore_AttributeTransactionPersistenceTime 0x55 +/** @brief Indication of whether the device is associated to the PAN through the PAN coordinator. +* A value of TRUE indicates the device has associated through the PAN coordinator. Otherwise, the value is set to FALSE. */ +#define gpMacCore_AttributeAssociatedPANCoord 0x56 +/** @brief The maximum value of the backoff exponent, BE, in the CSMA-CA algorithm */ +#define gpMacCore_AttributeMaxBE 0x57 +/** @brief The maximum time to wait either for a frame intended as a response to a data +* request frame or for a broadcast frame following a beacon with the Frame Pending +* field set to one. */ +#define gpMacCore_AttributeMaxFrameTotalWaitTime 0x58 +/** @brief The maximum number of retries allowed after a transmission failure. */ +#define gpMacCore_AttributeNumberOfRetries 0x59 +/** @brief The maximum time, in multiples of aBaseSuperframeDuration, a device shall wait +* for a response command frame to be available following a request command frame. */ +#define gpMacCore_AttributeResponseWaitTime 0x5a +/** @brief Indication of whether the MAC sublayer has security enabled. */ +#define gpMacCore_AttributeSecurityEnabled 0x5d +/** @brief Defines the Tx antenna, only used with antenna diversity. */ +#define gpMacCore_AttributeTxAntenna 0x5e + +/** @brief The extended 64 bit address of the device. */ +#define gpMacCore_AttributeExtendedAddress 0xFF + +// Attributes for security +/** @brief KeyDescriptor entries, each containing keys and security related information. */ +#define gpMacCore_AttributeKeyTable 0x71 +/** @brief Number of key tables */ +#define gpMacCore_AttributeKeyTableEntries 0x72 +/** @brief DeviceDescriptors for each remote device with which this device securely communicates. */ +#define gpMacCore_AttributeDeviceTable 0x73 +/** @brief Number of device tables */ +#define gpMacCore_AttributeDeviceTableEntries 0x74 +/** @brief Provides information about the security level required for each MAC frame type and subtype. */ +#define gpMacCore_AttributeSecurityLevelTable 0x75 +/** @brief Number of security level tables. */ +#define gpMacCore_AttributeSecurityLevelTableEntries 0x76 +/** @brief The outgoing frame counter for this device. */ +#define gpMacCore_AttributeFrameCounter 0x77 +/** @brief The security level used for automatic data requests. */ +#define gpMacCore_AttributeAutoRequestSecurityLevel 0x78 +/** @brief The key identifier mode used for automatic data requests. This attribute is invalid +* if the macAutoRequestSecurityLevel attribute is set to 0x00.*/ +#define gpMacCore_AttributeAutoRequestKeyIdMode 0x79 +/** @brief The originator of the key used for automatic data requests. This attribute is invalid +* if the macAutoRequestKeyIdMode element is invalid or set to 0x00. */ +#define gpMacCore_AttributeAutoRequestKeySource 0x7A +/** @brief The index of the key used for automatic data requests. This attribute is invalid +* if the macAutoRequestKeyIdMode attribute is invalid or set to 0x00 */ +#define gpMacCore_AttributeAutoRequestKeyIndex 0x7B +/** @brief The originator of the default key used for key identifier mode 0x01. */ +#define gpMacCore_AttributeDefaultKeySource 0x7C +/** @brief The extended address of the PAN coordinator. */ +#define gpMacCore_AttributePANCoordExtendedAddress 0x7D +/** @brief The short address assigned to the PAN coordinator. +* A value of 0xfffe indicates that the PAN coordinator is only using its extended address. +* A value of 0xffff indicates that this value is unknown. */ +#define gpMacCore_AttributePANCoordShortAddress 0x7E +/** @typedef gpMacCore_Attribute_t + * @brief The gpMacCore_Attribute_t type defines the attribute type. The value could be an IEEE802.15.4 MAC attribute or a non-standard attributes that was added for flexibility. Only the PIB attributes that are used in this mac could be used, the non-used PIB attributes are not implemented to save memory. +*/ +typedef UInt8 gpMacCore_Attribute_t; + +/** @enum gpMacCore_ScanType_t */ +//@{ +/** @brief The energy detect scan, can be used to detect the amount of energy in the air. It is only used on FFD's (Full Functional Devices).*/ +#define gpMacCore_ScanTypeED 0 +/** @brief The Active Scan will send out a beacon request. FFDs in the POS (Personal Operating Space) of the device will respond by sending out a beacon.*/ +#define gpMacCore_ScanTypeActive 1 +/** @brief The passive scan is not implemented. */ +#define gpMacCore_ScanTypePassive 2 +/** @brief The orphan scan is used when a node lost his coordinator (i.e. when it has changed panId or channel). Using the orphan scan the device can locate his coordinator. */ +#define gpMacCore_ScanTypeOrphan 3 +/** @brief (Wifi Aware) RSSI as a measure of the energy. */ +#define gpMacCore_ScanTypeRSSI 0x80 +/** @brief (Wifi Aware) RSSI as a measure of the energy masked with Min Interference Level. */ +#define gpMacCore_ScanTypeRSSIMasked 0x81 +/** @brief (Wifi Aware) Absolute Interference as a measure of the energy (0 = -95dBm, 254 = -45dBm, 255 = RDS Blocked Channel). */ +#define gpMacCore_ScanTypeAI 0x82 +/** @brief (Wifi Aware) Absolute Interference Masked as a measure of the energy masked with Min Interference Level (0 = -95dBm, 254 = -45dBm, 255 = RDS Blocked Channel). */ +#define gpMacCore_ScanTypeAIMasked 0x83 +/** @brief Stop an ongoing scan. The confirm for the scan in progress will be triggered with the results up to that point. */ +#define gpMacCore_ScanTypeStop 0xFF +/** @typedef gpMacCore_ScanType_t + * @brief The gpMacCore_ScanType_t type defines the scanType as described in the IEEE802.15.4 MAC. Since this is a non-beaconed MAC, the passive scan is not a valid value. +*/ +typedef UInt8 gpMacCore_ScanType_t; +//@} + +/** @enum gpMacCore_AddressMode_t */ +//@{ +/** @brief Values of the address mode field */ +#define gpMacCore_AddressModeNoAddress 0 +#define gpMacCore_AddressModeReserved 1 +#define gpMacCore_AddressModeShortAddress 2 +#define gpMacCore_AddressModeExtendedAddress 3 +typedef UInt8 gpMacCore_AddressMode_t; +//@} + +/** @enum gpMacCore_FrameType_t */ +//@{ +/** @brief Values of the frame type field */ +#define gpMacCore_FrameTypeBeacon 0 +#define gpMacCore_FrameTypeData 1 +#define gpMacCore_FrameTypeAcknowledge 2 +#define gpMacCore_FrameTypeCommand 3 +typedef UInt8 gpMacCore_FrameType_t; +//@} + +/** @enum gpMacCore_Command_t */ +//@{ +/** @brief Values of the command type field */ +#define gpMacCore_CommandAssociationRequest 0x1 +#define gpMacCore_CommandAssociationResponse 0x2 +#define gpMacCore_CommandDataRequest 0x4 +#define gpMacCore_CommandOrphanNotification 0x6 +#define gpMacCore_CommandBeaconRequest 0x7 +#define gpMacCore_CommandCoordinatorRealignment 0x8 +typedef UInt8 gpMacCore_Command_t; +//@} +//@{ +/** @brief Values of the mac version field */ +#define gpMacCore_MacVersion2003 0 +#define gpMacCore_MacVersion2006 1 +#define gpMacCore_MacVersion2015 2 +typedef UInt8 gpMacCore_MacVersion_t; +//@} + +/** @typedef gpMacCore_PanId_t + * @brief The gpMacCore_PanId_t type specifies a panId (Personal Area Network Identifier). The panId is a unique identifier of the network. The length of the panId is 2 bytes. +*/ +typedef UInt16 gpMacCore_PanId_t; + +/** @typedef gpMacCore_SuperFrameSpec_t + * @brief The gpMacCore_SuperFrameSpec_t type definition based on the structure gpMacCore_SuperFrameSpec. +*/ +typedef UInt16 gpMacCore_SuperFrameSpec_t; + +typedef UInt8 gpMacCore_KeyIdLookupListEntries_t; +typedef UInt8 gpMacCore_KeyDeviceListEntries_t; +typedef UInt8 gpMacCore_KeyUsageListEntries_t; +typedef UInt8 gpMacCore_KeyTablesEntries_t; +typedef UInt8 gpMacCore_DeviceTablesEntries_t; +typedef UInt8 gpMacCore_Index_t; +typedef UInt8 gpMacCore_SecurityLevelTableEntries_t; + +/** @enum gpMacCore_KeyIdMode_t */ +//@{ +/** @brief Values of the KeyId Mode field */ +#define gpMacCore_KeyIdModeImplicit 0 +#define gpMacCore_KeyIdModeExplicit1Octet 1 +#define gpMacCore_KeyIdModeExplicit4Octet 2 +#define gpMacCore_KeyIdModeExplicit8Octet 3 +typedef UInt8 gpMacCore_KeyIdMode_t; +//@} + +typedef UInt8 gpMacCore_KeyIndex_t; + +/** @union gpMacCore_Address_t + * @brief The gpMacCore_Address_t union either contains a short or an extended address. +*/ +typedef union { +/** The short address (2 bytes).*/ + UInt16 Short; +/** The extended address(MAC address), 8 bytes.*/ + MACAddress_t Extended; +} gpMacCore_Address_t; + +typedef union{ + UInt8 pKeySource4[4]; + UInt8 pKeySource8[8]; +}gpMacCore_KeySource_t; + +typedef struct { + UInt8 payloadStart; + UInt8 headerStart; + UInt8 payloadLength; + UInt8 headerLength; +} gpMacCore_EncryptionLengthInfo_t; + +/** @struct gpMacCore_Security_t + * @brief The gpMacCore_Security_t struct contains security related parameters. + * @param securityLevel The security level to be used (see IEEE802.15.4-2006). + * @param keyIdMode The mode used to identify the key to be used (see IEEE802.15.4-2006). + * @param pKeySource A pointer to the originator of the key to be used (see IEEE802.15.4-2006). + * @param keyIndex The index of the key to be used (see IEEE802.15.4-2006). +*/ +typedef struct gpMacCore_Security_s{ + gpEncryption_SecLevel_t securityLevel; + gpMacCore_KeyIdMode_t keyIdMode; + gpMacCore_KeySource_t pKeySource; + gpMacCore_KeyIndex_t keyIndex; +} gpMacCore_Security_t; + +/** @struct gpMacCore_AddressInfo_t + * @brief The gpMacCore_AddressInfo_t struct contains all address related information. (addressmode, address and panId) +*/ +typedef struct { + gpMacCore_Address_t address; + gpMacCore_PanId_t panId; + gpMacCore_AddressMode_t addressMode; +} gpMacCore_AddressInfo_t; + +/** @struct gpMacCore_PanDescriptor + * @brief The gpMacCore_PanDescriptor structure specifies the parameters of the PanDescriptor as is defined in the IEEE802.15.4-2006 spec. + * @typedef gpMacCore_PanDescriptor_t + * @brief The gpMacCore_PanDescriptor_t type definition based on the structure gpMacCore_PanDescriptor. +*/ +typedef struct gpMacCore_PanDescriptor { +/** A timestamp indicating at which time the beacon frame was received.*/ + UInt32 timeStamp; // Attention!!! Timestamp from beginning of subinterval (within beacon or IWU slot) +/** The superframe specification as specified in the IEEE802.15.4-2006 specification. */ + gpMacCore_SuperFrameSpec_t superFrame; +/** The channel the network is currently operating on. */ + UInt8 logicalChannel; +/** The quality of the link. This is an unsigned integer, ranging from 0 to 255. Lower values represent lower link quality.*/ + UInt8 linkQuality; +/** The address information of the pan coordinator (addressmode, address and panId) */ + gpMacCore_AddressInfo_t coordAddressInfo; +} gpMacCore_PanDescriptor_t; + +typedef struct gpMacCore_KeyIdLookupDescriptor{ + UInt8 lookupData[9]; + UInt8 lookupDataSize; +}gpMacCore_KeyIdLookupDescriptor_t; + +typedef struct gpMacCore_DeviceDescriptor{ + gpMacCore_PanId_t panId; + UInt16 shortAddr; + MACAddress_t extAddress; + UInt32 frameCounter; + Bool exempt; +}gpMacCore_DeviceDescriptor_t; + +typedef struct gpMacCore_KeyDeviceDescriptor{ + gpMacCore_DeviceDescriptor_t deviceDescriptor; + Bool uniqueDevice; + Bool blackListed; +}gpMacCore_KeyDeviceDescriptor_t; + +typedef struct gpMacCore_KeyUsageDescriptor{ + gpMacCore_FrameType_t frameType; + gpMacCore_Command_t commandFrameIdentifier; +}gpMacCore_KeyUsageDescriptor_t; + +typedef struct gpMacCore_KeyDescriptor{ + gpMacCore_KeyIdLookupDescriptor_t keyIdLookupDescriptors[ GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS ]; + gpMacCore_KeyIdLookupListEntries_t keyIdLookupListEntries; + gpMacCore_KeyDeviceDescriptor_t keyDeviceDescriptorList[ GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS ]; + gpMacCore_KeyDeviceListEntries_t keyDeviceListEntries; + gpMacCore_KeyUsageDescriptor_t keyUsageDescriptorList[ GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS ]; + gpMacCore_KeyUsageListEntries_t keyUsageListEntries; + UInt8 key[16]; +}gpMacCore_KeyDescriptor_t; + +typedef struct gpMacCore_SecurityLevelDescriptor{ + gpMacCore_FrameType_t frameType; + gpMacCore_Command_t commandFrameIdentifier; + gpEncryption_SecLevel_t securityMinimum; + Bool deviceOverrideSecurityMinimum; +}gpMacCore_SecurityLevelDescriptor_t; + +typedef struct gpMacCore_ShortAndPanID{ + gpMacCore_PanId_t panId; + UInt16 shortAddress; +}gpMacCore_ShortAndPanID_t; + +typedef struct gpMacCore_DeviceLookupDescriptor{ + union{ + gpMacCore_ShortAndPanID_t shortAndPanId; + MACAddress_t extendedAddress; + }DeviceLookup; + UInt8 lookupSize; +}gpMacCore_DeviceLookupDescriptor_t; + +typedef struct { + gpPd_Lqi_t lqi; + gpPd_Rssi_t rssi; +} gpMacCore_DiagRxCntr_t; + +typedef struct { + UInt32 avgRetryCntr; + UInt32 txCntr; +} gpMacCore_DiagTxCntr_t; + +/** @typedef gpMacCore_AssocStatus_t + * @brief See table 83 - Valid values of the Association Status field - IEEE 802.14.5 + * 0x0: Association successful. + * 0x1: PAN at capacity. + * 0x2: PAN access denied. +*/ +#define gpMacCore_AssocSuccess 0 +#define gpMacCore_AssocFullPan 1 +#define gpMacCore_AssocDenied 2 +typedef UInt8 gpMacCore_AssocStatus_t; + +typedef struct { + UInt8 channel[GP_MACCORE_MULTICHANNEL_MAX_CHANNELS]; +} gpMacCore_MultiChannelOptions_t; +#define GP_MACCORE_SET_DEFAULT_MULTICHANNELOPTIONS(multiChannelOptions) \ +multiChannelOptions.channel[0] = GP_MACCORE_INVALID_CHANNEL; \ +multiChannelOptions.channel[1] = GP_MACCORE_INVALID_CHANNEL; \ +multiChannelOptions.channel[2] = GP_MACCORE_INVALID_CHANNEL; + +/** @struct gpMacCore_TxTimingOptions_t + * @brief Options to specify transmission via timed TX queue. + */ +typedef struct { + /** Absolute timestamp for scheduled TX (based on chip time in microseconds as returned by gpHal_GetTime()). */ + UInt32 txTimestamp; +} gpMacCore_TxTimingOptions_t; + +typedef void (*gpMacCore_TransmissionCallback_t)(void); + +/** @enum gpMacCore_DataPendingMode_t */ +//@{ +/** @brief Values of the DataPendingMode field */ +#define gpMacCore_DataPendingModeMac802154 0 /* normal mode */ +#define gpMacCore_DataPendingModeForNonNeighbourDevices 1 /* for use with indirect transmit to unknown devices e.g. needed by Zigbee 3.0 */ +typedef UInt8 gpMacCore_DataPendingMode_t; +//@} + +/** @name gpMacCore_TxPower_t*/ +//@{ +#define gpMacCore_TxPowerMin 0x7d +#define gpMacCore_TxPowerMax 0x7e +/** @brief Default transmit powers are configured per channel through gpMacCore_SetDefaultTransmitPowers */ +#define gpMacCore_TxPowerDefault 0x7f +/** @typedef gpMacCore_TxPower_t + * @brief The gpMacCore_TxPower_t type defines the transmit power in dBm or the default, min or max define. +*/ +typedef Int8 gpMacCore_TxPower_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpJumpTables_DataTable.h" +#include "gpMacCore_CodeJumpTableFlash_Defs.h" +#include "gpMacCore_CodeJumpTableRom_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + +/** @ingroup INIT + * + * This function initializes the MacCore layer. It should be called before calling any other request function. + * +*/ +GP_API void gpMacCore_Init(void); +GP_API void gpMacCore_DeInit(void); + +/** @ingroup INIT + * @brief This function resets the MAC layer. If 'setDefaultPib' is true, the PIB attributes will be set to their default value. + * + * This function resets the MAC layer. If 'setDefaultPib' is set to true, it also resets the PIB variables, including the IEEE802.15.4-2006 standard values. + * The tranceiver will be switched off. + * All the buffered packets will be removed. + * The callback functions (specified using the gpMacCore_RegisterCallbackFunctions function) are registered. + * The interrupts are enabled. + * A list to find catching train messages is created (a method to filter out duplicate packets). + * + * @param setDefaultPib If true the PIB values are reset to their default value (as specified in the IEEE802.15.4-2006 specification). + * @param stackId The identifier of the stack +*/ +GP_API gpMacCore_Result_t gpMacCore_Reset(Bool setDefaultPib, gpMacCore_StackId_t stackId); + +/** @brief This function is used to send a data packet to another device. + * + * This function is used to send a data packet conform the IEEE802.15.4-2006 MAC specification. + * + * + * @param srcAddrMode The address modes to be used for source address. This parameter is used as in the Frame Control Field of an IEEE802.15.4-2006 packet. We refer to the define GP_IEEEMAC_SRC_ADDR_(EXT/SHORT). + * @param pDstAddrInfo All the information about the destination (address mode, address and panId). + * @param txOptions Tx Options byte (see IEEE802.15.4-2006). + * @param pSecOptions The security options - maybe NULL to be used (see IEEE802.15.4-2006). + * @param pdLoh The PD Length/Offset/Handle of the data payload . + * @param stackId The identifier of the stack doing this request +*/ +GP_API void gpMacCore_DataRequest(gpMacCore_AddressMode_t srcAddrMode, gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 txOptions, gpMacCore_Security_t *pSecOptions, gpMacCore_MultiChannelOptions_t multiChannelOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId); + +/** @brief Schedule a packet for timed transmission. + * + * To send a packet via timed transmission, perform two steps: + * - Call gpMacCore_DataRequest() with option GP_MACCORE_TX_OPT_TIMEDTX + * to queue the packet; + - Call gpMacCore_ScheduleTimedTx() to schedule transmission of the queued packet. + * + * This function is only available on hardware that supports a timed transmission queue. + * + * @param pdHandle Handle of TX packet to schedule for TX; must have been previously submitted via gpMacCore_DataRequest(). + * @param timingOptions Specification of scheduled transmit time. + * @param stackId The identifier of the stack doing this request + */ +GP_API gpMacCore_Result_t gpMacCore_ScheduleTimedTx(gpPd_Handle_t pdHandle, gpMacCore_TxTimingOptions_t timingOptions, gpMacCore_StackId_t stackId); + +/** @brief This function is used to purge a packet from the indirect transmission list + * + * @param handle The handle to be purged + * @param stackId The identifier of the stack doing this request +*/ +GP_API void gpMacCore_PurgeRequest(gpPd_Handle_t pdHandle, gpMacCore_StackId_t stackId); + +/** @ingroup MLME_SAP + * + * @brief This function is used to start a scan. + * + * This function starts a scan conform the IEEE802.15.4-2006 spec. A scan can be issued to detect a channel with the least amount of interference, to find networks, etc. + * + * @param scanType This parameter defines which of the 3 implemented scans needs to be performed: ED, active or orphan scan. + * @param scanChannels This parameter defines which channels need to be scanned. It is a bitmask where bit 0 must be '1' to select channel 0, bit 26 '1' to select channel 26, etc. Since the chip works in the 2.4GHz band, only channels 11 till 26 can be selected. If other channels are selected, they are ignored and only the selected channels between channel 11 and channel 26 are scanned. + * @param scanDuration This parameter specifies how long a channel will be scanned. The scantime equals [GP_IEEEMAC_BASE_SUPERFRAME_DURATION * (2^scanduration + 1)]symbols, where 1 symbol is 16us. + * @param resultListSize The length of the resultList (in bytes). If an ED scan is done, this should equal the amount of channels. + * For an active scan, resultListSize is 0. Received Beacons are returned through gpMacCore_cbBeaconNotifyIndication() calls during the scan. + * If it is an orphan scan, resultListSize is 0. + * @param pResultList This is a pointer to an array where the result of the scan can be saved. If an ED scan is done, the size is 'resultListSize' bytes. + Note the list is not used by the active scan for memory optimizations. The results are conveyed through separate BeaconNotify callbacks. + * @param stackId The identifier of the stack doing this request +*/ +GP_API void gpMacCore_ScanRequest(gpMacCore_ScanType_t scanType, UInt32 scanChannels, UInt8 scanDuration , UInt8 resultListSize, UInt8* pEdScanResultList, gpMacCore_StackId_t stackId); + +/** @ingroup MLME_SAP + * + * @brief This function is issued by a device who wishes to join a network. + * + * This function starts the associate procedure. It is used to join a network. When called, the AssociateRequest function will construct an associate request command packet, and send it to the coordinator. + * + * @param logicalChannel The channel that will be used to do the association attempt + * @param coordAddrMode The address mode to be used for the coordinator address. Possible values are: 2 = 16 bit short address, 3 = 64 bit extended address. + * @param coordPanId The panId of the coordinator. + * @param pCoordAddress A pointer to the address of the coordinator. + * @param capabilityInformation Specifies the operational capabilities of the associating device. +*/ +GP_API void gpMacCore_AssociateRequest(UInt8 logicalChannel, gpMacCore_AddressInfo_t* pCoordAddrInfo, UInt8 capabilityInformation, gpMacCore_StackId_t stackId); + +/** @ingroup MLME_SAP + * + * @brief This function is used to send an associate response command packet to a device that is trying to join. The associate response command packet contains the results of the join procedure. + * + * This function is used to respond to a previously received associate request command packet. Upon reception of an associate request command packet, the AssociateIndication function is called to inform the higher layer. The next higher layer then decides to allow the joining device in the network or not. Its decision is sent back to the joining device through the associate response packet. + * + * @param pDeviceAddress A pointer to the address of the device that is trying to join. + * @param associateShortAddress If the joining device is allowed (successful association), this parameter contains the short address that was allocated for the device. If the association was unsuccessful, this parameter is set to 0xffff. + * @param status This parameter contains the result of the association attempt. Possible values are: + * 0x0: Association successful. + * 0x1: PAN at capacity. + * 0x2: PAN access denied. + * @param stackId The identifier of the stack doing this response +*/ +GP_API void gpMacCore_AssociateResponse(MACAddress_t *pDeviceAddress, UInt16 associateShortAddress, gpMacCore_Result_t status, gpMacCore_StackId_t stackId); + +/** @ingroup MLME_SAP + * + * @brief This function is used to poll a coordinator for data by sending a data request command. If the coordinator has data pending for the device that issued the poll request, it will forward the data. + * + * This function starts a poll. This function is used to request packets that are pending on his coordinator (by sending a data request command to the coordinator). + * If the coordinator has data pending for the device that issued the poll request, it will forward the data. + * If a short address is allocated to the device, and it was written into the gpMacCore_AttributeShortAddress PIB attribute, + * the short address will be used as source address of the data request command. + * If the gpMacCore_AttributeShortAddress PIB attribute is set to 0xffff or 0xfffe, the device will use its extended address as source address in the data request command packet. + * + * @param coordAddrInfo All the details of the coordinator address + * @param stackId The identifier of the stack doing this request +*/ +GP_API void gpMacCore_PollRequest(gpMacCore_AddressInfo_t* coordAddrInfo, gpMacCore_Security_t *pSecOptions, gpMacCore_StackId_t stackId); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ +/** @brief Calls the PollConfirm function. The PollConfirm inform the next higher layer about a previously issued PollRequest. + * + * This function returns the status of a previously issued PollRequest. + * + * @param status The status of the pollrequest. If success, the received data will be returned using the DataIndication function. + * @param coordAddrInfo All the details of the coordinator address +*/ +void gpMacCore_cbPollConfirm( gpMacCore_Result_t status, gpMacCore_AddressInfo_t* coordAddrInfo, gpPd_TimeStamp_t txTime ); + +/** @brief This function is used to start a new superframe specification. As this is a non-beacon enabled MAC, it is mostly used when starting a coordinator. + * + * This function is used to start a new superframe specification. As this is a non-beacon enabled MAC, it is mostly used when starting a coordinator. It will set the values for the superframe. + * + * @param panId Sets the panId that will be used. + * @param logicalChannel Sets the logicalChannel (the channel the network will operate on). + * @param panCoordinator Sets panCoordinator TRUE or FALSE. If the device is a PAN coordinator, this parameter must be set to TRUE. + * @param stackId The identifier of the stack doing this request +*/ +GP_API gpMacCore_Result_t gpMacCore_Start(gpMacCore_PanId_t panId, UInt8 logicalChannel, Bool panCoordinator, gpMacCore_StackId_t stackId); + +/** @brief This function set the current channel. + * @param channel The channel to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetCurrentChannel(channel, stackId) gpMacCore_SetCurrentChannel_STACKID(MACCORE_STACKID_MAP_2(channel,stackId)) +GP_API void gpMacCore_SetCurrentChannel_STACKID(UInt8 channel MACCORE_STACKID_ARG_2); + +/** @brief This function set the 3 Rx channels. + * @param pChannel The pointer of channel list. +*/ +#define gpMacCore_SetMultipleChannelTable(pChannel, stackId) gpMacCore_SetMultipleChannelTable_STACKID(MACCORE_STACKID_MAP_2(pChannel,stackId)) +GP_API void gpMacCore_SetMultipleChannelTable_STACKID(UInt8* pChannel MACCORE_STACKID_ARG_2); + +/** @brief This function returns the current channel. +*/ +#define gpMacCore_GetCurrentChannel(stackId) gpMacCore_GetCurrentChannel_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetCurrentChannel_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This functions set the default transmit power for each channel + * + * @param Pointer to 16 byte array with default transmit power (in dBm) for each IEEE channel (11..26). + * +*/ +GP_API void gpMacCore_SetDefaultTransmitPowers(Int8* pDefaultTransmitPowerTable); + +/** @brief This function set the transmission power. + * @param transmitPower The transmission power to set in dBm, or one of gpMacCore_TxPowerMin, TxPowerMax, TxPowerDefault. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetTransmitPower(transmitPower, stackId) gpMacCore_SetTransmitPower_STACKID(MACCORE_STACKID_MAP_2(transmitPower,stackId)) +GP_API void gpMacCore_SetTransmitPower_STACKID(gpMacCore_TxPower_t transmitPower MACCORE_STACKID_ARG_2); + +/** @brief This function returns the transmission power. +*/ +#define gpMacCore_GetTransmitPower(stackId) gpMacCore_GetTransmitPower_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Int8 gpMacCore_GetTransmitPower_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function set the CCA mode. + * @param cCAMode The CCA mode to set. + * @param stackId The identifier of the stack doing this request +*/ +#define gpMacCore_SetCCAMode(cCAMode, stackId) gpMacCore_SetCCAMode_STACKID(MACCORE_STACKID_MAP_2(cCAMode,stackId)) +GP_API void gpMacCore_SetCCAMode_STACKID(UInt8 cCAMode MACCORE_STACKID_ARG_2); + +/** @brief This function returns the CCA mode. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetCCAMode(stackId) gpMacCore_GetCCAMode_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetCCAMode_STACKID(MACCORE_STACKID_ARG_1); +/** @brief This function sets the coordinator's extended MAC address. + * @param pCoordExtendedAddress A pointer to the address to set. + * @param stackId The identifier of the stack doing this request +*/ +#define gpMacCore_SetCoordExtendedAddress(pCoordExtendedAddress, stackId) gpMacCore_SetCoordExtendedAddress_STACKID(MACCORE_STACKID_MAP_2(pCoordExtendedAddress ,stackId)) +GP_API void gpMacCore_SetCoordExtendedAddress_STACKID( MACAddress_t* pCoordExtendedAddress MACCORE_STACKID_ARG_2); +/** @brief This function returns the coordinator's extended MAC address. + * @param pCoordExtendedAddress A pointer to the address to read. + * @param stackId The identifier of the stack doing this request +*/ +#define gpMacCore_GetCoordExtendedAddress(pCoordExtendedAddress , stackId) gpMacCore_GetCoordExtendedAddress_STACKID(MACCORE_STACKID_MAP_2(pCoordExtendedAddress ,stackId)) +GP_API void gpMacCore_GetCoordExtendedAddress_STACKID( MACAddress_t* pCoordExtendedAddress MACCORE_STACKID_ARG_2); + +/** @brief This function sets the coordinator's short MAC address. + * @param coordShortAddress A pointer to the address to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetCoordShortAddress(coordShortAddress, stackId) gpMacCore_SetCoordShortAddress_STACKID(MACCORE_STACKID_MAP_2(coordShortAddress,stackId)) +GP_API void gpMacCore_SetCoordShortAddress_STACKID(UInt16 coordShortAddress MACCORE_STACKID_ARG_2); + +/** @brief This function returns the coordinator's short MAC address. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetCoordShortAddress(stackId) gpMacCore_GetCoordShortAddress_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt16 gpMacCore_GetCoordShortAddress_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the panCoordinator property for a stack. + * @param panCoordinator True or false, if the stack is pan coordinator or not. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetPanCoordinator(panCoordinator, stackId) gpMacCore_SetPanCoordinator_STACKID(MACCORE_STACKID_MAP_2(panCoordinator,stackId)) +GP_API void gpMacCore_SetPanCoordinator_STACKID(Bool panCoordinator MACCORE_STACKID_ARG_2); +/** @brief This function returns the panCoordinator property of a stack. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetPanCoordinator(stackId) gpMacCore_GetPanCoordinator_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetPanCoordinator_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the MAC DSN. + * @param DSN The DSN walue to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetDsn(dsn, stackId) gpMacCore_SetDsn_STACKID(MACCORE_STACKID_MAP_2(dsn,stackId)) +GP_API void gpMacCore_SetDsn_STACKID(UInt8 dsn MACCORE_STACKID_ARG_2); +/** @brief This function returns the MAC DSN. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetDsn(stackId) gpMacCore_GetDsn_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetDsn_STACKID(MACCORE_STACKID_ARG_1); +/** @brief This function sets the maximum CSMA backoffs. + * @param maxCsmaBackoffs The maximum CSMA backoffs to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetMaxCsmaBackoffs(maxCsmaBackoffs, stackId) gpMacCore_SetMaxCsmaBackoffs_STACKID(MACCORE_STACKID_MAP_2(maxCsmaBackoffs,stackId)) +GP_API void gpMacCore_SetMaxCsmaBackoffs_STACKID(UInt8 maxCsmaBackoffs MACCORE_STACKID_ARG_2); + +/** @brief This function returns the maximum CSMA backoffs. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetMaxCsmaBackoffs(stackId) gpMacCore_GetMaxCsmaBackoffs_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetMaxCsmaBackoffs_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the minimun BE. + * @param minBE The minimum BE to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetMinBE(minBE, stackId) gpMacCore_SetMinBE_STACKID(MACCORE_STACKID_MAP_2(minBE,stackId)) +GP_API void gpMacCore_SetMinBE_STACKID(UInt8 minBE MACCORE_STACKID_ARG_2); + +/** @brief This function returns the minimun BE. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetMinBE(stackId) gpMacCore_GetMinBE_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetMinBE_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the minimun BE. + * @param minBE The minimum BE to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetMaxBE(maxBE, stackId) gpMacCore_SetMaxBE_STACKID(MACCORE_STACKID_MAP_2(maxBE,stackId)) +GP_API void gpMacCore_SetMaxBE_STACKID(UInt8 maxBE MACCORE_STACKID_ARG_2); + +/** @brief This function returns the minimun BE. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetMaxBE(stackId) gpMacCore_GetMaxBE_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetMaxBE_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the CSMA mode used when transmitting + * @param csmaMode The CSMA mode to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetCsmaMode(csmaMode, stackId) gpMacCore_SetCsmaMode_STACKID(MACCORE_STACKID_MAP_2(csmaMode,stackId)) +GP_API void gpMacCore_SetCsmaMode_STACKID(UInt8 csmaMode MACCORE_STACKID_ARG_2); + +/** @brief This function returns the CSMA mode. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetCsmaMode(stackId) gpMacCore_GetCsmaMode_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetCsmaMode_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the PANID. + * @param panId The PANID to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetPanId(panId, stackId) gpMacCore_SetPanId_STACKID(MACCORE_STACKID_MAP_2(panId,stackId)) +GP_API void gpMacCore_SetPanId_STACKID(UInt16 panId MACCORE_STACKID_ARG_2); + +/** @brief This function returns the PANID. +*/ +#define gpMacCore_GetPanId(stackId) gpMacCore_GetPanId_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt16 gpMacCore_GetPanId_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the RxOnWhenIdle attribute. + * @param rxOnWhenIdle The RxOnWhenIdle attribute to set. + * @param stackId The identifier of the stack doing this +*/ + +#define gpMacCore_SetRxOnWhenIdle(rxOnWhenIdle, stackId) gpMacCore_SetRxOnWhenIdle_STACKID(MACCORE_STACKID_MAP_2(rxOnWhenIdle,stackId)) +GP_API void gpMacCore_SetRxOnWhenIdle_STACKID(Bool rxOnWhenIdle MACCORE_STACKID_ARG_2); + +/** @brief This function returns the RxOnWhenIdle attribute. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetRxOnWhenIdle(stackId) gpMacCore_GetRxOnWhenIdle_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetRxOnWhenIdle_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the short MAC address of the device. + * @param shortAddress The address to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetShortAddress(shortAddress, stackId) gpMacCore_SetShortAddress_STACKID(MACCORE_STACKID_MAP_2(shortAddress,stackId)) +GP_API void gpMacCore_SetShortAddress_STACKID(UInt16 shortAddress MACCORE_STACKID_ARG_2); + +/** @brief This function returns the short MAC address of the device. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetShortAddress(stackId) gpMacCore_GetShortAddress_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt16 gpMacCore_GetShortAddress_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the association permit attribute. + * @param associationPermit The association permit value to set. +*/ +#define gpMacCore_SetAssociationPermit(associationPermit, stackId) gpMacCore_SetAssociationPermit_STACKID(MACCORE_STACKID_MAP_2(associationPermit,stackId)) +GP_API void gpMacCore_SetAssociationPermit_STACKID(Bool associationPermit MACCORE_STACKID_ARG_2); + +/** @brief This function returns the association permit attribute. +*/ +#define gpMacCore_GetAssociationPermit(stackId) gpMacCore_GetAssociationPermit_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetAssociationPermit_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the beacon payload pointer. + * @param pBeaconPayload The beacon payload pointer to set. +*/ +#define gpMacCore_SetBeaconPayload( pBeaconPayload, stackId) gpMacCore_SetBeaconPayload_STACKID(MACCORE_STACKID_MAP_2(pBeaconPayload,stackId)) +GP_API void gpMacCore_SetBeaconPayload_STACKID(UInt8* pBeaconPayload MACCORE_STACKID_ARG_2); + +/** @brief This function returns the beacon payload pointer. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetBeaconPayload(pBeaconPayload, stackId) gpMacCore_GetBeaconPayload_STACKID(MACCORE_STACKID_MAP_2(pBeaconPayload,stackId)) +GP_API void gpMacCore_GetBeaconPayload_STACKID(UInt8* pBeaconPayload MACCORE_STACKID_ARG_2); + +/** @brief This function sets the beacon payload length. + * @param beaconPayloadLength The beacon payload length to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetBeaconPayloadLength(beaconPayloadLength, stackId) gpMacCore_SetBeaconPayloadLength_STACKID(MACCORE_STACKID_MAP_2(beaconPayloadLength,stackId)) +GP_API void gpMacCore_SetBeaconPayloadLength_STACKID(UInt8 beaconPayloadLength MACCORE_STACKID_ARG_2); + +/** @brief This function returns the beacon payload length. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetBeaconPayloadLength(stackId) gpMacCore_GetBeaconPayloadLength_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetBeaconPayloadLength_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the promiscuous mode. + * @param promiscuousMode The promiscuous mode value to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetPromiscuousMode(promiscuousMode, stackId) gpMacCore_SetPromiscuousMode_STACKID(MACCORE_STACKID_MAP_2(promiscuousMode,stackId)) +GP_API void gpMacCore_SetPromiscuousMode_STACKID(UInt8 promiscuousMode MACCORE_STACKID_ARG_2); + +/** @brief This function returns the promiscuous mode. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetPromiscuousMode(stackId) gpMacCore_GetPromiscuousMode_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetPromiscuousMode_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the transaction persistence time. + * @param transactionPersistentTime The transaction persistence time to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetTransactionPersistenceTime(transactionPersistentTime, stackId) gpMacCore_SetTransactionPersistenceTime_STACKID(MACCORE_STACKID_MAP_2(transactionPersistentTime,stackId)) +GP_API void gpMacCore_SetTransactionPersistenceTime_STACKID(UInt16 transactionPersistentTime MACCORE_STACKID_ARG_2); + +/** @brief This function returns the transaction persistence time. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetTransactionPersistenceTime(stackId) gpMacCore_GetTransactionPersistenceTime_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt16 gpMacCore_GetTransactionPersistenceTime_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the extended MAC address of the device. + * @param pExtendedAddress The pointer to the address to set. +*/ +#define gpMacCore_SetExtendedAddress(pExtendedAddress, stackId) gpMacCore_SetExtendedAddress_STACKID(MACCORE_STACKID_MAP_2(pExtendedAddress,stackId)) +GP_API void gpMacCore_SetExtendedAddress_STACKID(MACAddress_t* pExtendedAddress MACCORE_STACKID_ARG_2); + +/** @brief This function returns the extended MAC address of the device. + * @param pExtendedAddress The pointer to the address to read. +*/ +#define gpMacCore_GetExtendedAddress(pExtendedAddress, stackId) gpMacCore_GetExtendedAddress_STACKID(MACCORE_STACKID_MAP_2(pExtendedAddress,stackId)) +GP_API void gpMacCore_GetExtendedAddress_STACKID(MACAddress_t* pExtendedAddress MACCORE_STACKID_ARG_2); + +/** @brief This function sets the number of transmission retries. + * @param numberOfRetries The number of transmission retries to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetNumberOfRetries(numberOfRetries, stackId) gpMacCore_SetNumberOfRetries_STACKID(MACCORE_STACKID_MAP_2(numberOfRetries,stackId)) +GP_API void gpMacCore_SetNumberOfRetries_STACKID(UInt8 numberOfRetries MACCORE_STACKID_ARG_2); + +/** @brief This function sets the number of transmission retries. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetNumberOfRetries(stackId) gpMacCore_GetNumberOfRetries_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetNumberOfRetries_STACKID(MACCORE_STACKID_ARG_1); + +// THDP ?? add to the setget struct +#define gpMacCore_SetSecurityEnabled(securityEnabled, stackId) gpMacCore_SetSecurityEnabled_STACKID(MACCORE_STACKID_MAP_2(securityEnabled,stackId)) +GP_API void gpMacCore_SetSecurityEnabled_STACKID(Bool securityEnabled MACCORE_STACKID_ARG_2); + +#define gpMacCore_GetSecurityEnabled(stackId) gpMacCore_GetSecurityEnabled_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetSecurityEnabled_STACKID(MACCORE_STACKID_ARG_1); + + +/** @brief This function sets the BeaconStarted attribute. + * @param BeaconStarted The BeaconStarted attribute value to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetBeaconStarted(BeaconStarted, stackId) gpMacCore_SetBeaconStarted_STACKID(MACCORE_STACKID_MAP_2(BeaconStarted, stackId)) +void gpMacCore_SetBeaconStarted_STACKID(Bool BeaconStarted MACCORE_STACKID_ARG_2); +/** @brief This function returns the BeaconStarted attribute. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetBeaconStarted(stackId) gpMacCore_GetBeaconStarted_STACKID(MACCORE_STACKID_MAP_1(stackId)) +Bool gpMacCore_GetBeaconStarted_STACKID(MACCORE_STACKID_ARG_1); +/** @brief This function sets the tx antenna. + * @param txAntenna The tx antenna to be used. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetTxAntenna(txAntenna, stackId) gpMacCore_SetTxAntenna_STACKID(MACCORE_STACKID_MAP_2(txAntenna,stackId)) +GP_API void gpMacCore_SetTxAntenna_STACKID(UInt8 txAntenna MACCORE_STACKID_ARG_2); +/** @brief This function gets the tx antenna. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetTxAntenna(stackId) gpMacCore_GetTxAntenna_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetTxAntenna_STACKID(MACCORE_STACKID_ARG_1); +/** @brief This function sets the mac version. + * @param MacVersion The mac version of the stack. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetMacVersion(macVersion, stackId) gpMacCore_SetMacVersion_STACKID(MACCORE_STACKID_MAP_2(macVersion,stackId)) +GP_API void gpMacCore_SetMacVersion_STACKID(gpMacCore_MacVersion_t macVersion MACCORE_STACKID_ARG_2); +/** @brief This function gets the mac version. + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_GetMacVersion(stackId) gpMacCore_GetMacVersion_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API gpMacCore_MacVersion_t gpMacCore_GetMacVersion_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief gpMacCore_SetIndicateBeaconNotifications. + * + * This function manipulates the indication of beacons by the MAC + * + * @param enable + * @note When enable is true, beacons will be indicated by the MAC to the specific stack + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_SetIndicateBeaconNotifications(enable, stackId) gpMacCore_SetIndicateBeaconNotifications_STACKID(MACCORE_STACKID_MAP_2(enable,stackId)) +GP_API void gpMacCore_SetIndicateBeaconNotifications_STACKID(Bool enable MACCORE_STACKID_ARG_2); + +/** @brief gpMacCore_GetIndicateBeaconNotifications. + * + * This function returns IndicateBeaconNotifications + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_GetIndicateBeaconNotifications(stackId) gpMacCore_GetIndicateBeaconNotifications_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetIndicateBeaconNotifications_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief gpMacCore_SetForwardPollIndication. + * + * This function manipulates the poll indication by the MAC + * + * @param enable + * @note When enable is true, poll indication will be forwarded by the MAC to the specific stack + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_SetForwardPollIndications(enable, stackId) gpMacCore_SetForwardPollIndications_STACKID(MACCORE_STACKID_MAP_2(enable,stackId)) +GP_API void gpMacCore_SetForwardPollIndications_STACKID(Bool enable MACCORE_STACKID_ARG_2); + +/** @brief gpMacCore_GetForwardPollIndications. + * + * This function returns the parameter ForwardPollIndications + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_GetForwardPollIndications(stackId) gpMacCore_GetForwardPollIndications_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetForwardPollIndications_STACKID(MACCORE_STACKID_ARG_1); + + + +#define gpMacCore_SetLqiThresholdForTest(lqiThreshold, stackId) gpMacCore_SetLqiThresholdForTest_STACKID(MACCORE_STACKID_MAP_2(lqiThreshold, stackId)) +GP_API void gpMacCore_SetLqiThresholdForTest_STACKID(UInt8 lqiThreshold MACCORE_STACKID_ARG_2); + +#define gpMacCore_GetLqiThresholdForTest(stackId) gpMacCore_GetLqiThresholdForTest_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetLqiThresholdForTest_STACKID(MACCORE_STACKID_ARG_1); + +#define gpMacCore_SetAddressModeOverrideForBeacons(addressMode, stackId) gpMacCore_SetAddressModeOverrideForBeacons_STACKID(MACCORE_STACKID_MAP_2(addressMode, stackId)) +GP_API void gpMacCore_SetAddressModeOverrideForBeacons_STACKID(UInt8 addressMode MACCORE_STACKID_ARG_2); + +#define gpMacCore_GetAddressModeOverrideForBeacons(stackId) gpMacCore_GetAddressModeOverrideForBeacons_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetAddressModeOverrideForBeacons_STACKID(MACCORE_STACKID_ARG_1); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +GP_API void gpMacCore_SetFrameCounter(UInt32 frameCounter, gpMacCore_StackId_t stackId); +GP_API UInt32 gpMacCore_GetFrameCounter(gpMacCore_StackId_t stackId); +GP_API gpMacCore_Result_t gpMacCore_SetKeyDescriptor(gpMacCore_KeyDescriptor_t *pKeyDescriptor, gpMacCore_Index_t index); +GP_API gpMacCore_Result_t gpMacCore_GetKeyDescriptor(gpMacCore_KeyDescriptor_t *pKeyDescriptor, gpMacCore_Index_t index); +GP_API void gpMacCore_SetKeyTableEntries(gpMacCore_KeyTablesEntries_t keyTableEntries); +GP_API gpMacCore_KeyTablesEntries_t gpMacCore_GetKeyTableEntries(void); +GP_API gpMacCore_Result_t gpMacCore_SetDeviceDescriptor(gpMacCore_DeviceDescriptor_t *pDeviceDescriptor, gpMacCore_Index_t index); +GP_API gpMacCore_Result_t gpMacCore_GetDeviceDescriptor(gpMacCore_DeviceDescriptor_t * pDeviceDescriptor , gpMacCore_Index_t index); +GP_API void gpMacCore_SetDeviceTableEntries(gpMacCore_DeviceTablesEntries_t deviceTableEntries); +GP_API gpMacCore_DeviceTablesEntries_t gpMacCore_GetDeviceTableEntries(void); +GP_API gpMacCore_Result_t gpMacCore_SetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index); +GP_API gpMacCore_Result_t gpMacCore_GetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t *pSecurityLevelDescriptor , gpMacCore_Index_t index); +GP_API gpMacCore_SecurityLevelTableEntries_t gpMacCore_GetSecurityLevelTableEntries(void); +GP_API void gpMacCore_SetSecurityLevelTableEntries(gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries); +//GP_API gpMacCore_SecurityLevelTableEntries_t gpMacCore_GetDeviceTableEntries(void); +GP_API void gpMacCore_SetDefaultKeySource(UInt8 *pDefaultKeySource); +GP_API void gpMacCore_GetDefaultKeySource(UInt8 *pDefaultKeySource); +GP_API void gpMacCore_SetPanCoordExtendedAddress(MACAddress_t *pPanCoordExtendedAddress); +GP_API void gpMacCore_GetPanCoordExtendedAddress(MACAddress_t *pPanCoordExtendedAddress); +GP_API void gpMacCore_SetPanCoordShortAddress(UInt16 PanCoordShortAddress); +GP_API UInt16 gpMacCore_GetPanCoordShortAddress(void); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ +/** @brief Calls the DataConfirm callback function. It is used to indicate the result of a data transmission to the next higher layer. + * + * This function is the Confirm of a data Request. It gives info of the success or failure of the dataRequest. + * + * @param status Status of the DataTransmission. + * @param pdHandle The msduHandle that was given with the dataRequest is returned with the dataConfirm. This way, the next higher layer knows which packet generated the confirm. +*/ +void gpMacCore_cbDataConfirm(gpMacCore_Result_t status, gpPd_Handle_t pdHandle); + +/** @brief Calls the DataIndication callback function. It is used to inform the next higher layer a data packet is received. + * + * This function indicates (to the next higher layer) that a data packet is received. + * + * It has more or less the same parameters than the type gpMacCore_cbCPSDataIndication_t, + * except that is has one additional parameter handle and that the parameter pMsdu contains the address + * in the PBM memory where the data payload is located. + * + * This function is only used, when the PBM version of the MAC is used. + * + * @param pSrcAddrInfo All the information about the source (address mode, address and panId). + * @param pDstAddrInfo All the information about the destination (address mode, address and panId). + * @param DSN The data sequence number of the received data frame. + * @param *pSecOptions The security options purportedly used by the received frame (see IEEE802.15.4-2006). + * @param p_PdLoh The PD Length/Offset/Handle of the mpdu. + * @param stackId The stack Id this indication is ment for + * +*/ +void gpMacCore_cbDataIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 dsn, gpMacCore_Security_t *pSecOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId ); + + + /** @brief This function allows the MAC sublayer to notify the next higher layer of the + * success of its request to purge a packet from the transaction queue. + * + * @param status Status of the PurgeRequest. + * @param pdHandle The msduHandle that was given with the dataRequest. +*/ +void gpMacCore_cbPurgeConfirm(gpMacCore_Result_t status, gpPd_Handle_t pdHandle); + +/** @ingroup MLME_SAP + * @brief Calls the AssociateIndication function to indicate a node is trying to join. + * + * This function informs the next higher layer that an associate request command was received, indicating a device wishes to associate. + * + * @param pDeviceAddress A pointer to the address of the device that requested the association. This will always be an extended (64 bit) address. + * @param capabilityInformation The operational capabilities of the device requesting association as specified in the IEEE802.15.4-2006 specification. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbAssociateIndication(gpMacCore_Address_t* pDeviceAddress, UInt8 capabilityInformation, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t rxTime); + +/** @ingroup MLME_SAP + * @brief Calls the AssociateConfirm function, indicating the result of a previous issued AssociateRequest. + * + * This function is used to inform a device of its attempt to join a network. It indicates the results (joined or not) of a previous issued AssociateRequest. + * + * @param assocShortAddress The short address the device may use if the association was successful. + * @param status The status of the association attempt. If this indicates a success, the assocShortAddress field contains the short address the device may use. + * @param txTime transmission time of this message +*/ +void gpMacCore_cbAssociateConfirm(UInt16 assocShortAddress, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime); + +/** @ingroup MLME_SAP + * @brief Indicates a associate response communication status to the next higher layer. + * + * This function indication primitive allows the MLME to indicate a communications status. + * + * @param pSrcAddrInfo The src address information of the device. + * @param pDstAddrInfo The intended recipient of the message + * @param status The communications status. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbAssociateCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t txTime); + +/** @ingroup MLME_SAP + * @brief Indicates a communications status to the next higher layer. + * + * This function indication primitive allows the MLME to indicate a communications status. + * + * @param pSrcAddrInfo The src address information of the device. + * @param pDstAddrInfo The intended recipient of the message + * @param status The communications status. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbOrphanCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t txTime); + +/** @ingroup MLME_SAP + * @brief Indicates a security failure communication status to the next higher layer. + * + * This function indication primitive allows the MLME to indicate a communications status. + * + * @param pSrcAddrInfo The src address information of the device. + * @param pDstAddrInfo The intended recipient of the message + * @param status The communications status. + * @param stackId The stack Id this indication is ment for + * @param [t|r]xTime transmission/reception time of this message +*/ +void gpMacCore_cbSecurityFailureCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t txTime); + + +/** @ingroup MLME_SAP + * @brief Calls the BeaconNotifyIndication function. Informs the next higher layer a beacon packet containing a payload has been received. + * + * This function indicates a beacon with payload is received. + * + * @param bsn The sequence number of the beacon. + * @param pPanDescriptor A pointer to the PANDescriptor of the beacon, the values of this pointer should not be changed. + * @param stackId The stack Id this indication is ment for + * @param beaconPayloadLength The length of the beacon payload + * @param pBeaconPayload A pointer to the beacon payload, the values of this pointer should not be changed. +*/ +void gpMacCore_cbBeaconNotifyIndication( UInt8 bsn, gpMacCore_PanDescriptor_t* pPanDescriptor, gpMacCore_StackId_t stackId , UInt8 beaconPayloadLength , UInt8 *pBeaconPayload ); + +/** @brief Calls the ScanConfirm function, indicating the result of a previously issued ScanRequest to the next higher layer. + * + * This function indicates the result of a previously issued scan to the next higher layer. + * + * @param status The result of the scan. + * @param scanType The scanType that was performed. + * @param unscannedChannels A bitmask of the channels that were not scanned. + * @param resultListSize The size of the result list (For additional info see the ScanRequest function). + * @param resultList A pointer to the result List. +*/ +void gpMacCore_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, UInt32 unscannedChannels, UInt8 resultListSize, UInt8* pEdScanResultList); + +/** @brief Calls the OrphanIndication function. It is issued on a coordinator on receipt of an orphan notification command. + * + * This function indicates a device is orphanned. It is issued on a coordinator on receipt of an orphan notification command. + * + * @param pOrphanAddress A pointer to the extended address of the orphaned device. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbOrphanIndication(MACAddress_t* pOrphanAddress, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t rxTime); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + +/** @brief Calls the OrphanResponse function. + * +*/ +void gpMacCore_OrphanResponse(MACAddress_t* pOrphanAddress, UInt16 shortAddress, Bool associatedMember, gpMacCore_StackId_t stackId); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + +/** @brief Calls the PollIndication function. It is only invoked when the gpMacCore_SetForwardPollIndications() is enabled. + * + * This callback is only used when the upper layer implemnents its own data pending mechanism. + * All handling to send out the packet must be done by the higher layer upon receiving this callback. + * + * @param addressMode The address info used by the originator. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbPollIndication(gpMacCore_AddressInfo_t *addressInfo, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t rxTime); + +/** @brief Calls the PollNotify function. It is invoked when a data poll was received. + * + * All data Tx is handled automatically by the MAC stack using the queued packets. + * This notification serves as bookkeepping information for the higher layer. + * + * @param addressInfo The address info used by the originator + * @param rxTime Time at which the packet was received (in us) + * @param pdHandle Handle of the queued packet that will be transmitted in response to this response. If no data was pending, 0xFF is returned here. + * @param fromNeighbour True if the poll came from a device specified in the Neighbour table list - see the gpMacCore_AddNeighbour() API calls. + * @param stackId The stack Id this indication is ment for +*/ +void gpMacCore_cbPollNotify(gpMacCore_AddressInfo_t *addressInfo, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t rxTime, gpPd_Handle_t pdHandle, Bool fromNeighbour); + +/** @brief Calls the SecurityFrameCounterIndication function. It is invoked when the security framecounter window exceeds the previous value with GP_MACCORE_FRAMECOUNTER_WINDOW. + * + * @param frameCounter New frame counter value + * @param stackId The stack Id this indication is ment for +*/ +void gpMacCore_cbSecurityFrameCounterIndication(UInt32 frameCounter, gpMacCore_StackId_t stackId); + + +/** @brief Calls the stackIdValid callback function. + * + * @param stackId The stackId to check for validity + */ + +GP_API Bool gpMacCore_cbValidStack(gpMacCore_StackId_t stackId); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +/** @brief Indicates stack adding or removal to the gpMacCore component + * + * @param stackId The stackId that was added or removed + */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ +GP_API void gpMacCore_StackAdded(gpMacCore_StackId_t stackId); +GP_API void gpMacCore_StackRemoved(gpMacCore_StackId_t stackId); +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + + +/** @brief This function Adds element to DataPending Queue + * + * @param element +*/ +GP_API gpMacCore_Result_t gpMacCore_DataPending_QueueAdd( gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); + + +/** @brief This function Removes element to DataPending Queue + * + * @param element +*/ +GP_API gpMacCore_Result_t gpMacCore_DataPending_QueueRemove( gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); + +/** @brief This function Removes all elements from the DataPending Queue + * + * @param stackId The stackId for which the dataPending queue needs to be cleared. +*/ +GP_API gpMacCore_Result_t gpMacCore_DataPending_QueueClear(gpMacCore_StackId_t stackId); + +/** @brief This function returns if the Data pending bit will be set in the next ACK + * + * @return dataPending +*/ +GP_API Bool gpMacCore_DataPendingGetAckDataPending(void); + +/** @brief This function sets interference level masks to allow operation alongside WiFi networks + * + * @return void +*/ +gpMacCore_Result_t gpMacCore_SetMinInterferenceLevels(Int8* pInterferenceLevels); + +/** @brief This function adds an address to the neighbour list (determines how to handle a poll request). + * + * @return Bool indicating success or fail +*/ +GP_API Bool gpMacCore_AddNeighbour (gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); + +/** @brief This function removes an address to the neighbour list (determines how to handle a poll request). + * + * @return Bool indicating success or fail +*/ +GP_API Bool gpMacCore_RemoveNeighbour(gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); + +/** @brief This function sets the mode to be used for datapending. + * + * @param dataPendingMode mode from gpMacCore_DataPendingMode_t enumeration to set. + * +*/ +GP_API gpMacCore_Result_t gpMacCore_SetDataPendingMode(gpMacCore_DataPendingMode_t dataPendingMode, gpMacCore_StackId_t stackId); + +/** @brief This function removes all neighbours from neighbour list. + * +*/ +GP_API void gpMacCore_ClearNeighbours(gpMacCore_StackId_t stackId); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + + + +/** @brief This function enables the raw mode of the stack. + * + * This mode allows the upper stack to create the MAC header while transmitting a packets, + * and to stop the MacCore from processing MAC headers, and instead passing them to the upper stack. + * + * @param rawModeEnabled Enables or disables the raw mode for a specific stack. +*/ +#define gpMacCore_SetStackInRawMode(rawModeEnabled, stackId) gpMacCore_SetStackInRawMode_STACKID(MACCORE_STACKID_MAP_2(rawModeEnabled, stackId)) +GP_API void gpMacCore_SetStackInRawMode_STACKID(Bool rawModeEnabled MACCORE_STACKID_ARG_2); + +/** @brief This function returns if the raw mode is enabled for a specific stack. + * + * @return rawModeEnabled Indicates if raw mode is enabled or disabled for a specific stack. +*/ +#define gpMacCore_GetStackInRawMode(stackId) gpMacCore_GetStackInRawMode_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetStackInRawMode_STACKID(MACCORE_STACKID_ARG_1); + +#define gpMacCore_SetRawModeEncryptionKeys(encryptionKeyIdMode, encryptionKeyId, pCurrKey, stackId) gpMacCore_SetRawModeEncryptionKeys_STACKID(MACCORE_STACKID_MAP_4(encryptionKeyIdMode, encryptionKeyId, pCurrKey, stackId)) +GP_API void gpMacCore_SetRawModeEncryptionKeys_STACKID(gpMacCore_KeyIdMode_t encryptionKeyIdMode, gpMacCore_KeyIndex_t encryptionKeyId, UInt8* pCurrKey MACCORE_STACKID_ARG_2); + +#define gpMacCore_SetRawModeNonceFields(frameCounter, pExtendedAddress, seclevel, stackId) gpMacCore_SetRawModeNonceFields_STACKID(MACCORE_STACKID_MAP_4(frameCounter, pExtendedAddress, seclevel, stackId)) +GP_API void gpMacCore_SetRawModeNonceFields_STACKID(UInt32 frameCounter, MACAddress_t* pExtendedAddress, UInt8 seclevel MACCORE_STACKID_ARG_2); + +/** @brief This function configures the insertion of a VS IE header in the Enh Ack frames containing probing data. + * + * @param linkMetrics Bitmask of link metrics which should be reported. + * @param pExtendedAddress The extended address of the probing initiator. + * @param shortAddress The short address of the probing initiator. + * @param stackId The stack id. +*/ +#define gpMacCore_ConfigureEnhAckProbing(linkMetrics, pExtendedAddress, shortAddress, stackId) gpMacCore_ConfigureEnhAckProbing_STACKID(MACCORE_STACKID_MAP_4(linkMetrics, pExtendedAddress, shortAddress, stackId)) +GP_API gpMacCore_Result_t gpMacCore_ConfigureEnhAckProbing_STACKID(UInt8 linkMetrics, MACAddress_t* pExtendedAddress, UInt16 shortAddress MACCORE_STACKID_ARG_2); + + +/** @brief This function enables the Enhanced FramePending behavior for a specific stack. + * + * @param enableEnhancedFramePending Enables or disables the Enhanced FramePending behavior for a specific stack. +*/ +#define gpMacCore_EnableEnhancedFramePending(enableEnhancedFramePending, stackId) gpMacCore_EnableEnhancedFramePending_STACKID(MACCORE_STACKID_MAP_2(enableEnhancedFramePending, stackId)) +GP_API void gpMacCore_EnableEnhancedFramePending(Bool enableEnhancedFramePending, gpMacCore_StackId_t stackId); + + +/** @brief Get the current time + * + * Retrieves the current local time on the chip. + * + * @return time the current local time on chip in us. +*/ +GP_API UInt32 gpMacCore_GetCurrentTimeUs(void); + +/** @brief This function enables or disables the Retransmits on CCA failures. + * + * This function enables or disables the Retransmits on CCA failures. The actual amount of retransmits + * is set through gpMacDispatcher_SetNumberOfRetries. As such this function only changes the + * default MAC 802.15.4-2015 behavior to also retransmit on a CCA fail. + * + * @param enable Enables or disables the Retransmits. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetRetransmitOnCcaFail(enable, stackId) gpMacCore_SetRetransmitOnCcaFail_STACKID(MACCORE_STACKID_MAP_2(enable,stackId)) +GP_API void gpMacCore_SetRetransmitOnCcaFail_STACKID(Bool enable MACCORE_STACKID_ARG_2); +/** @brief This function returns if the feature "Retransmits on CCA fail" is enabled for a stackId. + * + * This function returns if the feature "Retransmits on CCA fail" is enabled for a stackId. + * + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetRetransmitOnCcaFail(stackId) gpMacCore_GetRetransmitOnCcaFail_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetRetransmitOnCcaFail_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function enables or disables the random delays between subsequent retransmits. + * + * This function enables or disables the random delays between subsequent retransmits. + * The actual amount of retransmits is set through gpMacDispatcher_SetNumberOfRetries. As such this + * function only changes the default MAC 802.15.4-2015 behavior to add random delays between retransmits. + * + * @param enable Enables or disables the random delays between subsequent retransmits. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetRetransmitRandomBackoff(enable, stackId) gpMacCore_SetRetransmitRandomBackoff_STACKID(MACCORE_STACKID_MAP_2(enable,stackId)) +GP_API void gpMacCore_SetRetransmitRandomBackoff_STACKID(Bool enable MACCORE_STACKID_ARG_2); +/** @brief This function returns if the feature "random delays between subsequent retransmits" is enabled for a stackId. + * + * This function returns if the feature "random delays between subsequent retransmits" is enabled for a stackId. + * + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetRetransmitRandomBackoff(stackId) gpMacCore_GetRetransmitRandomBackoff_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetRetransmitRandomBackoff_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function configures the minimum backoff exponent for random delays between retransmits. + * + * This function configures the minimum backoff exponent for random delays between retransmits due to NoAck failures. + * See Thread v1.2.1 paragraph 3.2.7.4: Mac layer retries. + * Not to be confused with the backoff exponent for random delays between CCA failures! + * + * @param minBERetransmit The minimum backoff exponent. + * @param stackId The identifier of the stack +*/ +#define gpMacCore_SetMinBeRetransmit(minBERetransmit, stackId) gpMacCore_SetMinBeRetransmit_STACKID(MACCORE_STACKID_MAP_2(minBERetransmit,stackId)) +void gpMacCore_SetMinBeRetransmit_STACKID(UInt8 minBERetransmit MACCORE_STACKID_ARG_2); + +/** @brief This function returns the minimum backoff exponent for random delays between retransmits. + * + * This function returns the minimum backoff exponent for random delays between retransmits. + * + * @param stackId The identifier of the stack +*/ +#define gpMacCore_GetMinBeRetransmit(stackId) gpMacCore_GetMinBeRetransmit_STACKID(MACCORE_STACKID_MAP_1(stackId)) +UInt8 gpMacCore_GetMinBeRetransmit_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function configures the maximum backoff exponent for random delays between retransmits. + * + * This function configures the maximum backoff exponent for random delays between retransmits due to NoAck failures. + * See Thread v1.2.1 paragraph 3.2.7.4: Mac layer retries. + * Not to be confused with the backoff exponent for random delays between CCA failures! + * + * @param maxBERetransmit The maximum backoff exponent. + * @param stackId The identifier of the stack +*/ +#define gpMacCore_SetMaxBeRetransmit(maxBERetransmit, stackId) gpMacCore_SetMaxBeRetransmit_STACKID(MACCORE_STACKID_MAP_2(maxBERetransmit,stackId)) +void gpMacCore_SetMaxBeRetransmit_STACKID(UInt8 maxBERetransmit MACCORE_STACKID_ARG_2); + +/** @brief This function returns the maximum backoff exponent for random delays between retransmits. + * + * This function returns the maximum backoff exponent for random delays between retransmits. + * + * @param stackId The identifier of the stack +*/ +#define gpMacCore_GetMaxBeRetransmit(stackId) gpMacCore_GetMaxBeRetransmit_STACKID(MACCORE_STACKID_MAP_1(stackId)) +UInt8 gpMacCore_GetMaxBeRetransmit_STACKID(MACCORE_STACKID_ARG_1); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif // _GP_MACCORE_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c new file mode 100644 index 0000000..26e9fb0 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c @@ -0,0 +1,529 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacCore_marshalling.c" + * + * MACCore + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpMacCore.h" +#include "gpMacCore_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif +/* AdditionalIncludes */ +#include "gpEncryption_marshalling.h" +#include "gpMacCore_marshalling.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACCORE + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpMacCore_DeviceDescriptor_t_buf2api(gpMacCore_DeviceDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_PanId_t_buf2api_1(&(pDest->panId), pSource, pIndex); + UInt16_buf2api_1(&(pDest->shortAddr), pSource, pIndex); + MACAddress_t_buf2api_1(&(pDest->extAddress), pSource, pIndex); + UInt32_buf2api_1(&(pDest->frameCounter), pSource, pIndex); + Bool_buf2api_1(&(pDest->exempt), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_DeviceDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DeviceDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_PanId_t_api2buf_1(pDest , &(pSource->panId), pIndex); + UInt16_api2buf_1(pDest , &(pSource->shortAddr), pIndex); + MACAddress_t_api2buf_1(pDest , &(pSource->extAddress), pIndex); + UInt32_api2buf_1(pDest , &(pSource->frameCounter), pIndex); + Bool_api2buf_1(pDest , &(pSource->exempt), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_KeyUsageDescriptor_t_buf2api(gpMacCore_KeyUsageDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_FrameType_t_buf2api_1(&(pDest->frameType), pSource, pIndex); + gpMacCore_Command_t_buf2api_1(&(pDest->commandFrameIdentifier), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeyUsageDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyUsageDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_FrameType_t_api2buf_1(pDest , &(pSource->frameType), pIndex); + gpMacCore_Command_t_api2buf_1(pDest , &(pSource->commandFrameIdentifier), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_KeyDeviceDescriptor_t_buf2api(gpMacCore_KeyDeviceDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_DeviceDescriptor_t_buf2api(&(pDest->deviceDescriptor), pSource, 1, pIndex); + Bool_buf2api_1(&(pDest->uniqueDevice), pSource, pIndex); + Bool_buf2api_1(&(pDest->blackListed), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeyDeviceDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyDeviceDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_DeviceDescriptor_t_api2buf(pDest , &(pSource->deviceDescriptor), 1, pIndex); + Bool_api2buf_1(pDest , &(pSource->uniqueDevice), pIndex); + Bool_api2buf_1(pDest , &(pSource->blackListed), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_Security_t_buf2api(gpMacCore_Security_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpEncryption_SecLevel_t_buf2api_1(&(pDest->securityLevel), pSource, pIndex); + gpMacCore_KeyIdMode_t_buf2api_1(&(pDest->keyIdMode), pSource, pIndex); + gpMacCore_KeySource_t_buf2api(gpMacCore_KeyIdModeExplicit8Octet , &(pDest->pKeySource), pSource, 1, pIndex); + gpMacCore_KeyIndex_t_buf2api_1(&(pDest->keyIndex), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_Security_t_api2buf(UInt8Buffer* pDest , const gpMacCore_Security_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpEncryption_SecLevel_t_api2buf_1(pDest , &(pSource->securityLevel), pIndex); + gpMacCore_KeyIdMode_t_api2buf_1(pDest , &(pSource->keyIdMode), pIndex); + gpMacCore_KeySource_t_api2buf(gpMacCore_KeyIdModeExplicit8Octet , pDest , &(pSource->pKeySource), 1, pIndex); + gpMacCore_KeyIndex_t_api2buf_1(pDest , &(pSource->keyIndex), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_AddressInfo_t_buf2api(gpMacCore_AddressInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_Address_t_buf2api(gpMacCore_AddressModeExtendedAddress , &(pDest->address), pSource, 1, pIndex); + gpMacCore_PanId_t_buf2api_1(&(pDest->panId), pSource, pIndex); + gpMacCore_AddressMode_t_buf2api_1(&(pDest->addressMode), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_AddressInfo_t_api2buf(UInt8Buffer* pDest , const gpMacCore_AddressInfo_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_Address_t_api2buf(gpMacCore_AddressModeExtendedAddress , pDest , &(pSource->address), 1, pIndex); + gpMacCore_PanId_t_api2buf_1(pDest , &(pSource->panId), pIndex); + gpMacCore_AddressMode_t_api2buf_1(pDest , &(pSource->addressMode), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_PanDescriptor_t_buf2api(gpMacCore_PanDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_buf2api_1(&(pDest->timeStamp), pSource, pIndex); + gpMacCore_SuperFrameSpec_t_buf2api_1(&(pDest->superFrame), pSource, pIndex); + UInt8_buf2api_1(&(pDest->logicalChannel), pSource, pIndex); + UInt8_buf2api_1(&(pDest->linkQuality), pSource, pIndex); + gpMacCore_AddressInfo_t_buf2api(&(pDest->coordAddressInfo), pSource, 1, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_PanDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_PanDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_api2buf_1(pDest , &(pSource->timeStamp), pIndex); + gpMacCore_SuperFrameSpec_t_api2buf_1(pDest , &(pSource->superFrame), pIndex); + UInt8_api2buf_1(pDest , &(pSource->logicalChannel), pIndex); + UInt8_api2buf_1(pDest , &(pSource->linkQuality), pIndex); + gpMacCore_AddressInfo_t_api2buf(pDest , &(pSource->coordAddressInfo), 1, pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_KeyIdLookupDescriptor_t_buf2api(gpMacCore_KeyIdLookupDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_buf2api((pDest->lookupData), pSource, 9, pIndex); + UInt8_buf2api_1(&(pDest->lookupDataSize), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeyIdLookupDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyIdLookupDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_api2buf(pDest , (pSource->lookupData), 9, pIndex); + UInt8_api2buf_1(pDest , &(pSource->lookupDataSize), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_KeyDescriptor_t_buf2api(gpMacCore_KeyDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_KeyIdLookupDescriptor_t_buf2api((pDest->keyIdLookupDescriptors), pSource, GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS, pIndex); + gpMacCore_KeyIdLookupListEntries_t_buf2api_1(&(pDest->keyIdLookupListEntries), pSource, pIndex); + gpMacCore_KeyDeviceDescriptor_t_buf2api((pDest->keyDeviceDescriptorList), pSource, GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS, pIndex); + gpMacCore_KeyDeviceListEntries_t_buf2api_1(&(pDest->keyDeviceListEntries), pSource, pIndex); + gpMacCore_KeyUsageDescriptor_t_buf2api((pDest->keyUsageDescriptorList), pSource, GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS, pIndex); + gpMacCore_KeyUsageListEntries_t_buf2api_1(&(pDest->keyUsageListEntries), pSource, pIndex); + UInt8_buf2api((pDest->key), pSource, 16, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeyDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_KeyIdLookupDescriptor_t_api2buf(pDest , (pSource->keyIdLookupDescriptors), GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS, pIndex); + gpMacCore_KeyIdLookupListEntries_t_api2buf_1(pDest , &(pSource->keyIdLookupListEntries), pIndex); + gpMacCore_KeyDeviceDescriptor_t_api2buf(pDest , (pSource->keyDeviceDescriptorList), GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS, pIndex); + gpMacCore_KeyDeviceListEntries_t_api2buf_1(pDest , &(pSource->keyDeviceListEntries), pIndex); + gpMacCore_KeyUsageDescriptor_t_api2buf(pDest , (pSource->keyUsageDescriptorList), GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS, pIndex); + gpMacCore_KeyUsageListEntries_t_api2buf_1(pDest , &(pSource->keyUsageListEntries), pIndex); + UInt8_api2buf(pDest , (pSource->key), 16, pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_SecurityLevelDescriptor_t_buf2api(gpMacCore_SecurityLevelDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_FrameType_t_buf2api_1(&(pDest->frameType), pSource, pIndex); + gpMacCore_Command_t_buf2api_1(&(pDest->commandFrameIdentifier), pSource, pIndex); + gpEncryption_SecLevel_t_buf2api_1(&(pDest->securityMinimum), pSource, pIndex); + Bool_buf2api_1(&(pDest->deviceOverrideSecurityMinimum), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_SecurityLevelDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_SecurityLevelDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_FrameType_t_api2buf_1(pDest , &(pSource->frameType), pIndex); + gpMacCore_Command_t_api2buf_1(pDest , &(pSource->commandFrameIdentifier), pIndex); + gpEncryption_SecLevel_t_api2buf_1(pDest , &(pSource->securityMinimum), pIndex); + Bool_api2buf_1(pDest , &(pSource->deviceOverrideSecurityMinimum), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_MultiChannelOptions_t_buf2api(gpMacCore_MultiChannelOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_buf2api((pDest->channel), pSource, 3, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_MultiChannelOptions_t_api2buf(UInt8Buffer* pDest , const gpMacCore_MultiChannelOptions_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_api2buf(pDest , (pSource->channel), 3, pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_TxTimingOptions_t_buf2api(gpMacCore_TxTimingOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_buf2api_1(&(pDest->txTimestamp), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_TxTimingOptions_t_api2buf(UInt8Buffer* pDest , const gpMacCore_TxTimingOptions_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_api2buf_1(pDest , &(pSource->txTimestamp), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_DiagRxCntr_t_buf2api(gpMacCore_DiagRxCntr_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_buf2api_1(&(pDest->lqi), pSource, pIndex); + gpPd_Rssi_t_buf2api_1(&(pDest->rssi), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_DiagRxCntr_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DiagRxCntr_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_api2buf_1(pDest , &(pSource->lqi), pIndex); + gpPd_Rssi_t_api2buf_1(pDest , &(pSource->rssi), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_DiagTxCntr_t_buf2api(gpMacCore_DiagTxCntr_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_buf2api_1(&(pDest->avgRetryCntr), pSource, pIndex); + UInt32_buf2api_1(&(pDest->txCntr), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_DiagTxCntr_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DiagTxCntr_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_api2buf_1(pDest , &(pSource->avgRetryCntr), pIndex); + UInt32_api2buf_1(pDest , &(pSource->txCntr), pIndex); + pSource++; + } +} + +// Union copy functions +gpMarshall_AckStatus_t gpMacCore_Address_t_buf2api(UInt8 unionid , gpMacCore_Address_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + switch (unionid) + { + case gpMacCore_AddressModeShortAddress: + { + UInt16_buf2api(&(pDest->Short), pSource, 1, pIndex); + break; + } + case gpMacCore_AddressModeExtendedAddress: + { + MACAddress_t_buf2api(&(pDest->Extended), pSource, 1, pIndex); + break; + } + default: + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF(" Extended (MACAddress_t): Unknown unionid %i",2,unionid); +#endif + break; + } + } + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_Address_t_api2buf(UInt8 unionid , UInt8Buffer* pDest , const gpMacCore_Address_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + switch (unionid) + { + case gpMacCore_AddressModeShortAddress: + { + UInt16_api2buf_1(pDest , &(pSource->Short), pIndex); + break; + } + case gpMacCore_AddressModeExtendedAddress: + { + MACAddress_t_api2buf_1(pDest , &(pSource->Extended), pIndex); + break; + } + default: + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF(" Extended (MACAddress_t): Unknown unionid %i",2,unionid); +#endif + break; + } + } + pSource++; + } +} +gpMarshall_AckStatus_t gpMacCore_KeySource_t_buf2api(UInt8 unionid , gpMacCore_KeySource_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + switch (unionid) + { + case gpMacCore_KeyIdModeExplicit4Octet: + { + UInt8_buf2api((pDest->pKeySource4), pSource, 4, pIndex); + break; + } + case gpMacCore_KeyIdModeExplicit8Octet: + { + UInt8_buf2api((pDest->pKeySource8), pSource, 8, pIndex); + break; + } + default: + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF(" pKeySource8 (UInt8): Unknown unionid %i",2,unionid); +#endif + break; + } + } + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeySource_t_api2buf(UInt8 unionid , UInt8Buffer* pDest , const gpMacCore_KeySource_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + switch (unionid) + { + case gpMacCore_KeyIdModeExplicit4Octet: + { + UInt8_api2buf(pDest , (pSource->pKeySource4), 4, pIndex); + break; + } + case gpMacCore_KeyIdModeExplicit8Octet: + { + UInt8_api2buf(pDest , (pSource->pKeySource8), 8, pIndex); + break; + } + default: + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF(" pKeySource8 (UInt8): Unknown unionid %i",2,unionid); +#endif + break; + } + } + pSource++; + } +} + + +void gpMacCore_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/src/gpMacCore_defsDefines.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/src/gpMacCore_defsDefines.h new file mode 100644 index 0000000..639b8dd --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacCore/src/gpMacCore_defsDefines.h @@ -0,0 +1,336 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPMAC_CORE_DEFS_DEFINES_H_ +#define _GPMAC_CORE_DEFS_DEFINES_H_ +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpUtils.h" +#include "gpMacCore.h" +#include "gpRxArbiter.h" +#include "gpHal.h" +#include "gpEncryption.h" +#include "gpStat.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_MACCORE_SHORT_ADDR_SIZE 2 +#define GP_MACCORE_EXT_ADDR_SIZE 8 +#define GP_MACCORE_PANID_SIZE 2 +#define GP_MACCORE_FC_SIZE 2 +#define GP_MACCORE_SN_SIZE 1 +#define GP_MACCORE_IE_HEADER_SIZE 2 + +// Indexes for fields in framecontrol +#define GP_MACCORE_FRAME_TYPE_IDX 0 +#define GP_MACCORE_SECURITY_ENABLED_IDX 3 +#define GP_MACCORE_FRAME_PENDING_IDX 4 +#define GP_MACCORE_ACK_REQ_IDX 5 +#define GP_MACCORE_INTRA_PAN_IDX 6 +#define GP_MACCORE_SEQ_NO_SUPPRESSION_IDX 8 +#define GP_MACCORE_IE_PRESENT_IDX 9 +#define GP_MACCORE_DEST_ADDR_MODE_IDX 10 +#define GP_MACCORE_FRAME_VERSION_IDX 12 +#define GP_MACCORE_SRC_ADDR_MODE_IDX 14 + +// Bit masks for fields in framecontrol +#define GP_MACCORE_FRAME_TYPE_BM 0x0007 +#define GP_MACCORE_SECURITY_ENABLED_BM 0x0008 +#define GP_MACCORE_FRAME_PENDING_BM 0x0010 +#define GP_MACCORE_ACK_REQ_BM 0x0020 +#define GP_MACCORE_INTRA_PAN_BM 0x0040 +#define GP_MACCORE_SEQ_NO_SUPPRESSION_BM 0x0100 +#define GP_MACCORE_IE_PRESENT_BM 0x0200 +#define GP_MACCORE_DEST_ADDR_MODE_BM 0x0C00 +#define GP_MACCORE_FRAME_VERSION_BM 0x3000 +#define GP_MACCORE_SRC_ADDR_MODE_BM 0xC000 + +// Indexes for fields in superframe specification +#define MACCORE_SFS_BEACON_ORDER_IDX 0 +#define MACCORE_SFS_SUPERFRAME_ORDER_IDX 4 +#define MACCORE_SFS_FINAL_CAP_SLOT_IDX 8 +#define MACCORE_SFS_BATTERY_LIFE_EXT_IDX 12 +#define MACCORE_SFS_PAN_COORDINATOR_IDX 14 +#define MACCORE_SFS_ASSOCIATION_PERMIT_IDX 15 + +// Bit masks for fields in superframe specification +#define MACCORE_SFS_BEACON_ORDER_BM 0x000F +#define MACCORE_SFS_SUPERFRAME_ORDER_BM 0x00F0 +#define MACCORE_SFS_FINAL_CAP_SLOT_BM 0x0F00 +#define MACCORE_SFS_BATTERY_LIFE_EXT_BM 0x1000 +#define MACCORE_SFS_PAN_COORDINATOR_BM 0x4000 +#define MACCORE_SFS_ASSOCIATION_PERMIT_BM 0x8000 + +//Bit masks for pending address specification in a beacon (5.2.2.1.6) +#define GP_MACCORE_BCN_SHORT_ADDRS_SPEC_BM 0x0007 +#define GP_MACCORE_BCN_EXT_ADDRS_SPEC_BM 0x0070 +#define GP_MACCORE_BCN_SHORT_ADDRS_SPEC_IDX 0 +#define GP_MACCORE_BCN_EXT_ADDRS_SPEC_IDX 4 + +// Indexes for fields in security control +#define GP_MACCORE_SEC_LEVEL_IDX 0 +#define GP_MACCORE_KEY_ID_MODE_IDX 3 + +// Bit masks for fields in security control +#define GP_MACCORE_SEC_LEVEL_BM 0x07 +#define GP_MACCORE_KEY_ID_MODE_BM 0x18 + +// Bit masks for fields in IEs +#define GP_MACCORE_IE_LENGTH_IDX 0 +#define GP_MACCORE_IE_ELEMENTID_IDX 7 +#define GP_MACCORE_IE_TYPE_IDX 15 + +// Bit masks for fields in IEs +#define GP_MACCORE_IE_LENGTH_BM 0x3F +#define GP_MACCORE_IE_ELEMENTID_BM 0x7F80 +#define GP_MACCORE_IE_TYPE_BM 0x8000 + +#define GP_MACCORE_TRANSACTION_PERSISTENCE_TIME_TO_US(time) ((UInt32)time*(GP_MACCORE_BASE_SUPERFRAME_DURATION*GP_MACCORE_SYMBOL_DURATION)) + +// mac constants +#define GP_MACCORE_UNIT_BACKOFF_PERIOD 20 + +#define GP_MACCORE_ASSOCIATION_REQUEST_CMD_LEN 2 +#define GP_MACCORE_ASSOCIATION_RESPONSE_CMD_LEN 4 +#define GP_MACCORE_DATA_REQUEST_CMD_LEN 1 +#define GP_MACCORE_ORPHAN_NOTIFICATION_CMD_LEN 1 +#define GP_MACCORE_BEACON_REQUEST_CMD_LEN 1 +#define GP_MACCORE_COORDINATOR_REALIGNMENT_CMD_LEN 8 + +#define GP_MACCORE_GTS_FIELDS 0 +#define GP_MACCORE_PENDING_ADDRESS_FIELDS 0 + +// mac constants +#define GP_MACCORE_NUMBER_OF_RETRIES 3 +#define GP_MACCORE_RESPONSE_WAIT_TIME 32*GP_MACCORE_BASE_SUPERFRAME_DURATION //in symbols so *16 for in us +#define GP_MACCORE_WORST_CCA_RETRIES_TIME 53 // 2^3 - 1 + 2^4 - 1 + 2^5 - 1 // in backofPeriods + + +#define GP_MACCORE_WORST_CASE_CCA_RETRY_TIME (UInt32)(GP_MACCORE_NUMBER_OF_RETRIES+1)*(GP_MACCORE_WORST_CCA_RETRIES_TIME * GP_MACCORE_UNIT_BACKOFF_PERIOD +(GP_MACCORE_MAX_PHY_PACKET_SIZE+GP_MACCORE_MIN_FRAME_OVERHEAD)*2 + GP_MACCORE_ACK_WAIT_DURATION) * GP_MACCORE_SYMBOL_DURATION /* in us */ + +#define GP_MACCORE_MAX_FRAME_RESPONSE_TIME 1220 // symbols +#define GP_MACCORE_MAX_NUMBER_OF_RETRANSMITTED_MESSAGES_FILTER_EVENTS GP_MEMORY_ALLOCATOR_NUMBER_MAC_SEQUENCENUMBER_FILTER_EVENT + +#define GP_MACCORE_INDIRECT_PACKET_SIZE_QUEUE 2 + +#define GP_MACCORE_NUMBER_OF_CHANNELS 16 + +// definitions used for the hardware scheduler, values from 0 till 0xF are available for use +#define GP_MACCORE_ES_SCHED_ISR 0xA +#define GP_MACCORE_ACL_ENTRY 0x8 + +#define GP_MACCORE_FRAME_COUNTER_MAXIMUM 0xFFFFFFFF +#define GP_MACCORE_IE_HEADER_TERMINATION 0x3F80 + +/** This function sets bits in the frame control field of the MAC header. + * + * @param bf The buffer that contains the frame control byte. + * @param bm The shifted bit mask of the bits to set. + * @param idx The bit index of the bits to set. + * @param v The value to set. + */ +#define MACCORE_BM_SET(bf,bm,idx,v) bf &= ~bm; bf |= (((UInt16)v) << idx) +#define MACCORE_BM_GET(header, mask, idx) ((header & mask) >> idx) + +#define MACCORE_FRAMECONTROL_FRAMETYPE_SET(header, type) MACCORE_BM_SET(header, GP_MACCORE_FRAME_TYPE_BM, GP_MACCORE_FRAME_TYPE_IDX, type) +#define MACCORE_FRAMECONTROL_SECURITY_SET(header, security) MACCORE_BM_SET(header, GP_MACCORE_SECURITY_ENABLED_BM, GP_MACCORE_SECURITY_ENABLED_IDX, security) +#define MACCORE_FRAMECONTROL_ACKREQUEST_SET(header, ackreq) MACCORE_BM_SET(header, GP_MACCORE_ACK_REQ_BM, GP_MACCORE_ACK_REQ_IDX, ackreq) +#define MACCORE_FRAMECONTROL_FRAMEPENDING_SET(header, fpPending) MACCORE_BM_SET(header, GP_MACCORE_FRAME_PENDING_BM, GP_MACCORE_FRAME_PENDING_IDX, fpPending) +#define MACCORE_FRAMECONTROL_PANCOMPRESSION_SET(header, panComp) MACCORE_BM_SET(header, GP_MACCORE_INTRA_PAN_BM, GP_MACCORE_INTRA_PAN_IDX, panComp) +#define MACCORE_FRAMECONTROL_SEQNOSUPPRESSION_SET(header, version) MACCORE_BM_SET(header, GP_MACCORE_SEQ_NO_SUPPRESSION_BM, GP_MACCORE_SEQ_NO_SUPPRESSION_IDX, version) +#define MACCORE_FRAMECONTROL_IE_PRESENT_SET(header, iePresent) MACCORE_BM_SET(header, GP_MACCORE_IE_PRESENT_BM, GP_MACCORE_IE_PRESENT_IDX, panComp) +#define MACCORE_FRAMECONTROL_FRAMEVERSION_SET(header, version) MACCORE_BM_SET(header, GP_MACCORE_FRAME_VERSION_BM, GP_MACCORE_FRAME_VERSION_IDX, version) +#define MACCORE_FRAMECONTROL_DSTADDRMODE_SET(header, mode) MACCORE_BM_SET(header, GP_MACCORE_DEST_ADDR_MODE_BM, GP_MACCORE_DEST_ADDR_MODE_IDX, mode) +#define MACCORE_FRAMECONTROL_SRCADDRMODE_SET(header, mode) MACCORE_BM_SET(header, GP_MACCORE_SRC_ADDR_MODE_BM, GP_MACCORE_SRC_ADDR_MODE_IDX, mode) + +#define MACCORE_FRAMECONTROL_FRAMETYPE_GET(header) MACCORE_BM_GET(header, GP_MACCORE_FRAME_TYPE_BM, GP_MACCORE_FRAME_TYPE_IDX) +#define MACCORE_FRAMECONTROL_SECURITY_GET(header) MACCORE_BM_GET(header, GP_MACCORE_SECURITY_ENABLED_BM, GP_MACCORE_SECURITY_ENABLED_IDX) +#define MACCORE_FRAMECONTROL_FRAMEPENDING_GET(header) MACCORE_BM_GET(header, GP_MACCORE_FRAME_PENDING_BM,GP_MACCORE_FRAME_PENDING_IDX) +#define MACCORE_FRAMECONTROL_PANCOMPRESSION_GET(header) MACCORE_BM_GET(header, GP_MACCORE_INTRA_PAN_BM,GP_MACCORE_INTRA_PAN_IDX) +#define MACCORE_FRAMECONTROL_IE_PRESENT_GET(header) MACCORE_BM_GET(header, GP_MACCORE_IE_PRESENT_BM,GP_MACCORE_IE_PRESENT_IDX) +#define MACCORE_FRAMECONTROL_FRAMEVERSION_GET(header) MACCORE_BM_GET(header, GP_MACCORE_FRAME_VERSION_BM, GP_MACCORE_FRAME_VERSION_IDX) +#define MACCORE_FRAMECONTROL_SEQNOSUPPRESSION_GET(header) MACCORE_BM_GET(header, GP_MACCORE_SEQ_NO_SUPPRESSION_BM, GP_MACCORE_SEQ_NO_SUPPRESSION_IDX) +#define MACCORE_FRAMECONTROL_HASIEELEMENTS_GET(header) MACCORE_BM_GET(header, GP_MACCORE_HAS_IE_ELEMENTS_BM, GP_MACCORE_HAS_IE_ELEMENTS_IDX) +#define MACCORE_FRAMECONTROL_DSTADDRMODE_GET(header) MACCORE_BM_GET(header, GP_MACCORE_DEST_ADDR_MODE_BM,GP_MACCORE_DEST_ADDR_MODE_IDX) +#define MACCORE_FRAMECONTROL_SRCADDRMODE_GET(header) MACCORE_BM_GET(header, GP_MACCORE_SRC_ADDR_MODE_BM,GP_MACCORE_SRC_ADDR_MODE_IDX) + +#define MACCORE_SECCONTROL_SECLEVEL_SET(secControl, secLevel) MACCORE_BM_SET(secControl, GP_MACCORE_SEC_LEVEL_BM, GP_MACCORE_SEC_LEVEL_IDX, secLevel) +#define MACCORE_SECCONTROL_KEYIDMODE_SET(secControl, mode) MACCORE_BM_SET(secControl, GP_MACCORE_KEY_ID_MODE_BM, GP_MACCORE_KEY_ID_MODE_IDX, mode) + +#define MACCORE_SECCONTROL_SECLEVEL_GET(secControl) (secControl & 0x07) +#define MACCORE_SECCONTROL_KEYIDMODE_GET(secControl) MACCORE_BM_GET(secControl, GP_MACCORE_KEY_ID_MODE_BM,GP_MACCORE_KEY_ID_MODE_IDX) + +#define MACCORE_SFS_BEACON_ORDER_SET(superframeSpec, bo) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_BEACON_ORDER_BM, MACCORE_SFS_BEACON_ORDER_IDX, bo) +#define MACCORE_SFS_SUPERFRAME_ORDER_SET(superframeSpec, so) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_SUPERFRAME_ORDER_BM, MACCORE_SFS_SUPERFRAME_ORDER_IDX, so) +#define MACCORE_SFS_FINAL_CAP_SLOT_SET(superframeSpec, fcs) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_FINAL_CAP_SLOT_BM, MACCORE_SFS_FINAL_CAP_SLOT_IDX, fcs) +#define MACCORE_SFS_BATTERY_LIFE_EXTENSION_SET(superframeSpec, ble) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_BATTERY_LIFE_EXT_BM, MACCORE_SFS_BATTERY_LIFE_EXT_IDX, ble) +#define MACCORE_SFS_PAN_COORDINATOR_SET(superframeSpec, pc) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_PAN_COORDINATOR_BM, MACCORE_SFS_PAN_COORDINATOR_IDX, pc) +#define MACCORE_SFS_ASSOCIATION_PERMIT_SET(superframeSpec, ap) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_ASSOCIATION_PERMIT_BM, MACCORE_SFS_ASSOCIATION_PERMIT_IDX, ap) + + +#define MACCORE_ADRR_PENDING_SHORT_GET(addrPendingSpec) MACCORE_BM_GET(addrPendingSpec, GP_MACCORE_BCN_SHORT_ADDRS_SPEC_BM, GP_MACCORE_BCN_SHORT_ADDRS_SPEC_IDX) +#define MACCORE_ADRR_PENDING_EXT_GET(addrPendingSpec) MACCORE_BM_GET(addrPendingSpec, GP_MACCORE_BCN_EXT_ADDRS_SPEC_BM, GP_MACCORE_BCN_EXT_ADDRS_SPEC_IDX) + +/* Macros for parsing through the IE header elements: */ +#define MACCORE_IE_TYPE_HEADER 0 +#define MACCORE_IE_TYPE_PAYLOAD 1 + +#define MACCORE_IE_ID_CSL 0x1A +#define MACCORE_IE_ID_HT1 0x7E +#define MACCORE_IE_ID_HT2 0x7F + +// Indexes for fields in information element headers +#define GP_MACCORE_IEHEADER_LENGTH_IDX 0 +#define GP_MACCORE_IEHEADER_ELEMENTID_IDX 7 +#define GP_MACCORE_IEHEADER_TYPE_IDX 15 + +// Bit masks for fields in information element headers +#define GP_MACCORE_IEHEADER_LENGTH_BM 0x007F +#define GP_MACCORE_IEHEADER_ELEMENTID_BM 0x7F80 +#define GP_MACCORE_IEHEADER_TYPE_BM 0x8000 + +#define MACCORE_IEHEADER_LENGTH_GET(header) MACCORE_BM_GET(header, GP_MACCORE_IEHEADER_LENGTH_BM,GP_MACCORE_IEHEADER_LENGTH_IDX) +#define MACCORE_IEHEADER_ELEMENTID_GET(header) MACCORE_BM_GET(header, GP_MACCORE_IEHEADER_ELEMENTID_BM,GP_MACCORE_IEHEADER_ELEMENTID_IDX) +#define MACCORE_IEHEADER_TYPE_GET(header) MACCORE_BM_GET(header, GP_MACCORE_IEHEADER_TYPE_BM,GP_MACCORE_IEHEADER_TYPE_IDX) + + +// defines to access different fields within nonce +#define GP_MACCORE_NONCE_LENGTHOF_ADDRESS sizeof(MACAddress_t) +#define GP_MACCORE_NONCE_LENGTHOF_FRAME_COUNTER sizeof(UInt32) +#define GP_MACCORE_NONCE_LENGTHOF_SEC_LEVEL sizeof(UInt8) + +#define GP_MACCORE_NONCE_STARTOF_ADDRESS 0 +#define GP_MACCORE_NONCE_STARTOF_FRAME_COUNTER GP_MACCORE_NONCE_LENGTHOF_ADDRESS +#define GP_MACCORE_NONCE_STARTOF_SEC_LEVEL (GP_MACCORE_NONCE_LENGTHOF_ADDRESS + GP_MACCORE_NONCE_LENGTHOF_FRAME_COUNTER) + + +#ifndef GP_MACCORE_MEMORY_ALLOCATOR_CATCHING_TRAIN_LIST_SIZE +#define GP_MACCORE_MEMORY_ALLOCATOR_CATCHING_TRAIN_LIST_SIZE 8 +#endif //GP_MACCORE_MEMORY_ALLOCATOR_CATCHING_TRAIN_LIST_SIZE + +#define GP_MACCORE_INVALID_KEY_TABLE_ENTRY 0xFF +#define GP_MACCORE_INVALID_KEY_DEVICE_LIST_ENTRY 0xFF +#define GP_MACCORE_INVALID_HEADER_LENGTH 0 + +#define GP_MACCORE_FRAME_TYPE_FILTER_MASK_DEFAULT (GPHAL_ENUM_FRAME_TYPE_FILTER_BCN_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_RSV_MASK) + +#define GP_MACCORE_FRAME_TYPE_FILTER_MASK_ONLY_CMD (GPHAL_ENUM_FRAME_TYPE_FILTER_BCN_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_DATA_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_ACK_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_RSV_MASK) + +#define GP_MACCORE_FRAME_TYPE_FILTER_MASK_ONLY_BCN (GPHAL_ENUM_FRAME_TYPE_FILTER_CMD_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_DATA_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_ACK_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_RSV_MASK) + +#define GP_MACCORE_ADDRESS_MODE_NOOVERRIDE 0xFF + +#ifndef GP_MACCORE_MAX_NEIGHBOURS +#define GP_MACCORE_MAX_NEIGHBOURS 16 +#endif //GP_MACCORE_MAX_NEIGHBOURS + +#ifndef GP_MACCORE_INDTX_ENTRIES +#define GP_MACCORE_INDTX_ENTRIES GP_PD_NR_OF_HANDLES +#endif // GP_MACCORE_INDTX_ENTRIES + +#ifndef GP_MACCORE_MAX_ASSOC_RESP +#define GP_MACCORE_MAX_ASSOC_RESP 10 +#endif // GP_MACCORE_MAX_ASSOC_RESP + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpMacCore_AddressInfo_t coordAddrInfo; + gpMacCore_StackId_t stackId; + gpMacCore_Result_t result; + UInt16 responseShortAddr; + UInt32 txTimestamp; + Bool assoc; + gpPd_Handle_t pdHandle; +}MacCore_PollReqArgs_t; + +#define MacCore_SecurityLevelPassedFalse 0 +#define MacCore_SecurityLevelPassedConditionallyPassed 1 +#define MacCore_SecurityLevelPassedTrue 2 +typedef UInt8 MacCore_SecurityLevelPassed_t; + +typedef struct { + gpMacCore_ScanType_t currentScanType; + UInt16 requestChannels; + UInt16 scanChannels; + UInt32 scanDurationUc; + UInt8 resultListSize; + UInt8 resultListSizeMax; + UInt8 origPhyChannel; + UInt16 unscannedChannels; + union un{ + UInt8 origFilterMask; + }un_t; + UInt8* pEnergyDetectList; + gpMacCore_StackId_t stackId; + UInt8 scannedChannelCounter; + UInt32 scanDurationRemaining; + Int16 cummulatedRssi; +} gpMacCore_ScanState_t; + +typedef struct { + UInt16 frameControl; + gpMacCore_FrameType_t frameType; + UInt8 sequenceNumber; + gpMacCore_AddressInfo_t srcAddrInfo; + gpMacCore_AddressInfo_t dstAddrInfo; + UInt32 frameCounter; + gpMacCore_Security_t secOptions; + gpMacCore_StackId_t stackId; +} MacCore_HeaderDescriptor_t; + +typedef struct { + UInt16 assocShortAddr; + gpMacCore_Result_t assocStatus; + gpMacCore_StackId_t stackId; + MACAddress_t deviceAddress; + Bool inFlight; +} MacCore_AssocRsp_t; + +#endif //_GPMAC_CORE_DEFS_DEFINES_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_clientServerCmdId.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_clientServerCmdId.h new file mode 100644 index 0000000..2afa937 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_clientServerCmdId.h @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacDispatcher_clientServerCmdId.h" + * + * MAC Dispatcher + * + * Client Server Link Command IDs +*/ + +#ifndef _GPMACDISPATCHER_CLIENTSERVERCMDID_H_ +#define _GPMACDISPATCHER_CLIENTSERVERCMDID_H_ + +/***************************************************************************** + * Common timeout + *****************************************************************************/ + +#ifndef GPMACDISPATCHER_GPCOMTIMEOUT_US +#define GPMACDISPATCHER_GPCOMTIMEOUT_US 10000000UL //10s +#endif //GPMACDISPATCHER_GPCOMTIMEOUT_US + +/***************************************************************************** + * Component Specific Command IDs + *****************************************************************************/ + +#define gpMacDispatcher_Init_CmdId 0x01 /*01*/ +#define gpMacDispatcher_RegisterNetworkStack_CmdId 0x02 /*02*/ +#define gpMacDispatcher_UnRegisterNetworkStack_CmdId 0x03 /*03*/ +#define gpMacDispatcher_LockClaim_CmdId 0x05 /*05*/ +#define gpMacDispatcher_LockRelease_CmdId 0x06 /*06*/ +#define gpMacDispatcher_LockedByThisStack_CmdId 0x07 /*07*/ +#define gpMacDispatcher_Locked_CmdId 0x08 /*08*/ +#define gpMacDispatcher_Reset_CmdId 0x09 /*09*/ +#define gpMacDispatcher_DataRequest_CmdId 0x0c /*12*/ +#define gpMacDispatcher_ScanRequest_CmdId 0x11 /*17*/ +#define gpMacDispatcher_AssociateRequest_CmdId 0x14 /*20*/ +#define gpMacDispatcher_AssociateResponse_CmdId 0x17 /*23*/ +#define gpMacDispatcher_PollRequest_CmdId 0x1c /*28*/ +#define gpMacDispatcher_PurgeRequest_CmdId 0x21 /*33*/ +#define gpMacDispatcher_Start_CmdId 0x24 /*36*/ +#define gpMacDispatcher_OrphanResponse_CmdId 0x2b /*43*/ +#define gpMacDispatcher_SetPanId_CmdId 0x2e /*46*/ +#define gpMacDispatcher_GetPanId_CmdId 0x2f /*47*/ +#define gpMacDispatcher_SetShortAddress_CmdId 0x30 /*48*/ +#define gpMacDispatcher_GetShortAddress_CmdId 0x31 /*49*/ +#define gpMacDispatcher_SetExtendedAddress_CmdId 0x32 /*50*/ +#define gpMacDispatcher_GetExtendedAddress_CmdId 0x33 /*51*/ +#define gpMacDispatcher_SetDsn_CmdId 0x34 /*52*/ +#define gpMacDispatcher_GetDsn_CmdId 0x35 /*53*/ +#define gpMacDispatcher_SetCurrentChannel_CmdId 0x36 /*54*/ +#define gpMacDispatcher_GetCurrentChannel_CmdId 0x37 /*55*/ +#define gpMacDispatcher_SetBeaconPayload_CmdId 0x38 /*56*/ +#define gpMacDispatcher_GetBeaconPayload_CmdId 0x39 /*57*/ +#define gpMacDispatcher_SetBeaconPayloadLength_CmdId 0x3a /*58*/ +#define gpMacDispatcher_GetBeaconPayloadLength_CmdId 0x3b /*59*/ +#define gpMacDispatcher_SetTxAntenna_CmdId 0x3c /*60*/ +#define gpMacDispatcher_GetTxAntenna_CmdId 0x3d /*61*/ +#define gpMacDispatcher_SetRxOnWhenIdle_CmdId 0x3e /*62*/ +#define gpMacDispatcher_GetRxOnWhenIdle_CmdId 0x3f /*63*/ +#define gpMacDispatcher_GetTransactionPersistenceTime_CmdId 0x40 /*64*/ +#define gpMacDispatcher_SetTransactionPersistenceTime_CmdId 0x41 /*65*/ +#define gpMacDispatcher_SetBeaconStarted_CmdId 0x42 /*66*/ +#define gpMacDispatcher_GetBeaconStarted_CmdId 0x43 /*67*/ +#define gpMacDispatcher_SetCoordShortAddress_CmdId 0x44 /*68*/ +#define gpMacDispatcher_GetCoordShortAddress_CmdId 0x45 /*69*/ +#define gpMacDispatcher_SetCoordExtendedAddress_CmdId 0x46 /*70*/ +#define gpMacDispatcher_GetCoordExtendedAddress_CmdId 0x47 /*71*/ +#define gpMacDispatcher_SetPromiscuousMode_CmdId 0x48 /*72*/ +#define gpMacDispatcher_GetPromiscuousMode_CmdId 0x49 /*73*/ +#define gpMacDispatcher_SetAssociationPermit_CmdId 0x4a /*74*/ +#define gpMacDispatcher_GetAssociationPermit_CmdId 0x4b /*75*/ +#define gpMacDispatcher_SetSecurityEnabled_CmdId 0x4c /*76*/ +#define gpMacDispatcher_GetSecurityEnabled_CmdId 0x4d /*77*/ +#define gpMacDispatcher_SetNumberOfRetries_CmdId 0x4f /*79*/ +#define gpMacDispatcher_GetNumberOfRetries_CmdId 0x50 /*80*/ +#define gpMacDispatcher_SetMaxCsmaBackoffs_CmdId 0x51 /*81*/ +#define gpMacDispatcher_GetMaxCsmaBackoffs_CmdId 0x52 /*82*/ +#define gpMacDispatcher_SetDefaultTransmitPowers_CmdId 0x53 /*83*/ +#define gpMacDispatcher_SetTransmitPower_CmdId 0x54 /*84*/ +#define gpMacDispatcher_GetTransmitPower_CmdId 0x55 /*85*/ +#define gpMacDispatcher_SetCCAMode_CmdId 0x56 /*86*/ +#define gpMacDispatcher_GetCCAMode_CmdId 0x57 /*87*/ +#define gpMacDispatcher_SetPanCoordinator_CmdId 0x58 /*88*/ +#define gpMacDispatcher_GetPanCoordinator_CmdId 0x59 /*89*/ +#define gpMacDispatcher_SetMinBE_CmdId 0x5a /*90*/ +#define gpMacDispatcher_GetMinBE_CmdId 0x5b /*91*/ +#define gpMacDispatcher_SetIndicateBeaconNotifications_CmdId 0x5c /*92*/ +#define gpMacDispatcher_GetIndicateBeaconNotifications_CmdId 0x5d /*93*/ +#define gpMacDispatcher_SetMacVersion_CmdId 0x60 /*96*/ +#define gpMacDispatcher_GetMacVersion_CmdId 0x61 /*97*/ +#define gpMacDispatcher_SetForwardPollIndications_CmdId 0x64 /*100*/ +#define gpMacDispatcher_GetForwardPollIndications_CmdId 0x65 /*101*/ +#define gpMacDispatcher_DataPending_QueueAdd_CmdId 0x66 /*102*/ +#define gpMacDispatcher_DataPending_QueueRemove_CmdId 0x67 /*103*/ +#define gpMacDispatcher_SetMinInterferenceLevels_CmdId 0x68 /*104*/ +#define gpMacDispatcher_SetMaxBE_CmdId 0x69 /*105*/ +#define gpMacDispatcher_GetMaxBE_CmdId 0x6a /*106*/ +#define gpMacDispatcher_SetDeviceDescriptor_CmdId 0x6e /*110*/ +#define gpMacDispatcher_GetDeviceDescriptor_CmdId 0x6f /*111*/ +#define gpMacDispatcher_SetDeviceTableEntries_CmdId 0x70 /*112*/ +#define gpMacDispatcher_GetDeviceTableEntries_CmdId 0x71 /*113*/ +#define gpMacDispatcher_SetKeyDescriptor_CmdId 0x72 /*114*/ +#define gpMacDispatcher_GetKeyDescriptor_CmdId 0x73 /*115*/ +#define gpMacDispatcher_SetKeyTableEntries_CmdId 0x74 /*116*/ +#define gpMacDispatcher_SetSecurityLevelDescriptor_CmdId 0x75 /*117*/ +#define gpMacDispatcher_GetSecurityLevelDescriptor_CmdId 0x76 /*118*/ +#define gpMacDispatcher_SetSecurityLevelTableEntries_CmdId 0x77 /*119*/ +#define gpMacDispatcher_GetSecurityLevelTableEntries_CmdId 0x78 /*120*/ +#define gpMacDispatcher_SetDefaultKeySource_CmdId 0x79 /*121*/ +#define gpMacDispatcher_SetFrameCounter_CmdId 0x7a /*122*/ +#define gpMacDispatcher_GetFrameCounter_CmdId 0x7b /*123*/ +#define gpMacDispatcher_SetPanCoordShortAddress_CmdId 0x7c /*124*/ +#define gpMacDispatcher_SetPanCoordExtendedAddress_CmdId 0x7d /*125*/ +#define gpMacDispatcher_GetPanCoordExtendedAddress_CmdId 0x7e /*126*/ +#define gpMacDispatcher_AddNeighbour_CmdId 0x81 /*129*/ +#define gpMacDispatcher_RemoveNeighbour_CmdId 0x82 /*130*/ +#define gpMacDispatcher_SetDataPendingMode_CmdId 0x83 /*131*/ +#define gpMacDispatcher_SetLqiThresholdForTest_CmdId 0x84 /*132*/ +#define gpMacDispatcher_SetAddressModeOverrideForBeacons_CmdId 0x85 /*133*/ +#define gpMacDispatcher_ClearNeighbours_CmdId 0x86 /*134*/ +#define gpMacDispatcher_SetCsmaMode_CmdId 0x8b /*139*/ +#define gpMacDispatcher_GetCsmaMode_CmdId 0x8c /*140*/ +#define gpMacDispatcher_DataPending_QueueClear_CmdId 0x8d /*141*/ +#define gpMacDispatcher_ScheduleTimedTx_CmdId 0x8e /*142*/ +#define gpMacDispatcher_SetRegionalDomainSettings_CmdId 0x8f /*143*/ +#define gpMacDispatcher_GetRegionalDomainSettings_CmdId 0x90 /*144*/ +#define gpMacDispatcher_SetAutoTxAntennaToggling_CmdId 0x91 /*145*/ +#define gpMacDispatcher_GetAutoTxAntennaToggling_CmdId 0x92 /*146*/ +#define gpMacDispatcher_SetMultipleChannelTable_CmdId 0x93 /*147*/ +#define gpMacDispatcher_SetStackInRawMode_CmdId 0x94 /*148*/ +#define gpMacDispatcher_GetStackInRawMode_CmdId 0x95 /*149*/ +#define gpMacDispatcher_SetRawModeEncryptionKeys_CmdId 0x96 /*150*/ +#define gpMacDispatcher_SetRawModeNonceFields_CmdId 0x97 /*151*/ +#define gpMacDispatcher_EnableEnhancedFramePending_CmdId 0x98 /*152*/ +#define gpMacDispatcher_EnableRxWindows_CmdId 0x99 /*153*/ +#define gpMacDispatcher_DisableRxWindows_CmdId 0x9a /*154*/ +#define gpMacDispatcher_EnableCsl_CmdId 0x9b /*155*/ +#define gpMacDispatcher_UpdateCslSampleTime_CmdId 0x9c /*156*/ +#define gpMacDispatcher_GetCurrentTimeUs_CmdId 0x9d /*157*/ +#define gpMacDispatcher_ConfigureEnhAckProbing_CmdId 0x9e /*158*/ +#define gpMacDispatcher_SetRetransmitOnCcaFail_CmdId 0x9f /*159*/ +#define gpMacDispatcher_GetRetransmitOnCcaFail_CmdId 0xa0 /*160*/ +#define gpMacDispatcher_SetRetransmitRandomBackoff_CmdId 0xa1 /*161*/ +#define gpMacDispatcher_GetRetransmitRandomBackoff_CmdId 0xa2 /*162*/ +#define gpMacDispatcher_SetMinBeRetransmit_CmdId 0xa3 /*163*/ +#define gpMacDispatcher_GetMinBeRetransmit_CmdId 0xa4 /*164*/ +#define gpMacDispatcher_SetMaxBeRetransmit_CmdId 0xa5 /*165*/ +#define gpMacDispatcher_GetMaxBeRetransmit_CmdId 0xa6 /*166*/ +#define MacDispatcher_cbDataConfirm_CmdId 0x0d /*13*/ +#define MacDispatcher_cbDataIndication_CmdId 0x0f /*15*/ +#define MacDispatcher_cbScanConfirm_CmdId 0x12 /*18*/ +#define MacDispatcher_cbAssociateIndication_CmdId 0x15 /*21*/ +#define MacDispatcher_cbAssociateConfirm_CmdId 0x18 /*24*/ +#define MacDispatcher_cbAssociateCommStatusIndication_CmdId 0x1a /*26*/ +#define MacDispatcher_cbPollConfirm_CmdId 0x1d /*29*/ +#define MacDispatcher_cbPollIndication_CmdId 0x1f /*31*/ +#define MacDispatcher_cbPurgeConfirm_CmdId 0x22 /*34*/ +#define MacDispatcher_cbBeaconNotifyIndication_CmdId 0x25 /*37*/ +#define MacDispatcher_cbOrphanIndication_CmdId 0x27 /*39*/ +#define MacDispatcher_cbOrphanCommStatusIndication_CmdId 0x29 /*41*/ +#define MacDispatcher_cbSecurityFailureCommStatusIndication_CmdId 0x2c /*44*/ +#define MacDispatcher_cbDriverResetIndication_CmdId 0x62 /*98*/ +#define MacDispatcher_cbPollNotify_CmdId 0x7f /*127*/ +#define MacDispatcher_cbSecurityFrameCounterIndication_CmdId 0x89 /*137*/ + +/***************************************************************************** + * Fixed Command IDs + *****************************************************************************/ + +#define gpMacDispatcher_Acknowledge_CmdId 0xfe /*254*/ +#define gpMacDispatcher_GetServerCompatibilityNumber_CmdId 0xfd /*253*/ + +#endif //_GPMACDISPATCHER_CLIENTSERVERCMDID_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_marshalling.h new file mode 100644 index 0000000..b0cceea --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_marshalling.h @@ -0,0 +1,2508 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPMACDISPATCHER_MARSHALLING_H_ +#define _GPMACDISPATCHER_MARSHALLING_H_ + +//DOCUMENTATION MACDISPATCHER: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpMacDispatcher.h" +/* AdditionalIncludes */ +#include "gpPd_marshalling.h" +#include "gpMacCore_marshalling.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpMacDispatcher_StringIdentifier_t data[1]; +} gpMacDispatcher_StringIdentifier_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacDispatcher_Callbacks_t data[1]; +} gpMacDispatcher_Callbacks_t_l1_pointer_marshall_t; + + + +typedef struct { + gpMacDispatcher_StringIdentifier_t* stringIdentifier; +} gpMacDispatcher_RegisterNetworkStack_Input_struct_t; + +typedef struct { + gpMacDispatcher_RegisterNetworkStack_Input_struct_t data; + gpMacDispatcher_StringIdentifier_t_l1_pointer_marshall_t stringIdentifier; +} gpMacDispatcher_RegisterNetworkStack_Input_marshall_struct_t; + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_RegisterNetworkStack_Output_struct_t; + +typedef struct { + gpMacDispatcher_RegisterNetworkStack_Output_struct_t data; +} gpMacDispatcher_RegisterNetworkStack_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_UnRegisterNetworkStack_Input_struct_t; + +typedef struct { + gpMacDispatcher_UnRegisterNetworkStack_Input_struct_t data; +} gpMacDispatcher_UnRegisterNetworkStack_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_UnRegisterNetworkStack_Output_struct_t; + +typedef struct { + gpMacDispatcher_UnRegisterNetworkStack_Output_struct_t data; +} gpMacDispatcher_UnRegisterNetworkStack_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; + gpMacDispatcher_Callbacks_t* callbacks; +} gpMacDispatcher_RegisterCallbacks_Input_struct_t; + +typedef struct { + gpMacDispatcher_RegisterCallbacks_Input_struct_t data; + gpMacDispatcher_Callbacks_t_l1_pointer_marshall_t callbacks; +} gpMacDispatcher_RegisterCallbacks_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_LockClaim_Input_struct_t; + +typedef struct { + gpMacDispatcher_LockClaim_Input_struct_t data; +} gpMacDispatcher_LockClaim_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacDispatcher_LockClaim_Output_struct_t; + +typedef struct { + gpMacDispatcher_LockClaim_Output_struct_t data; +} gpMacDispatcher_LockClaim_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_LockRelease_Input_struct_t; + +typedef struct { + gpMacDispatcher_LockRelease_Input_struct_t data; +} gpMacDispatcher_LockRelease_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_LockedByThisStack_Input_struct_t; + +typedef struct { + gpMacDispatcher_LockedByThisStack_Input_struct_t data; +} gpMacDispatcher_LockedByThisStack_Input_marshall_struct_t; + +typedef struct { + Bool locked; +} gpMacDispatcher_LockedByThisStack_Output_struct_t; + +typedef struct { + gpMacDispatcher_LockedByThisStack_Output_struct_t data; +} gpMacDispatcher_LockedByThisStack_Output_marshall_struct_t; + + +typedef struct { + Bool locked; +} gpMacDispatcher_Locked_Output_struct_t; + +typedef struct { + gpMacDispatcher_Locked_Output_struct_t data; +} gpMacDispatcher_Locked_Output_marshall_struct_t; + + +typedef struct { + Bool setDefaultPib; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_Reset_Input_struct_t; + +typedef struct { + gpMacDispatcher_Reset_Input_struct_t data; +} gpMacDispatcher_Reset_Input_marshall_struct_t; + +typedef struct { + gpMacDispatcher_Result_t result; +} gpMacDispatcher_Reset_Output_struct_t; + +typedef struct { + gpMacDispatcher_Reset_Output_struct_t data; +} gpMacDispatcher_Reset_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressMode_t srcAddrMode; + gpMacCore_AddressInfo_t* pDstAddressInfo; + UInt8 txOptions; + gpMacCore_Security_t* pSecOptions; + gpMacCore_MultiChannelOptions_t multiChannelOptions; + gpPd_Loh_t pdLoh; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_DataRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_DataRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; + gpMacCore_MultiChannelOptions_t_l1_pointer_marshall_t multiChannelOptions; + gpPd_Loh_t_l1_pointer_marshall_t pdLoh; +} gpMacDispatcher_DataRequest_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_ScanType_t scanType; + UInt32 scanChannels; + UInt8 scanDuration; + UInt8 resultListSize; + UInt8* pResultList; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_ScanRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_ScanRequest_Input_struct_t data; +} gpMacDispatcher_ScanRequest_Input_marshall_struct_t; + + +typedef struct { + UInt8 logicalChannel; + gpMacCore_AddressInfo_t* coordAddrInfo; + UInt8 capabilityInformation; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_AssociateRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_AssociateRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; +} gpMacDispatcher_AssociateRequest_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pDeviceAddress; + UInt16 associateShortAddress; + gpMacCore_Result_t status; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_AssociateResponse_Input_struct_t; + +typedef struct { + gpMacDispatcher_AssociateResponse_Input_struct_t data; + MACAddress_t pDeviceAddress[1]; +} gpMacDispatcher_AssociateResponse_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* coordAddrInfo; + gpMacCore_Security_t* pSecOptions; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_PollRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_PollRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; +} gpMacDispatcher_PollRequest_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_PurgeRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_PurgeRequest_Input_struct_t data; +} gpMacDispatcher_PurgeRequest_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_PanId_t panId; + UInt8 logicalChannel; + Bool panCoordinator; + UInt8 stackId; +} gpMacDispatcher_Start_Input_struct_t; + +typedef struct { + gpMacDispatcher_Start_Input_struct_t data; +} gpMacDispatcher_Start_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t returnValue; +} gpMacDispatcher_Start_Output_struct_t; + +typedef struct { + gpMacDispatcher_Start_Output_struct_t data; +} gpMacDispatcher_Start_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pOrphanAddress; + UInt16 shortAddress; + Bool associatedMember; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_OrphanResponse_Input_struct_t; + +typedef struct { + gpMacDispatcher_OrphanResponse_Input_struct_t data; + MACAddress_t pOrphanAddress[1]; +} gpMacDispatcher_OrphanResponse_Input_marshall_struct_t; + + +typedef struct { + UInt16 panId; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPanId_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPanId_Input_struct_t data; +} gpMacDispatcher_SetPanId_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetPanId_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetPanId_Input_struct_t data; +} gpMacDispatcher_GetPanId_Input_marshall_struct_t; + +typedef struct { + gpMacCore_PanId_t panId; +} gpMacDispatcher_GetPanId_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetPanId_Output_struct_t data; +} gpMacDispatcher_GetPanId_Output_marshall_struct_t; + + +typedef struct { + UInt16 shortAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetShortAddress_Input_struct_t data; +} gpMacDispatcher_SetShortAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetShortAddress_Input_struct_t data; +} gpMacDispatcher_GetShortAddress_Input_marshall_struct_t; + +typedef struct { + UInt16 address; +} gpMacDispatcher_GetShortAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetShortAddress_Output_struct_t data; +} gpMacDispatcher_GetShortAddress_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pExtendedAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetExtendedAddress_Input_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacDispatcher_SetExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetExtendedAddress_Input_struct_t data; +} gpMacDispatcher_GetExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pExtendedAddress; +} gpMacDispatcher_GetExtendedAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetExtendedAddress_Output_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacDispatcher_GetExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + UInt8 dsn; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetDsn_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDsn_Input_struct_t data; +} gpMacDispatcher_SetDsn_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetDsn_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetDsn_Input_struct_t data; +} gpMacDispatcher_GetDsn_Input_marshall_struct_t; + +typedef struct { + UInt8 dsn; +} gpMacDispatcher_GetDsn_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetDsn_Output_struct_t data; +} gpMacDispatcher_GetDsn_Output_marshall_struct_t; + + +typedef struct { + UInt8 channel; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCurrentChannel_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCurrentChannel_Input_struct_t data; +} gpMacDispatcher_SetCurrentChannel_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCurrentChannel_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCurrentChannel_Input_struct_t data; +} gpMacDispatcher_GetCurrentChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 channel; +} gpMacDispatcher_GetCurrentChannel_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCurrentChannel_Output_struct_t data; +} gpMacDispatcher_GetCurrentChannel_Output_marshall_struct_t; + + +typedef struct { + UInt8* pBeaconPayload; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetBeaconPayload_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetBeaconPayload_Input_struct_t data; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} gpMacDispatcher_SetBeaconPayload_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetBeaconPayload_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconPayload_Input_struct_t data; +} gpMacDispatcher_GetBeaconPayload_Input_marshall_struct_t; + +typedef struct { + UInt8* pBeaconPayload; +} gpMacDispatcher_GetBeaconPayload_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconPayload_Output_struct_t data; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} gpMacDispatcher_GetBeaconPayload_Output_marshall_struct_t; + + +typedef struct { + UInt8 beaconPayloadLength; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetBeaconPayloadLength_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetBeaconPayloadLength_Input_struct_t data; +} gpMacDispatcher_SetBeaconPayloadLength_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetBeaconPayloadLength_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconPayloadLength_Input_struct_t data; +} gpMacDispatcher_GetBeaconPayloadLength_Input_marshall_struct_t; + +typedef struct { + UInt8 beaconPayloadLength; +} gpMacDispatcher_GetBeaconPayloadLength_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconPayloadLength_Output_struct_t data; +} gpMacDispatcher_GetBeaconPayloadLength_Output_marshall_struct_t; + + + + +typedef struct { + Bool rxOnWhenIdle; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetRxOnWhenIdle_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetRxOnWhenIdle_Input_struct_t data; +} gpMacDispatcher_SetRxOnWhenIdle_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetRxOnWhenIdle_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetRxOnWhenIdle_Input_struct_t data; +} gpMacDispatcher_GetRxOnWhenIdle_Input_marshall_struct_t; + +typedef struct { + Bool rxOnWhenIdle; +} gpMacDispatcher_GetRxOnWhenIdle_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetRxOnWhenIdle_Output_struct_t data; +} gpMacDispatcher_GetRxOnWhenIdle_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetTransactionPersistenceTime_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetTransactionPersistenceTime_Input_struct_t data; +} gpMacDispatcher_GetTransactionPersistenceTime_Input_marshall_struct_t; + +typedef struct { + UInt16 time; +} gpMacDispatcher_GetTransactionPersistenceTime_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetTransactionPersistenceTime_Output_struct_t data; +} gpMacDispatcher_GetTransactionPersistenceTime_Output_marshall_struct_t; + + +typedef struct { + UInt16 time; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetTransactionPersistenceTime_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetTransactionPersistenceTime_Input_struct_t data; +} gpMacDispatcher_SetTransactionPersistenceTime_Input_marshall_struct_t; + + +typedef struct { + Bool beaconStarted; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetBeaconStarted_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetBeaconStarted_Input_struct_t data; +} gpMacDispatcher_SetBeaconStarted_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetBeaconStarted_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconStarted_Input_struct_t data; +} gpMacDispatcher_GetBeaconStarted_Input_marshall_struct_t; + +typedef struct { + Bool beaconStarted; +} gpMacDispatcher_GetBeaconStarted_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconStarted_Output_struct_t data; +} gpMacDispatcher_GetBeaconStarted_Output_marshall_struct_t; + + +typedef struct { + UInt16 coordShortAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCoordShortAddress_Input_struct_t data; +} gpMacDispatcher_SetCoordShortAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCoordShortAddress_Input_struct_t data; +} gpMacDispatcher_GetCoordShortAddress_Input_marshall_struct_t; + +typedef struct { + UInt16 coordShortAddress; +} gpMacDispatcher_GetCoordShortAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCoordShortAddress_Output_struct_t data; +} gpMacDispatcher_GetCoordShortAddress_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pCoordExtendedAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCoordExtendedAddress_Input_struct_t data; + MACAddress_t pCoordExtendedAddress[1]; +} gpMacDispatcher_SetCoordExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCoordExtendedAddress_Input_struct_t data; +} gpMacDispatcher_GetCoordExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pCoordExtendedAddress; +} gpMacDispatcher_GetCoordExtendedAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCoordExtendedAddress_Output_struct_t data; + MACAddress_t pCoordExtendedAddress[1]; +} gpMacDispatcher_GetCoordExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + UInt8 promiscuousMode; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPromiscuousMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPromiscuousMode_Input_struct_t data; +} gpMacDispatcher_SetPromiscuousMode_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetPromiscuousMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetPromiscuousMode_Input_struct_t data; +} gpMacDispatcher_GetPromiscuousMode_Input_marshall_struct_t; + +typedef struct { + Bool promiscuousMode; +} gpMacDispatcher_GetPromiscuousMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetPromiscuousMode_Output_struct_t data; +} gpMacDispatcher_GetPromiscuousMode_Output_marshall_struct_t; + + +typedef struct { + Bool associationPermit; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetAssociationPermit_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetAssociationPermit_Input_struct_t data; +} gpMacDispatcher_SetAssociationPermit_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetAssociationPermit_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetAssociationPermit_Input_struct_t data; +} gpMacDispatcher_GetAssociationPermit_Input_marshall_struct_t; + +typedef struct { + Bool associationPermit; +} gpMacDispatcher_GetAssociationPermit_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetAssociationPermit_Output_struct_t data; +} gpMacDispatcher_GetAssociationPermit_Output_marshall_struct_t; + + +typedef struct { + Bool securityEnabled; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetSecurityEnabled_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetSecurityEnabled_Input_struct_t data; +} gpMacDispatcher_SetSecurityEnabled_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetSecurityEnabled_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityEnabled_Input_struct_t data; +} gpMacDispatcher_GetSecurityEnabled_Input_marshall_struct_t; + +typedef struct { + Bool securityEnabled; +} gpMacDispatcher_GetSecurityEnabled_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityEnabled_Output_struct_t data; +} gpMacDispatcher_GetSecurityEnabled_Output_marshall_struct_t; + + +typedef struct { + UInt8 numberOfRetries; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetNumberOfRetries_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetNumberOfRetries_Input_struct_t data; +} gpMacDispatcher_SetNumberOfRetries_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetNumberOfRetries_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetNumberOfRetries_Input_struct_t data; +} gpMacDispatcher_GetNumberOfRetries_Input_marshall_struct_t; + +typedef struct { + UInt8 numberOfRetries; +} gpMacDispatcher_GetNumberOfRetries_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetNumberOfRetries_Output_struct_t data; +} gpMacDispatcher_GetNumberOfRetries_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxCsmaBackoffs; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetMaxCsmaBackoffs_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMaxCsmaBackoffs_Input_struct_t data; +} gpMacDispatcher_SetMaxCsmaBackoffs_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetMaxCsmaBackoffs_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxCsmaBackoffs_Input_struct_t data; +} gpMacDispatcher_GetMaxCsmaBackoffs_Input_marshall_struct_t; + +typedef struct { + UInt8 maxCsmaBackoffs; +} gpMacDispatcher_GetMaxCsmaBackoffs_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxCsmaBackoffs_Output_struct_t data; +} gpMacDispatcher_GetMaxCsmaBackoffs_Output_marshall_struct_t; + + +typedef struct { + Int8* pDefaultTransmitPowerTable; +} gpMacDispatcher_SetDefaultTransmitPowers_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDefaultTransmitPowers_Input_struct_t data; + Int8 pDefaultTransmitPowerTable[16]; +} gpMacDispatcher_SetDefaultTransmitPowers_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_TxPower_t transmitPower; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetTransmitPower_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetTransmitPower_Input_struct_t data; +} gpMacDispatcher_SetTransmitPower_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetTransmitPower_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetTransmitPower_Input_struct_t data; +} gpMacDispatcher_GetTransmitPower_Input_marshall_struct_t; + +typedef struct { + Int8 transmitPower; +} gpMacDispatcher_GetTransmitPower_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetTransmitPower_Output_struct_t data; +} gpMacDispatcher_GetTransmitPower_Output_marshall_struct_t; + + +typedef struct { + UInt8 cCAMode; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCCAMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCCAMode_Input_struct_t data; +} gpMacDispatcher_SetCCAMode_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCCAMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCCAMode_Input_struct_t data; +} gpMacDispatcher_GetCCAMode_Input_marshall_struct_t; + +typedef struct { + UInt8 cCAMode; +} gpMacDispatcher_GetCCAMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCCAMode_Output_struct_t data; +} gpMacDispatcher_GetCCAMode_Output_marshall_struct_t; + + +typedef struct { + Bool panCoordinator; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPanCoordinator_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPanCoordinator_Input_struct_t data; +} gpMacDispatcher_SetPanCoordinator_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetPanCoordinator_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetPanCoordinator_Input_struct_t data; +} gpMacDispatcher_GetPanCoordinator_Input_marshall_struct_t; + +typedef struct { + Bool panCoordinator; +} gpMacDispatcher_GetPanCoordinator_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetPanCoordinator_Output_struct_t data; +} gpMacDispatcher_GetPanCoordinator_Output_marshall_struct_t; + + +typedef struct { + UInt8 minBE; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetMinBE_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMinBE_Input_struct_t data; +} gpMacDispatcher_SetMinBE_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetMinBE_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMinBE_Input_struct_t data; +} gpMacDispatcher_GetMinBE_Input_marshall_struct_t; + +typedef struct { + UInt8 minBE; +} gpMacDispatcher_GetMinBE_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMinBE_Output_struct_t data; +} gpMacDispatcher_GetMinBE_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetIndicateBeaconNotifications_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetIndicateBeaconNotifications_Input_struct_t data; +} gpMacDispatcher_SetIndicateBeaconNotifications_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetIndicateBeaconNotifications_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetIndicateBeaconNotifications_Input_struct_t data; +} gpMacDispatcher_GetIndicateBeaconNotifications_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacDispatcher_GetIndicateBeaconNotifications_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetIndicateBeaconNotifications_Output_struct_t data; +} gpMacDispatcher_GetIndicateBeaconNotifications_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_MacVersion_t macVersion; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetMacVersion_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMacVersion_Input_struct_t data; +} gpMacDispatcher_SetMacVersion_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetMacVersion_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMacVersion_Input_struct_t data; +} gpMacDispatcher_GetMacVersion_Input_marshall_struct_t; + +typedef struct { + gpMacCore_MacVersion_t macVersion; +} gpMacDispatcher_GetMacVersion_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMacVersion_Output_struct_t data; +} gpMacDispatcher_GetMacVersion_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetForwardPollIndications_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetForwardPollIndications_Input_struct_t data; +} gpMacDispatcher_SetForwardPollIndications_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetForwardPollIndications_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetForwardPollIndications_Input_struct_t data; +} gpMacDispatcher_GetForwardPollIndications_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacDispatcher_GetForwardPollIndications_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetForwardPollIndications_Output_struct_t data; +} gpMacDispatcher_GetForwardPollIndications_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_DataPending_QueueAdd_Input_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueAdd_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacDispatcher_DataPending_QueueAdd_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_DataPending_QueueAdd_Output_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueAdd_Output_struct_t data; +} gpMacDispatcher_DataPending_QueueAdd_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_DataPending_QueueRemove_Input_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueRemove_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacDispatcher_DataPending_QueueRemove_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_DataPending_QueueRemove_Output_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueRemove_Output_struct_t data; +} gpMacDispatcher_DataPending_QueueRemove_Output_marshall_struct_t; + + +typedef struct { + Int8* pInterferenceLevels; +} gpMacDispatcher_SetMinInterferenceLevels_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMinInterferenceLevels_Input_struct_t data; + Int8 pInterferenceLevels[1]; +} gpMacDispatcher_SetMinInterferenceLevels_Input_marshall_struct_t; + + +typedef struct { + UInt8 maxBE; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetMaxBE_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMaxBE_Input_struct_t data; +} gpMacDispatcher_SetMaxBE_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetMaxBE_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxBE_Input_struct_t data; +} gpMacDispatcher_GetMaxBE_Input_marshall_struct_t; + +typedef struct { + UInt8 maxBE; +} gpMacDispatcher_GetMaxBE_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxBE_Output_struct_t data; +} gpMacDispatcher_GetMaxBE_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceDescriptor_t* pDeviceDescriptor; + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetDeviceDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDeviceDescriptor_Input_struct_t data; + gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t pDeviceDescriptor; +} gpMacDispatcher_SetDeviceDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_SetDeviceDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_SetDeviceDescriptor_Output_struct_t data; +} gpMacDispatcher_SetDeviceDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetDeviceDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetDeviceDescriptor_Input_struct_t data; +} gpMacDispatcher_GetDeviceDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_DeviceDescriptor_t* pDeviceDescriptor; +} gpMacDispatcher_GetDeviceDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetDeviceDescriptor_Output_struct_t data; + gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t pDeviceDescriptor; +} gpMacDispatcher_GetDeviceDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceTablesEntries_t deviceTableEntries; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetDeviceTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDeviceTableEntries_Input_struct_t data; +} gpMacDispatcher_SetDeviceTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetDeviceTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetDeviceTableEntries_Input_struct_t data; +} gpMacDispatcher_GetDeviceTableEntries_Input_marshall_struct_t; + +typedef struct { + gpMacCore_DeviceTablesEntries_t deviceTableEntries; +} gpMacDispatcher_GetDeviceTableEntries_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetDeviceTableEntries_Output_struct_t data; +} gpMacDispatcher_GetDeviceTableEntries_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_KeyDescriptor_t* pKeyDescriptor; + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetKeyDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetKeyDescriptor_Input_struct_t data; + gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t pKeyDescriptor; +} gpMacDispatcher_SetKeyDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_SetKeyDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_SetKeyDescriptor_Output_struct_t data; +} gpMacDispatcher_SetKeyDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetKeyDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetKeyDescriptor_Input_struct_t data; +} gpMacDispatcher_GetKeyDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_KeyDescriptor_t* pKeyDescriptor; +} gpMacDispatcher_GetKeyDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetKeyDescriptor_Output_struct_t data; + gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t pKeyDescriptor; +} gpMacDispatcher_GetKeyDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_KeyTablesEntries_t keyTableEntries; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetKeyTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetKeyTableEntries_Input_struct_t data; +} gpMacDispatcher_SetKeyTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor; + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetSecurityLevelDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetSecurityLevelDescriptor_Input_struct_t data; + gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t pSecurityLevelDescriptor; +} gpMacDispatcher_SetSecurityLevelDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_SetSecurityLevelDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_SetSecurityLevelDescriptor_Output_struct_t data; +} gpMacDispatcher_SetSecurityLevelDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetSecurityLevelDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityLevelDescriptor_Input_struct_t data; +} gpMacDispatcher_GetSecurityLevelDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor; +} gpMacDispatcher_GetSecurityLevelDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityLevelDescriptor_Output_struct_t data; + gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t pSecurityLevelDescriptor; +} gpMacDispatcher_GetSecurityLevelDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetSecurityLevelTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetSecurityLevelTableEntries_Input_struct_t data; +} gpMacDispatcher_SetSecurityLevelTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetSecurityLevelTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityLevelTableEntries_Input_struct_t data; +} gpMacDispatcher_GetSecurityLevelTableEntries_Input_marshall_struct_t; + +typedef struct { + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; +} gpMacDispatcher_GetSecurityLevelTableEntries_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityLevelTableEntries_Output_struct_t data; +} gpMacDispatcher_GetSecurityLevelTableEntries_Output_marshall_struct_t; + + +typedef struct { + UInt8* pDefaultKeySource; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetDefaultKeySource_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDefaultKeySource_Input_struct_t data; + UInt8 pDefaultKeySource[8]; +} gpMacDispatcher_SetDefaultKeySource_Input_marshall_struct_t; + + +typedef struct { + UInt32 frameCounter; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetFrameCounter_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetFrameCounter_Input_struct_t data; +} gpMacDispatcher_SetFrameCounter_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetFrameCounter_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetFrameCounter_Input_struct_t data; +} gpMacDispatcher_GetFrameCounter_Input_marshall_struct_t; + +typedef struct { + UInt32 frameCounter; +} gpMacDispatcher_GetFrameCounter_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetFrameCounter_Output_struct_t data; +} gpMacDispatcher_GetFrameCounter_Output_marshall_struct_t; + + +typedef struct { + UInt16 panCoordShortAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPanCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPanCoordShortAddress_Input_struct_t data; +} gpMacDispatcher_SetPanCoordShortAddress_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPanCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPanCoordExtendedAddress_Input_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacDispatcher_SetPanCoordExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetPanCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetPanCoordExtendedAddress_Input_struct_t data; +} gpMacDispatcher_GetPanCoordExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; +} gpMacDispatcher_GetPanCoordExtendedAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetPanCoordExtendedAddress_Output_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacDispatcher_GetPanCoordExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_AddNeighbour_Input_struct_t; + +typedef struct { + gpMacDispatcher_AddNeighbour_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacDispatcher_AddNeighbour_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacDispatcher_AddNeighbour_Output_struct_t; + +typedef struct { + gpMacDispatcher_AddNeighbour_Output_struct_t data; +} gpMacDispatcher_AddNeighbour_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_RemoveNeighbour_Input_struct_t; + +typedef struct { + gpMacDispatcher_RemoveNeighbour_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacDispatcher_RemoveNeighbour_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacDispatcher_RemoveNeighbour_Output_struct_t; + +typedef struct { + gpMacDispatcher_RemoveNeighbour_Output_struct_t data; +} gpMacDispatcher_RemoveNeighbour_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DataPendingMode_t dataPendingMode; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetDataPendingMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDataPendingMode_Input_struct_t data; +} gpMacDispatcher_SetDataPendingMode_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_SetDataPendingMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_SetDataPendingMode_Output_struct_t data; +} gpMacDispatcher_SetDataPendingMode_Output_marshall_struct_t; + + + +typedef struct { + UInt8 addressMode; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_struct_t data; +} gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_ClearNeighbours_Input_struct_t; + +typedef struct { + gpMacDispatcher_ClearNeighbours_Input_struct_t data; +} gpMacDispatcher_ClearNeighbours_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCallbacks_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCallbacks_Input_struct_t data; +} gpMacDispatcher_GetCallbacks_Input_marshall_struct_t; + +typedef struct { + gpMacDispatcher_Callbacks_t* callbacks; +} gpMacDispatcher_GetCallbacks_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCallbacks_Output_struct_t data; + gpMacDispatcher_Callbacks_t_l1_pointer_marshall_t callbacks; +} gpMacDispatcher_GetCallbacks_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_IsValidStack_Input_struct_t; + +typedef struct { + gpMacDispatcher_IsValidStack_Input_struct_t data; +} gpMacDispatcher_IsValidStack_Input_marshall_struct_t; + +typedef struct { + Bool valid; +} gpMacDispatcher_IsValidStack_Output_struct_t; + +typedef struct { + gpMacDispatcher_IsValidStack_Output_struct_t data; +} gpMacDispatcher_IsValidStack_Output_marshall_struct_t; + + +typedef struct { + UInt8 csmaMode; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCsmaMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCsmaMode_Input_struct_t data; +} gpMacDispatcher_SetCsmaMode_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCsmaMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCsmaMode_Input_struct_t data; +} gpMacDispatcher_GetCsmaMode_Input_marshall_struct_t; + +typedef struct { + UInt8 csmaMode; +} gpMacDispatcher_GetCsmaMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCsmaMode_Output_struct_t data; +} gpMacDispatcher_GetCsmaMode_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_DataPending_QueueClear_Input_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueClear_Input_struct_t data; +} gpMacDispatcher_DataPending_QueueClear_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_DataPending_QueueClear_Output_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueClear_Output_struct_t data; +} gpMacDispatcher_DataPending_QueueClear_Output_marshall_struct_t; + + + + + + + + +typedef struct { + Bool rawModeEnabled; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetStackInRawMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetStackInRawMode_Input_struct_t data; +} gpMacDispatcher_SetStackInRawMode_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetStackInRawMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetStackInRawMode_Input_struct_t data; +} gpMacDispatcher_GetStackInRawMode_Input_marshall_struct_t; + +typedef struct { + Bool rawModeEnabled; +} gpMacDispatcher_GetStackInRawMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetStackInRawMode_Output_struct_t data; +} gpMacDispatcher_GetStackInRawMode_Output_marshall_struct_t; + + + + +typedef struct { + Bool enableEnhancedFramePending; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_EnableEnhancedFramePending_Input_struct_t; + +typedef struct { + gpMacDispatcher_EnableEnhancedFramePending_Input_struct_t data; +} gpMacDispatcher_EnableEnhancedFramePending_Input_marshall_struct_t; + + + + + + +typedef struct { + UInt32 currentTime; +} gpMacDispatcher_GetCurrentTimeUs_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCurrentTimeUs_Output_struct_t data; +} gpMacDispatcher_GetCurrentTimeUs_Output_marshall_struct_t; + + +typedef struct { + UInt8 linkMetrics; + MACAddress_t* pExtendedAddress; + UInt16 shortAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_ConfigureEnhAckProbing_Input_struct_t; + +typedef struct { + gpMacDispatcher_ConfigureEnhAckProbing_Input_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacDispatcher_ConfigureEnhAckProbing_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_ConfigureEnhAckProbing_Output_struct_t; + +typedef struct { + gpMacDispatcher_ConfigureEnhAckProbing_Output_struct_t data; +} gpMacDispatcher_ConfigureEnhAckProbing_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetRetransmitOnCcaFail_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetRetransmitOnCcaFail_Input_struct_t data; +} gpMacDispatcher_SetRetransmitOnCcaFail_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_GetRetransmitOnCcaFail_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetRetransmitOnCcaFail_Input_struct_t data; +} gpMacDispatcher_GetRetransmitOnCcaFail_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacDispatcher_GetRetransmitOnCcaFail_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetRetransmitOnCcaFail_Output_struct_t data; +} gpMacDispatcher_GetRetransmitOnCcaFail_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetRetransmitRandomBackoff_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetRetransmitRandomBackoff_Input_struct_t data; +} gpMacDispatcher_SetRetransmitRandomBackoff_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_GetRetransmitRandomBackoff_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetRetransmitRandomBackoff_Input_struct_t data; +} gpMacDispatcher_GetRetransmitRandomBackoff_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacDispatcher_GetRetransmitRandomBackoff_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetRetransmitRandomBackoff_Output_struct_t data; +} gpMacDispatcher_GetRetransmitRandomBackoff_Output_marshall_struct_t; + + +typedef struct { + UInt8 minBERetransmit; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetMinBeRetransmit_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMinBeRetransmit_Input_struct_t data; +} gpMacDispatcher_SetMinBeRetransmit_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_GetMinBeRetransmit_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMinBeRetransmit_Input_struct_t data; +} gpMacDispatcher_GetMinBeRetransmit_Input_marshall_struct_t; + +typedef struct { + UInt8 minBERetransmit; +} gpMacDispatcher_GetMinBeRetransmit_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMinBeRetransmit_Output_struct_t data; +} gpMacDispatcher_GetMinBeRetransmit_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxBERetransmit; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetMaxBeRetransmit_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMaxBeRetransmit_Input_struct_t data; +} gpMacDispatcher_SetMaxBeRetransmit_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_GetMaxBeRetransmit_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxBeRetransmit_Input_struct_t data; +} gpMacDispatcher_GetMaxBeRetransmit_Input_marshall_struct_t; + +typedef struct { + UInt8 maxBERetransmit; +} gpMacDispatcher_GetMaxBeRetransmit_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxBeRetransmit_Output_struct_t data; +} gpMacDispatcher_GetMaxBeRetransmit_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Result_t status; + gpPd_Handle_t pdHandle; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbDataConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbDataConfirm_Input_struct_t data; +} MacDispatcher_cbDataConfirm_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + UInt8 dsn; + gpMacCore_Security_t* pSecOptions; + gpPd_Loh_t pdLoh; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbDataIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbDataIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; + gpPd_Loh_t_l1_pointer_marshall_t pdLoh; +} MacDispatcher_cbDataIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_Result_t status; + gpMacCore_ScanType_t scanType; + UInt32 unscannedChannels; + UInt8 resultListSize; + UInt8* pEdScanResultList; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbScanConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbScanConfirm_Input_struct_t data; +} MacDispatcher_cbScanConfirm_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_Address_t* pDeviceAddress; + UInt8 capabilityInformation; + gpPd_TimeStamp_t rxTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbAssociateIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbAssociateIndication_Input_struct_t data; + gpMacCore_Address_t_l1_pointer_marshall_t pDeviceAddress; +} MacDispatcher_cbAssociateIndication_Input_marshall_struct_t; + + +typedef struct { + UInt16 assocShortAddress; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbAssociateConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbAssociateConfirm_Input_struct_t data; +} MacDispatcher_cbAssociateConfirm_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbAssociateCommStatusIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbAssociateCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; +} MacDispatcher_cbAssociateCommStatusIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_Result_t status; + gpMacCore_AddressInfo_t* coordAddrInfo; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbPollConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbPollConfirm_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; +} MacDispatcher_cbPollConfirm_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* addressInfo; + gpPd_TimeStamp_t rxTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbPollIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbPollIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t addressInfo; +} MacDispatcher_cbPollIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_Result_t status; + gpPd_Handle_t pdHandle; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbPurgeConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbPurgeConfirm_Input_struct_t data; +} MacDispatcher_cbPurgeConfirm_Input_marshall_struct_t; + + +typedef struct { + UInt8 bsn; + gpMacCore_PanDescriptor_t* pPanDescriptor; + UInt8 beaconPayloadLength; + UInt8* pBeaconPayload; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbBeaconNotifyIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbBeaconNotifyIndication_Input_struct_t data; + gpMacCore_PanDescriptor_t_l1_pointer_marshall_t pPanDescriptor; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} MacDispatcher_cbBeaconNotifyIndication_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pOrphanAddress; + gpPd_TimeStamp_t rxTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbOrphanIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbOrphanIndication_Input_struct_t data; + MACAddress_t pOrphanAddress[1]; +} MacDispatcher_cbOrphanIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbOrphanCommStatusIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbOrphanCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; +} MacDispatcher_cbOrphanCommStatusIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbSecurityFailureCommStatusIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbSecurityFailureCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; +} MacDispatcher_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_Result_t status; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbDriverResetIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbDriverResetIndication_Input_struct_t data; +} MacDispatcher_cbDriverResetIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* addressInfo; + gpPd_TimeStamp_t rxTime; + gpPd_Handle_t pdHandle; + Bool fromNeighbour; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbPollNotify_Input_struct_t; + +typedef struct { + MacDispatcher_cbPollNotify_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t addressInfo; +} MacDispatcher_cbPollNotify_Input_marshall_struct_t; + + +typedef struct { + UInt32 frameCounter; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbSecurityFrameCounterIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbSecurityFrameCounterIndication_Input_struct_t data; +} MacDispatcher_cbSecurityFrameCounterIndication_Input_marshall_struct_t; + + +typedef union { + gpMacDispatcher_RegisterNetworkStack_Input_marshall_struct_t gpMacDispatcher_RegisterNetworkStack; + gpMacDispatcher_UnRegisterNetworkStack_Input_marshall_struct_t gpMacDispatcher_UnRegisterNetworkStack; + gpMacDispatcher_RegisterCallbacks_Input_marshall_struct_t gpMacDispatcher_RegisterCallbacks; + gpMacDispatcher_LockClaim_Input_marshall_struct_t gpMacDispatcher_LockClaim; + gpMacDispatcher_LockRelease_Input_marshall_struct_t gpMacDispatcher_LockRelease; + gpMacDispatcher_LockedByThisStack_Input_marshall_struct_t gpMacDispatcher_LockedByThisStack; + gpMacDispatcher_Reset_Input_marshall_struct_t gpMacDispatcher_Reset; + gpMacDispatcher_DataRequest_Input_marshall_struct_t gpMacDispatcher_DataRequest; + gpMacDispatcher_ScanRequest_Input_marshall_struct_t gpMacDispatcher_ScanRequest; + gpMacDispatcher_AssociateRequest_Input_marshall_struct_t gpMacDispatcher_AssociateRequest; + gpMacDispatcher_AssociateResponse_Input_marshall_struct_t gpMacDispatcher_AssociateResponse; + gpMacDispatcher_PollRequest_Input_marshall_struct_t gpMacDispatcher_PollRequest; + gpMacDispatcher_PurgeRequest_Input_marshall_struct_t gpMacDispatcher_PurgeRequest; + gpMacDispatcher_Start_Input_marshall_struct_t gpMacDispatcher_Start; + gpMacDispatcher_OrphanResponse_Input_marshall_struct_t gpMacDispatcher_OrphanResponse; + gpMacDispatcher_SetPanId_Input_marshall_struct_t gpMacDispatcher_SetPanId; + gpMacDispatcher_GetPanId_Input_marshall_struct_t gpMacDispatcher_GetPanId; + gpMacDispatcher_SetShortAddress_Input_marshall_struct_t gpMacDispatcher_SetShortAddress; + gpMacDispatcher_GetShortAddress_Input_marshall_struct_t gpMacDispatcher_GetShortAddress; + gpMacDispatcher_SetExtendedAddress_Input_marshall_struct_t gpMacDispatcher_SetExtendedAddress; + gpMacDispatcher_GetExtendedAddress_Input_marshall_struct_t gpMacDispatcher_GetExtendedAddress; + gpMacDispatcher_SetDsn_Input_marshall_struct_t gpMacDispatcher_SetDsn; + gpMacDispatcher_GetDsn_Input_marshall_struct_t gpMacDispatcher_GetDsn; + gpMacDispatcher_SetCurrentChannel_Input_marshall_struct_t gpMacDispatcher_SetCurrentChannel; + gpMacDispatcher_GetCurrentChannel_Input_marshall_struct_t gpMacDispatcher_GetCurrentChannel; + gpMacDispatcher_SetBeaconPayload_Input_marshall_struct_t gpMacDispatcher_SetBeaconPayload; + gpMacDispatcher_GetBeaconPayload_Input_marshall_struct_t gpMacDispatcher_GetBeaconPayload; + gpMacDispatcher_SetBeaconPayloadLength_Input_marshall_struct_t gpMacDispatcher_SetBeaconPayloadLength; + gpMacDispatcher_GetBeaconPayloadLength_Input_marshall_struct_t gpMacDispatcher_GetBeaconPayloadLength; + gpMacDispatcher_SetRxOnWhenIdle_Input_marshall_struct_t gpMacDispatcher_SetRxOnWhenIdle; + gpMacDispatcher_GetRxOnWhenIdle_Input_marshall_struct_t gpMacDispatcher_GetRxOnWhenIdle; + gpMacDispatcher_GetTransactionPersistenceTime_Input_marshall_struct_t gpMacDispatcher_GetTransactionPersistenceTime; + gpMacDispatcher_SetTransactionPersistenceTime_Input_marshall_struct_t gpMacDispatcher_SetTransactionPersistenceTime; + gpMacDispatcher_SetBeaconStarted_Input_marshall_struct_t gpMacDispatcher_SetBeaconStarted; + gpMacDispatcher_GetBeaconStarted_Input_marshall_struct_t gpMacDispatcher_GetBeaconStarted; + gpMacDispatcher_SetCoordShortAddress_Input_marshall_struct_t gpMacDispatcher_SetCoordShortAddress; + gpMacDispatcher_GetCoordShortAddress_Input_marshall_struct_t gpMacDispatcher_GetCoordShortAddress; + gpMacDispatcher_SetCoordExtendedAddress_Input_marshall_struct_t gpMacDispatcher_SetCoordExtendedAddress; + gpMacDispatcher_GetCoordExtendedAddress_Input_marshall_struct_t gpMacDispatcher_GetCoordExtendedAddress; + gpMacDispatcher_SetPromiscuousMode_Input_marshall_struct_t gpMacDispatcher_SetPromiscuousMode; + gpMacDispatcher_GetPromiscuousMode_Input_marshall_struct_t gpMacDispatcher_GetPromiscuousMode; + gpMacDispatcher_SetAssociationPermit_Input_marshall_struct_t gpMacDispatcher_SetAssociationPermit; + gpMacDispatcher_GetAssociationPermit_Input_marshall_struct_t gpMacDispatcher_GetAssociationPermit; + gpMacDispatcher_SetSecurityEnabled_Input_marshall_struct_t gpMacDispatcher_SetSecurityEnabled; + gpMacDispatcher_GetSecurityEnabled_Input_marshall_struct_t gpMacDispatcher_GetSecurityEnabled; + gpMacDispatcher_SetNumberOfRetries_Input_marshall_struct_t gpMacDispatcher_SetNumberOfRetries; + gpMacDispatcher_GetNumberOfRetries_Input_marshall_struct_t gpMacDispatcher_GetNumberOfRetries; + gpMacDispatcher_SetMaxCsmaBackoffs_Input_marshall_struct_t gpMacDispatcher_SetMaxCsmaBackoffs; + gpMacDispatcher_GetMaxCsmaBackoffs_Input_marshall_struct_t gpMacDispatcher_GetMaxCsmaBackoffs; + gpMacDispatcher_SetDefaultTransmitPowers_Input_marshall_struct_t gpMacDispatcher_SetDefaultTransmitPowers; + gpMacDispatcher_SetTransmitPower_Input_marshall_struct_t gpMacDispatcher_SetTransmitPower; + gpMacDispatcher_GetTransmitPower_Input_marshall_struct_t gpMacDispatcher_GetTransmitPower; + gpMacDispatcher_SetCCAMode_Input_marshall_struct_t gpMacDispatcher_SetCCAMode; + gpMacDispatcher_GetCCAMode_Input_marshall_struct_t gpMacDispatcher_GetCCAMode; + gpMacDispatcher_SetPanCoordinator_Input_marshall_struct_t gpMacDispatcher_SetPanCoordinator; + gpMacDispatcher_GetPanCoordinator_Input_marshall_struct_t gpMacDispatcher_GetPanCoordinator; + gpMacDispatcher_SetMinBE_Input_marshall_struct_t gpMacDispatcher_SetMinBE; + gpMacDispatcher_GetMinBE_Input_marshall_struct_t gpMacDispatcher_GetMinBE; + gpMacDispatcher_SetIndicateBeaconNotifications_Input_marshall_struct_t gpMacDispatcher_SetIndicateBeaconNotifications; + gpMacDispatcher_GetIndicateBeaconNotifications_Input_marshall_struct_t gpMacDispatcher_GetIndicateBeaconNotifications; + gpMacDispatcher_SetMacVersion_Input_marshall_struct_t gpMacDispatcher_SetMacVersion; + gpMacDispatcher_GetMacVersion_Input_marshall_struct_t gpMacDispatcher_GetMacVersion; + gpMacDispatcher_SetForwardPollIndications_Input_marshall_struct_t gpMacDispatcher_SetForwardPollIndications; + gpMacDispatcher_GetForwardPollIndications_Input_marshall_struct_t gpMacDispatcher_GetForwardPollIndications; + gpMacDispatcher_DataPending_QueueAdd_Input_marshall_struct_t gpMacDispatcher_DataPending_QueueAdd; + gpMacDispatcher_DataPending_QueueRemove_Input_marshall_struct_t gpMacDispatcher_DataPending_QueueRemove; + gpMacDispatcher_SetMinInterferenceLevels_Input_marshall_struct_t gpMacDispatcher_SetMinInterferenceLevels; + gpMacDispatcher_SetMaxBE_Input_marshall_struct_t gpMacDispatcher_SetMaxBE; + gpMacDispatcher_GetMaxBE_Input_marshall_struct_t gpMacDispatcher_GetMaxBE; + gpMacDispatcher_SetDeviceDescriptor_Input_marshall_struct_t gpMacDispatcher_SetDeviceDescriptor; + gpMacDispatcher_GetDeviceDescriptor_Input_marshall_struct_t gpMacDispatcher_GetDeviceDescriptor; + gpMacDispatcher_SetDeviceTableEntries_Input_marshall_struct_t gpMacDispatcher_SetDeviceTableEntries; + gpMacDispatcher_GetDeviceTableEntries_Input_marshall_struct_t gpMacDispatcher_GetDeviceTableEntries; + gpMacDispatcher_SetKeyDescriptor_Input_marshall_struct_t gpMacDispatcher_SetKeyDescriptor; + gpMacDispatcher_GetKeyDescriptor_Input_marshall_struct_t gpMacDispatcher_GetKeyDescriptor; + gpMacDispatcher_SetKeyTableEntries_Input_marshall_struct_t gpMacDispatcher_SetKeyTableEntries; + gpMacDispatcher_SetSecurityLevelDescriptor_Input_marshall_struct_t gpMacDispatcher_SetSecurityLevelDescriptor; + gpMacDispatcher_GetSecurityLevelDescriptor_Input_marshall_struct_t gpMacDispatcher_GetSecurityLevelDescriptor; + gpMacDispatcher_SetSecurityLevelTableEntries_Input_marshall_struct_t gpMacDispatcher_SetSecurityLevelTableEntries; + gpMacDispatcher_GetSecurityLevelTableEntries_Input_marshall_struct_t gpMacDispatcher_GetSecurityLevelTableEntries; + gpMacDispatcher_SetDefaultKeySource_Input_marshall_struct_t gpMacDispatcher_SetDefaultKeySource; + gpMacDispatcher_SetFrameCounter_Input_marshall_struct_t gpMacDispatcher_SetFrameCounter; + gpMacDispatcher_GetFrameCounter_Input_marshall_struct_t gpMacDispatcher_GetFrameCounter; + gpMacDispatcher_SetPanCoordShortAddress_Input_marshall_struct_t gpMacDispatcher_SetPanCoordShortAddress; + gpMacDispatcher_SetPanCoordExtendedAddress_Input_marshall_struct_t gpMacDispatcher_SetPanCoordExtendedAddress; + gpMacDispatcher_GetPanCoordExtendedAddress_Input_marshall_struct_t gpMacDispatcher_GetPanCoordExtendedAddress; + gpMacDispatcher_AddNeighbour_Input_marshall_struct_t gpMacDispatcher_AddNeighbour; + gpMacDispatcher_RemoveNeighbour_Input_marshall_struct_t gpMacDispatcher_RemoveNeighbour; + gpMacDispatcher_SetDataPendingMode_Input_marshall_struct_t gpMacDispatcher_SetDataPendingMode; + gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_marshall_struct_t gpMacDispatcher_SetAddressModeOverrideForBeacons; + gpMacDispatcher_ClearNeighbours_Input_marshall_struct_t gpMacDispatcher_ClearNeighbours; + gpMacDispatcher_GetCallbacks_Input_marshall_struct_t gpMacDispatcher_GetCallbacks; + gpMacDispatcher_IsValidStack_Input_marshall_struct_t gpMacDispatcher_IsValidStack; + gpMacDispatcher_SetCsmaMode_Input_marshall_struct_t gpMacDispatcher_SetCsmaMode; + gpMacDispatcher_GetCsmaMode_Input_marshall_struct_t gpMacDispatcher_GetCsmaMode; + gpMacDispatcher_DataPending_QueueClear_Input_marshall_struct_t gpMacDispatcher_DataPending_QueueClear; + gpMacDispatcher_SetStackInRawMode_Input_marshall_struct_t gpMacDispatcher_SetStackInRawMode; + gpMacDispatcher_GetStackInRawMode_Input_marshall_struct_t gpMacDispatcher_GetStackInRawMode; + gpMacDispatcher_EnableEnhancedFramePending_Input_marshall_struct_t gpMacDispatcher_EnableEnhancedFramePending; + gpMacDispatcher_ConfigureEnhAckProbing_Input_marshall_struct_t gpMacDispatcher_ConfigureEnhAckProbing; + gpMacDispatcher_SetRetransmitOnCcaFail_Input_marshall_struct_t gpMacDispatcher_SetRetransmitOnCcaFail; + gpMacDispatcher_GetRetransmitOnCcaFail_Input_marshall_struct_t gpMacDispatcher_GetRetransmitOnCcaFail; + gpMacDispatcher_SetRetransmitRandomBackoff_Input_marshall_struct_t gpMacDispatcher_SetRetransmitRandomBackoff; + gpMacDispatcher_GetRetransmitRandomBackoff_Input_marshall_struct_t gpMacDispatcher_GetRetransmitRandomBackoff; + gpMacDispatcher_SetMinBeRetransmit_Input_marshall_struct_t gpMacDispatcher_SetMinBeRetransmit; + gpMacDispatcher_GetMinBeRetransmit_Input_marshall_struct_t gpMacDispatcher_GetMinBeRetransmit; + gpMacDispatcher_SetMaxBeRetransmit_Input_marshall_struct_t gpMacDispatcher_SetMaxBeRetransmit; + gpMacDispatcher_GetMaxBeRetransmit_Input_marshall_struct_t gpMacDispatcher_GetMaxBeRetransmit; + UInt8 dummy; //ensure none empty union definition +} gpMacDispatcher_Server_Input_union_t; + +typedef union { + gpMacDispatcher_RegisterNetworkStack_Output_marshall_struct_t gpMacDispatcher_RegisterNetworkStack; + gpMacDispatcher_UnRegisterNetworkStack_Output_marshall_struct_t gpMacDispatcher_UnRegisterNetworkStack; + gpMacDispatcher_LockClaim_Output_marshall_struct_t gpMacDispatcher_LockClaim; + gpMacDispatcher_LockedByThisStack_Output_marshall_struct_t gpMacDispatcher_LockedByThisStack; + gpMacDispatcher_Locked_Output_marshall_struct_t gpMacDispatcher_Locked; + gpMacDispatcher_Reset_Output_marshall_struct_t gpMacDispatcher_Reset; + gpMacDispatcher_Start_Output_marshall_struct_t gpMacDispatcher_Start; + gpMacDispatcher_GetPanId_Output_marshall_struct_t gpMacDispatcher_GetPanId; + gpMacDispatcher_GetShortAddress_Output_marshall_struct_t gpMacDispatcher_GetShortAddress; + gpMacDispatcher_GetExtendedAddress_Output_marshall_struct_t gpMacDispatcher_GetExtendedAddress; + gpMacDispatcher_GetDsn_Output_marshall_struct_t gpMacDispatcher_GetDsn; + gpMacDispatcher_GetCurrentChannel_Output_marshall_struct_t gpMacDispatcher_GetCurrentChannel; + gpMacDispatcher_GetBeaconPayload_Output_marshall_struct_t gpMacDispatcher_GetBeaconPayload; + gpMacDispatcher_GetBeaconPayloadLength_Output_marshall_struct_t gpMacDispatcher_GetBeaconPayloadLength; + gpMacDispatcher_GetRxOnWhenIdle_Output_marshall_struct_t gpMacDispatcher_GetRxOnWhenIdle; + gpMacDispatcher_GetTransactionPersistenceTime_Output_marshall_struct_t gpMacDispatcher_GetTransactionPersistenceTime; + gpMacDispatcher_GetBeaconStarted_Output_marshall_struct_t gpMacDispatcher_GetBeaconStarted; + gpMacDispatcher_GetCoordShortAddress_Output_marshall_struct_t gpMacDispatcher_GetCoordShortAddress; + gpMacDispatcher_GetCoordExtendedAddress_Output_marshall_struct_t gpMacDispatcher_GetCoordExtendedAddress; + gpMacDispatcher_GetPromiscuousMode_Output_marshall_struct_t gpMacDispatcher_GetPromiscuousMode; + gpMacDispatcher_GetAssociationPermit_Output_marshall_struct_t gpMacDispatcher_GetAssociationPermit; + gpMacDispatcher_GetSecurityEnabled_Output_marshall_struct_t gpMacDispatcher_GetSecurityEnabled; + gpMacDispatcher_GetNumberOfRetries_Output_marshall_struct_t gpMacDispatcher_GetNumberOfRetries; + gpMacDispatcher_GetMaxCsmaBackoffs_Output_marshall_struct_t gpMacDispatcher_GetMaxCsmaBackoffs; + gpMacDispatcher_GetTransmitPower_Output_marshall_struct_t gpMacDispatcher_GetTransmitPower; + gpMacDispatcher_GetCCAMode_Output_marshall_struct_t gpMacDispatcher_GetCCAMode; + gpMacDispatcher_GetPanCoordinator_Output_marshall_struct_t gpMacDispatcher_GetPanCoordinator; + gpMacDispatcher_GetMinBE_Output_marshall_struct_t gpMacDispatcher_GetMinBE; + gpMacDispatcher_GetIndicateBeaconNotifications_Output_marshall_struct_t gpMacDispatcher_GetIndicateBeaconNotifications; + gpMacDispatcher_GetMacVersion_Output_marshall_struct_t gpMacDispatcher_GetMacVersion; + gpMacDispatcher_GetForwardPollIndications_Output_marshall_struct_t gpMacDispatcher_GetForwardPollIndications; + gpMacDispatcher_DataPending_QueueAdd_Output_marshall_struct_t gpMacDispatcher_DataPending_QueueAdd; + gpMacDispatcher_DataPending_QueueRemove_Output_marshall_struct_t gpMacDispatcher_DataPending_QueueRemove; + gpMacDispatcher_GetMaxBE_Output_marshall_struct_t gpMacDispatcher_GetMaxBE; + gpMacDispatcher_SetDeviceDescriptor_Output_marshall_struct_t gpMacDispatcher_SetDeviceDescriptor; + gpMacDispatcher_GetDeviceDescriptor_Output_marshall_struct_t gpMacDispatcher_GetDeviceDescriptor; + gpMacDispatcher_GetDeviceTableEntries_Output_marshall_struct_t gpMacDispatcher_GetDeviceTableEntries; + gpMacDispatcher_SetKeyDescriptor_Output_marshall_struct_t gpMacDispatcher_SetKeyDescriptor; + gpMacDispatcher_GetKeyDescriptor_Output_marshall_struct_t gpMacDispatcher_GetKeyDescriptor; + gpMacDispatcher_SetSecurityLevelDescriptor_Output_marshall_struct_t gpMacDispatcher_SetSecurityLevelDescriptor; + gpMacDispatcher_GetSecurityLevelDescriptor_Output_marshall_struct_t gpMacDispatcher_GetSecurityLevelDescriptor; + gpMacDispatcher_GetSecurityLevelTableEntries_Output_marshall_struct_t gpMacDispatcher_GetSecurityLevelTableEntries; + gpMacDispatcher_GetFrameCounter_Output_marshall_struct_t gpMacDispatcher_GetFrameCounter; + gpMacDispatcher_GetPanCoordExtendedAddress_Output_marshall_struct_t gpMacDispatcher_GetPanCoordExtendedAddress; + gpMacDispatcher_AddNeighbour_Output_marshall_struct_t gpMacDispatcher_AddNeighbour; + gpMacDispatcher_RemoveNeighbour_Output_marshall_struct_t gpMacDispatcher_RemoveNeighbour; + gpMacDispatcher_SetDataPendingMode_Output_marshall_struct_t gpMacDispatcher_SetDataPendingMode; + gpMacDispatcher_GetCallbacks_Output_marshall_struct_t gpMacDispatcher_GetCallbacks; + gpMacDispatcher_IsValidStack_Output_marshall_struct_t gpMacDispatcher_IsValidStack; + gpMacDispatcher_GetCsmaMode_Output_marshall_struct_t gpMacDispatcher_GetCsmaMode; + gpMacDispatcher_DataPending_QueueClear_Output_marshall_struct_t gpMacDispatcher_DataPending_QueueClear; + gpMacDispatcher_GetStackInRawMode_Output_marshall_struct_t gpMacDispatcher_GetStackInRawMode; + gpMacDispatcher_GetCurrentTimeUs_Output_marshall_struct_t gpMacDispatcher_GetCurrentTimeUs; + gpMacDispatcher_ConfigureEnhAckProbing_Output_marshall_struct_t gpMacDispatcher_ConfigureEnhAckProbing; + gpMacDispatcher_GetRetransmitOnCcaFail_Output_marshall_struct_t gpMacDispatcher_GetRetransmitOnCcaFail; + gpMacDispatcher_GetRetransmitRandomBackoff_Output_marshall_struct_t gpMacDispatcher_GetRetransmitRandomBackoff; + gpMacDispatcher_GetMinBeRetransmit_Output_marshall_struct_t gpMacDispatcher_GetMinBeRetransmit; + gpMacDispatcher_GetMaxBeRetransmit_Output_marshall_struct_t gpMacDispatcher_GetMaxBeRetransmit; + UInt8 dummy; //ensure none empty union definition +} gpMacDispatcher_Server_Output_union_t; + +typedef union { + MacDispatcher_cbDataConfirm_Input_marshall_struct_t MacDispatcher_cbDataConfirm; + MacDispatcher_cbDataIndication_Input_marshall_struct_t MacDispatcher_cbDataIndication; + MacDispatcher_cbScanConfirm_Input_marshall_struct_t MacDispatcher_cbScanConfirm; + MacDispatcher_cbAssociateIndication_Input_marshall_struct_t MacDispatcher_cbAssociateIndication; + MacDispatcher_cbAssociateConfirm_Input_marshall_struct_t MacDispatcher_cbAssociateConfirm; + MacDispatcher_cbAssociateCommStatusIndication_Input_marshall_struct_t MacDispatcher_cbAssociateCommStatusIndication; + MacDispatcher_cbPollConfirm_Input_marshall_struct_t MacDispatcher_cbPollConfirm; + MacDispatcher_cbPollIndication_Input_marshall_struct_t MacDispatcher_cbPollIndication; + MacDispatcher_cbPurgeConfirm_Input_marshall_struct_t MacDispatcher_cbPurgeConfirm; + MacDispatcher_cbBeaconNotifyIndication_Input_marshall_struct_t MacDispatcher_cbBeaconNotifyIndication; + MacDispatcher_cbOrphanIndication_Input_marshall_struct_t MacDispatcher_cbOrphanIndication; + MacDispatcher_cbOrphanCommStatusIndication_Input_marshall_struct_t MacDispatcher_cbOrphanCommStatusIndication; + MacDispatcher_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t MacDispatcher_cbSecurityFailureCommStatusIndication; + MacDispatcher_cbDriverResetIndication_Input_marshall_struct_t MacDispatcher_cbDriverResetIndication; + MacDispatcher_cbPollNotify_Input_marshall_struct_t MacDispatcher_cbPollNotify; + MacDispatcher_cbSecurityFrameCounterIndication_Input_marshall_struct_t MacDispatcher_cbSecurityFrameCounterIndication; + UInt8 dummy; //ensure none empty union definition +} gpMacDispatcher_Client_Input_union_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpMacDispatcher_StackId_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacDispatcher_StackId_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacDispatcher_StackId_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacDispatcher_StackId_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacDispatcher_Result_t_buf2api(pDest, pSource, length, pIndex) gpMacCore_Result_t_buf2api(pDest, pSource, length, pIndex) +#define gpMacDispatcher_Result_t_api2buf(pDest, pSource, length, pIndex) gpMacCore_Result_t_api2buf(pDest, pSource, length, pIndex) +#define gpMacDispatcher_Result_t_buf2api_1(pDest, pSource, pIndex) gpMacCore_Result_t_buf2api_1(pDest, pSource, pIndex) +#define gpMacDispatcher_Result_t_api2buf_1(pDest, pSource, pIndex) gpMacCore_Result_t_api2buf_1(pDest, pSource, pIndex) +#define gpMacDispatcher_cbDataIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPurgeConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPurgeConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPurgeConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPurgeConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbBeaconNotifyIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbBeaconNotifyIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbBeaconNotifyIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbBeaconNotifyIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbScanConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbScanConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbScanConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbScanConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssocConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssocConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssocConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssocConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateCommStatusIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateCommStatusIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateCommStatusIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateCommStatusIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanCommStatusIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanCommStatusIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanCommStatusIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanCommStatusIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDriverResetIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDriverResetIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDriverResetIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDriverResetIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollNotify_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollNotify_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollNotify_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollNotify_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) + +// Structure copy functions +gpMarshall_AckStatus_t gpMacDispatcher_StringIdentifier_t_buf2api(gpMacDispatcher_StringIdentifier_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacDispatcher_StringIdentifier_t_api2buf(UInt8Buffer* pDest , const gpMacDispatcher_StringIdentifier_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_Callbacks_t_buf2api(gpMacDispatcher_Callbacks_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacDispatcher_Callbacks_t_api2buf(UInt8Buffer* pDest , const gpMacDispatcher_Callbacks_t* pSource , UInt16 length , UInt16* pIndex); +// Server functions +gpMarshall_AckStatus_t gpMacDispatcher_RegisterNetworkStack_Input_buf2api(gpMacDispatcher_RegisterNetworkStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_RegisterNetworkStack_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_RegisterNetworkStack_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_RegisterNetworkStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_UnRegisterNetworkStack_Input_buf2api(gpMacDispatcher_UnRegisterNetworkStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_UnRegisterNetworkStack_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_UnRegisterNetworkStack_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_UnRegisterNetworkStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_RegisterCallbacks_Input_buf2api(gpMacDispatcher_RegisterCallbacks_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_LockClaim_Input_buf2api(gpMacDispatcher_LockClaim_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_LockClaim_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_LockClaim_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_LockClaim_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_LockRelease_Input_buf2api(gpMacDispatcher_LockRelease_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_LockedByThisStack_Input_buf2api(gpMacDispatcher_LockedByThisStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_LockedByThisStack_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_LockedByThisStack_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_LockedByThisStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpMacDispatcher_Locked_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_Locked_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_Reset_Input_buf2api(gpMacDispatcher_Reset_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_Reset_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_Reset_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_Reset_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_DataRequest_Input_buf2api(gpMacDispatcher_DataRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_ScanRequest_Input_buf2api(gpMacDispatcher_ScanRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_AssociateRequest_Input_buf2api(gpMacDispatcher_AssociateRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_AssociateResponse_Input_buf2api(gpMacDispatcher_AssociateResponse_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_PollRequest_Input_buf2api(gpMacDispatcher_PollRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_PurgeRequest_Input_buf2api(gpMacDispatcher_PurgeRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_Start_Input_buf2api(gpMacDispatcher_Start_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_Start_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_Start_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_Start_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_OrphanResponse_Input_buf2api(gpMacDispatcher_OrphanResponse_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPanId_Input_buf2api(gpMacDispatcher_SetPanId_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetPanId_Input_buf2api(gpMacDispatcher_GetPanId_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetPanId_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetPanId_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetPanId_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetShortAddress_Input_buf2api(gpMacDispatcher_SetShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetShortAddress_Input_buf2api(gpMacDispatcher_GetShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetShortAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetShortAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetShortAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetExtendedAddress_Input_buf2api(gpMacDispatcher_SetExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetExtendedAddress_Input_buf2api(gpMacDispatcher_GetExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDsn_Input_buf2api(gpMacDispatcher_SetDsn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetDsn_Input_buf2api(gpMacDispatcher_GetDsn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetDsn_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetDsn_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetDsn_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCurrentChannel_Input_buf2api(gpMacDispatcher_SetCurrentChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCurrentChannel_Input_buf2api(gpMacDispatcher_GetCurrentChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCurrentChannel_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCurrentChannel_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCurrentChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetBeaconPayload_Input_buf2api(gpMacDispatcher_SetBeaconPayload_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetBeaconPayload_Input_buf2api(gpMacDispatcher_GetBeaconPayload_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayload_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetBeaconPayload_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetBeaconPayload_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetBeaconPayloadLength_Input_buf2api(gpMacDispatcher_SetBeaconPayloadLength_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetBeaconPayloadLength_Input_buf2api(gpMacDispatcher_GetBeaconPayloadLength_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayloadLength_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetBeaconPayloadLength_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetBeaconPayloadLength_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetRxOnWhenIdle_Input_buf2api(gpMacDispatcher_SetRxOnWhenIdle_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetRxOnWhenIdle_Input_buf2api(gpMacDispatcher_GetRxOnWhenIdle_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetRxOnWhenIdle_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetRxOnWhenIdle_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetRxOnWhenIdle_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetTransactionPersistenceTime_Input_buf2api(gpMacDispatcher_GetTransactionPersistenceTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetTransactionPersistenceTime_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetTransactionPersistenceTime_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetTransactionPersistenceTime_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetTransactionPersistenceTime_Input_buf2api(gpMacDispatcher_SetTransactionPersistenceTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetBeaconStarted_Input_buf2api(gpMacDispatcher_SetBeaconStarted_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetBeaconStarted_Input_buf2api(gpMacDispatcher_GetBeaconStarted_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetBeaconStarted_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetBeaconStarted_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetBeaconStarted_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCoordShortAddress_Input_buf2api(gpMacDispatcher_SetCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCoordShortAddress_Input_buf2api(gpMacDispatcher_GetCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCoordShortAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCoordShortAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCoordShortAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCoordExtendedAddress_Input_buf2api(gpMacDispatcher_SetCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCoordExtendedAddress_Input_buf2api(gpMacDispatcher_GetCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCoordExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCoordExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCoordExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPromiscuousMode_Input_buf2api(gpMacDispatcher_SetPromiscuousMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetPromiscuousMode_Input_buf2api(gpMacDispatcher_GetPromiscuousMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetPromiscuousMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetPromiscuousMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetPromiscuousMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetAssociationPermit_Input_buf2api(gpMacDispatcher_SetAssociationPermit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetAssociationPermit_Input_buf2api(gpMacDispatcher_GetAssociationPermit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetAssociationPermit_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetAssociationPermit_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetAssociationPermit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetSecurityEnabled_Input_buf2api(gpMacDispatcher_SetSecurityEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetSecurityEnabled_Input_buf2api(gpMacDispatcher_GetSecurityEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetSecurityEnabled_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetSecurityEnabled_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetSecurityEnabled_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetNumberOfRetries_Input_buf2api(gpMacDispatcher_SetNumberOfRetries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetNumberOfRetries_Input_buf2api(gpMacDispatcher_GetNumberOfRetries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetNumberOfRetries_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetNumberOfRetries_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetNumberOfRetries_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMaxCsmaBackoffs_Input_buf2api(gpMacDispatcher_SetMaxCsmaBackoffs_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMaxCsmaBackoffs_Input_buf2api(gpMacDispatcher_GetMaxCsmaBackoffs_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMaxCsmaBackoffs_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMaxCsmaBackoffs_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMaxCsmaBackoffs_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDefaultTransmitPowers_Input_buf2api(gpMacDispatcher_SetDefaultTransmitPowers_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetTransmitPower_Input_buf2api(gpMacDispatcher_SetTransmitPower_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetTransmitPower_Input_buf2api(gpMacDispatcher_GetTransmitPower_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetTransmitPower_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetTransmitPower_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetTransmitPower_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCCAMode_Input_buf2api(gpMacDispatcher_SetCCAMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCCAMode_Input_buf2api(gpMacDispatcher_GetCCAMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCCAMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCCAMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCCAMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPanCoordinator_Input_buf2api(gpMacDispatcher_SetPanCoordinator_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetPanCoordinator_Input_buf2api(gpMacDispatcher_GetPanCoordinator_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordinator_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetPanCoordinator_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetPanCoordinator_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMinBE_Input_buf2api(gpMacDispatcher_SetMinBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMinBE_Input_buf2api(gpMacDispatcher_GetMinBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMinBE_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMinBE_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMinBE_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetIndicateBeaconNotifications_Input_buf2api(gpMacDispatcher_SetIndicateBeaconNotifications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetIndicateBeaconNotifications_Input_buf2api(gpMacDispatcher_GetIndicateBeaconNotifications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetIndicateBeaconNotifications_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetIndicateBeaconNotifications_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetIndicateBeaconNotifications_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMacVersion_Input_buf2api(gpMacDispatcher_SetMacVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMacVersion_Input_buf2api(gpMacDispatcher_GetMacVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMacVersion_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMacVersion_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMacVersion_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetForwardPollIndications_Input_buf2api(gpMacDispatcher_SetForwardPollIndications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetForwardPollIndications_Input_buf2api(gpMacDispatcher_GetForwardPollIndications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetForwardPollIndications_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetForwardPollIndications_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetForwardPollIndications_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_DataPending_QueueAdd_Input_buf2api(gpMacDispatcher_DataPending_QueueAdd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueAdd_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_DataPending_QueueAdd_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_DataPending_QueueAdd_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_DataPending_QueueRemove_Input_buf2api(gpMacDispatcher_DataPending_QueueRemove_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueRemove_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_DataPending_QueueRemove_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_DataPending_QueueRemove_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMinInterferenceLevels_Input_buf2api(gpMacDispatcher_SetMinInterferenceLevels_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMaxBE_Input_buf2api(gpMacDispatcher_SetMaxBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMaxBE_Input_buf2api(gpMacDispatcher_GetMaxBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMaxBE_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMaxBE_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMaxBE_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDeviceDescriptor_Input_buf2api(gpMacDispatcher_SetDeviceDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDeviceDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_SetDeviceDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_SetDeviceDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetDeviceDescriptor_Input_buf2api(gpMacDispatcher_GetDeviceDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetDeviceDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetDeviceDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetDeviceDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDeviceTableEntries_Input_buf2api(gpMacDispatcher_SetDeviceTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetDeviceTableEntries_Input_buf2api(gpMacDispatcher_GetDeviceTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetDeviceTableEntries_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetDeviceTableEntries_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetDeviceTableEntries_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetKeyDescriptor_Input_buf2api(gpMacDispatcher_SetKeyDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetKeyDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_SetKeyDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_SetKeyDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetKeyDescriptor_Input_buf2api(gpMacDispatcher_GetKeyDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetKeyDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetKeyDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetKeyDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetKeyTableEntries_Input_buf2api(gpMacDispatcher_SetKeyTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetSecurityLevelDescriptor_Input_buf2api(gpMacDispatcher_SetSecurityLevelDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetSecurityLevelDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_SetSecurityLevelDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_SetSecurityLevelDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetSecurityLevelDescriptor_Input_buf2api(gpMacDispatcher_GetSecurityLevelDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetSecurityLevelDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetSecurityLevelDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetSecurityLevelTableEntries_Input_buf2api(gpMacDispatcher_SetSecurityLevelTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetSecurityLevelTableEntries_Input_buf2api(gpMacDispatcher_GetSecurityLevelTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelTableEntries_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetSecurityLevelTableEntries_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetSecurityLevelTableEntries_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDefaultKeySource_Input_buf2api(gpMacDispatcher_SetDefaultKeySource_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetFrameCounter_Input_buf2api(gpMacDispatcher_SetFrameCounter_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetFrameCounter_Input_buf2api(gpMacDispatcher_GetFrameCounter_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetFrameCounter_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetFrameCounter_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetFrameCounter_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPanCoordShortAddress_Input_buf2api(gpMacDispatcher_SetPanCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPanCoordExtendedAddress_Input_buf2api(gpMacDispatcher_SetPanCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetPanCoordExtendedAddress_Input_buf2api(gpMacDispatcher_GetPanCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetPanCoordExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetPanCoordExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_AddNeighbour_Input_buf2api(gpMacDispatcher_AddNeighbour_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_AddNeighbour_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_AddNeighbour_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_AddNeighbour_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_RemoveNeighbour_Input_buf2api(gpMacDispatcher_RemoveNeighbour_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_RemoveNeighbour_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_RemoveNeighbour_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_RemoveNeighbour_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDataPendingMode_Input_buf2api(gpMacDispatcher_SetDataPendingMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDataPendingMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_SetDataPendingMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_SetDataPendingMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_buf2api(gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_ClearNeighbours_Input_buf2api(gpMacDispatcher_ClearNeighbours_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCallbacks_Input_buf2api(gpMacDispatcher_GetCallbacks_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCallbacks_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCallbacks_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCallbacks_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_IsValidStack_Input_buf2api(gpMacDispatcher_IsValidStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_IsValidStack_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_IsValidStack_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_IsValidStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCsmaMode_Input_buf2api(gpMacDispatcher_SetCsmaMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCsmaMode_Input_buf2api(gpMacDispatcher_GetCsmaMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCsmaMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCsmaMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCsmaMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_DataPending_QueueClear_Input_buf2api(gpMacDispatcher_DataPending_QueueClear_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueClear_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_DataPending_QueueClear_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_DataPending_QueueClear_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetStackInRawMode_Input_buf2api(gpMacDispatcher_SetStackInRawMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetStackInRawMode_Input_buf2api(gpMacDispatcher_GetStackInRawMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetStackInRawMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetStackInRawMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetStackInRawMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_EnableEnhancedFramePending_Input_buf2api(gpMacDispatcher_EnableEnhancedFramePending_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCurrentTimeUs_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCurrentTimeUs_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_ConfigureEnhAckProbing_Input_buf2api(gpMacDispatcher_ConfigureEnhAckProbing_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_ConfigureEnhAckProbing_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_ConfigureEnhAckProbing_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_ConfigureEnhAckProbing_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetRetransmitOnCcaFail_Input_buf2api(gpMacDispatcher_SetRetransmitOnCcaFail_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetRetransmitOnCcaFail_Input_buf2api(gpMacDispatcher_GetRetransmitOnCcaFail_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitOnCcaFail_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetRetransmitOnCcaFail_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetRetransmitOnCcaFail_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetRetransmitRandomBackoff_Input_buf2api(gpMacDispatcher_SetRetransmitRandomBackoff_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetRetransmitRandomBackoff_Input_buf2api(gpMacDispatcher_GetRetransmitRandomBackoff_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitRandomBackoff_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetRetransmitRandomBackoff_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetRetransmitRandomBackoff_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMinBeRetransmit_Input_buf2api(gpMacDispatcher_SetMinBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMinBeRetransmit_Input_buf2api(gpMacDispatcher_GetMinBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMinBeRetransmit_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMinBeRetransmit_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMinBeRetransmit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMaxBeRetransmit_Input_buf2api(gpMacDispatcher_SetMaxBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMaxBeRetransmit_Input_buf2api(gpMacDispatcher_GetMaxBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMaxBeRetransmit_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMaxBeRetransmit_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMaxBeRetransmit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void MacDispatcher_cbDataConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpPd_Handle_t pdHandle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbDataIndication_Input_par2api(UInt8Buffer* pDest , const gpMacCore_AddressInfo_t* pSrcAddrInfo , const gpMacCore_AddressInfo_t* pDstAddrInfo , UInt8 dsn , gpMacCore_Security_t* pSecOptions , gpPd_Loh_t pdLoh , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbScanConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpMacCore_ScanType_t scanType , UInt32 unscannedChannels , UInt8 resultListSize , UInt8* pEdScanResultList , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbAssociateIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_Address_t* pDeviceAddress , UInt8 capabilityInformation , gpPd_TimeStamp_t rxTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbAssociateConfirm_Input_par2api(UInt8Buffer* pDest , UInt16 assocShortAddress , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbAssociateCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddrInfo , gpMacCore_AddressInfo_t* pDstAddrInfo , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbPollConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpMacCore_AddressInfo_t* coordAddrInfo , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbPollIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* addressInfo , gpPd_TimeStamp_t rxTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbPurgeConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpPd_Handle_t pdHandle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbBeaconNotifyIndication_Input_par2api(UInt8Buffer* pDest , UInt8 bsn , gpMacCore_PanDescriptor_t* pPanDescriptor , UInt8 beaconPayloadLength , UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbOrphanIndication_Input_par2api(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , gpPd_TimeStamp_t rxTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbOrphanCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddrInfo , gpMacCore_AddressInfo_t* pDstAddrInfo , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbSecurityFailureCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddrInfo , gpMacCore_AddressInfo_t* pDstAddrInfo , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbDriverResetIndication_Input_par2api(UInt8Buffer* pDest , gpMacDispatcher_Result_t status , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbPollNotify_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* addressInfo , gpPd_TimeStamp_t rxTime , gpPd_Handle_t pdHandle , Bool fromNeighbour , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbSecurityFrameCounterIndication_Input_par2api(UInt8Buffer* pDest , UInt32 frameCounter , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); + +// Client functions +void gpMacDispatcher_RegisterNetworkStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StringIdentifier_t* stringIdentifier , UInt16* pIndex); +void gpMacDispatcher_RegisterNetworkStack_Output_buf2par(gpMacDispatcher_StackId_t* stackId , gpMacDispatcher_StringIdentifier_t* stringIdentifier , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_UnRegisterNetworkStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_UnRegisterNetworkStack_Output_buf2par(gpMacCore_Result_t* result , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_RegisterCallbacks_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , gpMacDispatcher_Callbacks_t* callbacks , UInt16* pIndex); +void gpMacDispatcher_LockClaim_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_LockClaim_Output_buf2par(Bool* result , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_LockRelease_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_LockedByThisStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_LockedByThisStack_Output_buf2par(Bool* locked , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_Locked_Output_buf2par(Bool* locked , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_Reset_Input_par2buf(UInt8Buffer* pDest , Bool setDefaultPib , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_Reset_Output_buf2par(gpMacDispatcher_Result_t* result , Bool setDefaultPib , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressMode_t srcAddrMode , gpMacCore_AddressInfo_t* pDstAddressInfo , UInt8 txOptions , gpMacCore_Security_t* pSecOptions , gpMacCore_MultiChannelOptions_t multiChannelOptions , gpPd_Loh_t pdLoh , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_ScanRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_ScanType_t scanType , UInt32 scanChannels , UInt8 scanDuration , UInt8 resultListSize , UInt8* pResultList , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_AssociateRequest_Input_par2buf(UInt8Buffer* pDest , UInt8 logicalChannel , gpMacCore_AddressInfo_t* coordAddrInfo , UInt8 capabilityInformation , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_AssociateResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pDeviceAddress , UInt16 associateShortAddress , gpMacCore_Result_t status , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_PollRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* coordAddrInfo , gpMacCore_Security_t* pSecOptions , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_PurgeRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_Start_Input_par2buf(UInt8Buffer* pDest , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , UInt8 stackId , UInt16* pIndex); +void gpMacDispatcher_Start_Output_buf2par(gpMacCore_Result_t* returnValue , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , UInt8 stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_OrphanResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , UInt16 shortAddress , Bool associatedMember , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetPanId_Input_par2buf(UInt8Buffer* pDest , UInt16 panId , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanId_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanId_Output_buf2par(gpMacCore_PanId_t* panId , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetShortAddress_Output_buf2par(UInt16* address , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetExtendedAddress_Output_buf2par(MACAddress_t* pExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDsn_Input_par2buf(UInt8Buffer* pDest , UInt8 dsn , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDsn_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDsn_Output_buf2par(UInt8* dsn , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCurrentChannel_Output_buf2par(UInt8* channel , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayload_Output_buf2par(UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , UInt8 beaconPayloadLength , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayloadLength_Output_buf2par(UInt8* beaconPayloadLength , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , Bool rxOnWhenIdle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRxOnWhenIdle_Output_buf2par(Bool* rxOnWhenIdle , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetTransactionPersistenceTime_Output_buf2par(UInt16* time , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , UInt16 time , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , Bool beaconStarted , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconStarted_Output_buf2par(Bool* beaconStarted , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 coordShortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCoordShortAddress_Output_buf2par(UInt16* coordShortAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCoordExtendedAddress_Output_buf2par(MACAddress_t* pCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , UInt8 promiscuousMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPromiscuousMode_Output_buf2par(Bool* promiscuousMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , Bool associationPermit , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetAssociationPermit_Output_buf2par(Bool* associationPermit , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , Bool securityEnabled , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityEnabled_Output_buf2par(Bool* securityEnabled , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , UInt8 numberOfRetries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetNumberOfRetries_Output_buf2par(UInt8* numberOfRetries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , UInt8 maxCsmaBackoffs , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxCsmaBackoffs_Output_buf2par(UInt8* maxCsmaBackoffs , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDefaultTransmitPowers_Input_par2buf(UInt8Buffer* pDest , Int8* pDefaultTransmitPowerTable , UInt16* pIndex); +void gpMacDispatcher_SetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacCore_TxPower_t transmitPower , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetTransmitPower_Output_buf2par(Int8* transmitPower , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCCAMode_Input_par2buf(UInt8Buffer* pDest , UInt8 cCAMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCCAMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCCAMode_Output_buf2par(UInt8* cCAMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , Bool panCoordinator , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordinator_Output_buf2par(Bool* panCoordinator , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMinBE_Input_par2buf(UInt8Buffer* pDest , UInt8 minBE , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMinBE_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMinBE_Output_buf2par(UInt8* minBE , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetIndicateBeaconNotifications_Output_buf2par(Bool* enable , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacCore_MacVersion_t macVersion , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMacVersion_Output_buf2par(gpMacCore_MacVersion_t* macVersion , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetForwardPollIndications_Output_buf2par(Bool* enable , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueAdd_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueAdd_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueRemove_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueRemove_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMinInterferenceLevels_Input_par2buf(UInt8Buffer* pDest , Int8* pInterferenceLevels , UInt16* pIndex); +void gpMacDispatcher_SetMaxBE_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBE , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxBE_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxBE_Output_buf2par(UInt8* maxBE , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceTablesEntries_t deviceTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDeviceTableEntries_Output_buf2par(gpMacCore_DeviceTablesEntries_t* deviceTableEntries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetKeyTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyTablesEntries_t keyTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelTableEntries_Output_buf2par(gpMacCore_SecurityLevelTableEntries_t* securityLevelTableEntries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDefaultKeySource_Input_par2buf(UInt8Buffer* pDest , UInt8* pDefaultKeySource , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetFrameCounter_Input_par2buf(UInt8Buffer* pDest , UInt32 frameCounter , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetFrameCounter_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetFrameCounter_Output_buf2par(UInt32* frameCounter , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetPanCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 panCoordShortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pPanCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordExtendedAddress_Output_buf2par(MACAddress_t* pPanCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_AddNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_AddNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_RemoveNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_RemoveNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDataPendingMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetDataPendingMode_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_par2buf(UInt8Buffer* pDest , UInt8 addressMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_ClearNeighbours_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCallbacks_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCallbacks_Output_buf2par(gpMacDispatcher_StackId_t stackId , gpMacDispatcher_Callbacks_t* callbacks , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_IsValidStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_IsValidStack_Output_buf2par(Bool* valid , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCsmaMode_Input_par2buf(UInt8Buffer* pDest , UInt8 csmaMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCsmaMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCsmaMode_Output_buf2par(UInt8* csmaMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueClear_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueClear_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , Bool rawModeEnabled , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetStackInRawMode_Output_buf2par(Bool* rawModeEnabled , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_EnableEnhancedFramePending_Input_par2buf(UInt8Buffer* pDest , Bool enableEnhancedFramePending , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCurrentTimeUs_Output_buf2par(UInt32* currentTime , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_ConfigureEnhAckProbing_Input_par2buf(UInt8Buffer* pDest , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_ConfigureEnhAckProbing_Output_buf2par(gpMacCore_Result_t* result , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitOnCcaFail_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitRandomBackoff_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 minBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMinBeRetransmit_Output_buf2par(UInt8* minBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxBeRetransmit_Output_buf2par(UInt8* maxBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbDataConfirm_Input_buf2api(MacDispatcher_cbDataConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbDataIndication_Input_buf2api(MacDispatcher_cbDataIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbScanConfirm_Input_buf2api(MacDispatcher_cbScanConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbAssociateIndication_Input_buf2api(MacDispatcher_cbAssociateIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbAssociateConfirm_Input_buf2api(MacDispatcher_cbAssociateConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbAssociateCommStatusIndication_Input_buf2api(MacDispatcher_cbAssociateCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbPollConfirm_Input_buf2api(MacDispatcher_cbPollConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbPollIndication_Input_buf2api(MacDispatcher_cbPollIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbPurgeConfirm_Input_buf2api(MacDispatcher_cbPurgeConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbBeaconNotifyIndication_Input_buf2api(MacDispatcher_cbBeaconNotifyIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbOrphanIndication_Input_buf2api(MacDispatcher_cbOrphanIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbOrphanCommStatusIndication_Input_buf2api(MacDispatcher_cbOrphanCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbSecurityFailureCommStatusIndication_Input_buf2api(MacDispatcher_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbDriverResetIndication_Input_buf2api(MacDispatcher_cbDriverResetIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbPollNotify_Input_buf2api(MacDispatcher_cbPollNotify_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbSecurityFrameCounterIndication_Input_buf2api(MacDispatcher_cbSecurityFrameCounterIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); + +void gpMacDispatcher_InitMarshalling(void); + +#define gpMacDispatcher_SetDummyDataInsertion(enable) +#define gpMacDispatcher_GetDummyDataInsertion() false + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPMACDISPATCHER_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher.h new file mode 100644 index 0000000..18a0604 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher.h @@ -0,0 +1,292 @@ +/* + * Copyright (c) 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpMacDispatcher.h + * This file contains the definitions of the public functions and enumerations of the gpMacDispatcher.(based on IEEE802.15.4-2006) + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GP_MACDISPATCHER_H_ +#define _GP_MACDISPATCHER_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpMacCore.h" + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/** @brief The invalid stack ID. */ +#define GP_MAC_DISPATCHER_INVALID_STACK_ID (GP_MACCORE_STACK_UNDEFINED) +#define GP_MAC_DISPATCHER_STRING_ID_LENGTH 5 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @name gpMacDispatcher_Result_t */ +//@{ +//PHY results +/** @brief The requested operation was completed successfully. For instance if a transmission was requested, this value indicates a successful transmission.*/ +#define gpMacDispatcher_ResultSuccess gpMacCore_ResultSuccess +//MAC results +/** @brief The frame counter purportedly applied by the originator of the received frame is invalid. */ +#define gpMacDispatcher_ResultCounterError gpMacCore_ResultCounterError +/** @brief The key purportedly applied by the originator of the received frame is not allowed to be used with that frame type according to the key usage policy of the recipient.*/ +#define gpMacDispatcher_ResultImproperKeyType gpMacCore_ResultImproperKeyType +/** @brief The security level purportedly applied by the originator of the received frame does not meet the minimum security level required/expected by the recipient for that frame type.*/ +#define gpMacDispatcher_ResultImproperSecurityLevel gpMacCore_ResultImproperSecurityLevel +/** @brief The received frame was purportedly secured using security based on IEEE Std 802.15.4-2003, and such security is not supported by this standard. */ +#define gpMacDispatcher_ResultUnsupportedLegacy gpMacCore_ResultUnsupportedLegacy +/** @brief The security purportedly applied by the originator of the received frame is not supported. */ +#define gpMacDispatcher_ResultUnsupportedSecurity gpMacCore_ResultUnsupportedSecurity +/** @brief The beacon was lost following a synchronization request. */ +#define gpMacDispatcher_ResultBeaconLoss gpMacCore_ResultBeaconLoss +/** @brief A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed. */ +#define gpMacDispatcher_ResultChannelAccessFailure gpMacCore_ResultChannelAccessFailure +/** @brief The GTS request has been denied by the PAN coordinator. */ +#define gpMacDispatcher_ResultDenied gpMacCore_ResultDenied +/** @brief The attempt to disable the transceiver has failed. */ +#define gpMacDispatcher_ResultDisableTrxFailure gpMacCore_ResultDisableTrxFailure +/** @brief The received frame induces a failed security check according to the security suite. */ +#define gpMacDispatcher_ResultSecurityError gpMacCore_ResultSecurityError +/** @brief The frame resulting from secure processing has a length that is greater than aMACMaxFrameSize. */ +#define gpMacDispatcher_ResultFrameTooLong gpMacCore_ResultFrameTooLong +/** @brief The requested GTS transmission failed because the specified GTS either did not have a transmit GTS direction or was not defined. */ +#define gpMacDispatcher_ResultInvalidGTS gpMacCore_ResultInvalidGTS +/** @brief A request to purge an MSDU from the transaction queue wasmade using an MSDU handle that was not found in the transaction table. */ +#define gpMacDispatcher_ResultInvalidHandle gpMacCore_ResultInvalidHandle +/** @brief A parameter in the primitive is out of the valid range. */ +#define gpMacDispatcher_ResultInvalidParameter gpMacCore_ResultInvalidParameter +/** @brief No acknowledgment was received after aMaxFrameRetries. */ +#define gpMacDispatcher_ResultNoAck gpMacCore_ResultNoAck +/** @brief A scan operation failed to find any network beacons. */ +#define gpMacDispatcher_ResultNoBeacon gpMacCore_ResultNoBeacon +/** @brief No response data was available following a request. */ +#define gpMacDispatcher_ResultNoData gpMacCore_ResultNoData +/** @brief The operation failed because a short address was not allocated. */ +#define gpMacDispatcher_ResultNoShortAddress gpMacCore_ResultNoShortAddress +/** @brief A request to enable the receiver was unsuccessful because it could not be completed within the CAP. */ +#define gpMacDispatcher_ResultOutOfCAP gpMacCore_ResultOutOfCAP +/** @brief A PAN identifier conflict has been detected and communicated to the PAN coordinator. */ +#define gpMacDispatcher_ResultPanIdConflict gpMacCore_ResultPanIdConflict +/** @brief A coordinator realignment command has been received. */ +#define gpMacDispatcher_ResultRealignment gpMacCore_ResultRealignment +/** @brief The transaction has expired and its information is discarded. */ +#define gpMacDispatcher_ResultTransactionExpired gpMacCore_ResultTransactionExpired +/** @brief There is no capacity to store the transaction. */ +#define gpMacDispatcher_ResultTransactionOverflow gpMacCore_ResultTransactionOverflow +/** @brief The transceiver was transmitting when the receiver was requested to be enabled. */ +#define gpMacDispatcher_ResultTxActive gpMacCore_ResultTxActive +/** @brief The appropriate key is not available in the ACL. */ +#define gpMacDispatcher_ResultUnavailableKey gpMacCore_ResultUnavailableKey +/** @brief A SET/GET request was issued with the identifier of a PIBattribute that is not supported. */ +#define gpMacDispatcher_ResultUnsupportedAttribute gpMacCore_ResultUnsupportedAttribute +/** @brief A request to send data was unsuccessful because neither the source address parameters nor the destination address parameters were present.*/ +#define gpMacDispatcher_ResultInvalidAddress gpMacCore_ResultInvalidAddress +/** @brief A receiver enable request was unsuccessful because it specified a number of symbols that was longer than the beacon interval. */ +#define gpMacDispatcher_ResultOnTimeTooLong gpMacCore_ResultOnTimeTooLong +/** @brief A receiver enable request was unsuccessful because it could not be completed within the current superframe and was not permitted to be deferred until the next superframe. */ +#define gpMacDispatcher_ResultPastTime gpMacCore_ResultPastTime +/** @brief The device was instructed to start sending beacons based on the timing of the beacon transmissions of its coordinator, but the device is not currently tracking the beacon of its coordinator.*/ +#define gpMacDispatcher_ResultTrackingOff gpMacCore_ResultTrackingOff +/** @brief An attempt to write to a MAC PIB attribute that is in a table failed because the specified table index was out of range.*/ +#define gpMacDispatcher_ResultInvalidIndex gpMacCore_ResultInvalidIndex +/** @brief A scan operation terminated prematurely because the number of PAN descriptors stored reached an implementationspecified maximum.*/ +#define gpMacDispatcher_ResultLimitedReached gpMacCore_ResultLimitedReached +/** @brief A SET/GET request was issued with the identifier of an attribute that is read only. */ +#define gpMacDispatcher_ResultReadOnly gpMacCore_ResultReadOnly +/** @brief A request to perform a scan operation failed because the MLME was in the process of performing a previously initiated scan operation. */ +#define gpMacDispatcher_ResultScanInProgress gpMacCore_ResultScanInProgress +/** @brief The device was instructed to start sending beacons based on the timing of the beacon transmissions of its coordinator, but the instructed start time overlapped the transmission time of the beacon of its coordinator. */ +#define gpMacDispatcher_ResultSuperframeOverlap gpMacCore_ResultSuperframeOverlap +/** @brief Status send on driver reset indication to indicate that a second stack with the same ID has been registered */ +#define gpMacDispatcher_ResultSecondStackRegistered 0xFE +/** @brief Status send on driver reset indication to indicate that a reset has finished - used for server/client only */ +#define gpMacDispatcher_ResultResetFinished 0xFF + +typedef gpMacCore_Result_t gpMacDispatcher_Result_t; + +typedef UInt8 gpMacDispatcher_StackId_t; + +typedef struct { + char str[GP_MAC_DISPATCHER_STRING_ID_LENGTH]; +} gpMacDispatcher_StringIdentifier_t; + +#if GP_DIVERSITY_NR_OF_STACKS > 1 \ + \ + || defined(GP_DIVERSITY_JUMPTABLES) +#include "gpMacDispatcher_MultiStack.h" +#else +#include "gpMacDispatcher_SingleStack.h" +#endif //(GP_DIVERSITY_NR_OF_STACKS == 1) + + +/** @ingroup DATA + * @typedef gpMacDispatcher_cbDataIndication_t + * @brief Calls the DataIndication callback function. It is used to inform the next higher layer a data packet is received. + */ +typedef void (*gpMacDispatcher_cbDataIndication_t)(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 dsn, gpMacCore_Security_t *pSecOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId); +/** @ingroup DATA + * @typedef gpMacDispatcher_cbDataConfirm_t + * @brief Calls the DataConfirm callback function. It is used to inform the next higher layer a data packet is sent. + */ +typedef void (*gpMacDispatcher_cbDataConfirm_t)(gpMacDispatcher_Result_t status, gpPd_Handle_t pdHandle, gpMacCore_StackId_t stackId); +/** @ingroup DATA + * @typedef gpMacDispatcher_cbPollIndication_t + * @brief Calls the PollIndication callback function. It is used to inform the next higher layer a Cmd DataRequest is received. + */ +typedef void (*gpMacDispatcher_cbPollIndication_t)(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpMacCore_StackId_t stackId); +/** @ingroup DATA + * @typedef gpMacDispatcher_cbPollConfirm_t + * @brief Calls the PollConfirm callback function. It is used to inform the next higher layer a poll request was sent (status). + */ +typedef void (*gpMacDispatcher_cbPollConfirm_t)(gpMacDispatcher_Result_t status, gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); + +/** @ingroup DATA + * @typedef gpMacDispatcher_cbPurgeConfirm_t + * @brief Calls the PurgeConfirm callback function. It is used to inform the next higher layer a purge request was performed (status). + */ +typedef void (*gpMacDispatcher_cbPurgeConfirm_t)(gpMacDispatcher_Result_t status, gpPd_Handle_t pdHandle, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbBeaconNotifyIndication_t + * @brief Calls the BeaconIndication callback function. It is used to inform the next higher layer a beacon was received. + */ +typedef void (*gpMacDispatcher_cbBeaconNotifyIndication_t)(UInt8 bsn, gpMacCore_PanDescriptor_t* pPanDescriptor, UInt8 beaconPayloadLength, UInt8 *pBeaconPayload, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbScanConfirm_t + * @brief Calls the ScanConfirm callback function. It is used to indicate the scan process was finished. + */ +typedef void (*gpMacDispatcher_cbScanConfirm_t)(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, UInt32 unscannedChannels, UInt8 resultListSize, UInt8* pResultList, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbAssocConfirm_t + * @brief Calls the AssocConfirm callback function. It is used to indicate the association process was finished. + */ +typedef void (*gpMacDispatcher_cbAssocConfirm_t)(UInt16 assocShortAddress, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbAssociateIndication_t + * @brief Calls the AssocIndication callback function. It is used to indicate the association request was received. + */ +typedef void (*gpMacDispatcher_cbAssociateIndication_t)(gpMacCore_Address_t* pDeviceAddress, UInt8 capabilityInformation, gpPd_TimeStamp_t rxTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbOrphanIndication_t + * @brief Calls the Orphan Indication callback function. + */ +typedef void (*gpMacDispatcher_cbOrphanIndication_t)(MACAddress_t* pOrphanAddress, gpPd_TimeStamp_t rxTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbSecurityFailureCommStatusIndication_t + * @brief Indicates a security failure communication status to the next higher layer. + */ +typedef void (*gpMacDispatcher_cbSecurityFailureCommStatusIndication_t)(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbAssociateCommStatusIndication_t + * @brief Indicates a associate response communication status to the next higher layer. + */ +typedef void (*gpMacDispatcher_cbAssociateCommStatusIndication_t)(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbOrphanCommStatusIndication_t + * @brief Indicates an orphan communication status to the next higher layer. + */ +typedef void (*gpMacDispatcher_cbOrphanCommStatusIndication_t) (gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); + +/** @ingroup DATA + * @typedef gpMacDispatcher_cbPollNotify_t + * @brief Calls the PollIndication callback function. It is used to inform the next higher layer a Cmd DataRequest is received. + @param pAddrInfo The addressMode and address of PollRequest transmitter. + @param rxTime The timestamp for the reception of the frame. + * @param pdHandle The pd Handle which will be transmitted as a response to the PollRequest. 0xFF indicates that no data is ready. + * @param fromNeighbour Boolean value, which indicates if the source address is present in our Neighbour list. + */ +typedef void (*gpMacDispatcher_cbPollNotify_t)(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpPd_Handle_t pdHandle, Bool fromNeighbour, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbOrphanCommStatusIndication_t + * @brief Indicates an unexpected driver reset to network stacks. + */ +typedef void (*gpMacDispatcher_cbDriverResetIndication_t) (gpMacCore_Result_t status, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbSecurityFrameCounterIndication_t + * @brief Indicates that the frame counter has receached a value that needs to be stored in NVM. The value should be restored by the stack upon restart by using the function gpMacDispatcher_SetFrameCounter(); + */ +typedef void (*gpMacDispatcher_cbSecurityFrameCounterIndication_t)(UInt32 frameCounter, gpMacCore_StackId_t stackId); + +typedef struct gpMacDispatcher_Callbacks_s { + gpMacDispatcher_cbDataIndication_t dataIndicationCallback; + gpMacDispatcher_cbDataConfirm_t dataConfirmCallback; + gpMacDispatcher_cbPollIndication_t pollIndicationCallback; + gpMacDispatcher_cbPollConfirm_t pollConfirmCallback; + gpMacDispatcher_cbPurgeConfirm_t purgeConfirmCallback; + gpMacDispatcher_cbBeaconNotifyIndication_t beaconNotifyIndicationCallback; + gpMacDispatcher_cbScanConfirm_t scanConfirmCallback; + gpMacDispatcher_cbAssociateIndication_t assocIndicationCallback; + gpMacDispatcher_cbAssocConfirm_t assocConfirmCallback; + gpMacDispatcher_cbOrphanIndication_t orphanIndicationCallback; + gpMacDispatcher_cbSecurityFailureCommStatusIndication_t securityFailureCommStatusIndicationCallback; + gpMacDispatcher_cbAssociateCommStatusIndication_t associateCommStatusIndicationCallback; + gpMacDispatcher_cbOrphanCommStatusIndication_t orphanCommStatusIndicationCallback; + gpMacDispatcher_cbDriverResetIndication_t driverResetIndicationCallback; + gpMacDispatcher_cbPollNotify_t pollNotifyCallback; + gpMacDispatcher_cbSecurityFrameCounterIndication_t securityFrameCounterIndicationCallback; +}gpMacDispatcher_Callbacks_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpMacDispatcher_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** @brief This function is used to set the callbacks for a specific stack +*/ +void gpMacDispatcher_RegisterCallbacks(gpMacDispatcher_StackId_t stackId, gpMacDispatcher_Callbacks_t* pCallbacks); +void gpMacDispatcher_GetCallbacks(gpMacDispatcher_StackId_t stackId, gpMacDispatcher_Callbacks_t* pCallbacks); + +void gpMacDispatcher_SetMinInterferenceLevels(Int8* pInterferenceLevels) ; + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif // _GP_MACDISPATCHER_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher_MultiStack.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher_MultiStack.h new file mode 100644 index 0000000..88693a0 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher_MultiStack.h @@ -0,0 +1,792 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_MACDISPATCHER_MULTISTACK_H_ +#define _GP_MACDISPATCHER_MULTISTACK_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpMacCore.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Single/Dual Stack common definitions + *****************************************************************************/ + +/** + * @file gpMacDispatcher.h + * @brief The MacDispatcher locks the lower layer before processing any request, after the cbConfirm the lock is released. + * + * @defgroup INIT INIT primitives + * This module groups the initialization routines. + * + * @defgroup DATA DATA primitives + * This module groups the primitives for data transmission. + * - gpMacDispatcher_DataRequest + cbConfirm, cbIndication + * - gpMacDispatcher_PollRequest + cbConfirm, cbIndication + * + * @defgroup MANAGEMENT MANAGEMENT primitives + * - gpMacDispatcher_ScanRequest + * - gpMacDispatcher_AssociateRequest + * - gpMacDispatcher_AssociateResponse + * + * @defgroup ATTRIBUTE ATTRIBUTE primitives + * - gpMacDispatcher_ScanRequest + * - gpMacDispatcher_AssociateRequest + * - gpMacDispatcher_AssociateResponse + */ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpMacDispatcher_CodeJumpTableFlash_Defs_MultiStack.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** @ingroup INIT + * + * @brief This function initializes the MacCore layer. It should be called before calling any other request function. + * +*/ +GP_API void gpMacDispatcher_Init(void); +GP_API void gpMacDispatcher_DeInit(void); + +/** @ingroup INIT + * + * @brief This function resets the MACDispatcher + Core layer. + * + * @param setDefaultPib If true the PIB values are reset to their default value (as specified in the IEEE802.15.4-2006 specification). + * @param stackId The PIB values are reset to their default value (as specified in the IEEE802.15.4-2006 specification). + * + * @note A prerequisite; the invoker of this function should first aqcuire the Mac Dispatcher lock before a reset is allowed + * @return Whether this stack has successfully issued a reset command on the MAC network layer access (true) or not (false). +*/ +GP_API gpMacDispatcher_Result_t gpMacDispatcher_Reset( Bool setDefaultPib, UInt8 stackId ); + +/** @ingroup LOCK + * This function is used to request the lock for the MAC network layer access. This lock must be acquired by a stack before it may access the MAC network layer. + * + * @param stackId The identifier of the stack that requests the lock. + * + * @return Whether this stack has successfully acquired the lock on the MAC network layer access (true) or not (false). +*/ +GP_API Bool gpMacDispatcher_LockClaim( UInt8 stackId ); + +/** @ingroup LOCK + * This function is used to release the lock for the MAC network layer access. + * + * @param stackId The identifier of the stack. +*/ +GP_API void gpMacDispatcher_LockRelease( UInt8 stackId ); + +/** @ingroup LOCK + * This function can be used to check whether the stack id already has the lock on the MAC network layer access. + * + * @param stackId The identifier of the stack + * + * @return Whether this stack has the lock on the MAC network layer access (true) or not (false). +*/ +GP_API Bool gpMacDispatcher_LockedByThisStack( UInt8 stackId ); + +/** @ingroup LOCK + * This function can be used to check whether any stack has the lock on the MAC network layer access. + * + * @return Whether a stack has the lock on the MAC network layer access (true) or not (false). +*/ +GP_API Bool gpMacDispatcher_Locked( void ); + + +/** @ingroup INIT + * @brief This function is used to register a network stack to the dispatcher. + * + * @return The id that is allocated by the MacCore for this stack +*/ +GP_API gpMacDispatcher_StackId_t gpMacDispatcher_RegisterNetworkStack(gpMacDispatcher_StringIdentifier_t* stringIdentifier); + +/** @brief Unregisters a network stack to the MAC layer. + * + * @param stackId the stack ID of the stack that needs to be removed from the MAC layer + * @return result Result of the unregistering + * Possible results: + * - gpMacCore_ResultSuccess + * - gpMacCore_ResultInvalidParameter - stackId is not registered or not in supported range +*/ +GP_API gpMacCore_Result_t gpMacDispatcher_UnRegisterNetworkStack(gpMacDispatcher_StackId_t stackId); + +/** @brief Returns if a stackId is in range and registered + * + * @param stackId the stack ID to check + * @return result Possible results: + * - true - stack is registered and in range + * - false - stackId is not registered or not in supported range +*/ +GP_API Bool gpMacDispatcher_IsValidStack(gpMacDispatcher_StackId_t stackId); + +/** @ingroup DATA + * @brief This function is used to send a data packet to another device. + * + * This function is used to send a data packet conform the IEEE802.15.4-2006 MAC specification. + * + * @param srcAddrMode The address modes to be used for source address. This parameter is used as in the Frame Control Field of an IEEE802.15.4-2006 packet. We refer to the define GP_IEEEMAC_SRC_ADDR_(EXT/SHORT). + * @param pDstAddrInfo All the information about the destination (address mode, address and panId). + * @param txOptions Tx Options byte (see IEEE802.15.4-2006). + * @param pSecOptions The security options - maybe NULL to be used (see IEEE802.15.4-2006). + * @param p_PdLoh The PD Length/Offset/Handle of the data payload. + * @param stackId The stack doing this data request +*/ +GP_API void gpMacDispatcher_DataRequest(gpMacCore_AddressMode_t srcAddrMode, gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 txOptions, gpMacCore_Security_t *pSecOptions, gpMacCore_MultiChannelOptions_t multiChannelOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId); + +/** @brief Schedule a packet for timed transmission. + * + * To send a packet via timed transmission, perform two steps: + * - Call gpMacDispatcher_DataRequest() with option GP_MACCORE_TX_OPT_TIMEDTX + * to queue the packet; + - Call gpMacDispatcher_ScheduleTimedTx() to schedule transmission of the queued packet. + * + * This function is only available on hardware that supports a timed transmission queue. + * + * @param pdHandle Handle of TX packet to schedule for TX; must have been previously submitted via gpMacDispatcher_DataRequest(). + * @param timingOptions Specification of scheduled transmit time. + * @param stackId The identifier of the stack doing this request + */ +GP_API gpMacCore_Result_t gpMacDispatcher_ScheduleTimedTx(gpPd_Handle_t pdHandle, gpMacCore_TxTimingOptions_t timingOptions, gpMacDispatcher_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @brief This function is used to start a scan. + * + * This function starts a scan conform the IEEE802.15.4-2006 spec. A scan can be issued to detect a channel with the least amount of interference, to find networks, etc. + * + * @param scanType This parameter defines which of the 3 implemented scans needs to be performed: ED, active or orphan scan. + * @param scanChannels This parameter defines which channels need to be scanned. It is a bitmask where bit 0 must be '1' to select channel 0, bit 26 '1' to select channel 26, etc. Since the chip works in the 2.4GHz band, only channels 11 till 26 can be selected. If other channels are selected, they are ignored and only the selected channels between channel 11 and channel 26 are scanned. + * @param scanDuration This parameter specifies how long a channel will be scanned. The scantime equals [GP_IEEEMAC_BASE_SUPERFRAME_DURATION * (2^scanduration + 1)]symbols, where 1 symbol is 16us. + * @param resultListSize The length of the resultList (in bytes). If an ED scan is done, this should equal the amount of channels. If resultListSize is higher than the amount of channels that needs to be scanned there is no problem. If the value is lower, the scan is terminated when the list is full. + * If an active scan is selected, resultListSize is the amount of PANDescriptors that can be saved. + * If it is an orphan scan, resultListSize is 0. + * @param pResultList This is a pointer to an array where the result of the scan can be saved. If an ED scan is done, the size is resultListSize. If an active scan is issued the size is resultListSize*sizeof(gpMacCore_PanDescriptor_t). + * @param stackId The stack doing this scan request +*/ +GP_API void gpMacDispatcher_ScanRequest(gpMacCore_ScanType_t scanType, UInt32 scanChannels, UInt8 scanDuration , UInt8 resultListSize, UInt8* pResultList, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @brief This function is issued by a device who wishes to join a network. + * + * This function starts the associate procedure. It is used to join a network. When called, the AssociateRequest function will construct an associate request command packet, and send it to the coordinator. + * + * @param logicalChannel The channel that will be used to do the association attempt + * @param pCoordAddrInfo The coordinator addressing info (address mode, panId, address) + * @param capabilityInformation Specifies the operational capabilities of the associating device. + * @param stackId The stack doing this associate request +*/ +GP_API void gpMacDispatcher_AssociateRequest(UInt8 logicalChannel, gpMacCore_AddressInfo_t* pCoordAddrInfo, UInt8 capabilityInformation, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @brief This function is used to send an associate response command packet to a device that is trying to join. The associate response command packet contains the results of the join procedure. + * + * This function is used to respond to a previously received associate request command packet. Upon reception of an associate request command packet, the AssociateIndication function is called to inform the higher layer. The next higher layer then decides to allow the joining device in the network or not. Its decision is sent back to the joining device through the associate response packet. + * + * @param pDeviceAddress A pointer to the address of the device that is trying to join. + * @param associateShortAddress If the joining device is allowed (successful association), this parameter contains the short address that was allocated for the device. If the association was unsuccessful, this parameter is set to 0xffff. + * @param status This parameter contains the result of the association attempt. Possible values are: + * 0x0: Association successful. + * 0x1: PAN at capacity. + * 0x2: PAN access denied. + * @param stackId The stack doing this associate response +*/ +GP_API void gpMacDispatcher_AssociateResponse(MACAddress_t *pDeviceAddress, UInt16 associateShortAddress, gpMacCore_Result_t status, gpMacCore_StackId_t stackId); + +/** @ingroup DATA + * @brief This function is used to poll a coordinator for data by sending a data request command. If the coordinator has data pending for the device that issued the poll request, it will forward the data. + * + * This function starts a poll. This function is used to request packets that are pending at the coordinator (by sending a data request command to the coordinator). + * If the coordinator has data pending for the device that issued the poll request, it will forward the data. + * If a short address is allocated to the device, and it was written into the gpMacCore_AttributeShortAddress PIB attribute, + * the short address will be used as source address of the data request command. + * If the gpMacCore_AttributeShortAddress PIB attribute is set to 0xffff or 0xfffe, the device will use its extended address as source address in the data request command packet. + * + * @param pCoordAddrInfo All the details regarding the coordinator + * @param pSecOptions structure with security options, if NULL no security is used. + * @param stackId The stack doing this poll request +*/ +GP_API void gpMacDispatcher_PollRequest( gpMacCore_AddressInfo_t* pCoordAddrInfo, gpMacCore_Security_t *pSecOptions, gpMacCore_StackId_t stackId); + +/** @ingroup DATA + * @brief This function will remove the specified transmit request form the indirect transmission queue + */ +GP_API void gpMacDispatcher_PurgeRequest(gpPd_Handle_t pdHandle, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @brief This function is used to send an orphan response command packet. + */ +GP_API void gpMacDispatcher_OrphanResponse(MACAddress_t* pOrphanAddress, UInt16 shortAddress, Bool associatedMember, gpMacCore_StackId_t stackId); + +/** @brief This function is used to enable beacon transmission +*/ +GP_API gpMacCore_Result_t gpMacDispatcher_Start(gpMacCore_PanId_t panId, UInt8 logicalChannel, Bool panCoordinator, UInt8 stackId); + +// getters and setters +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCurrentChannel(UInt8 channel, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMultipleChannelTable(UInt8* pChannel, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetCurrentChannel(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetDefaultTransmitPowers(Int8* pDefaultTransmitPowerTable); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetTransmitPower(gpMacCore_TxPower_t transmitPower, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Int8 gpMacDispatcher_GetTransmitPower(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCCAMode(UInt8 cCAMode, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetCCAMode(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress , gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCoordShortAddress(UInt16 addr, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetCoordShortAddress(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPanCoordinator(Bool panCoordinator, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetPanCoordinator(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetDsn(UInt8 dsn, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetDsn(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMaxCsmaBackoffs(UInt8 maxCsmaBackoffs, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetMaxCsmaBackoffs(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMinBE(UInt8 minBE, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetMinBE(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMaxBE(UInt8 maxBE, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetMaxBE(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCsmaMode(UInt8 csmaMode, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetCsmaMode(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPanId(UInt16 panId, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetPanId(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetRxOnWhenIdle(Bool rxOnWhenIdle, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetRxOnWhenIdle(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetShortAddress(UInt16 shortAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetShortAddress(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetAssociationPermit(Bool associationPermit, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetAssociationPermit(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetBeaconPayload(UInt8* pBeaconPayload, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetBeaconPayload(UInt8* pBeaconPayload, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetBeaconPayloadLength(UInt8 length, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetBeaconPayloadLength(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPromiscuousMode(UInt8 promiscuousMode, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetPromiscuousMode(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetTransactionPersistenceTime(UInt16 time, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetTransactionPersistenceTime(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetExtendedAddress(MACAddress_t* pExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetExtendedAddress(MACAddress_t* pExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetNumberOfRetries(UInt8 numberOfRetries, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetNumberOfRetries(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetSecurityEnabled(Bool securityEnabled, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetSecurityEnabled(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetBeaconStarted(Bool BeaconStarted, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetBeaconStarted(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetTxAntenna(UInt8 txAntenna, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetTxAntenna(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetIndicateBeaconNotifications(Bool enable, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetIndicateBeaconNotifications(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetForwardPollIndications(Bool enable, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetForwardPollIndications(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetLqiThresholdForTest(UInt8 lqiThreshold, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetAddressModeOverrideForBeacons(UInt8 addressMode, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMacVersion(gpMacCore_MacVersion_t macVersion , gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_MacVersion_t gpMacDispatcher_GetMacVersion(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_DataPending_QueueAdd(gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId) ; +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_DataPending_QueueRemove(gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId) ; +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_DataPending_QueueClear(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_AddNeighbour (gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_RemoveNeighbour(gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_ClearNeighbours(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_SetDataPendingMode(gpMacCore_DataPendingMode_t dataPendingMode, gpMacCore_StackId_t stackId); + +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetFrameCounter(UInt32 frameCounter, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt32 gpMacDispatcher_GetFrameCounter(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_SetKeyDescriptor(gpMacCore_KeyDescriptor_t *pKeyDescriptor, gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_GetKeyDescriptor(gpMacCore_KeyDescriptor_t *pKeyDescriptor, gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetKeyTableEntries(gpMacCore_KeyTablesEntries_t keyTableEntries, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_KeyTablesEntries_t gpMacDispatcher_GetKeyTableEntries(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_SetDeviceDescriptor(gpMacCore_DeviceDescriptor_t *pDeviceDescriptor, gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_GetDeviceDescriptor(gpMacCore_DeviceDescriptor_t * pDeviceDescriptor , gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetDeviceTableEntries(gpMacCore_DeviceTablesEntries_t deviceTableEntries, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_DeviceTablesEntries_t gpMacDispatcher_GetDeviceTableEntries(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_SetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_GetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t *pSecurityLevelDescriptor , gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_SecurityLevelTableEntries_t gpMacDispatcher_GetSecurityLevelTableEntries(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetSecurityLevelTableEntries(gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetDefaultKeySource(UInt8 *pDefaultKeySource, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetDefaultKeySource(UInt8 *pDefaultKeySource, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPanCoordExtendedAddress(MACAddress_t *pPanCoordExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetPanCoordExtendedAddress(MACAddress_t *pPanCoordExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPanCoordShortAddress(UInt16 PanCoordShortAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetPanCoordShortAddress(gpMacCore_StackId_t stackId); + +/** @brief Set Regional Domain Settings (RDS) for the specified stack. + * + * The RDS values consist of a list of blocked channels and a table of maximum power levels for non-blocked channels. + * Any attempt to transmit/listen on a blocked channel will fail with gpMacCore_ResultInvalidParameter. + * Transmit power levels above maximum will be clipped to the maximum level. + * + * @param blockedChannelMask Bitmask of blocked channels (IEEE numbers). E.g. set bit 11 to block channel 11. + * @param pMaxTransmitPowerTable Pointer to 16-byte table of maximum power levels for channels 11 .. 26. + * @param stackId Apply RDS values to the specified stack. Each stack maintains separate RDS values. + */ +GP_API void gpMacDispatcher_SetRegionalDomainSettings(UInt32 blockedChannelMask, gpMacCore_TxPower_t* pMaxTransmitPowerTable, gpMacDispatcher_StackId_t stackId); + +/** @brief Get Regional Domain Settings (RDS) for the specified stack. + * + * The RDS values consist of a list of blocked channels and a table of maximum power levels for non-blocked channels. + * + * @param pBlockedChannelMask Bitmask of blocked channels (IEEE numbers). E.g. set bit 11 to block channel 11. + * @param pMaxTransmitPowerTable Pointer to 16-byte table of maximum power levels for channels 11 .. 26. + * @param stackId Get RDS values from the specified stack. Each stack maintains separate RDS values. + */ +GP_API void gpMacDispatcher_GetRegionalDomainSettings(UInt32* pBlockedChannelMask, gpMacCore_TxPower_t* pMaxTransmitPowerTable, gpMacDispatcher_StackId_t stackId); + +/** @ingroup ATTRIBUTE + * + * @brief Enable or disable automatic toggling of TX antenna after transmission failure. + * + * @param enable True to enable auto-toggling, false to disable. + * @param stackId Stack identifier. + */ + +/** @brief This function enables the Enhanced FramePending behavior for a specific stack. + * + * @param enableEnhancedFramePending Enables or disables the Enhanced FramePending behavior for a specific stack. +*/ +void gpMacDispatcher_EnableEnhancedFramePending(Bool enableEnhancedFramePending, gpMacCore_StackId_t stackId); + +/** @brief This function enables the raw mode of the stack. + * + * This mode allows the upper stack to create the MAC header while transmitting a packets, + * and to stop the MacCore from processing MAC headers, and instead passing them to the upper stack. + * + * @param rawModeEnabled Enables or disables the raw mode for a specific stack. +*/ +void gpMacDispatcher_SetStackInRawMode(Bool rawModeEnabled, gpMacCore_StackId_t stackId); + +/** @brief This function returns if the raw mode is enabled for a specific stack. + * + * @return rawModeEnabled Indicates if raw mode is enabled or disabled for a specific stack. +*/ +Bool gpMacDispatcher_GetStackInRawMode(gpMacCore_StackId_t stackId); + +/** @brief This function sets the encryption key and keyIndex to be used for the Tread raw encryption. + * + * @param encryptionKeyIdMode Key ID mode. Only mode '1' is supported for Thread raw encryption. + * @param encryptionKeyId Current key index. + * @param pCurrKey Current key. + * @param stackId Stack identifier. +*/ +void gpMacDispatcher_SetRawModeEncryptionKeys(gpMacCore_KeyIdMode_t encryptionKeyIdMode, gpMacCore_KeyIndex_t encryptionKeyId, UInt8* pCurrKey, gpMacCore_StackId_t stackId); + + +/** @brief This function sets the fields used in the Nonce for the Thread raw encryption. + * + * @param frameCounter Initial value of the frame pointer. Will be auto-incremented by the lower layers. + * @param pExtendedAddress Pointer to the local(source) extended address. + * @param seclevel Security Level. Needs to be '5' for Thread raw encryption. + * @param stackId Stack identifier. +*/ +void gpMacDispatcher_SetRawModeNonceFields(UInt32 frameCounter, MACAddress_t* pExtendedAddress , UInt8 seclevel, gpMacCore_StackId_t stackId); + +/** @brief This function configures the insertion of a VS IE header in the Enh Ack frames containing probing data. + * + * @param linkMetrics Bitmask of link metrics which should be reported. + * @param pExtendedAddress The extended address of the probing initiator. + * @param shortAddress The short address of the probing initiator. + * @param stackId The stack id. + * @return result Success if the parameter are accepted, InvalidParameters otherwise. +*/ +gpMacCore_Result_t gpMacDispatcher_ConfigureEnhAckProbing(UInt8 linkMetrics, MACAddress_t* pExtendedAddress , UInt16 shortAddress, gpMacCore_StackId_t stackId); + + +#define gpMacDispatcher_SetAutoTxAntennaToggling(Bool, gpMacDispatcher_StackId_t) +/** @ingroup ATTRIBUTE + * + * @brief Return the current state of automatic toggling of TX antenna. + * + * @param stackId Stack identifier. + * @return true when enabled, false when disabled. + */ +GP_API Bool gpMacDispatcher_GetAutoTxAntennaToggling(gpMacDispatcher_StackId_t stackId); + + +/** @brief Get the current time + * + * Retrieves the current local time on the chip. + * + * @return time the current local time on chip in us. +*/ +GP_API UInt32 gpMacDispatcher_GetCurrentTimeUs(void); + +/** @brief Enables or disables the Retransmits on CCA failures. + * + * This function enables or disables the Retransmits on CCA failures. The actual amount of retransmits + * is set through gpMacDispatcher_SetNumberOfRetries. As such this function only changes the + * default MAC 802.15.4-2015 behavior to also retransmit on a CCA fail. + * + * @param enable Enables or disables the Retransmits. + * @param stackId The identifier of the stack doing this +*/ +GP_API void gpMacDispatcher_SetRetransmitOnCcaFail(Bool enable, gpMacCore_StackId_t stackId); + +/** @brief returns if the feature "Retransmits on CCA fail" is enabled for a stackId. + * + * This function returns if the feature "Retransmits on CCA fail" is enabled for a stackId. + * + * @param stackId The identifier of the stack doing this +*/ +GP_API Bool gpMacDispatcher_GetRetransmitOnCcaFail(gpMacCore_StackId_t stackId); + +/** @brief Enables or disables the random delays between subsequent retransmits. + * + * This function enables or disables the random delays between subsequent retransmits. + * The actual amount of retransmits is set through gpMacDispatcher_SetNumberOfRetries. As such this + * function only changes the default MAC 802.15.4-2015 behavior to add random delays between retransmits. + * + * @param enable Enables or disables the random delays between subsequent retransmits. + * @param stackId The identifier of the stack doing this +*/ +GP_API void gpMacDispatcher_SetRetransmitRandomBackoff(Bool enable, gpMacCore_StackId_t stackId); + +/** @brief returns if the feature "random delays between subsequent retransmits" is enabled for a stackId. + * + * This function returns if the feature "random delays between subsequent retransmits" is enabled for a stackId. + * + * @param stackId The identifier of the stack doing this +*/ +GP_API Bool gpMacDispatcher_GetRetransmitRandomBackoff(gpMacCore_StackId_t stackId); + +/** @brief This function configures the minimum backoff exponent for random delays between retransmits. + * + * This function configures the minimum backoff exponent for random delays between retransmits. + * Not to be confused with the backoff exponent for random delays between CCA failures! + * + * @param minBERetransmit The minimum backoff exponent. + * @param stackId The identifier of the stack +*/ +GP_API void gpMacDispatcher_SetMinBeRetransmit(UInt8 minBERetransmit, gpMacCore_StackId_t stackId); + +/** @brief This function returns the minimum backoff exponent for random delays between retransmits. + * + * This function returns the minimum backoff exponent for random delays between retransmits. + * + * @param stackId The identifier of the stack +*/ +GP_API UInt8 gpMacDispatcher_GetMinBeRetransmit(gpMacCore_StackId_t stackId); + +/** @brief This function configures the maximum backoff exponent for random delays between retransmits. + * + * This function configures the maximum backoff exponent for random delays between retransmits. + * Not to be confused with the backoff exponent for random delays between CCA failures! + * + * @param maxBERetransmit The maximum backoff exponent. + * @param stackId The identifier of the stack +*/ +GP_API void gpMacDispatcher_SetMaxBeRetransmit(UInt8 maxBERetransmit, gpMacCore_StackId_t stackId); + +/** @brief This function returns the maximum backoff exponent for random delays between retransmits. + * + * This function returns the maximum backoff exponent for random delays between retransmits. + * + * @param stackId The identifier of the stack +*/ +GP_API UInt8 gpMacDispatcher_GetMaxBeRetransmit(gpMacCore_StackId_t stackId); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif // _GP_MACDISPATCHER_MULTISTACK_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c new file mode 100644 index 0000000..7f2d820 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacDispatcher_marshalling.c" + * + * MAC Dispatcher + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpMacDispatcher.h" +#include "gpMacDispatcher_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACDISPATCHER + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpMacDispatcher_StringIdentifier_t_buf2api(gpMacDispatcher_StringIdentifier_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_buf2api((pDest->str), pSource, 5, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacDispatcher_StringIdentifier_t_api2buf(UInt8Buffer* pDest , const gpMacDispatcher_StringIdentifier_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_api2buf(pDest , (pSource->str), 5, pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacDispatcher_Callbacks_t_buf2api(gpMacDispatcher_Callbacks_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacDispatcher_cbDataIndication_t_buf2api_1(&(pDest->dataIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbDataConfirm_t_buf2api_1(&(pDest->dataConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbPollIndication_t_buf2api_1(&(pDest->pollIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbPollConfirm_t_buf2api_1(&(pDest->pollConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbPurgeConfirm_t_buf2api_1(&(pDest->purgeConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbBeaconNotifyIndication_t_buf2api_1(&(pDest->beaconNotifyIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbScanConfirm_t_buf2api_1(&(pDest->scanConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbAssociateIndication_t_buf2api_1(&(pDest->assocIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbAssocConfirm_t_buf2api_1(&(pDest->assocConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbOrphanIndication_t_buf2api_1(&(pDest->orphanIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_buf2api_1(&(pDest->securityFailureCommStatusIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbAssociateCommStatusIndication_t_buf2api_1(&(pDest->associateCommStatusIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbOrphanCommStatusIndication_t_buf2api_1(&(pDest->orphanCommStatusIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbDriverResetIndication_t_buf2api_1(&(pDest->driverResetIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbPollNotify_t_buf2api_1(&(pDest->pollNotifyCallback), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacDispatcher_Callbacks_t_api2buf(UInt8Buffer* pDest , const gpMacDispatcher_Callbacks_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacDispatcher_cbDataIndication_t_api2buf_1(pDest , &(pSource->dataIndicationCallback), pIndex); + gpMacDispatcher_cbDataConfirm_t_api2buf_1(pDest , &(pSource->dataConfirmCallback), pIndex); + gpMacDispatcher_cbPollIndication_t_api2buf_1(pDest , &(pSource->pollIndicationCallback), pIndex); + gpMacDispatcher_cbPollConfirm_t_api2buf_1(pDest , &(pSource->pollConfirmCallback), pIndex); + gpMacDispatcher_cbPurgeConfirm_t_api2buf_1(pDest , &(pSource->purgeConfirmCallback), pIndex); + gpMacDispatcher_cbBeaconNotifyIndication_t_api2buf_1(pDest , &(pSource->beaconNotifyIndicationCallback), pIndex); + gpMacDispatcher_cbScanConfirm_t_api2buf_1(pDest , &(pSource->scanConfirmCallback), pIndex); + gpMacDispatcher_cbAssociateIndication_t_api2buf_1(pDest , &(pSource->assocIndicationCallback), pIndex); + gpMacDispatcher_cbAssocConfirm_t_api2buf_1(pDest , &(pSource->assocConfirmCallback), pIndex); + gpMacDispatcher_cbOrphanIndication_t_api2buf_1(pDest , &(pSource->orphanIndicationCallback), pIndex); + gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_api2buf_1(pDest , &(pSource->securityFailureCommStatusIndicationCallback), pIndex); + gpMacDispatcher_cbAssociateCommStatusIndication_t_api2buf_1(pDest , &(pSource->associateCommStatusIndicationCallback), pIndex); + gpMacDispatcher_cbOrphanCommStatusIndication_t_api2buf_1(pDest , &(pSource->orphanCommStatusIndicationCallback), pIndex); + gpMacDispatcher_cbDriverResetIndication_t_api2buf_1(pDest , &(pSource->driverResetIndicationCallback), pIndex); + gpMacDispatcher_cbPollNotify_t_api2buf_1(pDest , &(pSource->pollNotifyCallback), pIndex); + pSource++; + } +} + + +void gpMacDispatcher_InitMarshalling(void) +{ +} + + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c new file mode 100644 index 0000000..3201fe6 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c @@ -0,0 +1,1825 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacDispatcher_marshalling_client.c" + * + * MAC Dispatcher + * + * Marshalling structures and functions +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpMacDispatcher.h" +#include "gpMacDispatcher_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACDISPATCHER + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpMacDispatcher_RegisterNetworkStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StringIdentifier_t* stringIdentifier , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == stringIdentifier); + if (NULL != stringIdentifier) + { + gpMacDispatcher_StringIdentifier_t_api2buf(pDest, stringIdentifier, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (5)); + (*pIndex) += (5); + } + } +} + +void gpMacDispatcher_RegisterNetworkStack_Output_buf2par(gpMacDispatcher_StackId_t* stackId , gpMacDispatcher_StringIdentifier_t* stringIdentifier , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_buf2api(stackId, pSource, 1, pIndex); + NOT_USED(stringIdentifier); +} + +void gpMacDispatcher_UnRegisterNetworkStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_UnRegisterNetworkStack_Output_buf2par(gpMacCore_Result_t* result , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_LockClaim_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_LockClaim_Output_buf2par(Bool* result , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_LockRelease_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_LockedByThisStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_LockedByThisStack_Output_buf2par(Bool* locked , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(locked, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_Locked_Output_buf2par(Bool* locked , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(locked, pSource, 1, pIndex); +} + +void gpMacDispatcher_Reset_Input_par2buf(UInt8Buffer* pDest , Bool setDefaultPib , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(setDefaultPib), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_Reset_Output_buf2par(gpMacDispatcher_Result_t* result , Bool setDefaultPib , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacDispatcher_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(setDefaultPib); + NOT_USED(stackId); +} + +void gpMacDispatcher_DataRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressMode_t srcAddrMode , gpMacCore_AddressInfo_t* pDstAddressInfo , UInt8 txOptions , gpMacCore_Security_t* pSecOptions , gpMacCore_MultiChannelOptions_t multiChannelOptions , gpPd_Loh_t pdLoh , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_AddressMode_t_api2buf_1(pDest, &(srcAddrMode), pIndex); + pDest[(*pIndex)++] = (NULL == pDstAddressInfo); + if (NULL != pDstAddressInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pDstAddressInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + UInt8_api2buf_1(pDest, &(txOptions), pIndex); + pDest[(*pIndex)++] = (NULL == pSecOptions); + if (NULL != pSecOptions) + { + gpMacCore_Security_t_api2buf(pDest, pSecOptions, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (1 + 1 + max(4,8) + 1)); + (*pIndex) += (1 + 1 + max(4,8) + 1); + } + } + gpMacCore_MultiChannelOptions_t_api2buf(pDest, &(multiChannelOptions), 1, pIndex); + gpPd_Loh_t_api2buf(pDest, &(pdLoh), 1, pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_ScanRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_ScanType_t scanType , UInt32 scanChannels , UInt8 scanDuration , UInt8 resultListSize , UInt8* pResultList , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_ScanType_t_api2buf_1(pDest, &(scanType), pIndex); + UInt32_api2buf_1(pDest, &(scanChannels), pIndex); + UInt8_api2buf_1(pDest, &(scanDuration), pIndex); + UInt8_api2buf_1(pDest, &(resultListSize), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_AssociateRequest_Input_par2buf(UInt8Buffer* pDest , UInt8 logicalChannel , gpMacCore_AddressInfo_t* coordAddrInfo , UInt8 capabilityInformation , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(logicalChannel), pIndex); + pDest[(*pIndex)++] = (NULL == coordAddrInfo); + if (NULL != coordAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, coordAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + UInt8_api2buf_1(pDest, &(capabilityInformation), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_AssociateResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pDeviceAddress , UInt16 associateShortAddress , gpMacCore_Result_t status , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pDeviceAddress); + if (NULL != pDeviceAddress) + { + MACAddress_t_api2buf_1(pDest, pDeviceAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + UInt16_api2buf_1(pDest, &(associateShortAddress), pIndex); + gpMacCore_Result_t_api2buf_1(pDest, &(status), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_PollRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* coordAddrInfo , gpMacCore_Security_t* pSecOptions , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == coordAddrInfo); + if (NULL != coordAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, coordAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } +/* SpecialInputpar2bufParameterHandling_gpMacDispatcher_PollRequest_pSecOptions */ + pDest[(*pIndex)++] = (NULL == pSecOptions); + + if (NULL != pSecOptions) + { + gpMacCore_Security_t_api2buf(pDest, pSecOptions, 1, pIndex); + } + else + { + gpMacCore_Security_t dummy = {0}; + gpMacCore_Security_t_api2buf(pDest, &dummy, 1, pIndex); + } +/* SpecialInputpar2bufParameterHandling_gpMacDispatcher_PollRequest_pSecOptions */ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_PurgeRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ +#ifdef GP_COMP_UNIT_TEST + pDest[(*pIndex)++] = gpPd_GetUtPd(pdHandle); +#else + pDest[(*pIndex)++] = pdHandle; +#endif + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_Start_Input_par2buf(UInt8Buffer* pDest , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , UInt8 stackId , UInt16* pIndex) +{ + gpMacCore_PanId_t_api2buf_1(pDest, &(panId), pIndex); + UInt8_api2buf_1(pDest, &(logicalChannel), pIndex); + Bool_api2buf_1(pDest, &(panCoordinator), pIndex); + UInt8_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_Start_Output_buf2par(gpMacCore_Result_t* returnValue , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , UInt8 stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(returnValue, pSource, 1, pIndex); + NOT_USED(panId); + NOT_USED(logicalChannel); + NOT_USED(panCoordinator); + NOT_USED(stackId); +} + +void gpMacDispatcher_OrphanResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , UInt16 shortAddress , Bool associatedMember , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pOrphanAddress); + if (NULL != pOrphanAddress) + { + MACAddress_t_api2buf_1(pDest, pOrphanAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + UInt16_api2buf_1(pDest, &(shortAddress), pIndex); + Bool_api2buf_1(pDest, &(associatedMember), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetPanId_Input_par2buf(UInt8Buffer* pDest , UInt16 panId , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(panId), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanId_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanId_Output_buf2par(gpMacCore_PanId_t* panId , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_PanId_t_buf2api(panId, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(shortAddress), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetShortAddress_Output_buf2par(UInt16* address , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt16_buf2api(address, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pExtendedAddress); + if (NULL != pExtendedAddress) + { + MACAddress_t_api2buf_1(pDest, pExtendedAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetExtendedAddress_Output_buf2par(MACAddress_t* pExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + MACAddress_t_buf2api(pExtendedAddress, pSource, 1, pIndex); + } + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDsn_Input_par2buf(UInt8Buffer* pDest , UInt8 dsn , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(dsn), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDsn_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDsn_Output_buf2par(UInt8* dsn , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(dsn, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(channel), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCurrentChannel_Output_buf2par(UInt8* channel , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(channel, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pBeaconPayload); + if (NULL != pBeaconPayload) + { + UInt8_api2buf(pDest, pBeaconPayload, GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH); + (*pIndex) += GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconPayload_Output_buf2par(UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ +/* SpecialOutputbuf2parParameterHandling_gpMacDispatcher_GetBeaconPayload_pBeaconPayload */ + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + // Needs a variable because otherwise gpMacDispatcher_GetBeaconPayloadLength() gets called twice (see definition of UInt8_buf2api()) + UInt8 length = gpMacDispatcher_GetBeaconPayloadLength(stackId); + UInt8_buf2api( pBeaconPayload, pSource, length, pIndex); + } +/* SpecialOutputbuf2parParameterHandling_gpMacDispatcher_GetBeaconPayload_pBeaconPayload */ + NOT_USED(stackId); +} + +void gpMacDispatcher_SetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , UInt8 beaconPayloadLength , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(beaconPayloadLength), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconPayloadLength_Output_buf2par(UInt8* beaconPayloadLength , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(beaconPayloadLength, pSource, 1, pIndex); + NOT_USED(stackId); +} + + + + +void gpMacDispatcher_SetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , Bool rxOnWhenIdle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(rxOnWhenIdle), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRxOnWhenIdle_Output_buf2par(Bool* rxOnWhenIdle , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(rxOnWhenIdle, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_GetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetTransactionPersistenceTime_Output_buf2par(UInt16* time , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt16_buf2api(time, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , UInt16 time , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(time), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , Bool beaconStarted , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(beaconStarted), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconStarted_Output_buf2par(Bool* beaconStarted , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(beaconStarted, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 coordShortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(coordShortAddress), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCoordShortAddress_Output_buf2par(UInt16* coordShortAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt16_buf2api(coordShortAddress, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pCoordExtendedAddress); + if (NULL != pCoordExtendedAddress) + { + MACAddress_t_api2buf_1(pDest, pCoordExtendedAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCoordExtendedAddress_Output_buf2par(MACAddress_t* pCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + MACAddress_t_buf2api(pCoordExtendedAddress, pSource, 1, pIndex); + } + NOT_USED(stackId); +} + +void gpMacDispatcher_SetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , UInt8 promiscuousMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(promiscuousMode), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPromiscuousMode_Output_buf2par(Bool* promiscuousMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(promiscuousMode, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , Bool associationPermit , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(associationPermit), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetAssociationPermit_Output_buf2par(Bool* associationPermit , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(associationPermit, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , Bool securityEnabled , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(securityEnabled), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityEnabled_Output_buf2par(Bool* securityEnabled , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(securityEnabled, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , UInt8 numberOfRetries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(numberOfRetries), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetNumberOfRetries_Output_buf2par(UInt8* numberOfRetries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(numberOfRetries, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , UInt8 maxCsmaBackoffs , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(maxCsmaBackoffs), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxCsmaBackoffs_Output_buf2par(UInt8* maxCsmaBackoffs , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(maxCsmaBackoffs, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDefaultTransmitPowers_Input_par2buf(UInt8Buffer* pDest , Int8* pDefaultTransmitPowerTable , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pDefaultTransmitPowerTable); + if (NULL != pDefaultTransmitPowerTable) + { + Int8_api2buf(pDest, pDefaultTransmitPowerTable, 16, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 16); + (*pIndex) += 16; + } + } +} + +void gpMacDispatcher_SetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacCore_TxPower_t transmitPower , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_TxPower_t_api2buf_1(pDest, &(transmitPower), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetTransmitPower_Output_buf2par(Int8* transmitPower , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Int8_buf2api(transmitPower, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetCCAMode_Input_par2buf(UInt8Buffer* pDest , UInt8 cCAMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(cCAMode), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCCAMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCCAMode_Output_buf2par(UInt8* cCAMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(cCAMode, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , Bool panCoordinator , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(panCoordinator), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanCoordinator_Output_buf2par(Bool* panCoordinator , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(panCoordinator, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMinBE_Input_par2buf(UInt8Buffer* pDest , UInt8 minBE , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(minBE), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMinBE_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMinBE_Output_buf2par(UInt8* minBE , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(minBE, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetIndicateBeaconNotifications_Output_buf2par(Bool* enable , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacCore_MacVersion_t macVersion , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_MacVersion_t_api2buf_1(pDest, &(macVersion), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMacVersion_Output_buf2par(gpMacCore_MacVersion_t* macVersion , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_MacVersion_t_buf2api(macVersion, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetForwardPollIndications_Output_buf2par(Bool* enable , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_DataPending_QueueAdd_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pAddrInfo); + if (NULL != pAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_DataPending_QueueAdd_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pAddrInfo); + NOT_USED(stackId); +} + +void gpMacDispatcher_DataPending_QueueRemove_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pAddrInfo); + if (NULL != pAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_DataPending_QueueRemove_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pAddrInfo); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMinInterferenceLevels_Input_par2buf(UInt8Buffer* pDest , Int8* pInterferenceLevels , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pInterferenceLevels); + if (NULL != pInterferenceLevels) + { + Int8_api2buf_1(pDest, pInterferenceLevels, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 1); + (*pIndex) += 1; + } + } +} + +void gpMacDispatcher_SetMaxBE_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBE , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(maxBE), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxBE_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxBE_Output_buf2par(UInt8* maxBE , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(maxBE, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pDeviceDescriptor); + if (NULL != pDeviceDescriptor) + { + gpMacCore_DeviceDescriptor_t_api2buf(pDest, pDeviceDescriptor, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (2*1 + 2*1 + 8*1 + 4*1 + 1)); + (*pIndex) += (2*1 + 2*1 + 8*1 + 4*1 + 1); + } + } + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pDeviceDescriptor); + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_GetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_DeviceDescriptor_t_buf2api(pDeviceDescriptor , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceTablesEntries_t deviceTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_DeviceTablesEntries_t_api2buf_1(pDest, &(deviceTableEntries), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDeviceTableEntries_Output_buf2par(gpMacCore_DeviceTablesEntries_t* deviceTableEntries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_DeviceTablesEntries_t_buf2api(deviceTableEntries, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pKeyDescriptor); + if (NULL != pKeyDescriptor) + { + gpMacCore_KeyDescriptor_t_api2buf(pDest, pKeyDescriptor, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS*(9 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS*((2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS*(1 + 1) + 1 + 16)); + (*pIndex) += (GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS*(9 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS*((2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS*(1 + 1) + 1 + 16); + } + } + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pKeyDescriptor); + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_GetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_KeyDescriptor_t_buf2api(pKeyDescriptor , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetKeyTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyTablesEntries_t keyTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_KeyTablesEntries_t_api2buf_1(pDest, &(keyTableEntries), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pSecurityLevelDescriptor); + if (NULL != pSecurityLevelDescriptor) + { + gpMacCore_SecurityLevelDescriptor_t_api2buf(pDest, pSecurityLevelDescriptor, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (1 + 1 + 1 + 1)); + (*pIndex) += (1 + 1 + 1 + 1); + } + } + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pSecurityLevelDescriptor); + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_GetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_SecurityLevelDescriptor_t_buf2api(pSecurityLevelDescriptor , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_SecurityLevelTableEntries_t_api2buf_1(pDest, &(securityLevelTableEntries), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityLevelTableEntries_Output_buf2par(gpMacCore_SecurityLevelTableEntries_t* securityLevelTableEntries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_SecurityLevelTableEntries_t_buf2api(securityLevelTableEntries, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDefaultKeySource_Input_par2buf(UInt8Buffer* pDest , UInt8* pDefaultKeySource , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pDefaultKeySource); + if (NULL != pDefaultKeySource) + { + UInt8_api2buf(pDest, pDefaultKeySource, 8, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8); + (*pIndex) += 8; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetFrameCounter_Input_par2buf(UInt8Buffer* pDest , UInt32 frameCounter , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt32_api2buf_1(pDest, &(frameCounter), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetFrameCounter_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetFrameCounter_Output_buf2par(UInt32* frameCounter , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt32_buf2api(frameCounter, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetPanCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 panCoordShortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(panCoordShortAddress), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pPanCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pPanCoordExtendedAddress); + if (NULL != pPanCoordExtendedAddress) + { + MACAddress_t_api2buf_1(pDest, pPanCoordExtendedAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanCoordExtendedAddress_Output_buf2par(MACAddress_t* pPanCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + MACAddress_t_buf2api(pPanCoordExtendedAddress, pSource, 1, pIndex); + } + NOT_USED(stackId); +} + +void gpMacDispatcher_AddNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pAddrInfo); + if (NULL != pAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_AddNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(pAddrInfo); + NOT_USED(stackId); +} + +void gpMacDispatcher_RemoveNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pAddrInfo); + if (NULL != pAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_RemoveNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(pAddrInfo); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDataPendingMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_DataPendingMode_t_api2buf_1(pDest, &(dataPendingMode), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetDataPendingMode_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(dataPendingMode); + NOT_USED(stackId); +} + + +void gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_par2buf(UInt8Buffer* pDest , UInt8 addressMode , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(addressMode), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_ClearNeighbours_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetCsmaMode_Input_par2buf(UInt8Buffer* pDest , UInt8 csmaMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(csmaMode), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCsmaMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCsmaMode_Output_buf2par(UInt8* csmaMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(csmaMode, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_DataPending_QueueClear_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_DataPending_QueueClear_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + + + + + + + + + + +void gpMacDispatcher_SetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , Bool rawModeEnabled , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(rawModeEnabled), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetStackInRawMode_Output_buf2par(Bool* rawModeEnabled , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(rawModeEnabled, pSource, 1, pIndex); + NOT_USED(stackId); +} + + + +void gpMacDispatcher_EnableEnhancedFramePending_Input_par2buf(UInt8Buffer* pDest , Bool enableEnhancedFramePending , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enableEnhancedFramePending), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + + + + + +void gpMacDispatcher_GetCurrentTimeUs_Output_buf2par(UInt32* currentTime , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt32_buf2api(currentTime, pSource, 1, pIndex); +} + +void gpMacDispatcher_ConfigureEnhAckProbing_Input_par2buf(UInt8Buffer* pDest , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(linkMetrics), pIndex); + pDest[(*pIndex)++] = (NULL == pExtendedAddress); + if (NULL != pExtendedAddress) + { + MACAddress_t_api2buf_1(pDest, pExtendedAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + UInt16_api2buf_1(pDest, &(shortAddress), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_ConfigureEnhAckProbing_Output_buf2par(gpMacCore_Result_t* result , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(linkMetrics); + NOT_USED(pExtendedAddress); + NOT_USED(shortAddress); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRetransmitOnCcaFail_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRetransmitRandomBackoff_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 minBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(minBERetransmit), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMinBeRetransmit_Output_buf2par(UInt8* minBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(minBERetransmit, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(maxBERetransmit), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxBeRetransmit_Output_buf2par(UInt8* maxBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(maxBERetransmit, pSource, 1, pIndex); + NOT_USED(stackId); +} + +gpMarshall_AckStatus_t MacDispatcher_cbDataConfirm_Input_buf2api(MacDispatcher_cbDataConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + + /* server had pdHandle stored */ +#ifdef GP_COMP_UNIT_TEST + pDest->data.pdHandle = gpPd_GetRealPd(pSource[(*pIndex)++]); +#else + pDest->data.pdHandle = pSource[(*pIndex)++]; +#endif + { + gpPd_TimeStamp_t pdtimestamp; + gpPd_TimeStamp_t_buf2api(&pdtimestamp , pSource, 1, pIndex ); + gpPd_SetTxTimestamp(pDest->data.pdHandle , pdtimestamp); + } + { + UInt8 txr; + UInt8_buf2api(&txr , pSource, 1, pIndex ); + gpPd_SetTxRetryCntr(pDest->data.pdHandle , txr); + } + { + UInt8 framepending; + UInt8_buf2api(&framepending , pSource, 1, pIndex ); + gpPd_SetFramePendingAfterTx(pDest->data.pdHandle , framepending); + } + { + Bool enhancedAck; + Bool_buf2api(&enhancedAck , pSource, 1, pIndex ); + gpPd_SetRxEnhancedAckFromTxPbm(pDest->data.pdHandle , enhancedAck); + } + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbDataIndication_Input_buf2api(MacDispatcher_cbDataIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSrcAddrInfo = pDest->pSrcAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pSrcAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSrcAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDstAddrInfo = pDest->pDstAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pDstAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDstAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + UInt8_buf2api(&(pDest->data.dsn), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSecOptions = pDest->pSecOptions.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_Security_t_buf2api(pDest->data.pSecOptions , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSecOptions = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (1 + 1 + max(4,8) + 1); + } + } + { + gpMarshall_AckStatus_t marshall_result = gpPd_Loh_t_buf2api(&(pDest->data.pdLoh), pSource, 1, pIndex , false ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + gpPd_SetLqi(pDest->data.pdLoh.handle , pSource[(*pIndex)++]); + gpPd_SetRssi(pDest->data.pdLoh.handle , pSource[(*pIndex)++]); + { + gpPd_TimeStamp_t pdtimestamp; + gpPd_TimeStamp_t_buf2api(&pdtimestamp , pSource, 1, pIndex ); + gpPd_SetRxTimestamp(pDest->data.pdLoh.handle , pdtimestamp); + } + { + UInt8 rxchannel; + UInt8_buf2api(&rxchannel , pSource, 1, pIndex ); + gpPd_SetRxChannel(pDest->data.pdLoh.handle , rxchannel); + } + { + UInt16 framecontrol; + UInt16_buf2api(&framecontrol , pSource, 1, pIndex ); + gpPd_SetFrameControlFromTxAckAfterRx(pDest->data.pdLoh.handle , framecontrol); + } + + { + UInt32 framecounter; + UInt32_buf2api(&framecounter , pSource, 1, pIndex ); + gpPd_SetFrameCounterFromTxAckAfterRx(pDest->data.pdLoh.handle , framecounter); + } + { + UInt8 keyid; + UInt8_buf2api(&keyid , pSource, 1, pIndex ); + gpPd_SetKeyIdFromTxAckAfterRx(pDest->data.pdLoh.handle , keyid); + } + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbScanConfirm_Input_buf2api(MacDispatcher_cbScanConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpMacCore_ScanType_t_buf2api(&(pDest->data.scanType), pSource, 1, pIndex); + UInt32_buf2api(&(pDest->data.unscannedChannels), pSource, 1, pIndex); + UInt8_buf2api(&(pDest->data.resultListSize), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + // the pointer for the static parameter pEdScanResultList is already initialized + UInt8_buf2api(pDest->data.pEdScanResultList, pSource, pDest->data.resultListSize , pIndex ); + } + else + { + pDest->data.pEdScanResultList = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += 27; + } + } + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbAssociateIndication_Input_buf2api(MacDispatcher_cbAssociateIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDeviceAddress = pDest->pDeviceAddress.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_Address_t_buf2api(gpMacCore_AddressModeExtendedAddress , pDest->data.pDeviceAddress , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDeviceAddress = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += max(2*1,8*1); + } + } + UInt8_buf2api(&(pDest->data.capabilityInformation), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.rxTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbAssociateConfirm_Input_buf2api(MacDispatcher_cbAssociateConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt16_buf2api(&(pDest->data.assocShortAddress), pSource, 1, pIndex); + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbAssociateCommStatusIndication_Input_buf2api(MacDispatcher_cbAssociateCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSrcAddrInfo = pDest->pSrcAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pSrcAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSrcAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDstAddrInfo = pDest->pDstAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pDstAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDstAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbPollConfirm_Input_buf2api(MacDispatcher_cbPollConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.coordAddrInfo = pDest->coordAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.coordAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.coordAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbPollIndication_Input_buf2api(MacDispatcher_cbPollIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.addressInfo = pDest->addressInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.addressInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.addressInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpPd_TimeStamp_t_buf2api(&(pDest->data.rxTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbPurgeConfirm_Input_buf2api(MacDispatcher_cbPurgeConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + + /* server had pdHandle stored */ +#ifdef GP_COMP_UNIT_TEST + pDest->data.pdHandle = gpPd_GetRealPd(pSource[(*pIndex)++]); +#else + pDest->data.pdHandle = pSource[(*pIndex)++]; +#endif + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbBeaconNotifyIndication_Input_buf2api(MacDispatcher_cbBeaconNotifyIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(&(pDest->data.bsn), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pPanDescriptor = pDest->pPanDescriptor.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_PanDescriptor_t_buf2api(pDest->data.pPanDescriptor , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pPanDescriptor = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (4*1 + 2*1 + 1 + 1 + (max(2*1,8*1) + 2*1 + 1)); + } + } + UInt8_buf2api(&(pDest->data.beaconPayloadLength), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pBeaconPayload = pDest->pBeaconPayload; + UInt8_buf2api(pDest->data.pBeaconPayload, pSource, pDest->data.beaconPayloadLength , pIndex ); + } + else + { + pDest->data.pBeaconPayload = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH; + } + } + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbOrphanIndication_Input_buf2api(MacDispatcher_cbOrphanIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pOrphanAddress = pDest->pOrphanAddress; + MACAddress_t_buf2api(pDest->data.pOrphanAddress, pSource, 1 , pIndex ); + } + else + { + pDest->data.pOrphanAddress = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += 8*1; + } + } + gpPd_TimeStamp_t_buf2api(&(pDest->data.rxTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbOrphanCommStatusIndication_Input_buf2api(MacDispatcher_cbOrphanCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSrcAddrInfo = pDest->pSrcAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pSrcAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSrcAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDstAddrInfo = pDest->pDstAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pDstAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDstAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbSecurityFailureCommStatusIndication_Input_buf2api(MacDispatcher_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSrcAddrInfo = pDest->pSrcAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pSrcAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSrcAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDstAddrInfo = pDest->pDstAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pDstAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDstAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbDriverResetIndication_Input_buf2api(MacDispatcher_cbDriverResetIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacDispatcher_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbPollNotify_Input_buf2api(MacDispatcher_cbPollNotify_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.addressInfo = pDest->addressInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.addressInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.addressInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpPd_TimeStamp_t_buf2api(&(pDest->data.rxTime), pSource, 1, pIndex); + + /* server had pdHandle stored */ +#ifdef GP_COMP_UNIT_TEST + pDest->data.pdHandle = gpPd_GetRealPd(pSource[(*pIndex)++]); +#else + pDest->data.pdHandle = pSource[(*pIndex)++]; +#endif + Bool_buf2api(&(pDest->data.fromNeighbour), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbSecurityFrameCounterIndication_Input_buf2api(MacDispatcher_cbSecurityFrameCounterIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt32_buf2api(&(pDest->data.frameCounter), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c new file mode 100644 index 0000000..112d6af --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c @@ -0,0 +1,4243 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacDispatcher_wrapper_client.c" + * + * MAC Dispatcher + * + * Wrapper implementation +*/ + +/***************************************************************************** + * Includes Definition + *****************************************************************************/ + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpCom.h" +#include "gpPd.h" +#include "gpModule.h" +#include "gpMacDispatcher_clientServerCmdId.h" +#include "gpMacDispatcher.h" +#include "gpMacDispatcher_marshalling.h" +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +#include "gpVersion.h" +#endif +/* AdditionalIncludes */ +#include "gpMacDispatcher_def.h" +#include "gpMacDispatcher_callbacks.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Functions Declaration + *****************************************************************************/ + +static void gpMacDispatcher_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId); +static void MacDispatcher_HandleConnectionClose(gpCom_CommunicationId_t communicationId); + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACDISPATCHER +#define GP_MODULE_ID GP_COMPONENT_ID + + +#ifndef GP_MACDISPATCHER_COMM_ID +#define GP_MACDISPATCHER_COMM_ID GP_COM_DEFAULT_COMMUNICATION_ID +#endif + +#define REGISTER_MODULE(handle) GP_COM_REGISTER_MODULE(handle) +#define DATA_REQUEST(len,buf,commId) GP_COM_DATA_REQUEST(len,buf,commId) +#define DATA_REQUEST_ACKED(len,buf,commId) gpCom_DataRequestAndWaitForAck(GP_MODULE_ID, len, buf, commId, &gpMacDispatcher_reqAcked, GPMACDISPATCHER_GPCOMTIMEOUT_US, gpMacDispatcher_Acknowledge_CmdId) + +/***************************************************************************** + * Static Data + *****************************************************************************/ + +typedef union ackDataNeeded { + UInt8 dataBuf0[1]; + UInt8 dataBuf1[(2) * 1]; + UInt8 dataBuf2[1+8*1]; + UInt8 dataBuf3[1+GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; + UInt8 dataBuf4[(2*1 + 2*1 + 8*1 + 4*1 + 1)+1]; + UInt8 dataBuf5[(GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS*(9 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS*((2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS*(1 + 1) + 1 + 16)+1]; + UInt8 dataBuf6[(1 + 1 + 1 + 1)+1]; + UInt8 dataBuf7[(4) * 1]; + UInt8 dataBuf8[8*1]; + UInt8 dataBuf9[1+4*1+1+16]; +} ackDataNeeded_t; +static UInt8 gpMacDispatcher_ackBuffer[1 + 1 + 1 + sizeof(ackDataNeeded_t)]; +static Bool gpMacDispatcher_reqAcked; +/* AdditionalStaticData */ +STATIC UInt8* gpMacDispatcher_pResultList = NULL; //Manual - EDScan list +STATIC UInt8 gpMacDispatcher_ClientLockedStack[GP_DIVERSITY_NR_OF_STACKS]; +/* AdditionalStaticData */ + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +static Bool MacDispatcher_clientApiVersionSelected = false; +#endif + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +/* AdditionalStaticFunctionDefinitions */ + +// Define static functions MacDispatcher_cbXXX() to call registered API callbacks. +#include "gpMacDispatcher_callbacks.c" + +/* AdditionalStaticFunctionDefinitions */ + +static void MacDispatcher_HandleConnectionClose(gpCom_CommunicationId_t communicationId) +{ +/* ConnectionCloseFunction */ + GP_LOG_PRINTF("%s on commId=%x vs macDispComm=%x",0, __FUNCTION__, communicationId, GP_MACDISPATCHER_COMM_ID); + if(GP_MACDISPATCHER_COMM_ID == communicationId) + { + //All stacks disconnected - only 1 server used + UInt8 stackId; + for (stackId = 0; stackId < GP_DIVERSITY_NR_OF_STACKS; ++stackId) + { + gpMacDispatcher_ClientLockedStack[stackId] = 0; + MacDispatcher_cbDriverResetIndication(0, stackId); + } + MacDispatcher_InitStackMapping(); + } +/* ConnectionCloseFunction */ +} + +static void gpMacDispatcher_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId) +{ +#define commandId pPayload[0] + gpMarshall_AckStatus_t marshall_result; + UInt16 _index = 1; + gpMacDispatcher_Client_Input_union_t input; + UInt8 ackBuffer[1 + 1 + 1]; + UInt8 ackBytes = 0; /*No ack's on indication - fill in length when needed - 3+x */ + + if(pPayload == NULL) + { + MacDispatcher_HandleConnectionClose(communicationId); + return; + } + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + + ackBuffer[0] = gpMacDispatcher_Acknowledge_CmdId; + ackBuffer[1] = gpMarshall_AckStatusSuccess; + ackBuffer[2] = commandId; + + switch(commandId) + { + + case MacDispatcher_cbDataConfirm_CmdId: + { + marshall_result = MacDispatcher_cbDataConfirm_Input_buf2api(&(input.MacDispatcher_cbDataConfirm) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbDataConfirm */ + if(input.MacDispatcher_cbDataConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbDataConfirm.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbDataConfirm */ + + MacDispatcher_cbDataConfirm( + input.MacDispatcher_cbDataConfirm.data.status + , input.MacDispatcher_cbDataConfirm.data.pdHandle + , input.MacDispatcher_cbDataConfirm.data.stackId + ); + + + break; + } + case MacDispatcher_cbDataIndication_CmdId: + { + marshall_result = MacDispatcher_cbDataIndication_Input_buf2api(&(input.MacDispatcher_cbDataIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbDataIndication */ + if(input.MacDispatcher_cbDataIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbDataIndication.data.stackId]) + { + //MacDispatcher_cbDataIndication_Input_buf2api claims a pd, we need to free here + gpPd_FreePd(input.MacDispatcher_cbDataIndication.data.pdLoh.handle); + break; + } + } +/* ResetCheck_MacDispatcher_cbDataIndication */ + + MacDispatcher_cbDataIndication( + input.MacDispatcher_cbDataIndication.data.pSrcAddrInfo + , input.MacDispatcher_cbDataIndication.data.pDstAddrInfo + , input.MacDispatcher_cbDataIndication.data.dsn + , input.MacDispatcher_cbDataIndication.data.pSecOptions + , input.MacDispatcher_cbDataIndication.data.pdLoh + , input.MacDispatcher_cbDataIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbScanConfirm_CmdId: + { +/* SpecialCall_MacDispatcher_cbScanConfirm */ + input.MacDispatcher_cbScanConfirm.data.pEdScanResultList = gpMacDispatcher_pResultList; + gpMacDispatcher_pResultList = NULL; + marshall_result = MacDispatcher_cbScanConfirm_Input_buf2api( &(input.MacDispatcher_cbScanConfirm) , pPayload , &_index ); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + + if(input.MacDispatcher_cbScanConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbScanConfirm.data.stackId]) + { + break; + } + } + + MacDispatcher_cbScanConfirm( + input.MacDispatcher_cbScanConfirm.data.status + , input.MacDispatcher_cbScanConfirm.data.scanType + , input.MacDispatcher_cbScanConfirm.data.unscannedChannels + , input.MacDispatcher_cbScanConfirm.data.resultListSize + , input.MacDispatcher_cbScanConfirm.data.pEdScanResultList + , input.MacDispatcher_cbScanConfirm.data.stackId + ); +/* SpecialCall_MacDispatcher_cbScanConfirm */ + + + break; + } + case MacDispatcher_cbAssociateIndication_CmdId: + { + marshall_result = MacDispatcher_cbAssociateIndication_Input_buf2api(&(input.MacDispatcher_cbAssociateIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbAssociateIndication */ + if(input.MacDispatcher_cbAssociateIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbAssociateIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbAssociateIndication */ + + MacDispatcher_cbAssociateIndication( + input.MacDispatcher_cbAssociateIndication.data.pDeviceAddress + , input.MacDispatcher_cbAssociateIndication.data.capabilityInformation + , input.MacDispatcher_cbAssociateIndication.data.rxTime + , input.MacDispatcher_cbAssociateIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbAssociateConfirm_CmdId: + { + marshall_result = MacDispatcher_cbAssociateConfirm_Input_buf2api(&(input.MacDispatcher_cbAssociateConfirm) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbAssociateConfirm */ + if(input.MacDispatcher_cbAssociateConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbAssociateConfirm.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbAssociateConfirm */ + + MacDispatcher_cbAssociateConfirm( + input.MacDispatcher_cbAssociateConfirm.data.assocShortAddress + , input.MacDispatcher_cbAssociateConfirm.data.status + , input.MacDispatcher_cbAssociateConfirm.data.txTime + , input.MacDispatcher_cbAssociateConfirm.data.stackId + ); + + + break; + } + case MacDispatcher_cbAssociateCommStatusIndication_CmdId: + { + marshall_result = MacDispatcher_cbAssociateCommStatusIndication_Input_buf2api(&(input.MacDispatcher_cbAssociateCommStatusIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbAssociateCommStatusIndication */ + if(input.MacDispatcher_cbAssociateCommStatusIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbAssociateCommStatusIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbAssociateCommStatusIndication */ + + MacDispatcher_cbAssociateCommStatusIndication( + input.MacDispatcher_cbAssociateCommStatusIndication.data.pSrcAddrInfo + , input.MacDispatcher_cbAssociateCommStatusIndication.data.pDstAddrInfo + , input.MacDispatcher_cbAssociateCommStatusIndication.data.status + , input.MacDispatcher_cbAssociateCommStatusIndication.data.txTime + , input.MacDispatcher_cbAssociateCommStatusIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbPollConfirm_CmdId: + { + marshall_result = MacDispatcher_cbPollConfirm_Input_buf2api(&(input.MacDispatcher_cbPollConfirm) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbPollConfirm */ + if(input.MacDispatcher_cbPollConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbPollConfirm.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbPollConfirm */ + + MacDispatcher_cbPollConfirm( + input.MacDispatcher_cbPollConfirm.data.status + , input.MacDispatcher_cbPollConfirm.data.coordAddrInfo + , input.MacDispatcher_cbPollConfirm.data.txTime + , input.MacDispatcher_cbPollConfirm.data.stackId + ); + + + break; + } + case MacDispatcher_cbPollIndication_CmdId: + { + marshall_result = MacDispatcher_cbPollIndication_Input_buf2api(&(input.MacDispatcher_cbPollIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbPollIndication */ + if(input.MacDispatcher_cbPollIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbPollIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbPollIndication */ + + MacDispatcher_cbPollIndication( + input.MacDispatcher_cbPollIndication.data.addressInfo + , input.MacDispatcher_cbPollIndication.data.rxTime + , input.MacDispatcher_cbPollIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbPurgeConfirm_CmdId: + { + marshall_result = MacDispatcher_cbPurgeConfirm_Input_buf2api(&(input.MacDispatcher_cbPurgeConfirm) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbPurgeConfirm */ + if(input.MacDispatcher_cbPurgeConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbPurgeConfirm.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbPurgeConfirm */ + + MacDispatcher_cbPurgeConfirm( + input.MacDispatcher_cbPurgeConfirm.data.status + , input.MacDispatcher_cbPurgeConfirm.data.pdHandle + , input.MacDispatcher_cbPurgeConfirm.data.stackId + ); + + + break; + } + case MacDispatcher_cbBeaconNotifyIndication_CmdId: + { + marshall_result = MacDispatcher_cbBeaconNotifyIndication_Input_buf2api(&(input.MacDispatcher_cbBeaconNotifyIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbBeaconNotifyIndication */ + if(input.MacDispatcher_cbBeaconNotifyIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbBeaconNotifyIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbBeaconNotifyIndication */ + + MacDispatcher_cbBeaconNotifyIndication( + input.MacDispatcher_cbBeaconNotifyIndication.data.bsn + , input.MacDispatcher_cbBeaconNotifyIndication.data.pPanDescriptor + , input.MacDispatcher_cbBeaconNotifyIndication.data.beaconPayloadLength + , input.MacDispatcher_cbBeaconNotifyIndication.data.pBeaconPayload + , input.MacDispatcher_cbBeaconNotifyIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbOrphanIndication_CmdId: + { + marshall_result = MacDispatcher_cbOrphanIndication_Input_buf2api(&(input.MacDispatcher_cbOrphanIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbOrphanIndication */ + if(input.MacDispatcher_cbOrphanIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbOrphanIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbOrphanIndication */ + + MacDispatcher_cbOrphanIndication( + input.MacDispatcher_cbOrphanIndication.data.pOrphanAddress + , input.MacDispatcher_cbOrphanIndication.data.rxTime + , input.MacDispatcher_cbOrphanIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbOrphanCommStatusIndication_CmdId: + { + marshall_result = MacDispatcher_cbOrphanCommStatusIndication_Input_buf2api(&(input.MacDispatcher_cbOrphanCommStatusIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbOrphanCommStatusIndication */ + if(input.MacDispatcher_cbOrphanCommStatusIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbOrphanCommStatusIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbOrphanCommStatusIndication */ + + MacDispatcher_cbOrphanCommStatusIndication( + input.MacDispatcher_cbOrphanCommStatusIndication.data.pSrcAddrInfo + , input.MacDispatcher_cbOrphanCommStatusIndication.data.pDstAddrInfo + , input.MacDispatcher_cbOrphanCommStatusIndication.data.status + , input.MacDispatcher_cbOrphanCommStatusIndication.data.txTime + , input.MacDispatcher_cbOrphanCommStatusIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbSecurityFailureCommStatusIndication_CmdId: + { + marshall_result = MacDispatcher_cbSecurityFailureCommStatusIndication_Input_buf2api(&(input.MacDispatcher_cbSecurityFailureCommStatusIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbSecurityFailureCommStatusIndication */ + if(input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbSecurityFailureCommStatusIndication */ + + MacDispatcher_cbSecurityFailureCommStatusIndication( + input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.pSrcAddrInfo + , input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.pDstAddrInfo + , input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.status + , input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.txTime + , input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbDriverResetIndication_CmdId: + { + marshall_result = MacDispatcher_cbDriverResetIndication_Input_buf2api(&(input.MacDispatcher_cbDriverResetIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbDriverResetIndication */ + if(input.MacDispatcher_cbDriverResetIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(input.MacDispatcher_cbDriverResetIndication.data.status == 0xFF) //indication was triggered in the end of a reset call to inform reset has finished + { + //Free up any callbacks to client - reset has completed + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbDriverResetIndication.data.stackId] > 0) + { + gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbDriverResetIndication.data.stackId]--; + } + break; + } + } +/* ResetCheck_MacDispatcher_cbDriverResetIndication */ + + MacDispatcher_cbDriverResetIndication( + input.MacDispatcher_cbDriverResetIndication.data.status + , input.MacDispatcher_cbDriverResetIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbPollNotify_CmdId: + { + marshall_result = MacDispatcher_cbPollNotify_Input_buf2api(&(input.MacDispatcher_cbPollNotify) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbPollNotify */ + if(input.MacDispatcher_cbPollNotify.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbPollNotify.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbPollNotify */ + + MacDispatcher_cbPollNotify( + input.MacDispatcher_cbPollNotify.data.addressInfo + , input.MacDispatcher_cbPollNotify.data.rxTime + , input.MacDispatcher_cbPollNotify.data.pdHandle + , input.MacDispatcher_cbPollNotify.data.fromNeighbour + , input.MacDispatcher_cbPollNotify.data.stackId + ); + + + break; + } + case MacDispatcher_cbSecurityFrameCounterIndication_CmdId: + { + marshall_result = MacDispatcher_cbSecurityFrameCounterIndication_Input_buf2api(&(input.MacDispatcher_cbSecurityFrameCounterIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbSecurityFrameCounterIndication */ + if(input.MacDispatcher_cbSecurityFrameCounterIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbSecurityFrameCounterIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbSecurityFrameCounterIndication */ + + MacDispatcher_cbSecurityFrameCounterIndication( + input.MacDispatcher_cbSecurityFrameCounterIndication.data.frameCounter + , input.MacDispatcher_cbSecurityFrameCounterIndication.data.stackId + ); + + + break; + } + case gpMacDispatcher_Acknowledge_CmdId: + { + GP_ASSERT_SYSTEM(length <= sizeof(gpMacDispatcher_ackBuffer)); + MEMCPY(gpMacDispatcher_ackBuffer, pPayload, length); + gpMacDispatcher_reqAcked = true; + return; + } + default: + { + GP_ASSERT_DEV_INT(false); + break; + } + } +#undef commandId + if(0 < ackBytes) + { + DATA_REQUEST(ackBytes, ackBuffer, communicationId); + } +} +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +void gpMacDispatcher_SetDefaultApiVersion(gpVersion_ModuleVersionInfo_t* moduleVersionInfo) +{ + MacDispatcher_clientApiVersionSelected = true; + //TBD +} +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + + +void gpMacDispatcher_DeInit(void) +{ + gpCom_DeRegisterModule(GP_MODULE_ID); +} + +void gpMacDispatcher_Init(void) +{ +/* Init */ + MacDispatcher_InitStackMapping(); + + { + UInt8 i; + for(i=0; i < GP_DIVERSITY_NR_OF_STACKS; i++) + { + gpMacDispatcher_ClientLockedStack[i] = 0; + } + } +/* Init */ + + gpMacDispatcher_InitMarshalling(); + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + gpVersion_ReleaseInfo_t versions[1] = {{2,7,0,0}}; + MacDispatcher_clientApiVersionSelected = false; + gpVersion_RegisterModule(GP_MODULE_ID, versions,1,gpMacDispatcher_SetDefaultApiVersion); +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + REGISTER_MODULE(gpMacDispatcher_HandleIndicationClient); +} + +/***************************************************************************** + * gpMacDispatcher Require Functions + *****************************************************************************/ + +gpMacDispatcher_StackId_t gpMacDispatcher_RegisterNetworkStack(gpMacDispatcher_StringIdentifier_t* stringIdentifier) +{ + UInt16 _index = 1; + gpMacDispatcher_StackId_t stackId; + UInt8 dataBuf[1 + 1 + (5)]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_RegisterNetworkStack_CmdId; + + gpMacDispatcher_RegisterNetworkStack_Input_par2buf(dataBuf + , stringIdentifier + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_RegisterNetworkStack_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_RegisterNetworkStack_Output_buf2par( + &stackId + , stringIdentifier + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return stackId; +} + +gpMacCore_Result_t gpMacDispatcher_UnRegisterNetworkStack(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_UnRegisterNetworkStack_CmdId; + + gpMacDispatcher_UnRegisterNetworkStack_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_UnRegisterNetworkStack_CmdId == gpMacDispatcher_ackBuffer[2]); + +/* AdditionalBehavior_gpMacDispatcher_UnRegisterNetworkStack */ + MacDispatcher_UnRegisterCallbacks(stackId); + gpMacDispatcher_ClientLockedStack[stackId] = 0; +/* AdditionalBehavior_gpMacDispatcher_UnRegisterNetworkStack */ + + _index = 3; + gpMacDispatcher_UnRegisterNetworkStack_Output_buf2par( + &result + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +Bool gpMacDispatcher_LockClaim(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_LockClaim_CmdId; + + gpMacDispatcher_LockClaim_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_LockClaim_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_LockClaim_Output_buf2par( + &result + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_LockRelease(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_LockRelease_CmdId; + + gpMacDispatcher_LockRelease_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_LockRelease_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_LockedByThisStack(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool locked; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_LockedByThisStack_CmdId; + + gpMacDispatcher_LockedByThisStack_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_LockedByThisStack_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_LockedByThisStack_Output_buf2par( + &locked + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return locked; +} + +Bool gpMacDispatcher_Locked(void) +{ + UInt16 _index = 1; + Bool locked; + UInt8 dataBuf[1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_Locked_CmdId; + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_Locked_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_Locked_Output_buf2par( + &locked + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return locked; +} + +gpMacDispatcher_Result_t gpMacDispatcher_Reset(Bool setDefaultPib, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacDispatcher_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_Reset_CmdId; + + gpMacDispatcher_Reset_Input_par2buf(dataBuf + , setDefaultPib + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_Reset_CmdId == gpMacDispatcher_ackBuffer[2]); + +/* AdditionalBehavior_gpMacDispatcher_Reset */ + //Lock any callbacks for this stack until reset indication is received + if(stackId < GP_DIVERSITY_NR_OF_STACKS) + { + gpMacDispatcher_ClientLockedStack[stackId]++; + } +/* AdditionalBehavior_gpMacDispatcher_Reset */ + + _index = 3; + gpMacDispatcher_Reset_Output_buf2par( + &result + , setDefaultPib + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_DataRequest(gpMacCore_AddressMode_t srcAddrMode, gpMacCore_AddressInfo_t* pDstAddressInfo, UInt8 txOptions, gpMacCore_Security_t* pSecOptions, gpMacCore_MultiChannelOptions_t multiChannelOptions, gpPd_Loh_t pdLoh, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1 + 1 + (1 + 1 + max(4,8) + 1) + (3) + (2*1 + 2*0 + 128 + 1) + 128 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_DataRequest_CmdId; + + gpMacDispatcher_DataRequest_Input_par2buf(dataBuf + , srcAddrMode + , pDstAddressInfo + , txOptions + , pSecOptions + , multiChannelOptions + , pdLoh + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMacDispatcher_DataRequest_CmdId == gpMacDispatcher_ackBuffer[2]); +/* gpMacDispatcher_DataRequest_StatusCheck */ + /* Manual added begin:*/ + if(gpMarshall_AckStatusSuccess != gpMacDispatcher_ackBuffer[1]) + { + MacDispatcher_cbDataConfirm(gpMacCore_ResultTransactionOverflow, pdLoh.handle, stackId); + } + /* Manual added end*/ +/* gpMacDispatcher_DataRequest_StatusCheck */ + + +#undef commandId +} + +void gpMacDispatcher_ScanRequest(gpMacCore_ScanType_t scanType, UInt32 scanChannels, UInt8 scanDuration, UInt8 resultListSize, UInt8* pResultList, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 4*1 + 1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_ScanRequest_CmdId; + + gpMacDispatcher_ScanRequest_Input_par2buf(dataBuf + , scanType + , scanChannels + , scanDuration + , resultListSize + , pResultList + , stackId + , &_index); +/* SpecialOutputParameterHandling_gpMacDispatcher_ScanRequest_pResultList */ + if ((pResultList!= NULL) && (gpMacDispatcher_pResultList != NULL)) + { + MacDispatcher_cbScanConfirm(gpMacCore_ResultTransactionOverflow, scanType, scanChannels, 0, pResultList,stackId); + return; + } + else + { + //Do not assign result list on a Stop request + if (scanType != gpMacCore_ScanTypeStop) + { + gpMacDispatcher_pResultList = pResultList; + } + } +/* SpecialOutputParameterHandling_gpMacDispatcher_ScanRequest_pResultList */ + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_ScanRequest_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_AssociateRequest(UInt8 logicalChannel, gpMacCore_AddressInfo_t* coordAddrInfo, UInt8 capabilityInformation, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_AssociateRequest_CmdId; + + gpMacDispatcher_AssociateRequest_Input_par2buf(dataBuf + , logicalChannel + , coordAddrInfo + , capabilityInformation + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_AssociateRequest_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_AssociateResponse(MACAddress_t* pDeviceAddress, UInt16 associateShortAddress, gpMacCore_Result_t status, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 2*1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_AssociateResponse_CmdId; + + gpMacDispatcher_AssociateResponse_Input_par2buf(dataBuf + , pDeviceAddress + , associateShortAddress + , status + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_AssociateResponse_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_PollRequest(gpMacCore_AddressInfo_t* coordAddrInfo, gpMacCore_Security_t* pSecOptions, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1 + (1 + 1 + max(4,8) + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_PollRequest_CmdId; + + gpMacDispatcher_PollRequest_Input_par2buf(dataBuf + , coordAddrInfo + , pSecOptions + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_PollRequest_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_PurgeRequest(gpPd_Handle_t pdHandle, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_PurgeRequest_CmdId; + + gpMacDispatcher_PurgeRequest_Input_par2buf(dataBuf + , pdHandle + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_PurgeRequest_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_Result_t gpMacDispatcher_Start(gpMacCore_PanId_t panId, UInt8 logicalChannel, Bool panCoordinator, UInt8 stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t returnValue; + UInt8 dataBuf[1 + 2*1 + 1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_Start_CmdId; + + gpMacDispatcher_Start_Input_par2buf(dataBuf + , panId + , logicalChannel + , panCoordinator + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_Start_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_Start_Output_buf2par( + &returnValue + , panId + , logicalChannel + , panCoordinator + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return returnValue; +} + +void gpMacDispatcher_OrphanResponse(MACAddress_t* pOrphanAddress, UInt16 shortAddress, Bool associatedMember, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 2*1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_OrphanResponse_CmdId; + + gpMacDispatcher_OrphanResponse_Input_par2buf(dataBuf + , pOrphanAddress + , shortAddress + , associatedMember + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_OrphanResponse_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetPanId(UInt16 panId, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPanId_CmdId; + + gpMacDispatcher_SetPanId_Input_par2buf(dataBuf + , panId + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPanId_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_PanId_t gpMacDispatcher_GetPanId(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_PanId_t panId; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetPanId_CmdId; + + gpMacDispatcher_GetPanId_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetPanId_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetPanId_Output_buf2par( + &panId + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return panId; +} + +void gpMacDispatcher_SetShortAddress(UInt16 shortAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetShortAddress_CmdId; + + gpMacDispatcher_SetShortAddress_Input_par2buf(dataBuf + , shortAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt16 gpMacDispatcher_GetShortAddress(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt16 address; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetShortAddress_CmdId; + + gpMacDispatcher_GetShortAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetShortAddress_Output_buf2par( + &address + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return address; +} + +void gpMacDispatcher_SetExtendedAddress(MACAddress_t* pExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetExtendedAddress_CmdId; + + gpMacDispatcher_SetExtendedAddress_Input_par2buf(dataBuf + , pExtendedAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_GetExtendedAddress(MACAddress_t* pExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetExtendedAddress_CmdId; + + gpMacDispatcher_GetExtendedAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetExtendedAddress_Output_buf2par( + pExtendedAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId +} + +void gpMacDispatcher_SetDsn(UInt8 dsn, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDsn_CmdId; + + gpMacDispatcher_SetDsn_Input_par2buf(dataBuf + , dsn + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDsn_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetDsn(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dsn; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetDsn_CmdId; + + gpMacDispatcher_GetDsn_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetDsn_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetDsn_Output_buf2par( + &dsn + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return dsn; +} + +void gpMacDispatcher_SetCurrentChannel(UInt8 channel, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCurrentChannel_CmdId; + + gpMacDispatcher_SetCurrentChannel_Input_par2buf(dataBuf + , channel + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCurrentChannel_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetCurrentChannel(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 channel; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCurrentChannel_CmdId; + + gpMacDispatcher_GetCurrentChannel_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCurrentChannel_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCurrentChannel_Output_buf2par( + &channel + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return channel; +} + +void gpMacDispatcher_SetBeaconPayload(UInt8* pBeaconPayload, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetBeaconPayload_CmdId; + + gpMacDispatcher_SetBeaconPayload_Input_par2buf(dataBuf + , pBeaconPayload + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetBeaconPayload_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_GetBeaconPayload(UInt8* pBeaconPayload, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetBeaconPayload_CmdId; + + gpMacDispatcher_GetBeaconPayload_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetBeaconPayload_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetBeaconPayload_Output_buf2par( + pBeaconPayload + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId +} + +void gpMacDispatcher_SetBeaconPayloadLength(UInt8 beaconPayloadLength, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetBeaconPayloadLength_CmdId; + + gpMacDispatcher_SetBeaconPayloadLength_Input_par2buf(dataBuf + , beaconPayloadLength + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetBeaconPayloadLength_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetBeaconPayloadLength(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 beaconPayloadLength; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetBeaconPayloadLength_CmdId; + + gpMacDispatcher_GetBeaconPayloadLength_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetBeaconPayloadLength_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetBeaconPayloadLength_Output_buf2par( + &beaconPayloadLength + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return beaconPayloadLength; +} + + + +void gpMacDispatcher_SetRxOnWhenIdle(Bool rxOnWhenIdle, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetRxOnWhenIdle_CmdId; + + gpMacDispatcher_SetRxOnWhenIdle_Input_par2buf(dataBuf + , rxOnWhenIdle + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetRxOnWhenIdle_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetRxOnWhenIdle(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool rxOnWhenIdle; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetRxOnWhenIdle_CmdId; + + gpMacDispatcher_GetRxOnWhenIdle_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetRxOnWhenIdle_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetRxOnWhenIdle_Output_buf2par( + &rxOnWhenIdle + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return rxOnWhenIdle; +} + +UInt16 gpMacDispatcher_GetTransactionPersistenceTime(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt16 time; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetTransactionPersistenceTime_CmdId; + + gpMacDispatcher_GetTransactionPersistenceTime_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetTransactionPersistenceTime_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetTransactionPersistenceTime_Output_buf2par( + &time + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return time; +} + +void gpMacDispatcher_SetTransactionPersistenceTime(UInt16 time, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetTransactionPersistenceTime_CmdId; + + gpMacDispatcher_SetTransactionPersistenceTime_Input_par2buf(dataBuf + , time + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetTransactionPersistenceTime_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetBeaconStarted(Bool beaconStarted, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetBeaconStarted_CmdId; + + gpMacDispatcher_SetBeaconStarted_Input_par2buf(dataBuf + , beaconStarted + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetBeaconStarted_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetBeaconStarted(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool beaconStarted; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetBeaconStarted_CmdId; + + gpMacDispatcher_GetBeaconStarted_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetBeaconStarted_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetBeaconStarted_Output_buf2par( + &beaconStarted + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return beaconStarted; +} + +void gpMacDispatcher_SetCoordShortAddress(UInt16 coordShortAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCoordShortAddress_CmdId; + + gpMacDispatcher_SetCoordShortAddress_Input_par2buf(dataBuf + , coordShortAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCoordShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt16 gpMacDispatcher_GetCoordShortAddress(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt16 coordShortAddress; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCoordShortAddress_CmdId; + + gpMacDispatcher_GetCoordShortAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCoordShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCoordShortAddress_Output_buf2par( + &coordShortAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return coordShortAddress; +} + +void gpMacDispatcher_SetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCoordExtendedAddress_CmdId; + + gpMacDispatcher_SetCoordExtendedAddress_Input_par2buf(dataBuf + , pCoordExtendedAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCoordExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_GetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCoordExtendedAddress_CmdId; + + gpMacDispatcher_GetCoordExtendedAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCoordExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCoordExtendedAddress_Output_buf2par( + pCoordExtendedAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId +} + +void gpMacDispatcher_SetPromiscuousMode(UInt8 promiscuousMode, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPromiscuousMode_CmdId; + + gpMacDispatcher_SetPromiscuousMode_Input_par2buf(dataBuf + , promiscuousMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPromiscuousMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetPromiscuousMode(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool promiscuousMode; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetPromiscuousMode_CmdId; + + gpMacDispatcher_GetPromiscuousMode_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetPromiscuousMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetPromiscuousMode_Output_buf2par( + &promiscuousMode + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return promiscuousMode; +} + +void gpMacDispatcher_SetAssociationPermit(Bool associationPermit, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetAssociationPermit_CmdId; + + gpMacDispatcher_SetAssociationPermit_Input_par2buf(dataBuf + , associationPermit + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetAssociationPermit_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetAssociationPermit(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool associationPermit; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetAssociationPermit_CmdId; + + gpMacDispatcher_GetAssociationPermit_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetAssociationPermit_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetAssociationPermit_Output_buf2par( + &associationPermit + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return associationPermit; +} + +void gpMacDispatcher_SetSecurityEnabled(Bool securityEnabled, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetSecurityEnabled_CmdId; + + gpMacDispatcher_SetSecurityEnabled_Input_par2buf(dataBuf + , securityEnabled + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetSecurityEnabled_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetSecurityEnabled(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool securityEnabled; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetSecurityEnabled_CmdId; + + gpMacDispatcher_GetSecurityEnabled_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetSecurityEnabled_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetSecurityEnabled_Output_buf2par( + &securityEnabled + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return securityEnabled; +} + +void gpMacDispatcher_SetNumberOfRetries(UInt8 numberOfRetries, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetNumberOfRetries_CmdId; + + gpMacDispatcher_SetNumberOfRetries_Input_par2buf(dataBuf + , numberOfRetries + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetNumberOfRetries_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetNumberOfRetries(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 numberOfRetries; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetNumberOfRetries_CmdId; + + gpMacDispatcher_GetNumberOfRetries_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetNumberOfRetries_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetNumberOfRetries_Output_buf2par( + &numberOfRetries + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return numberOfRetries; +} + +void gpMacDispatcher_SetMaxCsmaBackoffs(UInt8 maxCsmaBackoffs, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMaxCsmaBackoffs_CmdId; + + gpMacDispatcher_SetMaxCsmaBackoffs_Input_par2buf(dataBuf + , maxCsmaBackoffs + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMaxCsmaBackoffs_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMaxCsmaBackoffs(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 maxCsmaBackoffs; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMaxCsmaBackoffs_CmdId; + + gpMacDispatcher_GetMaxCsmaBackoffs_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMaxCsmaBackoffs_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMaxCsmaBackoffs_Output_buf2par( + &maxCsmaBackoffs + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return maxCsmaBackoffs; +} + +void gpMacDispatcher_SetDefaultTransmitPowers(Int8* pDefaultTransmitPowerTable) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 16]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDefaultTransmitPowers_CmdId; + + gpMacDispatcher_SetDefaultTransmitPowers_Input_par2buf(dataBuf + , pDefaultTransmitPowerTable + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDefaultTransmitPowers_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetTransmitPower(gpMacCore_TxPower_t transmitPower, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetTransmitPower_CmdId; + + gpMacDispatcher_SetTransmitPower_Input_par2buf(dataBuf + , transmitPower + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetTransmitPower_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Int8 gpMacDispatcher_GetTransmitPower(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Int8 transmitPower; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetTransmitPower_CmdId; + + gpMacDispatcher_GetTransmitPower_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetTransmitPower_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetTransmitPower_Output_buf2par( + &transmitPower + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return transmitPower; +} + +void gpMacDispatcher_SetCCAMode(UInt8 cCAMode, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCCAMode_CmdId; + + gpMacDispatcher_SetCCAMode_Input_par2buf(dataBuf + , cCAMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCCAMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetCCAMode(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 cCAMode; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCCAMode_CmdId; + + gpMacDispatcher_GetCCAMode_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCCAMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCCAMode_Output_buf2par( + &cCAMode + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return cCAMode; +} + +void gpMacDispatcher_SetPanCoordinator(Bool panCoordinator, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPanCoordinator_CmdId; + + gpMacDispatcher_SetPanCoordinator_Input_par2buf(dataBuf + , panCoordinator + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPanCoordinator_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetPanCoordinator(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool panCoordinator; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetPanCoordinator_CmdId; + + gpMacDispatcher_GetPanCoordinator_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetPanCoordinator_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetPanCoordinator_Output_buf2par( + &panCoordinator + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return panCoordinator; +} + +void gpMacDispatcher_SetMinBE(UInt8 minBE, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMinBE_CmdId; + + gpMacDispatcher_SetMinBE_Input_par2buf(dataBuf + , minBE + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMinBE_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMinBE(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 minBE; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMinBE_CmdId; + + gpMacDispatcher_GetMinBE_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMinBE_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMinBE_Output_buf2par( + &minBE + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return minBE; +} + +void gpMacDispatcher_SetIndicateBeaconNotifications(Bool enable, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetIndicateBeaconNotifications_CmdId; + + gpMacDispatcher_SetIndicateBeaconNotifications_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetIndicateBeaconNotifications_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetIndicateBeaconNotifications(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetIndicateBeaconNotifications_CmdId; + + gpMacDispatcher_GetIndicateBeaconNotifications_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetIndicateBeaconNotifications_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetIndicateBeaconNotifications_Output_buf2par( + &enable + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return enable; +} + +void gpMacDispatcher_SetMacVersion(gpMacCore_MacVersion_t macVersion, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMacVersion_CmdId; + + gpMacDispatcher_SetMacVersion_Input_par2buf(dataBuf + , macVersion + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMacVersion_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_MacVersion_t gpMacDispatcher_GetMacVersion(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_MacVersion_t macVersion; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMacVersion_CmdId; + + gpMacDispatcher_GetMacVersion_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMacVersion_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMacVersion_Output_buf2par( + &macVersion + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return macVersion; +} + +void gpMacDispatcher_SetForwardPollIndications(Bool enable, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetForwardPollIndications_CmdId; + + gpMacDispatcher_SetForwardPollIndications_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetForwardPollIndications_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetForwardPollIndications(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetForwardPollIndications_CmdId; + + gpMacDispatcher_GetForwardPollIndications_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetForwardPollIndications_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetForwardPollIndications_Output_buf2par( + &enable + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return enable; +} + +gpMacCore_Result_t gpMacDispatcher_DataPending_QueueAdd(gpMacCore_AddressInfo_t* pAddrInfo, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_DataPending_QueueAdd_CmdId; + + gpMacDispatcher_DataPending_QueueAdd_Input_par2buf(dataBuf + , pAddrInfo + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_DataPending_QueueAdd_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_DataPending_QueueAdd_Output_buf2par( + &result + , pAddrInfo + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_DataPending_QueueRemove(gpMacCore_AddressInfo_t* pAddrInfo, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_DataPending_QueueRemove_CmdId; + + gpMacDispatcher_DataPending_QueueRemove_Input_par2buf(dataBuf + , pAddrInfo + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_DataPending_QueueRemove_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_DataPending_QueueRemove_Output_buf2par( + &result + , pAddrInfo + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetMinInterferenceLevels(Int8* pInterferenceLevels) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMinInterferenceLevels_CmdId; + + gpMacDispatcher_SetMinInterferenceLevels_Input_par2buf(dataBuf + , pInterferenceLevels + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMinInterferenceLevels_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetMaxBE(UInt8 maxBE, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMaxBE_CmdId; + + gpMacDispatcher_SetMaxBE_Input_par2buf(dataBuf + , maxBE + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMaxBE_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMaxBE(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 maxBE; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMaxBE_CmdId; + + gpMacDispatcher_GetMaxBE_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMaxBE_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMaxBE_Output_buf2par( + &maxBE + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return maxBE; +} + +gpMacCore_Result_t gpMacDispatcher_SetDeviceDescriptor(gpMacCore_DeviceDescriptor_t* pDeviceDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDeviceDescriptor_CmdId; + + gpMacDispatcher_SetDeviceDescriptor_Input_par2buf(dataBuf + , pDeviceDescriptor + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDeviceDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_SetDeviceDescriptor_Output_buf2par( + &result + , pDeviceDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_GetDeviceDescriptor(gpMacCore_DeviceDescriptor_t* pDeviceDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetDeviceDescriptor_CmdId; + + gpMacDispatcher_GetDeviceDescriptor_Input_par2buf(dataBuf + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetDeviceDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetDeviceDescriptor_Output_buf2par( + &result + , pDeviceDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetDeviceTableEntries(gpMacCore_DeviceTablesEntries_t deviceTableEntries, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDeviceTableEntries_CmdId; + + gpMacDispatcher_SetDeviceTableEntries_Input_par2buf(dataBuf + , deviceTableEntries + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDeviceTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_DeviceTablesEntries_t gpMacDispatcher_GetDeviceTableEntries(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_DeviceTablesEntries_t deviceTableEntries; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetDeviceTableEntries_CmdId; + + gpMacDispatcher_GetDeviceTableEntries_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetDeviceTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetDeviceTableEntries_Output_buf2par( + &deviceTableEntries + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return deviceTableEntries; +} + +gpMacCore_Result_t gpMacDispatcher_SetKeyDescriptor(gpMacCore_KeyDescriptor_t* pKeyDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS*(9 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS*((2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS*(1 + 1) + 1 + 16) + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetKeyDescriptor_CmdId; + + gpMacDispatcher_SetKeyDescriptor_Input_par2buf(dataBuf + , pKeyDescriptor + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetKeyDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_SetKeyDescriptor_Output_buf2par( + &result + , pKeyDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_GetKeyDescriptor(gpMacCore_KeyDescriptor_t* pKeyDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetKeyDescriptor_CmdId; + + gpMacDispatcher_GetKeyDescriptor_Input_par2buf(dataBuf + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetKeyDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetKeyDescriptor_Output_buf2par( + &result + , pKeyDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetKeyTableEntries(gpMacCore_KeyTablesEntries_t keyTableEntries, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetKeyTableEntries_CmdId; + + gpMacDispatcher_SetKeyTableEntries_Input_par2buf(dataBuf + , keyTableEntries + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetKeyTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_Result_t gpMacDispatcher_SetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (1 + 1 + 1 + 1) + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetSecurityLevelDescriptor_CmdId; + + gpMacDispatcher_SetSecurityLevelDescriptor_Input_par2buf(dataBuf + , pSecurityLevelDescriptor + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetSecurityLevelDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_SetSecurityLevelDescriptor_Output_buf2par( + &result + , pSecurityLevelDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_GetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetSecurityLevelDescriptor_CmdId; + + gpMacDispatcher_GetSecurityLevelDescriptor_Input_par2buf(dataBuf + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetSecurityLevelDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetSecurityLevelDescriptor_Output_buf2par( + &result + , pSecurityLevelDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetSecurityLevelTableEntries(gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetSecurityLevelTableEntries_CmdId; + + gpMacDispatcher_SetSecurityLevelTableEntries_Input_par2buf(dataBuf + , securityLevelTableEntries + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetSecurityLevelTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_SecurityLevelTableEntries_t gpMacDispatcher_GetSecurityLevelTableEntries(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetSecurityLevelTableEntries_CmdId; + + gpMacDispatcher_GetSecurityLevelTableEntries_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetSecurityLevelTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetSecurityLevelTableEntries_Output_buf2par( + &securityLevelTableEntries + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return securityLevelTableEntries; +} + +void gpMacDispatcher_SetDefaultKeySource(UInt8* pDefaultKeySource, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDefaultKeySource_CmdId; + + gpMacDispatcher_SetDefaultKeySource_Input_par2buf(dataBuf + , pDefaultKeySource + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDefaultKeySource_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetFrameCounter(UInt32 frameCounter, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 4*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetFrameCounter_CmdId; + + gpMacDispatcher_SetFrameCounter_Input_par2buf(dataBuf + , frameCounter + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetFrameCounter_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt32 gpMacDispatcher_GetFrameCounter(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt32 frameCounter; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetFrameCounter_CmdId; + + gpMacDispatcher_GetFrameCounter_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetFrameCounter_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetFrameCounter_Output_buf2par( + &frameCounter + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return frameCounter; +} + +void gpMacDispatcher_SetPanCoordShortAddress(UInt16 panCoordShortAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPanCoordShortAddress_CmdId; + + gpMacDispatcher_SetPanCoordShortAddress_Input_par2buf(dataBuf + , panCoordShortAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPanCoordShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetPanCoordExtendedAddress(MACAddress_t* pPanCoordExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPanCoordExtendedAddress_CmdId; + + gpMacDispatcher_SetPanCoordExtendedAddress_Input_par2buf(dataBuf + , pPanCoordExtendedAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPanCoordExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_GetPanCoordExtendedAddress(MACAddress_t* pPanCoordExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetPanCoordExtendedAddress_CmdId; + + gpMacDispatcher_GetPanCoordExtendedAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetPanCoordExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetPanCoordExtendedAddress_Output_buf2par( + pPanCoordExtendedAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId +} + +Bool gpMacDispatcher_AddNeighbour(gpMacCore_AddressInfo_t* pAddrInfo, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_AddNeighbour_CmdId; + + gpMacDispatcher_AddNeighbour_Input_par2buf(dataBuf + , pAddrInfo + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_AddNeighbour_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_AddNeighbour_Output_buf2par( + &result + , pAddrInfo + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +Bool gpMacDispatcher_RemoveNeighbour(gpMacCore_AddressInfo_t* pAddrInfo, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_RemoveNeighbour_CmdId; + + gpMacDispatcher_RemoveNeighbour_Input_par2buf(dataBuf + , pAddrInfo + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_RemoveNeighbour_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_RemoveNeighbour_Output_buf2par( + &result + , pAddrInfo + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_SetDataPendingMode(gpMacCore_DataPendingMode_t dataPendingMode, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDataPendingMode_CmdId; + + gpMacDispatcher_SetDataPendingMode_Input_par2buf(dataBuf + , dataPendingMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDataPendingMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_SetDataPendingMode_Output_buf2par( + &result + , dataPendingMode + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + + +void gpMacDispatcher_SetAddressModeOverrideForBeacons(UInt8 addressMode, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetAddressModeOverrideForBeacons_CmdId; + + gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_par2buf(dataBuf + , addressMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetAddressModeOverrideForBeacons_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_ClearNeighbours(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_ClearNeighbours_CmdId; + + gpMacDispatcher_ClearNeighbours_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_ClearNeighbours_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetCsmaMode(UInt8 csmaMode, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCsmaMode_CmdId; + + gpMacDispatcher_SetCsmaMode_Input_par2buf(dataBuf + , csmaMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCsmaMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetCsmaMode(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 csmaMode; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCsmaMode_CmdId; + + gpMacDispatcher_GetCsmaMode_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCsmaMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCsmaMode_Output_buf2par( + &csmaMode + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return csmaMode; +} + +gpMacCore_Result_t gpMacDispatcher_DataPending_QueueClear(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_DataPending_QueueClear_CmdId; + + gpMacDispatcher_DataPending_QueueClear_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_DataPending_QueueClear_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_DataPending_QueueClear_Output_buf2par( + &result + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + + + + + + + +void gpMacDispatcher_SetStackInRawMode(Bool rawModeEnabled, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetStackInRawMode_CmdId; + + gpMacDispatcher_SetStackInRawMode_Input_par2buf(dataBuf + , rawModeEnabled + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetStackInRawMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetStackInRawMode(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool rawModeEnabled; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetStackInRawMode_CmdId; + + gpMacDispatcher_GetStackInRawMode_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetStackInRawMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetStackInRawMode_Output_buf2par( + &rawModeEnabled + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return rawModeEnabled; +} + + + +void gpMacDispatcher_EnableEnhancedFramePending(Bool enableEnhancedFramePending, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_EnableEnhancedFramePending_CmdId; + + gpMacDispatcher_EnableEnhancedFramePending_Input_par2buf(dataBuf + , enableEnhancedFramePending + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_EnableEnhancedFramePending_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + + + + + +UInt32 gpMacDispatcher_GetCurrentTimeUs(void) +{ + UInt16 _index = 1; + UInt32 currentTime; + UInt8 dataBuf[1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCurrentTimeUs_CmdId; + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCurrentTimeUs_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCurrentTimeUs_Output_buf2par( + ¤tTime + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return currentTime; +} + +gpMacCore_Result_t gpMacDispatcher_ConfigureEnhAckProbing(UInt8 linkMetrics, MACAddress_t* pExtendedAddress, UInt16 shortAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1 + 8*1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_ConfigureEnhAckProbing_CmdId; + + gpMacDispatcher_ConfigureEnhAckProbing_Input_par2buf(dataBuf + , linkMetrics + , pExtendedAddress + , shortAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_ConfigureEnhAckProbing_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_ConfigureEnhAckProbing_Output_buf2par( + &result + , linkMetrics + , pExtendedAddress + , shortAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetRetransmitOnCcaFail(Bool enable, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetRetransmitOnCcaFail_CmdId; + + gpMacDispatcher_SetRetransmitOnCcaFail_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetRetransmitOnCcaFail_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetRetransmitOnCcaFail(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetRetransmitOnCcaFail_CmdId; + + gpMacDispatcher_GetRetransmitOnCcaFail_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetRetransmitOnCcaFail_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetRetransmitOnCcaFail_Output_buf2par( + &enable + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return enable; +} + +void gpMacDispatcher_SetRetransmitRandomBackoff(Bool enable, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetRetransmitRandomBackoff_CmdId; + + gpMacDispatcher_SetRetransmitRandomBackoff_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetRetransmitRandomBackoff_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetRetransmitRandomBackoff(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetRetransmitRandomBackoff_CmdId; + + gpMacDispatcher_GetRetransmitRandomBackoff_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetRetransmitRandomBackoff_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetRetransmitRandomBackoff_Output_buf2par( + &enable + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return enable; +} + +void gpMacDispatcher_SetMinBeRetransmit(UInt8 minBERetransmit, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMinBeRetransmit_CmdId; + + gpMacDispatcher_SetMinBeRetransmit_Input_par2buf(dataBuf + , minBERetransmit + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMinBeRetransmit_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMinBeRetransmit(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 minBERetransmit; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMinBeRetransmit_CmdId; + + gpMacDispatcher_GetMinBeRetransmit_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMinBeRetransmit_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMinBeRetransmit_Output_buf2par( + &minBERetransmit + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return minBERetransmit; +} + +void gpMacDispatcher_SetMaxBeRetransmit(UInt8 maxBERetransmit, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMaxBeRetransmit_CmdId; + + gpMacDispatcher_SetMaxBeRetransmit_Input_par2buf(dataBuf + , maxBERetransmit + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMaxBeRetransmit_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMaxBeRetransmit(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 maxBERetransmit; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMaxBeRetransmit_CmdId; + + gpMacDispatcher_GetMaxBeRetransmit_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMaxBeRetransmit_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMaxBeRetransmit_Output_buf2par( + &maxBERetransmit + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return maxBERetransmit; +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.c new file mode 100644 index 0000000..51397e3 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.c @@ -0,0 +1,283 @@ +/* + * Copyright (c) 2013-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +// +// Functions for invocation of MacDispatcher callbacks +// +// This file is included in gpMacDispatcher.c (normal stack or server side) +// and in gpMacDispatcher_clientWrapper.c (client side) +// and in utTbc_gpMacDispatcher.c (unit test) +// +// These functions forward the callback event via the public callback registration API. +// + +static void MacDispatcher_cbDataIndication(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 dsn, + gpMacCore_Security_t *pSecOptions, gpPd_Loh_t pdLoh, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->dataIndicationCallback) + { + pCallbacks->dataIndicationCallback(pSrcAddrInfo, pDstAddrInfo, dsn, pSecOptions, pdLoh, stackId); + } + else + { + // Callback is responsible for freeing pdHandle. + GP_LOG_PRINTF("WARNING: MacDispatcher_cbDataIndication has no handler registered", 0); + gpPd_FreePd(pdLoh.handle); + } +} + +static void MacDispatcher_cbDataConfirm(gpMacCore_Result_t status, UInt8 pdHandle, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + // get data related callback. + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->dataConfirmCallback) + { + pCallbacks->dataConfirmCallback(status, pdHandle, stackId); + } + else + { + // Callback is responsible for freeing pdHandle. + if (pdHandle != GP_PD_INVALID_HANDLE) + { + gpPd_FreePd(pdHandle); + } + } +} +static void MacDispatcher_cbPollIndication(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->pollIndicationCallback) + { + pCallbacks->pollIndicationCallback(pAddrInfo, rxTime, stackId); + } +} + +static void MacDispatcher_cbPollNotify(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpPd_Handle_t pdHandle, Bool fromNeighbour, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->pollNotifyCallback) + { + pCallbacks->pollNotifyCallback(pAddrInfo, rxTime, pdHandle, fromNeighbour, stackId); + } +} +static void MacDispatcher_cbPollConfirm(gpMacCore_Result_t status, gpMacCore_AddressInfo_t* pCoordAddrInfo, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->pollConfirmCallback) + { + pCallbacks->pollConfirmCallback(status, pCoordAddrInfo, txTime, stackId); + } +} +static void MacDispatcher_cbPurgeConfirm(gpMacCore_Result_t status, gpPd_Handle_t pdHandle, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->purgeConfirmCallback) + { + pCallbacks->purgeConfirmCallback(status, pdHandle, stackId); + } + else + { + if (status == gpMacCore_ResultSuccess) + { + // Callback is responsible for freeing pdHandle after succesful purge. + GP_ASSERT_DEV_INT(false); + if (pdHandle != GP_PD_INVALID_HANDLE) + { + gpPd_FreePd(pdHandle); + } + } + } +} +static void MacDispatcher_cbBeaconNotifyIndication(UInt8 bsn, gpMacCore_PanDescriptor_t* pPanDescriptor, UInt8 beaconPayloadLength , UInt8 *pBeaconPayload, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->beaconNotifyIndicationCallback) + { + pCallbacks->beaconNotifyIndicationCallback(bsn, pPanDescriptor, beaconPayloadLength , pBeaconPayload, stackId); + } +} +static void MacDispatcher_cbAssociateIndication(gpMacCore_Address_t* pDeviceAddress, UInt8 capabilityInformation, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->assocIndicationCallback) + { + pCallbacks->assocIndicationCallback(pDeviceAddress, capabilityInformation, rxTime, stackId); + } +} +static void MacDispatcher_cbAssociateConfirm(UInt16 assocShortAddress, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->assocConfirmCallback) + { + pCallbacks->assocConfirmCallback(assocShortAddress, status, txTime, stackId); + } +} + +static void MacDispatcher_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, UInt32 unscannedChannels, UInt8 resultListSize, UInt8* pEdScanResultList, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->scanConfirmCallback) + { + pCallbacks->scanConfirmCallback(status, scanType, unscannedChannels, resultListSize, pEdScanResultList, stackId); + } +} + +static void MacDispatcher_cbOrphanIndication(MACAddress_t* pOrphanAddress, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->orphanIndicationCallback) + { + pCallbacks->orphanIndicationCallback(pOrphanAddress, rxTime, stackId); + } +} + +static void MacDispatcher_cbSecurityFailureCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->securityFailureCommStatusIndicationCallback) + { + pCallbacks->securityFailureCommStatusIndicationCallback(pSrcAddrInfo, pDstAddrInfo, status, txTime, stackId); + } +} + +static void MacDispatcher_cbSecurityFrameCounterIndication(UInt32 frameCounter, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->securityFrameCounterIndicationCallback) + { + pCallbacks->securityFrameCounterIndicationCallback(frameCounter, stackId); + } +} +static void MacDispatcher_cbAssociateCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->associateCommStatusIndicationCallback) + { + pCallbacks->associateCommStatusIndicationCallback(pSrcAddrInfo, pDstAddrInfo, status, txTime, stackId); + } +} +static void MacDispatcher_cbOrphanCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->orphanCommStatusIndicationCallback) + { + pCallbacks->orphanCommStatusIndicationCallback(pSrcAddrInfo, pDstAddrInfo, status, txTime, stackId); + } +} +void MacDispatcher_cbDriverResetIndication(gpMacDispatcher_Result_t status, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->driverResetIndicationCallback) + { + if(status == gpMacDispatcher_ResultSecondStackRegistered) + { + GP_LOG_SYSTEM_PRINTF("ERROR: Second stack with same ID was registered",0); + } + else + { + GP_LOG_SYSTEM_PRINTF("Driver reset Ind %u %x",0, stackId, status); + } + pCallbacks->driverResetIndicationCallback(status, stackId); + } +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.h new file mode 100644 index 0000000..f4d861e --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#ifndef _GP_MACDISPATCHERCALLBACKS_H_ +#define _GP_MACDISPATCHERCALLBACKS_H_ + +#include "global.h" +#include "gpMacCore.h" +#include "gpMacDispatcher.h" + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +//Data callbacks + +static void MacDispatcher_cbDataIndication(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 dsn, + gpMacCore_Security_t *pSecOptions, gpPd_Loh_t pdLoh, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbDataConfirm(gpMacCore_Result_t status, UInt8 pdHandle, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbPurgeConfirm(gpMacCore_Result_t status, gpPd_Handle_t pdHandle, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbPollNotify(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpPd_Handle_t pdHandle, Bool fromNeighbour, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbPollIndication(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbPollConfirm(gpMacCore_Result_t status, gpMacCore_AddressInfo_t* pCoordAddrInfo, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); + +//Misc callbacks +static void MacDispatcher_cbBeaconNotifyIndication(UInt8 bsn, gpMacCore_PanDescriptor_t* pPanDescriptor, UInt8 beaconPayloadLength , UInt8 *pBeaconPayload, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbAssociateIndication(gpMacCore_Address_t* pDeviceAddress, UInt8 capabilityInformation, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbAssociateCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbOrphanIndication(MACAddress_t* pOrphanAddress, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbAssociateConfirm(UInt16 assocShortAddress, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbOrphanCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, UInt32 unscannedChannels, UInt8 resultListSize, UInt8* pEdScanResultList, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbSecurityFailureCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbSecurityFrameCounterIndication(UInt32 frameCounter, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbDriverResetIndication(gpMacDispatcher_Result_t status, gpMacDispatcher_StackId_t stackId); + +#endif //_GP_MACDISPATCHERCALLBACKS_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_def.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_def.h new file mode 100644 index 0000000..de16064 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_def.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#ifndef _GP_MACDISPATCHERDEF_H_ +#define _GP_MACDISPATCHERDEF_H_ + +#include "global.h" +#include "gpMacCore.h" +#include "gpMacDispatcher.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct gpMacDispatcher_StackMapping_s { + gpMacDispatcher_StringIdentifier_t stringId; + gpMacDispatcher_StackId_t numericId; + gpMacDispatcher_Callbacks_t callbacks; +} gpMacDispatcher_StackMapping_t; + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Internal non-static declarations + *****************************************************************************/ +extern gpMacDispatcher_StackMapping_t gpMacDispatcher_StackMapping[GP_DIVERSITY_NR_OF_STACKS]; + +#if GP_DIVERSITY_NR_OF_STACKS > 1 +gpMacDispatcher_Callbacks_t* MacDispatcher_GetCallbacks(UInt8 stackId); +#else +#define MacDispatcher_GetCallbacks(stackId) (&gpMacDispatcher_StackMapping[0].callbacks) +#endif //GP_DIVERSITY_NR_OF_STACKS > 1 + +void MacDispatcher_InitStackMapping(void); +void MacDispatcher_UnRegisterCallbacks(UInt8 stackId); + +#define MacDispatcher_InitAutoTxAntennaToggling(stackId) ((void)0) +#define MacDispatcher_HandleAutoTxAntennaToggling(status, stackId) ((void)0) + +#endif //_GP_MACDISPATCHERDEF_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c new file mode 100644 index 0000000..88516ae --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACDISPATCHER + +//Show all calls for debugging +//#define GP_LOCAL_LOG + +#include "gpMacCore.h" +#include "gpMacDispatcher.h" +#include "gpMacDispatcher_def.h" +#include "gpLog.h" +#include "gpAssert.h" + +#ifndef GP_DIVERSITY_NR_OF_STACKS +#warning You did not provide a number of stacks. Taking 1 as default + +#define GP_DIVERSITY_NR_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +gpMacDispatcher_StackMapping_t gpMacDispatcher_StackMapping[GP_DIVERSITY_NR_OF_STACKS]; + +void MacDispatcher_InitStackMapping(void) +{ + UIntLoop stackMapIndex; + for(stackMapIndex = 0; stackMapIndex < GP_DIVERSITY_NR_OF_STACKS; stackMapIndex++) + { + // code shared with unregisterNetworkStack + gpMacDispatcher_StackMapping[stackMapIndex].numericId = GP_MAC_DISPATCHER_INVALID_STACK_ID; + MEMSET(gpMacDispatcher_StackMapping[stackMapIndex].stringId.str, -1, sizeof(gpMacDispatcher_StringIdentifier_t)); + } +} + +void gpMacDispatcher_RegisterCallbacks(gpMacDispatcher_StackId_t stackId, gpMacDispatcher_Callbacks_t* pCallbacks) +{ + UIntLoop stackMapIndex; + + GP_ASSERT_DEV_EXT(pCallbacks); + for(stackMapIndex = 0; stackMapIndex < GP_DIVERSITY_NR_OF_STACKS; stackMapIndex++) + { + // find entry previously used by the same stackId. + if(gpMacDispatcher_StackMapping[stackMapIndex].numericId == stackId) + { + MEMCPY(&gpMacDispatcher_StackMapping[stackMapIndex].callbacks,pCallbacks,sizeof(gpMacDispatcher_Callbacks_t)); + return; + } + } + for(stackMapIndex = 0; stackMapIndex < GP_DIVERSITY_NR_OF_STACKS; stackMapIndex++) + { + // find empty entry. + if(gpMacDispatcher_StackMapping[stackMapIndex].numericId == GP_MAC_DISPATCHER_INVALID_STACK_ID) + { + gpMacDispatcher_StackMapping[stackMapIndex].numericId = stackId; + MEMCPY(&gpMacDispatcher_StackMapping[stackMapIndex].callbacks,pCallbacks,sizeof(gpMacDispatcher_Callbacks_t)); + return; + } + } + GP_ASSERT_DEV_INT(false); + return; +} + +void gpMacDispatcher_GetCallbacks(gpMacDispatcher_StackId_t stackId, gpMacDispatcher_Callbacks_t* pCallbacks) +{ + gpMacDispatcher_Callbacks_t* pLookupCallbacks; + + if(pCallbacks == NULL) + { + GP_ASSERT_DEV_EXT(false); + return; + } + + pLookupCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pLookupCallbacks == NULL) + { + GP_ASSERT_DEV_INT(false); + return; + } + + MEMCPY(pCallbacks, pLookupCallbacks, sizeof(gpMacDispatcher_Callbacks_t)); +} + +void MacDispatcher_UnRegisterCallbacks(UInt8 stackId) +{ + UIntLoop i; + + for(i = 0; i < GP_DIVERSITY_NR_OF_STACKS; i++) + { + if(gpMacDispatcher_StackMapping[i].numericId == stackId) + { + gpMacDispatcher_StackMapping[i].numericId = GP_MAC_DISPATCHER_INVALID_STACK_ID; + MEMSET(gpMacDispatcher_StackMapping[i].stringId.str, -1, sizeof(gpMacDispatcher_StringIdentifier_t)); + return; + } + } + GP_ASSERT_DEV_INT(false); +} + +#if GP_DIVERSITY_NR_OF_STACKS > 1 +gpMacDispatcher_Callbacks_t* MacDispatcher_GetCallbacks(UInt8 stackId) +{ + UIntLoop stackMapIndex; + for(stackMapIndex = 0; stackMapIndex < GP_DIVERSITY_NR_OF_STACKS; stackMapIndex++) + { + // find entry previously used by the same stackId. + if(gpMacDispatcher_StackMapping[stackMapIndex].numericId == stackId) + { + return &(gpMacDispatcher_StackMapping[stackMapIndex].callbacks); + } + } + // no entry found. + return NULL; +} +#endif //GP_DIVERSITY_NR_OF_STACKS > 1 diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_clientServerCmdId.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_clientServerCmdId.h new file mode 100644 index 0000000..365e424 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_clientServerCmdId.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRxArbiter_clientServerCmdId.h" + * + * RxArbiter + * + * Client Server Link Command IDs +*/ + +#ifndef _GPRXARBITER_CLIENTSERVERCMDID_H_ +#define _GPRXARBITER_CLIENTSERVERCMDID_H_ + +/***************************************************************************** + * Common timeout + *****************************************************************************/ + +#ifndef GPRXARBITER_GPCOMTIMEOUT_US +#define GPRXARBITER_GPCOMTIMEOUT_US 10000000UL //10s +#endif //GPRXARBITER_GPCOMTIMEOUT_US + +/***************************************************************************** + * Component Specific Command IDs + *****************************************************************************/ + +#define gpRxArbiter_ResetStack_CmdId 0x02 /*02*/ +#define gpRxArbiter_SetStackChannel_CmdId 0x03 /*03*/ +#define gpRxArbiter_GetStackChannel_CmdId 0x04 /*04*/ +#define gpRxArbiter_GetCurrentRxOnState_CmdId 0x05 /*05*/ +#define gpRxArbiter_GetCurrentRxChannel_CmdId 0x06 /*06*/ +#define gpRxArbiter_SetStackRxOn_CmdId 0x07 /*07*/ +#define gpRxArbiter_GetStackRxOn_CmdId 0x08 /*08*/ +#define gpRxArbiter_SetDutyCycleOnOffTimes_CmdId 0x09 /*09*/ +#define gpRxArbiter_EnableDutyCycling_CmdId 0x0a /*10*/ +#define gpRxArbiter_GetDutyCycleEnabled_CmdId 0x0b /*11*/ +#define gpRxArbiter_SetStackPriority_CmdId 0x0c /*12*/ +#define gpRxArbiter_IsAnActiveChannel_CmdId 0x11 /*17*/ +#define gpRxArbiter_EnableRxWindows_CmdId 0x12 /*18*/ +#define gpRxArbiter_DisableRxWindows_CmdId 0x13 /*19*/ +#define gpRxArbiter_cbSetFaModeNotification_CmdId 0x0e /*14*/ +#define gpRxArbiter_cbChannelUpdateNotification_CmdId 0x10 /*16*/ + +/***************************************************************************** + * Fixed Command IDs + *****************************************************************************/ + +#define gpRxArbiter_Acknowledge_CmdId 0xfe /*254*/ +#define gpRxArbiter_GetServerCompatibilityNumber_CmdId 0xfd /*253*/ + +#endif //_GPRXARBITER_CLIENTSERVERCMDID_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_marshalling.h new file mode 100644 index 0000000..b4d6c29 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_marshalling.h @@ -0,0 +1,428 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPRXARBITER_MARSHALLING_H_ +#define _GPRXARBITER_MARSHALLING_H_ + +//DOCUMENTATION RXARBITER: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpRxArbiter.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +typedef struct { + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_ResetStack_Input_struct_t; + +typedef struct { + gpRxArbiter_ResetStack_Input_struct_t data; +} gpRxArbiter_ResetStack_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_ResetStack_Output_struct_t; + +typedef struct { + gpRxArbiter_ResetStack_Output_struct_t data; +} gpRxArbiter_ResetStack_Output_marshall_struct_t; + + +typedef struct { + UInt8 channel; + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_SetStackChannel_Input_struct_t; + +typedef struct { + gpRxArbiter_SetStackChannel_Input_struct_t data; +} gpRxArbiter_SetStackChannel_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_SetStackChannel_Output_struct_t; + +typedef struct { + gpRxArbiter_SetStackChannel_Output_struct_t data; +} gpRxArbiter_SetStackChannel_Output_marshall_struct_t; + + +typedef struct { + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_GetStackChannel_Input_struct_t; + +typedef struct { + gpRxArbiter_GetStackChannel_Input_struct_t data; +} gpRxArbiter_GetStackChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 channel; +} gpRxArbiter_GetStackChannel_Output_struct_t; + +typedef struct { + gpRxArbiter_GetStackChannel_Output_struct_t data; +} gpRxArbiter_GetStackChannel_Output_marshall_struct_t; + + +typedef struct { + Bool rxon; +} gpRxArbiter_GetCurrentRxOnState_Output_struct_t; + +typedef struct { + gpRxArbiter_GetCurrentRxOnState_Output_struct_t data; +} gpRxArbiter_GetCurrentRxOnState_Output_marshall_struct_t; + + +typedef struct { + UInt8 currentChannel; +} gpRxArbiter_GetCurrentRxChannel_Output_struct_t; + +typedef struct { + gpRxArbiter_GetCurrentRxChannel_Output_struct_t data; +} gpRxArbiter_GetCurrentRxChannel_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_SetStackRxOn_Input_struct_t; + +typedef struct { + gpRxArbiter_SetStackRxOn_Input_struct_t data; +} gpRxArbiter_SetStackRxOn_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_SetStackRxOn_Output_struct_t; + +typedef struct { + gpRxArbiter_SetStackRxOn_Output_struct_t data; +} gpRxArbiter_SetStackRxOn_Output_marshall_struct_t; + + +typedef struct { + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_GetStackRxOn_Input_struct_t; + +typedef struct { + gpRxArbiter_GetStackRxOn_Input_struct_t data; +} gpRxArbiter_GetStackRxOn_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpRxArbiter_GetStackRxOn_Output_struct_t; + +typedef struct { + gpRxArbiter_GetStackRxOn_Output_struct_t data; +} gpRxArbiter_GetStackRxOn_Output_marshall_struct_t; + + + + +typedef struct { + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_GetDutyCycleEnabled_Input_struct_t; + +typedef struct { + gpRxArbiter_GetDutyCycleEnabled_Input_struct_t data; +} gpRxArbiter_GetDutyCycleEnabled_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpRxArbiter_GetDutyCycleEnabled_Output_struct_t; + +typedef struct { + gpRxArbiter_GetDutyCycleEnabled_Output_struct_t data; +} gpRxArbiter_GetDutyCycleEnabled_Output_marshall_struct_t; + + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +typedef struct { + UInt8 priority; + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_SetStackPriority_Input_struct_t; + +typedef struct { + gpRxArbiter_SetStackPriority_Input_struct_t data; +} gpRxArbiter_SetStackPriority_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_SetStackPriority_Output_struct_t; + +typedef struct { + gpRxArbiter_SetStackPriority_Output_struct_t data; +} gpRxArbiter_SetStackPriority_Output_marshall_struct_t; + +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +typedef struct { + gpRxArbiter_StackId_t stackId; + gpRxArbiter_cbSetFaMode_t callback; +} gpRxArbiter_RegisterSetFaModeCallback_Input_struct_t; + +typedef struct { + gpRxArbiter_RegisterSetFaModeCallback_Input_struct_t data; +} gpRxArbiter_RegisterSetFaModeCallback_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_RegisterSetFaModeCallback_Output_struct_t; + +typedef struct { + gpRxArbiter_RegisterSetFaModeCallback_Output_struct_t data; +} gpRxArbiter_RegisterSetFaModeCallback_Output_marshall_struct_t; + +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +typedef struct { + gpRxArbiter_StackId_t stackId; + gpRxArbiter_cbChannelUpdate_t callback; +} gpRxArbiter_RegisterChannelUpdateCallback_Input_struct_t; + +typedef struct { + gpRxArbiter_RegisterChannelUpdateCallback_Input_struct_t data; +} gpRxArbiter_RegisterChannelUpdateCallback_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_RegisterChannelUpdateCallback_Output_struct_t; + +typedef struct { + gpRxArbiter_RegisterChannelUpdateCallback_Output_struct_t data; +} gpRxArbiter_RegisterChannelUpdateCallback_Output_marshall_struct_t; + +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +typedef struct { + gpRxArbiter_StackId_t stackId; + UInt8 channel; +} gpRxArbiter_IsAnActiveChannel_Input_struct_t; + +typedef struct { + gpRxArbiter_IsAnActiveChannel_Input_struct_t data; +} gpRxArbiter_IsAnActiveChannel_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpRxArbiter_IsAnActiveChannel_Output_struct_t; + +typedef struct { + gpRxArbiter_IsAnActiveChannel_Output_struct_t data; +} gpRxArbiter_IsAnActiveChannel_Output_marshall_struct_t; + + + + +typedef struct { + gpRxArbiter_StackId_t stackId; + gpRxArbiter_FaMode_t mode; +} gpRxArbiter_cbSetFaModeNotification_Input_struct_t; + +typedef struct { + gpRxArbiter_cbSetFaModeNotification_Input_struct_t data; +} gpRxArbiter_cbSetFaModeNotification_Input_marshall_struct_t; + + +typedef struct { + gpRxArbiter_StackId_t stackId; + UInt8 channel; +} gpRxArbiter_cbChannelUpdateNotification_Input_struct_t; + +typedef struct { + gpRxArbiter_cbChannelUpdateNotification_Input_struct_t data; +} gpRxArbiter_cbChannelUpdateNotification_Input_marshall_struct_t; + + +typedef union { + gpRxArbiter_ResetStack_Input_marshall_struct_t gpRxArbiter_ResetStack; + gpRxArbiter_SetStackChannel_Input_marshall_struct_t gpRxArbiter_SetStackChannel; + gpRxArbiter_GetStackChannel_Input_marshall_struct_t gpRxArbiter_GetStackChannel; + gpRxArbiter_SetStackRxOn_Input_marshall_struct_t gpRxArbiter_SetStackRxOn; + gpRxArbiter_GetStackRxOn_Input_marshall_struct_t gpRxArbiter_GetStackRxOn; + gpRxArbiter_GetDutyCycleEnabled_Input_marshall_struct_t gpRxArbiter_GetDutyCycleEnabled; +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_SetStackPriority_Input_marshall_struct_t gpRxArbiter_SetStackPriority; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_RegisterSetFaModeCallback_Input_marshall_struct_t gpRxArbiter_RegisterSetFaModeCallback; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_RegisterChannelUpdateCallback_Input_marshall_struct_t gpRxArbiter_RegisterChannelUpdateCallback; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + gpRxArbiter_IsAnActiveChannel_Input_marshall_struct_t gpRxArbiter_IsAnActiveChannel; + UInt8 dummy; //ensure none empty union definition +} gpRxArbiter_Server_Input_union_t; + +typedef union { + gpRxArbiter_ResetStack_Output_marshall_struct_t gpRxArbiter_ResetStack; + gpRxArbiter_SetStackChannel_Output_marshall_struct_t gpRxArbiter_SetStackChannel; + gpRxArbiter_GetStackChannel_Output_marshall_struct_t gpRxArbiter_GetStackChannel; + gpRxArbiter_GetCurrentRxOnState_Output_marshall_struct_t gpRxArbiter_GetCurrentRxOnState; + gpRxArbiter_GetCurrentRxChannel_Output_marshall_struct_t gpRxArbiter_GetCurrentRxChannel; + gpRxArbiter_SetStackRxOn_Output_marshall_struct_t gpRxArbiter_SetStackRxOn; + gpRxArbiter_GetStackRxOn_Output_marshall_struct_t gpRxArbiter_GetStackRxOn; + gpRxArbiter_GetDutyCycleEnabled_Output_marshall_struct_t gpRxArbiter_GetDutyCycleEnabled; +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_SetStackPriority_Output_marshall_struct_t gpRxArbiter_SetStackPriority; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_RegisterSetFaModeCallback_Output_marshall_struct_t gpRxArbiter_RegisterSetFaModeCallback; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_RegisterChannelUpdateCallback_Output_marshall_struct_t gpRxArbiter_RegisterChannelUpdateCallback; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + gpRxArbiter_IsAnActiveChannel_Output_marshall_struct_t gpRxArbiter_IsAnActiveChannel; + UInt8 dummy; //ensure none empty union definition +} gpRxArbiter_Server_Output_union_t; + +typedef union { + gpRxArbiter_cbSetFaModeNotification_Input_marshall_struct_t gpRxArbiter_cbSetFaModeNotification; + gpRxArbiter_cbChannelUpdateNotification_Input_marshall_struct_t gpRxArbiter_cbChannelUpdateNotification; + UInt8 dummy; //ensure none empty union definition +} gpRxArbiter_Client_Input_union_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpRxArbiter_StackId_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_StackId_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_StackId_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_StackId_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpRxArbiter_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpRxArbiter_FaMode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_FaMode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_FaMode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_FaMode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpRxArbiter_cbChannelUpdate_t_buf2api(pDest, pSource, length, pIndex) void_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_cbChannelUpdate_t_api2buf(pDest, pSource, length, pIndex) void_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_cbChannelUpdate_t_buf2api_1(pDest, pSource, pIndex) void_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_cbChannelUpdate_t_api2buf_1(pDest, pSource, pIndex) void_api2buf_1(pDest, pSource, pIndex) +#define gpRxArbiter_cbSetFaMode_t_buf2api(pDest, pSource, length, pIndex) void_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_cbSetFaMode_t_api2buf(pDest, pSource, length, pIndex) void_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_cbSetFaMode_t_buf2api_1(pDest, pSource, pIndex) void_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_cbSetFaMode_t_api2buf_1(pDest, pSource, pIndex) void_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +// Server functions +gpMarshall_AckStatus_t gpRxArbiter_ResetStack_Input_buf2api(gpRxArbiter_ResetStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_ResetStack_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_ResetStack_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_ResetStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_SetStackChannel_Input_buf2api(gpRxArbiter_SetStackChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackChannel_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_SetStackChannel_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_SetStackChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_GetStackChannel_Input_buf2api(gpRxArbiter_GetStackChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetStackChannel_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetStackChannel_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_GetStackChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpRxArbiter_GetCurrentRxOnState_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetCurrentRxOnState_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +void gpRxArbiter_GetCurrentRxChannel_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetCurrentRxChannel_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_SetStackRxOn_Input_buf2api(gpRxArbiter_SetStackRxOn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackRxOn_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_SetStackRxOn_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_SetStackRxOn_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_GetStackRxOn_Input_buf2api(gpRxArbiter_GetStackRxOn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetStackRxOn_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetStackRxOn_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_GetStackRxOn_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_GetDutyCycleEnabled_Input_buf2api(gpRxArbiter_GetDutyCycleEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetDutyCycleEnabled_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetDutyCycleEnabled_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_GetDutyCycleEnabled_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +gpMarshall_AckStatus_t gpRxArbiter_SetStackPriority_Input_buf2api(gpRxArbiter_SetStackPriority_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackPriority_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_SetStackPriority_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_SetStackPriority_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +gpMarshall_AckStatus_t gpRxArbiter_RegisterSetFaModeCallback_Input_buf2api(gpRxArbiter_RegisterSetFaModeCallback_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_RegisterSetFaModeCallback_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_RegisterSetFaModeCallback_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_RegisterSetFaModeCallback_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +gpMarshall_AckStatus_t gpRxArbiter_RegisterChannelUpdateCallback_Input_buf2api(gpRxArbiter_RegisterChannelUpdateCallback_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_RegisterChannelUpdateCallback_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_RegisterChannelUpdateCallback_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_RegisterChannelUpdateCallback_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +gpMarshall_AckStatus_t gpRxArbiter_IsAnActiveChannel_Input_buf2api(gpRxArbiter_IsAnActiveChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_IsAnActiveChannel_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_IsAnActiveChannel_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_IsAnActiveChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpRxArbiter_cbSetFaModeNotification_Input_par2api(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , gpRxArbiter_FaMode_t mode , UInt16* pIndex); +void gpRxArbiter_cbChannelUpdateNotification_Input_par2api(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt16* pIndex); + +// Client functions +void gpRxArbiter_ResetStack_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_ResetStack_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_SetStackChannel_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 channel , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetStackChannel_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_GetStackChannel_Output_buf2par(UInt8* channel , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetCurrentRxOnState_Output_buf2par(Bool* rxon , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetCurrentRxChannel_Output_buf2par(UInt8* currentChannel , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackRxOn_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_SetStackRxOn_Output_buf2par(gpRxArbiter_Result_t* result , Bool enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetStackRxOn_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_GetStackRxOn_Output_buf2par(Bool* enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetDutyCycleEnabled_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_GetDutyCycleEnabled_Output_buf2par(Bool* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_SetStackPriority_Input_par2buf(UInt8Buffer* pDest , UInt8 priority , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_SetStackPriority_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 priority , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_RegisterSetFaModeCallback_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , gpRxArbiter_cbSetFaMode_t callback , UInt16* pIndex); +void gpRxArbiter_RegisterSetFaModeCallback_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , gpRxArbiter_cbSetFaMode_t callback , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_RegisterChannelUpdateCallback_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , gpRxArbiter_cbChannelUpdate_t callback , UInt16* pIndex); +void gpRxArbiter_RegisterChannelUpdateCallback_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , gpRxArbiter_cbChannelUpdate_t callback , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +void gpRxArbiter_IsAnActiveChannel_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt16* pIndex); +void gpRxArbiter_IsAnActiveChannel_Output_buf2par(Bool* result , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_cbSetFaModeNotification_Input_buf2api(gpRxArbiter_cbSetFaModeNotification_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_cbChannelUpdateNotification_Input_buf2api(gpRxArbiter_cbChannelUpdateNotification_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); + +void gpRxArbiter_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPRXARBITER_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gpRxArbiter.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gpRxArbiter.h new file mode 100644 index 0000000..62d44d8 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gpRxArbiter.h @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpRxArbiter.h + * This file contains the definitions of the public functions and enumerations of the gpRxArbiter. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GP_RX_ARBITER_H_ +#define _GP_RX_ARBITER_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "global.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifdef GP_DIVERSITY_NR_OF_STACKS +#define GP_RX_ARBITER_NUMBER_OF_STACKS GP_DIVERSITY_NR_OF_STACKS +#else//GP_DIVERSITY_NR_OF_STACKS +#define GP_RX_ARBITER_NUMBER_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS + +#define GP_RX_ARBITER_INVALID_CHANNEL 0xFF + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +#define GP_RXARBITER_CHECK_CHANNEL_VALID(channel) (((channel) >= 11) && ((channel) <= 26)) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @name gpRxArbiter_FaMode_t*/ +//@{ +/** @ingroup GEN_FA + * @brief The frequency agility is disabled. +*/ +#define gpRxArbiter_FaModeDisabled 0x00 +/** @ingroup GEN_FA + * @brief The frequency agility is enabled. +*/ +#define gpRxArbiter_FaModeEnabled 0x01 +/** @ingroup GEN_FA + * @brief The frequency agility is running in power save mode. +*/ +typedef UInt8 gpRxArbiter_FaMode_t ; +//@} + +typedef UInt8 gpRxArbiter_StackId_t; +#define gpRxArbiter_StackIdRf4ce 0x0 +#define gpRxArbiter_StackIdZigBeePro 0x1 +#define gpRxArbiter_StackIdZigBeeIp 0x2 +#define gpRxArbiter_StackIdInvalid 0xFF + +typedef UInt8 gpRxArbiter_Result_t; +#define gpRxArbiter_ResultSuccess 0x0 +#define gpRxArbiter_ResultInvalidArgument 0x1 + +typedef UInt8 gpRxArbiter_RadioState_t; +#define gpRxArbiter_RadioStateOff 0 +#define gpRxArbiter_RadioStateOn 1 +#define gpRxArbiter_RadioStateDutyCycle 2 +#define gpRxArbiter_RadioStateInvalid 0xff +#define gpRxArbiter_RadioStateActive(state) (state==gpRxArbiter_RadioStateOn || state==gpRxArbiter_RadioStateDutyCycle) + +typedef void (* gpRxArbiter_cbSetFaMode_t)(gpRxArbiter_StackId_t stackId, gpRxArbiter_FaMode_t mode) ; +typedef void (* gpRxArbiter_cbChannelUpdate_t)(gpRxArbiter_StackId_t stackId, UInt8 channel) ; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpRxArbiter_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +void gpRxArbiter_Init( void ); +void gpRxArbiter_DeInit( void ); + +//Added for enabling 3 Rx channels for multichannel listen over MAC +gpRxArbiter_Result_t gpRxArbiter_SetMultipleChannelTable(UInt8* pChannel , gpRxArbiter_StackId_t stackId); +UInt8 gpRxArbiter_GetStackSlotChannel(UInt8 slotnumber , gpRxArbiter_StackId_t stackId); + +gpRxArbiter_Result_t gpRxArbiter_ResetStack( gpRxArbiter_StackId_t stackId ); +gpRxArbiter_Result_t gpRxArbiter_SetStackChannel( UInt8 channel , gpRxArbiter_StackId_t stackId ); +UInt8 gpRxArbiter_GetStackChannel( gpRxArbiter_StackId_t stackId ); +UInt8 gpRxArbiter_GetCurrentRxChannel( void ); + +gpRxArbiter_Result_t gpRxArbiter_SetStackRxOn( Bool enable , gpRxArbiter_StackId_t stackId ); +Bool gpRxArbiter_GetStackRxOn( gpRxArbiter_StackId_t stackId ); +gpRxArbiter_RadioState_t gpRxArbiter_GetCurrentRxOnState( void ); + +Bool gpRxArbiter_GetDutyCycleEnabled( gpRxArbiter_StackId_t stackId ); + + + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS == 1) && (!(defined(GP_DIVERSITY_JUMPTABLES))) +#define gpRxArbiter_SetStackPriority( priority , stackId ) (gpRxArbiter_ResultSuccess) + +#define gpRxArbiter_RegisterSetFaModeCallback( stackId, cb) (gpRxArbiter_ResultSuccess) +#define gpRxArbiter_RegisterChannelUpdateCallback( stackId, cb) (gpRxArbiter_ResultSuccess) +#define gpRxArbiter_DeRegisterChannelUpdateCallback( stackId ) (gpRxArbiter_ResultSuccess) + +#else + +gpRxArbiter_Result_t gpRxArbiter_SetStackPriority( UInt8 priority , gpRxArbiter_StackId_t stackId ); + +// register for notifications from gpRxArbiter +gpRxArbiter_Result_t gpRxArbiter_RegisterSetFaModeCallback(gpRxArbiter_StackId_t stackId, gpRxArbiter_cbSetFaMode_t cb) ; +gpRxArbiter_Result_t gpRxArbiter_RegisterChannelUpdateCallback(gpRxArbiter_StackId_t stackId, gpRxArbiter_cbChannelUpdate_t cb) ; +gpRxArbiter_Result_t gpRxArbiter_DeRegisterChannelUpdateCallback(gpRxArbiter_StackId_t stackId); + +#endif // #if GP_RX_ARBITER_NUMBER_OF_STACKS == 1 + +Bool gpRxArbiter_IsAnActiveChannel(gpRxArbiter_StackId_t stackId, UInt8 channel); + + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //_GP_RX_ARBITER_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c new file mode 100644 index 0000000..808ac9d --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRxArbiter_marshalling.c" + * + * RxArbiter + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpRxArbiter.h" +#include "gpRxArbiter_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_RXARBITER + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +void gpRxArbiter_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c new file mode 100644 index 0000000..4d7c6b4 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRxArbiter_marshalling_client.c" + * + * RxArbiter + * + * Marshalling structures and functions +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpRxArbiter.h" +#include "gpRxArbiter_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_RXARBITER + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpRxArbiter_ResetStack_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_ResetStack_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpRxArbiter_SetStackChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(channel), pIndex); + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_SetStackChannel_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 channel , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(channel); + NOT_USED(stackId); +} + +void gpRxArbiter_GetStackChannel_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_GetStackChannel_Output_buf2par(UInt8* channel , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(channel, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpRxArbiter_GetCurrentRxOnState_Output_buf2par(Bool* rxon , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(rxon, pSource, 1, pIndex); +} + +void gpRxArbiter_GetCurrentRxChannel_Output_buf2par(UInt8* currentChannel , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(currentChannel, pSource, 1, pIndex); +} + +void gpRxArbiter_SetStackRxOn_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_SetStackRxOn_Output_buf2par(gpRxArbiter_Result_t* result , Bool enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(enable); + NOT_USED(stackId); +} + +void gpRxArbiter_GetStackRxOn_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_GetStackRxOn_Output_buf2par(Bool* enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + + + + + +void gpRxArbiter_GetDutyCycleEnabled_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_GetDutyCycleEnabled_Output_buf2par(Bool* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_SetStackPriority_Input_par2buf(UInt8Buffer* pDest , UInt8 priority , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(priority), pIndex); + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_SetStackPriority_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 priority , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(priority); + NOT_USED(stackId); +} +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +void gpRxArbiter_IsAnActiveChannel_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); + UInt8_api2buf_1(pDest, &(channel), pIndex); +} + +void gpRxArbiter_IsAnActiveChannel_Output_buf2par(Bool* result , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); + NOT_USED(channel); +} + + + + + +gpMarshall_AckStatus_t gpRxArbiter_cbSetFaModeNotification_Input_buf2api(gpRxArbiter_cbSetFaModeNotification_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + gpRxArbiter_FaMode_t_buf2api(&(pDest->data.mode), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t gpRxArbiter_cbChannelUpdateNotification_Input_buf2api(gpRxArbiter_cbChannelUpdateNotification_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + UInt8_buf2api(&(pDest->data.channel), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c new file mode 100644 index 0000000..fda542c --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c @@ -0,0 +1,654 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRxArbiter_wrapper_client.c" + * + * RxArbiter + * + * Wrapper implementation +*/ + +/***************************************************************************** + * Includes Definition + *****************************************************************************/ + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpCom.h" +#include "gpModule.h" +#include "gpRxArbiter_clientServerCmdId.h" +#include "gpRxArbiter.h" +#include "gpRxArbiter_marshalling.h" +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +#include "gpVersion.h" +#endif + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Functions Declaration + *****************************************************************************/ + +static void gpRxArbiter_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId); +static void RxArbiter_HandleConnectionClose(gpCom_CommunicationId_t communicationId); + +/* AdditionalStaticFunctions */ +static void gpRxArbiter_cbSetFaModeNotification(gpRxArbiter_StackId_t stackId, gpRxArbiter_FaMode_t mode); +static void gpRxArbiter_cbChannelUpdateNotification(gpRxArbiter_StackId_t stackId, UInt8 channel); +/* AdditionalStaticFunctions */ +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_RXARBITER +#define GP_MODULE_ID GP_COMPONENT_ID + + +#ifndef GP_RXARBITER_COMM_ID +#define GP_RXARBITER_COMM_ID GP_COM_DEFAULT_COMMUNICATION_ID +#endif + +#define REGISTER_MODULE(handle) GP_COM_REGISTER_MODULE(handle) +#define DATA_REQUEST(len,buf,commId) GP_COM_DATA_REQUEST(len,buf,commId) +#define DATA_REQUEST_ACKED(len,buf,commId) gpCom_DataRequestAndWaitForAck(GP_MODULE_ID, len, buf, commId, &gpRxArbiter_reqAcked, GPRXARBITER_GPCOMTIMEOUT_US, gpRxArbiter_Acknowledge_CmdId) + +/***************************************************************************** + * Static Data + *****************************************************************************/ + +typedef union ackDataNeeded { + UInt8 dataBuf0[1]; +} ackDataNeeded_t; +static UInt8 gpRxArbiter_ackBuffer[1 + 1 + 1 + sizeof(ackDataNeeded_t)]; +static Bool gpRxArbiter_reqAcked; +/* AdditionalStaticData */ +static gpRxArbiter_cbSetFaMode_t gpRxArbiter_SetFaModeCallback ; +static gpRxArbiter_cbChannelUpdate_t gpRxArbiter_ChannelUpdateCallback ; +/* AdditionalStaticData */ + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +static Bool RxArbiter_clientApiVersionSelected = false; +#endif + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +/* AdditionalStaticFunctionDefinitions */ +void gpRxArbiter_cbSetFaModeNotification(gpRxArbiter_StackId_t stackId, gpRxArbiter_FaMode_t mode) +{ + if (gpRxArbiter_SetFaModeCallback) + { + gpRxArbiter_SetFaModeCallback(stackId, mode) ; + } +} + +void gpRxArbiter_cbChannelUpdateNotification(gpRxArbiter_StackId_t stackId, UInt8 channel) +{ + if (gpRxArbiter_ChannelUpdateCallback) + { + gpRxArbiter_ChannelUpdateCallback(stackId, channel) ; + } +} +/* AdditionalStaticFunctionDefinitions */ + +static void RxArbiter_HandleConnectionClose(gpCom_CommunicationId_t communicationId) +{ +/* ConnectionCloseFunction */ + /* Manual update */ + NOT_USED(communicationId); +/* ConnectionCloseFunction */ +} + +static void gpRxArbiter_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId) +{ +#define commandId pPayload[0] + gpMarshall_AckStatus_t marshall_result; + UInt16 _index = 1; + gpRxArbiter_Client_Input_union_t input; + UInt8 ackBuffer[1 + 1 + 1]; + UInt8 ackBytes = 0; /*No ack's on indication - fill in length when needed - 3+x */ + + if(pPayload == NULL) + { + RxArbiter_HandleConnectionClose(communicationId); + return; + } + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + + ackBuffer[0] = gpRxArbiter_Acknowledge_CmdId; + ackBuffer[1] = gpMarshall_AckStatusSuccess; + ackBuffer[2] = commandId; + + switch(commandId) + { + + case gpRxArbiter_cbSetFaModeNotification_CmdId: + { + marshall_result = gpRxArbiter_cbSetFaModeNotification_Input_buf2api(&(input.gpRxArbiter_cbSetFaModeNotification) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + + gpRxArbiter_cbSetFaModeNotification( + input.gpRxArbiter_cbSetFaModeNotification.data.stackId + , input.gpRxArbiter_cbSetFaModeNotification.data.mode + ); + + + break; + } + case gpRxArbiter_cbChannelUpdateNotification_CmdId: + { + marshall_result = gpRxArbiter_cbChannelUpdateNotification_Input_buf2api(&(input.gpRxArbiter_cbChannelUpdateNotification) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + + gpRxArbiter_cbChannelUpdateNotification( + input.gpRxArbiter_cbChannelUpdateNotification.data.stackId + , input.gpRxArbiter_cbChannelUpdateNotification.data.channel + ); + + + break; + } + case gpRxArbiter_Acknowledge_CmdId: + { + GP_ASSERT_SYSTEM(length <= sizeof(gpRxArbiter_ackBuffer)); + MEMCPY(gpRxArbiter_ackBuffer, pPayload, length); + gpRxArbiter_reqAcked = true; + return; + } + default: + { + GP_ASSERT_DEV_INT(false); + break; + } + } +#undef commandId + if(0 < ackBytes) + { + DATA_REQUEST(ackBytes, ackBuffer, communicationId); + } +} +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +/* AdditionalPublicFunctionDefinitions */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) // manual +gpRxArbiter_Result_t gpRxArbiter_RegisterSetFaModeCallback(gpRxArbiter_StackId_t stackId, gpRxArbiter_cbSetFaMode_t cb) +{ + /* Manual update */ + NOT_USED(stackId); + gpRxArbiter_Result_t result ; + + if (cb) + { + gpRxArbiter_SetFaModeCallback = cb ; + + result = gpRxArbiter_ResultSuccess ; + } + else + { + result = gpRxArbiter_ResultInvalidArgument ; + } + + return result ; +} + +gpRxArbiter_Result_t gpRxArbiter_RegisterChannelUpdateCallback(gpRxArbiter_StackId_t stackId, gpRxArbiter_cbChannelUpdate_t cb) +{ + /* Manual update */ + NOT_USED(stackId); + gpRxArbiter_Result_t result ; + + if (cb) + { + gpRxArbiter_ChannelUpdateCallback = cb ; + + result = gpRxArbiter_ResultSuccess ; + } + else + { + result = gpRxArbiter_ResultInvalidArgument ; + } + + return result ; +} +#endif // (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) // manual +/* AdditionalPublicFunctionDefinitions */ + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +void gpRxArbiter_SetDefaultApiVersion(gpVersion_ModuleVersionInfo_t* moduleVersionInfo) +{ + RxArbiter_clientApiVersionSelected = true; + //TBD +} +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + + +void gpRxArbiter_DeInit(void) +{ + gpCom_DeRegisterModule(GP_MODULE_ID); +} + +void gpRxArbiter_Init(void) +{ +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + gpVersion_ReleaseInfo_t versions[1] = {{2,0,0,0}}; + RxArbiter_clientApiVersionSelected = false; + gpVersion_RegisterModule(GP_MODULE_ID, versions,1,gpRxArbiter_SetDefaultApiVersion); +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + REGISTER_MODULE(gpRxArbiter_HandleIndicationClient); +} + +/***************************************************************************** + * gpRxArbiter Require Functions + *****************************************************************************/ + +gpRxArbiter_Result_t gpRxArbiter_ResetStack(gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_ResetStack_CmdId; + + gpRxArbiter_ResetStack_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_ResetStack_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_ResetStack_Output_buf2par( + &result + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +gpRxArbiter_Result_t gpRxArbiter_SetStackChannel(UInt8 channel, gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_SetStackChannel_CmdId; + + gpRxArbiter_SetStackChannel_Input_par2buf(dataBuf + , channel + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_SetStackChannel_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_SetStackChannel_Output_buf2par( + &result + , channel + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +UInt8 gpRxArbiter_GetStackChannel(gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 channel; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetStackChannel_CmdId; + + gpRxArbiter_GetStackChannel_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetStackChannel_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetStackChannel_Output_buf2par( + &channel + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return channel; +} + +Bool gpRxArbiter_GetCurrentRxOnState(void) +{ + UInt16 _index = 1; + Bool rxon; + UInt8 dataBuf[1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetCurrentRxOnState_CmdId; + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetCurrentRxOnState_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetCurrentRxOnState_Output_buf2par( + &rxon + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return rxon; +} + +UInt8 gpRxArbiter_GetCurrentRxChannel(void) +{ + UInt16 _index = 1; + UInt8 currentChannel; + UInt8 dataBuf[1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetCurrentRxChannel_CmdId; + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetCurrentRxChannel_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetCurrentRxChannel_Output_buf2par( + ¤tChannel + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return currentChannel; +} + +gpRxArbiter_Result_t gpRxArbiter_SetStackRxOn(Bool enable, gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_SetStackRxOn_CmdId; + + gpRxArbiter_SetStackRxOn_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_SetStackRxOn_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_SetStackRxOn_Output_buf2par( + &result + , enable + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +Bool gpRxArbiter_GetStackRxOn(gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetStackRxOn_CmdId; + + gpRxArbiter_GetStackRxOn_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetStackRxOn_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetStackRxOn_Output_buf2par( + &enable + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return enable; +} + + + +Bool gpRxArbiter_GetDutyCycleEnabled(gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetDutyCycleEnabled_CmdId; + + gpRxArbiter_GetDutyCycleEnabled_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetDutyCycleEnabled_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetDutyCycleEnabled_Output_buf2par( + &result + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +gpRxArbiter_Result_t gpRxArbiter_SetStackPriority(UInt8 priority, gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_SetStackPriority_CmdId; + + gpRxArbiter_SetStackPriority_Input_par2buf(dataBuf + , priority + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_SetStackPriority_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_SetStackPriority_Output_buf2par( + &result + , priority + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +Bool gpRxArbiter_IsAnActiveChannel(gpRxArbiter_StackId_t stackId, UInt8 channel) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_IsAnActiveChannel_CmdId; + + gpRxArbiter_IsAnActiveChannel_Input_par2buf(dataBuf + , stackId + , channel + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_IsAnActiveChannel_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_IsAnActiveChannel_Output_buf2par( + &result + , stackId + , channel + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp.h new file mode 100644 index 0000000..be425fc --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpBsp.h + * This file manages how the BSP header file is included + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _BSP_H_ +#define _BSP_H_ + +#include "global.h" + + +#if defined(GP_COMP_CHIPEMU) +// Chip emulation definitions +#error Unsupported chip for chip emulation + +#endif //GP_COMP_EXTSTORAGE + +#if defined(__SDCC) +/* the "#include GP_BSP_FILENAME" construction doesn't seem to */ +/* work for the SDCC compiler. In this case we fall back to the old bsp selection */ +#else + +#if defined(GP_BSP_FILENAME) +/* Include BSP Header */ +#include GP_BSP_FILENAME +#endif +#endif //defined(__SDCC) +#endif // _BSP_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp_linux_user.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp_linux_user.h new file mode 100644 index 0000000..c3179d7 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp_linux_user.h @@ -0,0 +1,51 @@ + +#ifndef _GPBSP_LINUX_USER_H_ +#define _GPBSP_LINUX_USER_H_ + +/* + * Copyright (c) 2012-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpBsp_linux_user.h + * This file stubs gpBsp macro's for Pc unit tests + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * BSP configuration interface + *****************************************************************************/ + +#define GP_BSP_32KHZ_CRYSTAL_AVAILABLE() (0) +#define BSP_INIT() +#define GP_INT_IS_1 (0) +#define CONFIG_INTERRUPT_LINE() + +void gpBsp_init(void); + + +#endif //_GPBSP_LINUX_USER_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c new file mode 100644 index 0000000..8ee0df8 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2009-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpBsp.c + * Board support package functions + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_BSP + +#include "global.h" +#include "gpBsp.h" + +#if !defined(GP_DIVERSITY_WINDOWS) +void gpBsp_init(void) +{ + BSP_INIT(); +} +#endif diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/inc/gen/ComIoctlInterface_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/inc/gen/ComIoctlInterface_marshalling.h new file mode 100644 index 0000000..9879689 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/inc/gen/ComIoctlInterface_marshalling.h @@ -0,0 +1,135 @@ + +/* + * Copyright (c) 2017, Qorvo Inc + * + * This file contains the implementation of the ComIoctlInterface API protocol. + * + * + * Marshalling structures and functions + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _COMIOCTLINTERFACE_MARSHALLING_H_ +#define _COMIOCTLINTERFACE_MARSHALLING_H_ + +//DOCUMENTATION COMIOCTLINTERFACE: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "ComIoctlInterface.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + + + +typedef struct { + UInt8 moduleID; + UInt32 commId; + UInt16 length; + UInt8* pIoctlPayload; +} writeMsg_Input_struct_t; + +typedef struct { + writeMsg_Input_struct_t data; + UInt8 pIoctlPayload[GP_COM_MAX_PACKET_PAYLOAD_SIZE]; +} writeMsg_Input_marshall_struct_t; + +typedef struct { + UInt16 maxLength; +} readMsg_Input_struct_t; + +typedef struct { + readMsg_Input_struct_t data; +} readMsg_Input_marshall_struct_t; + +typedef struct { + UInt8* moduleID; + UInt32* commId; + UInt16* length; + UInt8* pIoctlPayload; +} readMsg_Output_struct_t; + +typedef struct { + readMsg_Output_struct_t data; + UInt8 moduleID[1]; + UInt32 commId[1]; + UInt16 length[1]; + UInt8 pIoctlPayload[GP_COM_MAX_PACKET_PAYLOAD_SIZE]; +} readMsg_Output_marshall_struct_t; + + +typedef union { + writeMsg_Input_marshall_struct_t writeMsg; + readMsg_Input_marshall_struct_t readMsg; +} ComIoctlInterface_Server_Input_union_t; + +typedef union { + readMsg_Output_marshall_struct_t readMsg; +} ComIoctlInterface_Server_Output_union_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's + +// Structure copy functions + +// Server functions +gpMarshall_AckStatus_t writeMsg_Input_buf2api( writeMsg_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t readMsg_Input_buf2api( readMsg_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +void readMsg_Output_api2buf( UInt8Buffer* pDest , readMsg_Output_marshall_struct_t* pSourceoutput , readMsg_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); + +// Client functions +void writeMsg_Input_par2buf( UInt8Buffer* pDest , UInt8 moduleID , UInt32 commId , UInt16 length , UInt8* pIoctlPayload , UInt16* pIndex ); +void readMsg_Input_par2buf( UInt8Buffer* pDest , UInt16 maxLength , UInt16* pIndex ); +void readMsg_Output_buf2par( UInt16 maxLength , UInt8* moduleID , UInt32* commId , UInt16* length , UInt8* pIoctlPayload , UInt8Buffer* pSource , UInt16* pIndex ); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _COMIOCTLINTERFACE_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/inc/gpCom.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/inc/gpCom.h new file mode 100644 index 0000000..d8158f2 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/inc/gpCom.h @@ -0,0 +1,283 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpCom.h + * + * This file contains the API definition of the serial communication module. + * It implements the GreenPeak serial protocol. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPCOM_H_ +#define _GPCOM_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpCom_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +//Check for multiple com usage +#ifdef GP_DIVERSITY_COM_UART +#ifndef GP_COM_DIVERSITY_MULTIPLE_COM +#define GP_COM_DIVERSITY_MULTIPLE_COM +#endif //ifndef GP_COM_DIVERSITY_MULTIPLE_COM +#else +#endif + +#define GP_COM_COMM_ID_HW (0x80000000) +#define GP_COM_COMM_ID_HW_1 (0x10000) +#define GP_COM_COMM_ID_HW_2 (0x20000) +#define GP_COM_COMM_ID_HW_3 (0x40000) +#define GP_COM_COMM_ID_HW_4 (0x80000) +#define GP_COM_COMM_ID_BLE_COMMAND GP_COM_COMM_ID_HW_1 +#define GP_COM_COMM_ID_BLE_DATA GP_COM_COMM_ID_HW_2 +#define GP_COM_COMM_ID_BLE_ISODATA GP_COM_COMM_ID_HW_3 +#define GP_COM_COMM_ID_BLE_EVENT GP_COM_COMM_ID_HW_4 +#define GP_COM_COMM_ID_USB (GP_COM_COMM_ID_HW | 0x4000) + +#define GP_COM_COMM_ID_UART1_PROPER (GP_COM_COMM_ID_HW | 0x01) +#define GP_COM_COMM_ID_UART1 GP_COM_COMM_ID_UART1_PROPER +#define GP_COM_COMM_ID_UART2 (GP_COM_COMM_ID_HW | 0x02) +#define GP_COM_COMM_ID_UART3 (GP_COM_COMM_ID_HW | 0x04) +#define GP_COM_COMM_ID_BLE (GP_COM_COMM_ID_HW_1 | GP_COM_COMM_ID_HW_2 | GP_COM_COMM_ID_HW_3 | GP_COM_COMM_ID_HW_4) +#define GP_COM_COMM_ID_STMUSB (GP_COM_COMM_ID_UART1) +#define GP_COM_COMM_ID_SHMEM (0x40000000) +#define GP_COM_COMM_ID_IOCTL_USER1 (GP_COM_COMM_ID_HW | 0x0040) +#define GP_COM_COMM_ID_IOCTL_USER2 (GP_COM_COMM_ID_HW | 0x0080) +#define GP_COM_COMM_ID_IOCTL_USER3 (GP_COM_COMM_ID_HW | 0x0010) +#define GP_COM_COMM_ID_IOCTL_USER4 (GP_COM_COMM_ID_HW | 0x0020) +#define GP_COM_COMM_ID_IOCTL_USER_MASK (GP_COM_COMM_ID_IOCTL_USER1 | GP_COM_COMM_ID_IOCTL_USER2 | GP_COM_COMM_ID_IOCTL_USER3 | GP_COM_COMM_ID_IOCTL_USER4) +#define GP_COM_COMM_ID_IOCTL_KERN1 (GP_COM_COMM_ID_HW | 0x0100) +#define GP_COM_COMM_ID_IOCTL_KERN2 (GP_COM_COMM_ID_HW | 0x0200) +#ifndef GP_COM_COMM_ID_IOCTL_USER +#define GP_COM_COMM_ID_IOCTL_USER GP_COM_COMM_ID_IOCTL_USER1 +#endif +#ifndef GP_COM_COMM_ID_IOCTL_KERN +#define GP_COM_COMM_ID_IOCTL_KERN GP_COM_COMM_ID_IOCTL_KERN1 +#endif +#define GP_COM_COMM_ID_SOCKET 0xFFFFFFFF /* used for the server (local client) conection if it exists; else the first client (local server) connection */ +#define GP_COM_COMM_ID_SOCKET2 0xFFFFFFFE /* for the next client (local server) connection */ +#define GP_COM_COMM_ID_RF (GP_COM_COMM_ID_HW | 0x1000) + +#define GP_COM_COMM_ID_SPI (GP_COM_COMM_ID_HW | 0x2000) + +#define GP_COM_COMM_ID_DIGSIM (GP_COM_COMM_ID_HW | 0x5555) + +#define GP_COMM_ID_CARRIED_BY(system,id) ((system & id) == id) + +//Define default COM ID + +#ifdef GP_COM_DIVERSITY_MULTIPLE_COM +#ifndef GP_COM_DEFAULT_COMMUNICATION_ID +#if defined(GP_DIVERSITY_JUMPTABLES) +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_UART1 +#else +#error supply default comm ID +#endif // defined(GP_DIVERSITY_JUMPTABLES) +#endif // GP_COM_DEFAULT_COMMUNICATION_ID +#else +#ifndef GP_COM_DEFAULT_COMMUNICATION_ID +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_IOCTL_USER1 +#endif //GP_COM_DEFAULT_COMMUNICATION_ID +#endif //GP_COM_DIVERSITY_MULTIPLE_COM + + +#if defined(GP_COMP_COM) +#define GP_COM_DATA_REQUEST(length,pData, commId) gpCom_DataRequest(GP_MODULE_ID, (length), (pData), commId) +#if defined(GP_DIVERSITY_COM_UART) +#define GP_COM_GET_FREE_BUFFER_SPACE(commId) gpCom_GetFreeBufferSpace(GP_MODULE_ID, commId) +#endif +#define GP_COM_REGISTER_MODULE(handleCallback) gpCom_RegisterModule(GP_MODULE_ID, (handleCallback)) +#define GP_COM_REGISTER_ACTIVATE_TX_CB(activateCallback) gpCom_RegisterActivateTxCb(GP_MODULE_ID, activateCallback) +#else +#define GP_COM_DATA_REQUEST(length,pData, commId) do {} while (false) +#define GP_COM_REGISTER_MODULE(handleCallback) do {} while (false) +#define GP_COM_REGISTER_ACTIVATE_TX_CB(activateCallback) do {} while (false) +#endif + +#ifndef GP_COM_MAX_PACKET_PAYLOAD_SIZE +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE 127 +#endif //GP_COM_MAX_PACKET_PAYLOAD_SIZE + +//Length expressed in 12-bits - maximum 4096-1 bytes available +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE_PROTOCOL 4095 +#if GP_COM_MAX_PACKET_PAYLOAD_SIZE > GP_COM_MAX_PACKET_PAYLOAD_SIZE_PROTOCOL +#error Length maximum 12-bits = 4096-1 bytes +#endif + +#define GP_COM_IOCTL_KERNEL_NR_OF_CLIENTS (4) + +#ifndef GP_COM_NR_OF_ACTIVATETXCB +#define GP_COM_NR_OF_ACTIVATETXCB (2) +#endif + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +#ifndef GP_COM_FILTER_CNT +#define GP_COM_FILTER_CNT 8 +#endif + +#ifndef GP_COM_FILTER_PATTERN_MAX_CNT +#define GP_COM_FILTER_PATTERN_MAX_CNT 2 +#endif + +#ifndef GP_COM_FILTER_PATTERN_MAX_LEN +#define GP_COM_FILTER_PATTERN_MAX_LEN 8 +#endif +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + +#ifndef GP_COM_TXBUFFER_ALMOST_FULL_TRESHOLD_PERCENT +#define GP_COM_TXBUFFER_ALMOST_FULL_TRESHOLD_PERCENT 80 +#endif + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt32 gpCom_CommunicationId_t; + +typedef void (*gpCom_HandleCallback_t) ( UInt16 length , UInt8* pData, gpCom_CommunicationId_t commId); +typedef UInt16 (*gpCom_cbActivateTx_t) ( UInt16 overFlowCounter, gpCom_CommunicationId_t commId); + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +typedef void (*gpCom_cbTxBufferAlmostFull_t)(gpCom_CommunicationId_t id, Bool almostFull); +#endif + +#define gpCom_ProtocolSyn 1 +#define gpCom_ProtocolBle 2 +#define gpCom_ProtocolNoSynNoCrc 3 +#define gpCom_ProtocolInvalid 0xff +typedef UInt8 gpCom_Protocol_t; +/***************************************************************************** + * External Function Definitions + *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpCom_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpCom_Init(void); + +/** +* @brief Send data over a specified communication channel +* +* @param moduleID SW component ID that will handle the data +* @param length Length of the data +* @param pData Pointer to the data to send +* @param commId Communication channel to use for transmission (if available). Can be UART/USB/... +* @return status Returns True if request was executed. +*/ +Bool gpCom_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId); + +/** +* @brief Send data over a specified communication channel and wait for a specific ACK packet +* +* @param moduleID SW component ID that will handle the data +* @param length Length of the data +* @param pData Pointer to the data to send +* @param commId Communication channel to use for transmission (if available). Can be UART/USB/... +* @param reqAcked Return pointer in whick ack state is returned. +* @param timeout Time to wait for ack (in us) +* @param ackId Specific command ID to wait for in ACK packet. Tied to API serialization. +* @return status Returns True if request was executed. +*/ +Bool gpCom_DataRequestAndWaitForAck(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId, Bool *reqAcked, UInt32 timeout, UInt8 ackId); +UInt16 gpCom_GetFreeBufferSpace(UInt8 moduleID, gpCom_CommunicationId_t commId); +Bool gpCom_RegisterModule(UInt8 moduleID, gpCom_HandleCallback_t handleCallback); +Bool gpCom_DeRegisterModule(UInt8 moduleID); +Bool gpCom_RegisterActivateTxCb(UInt8 moduleID, gpCom_cbActivateTx_t cb); +Bool gpCom_IsReceivedPacketPending(void); +void gpCom_HandleRx(void); +void gpCom_HandleRxBlocking(Bool blockingWait, UInt8 cmdId); + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +gpCom_cbTxBufferAlmostFull_t gpCom_RegisterTxBufferAlmostFull(gpCom_cbTxBufferAlmostFull_t cb); +#endif + +// Common functions +Bool gpCom_GetTXEnable(void); +void gpCom_HandleTx(void); +void gpCom_Flush(void); +void gpCom_DeInit(void); +Bool gpCom_TXDataPending(void); +gpCom_CommunicationId_t gpCom_cbSelectCommId(void); +gpCom_CommunicationId_t gpCom_cbSelectBleCommId(void); + + + + + + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + + + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING + +typedef struct +{ + UInt8 data[GP_COM_FILTER_PATTERN_MAX_LEN]; + UInt16 len; + UInt16 offset; +} gpCom_FilterPattern_t; + +Bool gpCom_AddFilter(UInt8 moduleId, UInt8 bufferUsageThresh, UInt8 patternsCnt, const gpCom_FilterPattern_t* patterns); +Bool gpCom_RemoveFilter(UInt8 moduleId, UInt8 bufferUsageThresh, UInt8 patternsCnt, const gpCom_FilterPattern_t* patterns); +#endif + +#endif // _GPCOM_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface.h new file mode 100644 index 0000000..620a05b --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#include "global.h" +#include "gpCom.h" +#include "gpAssert.h" diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c new file mode 100644 index 0000000..a51e3c8 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * This file contains the implementation of the ComIoctlInterface API protocol. + * + * + * Marshalling structures and functions + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "ComIoctlInterface.h" +#include "ComIoctlInterface_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_COMIOCTLINTERFACE + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void writeMsg_Input_par2buf( UInt8Buffer* pDest , UInt8 moduleID , UInt32 commId , UInt16 length , UInt8* pIoctlPayload , UInt16* pIndex ) +{ + UInt8_api2buf(pDest, &(moduleID), 1, pIndex); + UInt32_api2buf(pDest, &(commId), 1, pIndex); + UInt16_api2buf(pDest, &(length), 1, pIndex); + pDest[(*pIndex)++] = (NULL == pIoctlPayload); + if (NULL != pIoctlPayload) + { + UInt8_api2buf(pDest, pIoctlPayload, length, pIndex); + } +} + +void readMsg_Input_par2buf( UInt8Buffer* pDest , UInt16 maxLength , UInt16* pIndex ) +{ + UInt16_api2buf(pDest, &(maxLength), 1, pIndex); +} + +void readMsg_Output_buf2par( UInt16 maxLength , UInt8* moduleID , UInt32* commId , UInt16* length , UInt8* pIoctlPayload , UInt8Buffer* pSource , UInt16* pIndex ) +{ + NOT_USED(maxLength); + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt8_buf2api( moduleID, pSource, 1, pIndex); + } + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt32_buf2api( commId, pSource, 1, pIndex); + } + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt16_buf2api( length, pSource, 1, pIndex); + } + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt8_buf2api( pIoctlPayload, pSource, (*length), pIndex); + } +} + + + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c new file mode 100644 index 0000000..f363012 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * This file contains the implementation of the ComIoctlInterface API protocol. + * + * + * Marshalling structures and functions + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "ComIoctlInterface.h" +#include "ComIoctlInterface_marshalling.h" + +#include "gpLog.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_COMIOCTLINTERFACE + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t writeMsg_Input_buf2api( writeMsg_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ) +{ + UInt8_buf2api(&(pDest->data.moduleID), pSource, 1, pIndex); + UInt32_buf2api(&(pDest->data.commId), pSource, 1, pIndex); + UInt16_buf2api(&(pDest->data.length), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pIoctlPayload = pDest->pIoctlPayload; + UInt8_buf2api( pDest->data.pIoctlPayload, pSource, pDest->data.length, pIndex ); + } + else + { + pDest->data.pIoctlPayload = NULL; + } + return gpMarshall_AckStatusSuccess; +} + + +gpMarshall_AckStatus_t readMsg_Input_buf2api( readMsg_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ) +{ + UInt16_buf2api(&(pDest->data.maxLength), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +void readMsg_Output_api2buf( UInt8Buffer* pDest , readMsg_Output_marshall_struct_t* pSourceoutput , readMsg_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ) +{ + pDest[(*pIndex)++] = (pSourceoutput->data.moduleID == NULL); // Add IsNull byte for output pointer + if (pSourceoutput->data.moduleID != NULL) + { + UInt8_api2buf(pDest, pSourceoutput->data.moduleID,1, pIndex); + } + pDest[(*pIndex)++] = (pSourceoutput->data.commId == NULL); // Add IsNull byte for output pointer + if (pSourceoutput->data.commId != NULL) + { + UInt32_api2buf(pDest, pSourceoutput->data.commId,1, pIndex); + } + pDest[(*pIndex)++] = (pSourceoutput->data.length == NULL); // Add IsNull byte for output pointer + if (pSourceoutput->data.length != NULL) + { + UInt16_api2buf(pDest, pSourceoutput->data.length,1, pIndex); + } + pDest[(*pIndex)++] = (pSourceoutput->data.pIoctlPayload == NULL); // Add IsNull byte for output pointer + if (pSourceoutput->data.pIoctlPayload != NULL) + { + UInt8_api2buf(pDest, pSourceoutput->data.pIoctlPayload,(*pSourceoutput->data.length), pIndex); + } +} + + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c new file mode 100644 index 0000000..acb7d1a --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c @@ -0,0 +1,392 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpCom.c + * + * This file contains the implementation of the serial communication module. + * It implements the GreenPeak serial protocol. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_COM + +#include "gpCom.h" +#include "gpCom_defs.h" + +#include "gpLog.h" +#include "gpAssert.h" + +#include "gpSched.h" + +#include "hal.h" + +extern HAL_CRITICAL_SECTION_DEF(Com_MultiThreadingMutex) + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +#ifndef GP_COM_MAX_TX_BUFFER_SIZE +#define GP_COM_MAX_TX_BUFFER_SIZE 1536 +#endif +#define TX_BUFFER_CALCULATE_USAGE_PERCENTAGE(val) (UInt16)((100 - val * 100 / GP_COM_MAX_TX_BUFFER_SIZE)) +#define COMM_ID_SLOT_NB (4) /* currently tx buffer almost full indication is supported for max 4 interfaces: UART1, UART2, SPI, SHMEM */ +#define EMPTY_COMM_ID_SLOT (0x00000000) +#define EMPTY_COMM_ID_SLOT_BITFLAG (0x80) +#endif +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +Bool gpCom_Initialized = false; + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +static gpCom_cbTxBufferAlmostFull_t gpCom_TxBufferAlmostFullCb = NULL; +#endif +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) +Bool gpCom_TxLocked; +#endif + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +#error "Defined protocols cannot be used in this configuration together with GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK" +#endif +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ +#if defined(GP_COM_DIVERSITY_PACKET_FILTERING) && !defined(GP_COM_COMM_ID_IOCTL_KERN) +UInt8 gpCom_TxBufferUsagePercent(void); +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING && !GP_COM_COMM_ID_IOCTL_KERN + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +static void Com_CheckTxBufferOverTreshhold(gpCom_CommunicationId_t commId); +static void Com_CheckTxBufferBelowTreshold(void); +#endif +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +static UInt8 Com_FindConnIdInTxBufferAlmostFull(gpCom_CommunicationId_t commId) +{ + UInt8 tmpIdx = 0x7F; + for(UInt8 index = 0; index < COMM_ID_SLOT_NB; index++) + { + if(Com_TxBufferAlmostFullCommIds[index] == commId) + { + tmpIdx = index; + break; + } + else if(Com_TxBufferAlmostFullCommIds[index] == EMPTY_COMM_ID_SLOT) + { + if(!(tmpIdx & EMPTY_COMM_ID_SLOT_BITFLAG)) + { + /* first empty slot was found, store it and iterate over rest of the array*/ + tmpIdx = EMPTY_COMM_ID_SLOT_BITFLAG | index; + } + } + } + return tmpIdx; +} + +static void Com_CheckTxBufferOverTreshhold(gpCom_CommunicationId_t commId) +{ + UInt16 usagePerc = 0; + + if(!gpCom_TxBufferAlmostFullCb) + { + return; + } + + usagePerc = TX_BUFFER_CALCULATE_USAGE_PERCENTAGE(gpCom_GetFreeBufferSpace(0, commId)); + + if(usagePerc > GP_COM_TXBUFFER_ALMOST_FULL_TRESHOLD_PERCENT) + { + UInt8 index = Com_FindConnIdInTxBufferAlmostFull(commId); + GP_ASSERT_SYSTEM(index != 0x7F); + + if(index & EMPTY_COMM_ID_SLOT_BITFLAG) /* current connId is not stored in Com_TxBufferAlmostFull array - call cb and store it there */ + { + index &= ~(EMPTY_COMM_ID_SLOT_BITFLAG); + Com_TxBufferAlmostFullCommIds[index] = commId; + gpCom_TxBufferAlmostFullCb(Com_TxBufferAlmostFullCommIds[index], true); + } + else + { + /* connId already present in Com_TxBufferAlmostFull - do nothing */ + } + } +} + +static void Com_CheckTxBufferBelowTreshold(void) +{ + if(!gpCom_TxBufferAlmostFullCb) + { + return; + } + + for(UInt8 index = 0; index < COMM_ID_SLOT_NB; index++) + { + if((Com_TxBufferAlmostFullCommIds[index] != EMPTY_COMM_ID_SLOT)) + { + UInt16 usagePerc = TX_BUFFER_CALCULATE_USAGE_PERCENTAGE(gpCom_GetFreeBufferSpace(0, Com_TxBufferAlmostFullCommIds[index])); + if(usagePerc < GP_COM_TXBUFFER_ALMOST_FULL_TRESHOLD_PERCENT) + { + gpCom_TxBufferAlmostFullCb(Com_TxBufferAlmostFullCommIds[index], false); + Com_TxBufferAlmostFullCommIds[index] = EMPTY_COMM_ID_SLOT; + } + } + } +} +#endif +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpCom_Init(void) +{ + + Com_InitRx(); + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + gpComSerial_Init(); +#endif //GP_DIVERSITY_COM_UART + { + gpComIoctl_Init(); + } + + + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK + gpCom_TxBufferAlmostFullCb = NULL; +#endif +} + +Bool gpCom_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId) +{ + Bool ret = false; + +#if defined(GP_COM_DIVERSITY_PACKET_FILTERING) && !defined(GP_COM_COMM_ID_IOCTL_KERN) + // Check if the packet should be dropped: + if(gpCom_FilterIsPacketDataToReject(gpCom_TxBufferUsagePercent(), moduleID, length, pData, commId)) + { + return true; + } +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + + //GP_LOG_SYSTEM_PRINTF("TX m=%02x l=%d d=%02x...",0,moduleID, length, pData[0]); +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + if(GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_UART1) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_UART2) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_STMUSB) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_SPI) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_USB)) + { + ret = gpComSerial_DataRequest(moduleID, length, pData, commId); + } + else +#endif + if(GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_KERN1) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_KERN2) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_USER1) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_USER2) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_USER3) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_USER4) + ) + { + ret = gpComIoctl_DataRequest(moduleID, length, pData, commId); + } + else + { + ret = false; + } + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK + if(ret == true) + { + Com_CheckTxBufferOverTreshhold(commId); + } +#endif + + if (ret == false + && !(moduleID == GP_COMPONENT_ID_COM && pData[0] == 0xfe && pData[2] == 0x08 /*gpComLinkEvent_Ping_CmdId*/ ) + ) + { + GP_ASSERT_SYSTEM(ret); + } + return ret; + +} + +UInt16 gpCom_GetFreeBufferSpace(UInt8 moduleID, gpCom_CommunicationId_t commId) +{ + NOT_USED(moduleID); +#if ! defined(GP_DIVERSITY_COM_UART) + NOT_USED(commId); +#endif //not defined GP_DIVERSITY_COM_UART +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + if(GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_UART1) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_UART2) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_STMUSB) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_SPI) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_USB)) + { + return gpComSerial_GetFreeSpace(commId); + } + else +#endif + GP_ASSERT_DEV_EXT(false); + { + return 0; + } +} + +//Redirection functions +Bool gpCom_GetTXEnable(void) +{ + Bool enabled = false; + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + enabled |= gpComSerial_GetTXEnable(); +#endif + enabled |= gpComIoctl_GetTXEnable(); + + return enabled; +} + +Bool gpCom_TXDataPending(void) +{ + + Bool pending = false; + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + pending |= gpComSerial_TXDataPending(); +#endif + pending |= gpComIoctl_TXDataPending(); + + return pending; +} + + +void gpCom_Flush(void) +{ + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + gpComSerial_Flush(); +#endif + gpComIoctl_Flush(); +} + +void gpCom_DeInit(void) +{ + Com_DeInitRx(); + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + gpComSerial_DeInit(); +#endif + gpComIoctl_DeInit(); +} + +void gpCom_HandleTx(void) +{ +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + gpComSerial_HandleTx(); +#endif + gpComIoctl_HandleTx(); +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK + Com_CheckTxBufferBelowTreshold(); +#endif +} + +Bool gpCom_DataRequestAndWaitForAck(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId, Bool *reqAcked, UInt32 timeout, UInt8 ackId) +{ + Bool ret; + Bool timedOut = false; + + HAL_ACQUIRE_MUTEX(Com_MultiThreadingMutex); + *reqAcked = false; + ret = gpCom_DataRequest(moduleID, length, pData, commId); + + //Just wait for ACK if data request was a success + if(ret) + { + UInt32 endPollTime = timeout + gpSched_GetCurrentTime(); + + while(!timedOut) + { + gpCom_HandleTx(); + gpCom_HandleRxBlocking(true, ackId); + if(!(*reqAcked)) + { + if(!gpSched_TimeCompareLower(gpSched_GetCurrentTime(), endPollTime)) + { + timedOut = true; + } + } + else + { + break; + } + } + } + HAL_RELEASE_MUTEX(Com_MultiThreadingMutex); + + if(timedOut) + { + GP_LOG_SYSTEM_PRINTF("WFack fail m:%x l:%u [%x Id:%lx",0, moduleID, length, pData[0], (long unsigned int)commId); + GP_ASSERT_SYSTEM(false); + } + + return ret; +} + + + + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +gpCom_cbTxBufferAlmostFull_t gpCom_RegisterTxBufferAlmostFull(gpCom_cbTxBufferAlmostFull_t cb) +{ + gpCom_cbTxBufferAlmostFull_t oldCb = gpCom_TxBufferAlmostFullCb; + + gpCom_TxBufferAlmostFullCb = cb; + return oldCb; +} +#endif diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c new file mode 100644 index 0000000..39bcc82 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c @@ -0,0 +1,317 @@ +/** + * This file contains a the implementation of the gpCom over a UNIX socket + * + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_COM + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include +#include + +#include "hal.h" +#include "gpUtils.h" +#include "gpCom.h" +#include "gpCom_defs.h" + +#include "ComIoctlInterface_marshalling.h" +#include "gpLog.h" +#include "gpAssert.h" + +#include "gpSched.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#ifdef GP_COM_DEVICE_FILE_NAME +#define COM_DEVICE_FILE_NAME XSTRINGIFY(GP_COM_DEVICE_FILE_NAME) +#else +#define COM_DEVICE_FILE_NAME "/dev/gp" +#endif //def COM_DEVICE_FILE_NAME +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +//State variables +int Com_IoctlFd = -1; + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +void ComIoctl_FlushRx(void); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +void ComIoctl_ConnectionClose(void) +{ + GP_LOG_SYSTEM_PRINTF("Closing connections",0); + Com_ConnectionClose(GP_COM_COMM_ID_IOCTL_USER); + gpComIoctl_DeInit(); + gpComIoctl_Init(); + + GP_ASSERT_SYSTEM(false); +} + +Bool ComIoctl_PollFunction(void) +{ + UInt8 UserspaceBuffer[32+GP_COM_MAX_PACKET_PAYLOAD_SIZE]; + UInt16 Index = 0; + gpCom_Packet_t* pPacket; + int ret; + + MEMSET(&UserspaceBuffer, 0, sizeof(UserspaceBuffer)); + if(Com_IoctlFd < 0) + { + GP_LOG_SYSTEM_PRINTF("Driver not opened? fd:%d",0,Com_IoctlFd); + goto ComIoctl_PollFunction_NoFd; + } + + pPacket = Com_GetFreePacket(); + if (!pPacket) { + GP_LOG_PRINTF("No gpCom_PacketBuffer available",0); + goto ComIoctl_PollFunction_NoPacketBuffer; + } + + readMsg_Input_par2buf( (UInt8Buffer*)UserspaceBuffer, GP_COM_MAX_PACKET_PAYLOAD_SIZE, &Index ); + + ret = ioctl(Com_IoctlFd, GP_IOCTL_READ_STREAM_MSG, UserspaceBuffer); + Index = 0; + readMsg_Output_buf2par(GP_COM_MAX_PACKET_PAYLOAD_SIZE, &pPacket->moduleID, &pPacket->commId, &pPacket->length , pPacket->packet, (UInt8Buffer*)UserspaceBuffer , &Index); + if (ret<0) + { + switch (errno) + { + case ENOMEM: + GP_LOG_SYSTEM_PRINTF("%s: gpOsal_ErrorNoMemory, Userspace allocation too small for packet in kernel: %u < %u",0, __FUNCTION__, GP_COM_MAX_PACKET_PAYLOAD_SIZE, pPacket->length); + GP_ASSERT_SYSTEM(false); + break; + + case ENOTTY: + GP_LOG_SYSTEM_PRINTF("gpOsal_ErrorInvalidIoctl",0); + break; + + case ENODATA: + //No data available + break; + + case ENODEV: + //Device not available during recover, avoid flood of prints + break; + + default: + GP_LOG_SYSTEM_PRINTF("Errornumber: %d",0,errno); + break; + } + goto ComIoctl_PollFunction_IoctlFail; + } + GP_LOG_PRINTF("got msg mid=0x%02X len=%d commid=%lx [ %02x %02x %02x %02x %02x %02x %02x %02x ]", 0, + pPacket->moduleID, pPacket->length, (long unsigned int)pPacket->commId, + pPacket->packet[0], + pPacket->packet[1], + pPacket->packet[2], + pPacket->packet[3], + pPacket->packet[4], + pPacket->packet[5], + pPacket->packet[6], + pPacket->packet[7] + ); + + + //gpLog_PrintBuffer(pPacket->length, pPacket->packet); + + if(!Com_AddPendingPacket(pPacket)) + { + Com_FreePacket(pPacket); + GP_LOG_SYSTEM_PRINTF("No space for handling",0); + } + + return true; + +ComIoctl_PollFunction_IoctlFail: + Com_FreePacket(pPacket); +ComIoctl_PollFunction_NoPacketBuffer: +ComIoctl_PollFunction_NoFd: + return false; +} + +void ComIoctl_PollHandler(UInt8 fd) +{ + NOT_USED(fd); + ComIoctl_PollFunction(); +} + +void ComIoctl_FlushRx(void) +{ + while(ComIoctl_PollFunction()); +} + +void ComIoctl_SignalIOHandler(int sig, siginfo_t *siginfo, void* context) +{ + NOT_USED(sig); + NOT_USED(siginfo); + NOT_USED(context); + GP_LOG_SYSTEM_PRINTF("Driver reset detected",0); + gpSched_ScheduleEvent(0, ComIoctl_ConnectionClose); +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +void gpComIoctl_Init (void) +{ + int oldFlags; + struct sigaction act; + + Com_IoctlFd = open(COM_DEVICE_FILE_NAME, O_RDWR|O_CLOEXEC); + if (Com_IoctlFd < 0) + { + GP_LOG_SYSTEM_PRINTF("Can't open device file: %s", 0, COM_DEVICE_FILE_NAME); + GP_ASSERT_SYSTEM(false); + return; + } + + memset(&act, 0, sizeof(act)); + act.sa_sigaction = &ComIoctl_SignalIOHandler; + act.sa_flags = SA_SIGINFO; + if(sigaction(SIGIO, &act, NULL) < 0) + { + GP_LOG_SYSTEM_PRINTF("Can't assign SIGIO",0); + GP_ASSERT_SYSTEM(false); + return; + } + + fcntl(Com_IoctlFd, F_SETOWN, getpid()); + //FASYNC needs to be set through fcntl + oldFlags = fcntl(Com_IoctlFd, F_GETFL); + fcntl(Com_IoctlFd, F_SETFL, oldFlags | FASYNC); + + hal_RegisterPollFunction(Com_IoctlFd, ComIoctl_PollHandler); +} + +Bool gpComIoctl_GetTXEnable(void) +{ + return (Com_IoctlFd >= 0); +} + +void gpComIoctl_DeInit(void) +{ + if(Com_IoctlFd >= 0) + { + hal_UnRegisterPollFunction(Com_IoctlFd); + close(Com_IoctlFd); + Com_IoctlFd = -1; + } +} + +Bool gpComIoctl_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId) +{ + UInt8 UserspaceBuffer[32+GP_COM_MAX_PACKET_PAYLOAD_SIZE]; + UInt16 Index = 0; + int ret; + + if (Com_IoctlFd < 0) { + return false; + } + + MEMSET(&UserspaceBuffer, 0, sizeof(UserspaceBuffer)); + + GP_ASSERT_DEV_INT(GP_COM_COMM_ID_IOCTL_USER & commId); // return path hardcodes this value + + writeMsg_Input_par2buf( (UInt8Buffer*)UserspaceBuffer , moduleID , commId , length , pData , &Index); + GP_ASSERT_SYSTEM(Index < sizeof(UserspaceBuffer)); + + ret = ioctl(Com_IoctlFd, GP_IOCTL_WRITE_STREAM_MSG, UserspaceBuffer); + if(ret < 0) + { + switch (errno) + { + case ENOMEM: + GP_LOG_SYSTEM_PRINTF("%s: gpOsal_ErrorNoMemory, Userspace allocation too small for packet in kernel: %u < %u",0, __FUNCTION__, GP_COM_MAX_PACKET_PAYLOAD_SIZE, length); + GP_ASSERT_SYSTEM(false); + break; + case ENOTTY: + GP_LOG_SYSTEM_PRINTF("gpOsal_ErrorInvalidIoctl",0); + break; + case ENODATA: + //No data available + break; + case ENODEV: + //Device not available during recover, avoid flood of prints + break; + default: + GP_LOG_SYSTEM_PRINTF("Errornumber: %d",0,errno); + break; + } + return false; + } + else + { + return true; + } +} + +void gpComIoctl_HandleTx(void) +{ + +} + +void gpComIoctl_Flush(void) +{ + //No Tx side flush needed +} + +Bool gpComIoctl_TXDataPending(void) +{ +/* A datarequest will handover any tx data directly to the ioctl fd, so at no point will + there be any tx data pending */ + return false; +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c new file mode 100644 index 0000000..57ce4b5 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c @@ -0,0 +1,783 @@ +/* + * Copyright (c) 2014-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +//#define GP_LOCAL_LOG +#define GP_COMPONENT_ID GP_COMPONENT_ID_COM + +#include "hal.h" +#include "gpCom.h" +#include "gpCom_defs.h" + +#include "gpLog.h" +#include "gpAssert.h" + +#ifdef GP_FREERTOS_DIVERSITY_NO_GPSCHED +#include "hal_SchedFreeRTOS.h" +#endif //GP_FREERTOS_DIVERSITY_NO_GPSCHED +#include "gpSched.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_COM_RX_PACKET_BUFFERS +#if !defined(GP_COM_DIVERSITY_MULTIPLE_COM) +#define GP_COM_RX_PACKET_BUFFERS 1 +#else +//Reserve minimum space for possible simultaneous indication and ack +#define GP_COM_RX_PACKET_BUFFERS 2 +#endif //GP_DIVERSITY_COM_SHMEM && !defined(GP_COM_DIVERSITY_MULTIPLE_COM) +#endif //GP_COM_RX_PACKET_BUFFERS + +#define GP_COM_UNKNOWN_MODULE_ID 0 +#ifndef GP_COM_MAX_NUMBER_OF_MODULE_IDS +#define GP_COM_MAX_NUMBER_OF_MODULE_IDS 2 //16 +#endif //GP_COM_MAX_NUMBER_OF_MODULE_IDS + +#define BITS_IN_BYTE 8 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct gpCom_ModuleIDCallbackEntry { + UInt8 moduleID; + gpCom_HandleCallback_t handleCallback; +} gpCom_ModuleIDCallbackEntry_t; + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +typedef struct +{ + UInt8 bufferUsageThresh; // A threshold of RX queue usage in percents + UInt8 moduleId; + UInt8 patternsCnt; + gpCom_FilterPattern_t patterns[GP_COM_FILTER_PATTERN_MAX_CNT]; + Bool enabled; +} gpCom_FilterData_t; +#endif //GP_COM_DIVERSITY_PACKET_FILTERING + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static gpCom_Packet_t* gpCom_PacketHandlingQueue[GP_COM_RX_PACKET_BUFFERS]; +static gpCom_Packet_t gpCom_PacketBuffer[GP_COM_RX_PACKET_BUFFERS] GP_EXTRAM_SECTION_ATTR; +static UInt8 gpCom_PacketBufferClaimed[(GP_COM_RX_PACKET_BUFFERS-1)/8+1]; + +static gpCom_ModuleIDCallbackEntry_t gpCom_ModuleIDCallbackTable[GP_COM_MAX_NUMBER_OF_MODULE_IDS]; + +HAL_CRITICAL_SECTION_DEF(Com_RxMutex) +HAL_CRITICAL_SECTION_DEF(Com_MultiThreadingMutex) +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) +Bool gpCom_TxLocked; +#endif + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +static gpCom_FilterData_t filters[GP_COM_FILTER_CNT]; +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Internal Function Prototypes + *****************************************************************************/ + +//Packet memory handlers +gpCom_Packet_t* Com_GetFreePacket(void); +void Com_FreePacket(gpCom_Packet_t* pPacket); +//Queue handler +Bool Com_AddPendingPacket(gpCom_Packet_t* pPacket); + +void Com_InitRx(void); +void Com_ConnectionClose(gpCom_CommunicationId_t commId); + +void Com_Execute(gpCom_Packet_t * pPacket); + +void gpCom_HandleRxNonBlocking(void); +void Com_ExecuteAndFreePacket(gpCom_Packet_t* pPacket, Bool blockingWait, UInt8 cmdId); + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ +static void Com_ShiftHandlingQueue(UInt8 startIndex); +static gpCom_Packet_t* Com_GetPendingPacketWithCmdId(UInt8 cmdId); +static gpCom_Packet_t* Com_GetPendingPacket(void); + + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +static Bool isFilterPatternInPacket(gpCom_FilterPattern_t* pPattern, UInt16 length, UInt8* pData); +static Bool isPatternEqual(const gpCom_FilterPattern_t* pInPattern, const gpCom_FilterPattern_t* pOutPattern, UInt8 patternsCnt); +static UInt8 getFilterIdx(UInt8 threshold); +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +#ifdef GP_LOCAL_LOG +void Com_DumpRxBuffers(void) +{ + UIntLoop i; + for (i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + gpCom_Packet_t* pPacket = &gpCom_PacketBuffer[i]; + GP_LOG_SYSTEM_PRINTF("mem- %i:%i id:%x l:%i comm:%lu [%x",0,i, BIT_TST(gpCom_PacketBufferClaimed[i/8],i%8), + pPacket->moduleID, + pPacket->length, + (unsigned long)pPacket->commId, + pPacket->packet[0]); + gpLog_Flush(); + } + for (i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(gpCom_PacketHandlingQueue[i]) + { + gpCom_Packet_t* pPacket = gpCom_PacketHandlingQueue[i]; + + GP_LOG_SYSTEM_PRINTF("que- %i:id:%x l:%i comm:%lu [%x",0,i, pPacket->moduleID, + pPacket->length, + (unsigned long)pPacket->commId, + pPacket->packet[0]); + gpLog_Flush(); + } + } +} +#endif + +//Memory Claim/Free +gpCom_Packet_t* Com_GetFreePacket(void) +{ + UIntLoop i; + gpCom_Packet_t *pPacket = NULL; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return NULL; + } + + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(!BIT_TST(gpCom_PacketBufferClaimed[i/8], i%8)) + { + GP_LOG_PRINTF("G %i",0,i); + BIT_SET(gpCom_PacketBufferClaimed[i/8], i%8); + pPacket = &(gpCom_PacketBuffer[i]); + break; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + if(NULL == pPacket) + { + GP_LOG_PRINTF("No Rx buf",0); +#ifdef GP_LOCAL_LOG + Com_DumpRxBuffers(); +#endif //GP_LOCAL_LOG + } + return pPacket; +} + +void Com_FreePacket(gpCom_Packet_t* pPacket) +{ + UIntLoop i; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return; + } + + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(pPacket == &(gpCom_PacketBuffer[i])) + { + GP_LOG_PRINTF("Fr %i",0,i); + BIT_CLR(gpCom_PacketBufferClaimed[i/8], i%8); + break; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + if(i == GP_COM_RX_PACKET_BUFFERS) + { + GP_LOG_PRINTF("F: packet not found: id:%x l:%i comm:%lu",0,pPacket->moduleID, + pPacket->length, + (unsigned long)pPacket->commId); + GP_ASSERT_DEV_EXT(false); + } +} + +//Handling queue - preserve in order execution +static void Com_ShiftHandlingQueue(UInt8 startIndex) +{ + // always called from inside mutex, so no mutex here ! +#if GP_COM_RX_PACKET_BUFFERS > 1 + UIntLoop i; + GP_ASSERT_DEV_INT(startIndex < GP_COM_RX_PACKET_BUFFERS); + //Shift to front and add NULL at the end + for(i = startIndex; i < GP_COM_RX_PACKET_BUFFERS-1; i++) + { + gpCom_PacketHandlingQueue[i] = gpCom_PacketHandlingQueue[i+1]; + } +#endif //GP_COM_RX_PACKET_BUFFERS > 1 + gpCom_PacketHandlingQueue[GP_COM_RX_PACKET_BUFFERS-1] = NULL; +} + +Bool Com_AddPendingPacket(gpCom_Packet_t* pPacket) +{ + UIntLoop i; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return false; + } + + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(gpCom_PacketHandlingQueue[i] == NULL) + { + GP_LOG_PRINTF("Add %i",0, i); + gpCom_PacketHandlingQueue[i] = pPacket; + break; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + return i != GP_COM_RX_PACKET_BUFFERS; +} + +static gpCom_Packet_t* Com_GetPendingPacket(void) +{ + gpCom_Packet_t *pPacket = NULL; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return NULL; + } + + Com_FlushRx(); + HAL_ACQUIRE_MUTEX(Com_RxMutex); + pPacket = gpCom_PacketHandlingQueue[0]; + if(pPacket != NULL) + { + Com_ShiftHandlingQueue(0); + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + return pPacket; +} + +static gpCom_Packet_t* Com_GetPendingPacketWithCmdId(UInt8 cmdId) +{ + UIntLoop i; + gpCom_Packet_t *pPacket = NULL; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return NULL; + } + + Com_FlushRx(); + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if((gpCom_PacketHandlingQueue[i] != NULL) + && (gpCom_PacketHandlingQueue[i]->packet[0] == cmdId)) + { + pPacket = gpCom_PacketHandlingQueue[i]; + Com_ShiftHandlingQueue(i); + break; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + return pPacket; +} + +void Com_InitRx(void) +{ + UIntLoop i; + for (i=0;i < GP_COM_MAX_NUMBER_OF_MODULE_IDS;i++) + { + gpCom_ModuleIDCallbackTable[i].moduleID = GP_COM_UNKNOWN_MODULE_ID; + gpCom_ModuleIDCallbackTable[i].handleCallback = NULL; + } + for (i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + gpCom_PacketHandlingQueue[i] = NULL; + } +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING + for(i = 0; i < GP_COM_FILTER_CNT; i++) + { + filters[i].enabled = false; + } +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + MEMSET(gpCom_PacketBufferClaimed, 0x0, sizeof(gpCom_PacketBufferClaimed)); + HAL_CREATE_MUTEX(&Com_RxMutex); + HAL_CREATE_MUTEX(&Com_MultiThreadingMutex); +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) + gpCom_TxLocked = true; +#endif +} + +void Com_DeInitRx(void) +{ + if(HAL_VALID_MUTEX(Com_RxMutex)) + { + HAL_DESTROY_MUTEX(&Com_RxMutex); + } + if(HAL_VALID_MUTEX(Com_MultiThreadingMutex)) + { + HAL_DESTROY_MUTEX(&Com_MultiThreadingMutex); + } +} + +void Com_Execute(gpCom_Packet_t* pPacket) +{ + UIntLoop i; + //GP_LOG_SYSTEM_PRINTF("Ex:%x %i %lx [%x",0, pPacket->moduleID, pPacket->length, (unsigned long int)pPacket->commId, pPacket->packet[0]); + +#if defined(GP_COM_COMM_ID_BRIDGE_1) && defined(GP_COM_COMM_ID_BRIDGE_2) + gpCom_DataRequest(pPacket->moduleID, pPacket->length, pPacket->packet, (pPacket->commId == GP_COM_COMM_ID_BRIDGE_1) ? \ + GP_COM_COMM_ID_BRIDGE_2 : \ + GP_COM_COMM_ID_BRIDGE_1); +#endif /* GP_COM_COMM_ID_BRIDGE_1/GP_COM_COMM_ID_BRIDGE_2 */ + + + for (i=0;i < GP_COM_MAX_NUMBER_OF_MODULE_IDS;i++) + { + if (gpCom_ModuleIDCallbackTable[i].moduleID == pPacket->moduleID) + { + if (gpCom_ModuleIDCallbackTable[i].handleCallback != NULL) + { + gpCom_ModuleIDCallbackTable[i].handleCallback(pPacket->length, pPacket->packet, pPacket->commId); + break; + } + } + else + { + GP_LOG_PRINTF("No %x-%x",2,(UInt16)pPacket->moduleID,(UInt16)gpCom_ModuleIDCallbackTable[i].moduleID); + } + } +} + +void Com_ConnectionClose(gpCom_CommunicationId_t commId) +{ + UIntLoop i; + + GP_LOG_PRINTF("Close %lx",2, (long unsigned int)commId); + for (i=0;i < GP_COM_MAX_NUMBER_OF_MODULE_IDS;i++) + { + //Notify all modules of connection loss + if (gpCom_ModuleIDCallbackTable[i].handleCallback != NULL) + { + gpCom_ModuleIDCallbackTable[i].handleCallback(0, NULL, commId); + } + } +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +Bool gpCom_RegisterModule(UInt8 moduleID, gpCom_HandleCallback_t handleCallback) +{ + UIntLoop i; + //check for unknown module id + if (moduleID == GP_COM_UNKNOWN_MODULE_ID) + { + GP_ASSERT_DEV_EXT(false); // proper handling provided (might be omitted) + return false; + } + + //search for entry matching module id in binding table + //search for free entry in binding table + for (i =0;imoduleID, pPacket->length, pPacket->packet[0]); + + //Execute packet content + Com_Execute(pPacket); + + //Free handled packet memory + Com_FreePacket(pPacket); + } +} + +void Com_cbPacketReceived(gpCom_Packet_t* pPacket) +{ +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) + if (gpCom_TxLocked) + { + { + gpCom_TxLocked = false; + Com_TriggerTx(pPacket->commId); + } + } +#endif + + +#if defined(GP_COM_DIVERSITY_PACKET_FILTERING) && defined(GP_COM_COMM_ID_IOCTL_KERN) + // Check if the packet should be dropped: + UInt8 queueUsagePer = gpCom_RxBufferUsagePercent(); + if(gpCom_FilterIsPacketToReject(queueUsagePer, pPacket)) + { + Com_FreePacket(pPacket); + return; + } +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + + //GP_LOG_SYSTEM_PRINTF("Add:%x l:%u %lx [%x", 0, state->moduleID, state->length, (unsigned long)state->commId, state->pPacket->packet[0]); + if(!Com_AddPendingPacket(pPacket)) + { + Com_FreePacket(pPacket); + GP_LOG_SYSTEM_PRINTF("No space to handle",0); + GP_ASSERT_SYSTEM(false); + return; + } +#ifdef GP_FREERTOS_DIVERSITY_NO_GPSCHED + hal_FreeRTOSSchedTaskNotify(); +#endif //GP_FREERTOS_DIVERSITY_NO_GPSCHED + + gpSched_Trigger(); +} + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +UInt16 gpCom_ClaimedBuffersCnt(void) +{ + UInt8 i; + UInt16 bufClaimed = 0; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return 0; + } + + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(BIT_TST(gpCom_PacketBufferClaimed[i / BITS_IN_BYTE], i % BITS_IN_BYTE)) + { + bufClaimed++; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + return bufClaimed; +} + +UInt8 gpCom_RxBufferUsagePercent(void) +{ + return ((gpCom_ClaimedBuffersCnt() * 100) / GP_COM_RX_PACKET_BUFFERS); +} + +Bool gpCom_AddFilter(UInt8 moduleId, UInt8 bufferUsageThresh, UInt8 patternsCnt, const gpCom_FilterPattern_t* patterns) +{ + UInt8 i; + UInt8 idx; + + if(!patterns || (patternsCnt > GP_COM_FILTER_PATTERN_MAX_CNT) || (bufferUsageThresh >= 100) || (filters[GP_COM_FILTER_CNT - 1].enabled)) + { + return false; + } + + for(i = 0; i < patternsCnt; i++) + { + if(!patterns[i].len || (patterns[i].len > GP_COM_FILTER_PATTERN_MAX_LEN)) + { + return false; + } + } + + idx = getFilterIdx(bufferUsageThresh); + + if (idx >= GP_COM_FILTER_CNT) + { + return false; + } + + filters[idx].enabled = true; + filters[idx].moduleId = moduleId; + filters[idx].bufferUsageThresh = bufferUsageThresh; + filters[idx].patternsCnt = patternsCnt; + + for(i = 0; i < patternsCnt; i++) + { + memcpy(filters[idx].patterns[i].data, patterns[i].data, patterns[i].len); + + filters[idx].patterns[i].len = patterns[i].len; + filters[idx].patterns[i].offset = patterns[i].offset; + } + + return true; +} + +Bool gpCom_RemoveFilter(UInt8 moduleId, UInt8 bufferUsageThresh, UInt8 patternsCnt, const gpCom_FilterPattern_t* patterns) +{ + UInt8 i, j; + + if(!patterns) + { + return false; + } + + // Find the position of the filter to be removed + for(i = 0; i < GP_COM_FILTER_CNT; i++) + { + if(filters[i].enabled && filters[i].moduleId == moduleId + && filters[i].bufferUsageThresh == bufferUsageThresh + && patternsCnt == filters[i].patternsCnt + && isPatternEqual(patterns, filters[i].patterns, filters[i].patternsCnt)) + { + break; + } + } + + // If the filter was found, remove it and shift elements + if(i < GP_COM_FILTER_CNT - 1) + { + for(j = i; j < GP_COM_FILTER_CNT - 1; j++) + { + filters[j] = filters[j + 1]; + if(j == GP_COM_FILTER_CNT - 2) + { + filters[GP_COM_FILTER_CNT - 1].enabled = false; + } + } + } + else + { + if(i == GP_COM_FILTER_CNT - 1) + { + filters[i].enabled = false; + return true; + } + return false; + } + + return true; +} + +Bool gpCom_FilterIsPacketToReject(UInt8 queueUsagePer, gpCom_Packet_t* pPacket) +{ + return gpCom_FilterIsPacketDataToReject(queueUsagePer, pPacket->moduleID, pPacket->length, pPacket->packet, pPacket->commId); +} + +Bool gpCom_FilterIsPacketDataToReject(UInt8 queueUsagePer, UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId) +{ + UInt8 filterIdx; + UInt8 patternIdx; + Bool patternFound = false; + + for(filterIdx = 0; (filterIdx < GP_COM_FILTER_CNT) && !patternFound; filterIdx++) + { + patternFound = false; + // Check if filter is enabled and the moduleId is match: + if(!filters[filterIdx].enabled || (filters[filterIdx].moduleId != moduleID)) + { + continue; + } + + // Check the queue usage threshold (if set to 0, ignore the usage and go to the next step): + if(filters[filterIdx].bufferUsageThresh && (queueUsagePer <= filters[filterIdx].bufferUsageThresh)) + { + continue; + } + + // Check if all of the patterns are found in the packet data: + for(patternIdx = 0; patternIdx < filters[filterIdx].patternsCnt; patternIdx++) + { + patternFound = isFilterPatternInPacket(&filters[filterIdx].patterns[patternIdx], length, pData); + + if(!patternFound) + { + break; // Pattern not found, break the loop and skip to the next filter + } + } + } + + return patternFound; +} + +static Bool isFilterPatternInPacket(gpCom_FilterPattern_t* pPattern, UInt16 length, UInt8* pData) +{ + // Check if the packet is long enough to apply this filtering pattern: + if((pPattern->offset + pPattern->len) > length) + { + return false; + } + + // Compare pattern data with the packet data on given offset: + if(!memcmp(&pData[pPattern->offset], pPattern->data, pPattern->len)) + { + return true; + } + + return false; +} + +static UInt8 getFilterIdx(UInt8 threshold) +{ + UInt8 i; + int j; + + for(i = 0; i < GP_COM_FILTER_CNT; i++) + { + if(!filters[i].enabled || (filters[i].bufferUsageThresh > threshold)) + { + break; + } + } + for(j = GP_COM_FILTER_CNT - 1; j >= i; j--) + { + if(filters[i].enabled) + { + filters[j + 1] = filters[j]; + } + } + return i; +} + +static Bool isPatternEqual(const gpCom_FilterPattern_t* pInPattern, const gpCom_FilterPattern_t* pOutPattern, UInt8 patternsCnt) +{ + int i; + for(i = 0; i < patternsCnt; i++) + { + if(pInPattern[i].len == pOutPattern[i].len && pInPattern[i].offset == pOutPattern[i].offset) + { + if(memcmp(pInPattern[i].data, pOutPattern[i].data, pOutPattern[i].len)) + { + return false; + } + } + else + { + return false; + } + } + return true; +} + +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_defs.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_defs.h new file mode 100644 index 0000000..33969e7 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_defs.h @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPCOM_DEFS_H_ +#define _GPCOM_DEFS_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "gpCom.h" +#include "linux/ioctl.h" +/**************************************************************************** + * Macro Definitions + *****************************************************************************/ + + + +#define GP_COM_BLE_HEADER_LENGTH 1 + +//Shared for UART and USB +#define GP_COM_PACKET_HEADER_LENGTH 6 +#define GP_COM_PACKET_FOOTER_LENGTH 2 +#define GP_COM_PACKET_COMMID_LENGTH 4 + +#define GP_COM_MAXIMAL_COMMAND_PARAMETERS (GP_COM_MAX_PACKET_PAYLOAD_SIZE - sizeof(gpCom_CommandID_t)) + +#define GP_IOC_MAGIC 'G' + +#define GP_IOCTL_WRITE_MSG _IOW(GP_IOC_MAGIC, 1, int) +#define GP_IOCTL_READ_MSG _IOR(GP_IOC_MAGIC, 2, int) +#define GP_IOCTL_WRITE_STREAM_MSG _IOW(GP_IOC_MAGIC, 3, int) +#define GP_IOCTL_READ_STREAM_MSG _IOR(GP_IOC_MAGIC, 4, int) + +#define GP_SHMEM_MAX_PAYLOAD_LENGTH (GP_SHMEM_MSG_HEADER_LENGTHFIELD_MAX-GP_SHMEM_MSG_HEADER_LEN) + +//#ifdef GP_BSP_USB_COM +/* USB uses the buffer from uart1 */ +//#define GP_COM_NUM_UART 1 +//#endif + +#ifndef GP_BSP_UART_COM1 +//Dummy define for flush function +#define GP_BSP_UART_COM1 +#endif //GP_BSP_UART_COM1 + +#ifndef GP_BSP_UART_COM2 +#define GP_COM_NUM_UART 1 +#else +#define GP_COM_NUM_UART 2 +#endif + +#define gpCom_SynProtocol_FrameControl_CommIdIsEmbedded 0x80 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +#define gpCom_CommandIDTxOverflowIndication 0x02 +typedef UInt8 gpCom_CommandID_t; + +typedef struct gpCom_SerialPacket +{ + gpCom_CommandID_t commandID; + UInt8 commandParameters[GP_COM_MAXIMAL_COMMAND_PARAMETERS]; +} gpCom_SerialPacket_t; + +////////////////// +// TxOverflowIndication +////////////////// + +typedef struct gpCom_TxOverflowIndicationCommandParameters +{ + UInt16 numberOfMissedMessages; +}gpCom_TxOverflowIndicationCommandParameters_t; + +#define gpCom_ProtocolPacketHeader 0 +#define gpCom_ProtocolPacketCommId 1 +#define gpCom_ProtocolPacketData 2 +#define gpCom_ProtocolPacketFooter 3 +typedef UInt8 gpCom_ProtocolPacket_t; + +typedef struct gpCom_PacketHeader_s { + UInt8 length; + UInt8 moduleID; + UInt16 crc; +} gpCom_PacketHeader_t; + +typedef struct gpCom_Packet_s { + gpCom_CommunicationId_t commId; + UInt16 length; + UInt8 moduleID; + UInt8 packet[GP_COM_MAX_PACKET_PAYLOAD_SIZE]; +} gpCom_Packet_t; + +typedef struct { + gpCom_Packet_t* pPacket; + UInt16 crc; + gpCom_ProtocolPacket_t partOfPacket; //Header/data/footer + UInt16 counter; + UInt16 length; + UInt8 moduleID; + gpCom_CommunicationId_t commId; + gpCom_Protocol_t Com_protocol; +} gpCom_ProtocolState_t; + +typedef struct gpComIoctl_Buffer_s { + /* WARNING: do not change this struct. It is a binary interface between + * kernel- and usercode */ + UInt8 moduleID; + UInt16 length; + gpCom_CommunicationId_t commId; + UInt8 *pData; +} gpComIoctl_Buffer_t; + + +extern gpCom_cbActivateTx_t gpCom_ActivateTxCb[]; +extern UInt8 nbrOfgpCom_ActivateTxCbs; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +//Packet memory handlers +gpCom_Packet_t* Com_GetFreePacket(void); +void Com_FreePacket(gpCom_Packet_t* pPacket); +//Queue handler +Bool Com_AddPendingPacket(gpCom_Packet_t* pPacket); +void Com_Execute(gpCom_Packet_t * pPacket); + +void Com_InitRx(void); +void Com_ConnectionClose(gpCom_CommunicationId_t commId); +void Com_DeInitRx(void); + +//Specific parsing +#define gpCom_ProtocolDone 0 +#define gpCom_ProtocolContinue 1 +#define gpCom_ProtocolError 2 +typedef UInt8 gpCom_ProtocolStatus_t; + +//Specific parsing +gpCom_ProtocolStatus_t ComSynProtocol_ParseBuffer(UInt8 *rxbuf, UInt16 size, gpCom_ProtocolState_t* state); +gpCom_ProtocolStatus_t ComSynProtocol_ParseByte(UInt8 rxbyte, gpCom_ProtocolState_t* state); + +extern gpCom_ProtocolState_t gpComUart_RxState[]; + +void Com_ParseProtocol(Int16 rxbyte, gpCom_CommunicationId_t comm_id); +void ComSerial_ParseBuffer(UInt8 *buffer, UInt16 size, gpCom_CommunicationId_t comm_id); + +#if defined(GP_DIVERSITY_COM_UART) +#define Com_FlushRxSerial() ComSerial_FlushRx(); +#else +#define Com_FlushRxSerial() +#endif + +#define Com_FlushRxIoctl() ComIoctl_FlushRx(); + +#define Com_FlushRx() do { Com_FlushRxSerial() Com_FlushRxIoctl() } while(false) + +#if defined( GP_DIVERSITY_COM_UART ) || defined(GP_COM_DIVERSITY_SERIAL_SPI) +//UART functions +extern UInt16 gpComSerial_GetPacketSize(gpCom_CommunicationId_t commId, UInt16 payloadSize); +extern void gpComSerial_Init(void); +extern Bool gpComSerial_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId); +extern UInt16 gpComSerial_GetFreeSpace(gpCom_CommunicationId_t commId); +extern Bool gpComSerial_GetTXEnable(void); +extern void gpComSerial_HandleTx(void); +extern void gpComSerial_Flush(void); +extern void gpComSerial_DeInit(void); +extern Bool gpComSerial_TXDataPending(void); +extern void ComSerial_FlushRx(void); +Bool Com_IsDataWaiting(gpCom_CommunicationId_t commId); +UInt8 Com_GetData(gpCom_CommunicationId_t commId); +#endif //defined( GP_DIVERSITY_COM_UART ) || defined( GP_DIVERSITY_COM_USB) + +#if defined( GP_DIVERSITY_COM_UART ) +void gpComUart_Init(void); +void gpComUart_DeInit(void); +void gpComUart_Flush(void); +void ComUart_FlushRx(void); +void ComUart_TriggerTx(UInt8 uart); +#endif //defined( GP_DIVERSITY_COM_UART ) + +UInt16 Com_CalculateSizeOfNewData(gpCom_CommunicationId_t commId, UInt16* sizeContinuous); + +void Com_SetDataReadPointer(gpCom_CommunicationId_t commId, UInt16 readPtr); + + + + +extern void gpComIoctl_Init(void); +extern Bool gpComIoctl_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId); +extern Bool gpComIoctl_GetTXEnable(void); +extern void gpComIoctl_HandleTx(void); +extern void gpComIoctl_Flush(void); +extern void ComIoctl_FlushRx(void); +extern void gpComIoctl_DeInit(void); +extern Bool gpComIoctl_TXDataPending(void); + + +UInt16 Com_Call_ActivateTxCb(UInt16 overFlowCounter, gpCom_CommunicationId_t commId); + +void Com_cbPacketReceived(gpCom_Packet_t* pPacket); + +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) +extern Bool gpCom_TxLocked; +#endif //#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) + +void Com_TriggerTx(gpCom_CommunicationId_t commId); + + +extern Bool gpCom_Initialized; +#ifdef GP_COM_DIVERSITY_SERIAL +extern Bool gpComSerial_Initialized; +#endif + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +UInt16 gpCom_ClaimedBuffersCnt(void); +UInt8 gpCom_RxBufferUsagePercent(void); +Bool gpCom_FilterIsPacketToReject(UInt8 queueUsagePer, gpCom_Packet_t* pPacket); +Bool gpCom_FilterIsPacketDataToReject(UInt8 queueUsagePer, UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId); +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + +#endif // _GPCOM_DEFS_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen/gpEncryption_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen/gpEncryption_marshalling.h new file mode 100644 index 0000000..1234389 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen/gpEncryption_marshalling.h @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPENCRYPTION_MARSHALLING_H_ +#define _GPENCRYPTION_MARSHALLING_H_ + +//DOCUMENTATION ENCRYPTION: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpEncryption.h" +/* AdditionalIncludes */ +#include "gpPd_marshalling.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + UInt8 pKey[16]; + UInt8 pNonce[13]; +} gpEncryption_CCMOptions_t_pointer_marshall_t; + +typedef struct { + gpEncryption_CCMOptions_t data[1]; + gpEncryption_CCMOptions_t_pointer_marshall_t memberpointers[1]; +} gpEncryption_CCMOptions_t_l1_pointer_marshall_t; + + +typedef struct { + gpEncryption_AESOptions_t data[1]; +} gpEncryption_AESOptions_t_l1_pointer_marshall_t; + + +typedef struct { + gpEncryption_CCMOptions_t* pCCMOptions; +} gpEncryption_CCMEncrypt_Input_struct_t; + +typedef struct { + gpEncryption_CCMEncrypt_Input_struct_t data; + gpEncryption_CCMOptions_t_l1_pointer_marshall_t pCCMOptions; +} gpEncryption_CCMEncrypt_Input_marshall_struct_t; + +typedef struct { + gpEncryption_Result_t result; + UInt8* pDataOut; +} gpEncryption_CCMEncrypt_Output_struct_t; + +typedef struct { + gpEncryption_CCMEncrypt_Output_struct_t data; + UInt8 pDataOut[128]; +} gpEncryption_CCMEncrypt_Output_marshall_struct_t; + + +typedef struct { + gpEncryption_CCMOptions_t* pCCMOptions; +} gpEncryption_CCMDecrypt_Input_struct_t; + +typedef struct { + gpEncryption_CCMDecrypt_Input_struct_t data; + gpEncryption_CCMOptions_t_l1_pointer_marshall_t pCCMOptions; +} gpEncryption_CCMDecrypt_Input_marshall_struct_t; + +typedef struct { + gpEncryption_Result_t result; + UInt8* pDataOut; +} gpEncryption_CCMDecrypt_Output_struct_t; + +typedef struct { + gpEncryption_CCMDecrypt_Output_struct_t data; + UInt8 pDataOut[128]; +} gpEncryption_CCMDecrypt_Output_marshall_struct_t; + + +typedef struct { + UInt8* pInplaceBuffer; + UInt8* pAesKey; + gpEncryption_AESOptions_t AESOptions; +} gpEncryption_AESEncrypt_Input_struct_t; + +typedef struct { + gpEncryption_AESEncrypt_Input_struct_t data; + UInt8 pInplaceBuffer[16]; + UInt8 pAesKey[32]; + gpEncryption_AESOptions_t_l1_pointer_marshall_t AESOptions; +} gpEncryption_AESEncrypt_Input_marshall_struct_t; + +typedef struct { + gpEncryption_Result_t result; + // pInplaceBuffer used from input structure because it is an inout parameter +} gpEncryption_AESEncrypt_Output_struct_t; + +typedef struct { + gpEncryption_AESEncrypt_Output_struct_t data; + // pInplaceBuffer used from input structure because it is an inout parameter +} gpEncryption_AESEncrypt_Output_marshall_struct_t; + + + +typedef union { + gpEncryption_CCMEncrypt_Input_marshall_struct_t gpEncryption_CCMEncrypt; + gpEncryption_CCMDecrypt_Input_marshall_struct_t gpEncryption_CCMDecrypt; + gpEncryption_AESEncrypt_Input_marshall_struct_t gpEncryption_AESEncrypt; + UInt8 dummy; //ensure none empty union definition +} gpEncryption_Server_Input_union_t; + +typedef union { + gpEncryption_CCMEncrypt_Output_marshall_struct_t gpEncryption_CCMEncrypt; + gpEncryption_CCMDecrypt_Output_marshall_struct_t gpEncryption_CCMDecrypt; + gpEncryption_AESEncrypt_Output_marshall_struct_t gpEncryption_AESEncrypt; + UInt8 dummy; //ensure none empty union definition +} gpEncryption_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpEncryption_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpEncryption_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpEncryption_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpEncryption_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpEncryption_SecLevel_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpEncryption_SecLevel_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpEncryption_SecLevel_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpEncryption_SecLevel_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpEncryption_KeyId_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpEncryption_KeyId_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpEncryption_KeyId_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpEncryption_KeyId_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpEncryption_AESKeyLen_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpEncryption_AESKeyLen_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpEncryption_AESKeyLen_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpEncryption_AESKeyLen_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +gpMarshall_AckStatus_t gpEncryption_CCMOptions_t_buf2api(gpEncryption_CCMOptions_t* pDest ,gpEncryption_CCMOptions_t_pointer_marshall_t* pDestPointers , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex , Bool storePdHandle ); +void gpEncryption_CCMOptions_t_api2buf(UInt8Buffer* pDest , const gpEncryption_CCMOptions_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpEncryption_AESOptions_t_buf2api(gpEncryption_AESOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpEncryption_AESOptions_t_api2buf(UInt8Buffer* pDest , const gpEncryption_AESOptions_t* pSource , UInt16 length , UInt16* pIndex); +// Server functions +gpMarshall_AckStatus_t gpEncryption_CCMEncrypt_Input_buf2api(gpEncryption_CCMEncrypt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_CCMEncrypt_Output_api2buf(UInt8Buffer* pDest , gpEncryption_CCMEncrypt_Output_marshall_struct_t* pSourceoutput , gpEncryption_CCMEncrypt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpEncryption_CCMDecrypt_Input_buf2api(gpEncryption_CCMDecrypt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_CCMDecrypt_Output_api2buf(UInt8Buffer* pDest , gpEncryption_CCMDecrypt_Output_marshall_struct_t* pSourceoutput , gpEncryption_CCMDecrypt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpEncryption_AESEncrypt_Input_buf2api(gpEncryption_AESEncrypt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_AESEncrypt_Output_api2buf(UInt8Buffer* pDest , gpEncryption_AESEncrypt_Output_marshall_struct_t* pSourceoutput , gpEncryption_AESEncrypt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); + +// Client functions +void gpEncryption_CCMEncrypt_Input_par2buf(UInt8Buffer* pDest , gpEncryption_CCMOptions_t* pCCMOptions , UInt16* pIndex); +void gpEncryption_CCMEncrypt_Output_buf2par(gpEncryption_Result_t* result , gpEncryption_CCMOptions_t* pCCMOptions , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_CCMDecrypt_Input_par2buf(UInt8Buffer* pDest , gpEncryption_CCMOptions_t* pCCMOptions , UInt16* pIndex); +void gpEncryption_CCMDecrypt_Output_buf2par(gpEncryption_Result_t* result , gpEncryption_CCMOptions_t* pCCMOptions , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_AESEncrypt_Input_par2buf(UInt8Buffer* pDest , UInt8* pInplaceBuffer , UInt8* pAesKey , gpEncryption_AESOptions_t AESOptions , UInt16* pIndex); +void gpEncryption_AESEncrypt_Output_buf2par(gpEncryption_Result_t* result , UInt8* pInplaceBuffer , UInt8* pAesKey , gpEncryption_AESOptions_t AESOptions , UInt8Buffer* pSource , UInt16* pIndex); + +void gpEncryption_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPENCRYPTION_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gpEncryption.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gpEncryption.h new file mode 100644 index 0000000..bd1b70e --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gpEncryption.h @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * The file gpEncryption.h contains the encryption API definitions. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _ENCRYPTION_GP_H_ +#define _ENCRYPTION_GP_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpEncryption_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/** + * @file gpEncryption.h + * + * @defgroup AES AES Encryption + * @defgroup CCM CCM Encryption and Decryption + * @defgroup INIT Initialization +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + + + /** @name gpEncryption_AESKeyLen_t */ +//@{ +/** @brief 128 bits key len */ +#define gpEncryption_AESKeyLen128 (128>>3) +/** @brief 192 bits key len */ +#define gpEncryption_AESKeyLen192 (192>>3) +/** @brief 256 bits key len */ +#define gpEncryption_AESKeyLen256 (256>>3) +/** @brief Identifier for invalid value */ +#define gpEncryption_AESKeyLenInv 0xFF +/** @typedef gpEncryption_AESKeyLen_t + * @brief gpEncryption_AESKeyLen_t possible values are: 16, 24 or 32 bytes. + * + */ +typedef UInt8 gpEncryption_AESKeyLen_t; + + +/** @struct gpEncryption_AESOptions_t + * @param gpEncryption_AESKeyLen_t + * @param This parameter is an 8bit bitmask specifying the options: bits[6:0] specify the keyid to be used (see gpEncryption_API_Manual); bit[7] indicates additional hardening +*/ +typedef struct{ + gpEncryption_AESKeyLen_t keylen; + UInt8 options; +} gpEncryption_AESOptions_t; + + +#define GP_ENCRYPTION_OPTIONS_IS_HARDENED(id) (((id) & gpEncryption_Hardened) != 0) +#define GP_ENCRYPTION_OPTIONS_GET_KEYID(id) (id & ~gpEncryption_Hardened) + +#define GP_ENCRYPTION_KEYID_IS_USER(id) (id <= gpEncryption_KeyIdUserKey7) +#define GP_ENCRYPTION_KEYID_IS_PRODUCT(id) (id == gpEncryption_KeyIdProductKey0 || id == gpEncryption_KeyIdProductKey1) +#define GP_ENCRYPTION_KEYID_IS_KEYPTR(id) (id == gpEncryption_KeyIdKeyPtr) + +/** @name gpEncryption_SecLevel_t */ +//@{ +/** @brief Mode 0 No encryption, no MIC added. */ +#define gpEncryption_SecLevelNothing 0 +/** @brief Mode 1 No encryption, 32 bit MIC added. */ +#define gpEncryption_SecLevelMIC32 1 +/** @brief Mode 2 No encryption, 64 bit MIC added. */ +#define gpEncryption_SecLevelMIC64 2 +/** @brief Mode 3 No encryption, 128 bit MIC added. */ +#define gpEncryption_SecLevelMIC128 3 +/** @brief Mode 4 Encryption of payload, no MIC added. */ +#define gpEncryption_SecLevelENC 4 +/** @brief Mode 5 Encryption of payload, 32 bit MIC added. */ +#define gpEncryption_SecLevelENC_MIC32 5 +/** @brief Mode 6 Encryption of payload, 64 bit MIC added. */ +#define gpEncryption_SecLevelENC_MIC64 6 +/** @brief Mode 7 Encryption of payload, 128 bit MIC added. */ +#define gpEncryption_SecLevelENC_MIC128 7 +/** @brief The gpEncryption_SecLevel_t type defines the IEEE Std 802.15.4 (2006) security level. +*/ +typedef UInt8 gpEncryption_SecLevel_t; + +/** @brief Convert security level into mic length */ +#define GP_ENCRYPTION_SECLEVEL2MICLENGTH(secLevel) (((secLevel&0x03)*4)==12?16:((secLevel&0x03)*4)) + +//@} + +/** @name gpEncryption_CCMOptions_t */ +//@{ +/** @brief The gpEncryption_CCMOptions structure contains all the parameters for the CCM operations. +*/ +typedef struct gpEncryption_CCMOptions { +/** @brief This field contains the pd (packet descriptor) identifier where the encryption/decryption will take place */ + gpPd_Handle_t pdHandle; +/** @brief This field contains the offset in the pd indicating the start of the data (m-data in CCM*). */ + gpPd_Offset_t dataOffset; +/** @brief This field contains the data length. This is the length of the data where the security operation will be performed (m-data in CCM*).*/ + UInt8 dataLength; +/** @brief This field contains the offset in the pd indicating the start of the auxiliary data (a-data in CCM*). */ + gpPd_Offset_t auxOffset; +/** @brief This field contains the length of the auxiliary data (a-data in CCM*). */ + UInt8 auxLength; +/** @brief This field contains the expected MIC length. */ + UInt8 micLength; +/** @brief This field contains the pointer to the encryption key. The key size is fixed to 16 bytes. */ + UInt8* pKey; +/** @brief This field contains the pointer to the nonce used for operation. The nonce length is fixed to 13 bytes. */ + UInt8* pNonce; +} gpEncryption_CCMOptions_t; +//@} + +/** @name gpEncryption_Result_t */ +//@{ +/** @brief The function returned successful. */ +#define gpEncryption_ResultSuccess 0x0 +/** @brief An invalid parameter was given as a parameter to this function. */ +#define gpEncryption_ResultInvalidParameter 0x5 +/** @brief The GP chip is busy. */ +#define gpEncryption_ResultBusy 0x7 +/** @typedef gpEncryption_Result_t + * @brief The gpEncryption_Result_t type defines the result of various encryption functions. +*/ +typedef UInt8 gpEncryption_Result_t; +//@} + +/** @name gpEncryption_Result_t */ +//@{ +/** @brief User key identifiers */ +#define gpEncryption_KeyIdUserKey0 0x00 +#define gpEncryption_KeyIdUserKey1 0x01 +#define gpEncryption_KeyIdUserKey2 0x02 +#define gpEncryption_KeyIdUserKey3 0x03 +#define gpEncryption_KeyIdUserKey4 0x04 +#define gpEncryption_KeyIdUserKey5 0x05 +#define gpEncryption_KeyIdUserKey6 0x06 +#define gpEncryption_KeyIdUserKey7 0x07 +/** @brief Product key identifiers */ +#define gpEncryption_KeyIdProductKey0 0x50 +#define gpEncryption_KeyIdProductKey1 0x51 +/** @brief Unspecified key identifier */ +#define gpEncryption_KeyIdKeyPtr 0x7E +/** @brief Unspecified key identifier */ +#define gpEncryption_KeyIdUnspecified 0x7F +typedef UInt8 gpEncryption_KeyId_t; +//@} + +/** @brief Enable additional security hardening */ +#define gpEncryption_Hardened 0x80 + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpEncryption_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + +/** + * @ingroup AES + * @brief Performs a synchronous AES Encryption. + * + * The function will encrypt 16 bytes with the AES algorithm and return the result in place. + * + * @param pInplaceBuffer Pointer to the buffer of the 16 to be encrypted bytes. The encrypted result will be returned in the same buffer. + * @param pAesKey Pointer to the 16-byte key. + * This parameter is only used when gpEncryption_KeyIdKeyPtr is specified in the options parameter. When NULL is specified in combination with gpEncryption_KeyIdKeyPtr, 0 will be used as key value. + * @param options This parameter is an 8bit bitmask specifying the options: bits[6:0] specify a keyid defined by gpEncryption_KeyId_t; bit[7] indicates additional hardening. + * @return + * - gpEncryption_ResultSuccess + * - gpEncryption_ResultBusy +*/ +GP_API gpEncryption_Result_t gpEncryption_AESEncrypt(UInt8* pInplaceBuffer, UInt8* pAesKey, gpEncryption_AESOptions_t AESoptions); + +/** + * @ingroup CCM + * @brief Performs a synchronous CCM Encryption. + * + * The function will encrypt the bytes with the CCM algorithm according to the specified options + * in the gpEncryption_CCMOptions structure. + * + * @param pCCMOptions Pointer to the gpEncryption_CCMOptions structure. + * + * @return + * - gpEncryption_ResultSuccess + * - gpEncryption_ResultBusy +*/ +GP_API gpEncryption_Result_t gpEncryption_CCMEncrypt(gpEncryption_CCMOptions_t * pCCMOptions); + +/** + * @ingroup CCM + * @brief Performs a synchronous CCM Decryption. + * + * The function will decrypt the bytes with the CCM algorithm according to the specified options + * in the gpEncryption_CCMOptions structure. + * + * @param pCCMOptions Pointer to the gpEncryption_CCMOptions structure. + * + * @return + * - gpEncryption_ResultSuccess + * - gpEncryption_ResultBusy + * - gpEncryption_ResultInvalidParameter +*/ +GP_API gpEncryption_Result_t gpEncryption_CCMDecrypt(gpEncryption_CCMOptions_t* pCCMOptions); + +/** + * @ingroup INIT + * @brief Initializes the gpEncryption component. + * + * This function initializes the gpEncryption component. It should be called before calling any other function. + * + * This primitive is typically called via the gpBaseComps_StackInit() method of the gpBaseComps component. +*/ +GP_API void gpEncryption_Init(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif //_ENCRYPTION_GP_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c new file mode 100644 index 0000000..b55f2bc --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpEncryption_marshalling.c" + * + * GPENCRYPTION + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpEncryption.h" +#include "gpEncryption_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_ENCRYPTION + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpEncryption_CCMOptions_t_buf2api(gpEncryption_CCMOptions_t* pDest ,gpEncryption_CCMOptions_t_pointer_marshall_t* pDestPointers , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex , Bool storePdHandle ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + pDest->pdHandle = gpPd_GetPd(); + if(gpPd_ResultValidHandle != gpPd_CheckPdValid(pDest->pdHandle)) + { + return gpMarshall_AckStatusExecutionFailed;/* Failure to allocate handle. */ + } + if(storePdHandle && !gpPd_StorePdHandle(pDest->pdHandle,pSource[*pIndex]))/* sticky client side handle p_PdLoh has to be aasciated with server side handle. */ + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF("handle assoc failed",0); +#endif + /* Failure to associate client and server side handles causes freeing of server side handle... */ +#ifdef GP_COMP_UNIT_TEST + gpPd_FreeRealPd(pDest->pdHandle); +#else + gpPd_FreePd(pDest->pdHandle); +#endif //GP_COMP_UNIT_TEST + /* ...and causes server to indicate failure in acknowledge to client. */ + return gpMarshall_AckStatusExecutionFailed; + } + *pIndex += 1; + gpPd_Offset_t_buf2api_1(&(pDest->dataOffset), pSource, pIndex); + UInt8_buf2api_1(&(pDest->dataLength), pSource, pIndex); + gpPd_Offset_t_buf2api_1(&(pDest->auxOffset), pSource, pIndex); + UInt8_buf2api_1(&(pDest->auxLength), pSource, pIndex); + UInt8_buf2api_1(&(pDest->micLength), pSource, pIndex); + if (NULL != pDestPointers) // No IsNull byte check + { + pDest->pKey = pDestPointers->pKey; + UInt8_buf2api(pDest->pKey, pSource, 16, pIndex); + } + else + { + pDest->pKey = NULL; + } + if (NULL != pDestPointers) // No IsNull byte check + { + pDest->pNonce = pDestPointers->pNonce; + UInt8_buf2api(pDest->pNonce, pSource, 13, pIndex); + } + else + { + pDest->pNonce = NULL; + } + pDest++; + if (NULL != pDestPointers) { + pDestPointers++; + } + } + return gpMarshall_AckStatusSuccess; +} + +void gpEncryption_CCMOptions_t_api2buf(UInt8Buffer* pDest , const gpEncryption_CCMOptions_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { +#ifdef GP_COMP_UNIT_TEST + { + gpPd_Handle_t uthandle = gpPd_GetUtPd(pSource->pdHandle); + gpPd_Handle_t_api2buf_1(pDest, &uthandle, pIndex); + } +#else + gpPd_Handle_t_api2buf_1(pDest, &pSource->pdHandle, pIndex); +#endif //GP_COMP_UNIT_TEST + gpPd_Offset_t_api2buf_1(pDest , &(pSource->dataOffset), pIndex); + UInt8_api2buf_1(pDest , &(pSource->dataLength), pIndex); + gpPd_Offset_t_api2buf_1(pDest , &(pSource->auxOffset), pIndex); + UInt8_api2buf_1(pDest , &(pSource->auxLength), pIndex); + UInt8_api2buf_1(pDest , &(pSource->micLength), pIndex); + // No IsNull byte check + if (NULL != pSource->pKey) + { + UInt8_api2buf(pDest , pSource->pKey , 16, pIndex); + } + // No IsNull byte check + if (NULL != pSource->pNonce) + { + UInt8_api2buf(pDest , pSource->pNonce , 13, pIndex); + } + pSource++; + } +} + +gpMarshall_AckStatus_t gpEncryption_AESOptions_t_buf2api(gpEncryption_AESOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpEncryption_AESKeyLen_t_buf2api_1(&(pDest->keylen), pSource, pIndex); + UInt8_buf2api_1(&(pDest->options), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpEncryption_AESOptions_t_api2buf(UInt8Buffer* pDest , const gpEncryption_AESOptions_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpEncryption_AESKeyLen_t_api2buf_1(pDest , &(pSource->keylen), pIndex); + UInt8_api2buf_1(pDest , &(pSource->options), pIndex); + pSource++; + } +} + + +void gpEncryption_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_clientServerCmdId.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_clientServerCmdId.h new file mode 100644 index 0000000..d0f7c5c --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_clientServerCmdId.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRandom_clientServerCmdId.h" + * + * Random generator component + * + * Client Server Link Command IDs +*/ + +#ifndef _GPRANDOM_CLIENTSERVERCMDID_H_ +#define _GPRANDOM_CLIENTSERVERCMDID_H_ + +/***************************************************************************** + * Common timeout + *****************************************************************************/ + +#ifndef GPRANDOM_GPCOMTIMEOUT_US +#define GPRANDOM_GPCOMTIMEOUT_US 10000000UL //10s +#endif //GPRANDOM_GPCOMTIMEOUT_US + +/***************************************************************************** + * Component Specific Command IDs + *****************************************************************************/ + +#define gpRandom_GetNewSequence_CmdId 0x02 /*02*/ +#define gpRandom_CTR_DRBG_Init_CmdId 0x04 /*04*/ +#define gpRandom_CTR_DRBG_Reseed_CmdId 0x05 /*05*/ +#define gpRandom_CTR_DRBG_Generate_CmdId 0x06 /*06*/ +#define gpRandom_GetFromDRBG_CmdId 0x08 /*08*/ + +/***************************************************************************** + * Fixed Command IDs + *****************************************************************************/ + +#define gpRandom_Acknowledge_CmdId 0xfe /*254*/ +#define gpRandom_GetServerCompatibilityNumber_CmdId 0xfd /*253*/ + +#endif //_GPRANDOM_CLIENTSERVERCMDID_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_marshalling.h new file mode 100644 index 0000000..2513ddd --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_marshalling.h @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPRANDOM_MARSHALLING_H_ +#define _GPRANDOM_MARSHALLING_H_ + +//DOCUMENTATION RANDOM: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpRandom.h" +/* AdditionalIncludes */ +// manual +#include "gpRandom_CTR_DRBG.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +typedef struct { + UInt8 nmbrRandomBytes; +} gpRandom_GetNewSequence_Input_struct_t; + +typedef struct { + gpRandom_GetNewSequence_Input_struct_t data; +} gpRandom_GetNewSequence_Input_marshall_struct_t; + +typedef struct { + UInt8* pBuffer; +} gpRandom_GetNewSequence_Output_struct_t; + +typedef struct { + gpRandom_GetNewSequence_Output_struct_t data; + UInt8 pBuffer[25]; +} gpRandom_GetNewSequence_Output_marshall_struct_t; + + + + + + + +typedef struct { + UInt8 nmbrRandomBytes; +} gpRandom_GetFromDRBG_Input_struct_t; + +typedef struct { + gpRandom_GetFromDRBG_Input_struct_t data; +} gpRandom_GetFromDRBG_Input_marshall_struct_t; + +typedef struct { + UInt8* pBuffer; +} gpRandom_GetFromDRBG_Output_struct_t; + +typedef struct { + gpRandom_GetFromDRBG_Output_struct_t data; + UInt8 pBuffer[255]; +} gpRandom_GetFromDRBG_Output_marshall_struct_t; + + +typedef union { + gpRandom_GetNewSequence_Input_marshall_struct_t gpRandom_GetNewSequence; + gpRandom_GetFromDRBG_Input_marshall_struct_t gpRandom_GetFromDRBG; + UInt8 dummy; //ensure none empty union definition +} gpRandom_Server_Input_union_t; + +typedef union { + gpRandom_GetNewSequence_Output_marshall_struct_t gpRandom_GetNewSequence; + gpRandom_GetFromDRBG_Output_marshall_struct_t gpRandom_GetFromDRBG; + UInt8 dummy; //ensure none empty union definition +} gpRandom_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpRandom_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpRandom_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpRandom_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpRandom_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +// Server functions +gpMarshall_AckStatus_t gpRandom_GetNewSequence_Input_buf2api(gpRandom_GetNewSequence_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRandom_GetNewSequence_Output_api2buf(UInt8Buffer* pDest , gpRandom_GetNewSequence_Output_marshall_struct_t* pSourceoutput , gpRandom_GetNewSequence_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRandom_GetFromDRBG_Input_buf2api(gpRandom_GetFromDRBG_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRandom_GetFromDRBG_Output_api2buf(UInt8Buffer* pDest , gpRandom_GetFromDRBG_Output_marshall_struct_t* pSourceoutput , gpRandom_GetFromDRBG_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); + +// Client functions +void gpRandom_GetNewSequence_Input_par2buf(UInt8Buffer* pDest , UInt8 nmbrRandomBytes , UInt16* pIndex); +void gpRandom_GetNewSequence_Output_buf2par(UInt8 nmbrRandomBytes , UInt8* pBuffer , UInt8Buffer* pSource , UInt16* pIndex); +void gpRandom_GetFromDRBG_Input_par2buf(UInt8Buffer* pDest , UInt8 nmbrRandomBytes , UInt16* pIndex); +void gpRandom_GetFromDRBG_Output_buf2par(UInt8 nmbrRandomBytes , UInt8* pBuffer , UInt8Buffer* pSource , UInt16* pIndex); + +void gpRandom_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPRANDOM_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom.h new file mode 100644 index 0000000..b2c9394 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom.h @@ -0,0 +1,131 @@ + +/* + * Copyright (c) 2012-2013, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPRANDOM_H_ +#define _GPRANDOM_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpRandom_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +//DOCUMENTATION GENERATION: no @file required as all documented items are refered to a group + +/** + *@defgroup DEF_RANDOM General Random Definitions + * @brief The general Random Definitions + * + * The gpRandom component is intended for generation of the random number sequences. The randomness of + * the internal random number generator is configurable at compile time and if not changed, the default + * randomness is 128bits. The randomness is introduced via the call to randomize the generator and the + * consequent random numbers are produced by mashing up the random seed with 32bit based pseudo random + * generator. Unless disabled in compile time, the mashing process is modulated with time based low + * strength random generator. + * + * Note: Randomize function is lengthy and should be avoided to call it from points in code executing + * under tight timeout. + * Note: The driver is not made thread safe so care must be taken to avoid reentrancy. The consequence + * might be that two callers getting random sequences end up with highly correlated random sequences. + * + *@defgroup GEN_RANDOM General Random Public Functions + * @brief The general public Random functionality is implemented in these functions + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + /** @typedef gpRandom_Result_t + * @brief The gpRandom_Result_t type defines the result of various gpRandom functions. +*/ +typedef UInt8 gpRandom_Result_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpRandom_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + + +/**@ingroup GEN_RANDOM + * @brief This function generates new random number sequence + * + * @param pBuffer is reference to memory location where new random number sequence is to be stored + * @param nmbrRandomBytes is number of random bytes in sequence to be stored + */ +void gpRandom_GetNewSequence(UInt8 nmbrRandomBytes, UInt8* pBuffer); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +/**@ingroup GEN_RANDOM + * @brief This function seeds the generator with truly random numbers + * + * Calling this function costs a lot of time being blocked in its execution. + */ +void gpRandom_RandomizeSeed(void); + +void gpRandom_Init(void); + +void gpRandom_Reset(void); + +void gpRandom_GetFromDRBG(UInt8 nmbrRandomBytes, UInt8* pBuffer); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPRANDOM_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom_CTR_DRBG.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom_CTR_DRBG.h new file mode 100644 index 0000000..ebb3d0f --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom_CTR_DRBG.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/** + *@defgroup DEF_RANDOM_CTR_DRBG General Random CTR DRBG Definitions + * @brief The general Random CTR DRBG (Deterministic Random Bit Generator) Definitions + * + * The gpRandom_CTR_DRBG component is intended for generation of the random number sequences as specified in SP 800 90 $10.2. + * using AES256 + * + *@defgroup DEF_RANDOM_CTR_DRBG General Random Public Functions + * @brief The general Random CTR DRBG functionality is implemented in these functions + */ + + +#ifndef _GPRANDOM_CTR_DRBG_H_ +#define _GPRANDOM_CTR_DRBG_H_ + +/** @name gpRandom_Result_t */ +//@{ +/** @brief The function returned successful. */ +#define gpRandom_ResultSuccess gpHal_ResultSuccess +/** @brief An invalid parameter was given as a parameter to this function. */ +#define gpRandom_ResultInvalidParameter gpHal_ResultInvalidParameter +/** @brief The GP chip is busy. */ +#define gpRandom_ResultBusy gpHal_ResultBusy + +#ifdef __cplusplus +extern "C" { +#endif + + + /**@ingroup DEF_RANDOM_CTR_DRBG + * @brief This function Initializes the entropy + * + * @return + * - gpRandom_ResultSuccess + * - gpRandom_ResultBusy + */ +gpRandom_Result_t gpRandom_CTR_DRBG_Init(void); +/**@ingroup DEF_RANDOM_CTR_DRBG + * @brief This function implements the reseed procedure + * @return + * - gpRandom_ResultSuccess + * - gpRandom_ResultBusy + */ +gpRandom_Result_t gpRandom_CTR_DRBG_Reseed(void); +/**@ingroup DEF_RANDOM_CTR_DRBG + * @brief gpRandom_CTR_DRBG_Generate + * @param nmbrRandomBytes number of buffer in bytes + * @param pBuffer is reference to memory location where new random number sequence is to be stored + * @return + * - gpRandom_ResultSuccess + * - gpRandom_ResultBusy + * - gpRandom_ReseedRequest + */ +gpRandom_Result_t gpRandom_CTR_DRBG_Generate( UInt32 nmbrRandomBytes, UInt8 *pBuffer ); + +#ifdef __cplusplus +} +#endif + +#endif // _GPRANDOM_CTR_DRBG_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c new file mode 100644 index 0000000..dcc11a6 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRandom_marshalling.c" + * + * Random generator component + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpRandom.h" +#include "gpRandom_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_RANDOM + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +void gpRandom_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c new file mode 100644 index 0000000..3dc4b06 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRandom_marshalling_client.c" + * + * Random generator component + * + * Marshalling structures and functions +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpRandom.h" +#include "gpRandom_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_RANDOM + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpRandom_GetNewSequence_Input_par2buf(UInt8Buffer* pDest , UInt8 nmbrRandomBytes , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(nmbrRandomBytes), pIndex); +} + +void gpRandom_GetNewSequence_Output_buf2par(UInt8 nmbrRandomBytes , UInt8* pBuffer , UInt8Buffer* pSource , UInt16* pIndex) +{ + NOT_USED(nmbrRandomBytes); + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt8_buf2api(pBuffer, pSource, nmbrRandomBytes, pIndex); + } +} + + + + + +void gpRandom_GetFromDRBG_Input_par2buf(UInt8Buffer* pDest , UInt8 nmbrRandomBytes , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(nmbrRandomBytes), pIndex); +} + +void gpRandom_GetFromDRBG_Output_buf2par(UInt8 nmbrRandomBytes , UInt8* pBuffer , UInt8Buffer* pSource , UInt16* pIndex) +{ + NOT_USED(nmbrRandomBytes); + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt8_buf2api(pBuffer, pSource, nmbrRandomBytes, pIndex); + } +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c new file mode 100644 index 0000000..65b07b6 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRandom_wrapper_client.c" + * + * Random generator component + * + * Wrapper implementation +*/ + +/***************************************************************************** + * Includes Definition + *****************************************************************************/ + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpCom.h" +#include "gpModule.h" +#include "gpRandom_clientServerCmdId.h" +#include "gpRandom.h" +#include "gpRandom_marshalling.h" +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +#include "gpVersion.h" +#endif + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Functions Declaration + *****************************************************************************/ + +static void gpRandom_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId); +static void Random_HandleConnectionClose(gpCom_CommunicationId_t communicationId); + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_RANDOM +#define GP_MODULE_ID GP_COMPONENT_ID + + +#ifndef GP_RANDOM_COMM_ID +#define GP_RANDOM_COMM_ID GP_COM_DEFAULT_COMMUNICATION_ID +#endif + +#define REGISTER_MODULE(handle) GP_COM_REGISTER_MODULE(handle) +#define DATA_REQUEST(len,buf,commId) GP_COM_DATA_REQUEST(len,buf,commId) +#define DATA_REQUEST_ACKED(len,buf,commId) gpCom_DataRequestAndWaitForAck(GP_MODULE_ID, len, buf, commId, &gpRandom_reqAcked, GPRANDOM_GPCOMTIMEOUT_US, gpRandom_Acknowledge_CmdId) + +/***************************************************************************** + * Static Data + *****************************************************************************/ + +typedef union ackDataNeeded { + UInt8 dataBuf0[1+25]; + UInt8 dataBuf1[1]; + UInt8 dataBuf2[1+25+1]; + UInt8 dataBuf3[1+255]; +} ackDataNeeded_t; +static UInt8 gpRandom_ackBuffer[1 + 1 + 1 + sizeof(ackDataNeeded_t)]; +static Bool gpRandom_reqAcked; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +static Bool Random_clientApiVersionSelected = false; +#endif + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +static void Random_HandleConnectionClose(gpCom_CommunicationId_t communicationId) +{ +} + +static void gpRandom_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId) +{ +#define commandId pPayload[0] + UInt8 ackBuffer[1 + 1 + 1]; + UInt8 ackBytes = 0; /*No ack's on indication - fill in length when needed - 3+x */ + + if(pPayload == NULL) + { + Random_HandleConnectionClose(communicationId); + return; + } + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Random_clientApiVersionSelected); +#endif + + ackBuffer[0] = gpRandom_Acknowledge_CmdId; + ackBuffer[1] = gpMarshall_AckStatusSuccess; + ackBuffer[2] = commandId; + + switch(commandId) + { + + case gpRandom_Acknowledge_CmdId: + { + GP_ASSERT_SYSTEM(length <= sizeof(gpRandom_ackBuffer)); + MEMCPY(gpRandom_ackBuffer, pPayload, length); + gpRandom_reqAcked = true; + return; + } + default: + { + GP_ASSERT_DEV_INT(false); + break; + } + } +#undef commandId + if(0 < ackBytes) + { + DATA_REQUEST(ackBytes, ackBuffer, communicationId); + } +} +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +void gpRandom_SetDefaultApiVersion(gpVersion_ModuleVersionInfo_t* moduleVersionInfo) +{ + Random_clientApiVersionSelected = true; + //TBD +} +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + + +void gpRandom_DeInit(void) +{ + gpCom_DeRegisterModule(GP_MODULE_ID); +} + +void gpRandom_Init(void) +{ +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + gpVersion_ReleaseInfo_t versions[1] = {{2,0,0,0}}; + Random_clientApiVersionSelected = false; + gpVersion_RegisterModule(GP_MODULE_ID, versions,1,gpRandom_SetDefaultApiVersion); +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + REGISTER_MODULE(gpRandom_HandleIndicationClient); +} + +/***************************************************************************** + * gpRandom Require Functions + *****************************************************************************/ + +void gpRandom_GetNewSequence(UInt8 nmbrRandomBytes, UInt8* pBuffer) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Random_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRandom_GetNewSequence_CmdId; + + gpRandom_GetNewSequence_Input_par2buf(dataBuf + , nmbrRandomBytes + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RANDOM_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRandom_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRandom_GetNewSequence_CmdId == gpRandom_ackBuffer[2]); + + _index = 3; + gpRandom_GetNewSequence_Output_buf2par( + nmbrRandomBytes + , pBuffer + , gpRandom_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRandom_ackBuffer)); + +#undef commandId +} + + + + +void gpRandom_GetFromDRBG(UInt8 nmbrRandomBytes, UInt8* pBuffer) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Random_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRandom_GetFromDRBG_CmdId; + + gpRandom_GetFromDRBG_Input_par2buf(dataBuf + , nmbrRandomBytes + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RANDOM_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRandom_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRandom_GetFromDRBG_CmdId == gpRandom_ackBuffer[2]); + + _index = 3; + gpRandom_GetFromDRBG_Output_buf2par( + nmbrRandomBytes + , pBuffer + , gpRandom_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRandom_ackBuffer)); + +#undef commandId +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpStat/inc/gpStat.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpStat/inc/gpStat.h new file mode 100644 index 0000000..a225547 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpStat/inc/gpStat.h @@ -0,0 +1,242 @@ + +/* + * Copyright (c) 2009-2010, 2012, 2014-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpStat.h + * + * This file defines the generic statistics component api + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPSTAT_H_ +#define _GPSTAT_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifdef GP_FILENAME +#if defined(GP_DIVERSITY_LOG) +//Define a FileName only once for use - name comes from make environment +static const char ROM gpStatFileName[] FLASH_PROGMEM = { XSTRINGIFY(GP_FILENAME) }; +#define GP_STAT_FILENAME gpStatFileName +#endif //GP_DIVERSITY_LOG || defined(GP_STAT_DIVERSITY_GPCOM_SERVER) +#else +#define GP_STAT_FILENAME __FILE__ +#endif //GP_FILENAME + +#ifndef GP_STAT_NUMBER_OF_COUNTERS +#define GP_STAT_NUMBER_OF_COUNTERS 5 +#endif + +#ifndef GP_STAT_NUMBER_OF_MINMAX +#define GP_STAT_NUMBER_OF_MINMAX 5 +#endif + +#ifndef GP_STAT_NUMBER_OF_STOPWATCHES +#define GP_STAT_NUMBER_OF_STOPWATCHES 5 +#endif +#ifndef GP_STAT_NUMBER_OF_SAMPLES +#define GP_STAT_NUMBER_OF_SAMPLES 10 +#endif +#ifndef GP_STAT_NUMBER_OF_HEAP_SAMPLES +#define GP_STAT_NUMBER_OF_HEAP_SAMPLES 1 +#endif + +#define GP_STAT_MAX_NAME_CHARS 20 +#define GP_STAT_MAX_NAME_LENGTH 10 + + +#define GP_STAT_INIT() gpStat_Init() +#define GP_STAT_CLEAR() gpStat_Clear() + +#define GP_STAT_RESET_COUNTER(id) gpStat_ResetCounter(id) +#define GP_STAT_REGISTER_COUNTER(id,name,incrementStep) do { id = gpStat_RegisterCounter((FLASH_STRING)GEN_STR2FLASH(name), incrementStep); } while(false) +#define GP_STAT_FREE_COUNTER(id) gpStat_FreeCounter(id) +#define GP_STAT_INCREASE_COUNTER(id, value) do { if(value) gpStat_IncreaseCounter((id), (value)); } while(false) +#define GP_STAT_INCREMENT_COUNTER(id) gpStat_IncrementCounter(id) +#define GP_STAT_GET_COUNTER(id) gpStat_GetCounter(id) + +#define GP_STAT_DECLARE_COUNTERID(name) gpStat_CounterID_t name + +#define GP_STAT_REGISTER_MINMAX(id , name) do { id = gpStat_RegisterMinMax((FLASH_STRING)GEN_STR2FLASH(name)); }while(false) +#define GP_STAT_FREE_MINMAX(id) gpStat_FreeMinMax( id ) +#define GP_STAT_SET_MINMAX( id , value) gpStat_SetMinMax( id , value) +#define GP_STAT_GET_COUNT( id ) gpStat_GetCount( id ) +#define GP_STAT_GET_MIN( id ) gpStat_GetMin( id ) +#define GP_STAT_GET_MAX( id ) gpStat_GetMax( id ) +#define GP_STAT_GET_SUM( id ) gpStat_GetSum( id ) +#define GP_STAT_GET_AVERAGE( id ) gpStat_GetAverage( id ) +#define GP_STAT_GET_VARIANCE( id ) gpStat_GetVariance( id ) +#define GP_STAT_RESET_MINMAX( id ) gpStat_ResetMinMax( id ) + +#define GP_STAT_DECLARE_MINMAXID(name) gpStat_MinMaxID_t name + + +#define GP_STAT_REGISTER_STOPWATCH(id , name) do { id = gpStat_RegisterStopwatch((FLASH_STRING)GEN_STR2FLASH(name)); }while(false) +#define GP_STAT_FREE_STOPWATCH(id) gpStat_FreeStopwatch(id) +#define GP_STAT_START_STOPWATCH(id) gpStat_StartStopwatch( id ) +#define GP_STAT_STOP_STOPWATCH(id) gpStat_StopStopwatch( id ) + +#define GP_STAT_DECLARE_STOPWATCHID(name) gpStat_StopwatchID_t name + +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +#define GP_STAT_SAMPLE_TIME() gpStat_SampleTime(GP_COMPONENT_ID, GP_STAT_FILENAME, __FUNCTION__, __LINE__) +#define GP_STAT_RETURN_SAMPLING() gpStat_ReturnSamples() +#else +#define GP_STAT_SAMPLE_TIME() +#define GP_STAT_RETURN_SAMPLING() +#endif + +#define GP_STAT_SAMPLE_HEAP(heapInUse) gpStat_SampleHeap(heapInUse) +#define GP_STAT_RETURN_SAMPLING_HEAP() gpStat_ReturnSamplesHeap() + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt8 gpStat_CounterID_t; +typedef UInt8 gpStat_MinMaxID_t; +typedef UInt8 gpStat_StopwatchID_t; + +// Main statistic counter type +typedef struct gpStat_StatisticsCounter { + UInt32 counter; + char name[GP_STAT_MAX_NAME_LENGTH]; + Int8 incrementStep; +} gpStat_StatisticsCounter_t; + +// Main statistic min max type +typedef struct gpStat_StatisticsMinMax { + UInt16 count; + UInt32 min; + UInt32 max; + UInt32 sum; + UInt32 sum2; //sum of square values + char name[GP_STAT_MAX_NAME_LENGTH]; +} gpStat_StatisticsMinMax_t; + +// Main statistic min max type +typedef struct gpStat_StatisticsStopwatch { + UInt32 time; + char name[GP_STAT_MAX_NAME_LENGTH]; +} gpStat_StatisticsStopwatch_t; + + +// Serial packet typedefs +#define gpStat_CommandIDGeneralStatisticsIndication 0x02 +typedef UInt8 gpStat_CommandID_t; + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +typedef struct gpStat_StatisticInformation { + /*All counters available in gpStat*/ + UInt32 counters[GP_STAT_NUMBER_OF_COUNTERS]; +} gpStat_StatisticInformation_t; + +typedef struct gpStat_StatisticInformationPacket{ + gpStat_CommandID_t commandID; + UInt16 appID; + gpStat_StatisticInformation_t statisticInformation; +}gpStat_StatisticInformationPacket_t; +#endif + +typedef struct { + UInt32 time; + UInt16 line; + UInt8 compId; + char funcName[GP_STAT_MAX_NAME_CHARS]; + char fileName[GP_STAT_MAX_NAME_CHARS]; +} gpStat_Sample_t; + +typedef struct { + UInt32 time; + UInt32 heapInUse; +} gpStat_HeapSample_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +void gpStat_Init(void); +void gpStat_Clear(void); + +gpStat_CounterID_t gpStat_RegisterCounter(FLASH_STRING name, Int8 incrementStep); +void gpStat_FreeCounter(gpStat_CounterID_t id); +void gpStat_IncreaseCounter(gpStat_CounterID_t id, Int32 value); +void gpStat_IncrementCounter(gpStat_CounterID_t id); +UInt32 gpStat_GetCounter(gpStat_CounterID_t id); +void gpStat_ResetCounter(gpStat_CounterID_t id); + + +gpStat_MinMaxID_t gpStat_RegisterMinMax(FLASH_STRING name); +void gpStat_FreeMinMax(gpStat_MinMaxID_t id); +Bool gpStat_SetMinMax(gpStat_MinMaxID_t id , UInt32 value); +UInt32 gpStat_GetCount(gpStat_MinMaxID_t id); +UInt32 gpStat_GetMin(gpStat_MinMaxID_t id); +UInt32 gpStat_GetMax(gpStat_MinMaxID_t id); +UInt32 gpStat_GetSum(gpStat_MinMaxID_t id); +UInt32 gpStat_GetAverage(gpStat_MinMaxID_t id); +UInt32 gpStat_GetVariance(gpStat_MinMaxID_t id); +void gpStat_ResetMinMax(gpStat_MinMaxID_t id); + +gpStat_StopwatchID_t gpStat_RegisterStopwatch(FLASH_STRING name); +void gpStat_FreeStopwatch(gpStat_StopwatchID_t id); +void gpStat_StartStopwatch(gpStat_StopwatchID_t id); +UInt32 gpStat_StopStopwatch(gpStat_StopwatchID_t id); + +void gpStat_SampleTime(UInt8 componentID, FLASH_STRING filename, FLASH_STRING funcName, UInt16 line); +void gpStat_ReturnSamples(void); +void gpStat_cbReturnSample(gpStat_Sample_t sample); + +void gpStat_SampleHeap(UInt32 heapInUse); +void gpStat_ReturnSamplesHeap(void); +void gpStat_cbReturnHeapSample(gpStat_HeapSample_t sample); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +#endif // _GPSTAT_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c new file mode 100644 index 0000000..25a808e --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c @@ -0,0 +1,773 @@ + +/* + * Copyright (c) 2009-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpStat.c + * + * This file implements the generic statistics component + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +//#define GP_LOCAL_LOG + +// General includes +#include "gpStat.h" +#include "gpLog.h" +#include "gpAssert.h" + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_STAT + +#include "gpSched.h" +#define GP_STAT_GET_TIME() gpSched_GetCurrentTime() + +#define STAT_LOG_FORMAT_LENGTH 9 //"T:%lu l:%i!" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + UInt32 time; + UInt16 line; + UInt8 compId; + char funcName[GP_STAT_MAX_NAME_CHARS]; + FLASH_STRING pFileName; //Internally only storing pointer for RAM optimization +} Stat_Sample_t; + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +Bool gpStat_Initialized = false; +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +gpStat_StatisticsCounter_t gpStat_StatisticsCounters[GP_STAT_NUMBER_OF_COUNTERS]; +#endif +#if GP_STAT_NUMBER_OF_MINMAX > 0 +gpStat_StatisticsMinMax_t gpStat_StatisticsMinMax[GP_STAT_NUMBER_OF_MINMAX]; +#endif +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 +gpStat_StatisticsStopwatch_t gpStat_StatisticsStopwatches[GP_STAT_NUMBER_OF_STOPWATCHES]; +#endif +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +Stat_Sample_t gpStat_Samples[GP_STAT_NUMBER_OF_SAMPLES]; +UInt8 gpStat_SampleIndex = 0; +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 +gpStat_HeapSample_t gpStat_HeapSamples[GP_STAT_NUMBER_OF_HEAP_SAMPLES]; +UInt8 gpStat_HeapSampleIndex = 0; +#endif //GP_STAT_NUMBER_OF_HEAP_SAMPLES + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +static void Stat_DumpCounter(gpStat_StatisticsCounter_t* pCounter, Int32 increment); +static gpStat_StatisticsCounter_t* Stat_GetCounter(gpStat_CounterID_t id); +#endif +#if GP_STAT_NUMBER_OF_MINMAX > 0 +static gpStat_StatisticsMinMax_t* Stat_GetMinMax(gpStat_MinMaxID_t id); +#endif +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 +static gpStat_StatisticsStopwatch_t* Stat_GetStopwatch(gpStat_StopwatchID_t id); +#endif +#if (GP_STAT_NUMBER_OF_COUNTERS > 0) || (GP_STAT_NUMBER_OF_MINMAX > 0) || (GP_STAT_NUMBER_OF_STOPWATCHES > 0) +static void Stat_ErrorID(gpStat_CounterID_t id); +#endif +static void Stat_LogSample(Stat_Sample_t* sample); +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +static void Stat_InitSampling(void); +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 +static void Stat_InitHeapSampling(void); +#endif +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +void Stat_DumpCounter(gpStat_StatisticsCounter_t* pCounter, Int32 increment) +{ +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF("Inc cnt %s %lu (%li)",0, pCounter->name, (unsigned long int)pCounter->counter, (long int)increment); +#endif //GP_DIVERSITY_LOG +} + +gpStat_StatisticsCounter_t* Stat_GetCounter(gpStat_CounterID_t id) +{ + //Incrementstep == 0 - unused counter + if(id < GP_STAT_NUMBER_OF_COUNTERS && (gpStat_StatisticsCounters[id].incrementStep != 0)) + { + return &(gpStat_StatisticsCounters[id]); + } + else + { + return NULL; + } +} +#endif +#if GP_STAT_NUMBER_OF_MINMAX > 0 +gpStat_StatisticsMinMax_t* Stat_GetMinMax(gpStat_MinMaxID_t id) +{ + //' ' as first character in name - unused object + if(id < GP_STAT_NUMBER_OF_COUNTERS && (gpStat_StatisticsMinMax[id].name[0]!=' ')) + { + return &(gpStat_StatisticsMinMax[id]); + } + else + { + return NULL; + } +} +#endif +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 +gpStat_StatisticsStopwatch_t* Stat_GetStopwatch(gpStat_StopwatchID_t id) +{ + //' ' as first character in name - unused object + if(id < GP_STAT_NUMBER_OF_STOPWATCHES && (gpStat_StatisticsStopwatches[id].name[0]!=' ')) + { + return &(gpStat_StatisticsStopwatches[id]); + } + else + { + return NULL; + } +} +#endif +void Stat_LogSample(Stat_Sample_t* sample) +{ + //Copy filename after ':' + char buffer[STAT_LOG_FORMAT_LENGTH+GP_STAT_MAX_NAME_CHARS*2+1] = "T:%lu %i:"; + UInt8 fileNameLength= 0; + + STRNCPY_P(&buffer[STAT_LOG_FORMAT_LENGTH], sample->pFileName, GP_STAT_MAX_NAME_CHARS); + fileNameLength = min(STRLEN_P(sample->pFileName), GP_STAT_MAX_NAME_CHARS); + + buffer[STAT_LOG_FORMAT_LENGTH+fileNameLength] = ' '; + STRNCPY(&buffer[STAT_LOG_FORMAT_LENGTH+fileNameLength+1], sample->funcName, GP_STAT_MAX_NAME_CHARS); + + gpLog_Printf(sample->compId, false, (FLASH_STRING)buffer, 0, sample->time, sample->line); + gpLog_Flush(); +} +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +void Stat_InitSampling(void) +{ + //Clear samples + gpStat_SampleIndex = 0; + MEMSET((UInt8*)gpStat_Samples, 0, sizeof(Stat_Sample_t)*GP_STAT_NUMBER_OF_SAMPLES); +} +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 +void Stat_InitHeapSampling(void) +{ + gpStat_HeapSampleIndex = 0; + MEMSET((UInt8*)gpStat_HeapSamples, 0, sizeof(gpStat_HeapSamples)); +} +void Stat_LogHeapSample(gpStat_HeapSample_t* pSample) +{ + GP_LOG_SYSTEM_PRINTF("T:%lu %lu" ,0, (long unsigned int)pSample->time, (long unsigned int)pSample->heapInUse); +} +#endif +#if (GP_STAT_NUMBER_OF_COUNTERS > 0) || (GP_STAT_NUMBER_OF_MINMAX > 0) || (GP_STAT_NUMBER_OF_STOPWATCHES > 0) +void Stat_ErrorID(gpStat_CounterID_t id) +{ +#ifndef GP_LOCAL_LOG + NOT_USED(id); +#endif + GP_LOG_PRINTF("faulty ID %i",2,(UInt16)id); + GP_ASSERT_DEV_EXT(false); +} +#endif + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpStat_Init(void) +{ + if(!gpStat_Initialized) + { + gpStat_Clear(); + } + gpStat_Initialized = true; + + GP_LOG_PRINTF("Init",0); +} + +void gpStat_Clear(void) +{ + UIntLoop id = 0; + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 + for(id= 0; id < GP_STAT_NUMBER_OF_COUNTERS; id++) + { + MEMSET(gpStat_StatisticsCounters[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + gpStat_StatisticsCounters[id].incrementStep = 0; //no counting up or down + gpStat_StatisticsCounters[id].counter = 0; + } +#endif +#if GP_STAT_NUMBER_OF_MINMAX > 0 + for(id= 0; id < GP_STAT_NUMBER_OF_MINMAX; id++) + { + MEMSET(gpStat_StatisticsMinMax[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + gpStat_StatisticsMinMax[id].count = 0; + gpStat_StatisticsMinMax[id].max = 0; + gpStat_StatisticsMinMax[id].min = 0xFFFFFFFF; + gpStat_StatisticsMinMax[id].sum = 0; + gpStat_StatisticsMinMax[id].sum2 = 0; + } +#endif +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 + for(id= 0; id < GP_STAT_NUMBER_OF_STOPWATCHES; id++) + { + MEMSET(gpStat_StatisticsStopwatches[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + } +#endif +#if GP_STAT_NUMBER_OF_SAMPLES > 0 + Stat_InitSampling(); +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 + Stat_InitHeapSampling(); +#endif + NOT_USED(id); +} + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +//---------------------------------------- +// Counter +//---------------------------------------- + +gpStat_CounterID_t gpStat_RegisterCounter(FLASH_STRING name, Int8 incrementStep) +{ + gpStat_CounterID_t id; + + //Find free counter ID + for(id = 0; id < GP_STAT_NUMBER_OF_COUNTERS; id++) + { + if(gpStat_StatisticsCounters[id].incrementStep == 0) break; + } + //No free counter ID left + if(id == GP_STAT_NUMBER_OF_COUNTERS) + { + GP_LOG_PRINTF("Cnt full",0); + GP_ASSERT_DEV_EXT(false); + return 0xFF; + } + + //Copy name + //Copy untill we reach \0 character + STRNCPY_P(gpStat_StatisticsCounters[id].name, name, GP_STAT_MAX_NAME_LENGTH); + + //Set increment step + gpStat_StatisticsCounters[id].incrementStep = incrementStep; + + //Clear counter + gpStat_StatisticsCounters[id].counter = 0; + + GP_LOG_PRINTF("Cnt reg %i",2,(UInt16)id); + return id; +} + +void gpStat_FreeCounter(gpStat_CounterID_t id) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + if(pCounter) + { + GP_LOG_PRINTF("Cnt free %i",2,(UInt16)id); + pCounter->incrementStep = 0; + MEMSET(gpStat_StatisticsCounters[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + } + else + { + Stat_ErrorID(id); + } +} + +void gpStat_ResetCounter(gpStat_CounterID_t id) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + + if(pCounter) + { + GP_LOG_PRINTF("Cnt reset %i",2,(UInt16)id); + pCounter->counter = 0; + } + else + { + Stat_ErrorID(id); + } +} + +void gpStat_IncrementCounter(gpStat_CounterID_t id) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + + if(pCounter) + { + pCounter->counter += pCounter->incrementStep; + Stat_DumpCounter(pCounter, pCounter->incrementStep); + } + else + { + Stat_ErrorID(id); + } +} + +void gpStat_IncreaseCounter(gpStat_CounterID_t id, Int32 value) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + + if(pCounter) + { + pCounter->counter += value; + Stat_DumpCounter(pCounter, value); + } + else + { + Stat_ErrorID(id); + } +} + +UInt32 gpStat_GetCounter(gpStat_CounterID_t id) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + + if(pCounter) + { + return pCounter->counter; + } + else + { + Stat_ErrorID(id); + return 0xFFFFFFFF; + } +} +#endif + +#if GP_STAT_NUMBER_OF_MINMAX > 0 +//---------------------------------------- +// Min/Max +//---------------------------------------- + +gpStat_MinMaxID_t gpStat_RegisterMinMax(FLASH_STRING name) +{ + gpStat_MinMaxID_t id; + + //Find free counter ID + for(id = 0; id < GP_STAT_NUMBER_OF_COUNTERS; id++) + { + if(gpStat_StatisticsMinMax[id].name[0] == ' ') break; + } + //No free counter ID left + if(id == GP_STAT_NUMBER_OF_COUNTERS) + { + GP_LOG_PRINTF("MiMa full",0); + GP_ASSERT_DEV_EXT(false); + return 0xFF; + } + + //Copy name + //Copy untill we reach \0 character + STRNCPY_P(gpStat_StatisticsMinMax[id].name, name, GP_STAT_MAX_NAME_LENGTH); + + //Clear counter + gpStat_StatisticsMinMax[id].min = 0xffffffff; + gpStat_StatisticsMinMax[id].max = 0x0; + + GP_LOG_PRINTF("MiMa reg %i",2,(UInt16)id); + return id; +} + +void gpStat_FreeMinMax(gpStat_CounterID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + if(pMinMax) + { + GP_LOG_PRINTF("MinMax free %i",2,(UInt16)id); + MEMSET(gpStat_StatisticsMinMax[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + } + else + { + Stat_ErrorID(id); + } +} + +Bool gpStat_SetMinMax(gpStat_MinMaxID_t id , UInt32 value) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + Bool overflow = false; + + if(pMinMax) + { + //count overflow + if(pMinMax->count == 0xFFFF) + { + overflow = true; + } + pMinMax->count++; + + //sum overflow + if(0xFFFFFFFF-value <= pMinMax->sum) + { + overflow = true; + } + pMinMax->sum += value; + + //sum2 overflows + if((value >= 0xFFFF) || (0xFFFFFFFF-(value*value) <= pMinMax->sum2)) + { + overflow = true; + } + pMinMax->sum2 += (value*value) ; + + if(pMinMax->max < value ) + { + pMinMax->max = value; + } + + if(pMinMax->min > value ) + { + pMinMax->min = value; + } + //Stat_DumpCounter(pCounter, pCounter->incrementStep); + } + else + { + Stat_ErrorID(id); + } + + return overflow; +} + +UInt32 gpStat_GetCount(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + return pMinMax->count; + } + + Stat_ErrorID(id); + return 0; +} + +UInt32 gpStat_GetMin(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + return pMinMax->min; + } + + Stat_ErrorID(id); + return 0xFFFFFFFF; +} + +UInt32 gpStat_GetMax(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + return pMinMax->max; + } + + Stat_ErrorID(id); + return 0; +} + +UInt32 gpStat_GetSum(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + return pMinMax->sum; + } + + Stat_ErrorID(id); + return 0; +} + +UInt32 gpStat_GetAverage(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + if(pMinMax->count == 0) + { + return 0; + } + return (pMinMax->sum / pMinMax->count); + } + + Stat_ErrorID(id); + return 0; +} + +UInt32 gpStat_GetVariance(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + if(pMinMax->count == 0) + { + return 0; + } + return (pMinMax->sum2 / pMinMax->count) - ((pMinMax->sum / pMinMax->count)*(pMinMax->sum / pMinMax->count)); + } + else + { + Stat_ErrorID(id); + return 0; + } +} + +void gpStat_ResetMinMax(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + GP_LOG_PRINTF("MiMa reset %i",2,(UInt16)id); + pMinMax->count = 0; + pMinMax->min = 0xFFFFFFFF; + pMinMax->max = 0; + pMinMax->sum = 0; + pMinMax->sum2 = 0; + } + else + { + Stat_ErrorID(id); + } +} +#endif + +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 +//---------------------------------------- +// Stopwatches +//---------------------------------------- + +gpStat_StopwatchID_t gpStat_RegisterStopwatch(FLASH_STRING name) +{ + gpStat_StopwatchID_t id; + + //Find free counter ID + for(id = 0; id < GP_STAT_NUMBER_OF_STOPWATCHES; id++) + { + if(gpStat_StatisticsStopwatches[id].name[0] == ' ') break; + } + //No free counter ID left + if(id == GP_STAT_NUMBER_OF_STOPWATCHES) + { + GP_LOG_PRINTF("Stopwatch full",0); + GP_ASSERT_DEV_EXT(false); + return 0xFF; + } + + //Copy name + //Copy untill we reach \0 character + STRNCPY_P(gpStat_StatisticsStopwatches[id].name, name, GP_STAT_MAX_NAME_LENGTH); + + //Clear counter + gpStat_StatisticsStopwatches[id].time = 0; + + GP_LOG_PRINTF("Stopwatch reg %i",2,(UInt16)id); + return id; +} + +void gpStat_FreeStopwatch(gpStat_StopwatchID_t id) +{ + gpStat_StatisticsStopwatch_t* pStopwatch = Stat_GetStopwatch(id); + + if(pStopwatch) + { + GP_LOG_PRINTF("Stopwatch free %i",2,(UInt16)id); + MEMSET(gpStat_StatisticsStopwatches[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + } + else + { + Stat_ErrorID(id); + } +} + +void gpStat_StartStopwatch(gpStat_StopwatchID_t id) +{ + gpStat_StatisticsStopwatch_t* pStopwatch = Stat_GetStopwatch(id); + + if(pStopwatch) + { + pStopwatch->time = GP_STAT_GET_TIME(); + } + else + { + Stat_ErrorID(id); + } +} + +UInt32 gpStat_StopStopwatch(gpStat_StopwatchID_t id) +{ + gpStat_StatisticsStopwatch_t* pStopwatch = Stat_GetStopwatch(id); + + if(pStopwatch) + { + UInt32 time = GP_STAT_GET_TIME(); + + if(time >= pStopwatch->time) //check if no overflow is triggered + { + return (time - pStopwatch->time); + } + } + else + { + Stat_ErrorID(id); + } + + return 0xFFFFFFFF; +} +#endif + +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +//---------------------------------------- +// Sampling +//---------------------------------------- + +void gpStat_SampleTime(UInt8 compId, FLASH_STRING filename, FLASH_STRING funcName, UInt16 line) +{ + UInt32 currentTime; + Stat_Sample_t* pSample; + + currentTime = GP_STAT_GET_TIME(); + + //Circular buffer - not using modulo for speed + gpStat_SampleIndex = (gpStat_SampleIndex < (GP_STAT_NUMBER_OF_SAMPLES-1)) ? (gpStat_SampleIndex+1) : 0; + + //Store sample info + pSample = &gpStat_Samples[gpStat_SampleIndex]; + + pSample->compId = compId; + pSample->line = line; + pSample->pFileName = filename; + STRNCPY_P(pSample->funcName, funcName, GP_STAT_MAX_NAME_CHARS); + pSample->time = currentTime; + + //gpLog_Printf(compId, true, funcName, 0); + //GP_LOG_SYSTEM_PRINTF("Sample overhead:%lu %i",0,GP_STAT_GET_TIME()-currentTime, (UInt16)gpStat_SampleIndex); +} + +//API functions + +void gpStat_ReturnSamples(void) +{ + UIntLoop i; + for(i = 1; i < GP_STAT_NUMBER_OF_SAMPLES+1; i++) + { + //Start from oldest sample - current index refers to last filled in sample + Stat_Sample_t* pSample = &gpStat_Samples[(gpStat_SampleIndex+i) % GP_STAT_NUMBER_OF_SAMPLES]; + + if (pSample->compId != 0) + { +#ifdef GP_DIVERSITY_LOG + Stat_LogSample(pSample); +#endif //GP_DIVERSITY_LOG + } + } + Stat_InitSampling(); +} + +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 +//Measuring general consumption - some filtering can be applied on short term changes and size jumps +#define GP_STAT_HEAP_SAMPLE_SIZE_RESOLUTION 0 //amount of bytes +#define GP_STAT_HEAP_SAMPLE_TIME_RESOLUTION 5000 //5ms + +void gpStat_SampleHeap(UInt32 heapInUse) +{ + UInt32 currentTime; + gpStat_HeapSample_t* pSample; + + currentTime = GP_STAT_GET_TIME(); + + if((dist(heapInUse, gpStat_HeapSamples[gpStat_HeapSampleIndex].heapInUse) <= GP_STAT_HEAP_SAMPLE_SIZE_RESOLUTION) || /*difference granularity*/ + (dist(currentTime, gpStat_HeapSamples[gpStat_HeapSampleIndex].time) < GP_STAT_HEAP_SAMPLE_TIME_RESOLUTION) /*time granularity */ + ) + { + //Don't sample if there is little change or it's a rapid fluctuation + return; + } + + //Circular buffer - not using modulo for speed + gpStat_HeapSampleIndex = (gpStat_HeapSampleIndex < (number_of_elements(gpStat_HeapSamples)-1)) ? (gpStat_HeapSampleIndex+1) : 0; + + //Store sample info + pSample = &gpStat_HeapSamples[gpStat_HeapSampleIndex]; + + pSample->time = currentTime; + pSample->heapInUse = heapInUse; +} + +void gpStat_ReturnSamplesHeap(void) +{ + UIntLoop i; + for(i = 1; i < number_of_elements(gpStat_HeapSamples)+1; i++) + { + //Start from oldest sample - current index refers to last filled in sample + gpStat_HeapSample_t* pSample = &gpStat_HeapSamples[(gpStat_HeapSampleIndex+i) % number_of_elements(gpStat_HeapSamples)]; + + if (pSample->time != 0) + { +#ifdef GP_DIVERSITY_LOG + Stat_LogHeapSample(pSample); + gpLog_Flush(); +#endif //GP_DIVERSITY_LOG + } + } + Stat_InitHeapSampling(); +} +#endif //GP_STAT_NUMBER_OF_HEAP_SAMPLES + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/inc/gpUtils.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/inc/gpUtils.h new file mode 100644 index 0000000..1010b43 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/inc/gpUtils.h @@ -0,0 +1,355 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpUtils.h + * + * This file contains the API of the Utils component. This component implements the + * following features: + * + * - Link Lists (LL) + * - Array Lists (AL) + * - Circular buffer (CircB) + * - Stack control (stack) + * - CRC calculation (crc) + * - CRC32 calculation (crc32) + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPUTILS_H_ +#define _GPUTILS_H_ + +#ifdef GP_DIVERSITY_ROM_CODE +#include "gpUtils_RomCode.h" +#else //def GP_DIVERSITY_ROM_CODE + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "hal.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/* NOTE: When using this macro, make sure a and be are no functions + * since this will result in double evaluations! */ +#define GP_UTILS_MAX(a,b) (((a)>(b))?(a):(b)) + +#define GP_UTILS_LL_MEMORY_DECLARATION(elemType, nrOfElements) \ + typedef struct { \ + gpUtils_Link_t link; \ + elemType elem; \ + }gpUtils_ll_sub_##elemType##_t; \ + \ + typedef struct { \ + gpUtils_ll_sub_##elemType##_t sub_##elemType##_array[nrOfElements]; \ + }gpUtils_ll_##elemType##_t + +#define GP_UTILS_LL_MEMORY_ALOCATION(elemType, memoryName) \ + gpUtils_ll_##elemType##_t memoryName[1] + + +#define GP_UTILS_AL_MEMORY_DECLARATION(elemType, nrOfElements) \ + typedef struct { \ + gpUtils_ArrayListHdr_t arrayListHdr; \ + elemType elem; \ + }gpUtils_al_sub_##elemType##_t; \ + \ + typedef struct { \ + gpUtils_ArrayInfo_t bufInfo; \ + gpUtils_al_sub_##elemType##_t sub_##elemType##_array[nrOfElements]; \ + }gpUtils_al_##elemType##_t + +#define GP_UTILS_AL_MEMORY_ALOCATION(elemType, memoryName) \ + gpUtils_al_##elemType##_t memoryName[1] + +#define GP_UTILS_LL_SIZE_OF(elem_type) ((UInt32)sizeof(gpUtils_ll_sub_##elem_type##_t)) +#define GP_UTILS_AL_SIZE_OF(elem_type) ((UInt32)sizeof(gpUtils_al_sub_##elem_type##_t)) +#define GP_UTILS_AL_SIZE_BUF_INFO ((UInt32)sizeof(gpUtils_ArrayInfo_t)) + +#define GP_UTILS_LL_GET_ELEM(plnk) (void*)((UIntPtr)plnk + sizeof(gpUtils_Link_t)) +#define GP_UTILS_LL_GET_LINK(pelem) (gpUtils_Link_t*)((UIntPtr)pelem - sizeof(gpUtils_Link_t)) + +#define GP_UTILS_AL_GET_ELEM(phdr) (void*)((UIntPtr)phdr + sizeof(gpUtils_ArrayListHdr_t)) +#define GP_UTILS_AL_GET_HDR(pelem) (gpUtils_ArrayListHdr_t*)((UIntPtr)pelem - sizeof(gpUtils_ArrayListHdr_t)) +#define GP_UTILS_AL_GET_NEXT_HDR(phdr, pfre) (gpUtils_ArrayListHdr_t *)((UIntPtr)phdr + (UInt16)pfre->pbuf_info->elem_size) +#define GP_UTILS_AL_GET_PREV_HDR(phdr, pfre) (gpUtils_ArrayListHdr_t *)((UIntPtr)phdr - (UInt16)pfre->pbuf_info->elem_size) + +#define GP_UTILS_LL_IS_LIST_EMPTY(plist) (plist->plnk_first == NULL) + +#define GP_UTILS_LL_ACQUIRE_LOCK(plist) HAL_ACQUIRE_MUTEX(plist->lock) +#define GP_UTILS_LL_RELEASE_LOCK(plist) HAL_RELEASE_MUTEX(plist->lock) +#define GP_UTILS_LL_FREE_ACQUIRE_LOCK(pfre) HAL_ACQUIRE_MUTEX(pfre->lock) +#define GP_UTILS_LL_FREE_RELEASE_LOCK(pfre) HAL_RELEASE_MUTEX(pfre->lock) + + +#define GP_UTILS_END_OF_STACK +#define GP_UTILS_STACK_PATTERN +#define GP_UTILS_END_OF_ISRAM +#define GP_UTILS_INIT_STACK() + +#define GP_UTILS_CHECK_STACK_PATTERN() +#define GP_UTILS_CHECK_STACK_POINTER() +#define GP_UTILS_CHECK_STACK_USAGE() +#define GP_UTILS_DUMP_STACK_POINTER() +#define GP_UTILS_DUMP_STACK_POINTER2(x) + +#define GP_UTILS_DUMP_STACK_TRACK() +#define GP_UTILS_RESET_STACK_TRACK() +#define GP_UTILS_STACK_TRACK() + + +#define GP_UTILS_AL_ELEM_FREE 0 +#define GP_UTILS_AL_ELEM_RESERVED 1 + +#define GP_UTILS_CRC32_INITIAL_REMAINDER (UInt32)(0xFFFFFFFF) +#define GP_UTILS_CRC32_FINAL_XOR_VALUE (UInt32)(0xFFFFFFFF) + +#define GP_UTILS_LOCK_CLAIM() true +#define GP_UTILS_LOCK_RELEASE() true +#define GP_UTILS_LOCK_CHECK_CLAIMED() false + +#define RADIO_INT +#define GPCOMTXRX +#define LWIP +#define SCHEDEVENT +#define POSTPROCESSING +#define HOSTPROCESSING + +#define GP_UTILS_CPUMON_INIT() +#define GP_UTILS_CPUMON_NEW_SCHEDULER_LOOP() +#define GP_UTILS_CPUMON_PROCDONE(x) + +#define GP_UTILS_CPUMON_IRQPROLOGUE() +#define GP_UTILS_CPUMON_IRQEPILOGUE() + +#define GP_UTILS_CPUMON_HOSTPROCESSING_START() +#define GP_UTILS_CPUMON_HOSTPROCESSING_DONE() + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct gpUtils_Link { + struct gpUtils_Link* plnk_nxt; + struct gpUtils_Link* plnk_prv; +} gpUtils_Link_t; + +typedef struct { + gpUtils_Link_t* plnk_free; // List of free cells + gpUtils_Link_t* plnk_free_last; // Pointer to the last free cell for circular cell usage + HAL_CRITICAL_SECTION_DEF(lock) +} gpUtils_LinkFree_t; + +typedef struct { + gpUtils_Link_t * plnk_first; // The first element in the list + gpUtils_Link_t * plnk_last; // The last element in the list + HAL_CRITICAL_SECTION_DEF(lock) +} gpUtils_LinkList_t; + +typedef struct { + void * pfirst; // The first pointer + void * psecond; // The second pointer + HAL_CRITICAL_SECTION_DEF(lock) // common lock +} gpUtils_LinkCommon_t; + +typedef union { + gpUtils_LinkFree_t free; + gpUtils_LinkList_t list; + gpUtils_LinkCommon_t common; +} gpUtils_Links_t; + +//Padding issues for arraylists +typedef UInt8 gpUtils_ArrayListHdr_t; //The header of an arrayelement indicating if the element is in use + +typedef struct { + UInt16 elem_size; //Array list element size including header + UInt16 elem_cnt; // Array list total number of elements +} gpUtils_ArrayInfo_t; + +typedef struct { + gpUtils_ArrayInfo_t * pbuf_info; // pointer to Array buffer info at start of buffer block + gpUtils_ArrayListHdr_t * pfree; // first known free element in array list + gpUtils_ArrayListHdr_t * plast; // Last element pointer of array list (kept for calculation ease) +} gpUtils_ArrayFree_t; + +//Simple array lists (not linked) +typedef struct { + gpUtils_ArrayListHdr_t type; // value indentifying a unique ID for the list + gpUtils_ArrayInfo_t * pbuf_info; // pointer to Array buffer info at start of free list buffer block + gpUtils_ArrayListHdr_t * pfirst; // Start ptr of Arraylist + gpUtils_ArrayListHdr_t * plast; // End ptr of Arraylist +} gpUtils_ArrayList_t; + +//Circular buffer +typedef struct { + UInt8* pBuffer; // Pointer to the memory block + UInt16 size; // Size of the memory block + UInt16 readIndex; // Read index + UInt16 writeIndex; // Write index + Bool full; // Flag indicating a full buffer +} gpUtils_CircularBuffer_t; + +typedef Bool (*gpUtils_ElemCompare_t)( void* , void* ); +typedef Bool (*gpUtils_ElemCompareDelete_t)( void* , void* , Bool* ); + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +void gpUtils_WmrkSubscribe(void); + +UInt32 gpUtil_encodeBase64(const UInt8 *in_buf, const UInt32 in_len, char *out_buf, const UInt32 out_len); + + +/**************************************************************************** + **************************************************************************** + ** Linked lists ** + **************************************************************************** + ****************************************************************************/ + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpUtils_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +GP_API void gpUtils_LLInit (void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLClear (gpUtils_LinkList_t * plst); +GP_API void* gpUtils_LLNew (gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLAdd (void * pelem, gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLInsert (void * pelem, void * pelem_cur, gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLInsertBefore (void * pelem, void * pelem_cur, gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLInsertSorted (void * pelem, gpUtils_LinkList_t * plst, gpUtils_ElemCompare_t callback); +GP_API void* gpUtils_LLNewSorted (void * pelem, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre, gpUtils_ElemCompareDelete_t callback); +GP_API void gpUtils_LLUnlink (void * pelem, gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLFree (void * pelem, gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLRelease (void * pelem, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLDump (gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLDumpFree (gpUtils_LinkFree_t * pfree); +GP_API void gpUtils_LLDumpMemory (void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre); +GP_API Bool gpUtils_LLCheckConsistency(void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLDeInit(gpUtils_LinkList_t* plst); +GP_API void gpUtils_LLDeInitFree(gpUtils_LinkFree_t* pfre); + +GP_API void* gpUtils_LLGetNext(void* pelem); +GP_API void* gpUtils_LLGetPrev(void* pelem); +GP_API gpUtils_Link_t* gpUtils_LLGetLink(void* pelem); +GP_API void* gpUtils_LLGetElem(gpUtils_Link_t* plnk); +GP_API void* gpUtils_LLGetFirstElem(gpUtils_LinkList_t* plst); +GP_API void* gpUtils_LLGetLastElem(gpUtils_LinkList_t* plst); + +//Array list basic operations +GP_API void gpUtils_ALInit (void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_ArrayFree_t * pfre); +GP_API void* gpUtils_ALNew (gpUtils_ArrayFree_t* pfre); +GP_API void gpUtils_ALFree (void * pelem, gpUtils_ArrayFree_t* pfre); +GP_API void gpUtils_ALDumpFree (gpUtils_ArrayFree_t* pfre); +GP_API void gpUtils_ALClear (gpUtils_ArrayList_t* plst, gpUtils_ArrayListHdr_t type, gpUtils_ArrayFree_t* pfre); +GP_API void gpUtils_ALAdd (void * pelem, gpUtils_ArrayList_t* plst); +GP_API void gpUtils_ALUnlink (void * pelem, gpUtils_ArrayList_t* plst); +GP_API void gpUtils_ALRelease (void * pelem, gpUtils_ArrayList_t * plst, gpUtils_ArrayFree_t * pfre); +GP_API void gpUtils_ALDump (gpUtils_ArrayList_t* plst); +//GP_API void gpUtils_ALDumpMemory (gpUtils_ArrayList_t* plst, gpUtils_ArrayFree_t* pfre); +//Array list functions +GP_API void* gpUtils_ALGetNext (gpUtils_ArrayList_t * plst, void* pelem); +GP_API void* gpUtils_ALGetPrev (gpUtils_ArrayList_t * plst, void* pelem); +GP_API void* gpUtils_ALGetElem (gpUtils_ArrayListHdr_t* phdr); +GP_API gpUtils_ArrayListHdr_t* gpUtils_ALGetHdr (void* pelem); +GP_API void* gpUtils_ALGetFirstElem (gpUtils_ArrayList_t * plst); +GP_API void* gpUtils_ALGetLastElem (gpUtils_ArrayList_t * plst); +//Circular buffer basic operations +GP_API void gpUtils_CircBInit (gpUtils_CircularBuffer_t* pCircularBuffer, void * pBuffer, UInt16 size); +GP_API void gpUtils_CircBClear (gpUtils_CircularBuffer_t* pCircularBuffer); +GP_API UInt16 gpUtils_CircBAvailableData (gpUtils_CircularBuffer_t* pCircularBuffer); +GP_API UInt16 gpUtils_CircBAvailableSpace (gpUtils_CircularBuffer_t* pCircularBuffer); +GP_API Bool gpUtils_CircBWriteData (gpUtils_CircularBuffer_t* pCircularBuffer, UInt8* pData, UInt16 length); +GP_API Bool gpUtils_CircBWriteByte (gpUtils_CircularBuffer_t* pCircularBuffer, UInt8 Data); +GP_API Bool gpUtils_CircBReadData (gpUtils_CircularBuffer_t* pCircularBuffer, UInt8* pData, UInt16 length); +GP_API Bool gpUtils_CircBReadByte (gpUtils_CircularBuffer_t* pCircularBuffer, UInt8* pData); +GP_API Bool gpUtils_CircBGetData (gpUtils_CircularBuffer_t* pCircularBuffer, UInt16 index, UInt8* pData, UInt16 length); +GP_API Bool gpUtils_CircBGetByte (gpUtils_CircularBuffer_t* pCircularBuffer, UInt16 index, UInt8* pData); + + +//Crc checking +GP_API UInt16 gpUtils_CalculateCrc(UInt8* pData , UInt16 length); +GP_API void gpUtils_UpdateCrc(UInt16* pCRCValue, UInt8 Data); +GP_API void gpUtils_CalculatePartialCrc(UInt16* pCrcValue, UInt8* pData, UInt16 length); + +//Crc CCITT-16 +GP_API UInt16 gpUtils_CalculateKermitCrc(UInt8 *pData, UInt16 length); + +//Crc32 checking +GP_API UInt32 gpUtils_CalculateCrc32(UInt8* pData , UInt32 length); +GP_API void gpUtils_UpdateCrc32(UInt32* pCRCValue, UInt8 Data); +GP_API void gpUtils_CalculatePartialCrc32(UInt32* pCrcValue, UInt8* pData, UInt32 length); + +//Global lock +GP_API Bool gpUtils_LockClaim(void); +GP_API Bool gpUtils_LockRelease(void); +GP_API Bool gpUtils_LockCheckClaimed(void); + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +void gpUtils_LLLockCreate(gpUtils_Links_t *plst); +void gpUtils_LLLockDestroy(gpUtils_Links_t * plst); +void gpUtils_LLLockAcquire(gpUtils_Links_t * plst); +void gpUtils_LLLockRelease(gpUtils_Links_t * plst); +Bool gpUtils_LLLockIsValid(gpUtils_Links_t * plst); +Bool gpUtils_LLLockIsAcquired(gpUtils_Links_t * plst); + +#ifdef __cplusplus +} +#endif + +#endif //def GP_DIVERSITY_ROM_CODE + +#endif // _GPUTILS_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c new file mode 100644 index 0000000..aa3b71f --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c @@ -0,0 +1,355 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, 2021-2022, Qorvo Inc + * + * gpUtils_LL.c + * + * This file contains the link list features of the Utils component. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +void Utils_InsertBound(gpUtils_Link_t* plnk, gpUtils_LinkList_t* plst); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +void gpUtils_LLLockCreate(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + hal_MutexCreate(&plst->common.lock); +#endif +} + +void gpUtils_LLLockDestroy(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + hal_MutexDestroy(&plst->common.lock); +#endif +} + +void gpUtils_LLLockAcquire(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + hal_MutexAcquire(plst->common.lock); +#else + hal_MutexAcquire(NULL); +#endif +} + +void gpUtils_LLLockRelease(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + hal_MutexRelease(plst->common.lock); +#else + hal_MutexRelease(NULL); +#endif +} + +Bool gpUtils_LLLockIsValid(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + return hal_MutexIsValid(plst->common.lock); +#else + return hal_MutexIsValid(NULL); +#endif +} + +Bool gpUtils_LLLockIsAcquired(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + return hal_MutexIsAcquired(plst->common.lock); +#else + return hal_MutexIsAcquired(NULL); +#endif +} + +void Utils_InsertBound(gpUtils_Link_t* plnk, gpUtils_LinkList_t* plst) +{ + // Insert the element that has its insertion point filled in + // To be executed atomically before specifying the insertion point! + + // If there is a next element, point it to me + // or adjust the last-pointer + if(plnk->plnk_nxt) + { + plnk->plnk_nxt->plnk_prv = plnk; + } + else + { + plst->plnk_last = plnk; + } + // If there is a previous element, point it to me + // or adjust the first-pointer + if(plnk->plnk_prv) + { + plnk->plnk_prv->plnk_nxt = plnk; + } + else + { + plst->plnk_first = plnk; + } +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpUtils_LLInit(void* buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkFree_t* pfre) +{ + void* plnk_org = buf; // Remember start of the list + UInt32 i; + gpUtils_Link_t* plnk = (gpUtils_Link_t*)buf; + + // Init linked list + // Point the next-pointer of every cell to the link struct of the next cell + // To initialize the private contents of every cell itself is up to the user + // Every cell may have a payload or a pointer to a payload embedded + for(i = 0; i < (n_nr_of_elements - 1); i++) + { + plnk->plnk_nxt = (gpUtils_Link_t*)((UIntPtr)plnk + (UInt16)n_size_cell /*+ (UInt16)sizeof(gpUtils_Link_t)*/); + plnk = plnk->plnk_nxt; + } + plnk->plnk_nxt = NULL; + // Assign the free-pointers + // Hook the last-pointer to the last cell to be able to have circular usage of the free-list + // Used cells will be returned to the end of the list + pfre->plnk_free_last = plnk; + pfre->plnk_free = plnk_org; + if(!gpUtils_LLLockIsValid((gpUtils_Links_t*)pfre)) + { + gpUtils_LLLockCreate((gpUtils_Links_t*)pfre); + } + GP_ASSERT_DEV_EXT(gpUtils_LLLockIsValid((gpUtils_Links_t*)pfre)); +} + +void gpUtils_LLClear(gpUtils_LinkList_t* plst) +{ + HAL_DISABLE_GLOBAL_INT(); + // Clear the list + plst->plnk_first = plst->plnk_last = NULL; + if(!gpUtils_LLLockIsValid((gpUtils_Links_t*)plst)) + { + gpUtils_LLLockCreate((gpUtils_Links_t*)plst); + } + GP_ASSERT_DEV_EXT(gpUtils_LLLockIsValid((gpUtils_Links_t*)plst)); + HAL_ENABLE_GLOBAL_INT(); +} + +void* gpUtils_LLNew(gpUtils_LinkFree_t* pfre) +{ + // Get a fresh element from the free-list + gpUtils_Link_t* p_cell; + + // Check if AtomicOn + GP_ASSERT_DEV_EXT(pfre && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)pfre)); + if(pfre) + { + // Get element from start of queue + if(!(p_cell = pfre->plnk_free)) + return NULL; // exit if no more element available + + // Move the free-pointer + pfre->plnk_free = pfre->plnk_free->plnk_nxt; + + // This might have been the last element in the list + if(!pfre->plnk_free) + { + pfre->plnk_free_last = pfre->plnk_free; + } + } + else + { + p_cell = NULL; + } + + if(p_cell) + { + return GP_UTILS_LL_GET_ELEM(p_cell); + } + else + { + return NULL; + } +} + +void gpUtils_LLAdd(void* pelem, gpUtils_LinkList_t* plst) +{ + gpUtils_Link_t* plnk; + // Add the element to the end of the list + // Check if AtomicOn + GP_ASSERT_DEV_EXT(plst && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)plst)); + GP_ASSERT_DEV_EXT(pelem); + plnk = GP_UTILS_LL_GET_LINK(pelem); + // Set the link pointers + plnk->plnk_prv = plst->plnk_last; + plnk->plnk_nxt = 0; + // Insert the element + Utils_InsertBound(plnk, plst); +} + +void gpUtils_LLInsertBefore(void* pelem, void* pelem_cur, gpUtils_LinkList_t* plst) +{ + gpUtils_Link_t* plnk; + gpUtils_Link_t* plnk_cur; + // Insert the element after the current position + // UNTESTED + // Check if AtomicOn + GP_ASSERT_DEV_EXT(plst && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)plst)); + + plnk = GP_UTILS_LL_GET_LINK(pelem); + plnk_cur = GP_UTILS_LL_GET_LINK(pelem_cur); + + // Set the link pointers + plnk->plnk_prv = plnk_cur->plnk_prv; + plnk->plnk_nxt = plnk_cur; + + // Insert the element + Utils_InsertBound(plnk, plst); +} + +void gpUtils_LLUnlink(void* pelem, gpUtils_LinkList_t* plst) +{ + gpUtils_Link_t* plnk; + // Remove the element from the list + // Check if AtomicOn + GP_ASSERT_DEV_EXT(plst && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)plst)); + + if(!pelem) + { + GP_ASSERT_DEV_EXT(false); + } + + plnk = GP_UTILS_LL_GET_LINK(pelem); + // If there is a previous element, point it to my next + // or adjust the first-pointer + if(plnk->plnk_prv) + { + plnk->plnk_prv->plnk_nxt = plnk->plnk_nxt; + } + else + { + plst->plnk_first = plnk->plnk_nxt; + } + // If there is a next element, point it to my previous + // or adjust the last-pointer + if(plnk->plnk_nxt) + { + plnk->plnk_nxt->plnk_prv = plnk->plnk_prv; + } + else + { + plst->plnk_last = plnk->plnk_prv; + } +} + +void gpUtils_LLFree(void* pelem, gpUtils_LinkFree_t* pfre) +{ + gpUtils_Link_t* plnk; + // Return the unlinked element to end of free-queue + + // Check if AtomicOn + GP_ASSERT_DEV_EXT(pfre && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)pfre)); + + if(!pelem) + { + GP_ASSERT_DEV_EXT(false); + } + + plnk = GP_UTILS_LL_GET_LINK(pelem); + // Link this element behind the last + if(pfre->plnk_free_last) + { + pfre->plnk_free_last->plnk_nxt = plnk; + } + // And move the last-pointer + pfre->plnk_free_last = plnk; + // This is the last element + plnk->plnk_nxt = 0; + // This might be the first element in the list + if(!pfre->plnk_free) + { + pfre->plnk_free = plnk; + } +} + +void* gpUtils_LLGetFirstElem(gpUtils_LinkList_t* plst) +{ + void* pelem = (void*)((UInt8*)plst->plnk_first + sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(plst && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)plst)); + return plst->plnk_first ? pelem : NULL; +} + +void gpUtils_LLDeInit(gpUtils_LinkList_t* plst) +{ + if(gpUtils_LLLockIsValid((gpUtils_Links_t*)plst)) + { + gpUtils_LLLockDestroy((gpUtils_Links_t*)plst); + } +} + +void gpUtils_LLDeInitFree(gpUtils_LinkFree_t* pfre) +{ + if(gpUtils_LLLockIsValid((gpUtils_Links_t*)pfre)) + { + gpUtils_LLLockDestroy((gpUtils_Links_t*)pfre); + } +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c new file mode 100644 index 0000000..5205232 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c @@ -0,0 +1,298 @@ +/* + * Copyright (c) 2008-2013, 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpUtils_LLext.c + * + * This file contains the less used functions of the Linked Lists + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +extern void Utils_InsertBound(gpUtils_Link_t * plnk, gpUtils_LinkList_t * plst); + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void +gpUtils_LLInsert (void * pelem, void * pelem_cur, gpUtils_LinkList_t * plst) { + gpUtils_Link_t* plnk; + gpUtils_Link_t* plnk_cur; + // Insert the element at the current position + // UNTESTED + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + //HAL_DISABLE_GLOBAL_INT(); + plnk = GP_UTILS_LL_GET_LINK(pelem); + plnk_cur = GP_UTILS_LL_GET_LINK(pelem_cur); + // Set the link pointers + plnk->plnk_prv = plnk_cur; + plnk->plnk_nxt = plnk_cur->plnk_nxt; + // Insert the element + Utils_InsertBound (plnk, plst); + //HAL_ENABLE_GLOBAL_INT(); +} + +void +gpUtils_LLInsertSorted (void * pelem, gpUtils_LinkList_t * plst, gpUtils_ElemCompare_t callback) +{ + gpUtils_Link_t* plnk; + void* pelemFound = NULL; + + GP_ASSERT_DEV_EXT(pelem); + + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + //HAL_DISABLE_GLOBAL_INT(); + + // Search position in the sorted list + for (plnk = plst->plnk_first; plnk; plnk = plnk->plnk_nxt) + { + pelemFound = GP_UTILS_LL_GET_ELEM(plnk); + if (callback(pelem,pelemFound)) + break; + } + if (plnk) + { + gpUtils_LLInsertBefore(pelem, pelemFound, plst); + } + else + { + gpUtils_LLAdd(pelem,plst); + } +} + +void* +gpUtils_LLNewSorted (void * pelem, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre, gpUtils_ElemCompareDelete_t callback) +{ + void* preturn = gpUtils_LLNew(pfre); + Bool betterElemThanLast = true; + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + //HAL_DISABLE_GLOBAL_INT(); + + // If last element is better than last, element can always be added (it can alays replace the last element) + // If it is not better, then it can only be added if a free element exists in the free list + if (!preturn) + { + gpUtils_Link_t* plnk; + void* pelem_last; + Bool canBeDeleted; + for (plnk = plst->plnk_last; plnk; plnk = plnk->plnk_prv) + { + pelem_last = GP_UTILS_LL_GET_ELEM(plnk); + + betterElemThanLast = callback(pelem,pelem_last,&canBeDeleted); + if (betterElemThanLast) + { + if (canBeDeleted) + { + // return last element + preturn = pelem_last; + gpUtils_LLUnlink(preturn, plst); + break; + } + } + else + break; + } + } + return preturn; +} + +void +gpUtils_LLRelease (void * pelem, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre) { + // Remove the element from the list and return to the free-list + gpUtils_LLUnlink (pelem, plst); + gpUtils_LLFree (pelem, pfre); +} + +void gpUtils_LLDump (gpUtils_LinkList_t * plst) +{ + gpUtils_Link_t* plnk; + HAL_DISABLE_GLOBAL_INT(); + GP_LOG_PRINTF("Dump LL:",0); + GP_LOG_PRINTF("First:%p, Last:%p",4,plst->plnk_first,plst->plnk_last); + for (plnk = plst->plnk_first;plnk;plnk = plnk->plnk_nxt) + { + GP_LOG_PRINTF("this:%p/%p,prev:%p,nxt:%p,data:%i",10,plnk,GP_UTILS_LL_GET_ELEM(plnk),plnk->plnk_prv,plnk->plnk_nxt,*(Char*)(GP_UTILS_LL_GET_ELEM(plnk))); + } + GP_LOG_PRINTF("End Dump LL:",0); + HAL_ENABLE_GLOBAL_INT(); +} + +void gpUtils_LLDumpFree (gpUtils_LinkFree_t * pfree) +{ + UInt8 Counter = 0; + gpUtils_Link_t* plnk; + HAL_DISABLE_GLOBAL_INT(); + GP_LOG_PRINTF("DumpFree LL:",0); + GP_LOG_PRINTF("First:%p, Last:%p",4,pfree->plnk_free,pfree->plnk_free_last); + for (plnk = pfree->plnk_free;plnk && Counter<10;plnk = plnk->plnk_nxt) + { + GP_LOG_PRINTF("this:%p/%p,prev:%p,nxt:%p,data:%i",10,plnk,GP_UTILS_LL_GET_ELEM(plnk),plnk->plnk_prv,plnk->plnk_nxt,*(Char*)(GP_UTILS_LL_GET_ELEM(plnk))); + Counter++; + } + GP_LOG_PRINTF("End Dump LL:",0); + HAL_ENABLE_GLOBAL_INT(); +} + +void +gpUtils_LLDumpMemory (void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre ) { + UInt32 i; + gpUtils_Link_t* plnk = (gpUtils_Link_t*)buf; + + NOT_USED(pfre); + NOT_USED(plst); + + GP_LOG_PRINTF("Lf%p Ll%p Ff%p Fl%p",8,plst->plnk_first,plst->plnk_last,pfre->plnk_free,pfre->plnk_free_last); + for (i = 0; i < n_nr_of_elements; i++) { + GP_LOG_PRINTF("@%p <%p %p>",6,plnk,plnk->plnk_prv, plnk->plnk_nxt); + //GP_LOG_PRINTF("d:%x %x %x %x %x",10, plnk->plnk_nxt[1], plnk->plnk_nxt[2], plnk->plnk_nxt[3], plnk->plnk_nxt[4], plnk->plnk_nxt[5]); + plnk = (gpUtils_Link_t *) ((UIntPtr) plnk + (UInt16)n_size_cell); + } +} + +Bool gpUtils_LLCheckConsistency(void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre) +{ + UInt32 ElementCounter = 0; + gpUtils_Link_t* plnk; + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + if (plst) + { + for (plnk = plst->plnk_first; plnk; plnk = plnk->plnk_nxt) + { + ElementCounter++; + if (ElementCounter > n_nr_of_elements) + { + GP_LOG_PRINTF("Err1 %"PRIu32" %"PRIu32,6, ElementCounter, n_nr_of_elements); + gpUtils_LLDumpMemory(buf, n_size_cell, n_nr_of_elements, plst, pfre); + return false; + } + } + } + if (pfre) + { + ElementCounter = 0; + for (plnk = pfre->plnk_free; plnk; plnk = plnk->plnk_nxt) + { + ElementCounter++; + if (ElementCounter > n_nr_of_elements) + { + GP_LOG_PRINTF("Err2 %"PRIu32" %"PRIu32,6, (long unsigned int)ElementCounter, (long unsigned int)n_nr_of_elements); + gpUtils_LLDumpMemory(buf, n_size_cell, n_nr_of_elements, plst, pfre); + return false; + } + } + } + return true; +} + +void* gpUtils_LLGetNext(void* pelem) +{ + gpUtils_Link_t* plnk = (gpUtils_Link_t*)((UIntPtr)pelem - sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + + return plnk->plnk_nxt?GP_UTILS_LL_GET_ELEM(plnk->plnk_nxt):NULL; +} + +void* gpUtils_LLGetPrev(void* pelem) +{ + gpUtils_Link_t* plnk = (gpUtils_Link_t*)((UIntPtr)pelem - sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + + return plnk->plnk_prv?GP_UTILS_LL_GET_ELEM(plnk->plnk_prv):NULL; +} + +gpUtils_Link_t* gpUtils_LLGetLink(void* pelem) +{ + gpUtils_Link_t* plnk = (gpUtils_Link_t*)((UIntPtr)pelem - sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + return pelem?plnk:NULL; +} + +void* gpUtils_LLGetElem(gpUtils_Link_t* plnk) +{ + void* pelem = (void*)((UIntPtr)plnk + sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + return plnk?pelem:NULL; +} + +void* gpUtils_LLGetLastElem(gpUtils_LinkList_t* plst) +{ + void* pelem = (void*)((UIntPtr)plst->plnk_last + sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + return plst->plnk_last?pelem:NULL; +} + + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c new file mode 100644 index 0000000..f03f1fb --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2017, 2019, Qorvo Inc + * + * Helper functions to encode/decode Base64 + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "gpUtils.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +/*! + * \brief Encode binary data with the Base64 scheme + * + * \param in_buf Pointer to the input buffer + * \param in_len Length of the input buffer + * \param out_buf Pointer to the output buffer + * \param out_len Length of the output buffer + * + * \return 0, on success + * N, if out_len is less than N or any of the data pointers is NULL + * in_len, if N would overflow UInt32 + * + * \notes + * * N is the minimum size of the output buffer for the given input (string termination included) + * * the output buffer is to be allocated/freed by the caller + */ +UInt32 gpUtil_encodeBase64(const UInt8 *in_buf, const UInt32 in_len, char *out_buf, const UInt32 out_len) +{ + const char *encoding_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + const UInt8 pad_len[] = { 0, 2, 1 }; + + const UInt8 *in_end = in_buf + in_len; + const UInt8 *in_p = in_buf; + + const UInt32 out_min_len = 4 * ((in_len + 2) / 3) + 1; + const char *out_end = out_buf + out_min_len; + char *out_p = out_buf; + + /* validate parameters */ + if (in_buf == NULL || out_buf == NULL || out_len < out_min_len || out_min_len < in_len) + { + /* failure, return in_len or out_min_len (N), as needed */ + return out_min_len < in_len ? in_len : out_min_len; + } + + /* fill the whole output buffer with string terminators */ + MEMSET(out_buf, 0, out_len); + + /* data loop: consume three input bytes and produce 4 output bytes */ + while (in_p < in_end) + { + UInt32 n = ((UInt32) *in_p++) << 16; + + if (in_p < in_end) + { + n += ((UInt32) *in_p++) << 8; + } + + if (in_p < in_end) + { + n += ((UInt32) *in_p++); + } + + *out_p++ = encoding_table[(n >> 3 * 6) & 0x3f]; + *out_p++ = encoding_table[(n >> 2 * 6) & 0x3f]; + *out_p++ = encoding_table[(n >> 1 * 6) & 0x3f]; + *out_p++ = encoding_table[(n >> 0 * 6) & 0x3f]; + } + + /* fix-up padding if the input size is not 0 modulo 3 */ + out_p = out_buf + out_min_len - pad_len[in_len % 3] - 1; + while (out_p < out_end - 1) + { + *out_p++ = '='; + } + + /* success */ + return 0; +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c new file mode 100644 index 0000000..d51f48f --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2008-2013, 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpUtils_crc.c + * + * This file contains the crc features of the Utils component. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +//CRC-16-IBM - x16 + x15 + x2 + 1 +//#define GP_UTILS_DIVERSITY_CRC_TABLE +static INLINE UInt16 _crc16_update(UInt16 crc, UInt8 a) +{ + int i; + + crc ^= a; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; + else + crc = (crc >> 1); + } + + return crc; +} + +static INLINE UInt16 _crc16_kermit_update(UInt16 crc, UInt8 a) +{ + UInt8 i; + UInt16 tmp; + UInt16 c; + + tmp = 0; + c = crc ^ a; + for (i = 0; i < 8; i++) + { + if ((tmp ^ c) & 0x0001) + { + tmp = (tmp >> 1) ^ 0x8408; + } + else + { + tmp = tmp >> 1; + } + + c = c >> 1; + } + crc = (crc >> 8) ^ tmp; + + return crc; +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpUtils_CalculatePartialCrc(UInt16* pCrcValue, UInt8* pData, UInt16 length) +{ + while(length--) + { + *pCrcValue = _crc16_update(*pCrcValue, *pData); + pData++; + } +} + +UInt16 gpUtils_CalculateCrc(UInt8* pData , UInt16 length) +{ + UInt16 crc_value = 0; + gpUtils_CalculatePartialCrc(&crc_value, pData, length); + + return crc_value; +} + +void gpUtils_UpdateCrc(UInt16* pCRCValue, UInt8 byte) +{ + gpUtils_CalculatePartialCrc(pCRCValue, &byte, 1); +} + +void gpUtils_CalculatePartialKermitCrc(UInt16* pCrcValue, UInt8* pData, UInt16 length) +{ + while (length--) + { + *pCrcValue = _crc16_kermit_update(*pCrcValue, *pData++); + } +} + +UInt16 gpUtils_CalculateKermitCrc(UInt8 *pData, UInt16 length) +{ + UInt16 crc_value = 0; + gpUtils_CalculatePartialKermitCrc(&crc_value, pData, length); + + return crc_value; +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c new file mode 100644 index 0000000..e2061a2 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2011, 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpUtils_crc.c + * + * This file contains the crc features of the Utils component. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "gpUtils.h" +#include "gpLog.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +#define _crc32_init(crc) /*No init of crc HW */ +static INLINE UInt32 _crc32_update(UInt32 crc, UInt8 a) +{ + UIntLoop j; + + crc= crc ^ a; + for (j=0; j<8; j++) + { + if (crc & 1) + crc = (crc>>1) ^ 0xEDB88320 ; + else + crc = crc >>1 ; + } + + return crc; +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpUtils_CalculatePartialCrc32 (UInt32* pCrcValue, UInt8* pData, UInt32 length) +{ + _crc32_init(*pCrcValue); + while(length--) + { + *pCrcValue = _crc32_update(*pCrcValue, *pData); + pData++; + } +} + +UInt32 gpUtils_CalculateCrc32(UInt8* pData , UInt32 length) +{ + UInt32 crc_value = GP_UTILS_CRC32_INITIAL_REMAINDER; + gpUtils_CalculatePartialCrc32(&crc_value, pData, length); + + return (crc_value ^ GP_UTILS_CRC32_FINAL_XOR_VALUE); +} + +void gpUtils_UpdateCrc32(UInt32* pCRCValue, UInt8 byte) +{ + gpUtils_CalculatePartialCrc32(pCRCValue, &byte, 1); +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpWmrk/inc/gpWmrk.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpWmrk/inc/gpWmrk.h new file mode 100644 index 0000000..08e11e1 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/BaseUtils/gpWmrk/inc/gpWmrk.h @@ -0,0 +1,109 @@ + +/* + * Copyright (c) 2012, 2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpWmrk.h + * + * This file defines the watermarker component api + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPWMRK_H_ +#define _GPWMRK_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +/// @brief The maximum amount tallies to be monitored (can be overruled at compilation time). +#ifndef GP_WMRK_MAX_ENTRIES +#define GP_WMRK_MAX_ENTRIES 6 +#endif +/// @brief The interval to generate a log which shows all subscribed tallies (can be overruled at compilation time). +#ifndef GP_WMRK_INTERVAL +#define GP_WMRK_INTERVAL 60000000 +#endif +/// @brief The maximum # chars to define a unique id. +#define GP_WMRK_MAX_UID_LENGTH 3 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @typedef gpWmrk_Parameters_t + * @brief The gpWmrk_Parameters_t defines the parameters required for the watermarker +*/ +typedef struct gpWmrk_Parameters { + UIntPtr softLimit; + UIntPtr deadLimit; + UIntPtr value; + char uid[GP_WMRK_MAX_UID_LENGTH]; // unique id + Bool up; // up or down counter +} gpWmrk_Parameters_t; + +/** @typedef gmrk_Id_t + * @brief The gpWmrk_Id_t defines the id used by the Watermarker, FAILURE equals 0xFF + * When a counter needs to be manipulated, the very same Id needs to be passed as argument + * + +*/ +typedef UInt8 gpWmrk_Id_t; + +/// @brief Value returned in error situations. +#define GP_WMRK_FAILURE 0xFF + +/** + * @file gpWmrk.h + * + * + * @defgroup GEN_WMRK General Watermarker functions + * @brief The general Watermarker functionality is implemented in these functions + * + * @note When a counter needs to go towards its limit gpWmrk_CntrIncr should be used despite it's direction + */ + + +#define gpWmrk_Init() +#define gpWmrk_Subscribe(params) 0 +#define gpWmrk_CntrToLimit(id) +#define gpWmrk_CntrFromLimit(id) +#define gpWmrk_CntrSet(id, val) + + +#endif // _GPWMRK_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal.h new file mode 100644 index 0000000..f038224 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal.h @@ -0,0 +1,618 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2021, Qorvo Inc + * + * hal.h + * Hardware Abstraction Layer for linux based devices. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_H_ +#define _HAL_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "global.h" +#include "gpBsp.h" + +#ifdef GP_COMP_GPHAL +#include "gpHal_MSI.h" +#endif //GP_COMP_GPHAL + +#ifdef __cplusplus +extern "C" { +#endif + +#include "hal_Extension.h" + +#include +#include +#include + +/***************************************************************************** + * TIMER + *****************************************************************************/ + + +/* This implementation uses the time of the os to keep the time */ +UInt32 hal_GetCurrentTime(void); +UInt32 hal_GetCurrentTime_1us(void); +#define HAL_TIMER_START(initialisationTime) + +#define HAL_TIMER_STOP() + +#define HAL_TIMER_GET_CURRENT_TIME(time) time = hal_GetCurrentTime() + +#define HAL_TIMER_GET_CURRENT_TIME_1US(time) time = hal_GetCurrentTime_1us() + +/***************************************************************************** + * SPI + *****************************************************************************/ + +#ifdef GP_COMP_GPHAL +int hal_spi_readRegExternal(gpHal_Address_t Address, UInt8* pData); +int hal_spi_writeRegExternal(gpHal_Address_t Address, UInt8 Data); +int hal_spi_readByteStreamExternal(gpHal_Address_t Address, UInt8 Length, UInt8* pBuffer); +int hal_spi_writeByteStreamExternal(gpHal_Address_t Address, UInt8 Length, const UInt8* pBuffer); +int hal_spi_readModifyWriteRegExternal(gpHal_Address_t Address, UInt8 mask, UInt8 Data); +#endif //GP_COMP_GPHAL + +/** @ingroup SPI + * + * This macro initializes the SPI port used to communicate with the communication controller. + * + * Configuration: + * - Microcontroller is the master, the communication controller is the slave. + * - Chip select pin is output on the microcontroller and active Low, so when initialized the chip select pin needs to be high. + * - The maximum clock speed the microcontroller can use to communicate with the comunication controller is 16 Mhz. + * - The SPI mode used to communicate is mode 3. This means sample the bit on rising edge, change value on falling edge. + * - No interrupts are used, the SPI protocol is implemented in a polled way. +*/ +#define HAL_SPI_START() + +/** @ingroup SPI + * This macro sets the chip select pin low. +*/ +#define HAL_SPI_SSN_LOW() +/** @ingroup SPI + * This macro sets the chip select pin high. +*/ +#define HAL_SPI_SSN_HIGH() + +/** @ingroup SPI + * This macro transmits 1 byte: x. + * If the microcontroller has an SPI harware block: + * - write the byte x to the communication controller using the tx buffer of the SPI block. + * - wait until the tx buffer is empty. + * If the microcontroller has no SPI hardware block the SPI communication needs to be implemented in software: + * - at startup the clock signal is low. + * - Set the MSB bit on the MOSI pin and pull up the clock line. + * - Pull donw the clock line. + * - Transmit the next bit using the same procedure as described above, do this 8 times to transmit the full byte + * + * @param x The byte that is transmitted, x is an unsigned 8 bit integer. +*/ +#if !defined(GP_COMP_CHIPEMU) +#define HAL_SPI_TX(x) +#else +UInt8 hal_msiHandleTx(UInt8 byte); +#define HAL_SPI_TX(x) hal_msiHandleTx(x) +#endif + +/** @ingroup SPI + * This macro is used to receives a byte and save it to x. + * + * If the microcontroller has an SPI harware block: + * - write a 0 to the communication controller to generate a clock signal. + * - wait until the SPI block is idle and read out the byte in the receive buffer and save this byte to x. + * If the microcontroller has no SPI hardware block the SPI communication needs to be implemented in software: + * - generate a clock signal on the clk line by driving the clock line from low to high. + * - After the clock signal goes from low to high read out the value of the MISO pin. + * - Pull down the clock signal. + * - Repeat the previous steps 8 times. Now 1 byte is read out. + * - The first bit read out is the MSB bit, the last bit is the LSB bit. + * + * @param x This byte returns the received value, x is an unsigned 8 bit integer. +*/ +#if !defined(GP_COMP_CHIPEMU) +#define HAL_SPI_RX(x) +#else +UInt8 hal_msiHandleRx(UInt8 byte); +#define HAL_SPI_RX(x) (x = hal_msiHandleRx(x)) +#endif + +/** @ingroup SPI + * This macro is used to power down the SPI block. + * + * All pins used for SPI should be set low. Default the chip select pin should be set low. + * Other pins could also need to be set low depending on the SPI block behavior + * +*/ +#define HAL_SPI_POWERDOWN() + +/** @ingroup SPI + * This macro is used to power up the SPI block. + * + * All pins used for SPI should be set to an active state. Default the chip select pin should be set high. + * Other pins could also need to be set depending on the SPI block behavior. + * +*/ +#define HAL_SPI_POWERUP() +/***************************************************************************** + * RADIO INTERRUPT + *****************************************************************************/ + +Bool hal_HandleRadioInterrupt(Bool execute); + +/** @ingroup RadioInterrupt Radio Interrupt + * This macro configures the interrupt line connecting the radio with the microcontroller. + * If the interruptCallback parameter is not NULL, the communication controller's interrupt is used to trigger in interrupt in the software. Implementation needs to be as described below. + * - Sets the interrupt sense control to falling edge or low level. + * - Registers the interrupt service routine: save the function that need to be called in a local variable. + * - Clears the pending interrupt flag and enables the interrupt. + * - The interrupt pin needs to be pulled-up by the microcontroller or en external circuit. + * + * If the interruptCallback parameter is NULL: the application will check the communication controller's interrupt line to see if an interrupt occured. Implementation needs to be as described below. + * - Set the pin connected to the interrupt of the communication controller to input and pull up the line. + * @param interruptCallback The parameter interruptCallback is the function that needs to be called if an interrupt from the communication controller occurs. +*/ + +#define HAL_RADIO_INTERRUPT_START(interruptCallback) + +/** @ingroup RadioInterrupt Radio Interrupt + * This macro returnes if the radio interrupt is enabled. If the radio interrupts are not used this macro needs to return true. +*/ +//Execution of ISR is done in sleep code with select() function +#define HAL_RADIO_INT_CHECK_IF_OCCURED() hal_HandleRadioInterrupt(false) +#define HAL_RADIO_INT_EXEC_IF_OCCURED() hal_HandleRadioInterrupt(true) + +/***************************************************************************** + * WAIT LOOP + *****************************************************************************/ + +#ifdef GP_COMP_UNIT_TEST +#define HAL_WAIT_US(timeout) \ + do \ + { \ + hal_GoToSleep(timeout); \ + } while(false) + +#define HAL_WAIT_MS(timeout) \ + do \ + { \ + hal_GoToSleep(timeout * 1000); \ + } while(false) +#else +#define HAL_WAIT_US(timeout) \ + do \ + { \ + struct timespec sleepTime; \ + sleepTime.tv_sec = (timeout) / 1000000; \ + sleepTime.tv_nsec = ((timeout) % 1000000) * 1000; \ + nanosleep(&sleepTime, NULL); \ + } while(false) + +#define HAL_WAIT_MS(timeout) \ + do \ + { \ + struct timespec sleepTime; \ + sleepTime.tv_sec = (timeout) / 1000; \ + sleepTime.tv_nsec = ((timeout) % 1000) * 1000000; \ + nanosleep(&sleepTime, NULL); \ + } while(false) +#endif //GP_COMP_UNIT_TEST + +/***************************************************************************** + * WAKEUP Pin + *****************************************************************************/ +void hal_Trigger_Wakeup(void); +/** @ingroup WakeUp + * This macro configures the wakeup pin. Puts the pin on digital output. +*/ +#define HAL_WKUP_START() + +/** @ingroup WakeUp + * This macro drives the wake up pin high. +*/ +#define HAL_SET_WKUP_ACTIVE() hal_Trigger_Wakeup() + +/** @ingroup WakeUp + * This macro drives the wake up pin low. +*/ +#define HAL_SET_WKUP_INACTIVE() + +/***************************************************************************** + * RESET Pin + *****************************************************************************/ + +void hal_Trigger_Reset(void); + +/** @ingroup Reset + * This macro drives the reset pin to the specified logical level. +*/ +#ifndef GP_COMP_CHIPEMU +#define HAL_SET_RESET_ACTIVE(level) hal_Trigger_Reset() +#else +#define HAL_SET_RESET_ACTIVE(level) hal_msiInit(level) +#endif //GP_COMP_CHIPEMU + +/** @ingroup Reset + * This macro configures the reset pin. Puts the pin on digital input to not interfere with default state of the reset line. + */ +#ifndef GP_COMP_CHIPEMU +#define HAL_SET_RESET_INACTIVE() +#else +#define HAL_SET_RESET_INACTIVE() hal_msiInit(1) +#endif //GP_COMP_CHIPEMU + +/** @ingroup Reset + * This macro returns the logic level of the reset pin. It is used to select the correct reset method. + */ +#define HAL_GET_RESET_LEVEL() 0 + +/***************************************************************************** + * Init Function + *****************************************************************************/ +void hal_Init(void); +void hal_DeInit(void); + +#define HAL_INIT() hal_Init() + +/***************************************************************************** + * GLOBAL interrupt Function + *****************************************************************************/ + +//Nested interrupt disabling mechanism only kept to keep checks in order throughout the code. +extern UInt8 l_n_atomic; + +/** @ingroup globalInterrupts + * This macro enables the global interrupts without incrementing the l_n_atomic counter. + * +*/ +#define HAL_FORCE_ENABLE_GLOBAL_INT() + +/** @ingroup globalInterrupts + * This macro disables the global interrupts without decrementing the l_n_atomic counter. + * +*/ +#define HAL_FORCE_DISABLE_GLOBAL_INT() + +#define HAL_INITIALIZE_GLOBAL_INT() \ + { \ + l_n_atomic = 1; \ + } + +/** @ingroup globalInterrupts + * This macro decrements the counter l_n_atomic. If l_n_atomic is 0 after the decrement the interrupts are enabled. + * +*/ + +#define HAL_ENABLE_GLOBAL_INT() \ + do \ + { \ + l_n_atomic--; \ + } while(false) + +/** @ingroup globalInterrupts + * This macro increments the counter l_n_atomic. If l_n_atomic is 1 after the increment the interrupts are disabled. + * +*/ +#define HAL_DISABLE_GLOBAL_INT() \ + do \ + { \ + l_n_atomic++; \ + } while(false) + +#define HAL_GLOBAL_INT_ENABLED() (l_n_atomic == 0) + +/***************************************************************************** + * Buttons + *****************************************************************************/ + +/** @ingroup Buttons + * This macro initializes the buttons. The pin(s) connected to the button(s) are configured as digital input. + * +*/ +#define HAL_BTN_INIT() + +/** @ingroup Buttons + * This macro reads out the value of button btn, possible values for btn are 1 or 2. + * The value is returned by using the construction BUTTON_##btn and by defining BUTTON_1 and BUTTON_2 as the pin which is read out. Where the value 1 means button pressed and 0 means button not pressed. + * If a pull-down circuit is used and a 0 means button pressed, the value needs to be inverted. + * + * @param btn The parameter btn is a unsigned 8 bit integer. The number of the used button is 1 or 2. +*/ +#define HAL_BTN_PRESSED(btn) false + +/***************************************************************************** + * Leds + *****************************************************************************/ + +/** @ingroup LEDS + * This macro initializes the leds. + * Led RED and led GRN are initialized in this macro. Leds are turned of at initialisation and the pins connected to the leds are put as digital output. + * +*/ + +#define HAL_LED_INIT() + +/** @ingroup LEDS + * This macro clears a led. Possible values for led are RED or GRN. + * This can be implemented by using the structure HAL_LED_CLR_##led() and by defining and implementing HAL_LED_CLR_GRN() and HAL_LED_CLR_RED(). + * @param led The parameter is RED or GRN. +*/ +#define HAL_LED_CLR(led) + +/** @ingroup LEDS + * This macro sets a led. Possible values for led are RED or GRN. + * This can be implemented by using the structure HAL_LED_SET_##led() and by defining and implementing HAL_LED_SET_GRN() and HAL_LED_SET_RED(). + * @param led The parameter is RED or GRN. +*/ +#define HAL_LED_SET(led) + +/** @ingroup LEDS + * This macro reads out the value of a led. Possible values for led are RED or GRN. + * This can be implemented by using the structure HAL_LED_TST_##led() and by defining and implementing HAL_LED_TST_GRN() and HAL_LED_TST_RED(). + * @param led The parameter is RED or GRN. +*/ +#define HAL_LED_TST(led) + +/** @ingroup LEDS + * This macro reads out the value of a led and inverts it. Possible values for led are RED or GRN. + * This can be implemented by using the structure HAL_LED_TGL_##led() and by defining and implementing HAL_LED_TGL_GRN() and HAL_LED_TGL_RED(). + * @param led The parameter is RED or GRN. +*/ +#define HAL_LED_TGL(led) + +/** @ingroup LEDS + * This macro initializes the leds. + * Led RED and led GRN are initialized in this macro. + * +*/ + +#define HAL_USERLED_INIT() + +/** @ingroup LEDS + * This macro clears a userled. Possible values for led are YEL or BLU. + * This can be implemented by using the structure HAL_USERLED_CLR_##led() and by defining and implementing HAL_USERLED_CLR_YEL() and HAL_USERLED_CLR_BLU(). + * @param led The parameter is BLU or YEL. +*/ +#define HAL_USERLED_CLR(led) + +/** @ingroup LEDS + * This macro sets a userled. Possible values for led are YEL or BLU. + * This can be implemented by using the structure HAL_USERLED_SET_##led() and by defining and implementing HAL_USERLED_SET_YEL() and HAL_USERLED_SET_BLU(). + * @param led The parameter is BLU or YEL. +*/ +#define HAL_USERLED_SET(led) + +/** @ingroup LEDS + * This macro reads out the value of a userled. Possible values for led are YEL or BLU. + * This can be implemented by using the structure HAL_USERLED_TST_##led() and by defining and implementing HAL_USERLED_TST_YEL() and HAL_USERLED_TST_BLU(). + * @param led The parameter is BLU or YEL. +*/ +#define HAL_USERLED_TST(led) + +/** @ingroup LEDS + * This macro reads out the value of a userled and inverts it. Possible values for led are YEL or BLU. + * This can be implemented by using the structure HAL_USERLED_TGL_##led() and by defining and implementing HAL_USERLED_TGL_YEL() and HAL_LED_USERTGL_BLU(). + * @param led The parameter is BLU or YEL. +*/ +#define HAL_USERLED_TGL(led) + +/***************************************************************************** + * RESET REASON + *****************************************************************************/ + +#define hal_ResetReason_Unspecified 0x0 +typedef UInt8 hal_ResetReason_t; + +#define HAL_GET_RESET_REASON() (hal_ResetReason_Unspecified) + +/***************************************************************************** + * UART + *****************************************************************************/ + +void hal_InitUART(hal_cbUartRx_t RxISR, hal_cbUartGetTxData_t TxISR); +void hal_TxUART(void); +void hal_RxUART(UInt8 id); +/* This implementation uses stdin and stdout*/ +#define HAL_UART_COM_START(cbUartRx, cbUartGetTxData) hal_InitUART(cbUartRx, cbUartGetTxData) +#define HAL_UART_COM_STOP() + +#define HAL_UART_COM_POWERDOWN() \ + do \ + { \ + hal_UartRxEnabled = false; \ + hal_UartTxEnabled = false; \ + } while(false) + +#define HAL_UART_COM_POWERUP() \ + do \ + { \ + hal_UartRxEnabled = true; \ + hal_UartTxEnabled = true; \ + } while(false) + +#define HAL_UART_COM_TX_NEW_DATA() hal_TxUART() +#define HAL_UART_COM_TX_ENABLED() (hal_UartTxEnabled) + +#define hal_UartPollRx() hal_RxUART(0) + +#define hal_UartPollTx() HAL_UART_COM_TX_NEW_DATA() + +#define HAL_UART_SCOM_START(cbUartRx, cbUartGetTxData) hal_InitUART(cbUartRx, cbUartGetTxData) +#define HAL_UART_SCOM_STOP() \ + do \ + { \ + GP_ASSERT_SYSTEM(false); /* not supported */ \ + } while(0) + +#define HAL_UART_SCOM_POWERDOWN() \ + do \ + { \ + hal_UartRxEnabled = false; \ + hal_UartTxEnabled = false; \ + } while(false) + +#define HAL_UART_SCOM_POWERUP() \ + do \ + { \ + hal_UartRxEnabled = true; \ + hal_UartTxEnabled = true; \ + } while(false) + +#define HAL_UART_SCOM_TX_NEW_DATA() hal_TxUART() + +/***************************************************************************** + * RESET UC + *****************************************************************************/ + +/** @ingroup ResetUC + * This macro resets the application. + * +*/ +#define HAL_RESET_UC() abort() //Stop application and produce core dump (if system supports it) +/***************************************************************************** + * SLEEP UC + *****************************************************************************/ +GP_API void hal_GoToSleep(UInt32 time); + +#define HAL_SLEEP_INDEFINITE_SLEEP_TIME 0xFFFFFFFF +#define HAL_SLEEP_MAX_SLEEP_TIME 0xFFFFFFFE + +#define HAL_DISABLE_SLEEP_UC() +#define HAL_ENABLE_SLEEP_UC() +#define HAL_SLEEP_UC_1US(time) hal_GoToSleep(time) + +/***************************************************************************** + * WATCHDOG + *****************************************************************************/ + +#define HAL_WDT_ENABLE(timeout) \ + do \ + { \ + } while(false) +#define HAL_WDT_DISABLE() \ + do \ + { \ + } while(false) +#define HAL_WDT_RESET() \ + do \ + { \ + } while(false) +#define HAL_WDT_FORCE_TRIGGER() \ + do \ + { \ + } while(false) + +/***************************************************************************** + * BACKTRACE STACK DUMP + *****************************************************************************/ + +void hal_dump_backtrace(UInt8 maxlevel); +void hal_install_exception_handlers(void); + +/***************************************************************************** + * HEAP DEBUG + *****************************************************************************/ + +/** @brief Returns heap usage information + * + * @return pInUse Currently allocated bytes on heap + * @return pReserved Memory + * @return pMax Maximum used heap. Will grow during operation, but will stay at that number. +*/ +void hal_GetHeapInUse(UInt32* pInUse, UInt32* pReserved, UInt32* pMax); + +/***************************************************************************** + * File descriptor/pipe registration + *****************************************************************************/ + +#define HAL_NR_OF_PIPE_HANDLES 10 +#define HAL_PIPE_INVALID_HANDLE 0xFF + +typedef UInt8 hal_pipeHandle_t; + +hal_pipeHandle_t hal_GetPipeHandle(hal_PollFunction_t pollFunction); +void hal_ReadFromPipe(hal_pipeHandle_t handle, UInt8* pData, UInt32 length); +void hal_WriteToPipe(hal_pipeHandle_t handle, UInt8* pData, UInt32 length); + +void hal_RegisterPollFunction(int fd, hal_PollFunction_t pollFunction); +void hal_UnRegisterPollFunction(int fd); + +void hal_SetPollFunction_write(int fd, hal_PollFunction_t pollFunction); + +Bool hal_HandleFds(Bool execute); + +/***************************************************************************** + * MUTEX + *****************************************************************************/ + +#define HAL_CRITICAL_SECTION_TYPE pthread_mutex_t +#define HAL_CRITICAL_SECTION_DEF(pMutex) pthread_mutex_t* pMutex; +#define HAL_CREATE_MUTEX(pMutex) hal_MutexCreate(pMutex) +#define HAL_DESTROY_MUTEX(pMutex) hal_MutexDestroy(pMutex) +#define HAL_ACQUIRE_MUTEX(mutex) hal_MutexAcquire(mutex) +#define HAL_RELEASE_MUTEX(mutex) hal_MutexRelease(mutex) +#define HAL_VALID_MUTEX(mutex) hal_MutexIsValid(mutex) +#define HAL_IS_MUTEX_ACQUIRED(mutex) hal_MutexIsAcquired(mutex) + +void hal_MutexAcquire(pthread_mutex_t *pMutex); +void hal_MutexRelease(pthread_mutex_t *pMutex); +void hal_MutexCreate(pthread_mutex_t **pMutex); +void hal_MutexDestroy(pthread_mutex_t **pMutex); +Bool hal_MutexIsValid(pthread_mutex_t *pMutex); +Bool hal_MutexIsAcquired(pthread_mutex_t *pMutex); + + +/***************************************************************************** + * ChipEmu and Unit/Stack tests + *****************************************************************************/ + +#ifdef GP_COMP_CHIPEMU +void hal_update_interrupt(void); +#endif //GP_COMP_CHIPEMU + +Bool hal_Select(UInt32 time, Bool Execute); +void hal_WakeEventloop(void); +void hal_ClearWakeUpEvent(void); + +#if defined(GP_COMP_CHIPEMU) +typedef void (*hal_cbFastForwardSleep_t)(UInt32 requestedSleepTime, UInt64* clockCounter); +void hal_RegisterFastForwardSleepCallback(hal_cbFastForwardSleep_t cbFFSleep); +#endif //defined(HAL_FASTFORWARD_FOR_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + +/***************************************************************************** + * Random + *****************************************************************************/ +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //_HAL_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal_Extension.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal_Extension.h new file mode 100644 index 0000000..4fca34a --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal_Extension.h @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal_Extension.h + * Hardware Abstraction Layer for linux based devices. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_EXTENSION_H_ +#define _HAL_EXTENSION_H_ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define HAVE_LOCALTIME + +//Chip access macro's +#define HAL_ACCESS_CHIP(command, pValue) ioctl(fdGP, command, pValue) + +#define HAL_TIMER_RESTART() + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef Int16 (* hal_cbUartGetTxData_t) (void); +#if defined(HAL_DIVERSITY_UART_RX_BUFFER_CALLBACK) +typedef void (* hal_cbUartRx_t)(UInt8 *buffer, UInt16 size); +#else +typedef void (* hal_cbUartRx_t) (Int16); +#endif +typedef void (* hal_cbUartTxReady_t) (void); +typedef Bool (* hal_cbUartTxPending_t) (void); + +typedef void (*hal_PollFunction_t)(UInt8); +typedef void (*hal_RadioFunction_t)(void); + +typedef void (*hal_cbSocketRx_t)(UInt16, const char*, UInt32 socketId); +typedef void (*hal_cbSocketClose_t)(UInt32 socketId); + +/***************************************************************************** + * Public Data Definitions + *****************************************************************************/ +extern Bool hal_UartRxEnabled; +extern Bool hal_UartTxEnabled; +extern int fdGP; +/***************************************************************************** + * Internal Function Definitions + *****************************************************************************/ + +void hal_InitSocket(hal_cbSocketRx_t RxISR, hal_cbSocketClose_t closeCb); +void hal_DeInitSocket(void); + +int hal_TxDataSocket(UInt16 length, UInt8 *pData, UInt32 socketId); + +void hal_RegisterGPPollFunction(hal_RadioFunction_t pollFunction); + + +#ifdef GP_COMP_CHIPEMU +void hal_msiInit(UInt8 not_in_reset); +UInt8 hal_msiHandleTx(UInt8 byte); +UInt8 hal_msiHandleRx(UInt8 byte); + +void hal_update_interrupt(void); +#endif //GP_COMP_CHIPEMU + +UInt32 hal_getSecondsSinceEpoch(void); + +/** @brief Return the current real time in microseconds since the Unix epoch. + * + * This function returns the real time as reported by the operating system. + * The time is represented as the number of microseconds elapsed + * since 1970-01-01 00:00:00 UTC (excluding leap seconds). + */ +UInt64 hal_GetMicrosecondsSinceEpoch(void); + +#define __DSB() +#endif //_HAL_EXTENSION_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c new file mode 100644 index 0000000..a0d6ed5 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/** @file "hal_Heap.c" + * + * Heap analysis functionality +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +//#define DEBUG + +#include "hal.h" +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +/***************************************************************************** + * Public Function Implementations + *****************************************************************************/ + +void hal_GetHeapInUse(UInt32* pInUse, UInt32* pReserved, UInt32* pMax) +{ + //No Heap + *pInUse = 0x0; + *pReserved = 0x0; + *pMax = 0x0; +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c new file mode 100644 index 0000000..ce1ac00 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c @@ -0,0 +1,453 @@ +/* + * Copyright (c) 2010, 2012-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal_Sched.c + * Linux-specific implementation of event polling and event waiting. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +//#define GP_LOCAL_LOG +#include "hal.h" +#include "hal_defs.h" +#include "gpAssert.h" +#ifdef GP_COMP_CHIPEMU +#include "gpChipEmu.h" +#ifdef GP_COMP_GPHAL +#include "gpHal.h" +#endif //GP_COMP_GPHAL +#endif //GP_COMP_CHIPEMU + +#include +#include + +#include "gpLog.h" +#include +#include + +#include +#include +#include + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX +#define HAL_NUM_OF_FD 40 +#define HAL_INVALID_FD -1 +#define EVENTFD_INITIAL_VALUE_ZERO 0 +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct{ + Bool valid; + int fd; + hal_PollFunction_t pollFunction; + hal_PollFunction_t pollFunction_write; +} hal_PollFunctionInfo_t; + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static int hal_nfds = 0; +static hal_PollFunctionInfo_t hal_PollFunctionInfo[HAL_NUM_OF_FD]; +static int hal_EventFd = -1; + + +#if defined(GP_COMP_CHIPEMU) +static hal_cbFastForwardSleep_t hal_cbFastForwardSleep; +#endif //defined(HAL_FASTFORWARD_FOR_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + +/***************************************************************************** + * Static Function Declarations + *****************************************************************************/ + +#if defined(GP_COMP_CHIPEMU) +void hal_FastForwardSleep(UInt32 requestedSleepTime, UInt64* clockCounter); +#endif //defined(HAL_FASTFORWARD_FOR_UNIT_TEST) || defined(GP_COMP_CHIPEMU) +static void hal_EventFdInit(void); +static void hal_EventFdDeInit(void); +static void hal_EventFdHandler(UInt8 x); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void halSched_Init(void) +{ + UIntLoop i; + + if (hal_nfds != 0) + { + // Allow re-init of hal without resetting registered file descriptors. + return; + } + + + hal_nfds = 0; + MEMSET(hal_PollFunctionInfo, 0, sizeof(hal_PollFunctionInfo_t) * HAL_NUM_OF_FD); + for(i = 0; i < HAL_NUM_OF_FD; i++) + { + hal_PollFunctionInfo[i].valid = false; + hal_PollFunctionInfo[i].fd = HAL_INVALID_FD; + } + #if defined(GP_COMP_CHIPEMU) + hal_cbFastForwardSleep = hal_FastForwardSleep; + #endif //defined(HAL_FASTFORWARD_FOR_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + + hal_EventFdInit(); + +} + +void halSched_DeInit(void) +{ + hal_EventFdDeInit(); + + // Clear poll function table. + hal_nfds = 0; + memset(hal_PollFunctionInfo, 0, sizeof(hal_PollFunctionInfo_t) * HAL_NUM_OF_FD); +} + +void hal_RegisterPollFunction(int fd, hal_PollFunction_t pollFunction) +{ + UIntLoop i; + Bool added = false; + + //Check re-add first + for(i=0; i < HAL_NUM_OF_FD; i++) + { + if(hal_PollFunctionInfo[i].fd == fd && hal_PollFunctionInfo[i].valid) + { + hal_PollFunctionInfo[i].pollFunction = pollFunction; + added = true; + break; + } + } + + if(!added) + { + for(i=0; i < HAL_NUM_OF_FD; i++) + { + if(!hal_PollFunctionInfo[i].valid) + { + hal_PollFunctionInfo[i].valid = true; + hal_PollFunctionInfo[i].fd = fd; + hal_PollFunctionInfo[i].pollFunction = pollFunction; + if(fd >= hal_nfds) + { + hal_nfds = fd +1; + } + added = true; + break; + } + } + } + GP_ASSERT_SYSTEM(added); +} + +void hal_UnRegisterPollFunction(int fd) +{ + UIntLoop i; + int new_nfds = 0; + + for(i = 0; i < HAL_NUM_OF_FD; i++) + { + if(hal_PollFunctionInfo[i].valid) + { + if (hal_PollFunctionInfo[i].fd == fd) + { + //Invalidate all info for this fd + hal_PollFunctionInfo[i].valid = false; + hal_PollFunctionInfo[i].fd = HAL_INVALID_FD; + hal_PollFunctionInfo[i].pollFunction = NULL; + hal_PollFunctionInfo[i].pollFunction_write = NULL; + } + else + { + //Re-calculate nfds over remaining fds + new_nfds = max(new_nfds, hal_PollFunctionInfo[i].fd); + } + } + } + hal_nfds = new_nfds+1; +} + +Bool hal_Select(UInt32 time, Bool Execute) +{ + Bool ready = false; + UInt32 time_us = time; + + fd_set readfds, writefds; + UInt16 i; /* the number of nfds can be larger than + 255 in some linux based middleware applications */ + struct timeval tv; + int retval; + + FD_ZERO(&readfds); + FD_ZERO(&writefds); + for(i=0;i +#include + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +//Legacy system time resolution = 32 us +#define HAL_TIME_RES_ORDER 5 + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ +#if defined(GP_COMP_CHIPEMU) +UInt64 hal_ClockCounter; +#endif //GP_COMP_UNIT_TEST + +/** + * Return 1us resolution time in 64-bit +*/ +#if defined(GP_COMP_CHIPEMU) +UInt64 halTimer_GetCurrentTime_1us_64bit(void) +{ + return hal_ClockCounter; +} +#else +UInt64 halTimer_GetCurrentTime_1us_64bit(void) +{ + UInt64 timestampUs; + struct timespec tp; + + // use monotonic clock to be robust against system time changes + clock_gettime(CLOCK_MONOTONIC, &tp); + + timestampUs = (UInt64)tp.tv_nsec/1000 + ((UInt64)tp.tv_sec * 1000000); + + return timestampUs; +} +#endif //defined(GP_COMP_UNIT_TEST) && !defined(GP_HAL_DIVERSITY_USE_SELECT) && !defined(HAL_DIVERSITY_USE_LIBEV)&& !defined(GP_UNITTEST_DIVERSITY_NO_FASTFORWARD) + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +/* + * Timers + */ + +#if defined(GP_COMP_CHIPEMU) +void hal_StartTimer(void) +{ + hal_ClockCounter = 0; +} +#endif //GP_COMP_UNIT_TEST + +/** + * Return 32us resolution time in full 32-bit. +*/ +UInt32 hal_GetCurrentTime(void) +{ + return (UInt32)(halTimer_GetCurrentTime_1us_64bit() >> HAL_TIME_RES_ORDER); +} + +/** + * Return 1us resolution time in full 32-bit +*/ +UInt32 hal_GetCurrentTime_1us(void) +{ + return (UInt32)halTimer_GetCurrentTime_1us_64bit(); +} + +/** + * Return the current real time in seconds since the Unix epoch. +*/ +UInt32 hal_getSecondsSinceEpoch(void) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + return tv.tv_sec; +} + +/** + * Return the current real time in microseconds since the Unix epoch. +*/ +UInt64 hal_GetMicrosecondsSinceEpoch(void) +{ + struct timeval tv; + gettimeofday(&tv, NULL); + return ((UInt64)tv.tv_sec) * 1000000 + tv.tv_usec; +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c new file mode 100644 index 0000000..cc23b41 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal_UART.c + * Hardware Abstraction Layer for stdin/stdout as UART on Linux. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "hal.h" +#include "hal_defs.h" +#include +#include "termios.h" + +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static hal_cbUartRx_t cbUartRx = NULL; +static hal_cbUartGetTxData_t cbUartGetTxData = NULL; +Bool hal_UartRxEnabled; +Bool hal_UartTxEnabled; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +void hal_InitUART( hal_cbUartRx_t RxISR, hal_cbUartGetTxData_t TxISR ) +{ + /* register RX and TX isr */ + cbUartRx = RxISR; + cbUartGetTxData = TxISR; + + hal_UartRxEnabled = false; + hal_UartTxEnabled = true; + + printf("_____%s",__FUNCTION__); + if(RxISR != NULL) + { + int res; + struct termios newT; + + res = tcgetattr(fileno(stdin), &newT); + if(res == 0) + { + hal_UartRxEnabled = true; + hal_RegisterPollFunction(fileno(stdin),hal_RxUART); + newT.c_lflag &= (~ICANON); //one char @ a time + newT.c_cc[VTIME] = 1; + newT.c_cc[VMIN] = 1; //generate interrupt when at least 1 char is received + + tcsetattr(fileno(stdin), TCSANOW, &newT); + } + } +} + +void hal_TxUART(void) +{ + if(hal_UartTxEnabled && cbUartGetTxData) + { + while(true) + { + Int16 sendData; + sendData = cbUartGetTxData(); + if(sendData != -1) + { + putchar((sendData)); + fflush(stdout); + } + else + { + break; + } + } + } +} +void hal_RxUART(UInt8 id) +{ + NOT_USED(id); + if(hal_UartRxEnabled) + { + int receiveData; + + receiveData = getchar(); + if(receiveData != EOF) + { + +#if defined(HAL_DIVERSITY_UART_RX_BUFFER_CALLBACK) + cbUartRx((UInt8*)&receiveData,1); +#else + cbUartRx(receiveData); +#endif + } + } +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c new file mode 100644 index 0000000..5dfede6 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal.c + * Hardware Abstraction Layer for linux based devices, in combination with gp kernel driver + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "hal.h" +#include "hal_defs.h" +#include "gpBsp.h" +#include "gpAssert.h" +#include "gpLog.h" + +#include // for getting the stack trace after assert +#include // signal handlers defs. +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void hal_dump_backtrace(UInt8 maxlevel) +{ + // + // use compiler options: + // OPT = -rdynamic -funwind-tables + // + #define MAX_STACK_TRACE 16 + void* stacktrace[MAX_STACK_TRACE]; + UInt8 stacksize; + char** stacknames; + NOT_USED(maxlevel); + + stacksize = backtrace(stacktrace, MAX_STACK_TRACE); + GP_LOG_SYSTEM_PRINTF("stacktrace size=%d",0,stacksize); + stacknames = backtrace_symbols(stacktrace, stacksize); + if(stacksize>1) + { + UInt8 stackindex; + for(stackindex=1; stackindexsi_addr); + GP_ASSERT_DEV_INT(false); +} + +void hal_install_exception_handlers(void) +{ + struct sigaction sa; + sa.sa_sigaction = handler; + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART | SA_SIGINFO; + + sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGFPE , &sa, NULL); + sigaction(SIGBUS , &sa, NULL); + sigaction(SIGILL , &sa, NULL); + sigaction(SIGABRT, &sa, NULL); +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_defs.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_defs.h new file mode 100644 index 0000000..6658a31 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_defs.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2010, 2013-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal_defs.h + * Hardware Abstraction Layer for linux based devices. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "hal.h" +#include + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ +typedef enum +{ + halSocket_state_idle, + halSocket_state_active, + halSocket_state_exited +} halSocket_state_t; + +typedef struct +{ + UInt32 socketId; + halSocket_state_t state; + Bool isClient; + struct sockaddr addr; + pthread_t rfReadThread; +} halSocket_t; + +/***************************************************************************** + * Public Data Declarations + *****************************************************************************/ +#if defined(GP_COMP_CHIPEMU) +extern UInt64 hal_ClockCounter; +#endif //GP_COMP_UNIT_TEST + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void halSched_Init(void); +void halSched_DeInit(void); + + void halSocket_RegisterPollFunction(int fd); + void* halSocket_readThread(void *pClientSocketId); + int hal_GetServerSocket(halSocket_t* socketInfo, char* host, int port); + int halSocket_ListenForClients(char *path, int port); + +int halUART_SetNonSpecialBaudRate(int fd, UInt32 baudrate); diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c new file mode 100644 index 0000000..8e35b4c --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2010, 2012-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal.c + * Hardware Abstraction Layer for linux based devices. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "hal.h" +#include "hal_defs.h" +#include "gpBsp.h" +#include "gpAssert.h" +#ifdef GP_COMP_CHIPEMU +#include "gpChipEmu.h" +#ifdef GP_COMP_GPHAL +#include "gpHal.h" +#endif //GP_COMP_GPHAL +#endif //GP_COMP_CHIPEMU + +#include +#include +#include "gpLog.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Data Definitions + *****************************************************************************/ +UInt8 l_n_atomic; + +#ifdef GP_COMP_CHIPEMU +Bool bsp_linux_int; +hal_RadioFunction_t gphal_cb; +#endif + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void hal_Init (void) +{ + setlinebuf(stdout); + setlinebuf(stderr); + + halSched_Init(); + + HAL_LED_INIT(); + HAL_BTN_INIT(); + gpBsp_init(); + hal_install_exception_handlers(); + +#if defined(GP_COMP_GPHAL) && defined(GP_COMP_CHIPEMU) +//For emulation testing + HAL_GP_HW_INIT(); +#ifdef GP_COMP_GPHAL + gpHal_Reset(); +#endif +#endif //defined(GP_COMP_GPHAL) && defined(GP_COMP_CHIPEMU) +} + +void hal_DeInit(void) +{ + halSched_DeInit(); +} + +void hal_Trigger_Wakeup(void) +{ +#ifdef GP_COMP_CHIPEMU + gpChipEmu_WakeUp_External(); +#endif //GP_COMP_CHIPEMU +} + +Bool hal_HandleRadioInterrupt(Bool execute) +{ +#ifdef GP_COMP_CHIPEMU + if (bsp_linux_int) + { + if(execute && (NULL != gphal_cb)) + { + gphal_cb(); + bsp_linux_int = false; + } + return true; + } +#else + NOT_USED(execute); +#endif + return false; +} + +#ifdef GP_COMP_CHIPEMU +void hal_RegisterGPPollFunction(hal_RadioFunction_t pollFunction) +{ + gphal_cb = pollFunction; +} + +void hal_update_interrupt(void) +{ + UInt8 interrupt = gpChipEmu_GetInterruptPin(); + bsp_linux_int = !!interrupt; +} +#endif //GP_COMP_CHIPEMU diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708/compiler.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708/compiler.h new file mode 100644 index 0000000..75d679c --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708/compiler.h @@ -0,0 +1,24 @@ +#ifndef _COMPILER_H_ +#define _COMPILER_H_ + +#include +#include +#include + +//compiler specific stuff +#define INLINE +#define PACKED_PRE +#define PACKED_POST __attribute__((packed)) +#define ALIGNMENT_NEEDED + +#define COMPILER_ALIGNED(a) __attribute__((__aligned__(a))) + +//#define HAVE_NO_64BIT + +#define NORETURN + +//Pointer type, use this type to perform pointer arithmetic +typedef uintptr_t UIntPtr; +typedef UIntPtr UIntPtr_P; + +#endif //_COMPILER_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/inc/global.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/inc/global.h new file mode 100644 index 0000000..bc3735e --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/inc/global.h @@ -0,0 +1,742 @@ +/* + * Copyright (c) 2005-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * global.h + * This file contains the global typedefs and defines. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + */ + +#ifndef _GLOBAL_H_ +#define _GLOBAL_H_ + +#include "compiler.h" + +/***************************************************************************** + * Compile time verification + *****************************************************************************/ + +/** Check a conditon at compile time. + * this macro will produce a compile error if the condition x is false + * the error might be strange however, + * the error will be that the size of the array is negative, which is illegal in C. + * You can use it both as a statement and an expression, but not at file level. + * if used with a condition that is not compile-time-constant, it will pass + */ +#ifndef COMPILE_TIME_ASSERT +#define COMPILE_TIME_ASSERT(x) ((void) sizeof(int[1-2*((x) ? 0 : 1)])) +#endif + +//auxiliary macro +#define GP_COMPILE_TIME_VERIFY_TRUE(R) (!!sizeof(struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) + +/** Check a conditon at compile time. + * this macro will produce a compile error if the condition x is false + * it is an alternative for COMPILE_TIME_ASSERT: + * it is usable at file level, whereas COMPILE_TIME_ASSERT is not + * COMPILE_TIME_ASSERT is usable as expression (inside macros that return a value), GP_COMPILE_TIME_VERIFY is not. + * if used with a condition that is not compile-time-constant, it will fail + */ +#ifndef __cplusplus +#define GP_COMPILE_TIME_VERIFY(R) extern int (* gp_verify_function__ (void)) [GP_COMPILE_TIME_VERIFY_TRUE (R)] +#else +#define GP_COMPILE_TIME_VERIFY(R) typedef char gp_verify_function__ [ (R) ? 1 : -1 ] +#endif + +/***************************************************************************** + * Common data types + *****************************************************************************/ + +typedef uint8_t Bool; +typedef char Char; + +typedef uint8_t UInt8; +typedef uint16_t UInt16; +typedef uint32_t UInt24; +typedef uint32_t UInt32; +typedef uint_fast8_t UIntLoop; +typedef uint8_t UInt8Buffer; + +typedef int8_t Int8; +typedef int16_t Int16; +typedef int32_t Int24; +typedef int32_t Int32; +typedef int_fast8_t IntLoop; + +typedef uint8_t Byte; + +typedef UInt8 UQ2_6; +typedef UInt16 UQ2_14; +typedef UInt16 UQ8_8; +typedef Int16 Q8_8; +typedef Int8 Q1_7; +typedef Int16 Q1_15; +typedef Int32 Q1_31; +typedef Int32 Q24_8; /* 8 decimal places */ +typedef Int32 Q8_24; /* 24 decimal places */ + +#define MILLIVOLT_TO_UQ2_14(mv) ( (UQ2_14) ((((UInt32)mv)<<14)/1000) ) + +#ifndef HAVE_NO_64BIT +typedef uint64_t UInt64; +typedef int64_t Int64; +#endif + +GP_COMPILE_TIME_VERIFY(sizeof(Char)==1); +GP_COMPILE_TIME_VERIFY(sizeof(UInt8)==1); +GP_COMPILE_TIME_VERIFY(sizeof(UInt16)==2); +GP_COMPILE_TIME_VERIFY(sizeof(UInt32)==4); + +//not all hosts have a UInt64, let's simulate one, including endianness +typedef struct UInt64Struct +{ +#ifndef GP_BIG_ENDIAN + //normal case, little endian + UInt32 LSB; + UInt32 MSB; +#else //GP_BIG_ENDIAN + UInt32 MSB; + UInt32 LSB; +#endif +} UInt64Struct_t; +typedef UInt64Struct_t MACAddress_t; + +#ifdef GP_BIG_ENDIAN +#define MACADDRESS_INITIALIZER(msb, lsb) { (msb), (lsb) } +#else +#define MACADDRESS_INITIALIZER(msb, lsb) { (lsb), (msb) } +#endif + +// Bluetooth device address (6 bytes) +typedef PACKED_PRE struct +{ + UInt8 addr[6]; +} PACKED_POST BtDeviceAddress_t; + +GP_COMPILE_TIME_VERIFY(sizeof(BtDeviceAddress_t) == 6); + + +//Define UIntPtr and UIntPtr_P in compiler.h + +#ifndef __cplusplus +#ifndef false +#define false ((Bool) 0) +#endif +#ifndef true +#define true ((Bool) !false) +#endif +#endif + +#include + +#define GP_API extern + +typedef void (* void_func) (void); + +/***************************************************************************** + * Helper macros + *****************************************************************************/ +#if !defined(__KERNEL__) && !defined(__cplusplus) +#ifndef min +#define min(a,b) ((b) < (a) ? (b) : (a)) +#endif +#ifndef max +#define max(a,b) ((a) < (b) ? (b) : (a)) +#endif +#ifndef clamp +#define clamp(val,a,b) (min(max(val, a), b)) +#endif +#endif // __KERNEL__ && !__cplusplus + +#ifndef dist +#define dist(a,b) ((a) < (b) ? ((b) - (a)) : ((a) - (b))) +#endif +#ifndef div_ceil +#define div_ceil(nr,div) ( nr>=0 ? (((nr)+((div)-1))/(div)) : (((nr)+(0 ))/(div)) ) +#endif +#ifndef div_round +#define div_round(nr,div) ( nr>=0 ? (((nr)+((div)/2))/(div)) : (((nr)-((div)/2))/(div)) ) +#endif +#ifndef div_floor +#define div_floor(nr,div) ( nr>=0 ? (((nr)+(0 ))/(div)) : (((nr)-((div)-1))/(div)) ) +#endif +#ifndef udiv_ceil +#define udiv_ceil(nr,div) (((nr)+((div)-1))/(div)) +#endif +#ifndef udiv_round +#define udiv_round(nr,div) (((nr)+((div)/2))/(div)) +#endif +#ifndef udiv_floor +#define udiv_floor(nr,div) (((nr)+(0 ))/(div)) +#endif + +// Useful stuff +#define BM(n) (1 << (n)) +#define BM64(n) (1ULL << (n)) +#define BF(x,b,s) (((x) & (b)) >> (s)) + +#define BIT_SET(p,b) do{ p|=BM(b); }while(false) +#define BIT_CLR(p,b) do{ p&=~BM(b); }while(false) +#define BIT_TST(p,b) (!!(p & BM(b))) +#define BIT_SET64(p,b) do{ p|=BM64(b); }while(false) +#define BIT_CLR64(p,b) do{ p&=~BM64(b); }while(false) +#define BIT_TST64(p,b) (!!(p & BM64(b))) + +#define number_of_elements(arr) (sizeof (arr) / sizeof (*(arr))) + +#define MS_TO_US(msec) ((UInt32)(msec)*1000UL) +#define US_TO_MS(usec) (UInt16)(usec/1000UL) +#define ABS(a) (((a) < 0) ? (-(a)) : (a)) +/***************************************************************************** + * Fixed point + * conversion macro's + *****************************************************************************/ + +#define UQ_PRECISION_DECR8(v) ((UInt8)(((v)+0x80)>>8)) +#define UQ_PRECISION_INCR8(v) (((UInt16)((v)))<<8) + +#define Q_PRECISION_DECR8(v) (((v) < 0) ? (Int8)(((v)-0x80)>>8) : (Int8)(((v)+0x80)>>8)) +#define Q_PRECISION_INCR8(v) (((Int16)(v))<<8) + +/***************************************************************************** + * Endianness + * you should define GP_BIG_ENDIAN in compiler.h if it's a big endian uc + * nothing to define for little endian + *****************************************************************************/ + +#ifndef GP_HAVE_SWAP_UINT16 +#define GP_SWAP_UINT16_CONVERSION(Data) ((Data) & 0xFF) << 8 | (((Data) >> 8) & 0xFF) +#endif +#ifndef GP_HAVE_SWAP_UINT32 +#define GP_SWAP_UINT32_CONVERSION(Data) ((Data) & 0xFF) << 24 | ((((Data) >> 8) & 0xFF) << 16) | ((((Data) >> 16) & 0xFF) << 8) | ((((Data) >> 24) & 0xFF)) +#endif +#ifndef GP_HAVE_SWAP_UINT16 +#define GP_SWAP_UINT16(pData) (*(UInt16*)pData) = GP_SWAP_UINT16_CONVERSION(*(UInt16*)(pData)) +#endif +#ifndef GP_HAVE_SWAP_UINT32 +#define GP_SWAP_UINT32(pData) (*(UInt32*)pData) = GP_SWAP_UINT32_CONVERSION(*(UInt32*)(pData)) +#endif +#ifndef GP_HAVE_SWAP_UINT64 +#define GP_SWAP_UINT64(pData) \ +do { \ + UInt8 tmp,i; \ + for (i=0; i < 4; i++) \ + { \ + tmp = ((UInt8*)(pData))[i]; \ + ((UInt8*)(pData))[i] = ((UInt8*)(pData))[7-i]; \ + ((UInt8*)(pData))[7-i] = tmp; \ + } \ + } while(false) + #endif + +#define HOST_TO_LITTLE_UINT8(pData) +#ifdef GP_BIG_ENDIAN +#define HOST_TO_LITTLE_UINT16_CONVERSION(Data) GP_SWAP_UINT16_CONVERSION(Data) +#define HOST_TO_LITTLE_UINT32_CONVERSION(Data) GP_SWAP_UINT32_CONVERSION(Data) +#define HOST_TO_LITTLE_UINT16(pData) GP_SWAP_UINT16(pData) +#define HOST_TO_LITTLE_UINT32(pData) GP_SWAP_UINT32(pData) +#define HOST_TO_LITTLE_UINT64(pData) GP_SWAP_UINT64(pData) +#define HOST_TO_LITTLE_ENUM(pData) /* enumeration is 1 byte wide */ +#else +#define HOST_TO_LITTLE_UINT16_CONVERSION(Data) (Data) +#define HOST_TO_LITTLE_UINT32_CONVERSION(Data) (Data) +#define HOST_TO_LITTLE_UINT16(pData) +#define HOST_TO_LITTLE_UINT32(pData) +#define HOST_TO_LITTLE_UINT64(pData) +#define HOST_TO_LITTLE_ENUM(pData) +#endif + +#define HOST_TO_BIG_UINT8(pData) +#ifdef GP_BIG_ENDIAN +#define HOST_TO_BIG_UINT16(pData) +#define HOST_TO_BIG_UINT32(pData) +#define HOST_TO_BIG_UINT64(pData) +#define HOST_TO_BIG_ENUM(pData) +#else +#define HOST_TO_BIG_UINT16(pData) GP_SWAP_UINT16(pData) +#define HOST_TO_BIG_UINT32(pData) GP_SWAP_UINT32(pData) +#define HOST_TO_BIG_UINT64(pData) GP_SWAP_UINT64(pData) +#define HOST_TO_BIG_ENUM(pData) /* enumeration is 1 byte wide */ +#endif + +//Inverse macros - equal to conversion macros +#define BIG_TO_HOST_UINT8(pData) +#define BIG_TO_HOST_UINT16(pData) HOST_TO_BIG_UINT16(pData) +#define BIG_TO_HOST_UINT32(pData) HOST_TO_BIG_UINT32(pData) +#define BIG_TO_HOST_UINT64(pData) HOST_TO_BIG_UINT64(pData) +#define BIG_TO_HOST_ENUM(pData) HOST_TO_BIG_ENUM(pData) + +#define LITTLE_TO_HOST_UINT8(pData) +#define LITTLE_TO_HOST_UINT16(pData) HOST_TO_LITTLE_UINT16(pData) +#define LITTLE_TO_HOST_UINT32(pData) HOST_TO_LITTLE_UINT32(pData) +#define LITTLE_TO_HOST_UINT64(pData) HOST_TO_LITTLE_UINT64(pData) +#define LITTLE_TO_HOST_ENUM(pData) HOST_TO_LITTLE_ENUM(pData) + +// To RF = To little endian +#define HOST_TO_RF_UINT8(pData) +#define HOST_TO_RF_UINT16_CONVERSION(Data) HOST_TO_LITTLE_UINT16_CONVERSION(Data) +#define HOST_TO_RF_UINT32_CONVERSION(Data) HOST_TO_LITTLE_UINT32_CONVERSION(Data) +#define HOST_TO_RF_UINT16(pData) HOST_TO_LITTLE_UINT16(pData) +#define HOST_TO_RF_UINT32(pData) HOST_TO_LITTLE_UINT32(pData) +#define HOST_TO_RF_UINT64(pData) HOST_TO_LITTLE_UINT64(pData) +#define HOST_TO_RF_ENUM(pData) HOST_TO_LITTLE_ENUM(pData) + +//Conversion from RF to host = Conversion from host to RF +#define RF_TO_HOST_UINT8(pData) +#define RF_TO_HOST_UINT16(pData) HOST_TO_RF_UINT16(pData) +#define RF_TO_HOST_UINT32(pData) HOST_TO_RF_UINT32(pData) +#define RF_TO_HOST_UINT64(pData) HOST_TO_RF_UINT64(pData) +#define RF_TO_HOST_ENUM(pData) HOST_TO_RF_ENUM(pData) + + +/***************************************************************************** + * String functions. + * you need to define these if the clib version is not suitable + * see c library for prototypes. + * a reason to define these macros is if the C compiler has "original" ideas about problematic casts and issues warnings for perfectly legal code. + *****************************************************************************/ +#ifndef MEMCPY +#define MEMCPY(dst, src, len) memcpy(dst, src, len) +#endif +#ifndef MEMCMP +#define MEMCMP(p1, p2, len) memcmp(p1, p2, len) +#endif +#ifndef MEMSET +#define MEMSET(dst, value, len) memset (dst, value, len) +#endif +#ifndef STRNCPY +#define STRNCPY(dst, src, len) strncpy (dst, src, len) +#endif +#ifndef STRNCMP +#define STRNCMP(p1, p2, len) strncmp(p1, p2, len) +#endif +#ifndef STRLEN +#define STRLEN(s) strlen(s) +#endif + +#define MEMCPY_INPLACE(dest, source, length) \ +{ \ + UInt16 index; \ + if(dest > source) /* shift to the right */ \ + { \ + for(index = length - 1; index <=0 ; index--) \ + { \ + (((UInt8*)dest)[index]) = (((UInt8*)source)[index]); \ + } \ + } \ + else if(source > dest) /* shift to the left */ \ + { \ + for(index = 0; index < length; index++) \ + { \ + (((UInt8*)dest)[index]) = (((UInt8*)source)[index]); \ + } \ + } \ +} + +/* + * const data in flash + * + * this define should be set in compiler.h, if the flash/rom/otp is in a different address space. + * in that case all the macros below should also be defined + * the documentation can be found below + */ +#ifndef GP_FLASH_PTR_IS_NO_ORDINARY_PTR + +/* + * a variable in flash is declared as + * const mytype ROM myvar FLASH_PROGMEM; + * most compilers that have special flash pointers need only to define one of these two keywords, the other can be left empty. + */ +#define ROM +#define FLASH_PROGMEM + +/* + * Keyword to indicate a symbol is weak +*/ +#ifndef WEAK +#define WEAK +#endif + +/** + * read one byte from flash. Argument is flash address * + */ +#ifndef PGM_READ_BYTE +#define PGM_READ_BYTE(address) (*(address)) +#endif //PGM_READ_BYTE +/** + * read 2 bytes from flash. Argument is a flash address * + */ +#ifndef PGM_READ_WORD +#define PGM_READ_WORD(address) (*(address)) +#endif //PGM_READ_WORD + +/** functions that work with a flash string as second argument instead of a normal string */ +#define MEMCPY_P(ptr,pprogmem,size) MEMCPY(ptr,(const void *)(pprogmem), size) +#define MEMCMP_P(ptr,pprogmem,size) MEMCMP(ptr,(const void *)(pprogmem), size) +#define STRNCPY_P(pchar,pprogmem,len) STRNCPY(pchar,(const void *)(pprogmem), len) +#define STRNCMP_P(ptr,pprogmem,size) STRNCMP(ptr,(const void *)(pprogmem),size) +#define STRLEN_P(pprogmem) STRLEN((const void *)(pprogmem)) + +/* + * the argument s is a literal string. + * example of usage: printf(GEN_STR2FLASH("iteration %u"), n); + * the macro should make sure the literal string ends up in flash + * this is rarely needed (atmel only) + */ +#define GEN_STR2FLASH(s) (s) +#endif //GP_FLASH_PTR_IS_NO_ORDINARY_PTR + +typedef const Char ROM gp_flash_char FLASH_PROGMEM; +#define FLASH_STRING gp_flash_char * + +/***************************************************************************** + * Preprocesser macros + *****************************************************************************/ + +//Convert defines into strings +#define XSTRINGIFY(s) STRINGIFY(s) +#define STRINGIFY(s) #s + +#if defined(__GNUC__) +//if GNU preprocessor is used, we do have variable length macros, so override compiler.h +#undef HAVE_NO_VARIABLE_LENGTH_MACRO +#endif //__GNUC__ + +#ifndef LINKER_SECTION +#define LINKER_SECTION(name) +#endif //LINKER_SECTION + +#ifndef GP_HAVE_EXTRAM_SECTION +#define GP_EXTRAM_SECTION_ATTR +#endif //GP_HAVE_EXTRAM_SECTION + +#define STATIC static +#define STATIC_VAR static +#define STATIC_VAR_CONST static const + +/** use this macro to get rid of warnings about unused variables/arguments*/ +#define NOT_USED(x) ((void) (x)) + +#ifdef GP_DIVERSITY_JUMPTABLES + +/* to be able to remove the static for functions that need to be patchable */ +#define STATIC_FUNC + +#ifdef GP_DIVERSITY_ROM_CODE +/* these macros will be generated in the ROM code to enable calling via jumptables */ +#define JUMPTABLE_FLASHTYPEDEF(rtype, func, ...) rtype JUMPTABLE_FLASH(func)(__VA_ARGS__) +#define JUMPTABLE_ROMDEF(rtype, func, ...) rtype func(__VA_ARGS__) LINKER_SECTION(".rom") +#define JUMPTABLE_ROMIMPL(func) rom_impl_##func +#define JUMPTABLE_FLASH(func) flash_jump_##func +#undef STATIC_VAR +#define STATIC_VAR "this should generate an error: you shouldn't use STATIC_VAR in ROM code." +#endif //GP_DIVERSITY_ROM_CODE + +#else // def GP_DIVERSITY_JUMPTABLES + +/* when the ROM code is compiled in legacy builds */ +#define STATIC_FUNC static + +#endif // def GP_DIVERSITY_JUMPTABLES + +/***************************************************************************** + * Base type marshalling macro's + *****************************************************************************/ + +#ifdef GP_BIG_ENDIAN +#define generic_api2buf(pDest, pSource, length, pIndex, byteSize) do { \ + UIntLoop __i; \ + const UInt8* __pSource = (const UInt8*)(pSource); \ + for (__i = 0; __i < length; __i++) \ + { \ + if (byteSize == 2) \ + { \ + UInt16 __v; \ + MEMCPY(&__v, __pSource, 2); \ + HOST_TO_LITTLE_UINT16(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 2); \ + } \ + else if (byteSize == 4) \ + { \ + UInt32 __v; \ + MEMCPY(&__v, __pSource, 4); \ + HOST_TO_LITTLE_UINT32(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 4); \ + } \ + else if (byteSize == 8) \ + { \ + UInt64Struct_t __v; \ + MEMCPY(&__v, __pSource, 8); \ + HOST_TO_LITTLE_UINT64(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 8); \ + } \ + *(pIndex) += byteSize; \ + __pSource += byteSize; \ + } \ +} while(false) +#define generic_api2buf_1(pDest, pSource, pIndex, byteSize) do { \ + if (byteSize == 2) \ + { \ + UInt16 __v; \ + MEMCPY(&__v, __pSource, 2); \ + HOST_TO_LITTLE_UINT16(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 2); \ + } \ + else if (byteSize == 4) \ + { \ + UInt32 __v; \ + MEMCPY(&__v, __pSource, 4); \ + HOST_TO_LITTLE_UINT32(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 4); \ + } \ + else if (byteSize == 8) \ + { \ + UInt64Struct_t __v; \ + MEMCPY(&__v, __pSource, 8); \ + HOST_TO_LITTLE_UINT64(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 8); \ + } \ + *(pIndex) += byteSize; \ + } while(false) +#else +#define generic_api2buf(pDest, pSource, length, pIndex, byteSize) do { \ + UIntLoop __i;\ + const UInt8* __pSource = (const UInt8*)(pSource); \ + for (__i = 0; __i < length; __i++) \ + {\ + MEMCPY(&pDest[*pIndex], __pSource, byteSize);\ + *(pIndex) += byteSize;\ + __pSource += byteSize;\ + }\ +} while(false) +#define generic_api2buf_1(pDest, pSource, pIndex, byteSize) do { \ + MEMCPY(&pDest[*pIndex], (const UInt8*)(pSource), byteSize);\ + *(pIndex) += byteSize;\ +} while(false) +#endif + +#define UInt8_api2buf(pDest, pSource, length, pIndex) do { \ + if(__builtin_constant_p(length) && (length == 1)) { \ + (pDest)[*(pIndex)] = *(pSource); \ + } \ + else\ + { \ + MEMCPY(&(pDest)[*(pIndex)], (pSource), (length)); \ + } \ + *(pIndex)+=(length); \ +} while(false) +#define UInt8_api2buf_1(pDest, pSource, pIndex) do { \ + (pDest)[*(pIndex)] = *(pSource); \ + *(pIndex)+=1; \ +} while(false) + +#define void_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define Bool_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define bool_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define char_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define Byte_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define uint8_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define void_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define Bool_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define bool_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define char_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define Byte_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define uint8_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +#define UInt16_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 2) +#define uint16_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 2) +#define UInt32_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 4) +#define uint32_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 4) +#define UInt16_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 2) +#define UInt32_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 4) +#define uint16_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 2) +#define uint32_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 4) + +#define Int8_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define int8_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define Int16_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define Int32_api2buf(pDest, pSource, length, pIndex) UInt32_api2buf(pDest, pSource, length, pIndex) +#define Int8_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define int8_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define Int16_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define Int32_api2buf_1(pDest, pSource, pIndex) UInt32_api2buf_1(pDest, pSource, pIndex) + +#ifndef HAVE_NO_64BIT +#define UInt64_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 8) +#define uint64_t_api2buf(pDest, pSource, pIndex) UInt64_api2buf(pDest, pSource, length, pIndex) +#define Int64_api2buf(pDest, pSource, length, pIndex) UInt64_api2buf(pDest, pSource, length, pIndex) +#define UInt64_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 8) +#define Int64_api2buf_1(pDest, pSource, pIndex) UInt64_api2buf_1(pDest, pSource, pIndex) +#define uint64_t_api2buf_1(pDest, pSource, pIndex) UInt64_api2buf_1(pDest, pSource, pIndex) +#endif + +#define UInt64Struct_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 8) +#define MACAddress_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 8) +#define BtDeviceAddress_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 6) +#define UInt64Struct_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 8) +#define MACAddress_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 8) +#define BtDeviceAddress_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 6) + + +#define generic_buf2api(pDest, pSource, length, pIndex, byteSize) do { \ + UIntLoop __i; \ + UInt8* __pDest = (UInt8*)(pDest); \ + for (__i = 0; __i < length; __i++) \ + { \ + MEMCPY(__pDest, &(pSource)[*(pIndex)], byteSize); \ + if(byteSize == 2) \ + { \ + LITTLE_TO_HOST_UINT16(__pDest); \ + } \ + else if(byteSize == 4) \ + { \ + LITTLE_TO_HOST_UINT32(__pDest); \ + } \ + else if(byteSize == 8) \ + { \ + LITTLE_TO_HOST_UINT64(__pDest); \ + } \ + *(pIndex) += byteSize; \ + __pDest += byteSize; \ + } \ +} while(false) +#define generic_buf2api_1(pDest, pSource, pIndex, byteSize) do { \ + UInt8* __pDest = (UInt8*)(pDest); \ + MEMCPY(__pDest, &(pSource)[*(pIndex)], byteSize); \ + if(byteSize == 2) \ + { \ + LITTLE_TO_HOST_UINT16(__pDest); \ + } \ + else if(byteSize == 4) \ + { \ + LITTLE_TO_HOST_UINT32(__pDest); \ + } \ + else if(byteSize == 8) \ + { \ + LITTLE_TO_HOST_UINT64(__pDest); \ + } \ + *(pIndex) += byteSize; \ +} while(false) + +#define UInt8_buf2api(pDest, pSource, length, pIndex) do { \ + if(__builtin_constant_p(length) && (length == 1)) { \ + *(pDest) = (pSource)[*(pIndex)]; \ + }\ + else\ + { \ + MEMCPY((pDest), &(pSource)[*(pIndex)], (length)); \ + }\ + *(pIndex)+=(length); \ +} while(false) +#define UInt8_buf2api_1(pDest, pSource, pIndex) do { \ + *(pDest) = (pSource)[*(pIndex)]; \ + *(pIndex)+=1; \ +} while(false) + +#define void_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define Bool_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define bool_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define char_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define Byte_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define uint8_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define void_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define Bool_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define bool_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define char_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define Byte_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define uint8_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) + +#define UInt16_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 2) +#define uint16_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 2) +#define UInt32_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 4) +#define uint32_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 4) +#define UInt16_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 2) +#define uint16_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 2) +#define UInt32_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 4) +#define uint32_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 4) + +#define Int8_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define int8_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define Int16_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define Int32_buf2api(pDest, pSource, length, pIndex) UInt32_buf2api(pDest, pSource, length, pIndex) +#define Int8_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define int8_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define Int16_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define Int32_buf2api_1(pDest, pSource, pIndex) UInt32_buf2api_1(pDest, pSource, pIndex) +#define int_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, sizeof(int)) +#define int_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, sizeof(int)) + +#ifndef HAVE_NO_64BIT +#define UInt64_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 8) +#define uint64_t_buf2api(pDest, pSource, length, pIndex) UInt64_buf2api(pDest, pSource, length, pIndex) +#define Int64_buf2api(pDest, pSource, length, pIndex) UInt64_buf2api(pDest, pSource, length, pIndex) +#define UInt64_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 8) +#define Int64_buf2api_1(pDest, pSource, pIndex) UInt64_buf2api_1(pDest, pSource, pIndex) +#define uint64_t_buf2api_1(pDest, pSource, pIndex) UInt64_buf2api_1(pDest, pSource, pIndex) +#endif + +#define UInt64Struct_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 8) +#define MACAddress_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 8) +#define BtDeviceAddress_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 6) +#define UInt64Struct_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 8) +#define MACAddress_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 8) +#define BtDeviceAddress_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 6) + + +/** @enum gpMarshall_AckStatus_t */ +//@{ +/** @brief Command processed correctly */ +#define gpMarshall_AckStatusSuccess 0x0 +/** @brief Command not known by device */ +#define gpMarshall_AckStatusUnknownCommand 0x1 +/** @brief Command unsupported */ +#define gpMarshall_AckStatusUnsupportedCommand 0x2 +/** @brief Command parameter length incorrect */ +#define gpMarshall_AckStatusWrongParameterLength 0x3 +/** @brief Command execution failure */ +#define gpMarshall_AckStatusExecutionFailed 0x4 +/** @brief Device not able to process command at this time */ +#define gpMarshall_AckStatusBusy 0x5 +/** @brief The connected PC client is not the expected client. Last connected client takes ownership of the board, rendering previously connected client invalid */ +#define gpMarshall_AckStatusClientIDMismatch 0x6 +/** @typedef AckStatus_t + @brief Serial status reported on communication +*/ +typedef UInt8 gpMarshall_AckStatus_t; +//@} + +/***************************************************************************** + * Main function return + *****************************************************************************/ +#define MAIN_FUNCTION_RETURN_TYPE int +#define MAIN_FUNCTION_RETURN_VALUE (0) + +#endif // _GLOBAL_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/inc/gpModule.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/inc/gpModule.h new file mode 100644 index 0000000..e5971e6 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_PLATFORM/inc/gpModule.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpModule.h + * This file contains the MODULE ID of the components that uses the serial protocol. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_MODULE_H_ +#define _GP_MODULE_H_ + +#ifdef GP_COMP_SHMEM +#define GP_MODULE_ID_SHMEM 23 +#endif //GP_COMP_SHMEM +#ifdef GP_COMP_ASSERT +#define GP_MODULE_ID_ASSERTAPI 29 +#endif //GP_COMP_ASSERT +#ifdef GP_COMP_MACCORE +#define GP_MODULE_ID_MACCOREAPI 109 +#endif //GP_COMP_MACCORE + +#ifdef GP_COMP_NVM +#define GP_MODULE_ID_NVM_API 32 +#endif // GP_COMP_NVM +#if defined(GP_NVM_RW_CACHE_DIVERSITY_GPCOM_SERVER) || defined(GP_NVM_RW_CACHE_DIVERSITY_GPCOM_CLIENT) +#define GP_MODULE_ID_NVM_RW_CACHEAPI 111 +#endif //defined(GP_NVM_RW_CACHE_DIVERSITY_GPCOM_SERVER) || defined(GP_NVM_RW_CACHE_DIVERSITY_GPCOM_CLIENT) +#ifdef GP_COMP_RESET +#define GP_MODULE_ID_RESETAPI 33 +#endif // GP_COMP_RESET +#ifdef GP_COMP_BASECOMPS +#define GP_MODULE_ID_BASECOMPSAPI 35 +#endif +#ifdef GP_COMP_GPHAL +#define GP_MODULE_ID_SNIFFERAPI 68 +#endif //GP_COMP_GPHAL +#ifdef GP_COMP_KEYSCAN +#define GP_MODULE_ID_KEYSCAN 12 +#endif //GP_COMP_KEYSCAN +#ifdef GP_COMP_RANDOM +#define GP_MODULE_ID_RANDOMAPI 108 +#endif //GP_COMP_RANDOM +#ifdef GP_COMP_RFCHANNEL +#define GP_MODULE_ID_RFCHANNELAPI 113 +#endif //GP_COMP_RFCHANNEL +#ifdef GP_COMP_MACDISPATCHER +#define GP_MODULE_ID_MACDISPATCHERAPI 114 +#endif //GP_COMP_MACDISPATCHER +#ifdef GP_COMP_TXMONITOR +#define GP_MODULE_ID_TXMONITOR 122 +#endif +#ifdef GP_COMP_ENCRYPTION +#define GP_MODULE_ID_ENCRYPTIONAPI 124 +#endif +#ifdef GP_COMP_VERSION +#define GP_MODULE_ID_VERSIONAPI 129 +#endif +#ifdef GP_COMP_NVM +#define GP_MODULE_ID_NVMAPI 181 +#endif + +#endif // _GP_MODULE_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPad/inc/gpPad.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPad/inc/gpPad.h new file mode 100644 index 0000000..680aef9 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPad/inc/gpPad.h @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2013, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPPAD_H_ +#define _GPPAD_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_PAD_NR_OF_HANDLES +#define GP_PAD_NR_OF_HANDLES 3 +#endif //GP_PD_NR_OF_HANDLES + +#define GP_PAD_INVALID_HANDLE 0xFF + +#define GP_PAD_MAX_CHANNELS 3 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt8 gpPad_Handle_t; + +#define gpPad_ResultValidHandle 0x0 +#define gpPad_ResultInvalidHandle 0x1 +#define gpPad_ResultNotInUse 0x2 +typedef UInt8 gpPad_Result_t; + +typedef struct gpPad_Attributes_s { + UInt8 channels[GP_PAD_MAX_CHANNELS]; + UInt8 antenna; + Int8 txPower; + UInt8 minBE; + UInt8 maxBE; + UInt8 maxCsmaBackoffs; + UInt8 maxFrameRetries; + UInt8 csma; + UInt8 cca; + Bool retransmitOnCcaFail; + Bool retransmitRandomBackoff; + UInt8 minBERetransmit; + UInt8 maxBERetransmit; +} gpPad_Attributes_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpPad_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +void gpPad_Init(void); + +//Descriptor handling +gpPad_Handle_t gpPad_GetPad(gpPad_Attributes_t* pInitAttributes); +void gpPad_FreePad(gpPad_Handle_t padHandle); +gpPad_Result_t gpPad_CheckPadValid(gpPad_Handle_t padHandle); + +//TxRequest +void gpPad_SetAttributes(gpPad_Handle_t padHandle, gpPad_Attributes_t* pAttributes); +void gpPad_GetAttributes(gpPad_Handle_t padHandle, gpPad_Attributes_t* pAttributes); + +void gpPad_SetTxChannels(gpPad_Handle_t padHandle, UInt8* channels); +void gpPad_SetTxPower(gpPad_Handle_t padHandle, Int8 txPower); +void gpPad_SetTxAntenna(gpPad_Handle_t padHandle, UInt8 antenna); +void gpPad_SetTxMinBE(gpPad_Handle_t padHandle, UInt8 minBE); +void gpPad_SetTxMaxBE(gpPad_Handle_t padHandle, UInt8 maxBE); +void gpPad_SetTxMaxCsmaBackoffs(gpPad_Handle_t padHandle, UInt8 maxCsmaBackoffs); +void gpPad_SetTxMaxFrameRetries(gpPad_Handle_t padHandle, UInt8 maxFrameRetries); +void gpPad_SetTxCsmaMode(gpPad_Handle_t padHandle, UInt8 csma); +void gpPad_SetCcaMode(gpPad_Handle_t padHandle, UInt8 cca); + +void gpPad_GetTxChannels(gpPad_Handle_t padHandle, UInt8* channels); +Int8 gpPad_GetTxPower(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxAntenna(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxMinBE(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxMaxBE(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxMaxCsmaBackoffs(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxMaxFrameRetries(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxCsmaMode(gpPad_Handle_t padHandle); +UInt8 gpPad_GetCcaMode(gpPad_Handle_t padHandle); + +void gpPad_SetRetransmitOnCcaFail(gpPad_Handle_t padHandle, Bool enabled); +Bool gpPad_GetRetransmitOnCcaFail(gpPad_Handle_t padHandle); +void gpPad_SetRetransmitRandomBackoff(gpPad_Handle_t padHandle, Bool enabled); +Bool gpPad_GetRetransmitRandomBackoff(gpPad_Handle_t padHandle); + +void gpPad_SetMinBeRetransmit(gpPad_Handle_t padHandle, UInt8 minBERetransmit); +UInt8 gpPad_GetMinBeRetransmit(gpPad_Handle_t padHandle); +void gpPad_SetMaxBeRetransmit(gpPad_Handle_t padHandle, UInt8 maxBERetransmit); +UInt8 gpPad_GetMaxBeRetransmit(gpPad_Handle_t padHandle); +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPPD_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/inc/gen/gpPd_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/inc/gen/gpPd_marshalling.h new file mode 100644 index 0000000..00e6aaf --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/inc/gen/gpPd_marshalling.h @@ -0,0 +1,1079 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPPD_MARSHALLING_H_ +#define _GPPD_MARSHALLING_H_ + +//DOCUMENTATION PD: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpPd_Loh_t data[1]; +} gpPd_Loh_t_l1_pointer_marshall_t; + + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Offset_t offset; +} gpPd_ReadByte_Input_struct_t; + +typedef struct { + gpPd_ReadByte_Input_struct_t data; +} gpPd_ReadByte_Input_marshall_struct_t; + +typedef struct { + UInt8 returnVal; +} gpPd_ReadByte_Output_struct_t; + +typedef struct { + gpPd_ReadByte_Output_struct_t data; +} gpPd_ReadByte_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Offset_t offset; + UInt8 byte; +} gpPd_WriteByte_Input_struct_t; + +typedef struct { + gpPd_WriteByte_Input_struct_t data; +} gpPd_WriteByte_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Offset_t offset; + UInt8 length; +} gpPd_ReadByteStream_Input_struct_t; + +typedef struct { + gpPd_ReadByteStream_Input_struct_t data; +} gpPd_ReadByteStream_Input_marshall_struct_t; + +typedef struct { + UInt8* pBuf; +} gpPd_ReadByteStream_Output_struct_t; + +typedef struct { + gpPd_ReadByteStream_Output_struct_t data; + UInt8 pBuf[255]; +} gpPd_ReadByteStream_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Offset_t offset; + UInt8 length; + UInt8* pBuf; +} gpPd_WriteByteStream_Input_struct_t; + +typedef struct { + gpPd_WriteByteStream_Input_struct_t data; + UInt8 pBuf[255]; +} gpPd_WriteByteStream_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t returnVal; +} gpPd_GetPd_Output_struct_t; + +typedef struct { + gpPd_GetPd_Output_struct_t data; +} gpPd_GetPd_Output_marshall_struct_t; + + +typedef struct { + gpPd_BufferType_t type; + UInt16 size; +} gpPd_GetCustomPd_Input_struct_t; + +typedef struct { + gpPd_GetCustomPd_Input_struct_t data; +} gpPd_GetCustomPd_Input_marshall_struct_t; + +typedef struct { + gpPd_Handle_t returnVal; +} gpPd_GetCustomPd_Output_struct_t; + +typedef struct { + gpPd_GetCustomPd_Output_struct_t data; +} gpPd_GetCustomPd_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_FreePd_Input_struct_t; + +typedef struct { + gpPd_FreePd_Input_struct_t data; +} gpPd_FreePd_Input_marshall_struct_t; + + +typedef struct { + UInt8 pbmHandle; + UInt16 pbmOffset; + UInt16 pbmLength; +} gpPd_cbDataConfirm_Input_struct_t; + +typedef struct { + gpPd_cbDataConfirm_Input_struct_t data; +} gpPd_cbDataConfirm_Input_marshall_struct_t; + +typedef struct { + gpPd_Loh_t* p_PdLoh; +} gpPd_cbDataConfirm_Output_struct_t; + +typedef struct { + gpPd_cbDataConfirm_Output_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t p_PdLoh; +} gpPd_cbDataConfirm_Output_marshall_struct_t; + + +typedef struct { + UInt8 pbmHandle; + UInt16 pbmOffset; + UInt16 pbmLength; + gpPd_BufferType_t type; +} gpPd_DataIndication_Input_struct_t; + +typedef struct { + gpPd_DataIndication_Input_struct_t data; +} gpPd_DataIndication_Input_marshall_struct_t; + +typedef struct { + gpPd_Loh_t* p_PdLoh; +} gpPd_DataIndication_Output_struct_t; + +typedef struct { + gpPd_DataIndication_Output_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t p_PdLoh; +} gpPd_DataIndication_Output_marshall_struct_t; + + +typedef struct { + gpPd_Loh_t* p_PdLoh; +} gpPd_DataRequest_Input_struct_t; + +typedef struct { + gpPd_DataRequest_Input_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t p_PdLoh; +} gpPd_DataRequest_Input_marshall_struct_t; + +typedef struct { + UInt8 returnVal; +} gpPd_DataRequest_Output_struct_t; + +typedef struct { + gpPd_DataRequest_Output_struct_t data; +} gpPd_DataRequest_Output_marshall_struct_t; + + +typedef struct { + UInt8 pbmHandle; +} gpPd_cbPurgeConfirm_Input_struct_t; + +typedef struct { + gpPd_cbPurgeConfirm_Input_struct_t data; +} gpPd_cbPurgeConfirm_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_PurgeRequest_Input_struct_t; + +typedef struct { + gpPd_PurgeRequest_Input_struct_t data; +} gpPd_PurgeRequest_Input_marshall_struct_t; + +typedef struct { + gpPd_Handle_t returnVal; +} gpPd_PurgeRequest_Output_struct_t; + +typedef struct { + gpPd_PurgeRequest_Output_struct_t data; +} gpPd_PurgeRequest_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 dataOffset; + UInt8 dataLength; + UInt8 auxOffset; + UInt8 auxLength; +} gpPd_SecRequest_Input_struct_t; + +typedef struct { + gpPd_SecRequest_Input_struct_t data; +} gpPd_SecRequest_Input_marshall_struct_t; + +typedef struct { + UInt8 returnVal; +} gpPd_SecRequest_Output_struct_t; + +typedef struct { + gpPd_SecRequest_Output_struct_t data; +} gpPd_SecRequest_Output_marshall_struct_t; + + +typedef struct { + UInt8 pbmHandle; + UInt8 dataOffset; + UInt8 dataLength; +} gpPd_cbSecConfirm_Input_struct_t; + +typedef struct { + gpPd_cbSecConfirm_Input_struct_t data; +} gpPd_cbSecConfirm_Input_marshall_struct_t; + +typedef struct { + gpPd_Handle_t returnVal; +} gpPd_cbSecConfirm_Output_struct_t; + +typedef struct { + gpPd_cbSecConfirm_Output_struct_t data; +} gpPd_cbSecConfirm_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_CheckPdValid_Input_struct_t; + +typedef struct { + gpPd_CheckPdValid_Input_struct_t data; +} gpPd_CheckPdValid_Input_marshall_struct_t; + +typedef struct { + gpPd_Result_t returnVal; +} gpPd_CheckPdValid_Output_struct_t; + +typedef struct { + gpPd_CheckPdValid_Output_struct_t data; +} gpPd_CheckPdValid_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRssi_Input_struct_t; + +typedef struct { + gpPd_GetRssi_Input_struct_t data; +} gpPd_GetRssi_Input_marshall_struct_t; + +typedef struct { + gpPd_Rssi_t rssi; +} gpPd_GetRssi_Output_struct_t; + +typedef struct { + gpPd_GetRssi_Output_struct_t data; +} gpPd_GetRssi_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Rssi_t rssi; +} gpPd_SetRssi_Input_struct_t; + +typedef struct { + gpPd_SetRssi_Input_struct_t data; +} gpPd_SetRssi_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetLqi_Input_struct_t; + +typedef struct { + gpPd_GetLqi_Input_struct_t data; +} gpPd_GetLqi_Input_marshall_struct_t; + +typedef struct { + gpPd_Lqi_t lqi; +} gpPd_GetLqi_Output_struct_t; + +typedef struct { + gpPd_GetLqi_Output_struct_t data; +} gpPd_GetLqi_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Lqi_t lqi; +} gpPd_SetLqi_Input_struct_t; + +typedef struct { + gpPd_SetLqi_Input_struct_t data; +} gpPd_SetLqi_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxTimestamp_Input_struct_t; + +typedef struct { + gpPd_GetRxTimestamp_Input_struct_t data; +} gpPd_GetRxTimestamp_Input_marshall_struct_t; + +typedef struct { + UInt32 timestamp; +} gpPd_GetRxTimestamp_Output_struct_t; + +typedef struct { + gpPd_GetRxTimestamp_Output_struct_t data; +} gpPd_GetRxTimestamp_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxTimestamp_Input_struct_t; + +typedef struct { + gpPd_GetTxTimestamp_Input_struct_t data; +} gpPd_GetTxTimestamp_Input_marshall_struct_t; + +typedef struct { + UInt32 timestamp; +} gpPd_GetTxTimestamp_Output_struct_t; + +typedef struct { + gpPd_GetTxTimestamp_Output_struct_t data; +} gpPd_GetTxTimestamp_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_TimeStamp_t timestamp; +} gpPd_SetRxTimestamp_Input_struct_t; + +typedef struct { + gpPd_SetRxTimestamp_Input_struct_t data; +} gpPd_SetRxTimestamp_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_TimeStamp_t timestamp; +} gpPd_SetTxTimestamp_Input_struct_t; + +typedef struct { + gpPd_SetTxTimestamp_Input_struct_t data; +} gpPd_SetTxTimestamp_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_CopyPd_Input_struct_t; + +typedef struct { + gpPd_CopyPd_Input_struct_t data; +} gpPd_CopyPd_Input_marshall_struct_t; + +typedef struct { + gpPd_Handle_t copyPd; +} gpPd_CopyPd_Output_struct_t; + +typedef struct { + gpPd_CopyPd_Output_struct_t data; +} gpPd_CopyPd_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxRetryCntr_Input_struct_t; + +typedef struct { + gpPd_GetTxRetryCntr_Input_struct_t data; +} gpPd_GetTxRetryCntr_Input_marshall_struct_t; + +typedef struct { + UInt8 retryCntr; +} gpPd_GetTxRetryCntr_Output_struct_t; + +typedef struct { + gpPd_GetTxRetryCntr_Output_struct_t data; +} gpPd_GetTxRetryCntr_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxTimestampChip_Input_struct_t; + +typedef struct { + gpPd_GetRxTimestampChip_Input_struct_t data; +} gpPd_GetRxTimestampChip_Input_marshall_struct_t; + +typedef struct { + gpPd_TimeStamp_t timestamp; +} gpPd_GetRxTimestampChip_Output_struct_t; + +typedef struct { + gpPd_GetRxTimestampChip_Output_struct_t data; +} gpPd_GetRxTimestampChip_Output_marshall_struct_t; + + +typedef struct { + gpPd_Loh_t* pPdLoh; + UInt8 length; + UInt8* pData; //FIXME - Manual +} gpPd_AppendWithUpdate_Input_struct_t; + +typedef struct { + gpPd_AppendWithUpdate_Input_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t pPdLoh; + UInt8 pData[128]; +} gpPd_AppendWithUpdate_Input_marshall_struct_t; + +typedef struct { + // pPdLoh used from input structure because it is an inout parameter + char _unused_dummy; // struct shall not be empty in C99 +} gpPd_AppendWithUpdate_Output_struct_t; + +typedef struct { + gpPd_AppendWithUpdate_Output_struct_t data; + // pPdLoh used from input structure because it is an inout parameter +} gpPd_AppendWithUpdate_Output_marshall_struct_t; + + +typedef struct { + gpPd_Loh_t* pPdLoh; + UInt8 length; + UInt8* pData; +} gpPd_PrependWithUpdate_Input_struct_t; + +typedef struct { + gpPd_PrependWithUpdate_Input_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t pPdLoh; + UInt8 pData[128]; +} gpPd_PrependWithUpdate_Input_marshall_struct_t; + +typedef struct { + // pPdLoh used from input structure because it is an inout parameter + char _unused_dummy; // struct shall not be empty in C99 +} gpPd_PrependWithUpdate_Output_struct_t; + +typedef struct { + gpPd_PrependWithUpdate_Output_struct_t data; + // pPdLoh used from input structure because it is an inout parameter +} gpPd_PrependWithUpdate_Output_marshall_struct_t; + + +typedef struct { + gpPd_Loh_t* pPdLoh; + UInt8 length; +} gpPd_ReadWithUpdate_Input_struct_t; + +typedef struct { + gpPd_ReadWithUpdate_Input_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t pPdLoh; +} gpPd_ReadWithUpdate_Input_marshall_struct_t; + +typedef struct { + // pPdLoh used from input structure because it is an inout parameter + UInt8* pData; +} gpPd_ReadWithUpdate_Output_struct_t; + +typedef struct { + gpPd_ReadWithUpdate_Output_struct_t data; + // pPdLoh used from input structure because it is an inout parameter + UInt8 pData[128]; +} gpPd_ReadWithUpdate_Output_marshall_struct_t; + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxTimestampExt_Input_struct_t; //FIXME - Manual + +typedef struct { + gpPd_GetRxTimestampExt_Input_struct_t data; +} gpPd_GetRxTimestampExt_Input_marshall_struct_t; //FIXME - Manual + +typedef struct { + gpPd_TimeStamp_t timestamp; +} gpPd_GetRxTimestampExt_Output_struct_t; //FIXME - Manual + +typedef struct { + gpPd_GetRxTimestampExt_Output_struct_t data; +} gpPd_GetRxTimestampExt_Output_marshall_struct_t; //FIXME - Manual + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxTimestampExt_Input_struct_t; //FIXME - Manual + +typedef struct { + gpPd_GetTxTimestampExt_Input_struct_t data; +} gpPd_GetTxTimestampExt_Input_marshall_struct_t; //FIXME - Manual + +typedef struct { + gpPd_TimeStamp_t timestamp; +} gpPd_GetTxTimestampExt_Output_struct_t; //FIXME - Manual + +typedef struct { + gpPd_GetTxTimestampExt_Output_struct_t data; +} gpPd_GetTxTimestampExt_Output_marshall_struct_t; //FIXME - Manual + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 retryCntr; +} gpPd_SetTxRetryCntr_Input_struct_t; + +typedef struct { + gpPd_SetTxRetryCntr_Input_struct_t data; +} gpPd_SetTxRetryCntr_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxChannel_Input_struct_t; + +typedef struct { + gpPd_GetRxChannel_Input_struct_t data; +} gpPd_GetRxChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 rxChannel; +} gpPd_GetRxChannel_Output_struct_t; + +typedef struct { + gpPd_GetRxChannel_Output_struct_t data; +} gpPd_GetRxChannel_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 rxChannel; +} gpPd_SetRxChannel_Input_struct_t; + +typedef struct { + gpPd_SetRxChannel_Input_struct_t data; +} gpPd_SetRxChannel_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetFramePendingAfterTx_Input_struct_t; + +typedef struct { + gpPd_GetFramePendingAfterTx_Input_struct_t data; +} gpPd_GetFramePendingAfterTx_Input_marshall_struct_t; + +typedef struct { + UInt8 framePending; +} gpPd_GetFramePendingAfterTx_Output_struct_t; + +typedef struct { + gpPd_GetFramePendingAfterTx_Output_struct_t data; +} gpPd_GetFramePendingAfterTx_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 framePending; +} gpPd_SetFramePendingAfterTx_Input_struct_t; + +typedef struct { + gpPd_SetFramePendingAfterTx_Input_struct_t data; +} gpPd_SetFramePendingAfterTx_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxCCACntr_Input_struct_t; + +typedef struct { + gpPd_GetTxCCACntr_Input_struct_t data; +} gpPd_GetTxCCACntr_Input_marshall_struct_t; + +typedef struct { + UInt8 txCCACntr; +} gpPd_GetTxCCACntr_Output_struct_t; + +typedef struct { + gpPd_GetTxCCACntr_Output_struct_t data; +} gpPd_GetTxCCACntr_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxAckLqi_Input_struct_t; + +typedef struct { + gpPd_GetTxAckLqi_Input_struct_t data; +} gpPd_GetTxAckLqi_Input_marshall_struct_t; + +typedef struct { + gpPd_Lqi_t ackLqi; +} gpPd_GetTxAckLqi_Output_struct_t; + +typedef struct { + gpPd_GetTxAckLqi_Output_struct_t data; +} gpPd_GetTxAckLqi_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetFrameControlFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_GetFrameControlFromTxAckAfterRx_Input_struct_t data; +} gpPd_GetFrameControlFromTxAckAfterRx_Input_marshall_struct_t; + +typedef struct { + UInt16 framePending; +} gpPd_GetFrameControlFromTxAckAfterRx_Output_struct_t; + +typedef struct { + gpPd_GetFrameControlFromTxAckAfterRx_Output_struct_t data; +} gpPd_GetFrameControlFromTxAckAfterRx_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt16 framePending; +} gpPd_SetFrameControlFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_SetFrameControlFromTxAckAfterRx_Input_struct_t data; +} gpPd_SetFrameControlFromTxAckAfterRx_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxEnhancedAckFromTxPbm_Input_struct_t; + +typedef struct { + gpPd_GetRxEnhancedAckFromTxPbm_Input_struct_t data; +} gpPd_GetRxEnhancedAckFromTxPbm_Input_marshall_struct_t; + +typedef struct { + Bool enhancedAck; +} gpPd_GetRxEnhancedAckFromTxPbm_Output_struct_t; + +typedef struct { + gpPd_GetRxEnhancedAckFromTxPbm_Output_struct_t data; +} gpPd_GetRxEnhancedAckFromTxPbm_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + Bool enhancedAck; +} gpPd_SetRxEnhancedAckFromTxPbm_Input_struct_t; + +typedef struct { + gpPd_SetRxEnhancedAckFromTxPbm_Input_struct_t data; +} gpPd_SetRxEnhancedAckFromTxPbm_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetFrameCounterFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_GetFrameCounterFromTxAckAfterRx_Input_struct_t data; +} gpPd_GetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t; + +typedef struct { + UInt32 frameCounter; +} gpPd_GetFrameCounterFromTxAckAfterRx_Output_struct_t; + +typedef struct { + gpPd_GetFrameCounterFromTxAckAfterRx_Output_struct_t data; +} gpPd_GetFrameCounterFromTxAckAfterRx_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt32 frameCounter; +} gpPd_SetFrameCounterFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_SetFrameCounterFromTxAckAfterRx_Input_struct_t data; +} gpPd_SetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetKeyIdFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_GetKeyIdFromTxAckAfterRx_Input_struct_t data; +} gpPd_GetKeyIdFromTxAckAfterRx_Input_marshall_struct_t; + +typedef struct { + UInt8 keyId; +} gpPd_GetKeyIdFromTxAckAfterRx_Output_struct_t; + +typedef struct { + gpPd_GetKeyIdFromTxAckAfterRx_Output_struct_t data; +} gpPd_GetKeyIdFromTxAckAfterRx_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 keyId; +} gpPd_SetKeyIdFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_SetKeyIdFromTxAckAfterRx_Input_struct_t data; +} gpPd_SetKeyIdFromTxAckAfterRx_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxChannel_Input_struct_t; + +typedef struct { + gpPd_GetTxChannel_Input_struct_t data; +} gpPd_GetTxChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 channel; +} gpPd_GetTxChannel_Output_struct_t; + +typedef struct { + gpPd_GetTxChannel_Output_struct_t data; +} gpPd_GetTxChannel_Output_marshall_struct_t; + + +typedef union { + gpPd_ReadByte_Input_marshall_struct_t gpPd_ReadByte; + gpPd_WriteByte_Input_marshall_struct_t gpPd_WriteByte; + gpPd_ReadByteStream_Input_marshall_struct_t gpPd_ReadByteStream; + gpPd_WriteByteStream_Input_marshall_struct_t gpPd_WriteByteStream; + gpPd_GetCustomPd_Input_marshall_struct_t gpPd_GetCustomPd; + gpPd_FreePd_Input_marshall_struct_t gpPd_FreePd; + gpPd_cbDataConfirm_Input_marshall_struct_t gpPd_cbDataConfirm; + gpPd_DataIndication_Input_marshall_struct_t gpPd_DataIndication; + gpPd_DataRequest_Input_marshall_struct_t gpPd_DataRequest; + gpPd_cbPurgeConfirm_Input_marshall_struct_t gpPd_cbPurgeConfirm; + gpPd_PurgeRequest_Input_marshall_struct_t gpPd_PurgeRequest; + gpPd_SecRequest_Input_marshall_struct_t gpPd_SecRequest; + gpPd_cbSecConfirm_Input_marshall_struct_t gpPd_cbSecConfirm; + gpPd_CheckPdValid_Input_marshall_struct_t gpPd_CheckPdValid; + gpPd_GetRssi_Input_marshall_struct_t gpPd_GetRssi; + gpPd_SetRssi_Input_marshall_struct_t gpPd_SetRssi; + gpPd_GetLqi_Input_marshall_struct_t gpPd_GetLqi; + gpPd_SetLqi_Input_marshall_struct_t gpPd_SetLqi; + gpPd_GetRxTimestamp_Input_marshall_struct_t gpPd_GetRxTimestamp; + gpPd_GetTxTimestamp_Input_marshall_struct_t gpPd_GetTxTimestamp; + gpPd_SetRxTimestamp_Input_marshall_struct_t gpPd_SetRxTimestamp; + gpPd_SetTxTimestamp_Input_marshall_struct_t gpPd_SetTxTimestamp; + gpPd_CopyPd_Input_marshall_struct_t gpPd_CopyPd; + gpPd_GetTxRetryCntr_Input_marshall_struct_t gpPd_GetTxRetryCntr; + gpPd_GetRxTimestampChip_Input_marshall_struct_t gpPd_GetRxTimestampChip; + gpPd_AppendWithUpdate_Input_marshall_struct_t gpPd_AppendWithUpdate; + gpPd_PrependWithUpdate_Input_marshall_struct_t gpPd_PrependWithUpdate; + gpPd_ReadWithUpdate_Input_marshall_struct_t gpPd_ReadWithUpdate; + gpPd_GetRxTimestampExt_Input_marshall_struct_t gpPd_GetRxTimestampExt; //FIXME - Manual + gpPd_GetTxTimestampExt_Input_marshall_struct_t gpPd_GetTxTimestampExt; //FIXME - Manual + gpPd_SetTxRetryCntr_Input_marshall_struct_t gpPd_SetTxRetryCntr; + gpPd_GetRxChannel_Input_marshall_struct_t gpPd_GetRxChannel; + gpPd_SetRxChannel_Input_marshall_struct_t gpPd_SetRxChannel; + gpPd_GetFramePendingAfterTx_Input_marshall_struct_t gpPd_GetFramePendingAfterTx; + gpPd_SetFramePendingAfterTx_Input_marshall_struct_t gpPd_SetFramePendingAfterTx; + gpPd_GetTxCCACntr_Input_marshall_struct_t gpPd_GetTxCCACntr; + gpPd_GetTxAckLqi_Input_marshall_struct_t gpPd_GetTxAckLqi; + gpPd_GetFrameControlFromTxAckAfterRx_Input_marshall_struct_t gpPd_GetFrameControlFromTxAckAfterRx; + gpPd_SetFrameControlFromTxAckAfterRx_Input_marshall_struct_t gpPd_SetFrameControlFromTxAckAfterRx; + gpPd_GetRxEnhancedAckFromTxPbm_Input_marshall_struct_t gpPd_GetRxEnhancedAckFromTxPbm; + gpPd_SetRxEnhancedAckFromTxPbm_Input_marshall_struct_t gpPd_SetRxEnhancedAckFromTxPbm; + gpPd_GetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t gpPd_GetFrameCounterFromTxAckAfterRx; + gpPd_SetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t gpPd_SetFrameCounterFromTxAckAfterRx; + gpPd_GetKeyIdFromTxAckAfterRx_Input_marshall_struct_t gpPd_GetKeyIdFromTxAckAfterRx; + gpPd_SetKeyIdFromTxAckAfterRx_Input_marshall_struct_t gpPd_SetKeyIdFromTxAckAfterRx; + gpPd_GetTxChannel_Input_marshall_struct_t gpPd_GetTxChannel; + UInt8 dummy; //ensure none empty union definition +} gpPd_Server_Input_union_t; + +typedef union { + gpPd_ReadByte_Output_marshall_struct_t gpPd_ReadByte; + gpPd_ReadByteStream_Output_marshall_struct_t gpPd_ReadByteStream; + gpPd_GetPd_Output_marshall_struct_t gpPd_GetPd; + gpPd_GetCustomPd_Output_marshall_struct_t gpPd_GetCustomPd; + gpPd_cbDataConfirm_Output_marshall_struct_t gpPd_cbDataConfirm; + gpPd_DataIndication_Output_marshall_struct_t gpPd_DataIndication; + gpPd_DataRequest_Output_marshall_struct_t gpPd_DataRequest; + gpPd_PurgeRequest_Output_marshall_struct_t gpPd_PurgeRequest; + gpPd_SecRequest_Output_marshall_struct_t gpPd_SecRequest; + gpPd_cbSecConfirm_Output_marshall_struct_t gpPd_cbSecConfirm; + gpPd_CheckPdValid_Output_marshall_struct_t gpPd_CheckPdValid; + gpPd_GetRssi_Output_marshall_struct_t gpPd_GetRssi; + gpPd_GetLqi_Output_marshall_struct_t gpPd_GetLqi; + gpPd_GetRxTimestamp_Output_marshall_struct_t gpPd_GetRxTimestamp; + gpPd_GetTxTimestamp_Output_marshall_struct_t gpPd_GetTxTimestamp; + gpPd_CopyPd_Output_marshall_struct_t gpPd_CopyPd; + gpPd_GetTxRetryCntr_Output_marshall_struct_t gpPd_GetTxRetryCntr; + gpPd_GetRxTimestampChip_Output_marshall_struct_t gpPd_GetRxTimestampChip; + gpPd_AppendWithUpdate_Output_marshall_struct_t gpPd_AppendWithUpdate; + gpPd_PrependWithUpdate_Output_marshall_struct_t gpPd_PrependWithUpdate; + gpPd_ReadWithUpdate_Output_marshall_struct_t gpPd_ReadWithUpdate; + gpPd_GetRxTimestampExt_Output_marshall_struct_t gpPd_GetRxTimestampExt; //FIXME - Manual + gpPd_GetTxTimestampExt_Output_marshall_struct_t gpPd_GetTxTimestampExt; //FIXME - Manual + gpPd_GetRxChannel_Output_marshall_struct_t gpPd_GetRxChannel; + gpPd_GetFramePendingAfterTx_Output_marshall_struct_t gpPd_GetFramePendingAfterTx; + gpPd_GetTxCCACntr_Output_marshall_struct_t gpPd_GetTxCCACntr; + gpPd_GetTxAckLqi_Output_marshall_struct_t gpPd_GetTxAckLqi; + gpPd_GetFrameControlFromTxAckAfterRx_Output_marshall_struct_t gpPd_GetFrameControlFromTxAckAfterRx; + gpPd_GetRxEnhancedAckFromTxPbm_Output_marshall_struct_t gpPd_GetRxEnhancedAckFromTxPbm; + gpPd_GetFrameCounterFromTxAckAfterRx_Output_marshall_struct_t gpPd_GetFrameCounterFromTxAckAfterRx; + gpPd_GetKeyIdFromTxAckAfterRx_Output_marshall_struct_t gpPd_GetKeyIdFromTxAckAfterRx; + gpPd_GetTxChannel_Output_marshall_struct_t gpPd_GetTxChannel; + UInt8 dummy; //ensure none empty union definition +} gpPd_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpPd_Handle_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Handle_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Handle_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Handle_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Offset_t_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Offset_t_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Offset_t_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Offset_t_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Length_t_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Length_t_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Length_t_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Length_t_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Lqi_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Lqi_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Lqi_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Lqi_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Rssi_t_buf2api(pDest, pSource, length, pIndex) Int8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Rssi_t_api2buf(pDest, pSource, length, pIndex) Int8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Rssi_t_buf2api_1(pDest, pSource, pIndex) Int8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Rssi_t_api2buf_1(pDest, pSource, pIndex) Int8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_BufferType_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_BufferType_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_BufferType_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_BufferType_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_TimeStamp_t_buf2api(pDest, pSource, length, pIndex) UInt32_buf2api(pDest, pSource, length, pIndex) +#define gpPd_TimeStamp_t_api2buf(pDest, pSource, length, pIndex) UInt32_api2buf(pDest, pSource, length, pIndex) +#define gpPd_TimeStamp_t_buf2api_1(pDest, pSource, pIndex) UInt32_buf2api_1(pDest, pSource, pIndex) +#define gpPd_TimeStamp_t_api2buf_1(pDest, pSource, pIndex) UInt32_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +gpMarshall_AckStatus_t gpPd_Loh_t_buf2api(gpPd_Loh_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex , Bool storePdHandle ); +void gpPd_Loh_t_api2buf(UInt8Buffer* pDest , const gpPd_Loh_t* pSource , UInt16 length , UInt16* pIndex); +// Server functions +gpMarshall_AckStatus_t gpPd_ReadByte_Input_buf2api(gpPd_ReadByte_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_ReadByte_Output_api2buf(UInt8Buffer* pDest , gpPd_ReadByte_Output_marshall_struct_t* pSourceoutput , gpPd_ReadByte_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_WriteByte_Input_buf2api(gpPd_WriteByte_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_ReadByteStream_Input_buf2api(gpPd_ReadByteStream_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_ReadByteStream_Output_api2buf(UInt8Buffer* pDest , gpPd_ReadByteStream_Output_marshall_struct_t* pSourceoutput , gpPd_ReadByteStream_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_WriteByteStream_Input_buf2api(gpPd_WriteByteStream_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetPd_Output_api2buf(UInt8Buffer* pDest , gpPd_GetPd_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetCustomPd_Input_buf2api(gpPd_GetCustomPd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetCustomPd_Output_api2buf(UInt8Buffer* pDest , gpPd_GetCustomPd_Output_marshall_struct_t* pSourceoutput , gpPd_GetCustomPd_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_FreePd_Input_buf2api(gpPd_FreePd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_cbDataConfirm_Input_buf2api(gpPd_cbDataConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_cbDataConfirm_Output_api2buf(UInt8Buffer* pDest , gpPd_cbDataConfirm_Output_marshall_struct_t* pSourceoutput , gpPd_cbDataConfirm_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_DataIndication_Input_buf2api(gpPd_DataIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_DataIndication_Output_api2buf(UInt8Buffer* pDest , gpPd_DataIndication_Output_marshall_struct_t* pSourceoutput , gpPd_DataIndication_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_DataRequest_Input_buf2api(gpPd_DataRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_DataRequest_Output_api2buf(UInt8Buffer* pDest , gpPd_DataRequest_Output_marshall_struct_t* pSourceoutput , gpPd_DataRequest_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_cbPurgeConfirm_Input_buf2api(gpPd_cbPurgeConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_PurgeRequest_Input_buf2api(gpPd_PurgeRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_PurgeRequest_Output_api2buf(UInt8Buffer* pDest , gpPd_PurgeRequest_Output_marshall_struct_t* pSourceoutput , gpPd_PurgeRequest_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SecRequest_Input_buf2api(gpPd_SecRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SecRequest_Output_api2buf(UInt8Buffer* pDest , gpPd_SecRequest_Output_marshall_struct_t* pSourceoutput , gpPd_SecRequest_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_cbSecConfirm_Input_buf2api(gpPd_cbSecConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_cbSecConfirm_Output_api2buf(UInt8Buffer* pDest , gpPd_cbSecConfirm_Output_marshall_struct_t* pSourceoutput , gpPd_cbSecConfirm_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_CheckPdValid_Input_buf2api(gpPd_CheckPdValid_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_CheckPdValid_Output_api2buf(UInt8Buffer* pDest , gpPd_CheckPdValid_Output_marshall_struct_t* pSourceoutput , gpPd_CheckPdValid_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRssi_Input_buf2api(gpPd_GetRssi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRssi_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRssi_Output_marshall_struct_t* pSourceoutput , gpPd_GetRssi_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetRssi_Input_buf2api(gpPd_SetRssi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetLqi_Input_buf2api(gpPd_GetLqi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetLqi_Output_api2buf(UInt8Buffer* pDest , gpPd_GetLqi_Output_marshall_struct_t* pSourceoutput , gpPd_GetLqi_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetLqi_Input_buf2api(gpPd_SetLqi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxTimestamp_Input_buf2api(gpPd_GetRxTimestamp_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxTimestamp_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRxTimestamp_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxTimestamp_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxTimestamp_Input_buf2api(gpPd_GetTxTimestamp_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxTimestamp_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxTimestamp_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxTimestamp_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetRxTimestamp_Input_buf2api(gpPd_SetRxTimestamp_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetTxTimestamp_Input_buf2api(gpPd_SetTxTimestamp_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_CopyPd_Input_buf2api(gpPd_CopyPd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_CopyPd_Output_api2buf(UInt8Buffer* pDest , gpPd_CopyPd_Output_marshall_struct_t* pSourceoutput , gpPd_CopyPd_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxRetryCntr_Input_buf2api(gpPd_GetTxRetryCntr_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxRetryCntr_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxRetryCntr_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxRetryCntr_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxTimestampChip_Input_buf2api(gpPd_GetRxTimestampChip_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxTimestampChip_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRxTimestampChip_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxTimestampChip_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_AppendWithUpdate_Input_buf2api(gpPd_AppendWithUpdate_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_AppendWithUpdate_Output_api2buf(UInt8Buffer* pDest , gpPd_AppendWithUpdate_Output_marshall_struct_t* pSourceoutput , gpPd_AppendWithUpdate_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_PrependWithUpdate_Input_buf2api(gpPd_PrependWithUpdate_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_PrependWithUpdate_Output_api2buf(UInt8Buffer* pDest , gpPd_PrependWithUpdate_Output_marshall_struct_t* pSourceoutput , gpPd_PrependWithUpdate_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_ReadWithUpdate_Input_buf2api(gpPd_ReadWithUpdate_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_ReadWithUpdate_Output_api2buf(UInt8Buffer* pDest , gpPd_ReadWithUpdate_Output_marshall_struct_t* pSourceoutput , gpPd_ReadWithUpdate_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxTimestampExt_Input_buf2api( gpPd_GetRxTimestampExt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetRxTimestampExt_Output_api2buf( UInt8Buffer* pDest , gpPd_GetRxTimestampExt_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxTimestampExt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); //FIXME - Manual +gpMarshall_AckStatus_t gpPd_GetTxTimestampExt_Input_buf2api( gpPd_GetTxTimestampExt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetTxTimestampExt_Output_api2buf( UInt8Buffer* pDest , gpPd_GetTxTimestampExt_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxTimestampExt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); //FIXME - Manual +gpMarshall_AckStatus_t gpPd_SetTxRetryCntr_Input_buf2api(gpPd_SetTxRetryCntr_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxChannel_Input_buf2api(gpPd_GetRxChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxChannel_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRxChannel_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetRxChannel_Input_buf2api(gpPd_SetRxChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetFramePendingAfterTx_Input_buf2api(gpPd_GetFramePendingAfterTx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetFramePendingAfterTx_Output_api2buf(UInt8Buffer* pDest , gpPd_GetFramePendingAfterTx_Output_marshall_struct_t* pSourceoutput , gpPd_GetFramePendingAfterTx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetFramePendingAfterTx_Input_buf2api(gpPd_SetFramePendingAfterTx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxCCACntr_Input_buf2api(gpPd_GetTxCCACntr_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxCCACntr_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxCCACntr_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxCCACntr_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxAckLqi_Input_buf2api(gpPd_GetTxAckLqi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxAckLqi_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxAckLqi_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxAckLqi_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetFrameControlFromTxAckAfterRx_Input_buf2api(gpPd_GetFrameControlFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetFrameControlFromTxAckAfterRx_Output_api2buf(UInt8Buffer* pDest , gpPd_GetFrameControlFromTxAckAfterRx_Output_marshall_struct_t* pSourceoutput , gpPd_GetFrameControlFromTxAckAfterRx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetFrameControlFromTxAckAfterRx_Input_buf2api(gpPd_SetFrameControlFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxEnhancedAckFromTxPbm_Input_buf2api(gpPd_GetRxEnhancedAckFromTxPbm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxEnhancedAckFromTxPbm_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRxEnhancedAckFromTxPbm_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxEnhancedAckFromTxPbm_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetRxEnhancedAckFromTxPbm_Input_buf2api(gpPd_SetRxEnhancedAckFromTxPbm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetFrameCounterFromTxAckAfterRx_Input_buf2api(gpPd_GetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetFrameCounterFromTxAckAfterRx_Output_api2buf(UInt8Buffer* pDest , gpPd_GetFrameCounterFromTxAckAfterRx_Output_marshall_struct_t* pSourceoutput , gpPd_GetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetFrameCounterFromTxAckAfterRx_Input_buf2api(gpPd_SetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetKeyIdFromTxAckAfterRx_Input_buf2api(gpPd_GetKeyIdFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetKeyIdFromTxAckAfterRx_Output_api2buf(UInt8Buffer* pDest , gpPd_GetKeyIdFromTxAckAfterRx_Output_marshall_struct_t* pSourceoutput , gpPd_GetKeyIdFromTxAckAfterRx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetKeyIdFromTxAckAfterRx_Input_buf2api(gpPd_SetKeyIdFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxChannel_Input_buf2api(gpPd_GetTxChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxChannel_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxChannel_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); + +// Client functions +void gpPd_ReadByte_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt16* pIndex); +void gpPd_ReadByte_Output_buf2par(UInt8* returnVal , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_WriteByte_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8 byte , UInt16* pIndex); +void gpPd_ReadByteStream_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8 length , UInt16* pIndex); +void gpPd_ReadByteStream_Output_buf2par(gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8 length , UInt8* pBuf , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_WriteByteStream_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8 length , UInt8* pBuf , UInt16* pIndex); +void gpPd_GetPd_Output_buf2par(gpPd_Handle_t* returnVal , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetCustomPd_Input_par2buf(UInt8Buffer* pDest , gpPd_BufferType_t type , UInt16 size , UInt16* pIndex); +void gpPd_GetCustomPd_Output_buf2par(gpPd_Handle_t* returnVal , gpPd_BufferType_t type , UInt16 size , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_FreePd_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_cbDataConfirm_Input_par2buf(UInt8Buffer* pDest , UInt8 pbmHandle , UInt16 pbmOffset , UInt16 pbmLength , UInt16* pIndex); +void gpPd_cbDataConfirm_Output_buf2par(UInt8 pbmHandle , UInt16 pbmOffset , UInt16 pbmLength , gpPd_Loh_t* p_PdLoh , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_DataIndication_Input_par2buf(UInt8Buffer* pDest , UInt8 pbmHandle , UInt16 pbmOffset , UInt16 pbmLength , gpPd_BufferType_t type , UInt16* pIndex); +void gpPd_DataIndication_Output_buf2par(UInt8 pbmHandle , UInt16 pbmOffset , UInt16 pbmLength , gpPd_Loh_t* p_PdLoh , gpPd_BufferType_t type , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_DataRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Loh_t* p_PdLoh , UInt16* pIndex); +void gpPd_DataRequest_Output_buf2par(UInt8* returnVal , gpPd_Loh_t* p_PdLoh , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_cbPurgeConfirm_Input_par2buf(UInt8Buffer* pDest , UInt8 pbmHandle , UInt16* pIndex); +void gpPd_PurgeRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_PurgeRequest_Output_buf2par(gpPd_Handle_t* returnVal , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SecRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 dataOffset , UInt8 dataLength , UInt8 auxOffset , UInt8 auxLength , UInt16* pIndex); +void gpPd_SecRequest_Output_buf2par(UInt8* returnVal , gpPd_Handle_t pdHandle , UInt8 dataOffset , UInt8 dataLength , UInt8 auxOffset , UInt8 auxLength , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_cbSecConfirm_Input_par2buf(UInt8Buffer* pDest , UInt8 pbmHandle , UInt8 dataOffset , UInt8 dataLength , UInt16* pIndex); +void gpPd_cbSecConfirm_Output_buf2par(gpPd_Handle_t* returnVal , UInt8 pbmHandle , UInt8 dataOffset , UInt8 dataLength , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_CheckPdValid_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_CheckPdValid_Output_buf2par(gpPd_Result_t* returnVal , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRssi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRssi_Output_buf2par(gpPd_Rssi_t* rssi , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetRssi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Rssi_t rssi , UInt16* pIndex); +void gpPd_GetLqi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetLqi_Output_buf2par(gpPd_Lqi_t* lqi , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetLqi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Lqi_t lqi , UInt16* pIndex); +void gpPd_GetRxTimestamp_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRxTimestamp_Output_buf2par(UInt32* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxTimestamp_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxTimestamp_Output_buf2par(UInt32* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetRxTimestamp_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_TimeStamp_t timestamp , UInt16* pIndex); +void gpPd_SetTxTimestamp_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_TimeStamp_t timestamp , UInt16* pIndex); +void gpPd_CopyPd_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_CopyPd_Output_buf2par(gpPd_Handle_t* copyPd , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxRetryCntr_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxRetryCntr_Output_buf2par(UInt8* retryCntr , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxTimestampChip_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRxTimestampChip_Output_buf2par(gpPd_TimeStamp_t* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_AppendWithUpdate_Input_par2buf(UInt8Buffer* pDest , gpPd_Loh_t* pPdLoh , UInt8 length , const UInt8* pData , UInt16* pIndex); +void gpPd_AppendWithUpdate_Output_buf2par(gpPd_Loh_t* pPdLoh , UInt8 length , const UInt8* pData , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_PrependWithUpdate_Input_par2buf(UInt8Buffer* pDest , gpPd_Loh_t* pPdLoh , UInt8 length , UInt8* pData , UInt16* pIndex); +void gpPd_PrependWithUpdate_Output_buf2par(gpPd_Loh_t* pPdLoh , UInt8 length , UInt8* pData , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_ReadWithUpdate_Input_par2buf(UInt8Buffer* pDest , gpPd_Loh_t* pPdLoh , UInt8 length , UInt16* pIndex); +void gpPd_ReadWithUpdate_Output_buf2par(gpPd_Loh_t* pPdLoh , UInt8 length , UInt8* pData , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxTimestampExt_Input_par2buf( UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetRxTimestampExt_Output_buf2par( gpPd_TimeStamp_t* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetTxTimestampExt_Input_par2buf( UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetTxTimestampExt_Output_buf2par( gpPd_TimeStamp_t* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex ); //FIXME - Manual +void gpPd_SetTxRetryCntr_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 retryCntr , UInt16* pIndex); +void gpPd_GetRxChannel_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRxChannel_Output_buf2par(UInt8* rxChannel , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetRxChannel_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 rxChannel , UInt16* pIndex); +void gpPd_GetFramePendingAfterTx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetFramePendingAfterTx_Output_buf2par(UInt8* framePending , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetFramePendingAfterTx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 framePending , UInt16* pIndex); +void gpPd_GetTxCCACntr_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxCCACntr_Output_buf2par(UInt8* txCCACntr , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxAckLqi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxAckLqi_Output_buf2par(gpPd_Lqi_t* ackLqi , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetFrameControlFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetFrameControlFromTxAckAfterRx_Output_buf2par(UInt16* framePending , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetFrameControlFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16 framePending , UInt16* pIndex); +void gpPd_GetRxEnhancedAckFromTxPbm_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRxEnhancedAckFromTxPbm_Output_buf2par(Bool* enhancedAck , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetRxEnhancedAckFromTxPbm_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , Bool enhancedAck , UInt16* pIndex); +void gpPd_GetFrameCounterFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetFrameCounterFromTxAckAfterRx_Output_buf2par(UInt32* frameCounter , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetFrameCounterFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt32 frameCounter , UInt16* pIndex); +void gpPd_GetKeyIdFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetKeyIdFromTxAckAfterRx_Output_buf2par(UInt8* keyId , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetKeyIdFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 keyId , UInt16* pIndex); +void gpPd_GetTxChannel_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxChannel_Output_buf2par(UInt8* channel , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); + +void gpPd_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPPD_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd.h new file mode 100644 index 0000000..1cc56f9 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd.h @@ -0,0 +1,668 @@ +/* + * Copyright (c) 2011-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/** @file "gpPd.h" + * + * Packet Descriptor Implementation + * + * Declarations of the public functions of gpPd. + * + * The Packet Descriptor is a handle to packet memory for RF transmission and reception. + * It holds, next to the data, additional attributes around the received packet. + * The handle is used across RF API's in the Qorvo stack. + * + * For a TX flow, following steps need to be followed: + * - Get a Pd with gpPd_GetPd() (Support for 802.15.4) or gpPd_GetCustomPd() (Support for 802.15.4 and BLE packets) + * - Fill in data to be sent with the gpPd_Write*() functions. + * - Use the handled in the relevant DataRequest API. + * - Free the handle in the DataConfirm of the RF TX request + * + * For a RX flow: + * - The stack will have allocated a Pd handle with all data and attributes filled in. + * - It will be supplied through indication APIs to upper layers + * - That layer can read out data with gpPd_Read*() functions and fetch extra data through gpPd_Get*() + * - After using the Pd, the higher layer needs to free the Pd handle +*/ + +#ifndef _GPPD_H_ +#define _GPPD_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpPd_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include +#ifdef GP_COMP_GPHAL +// inclusion for number of pbms +#include "gpHal_Pbm.h" +#endif //GP_COMP_GPHAL + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_PD_NR_OF_HANDLES +#ifdef GPHAL_NUMBER_OF_PBMS_USED +#define GP_PD_NR_OF_HANDLES GPHAL_NUMBER_OF_PBMS_USED +#else +#define GP_PD_NR_OF_HANDLES 5 +#endif //GPHAL_NUMBER_OF_PBMS_USED +#endif //GP_PD_NR_OF_HANDLES + +/** @brief Handle value indicating an invalid handle. + * Note! + * Use gpPd_CheckPdValid() instead of a direct comparison + * to catch out of range or not in use handles +*/ +#define GP_PD_INVALID_HANDLE 0xFF + +/** @brief Buffer size for 802.15.4 packets */ +#define GP_PD_BUFFER_SIZE_ZIGBEE 128 +/** @brief Buffer size for BLE packets */ +#define GP_PD_BUFFER_SIZE_BLE 256 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @brief Reference handle to a Packet Descriptor. To be used across RF APIs. */ +typedef UInt8 gpPd_Handle_t; +/** @brief Length of data in a Packet Descriptor. */ +typedef UInt16 gpPd_Length_t; +/** @brief Offset in the data buffer of a Packet Descriptor. */ +typedef UInt16 gpPd_Offset_t; +/** @brief Time in us of reception or transmission of the packet. */ +typedef UInt32 gpPd_TimeStamp_t; +/** @brief RSSI (in dBm) of the received packet. */ +typedef Int8 gpPd_Rssi_t; +/** @brief Link Quality indication of the received packet. */ +typedef UInt8 gpPd_Lqi_t; + +/** @name gpPd_Result_t */ +//@{ +/** @brief Given handle is valid. Only allocated handles will be flagged valid. */ +#define gpPd_ResultValidHandle 0x0 +/** @brief Given handle is not valid. Can be out of range. */ +#define gpPd_ResultInvalidHandle 0x1 +/** @brief Given handle is valid but not in use. Handle can be wrong or no longe in use. */ +#define gpPd_ResultNotInUse 0x2 +/** @typedef gpPd_Result_t + * @brief The gpPd_Result_t type defines the result of handle check for validity. +*/ +typedef UInt8 gpPd_Result_t; +//@} + +/** @name gpPd_Result_t */ +//@{ +/** @brief Use a packet buffer with a size suitable for 802.15.4/ZigBee. */ +#define gpPd_BufferTypeZigBee 0x00 +/** @brief Use a packet buffer with a size suitable for BLE. */ +#define gpPd_BufferTypeBle 0x01 +/** @brief Invalid buffer type - used as check. */ +#define gpPd_BufferTypeInvalid 0x02 +/** @typedef gpPd_BufferType_t + * @brief The gpPd_BufferType_t type defines the type of Packet Descriptor the use. +*/ +typedef UInt8 gpPd_BufferType_t; +//@} + +/** @struct gpPd_Loh_t + * @brief Structure grouping information about a part of data to be read out or written. +*/ +typedef struct gpPd_Loh_s { + gpPd_Length_t length; + gpPd_Offset_t offset; + gpPd_Handle_t handle; +} gpPd_Loh_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpPd_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** @brief Initialize gpPd component. This will init all internal data structures */ +void gpPd_Init(void); + +/** @brief De-initializes gpPd component. */ +void gpPd_DeInit(void); + +//Descriptor handling +/** @brief Return a handle to use for packet construction and transmission + * This function will return a gpPd_BufferTypeZigBee. + * See gpPd_GetCustomPd() for other buffer types (BLE). + * + * @return pdHandle Handle as reference for use with the packet memory througout other APIs. + * GP_PD_INVALID_HANDLE will be returned if no handles are available. +*/ +gpPd_Handle_t gpPd_GetPd(void); + +/** @brief Return a handle to use for a specific packet buffer type. + * + * @param type Buffer type requested. Possible types listed in gpPd_BufferType_t. + * @param size Buffer size needed for the requested packet. Size must align with the request type (ZB/BLE/BLE XL). + * + * @return pdHandle Handle as reference for use with the packet memory througout other APIs. + * Will return GP_PD_INVALID_HANDLE in the following cases: + * - no handles are available. + * - no buffers with the requested size are available + * - requested size is not valid for the selected type. +*/ +gpPd_Handle_t gpPd_GetCustomPd(gpPd_BufferType_t type, UInt16 size); + +/** @brief Release a Pd handle and it's associated memory after use. + * + * Pd handle can be freed, allowing it and his associated memory to be re-used by the application (Tx) or HW (Rx). + * It is expected the handles are not kept for long durations, not to block the ability to send or receive new packets. + * The recommentation is the copy all needed information in a short lifespan. + * Note that accessing the handle after freeing is an illegal operation. + * + * @param pdHandle Handle referring to Tx or Rx buffer used. +*/ +void gpPd_FreePd(gpPd_Handle_t pdHandle); + +/** @brief Copy all contents of a Packet Descriptor to a new one. + * + * This function can be used when distributing a packet over multiple upper layers. + * + * @param pdHandle Handle to copy all information from + * + * @return newHandle New handle to copied content. + * Will return GP_PD_INVALID_HANDLE in the following case: + * - no handles are available with the same type +*/ +gpPd_Handle_t gpPd_CopyPd(gpPd_Handle_t pdHandle); + +/** @brief Lookup pd handle by PBM. + * + * + * @param pdHandle Handle referring to Tx or Rx buffer used. +*/ +gpPd_Handle_t gpPd_GetPdFromPBM(UInt8 pbmHandle); + +/** @brief Check if the Pd is valid. + * To be used to check a fetched Pd. + * This function is advised to be used opposed to comparing against GP_PD_INVALID_HANDLE as more checks are performed. + * + * @param pdHandle Handle fetched or received. + * @return result Can return the following: + - gpPd_ResultValidHandle if it's in range of possible handle values. + - gpPd_ResultInvalidHandle if the handle is outside the possible range. + - gpPd_ResultNotInUse if the handle is not considered claimed (fi when feeding an unfetched but valid handle value). +*/ +gpPd_Result_t gpPd_CheckPdValid(gpPd_Handle_t pdHandle); + +/** @brief Check if the Pd is valid. + * + * @param pdHandle Handle referring to buffer. + * @return type Buffer type of gpPd_BufferType_t pertaining to the given handle. +*/ +gpPd_BufferType_t gpPd_GetPdType(gpPd_Handle_t pdHandle); + +//Data handling +/** @brief Read one byte from a Pd buffer. + * + * @param pdHandle Handle associated with the packet buffer. + * @param offset Offset to location in buffer to read from. + * @return byte Byte read out @ offset. +*/ +UInt8 gpPd_ReadByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset); + +/** @brief Write one byte to a Pd buffer. + * + * @param pdHandle Handle associated with the packet buffer. + * @param offset Offset to location in buffer to write to. + * @param byte Byte to write @ offset. +*/ +void gpPd_WriteByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 byte); + +/** @brief Read a bytestream from a Pd buffer. + * + * @param pdHandle Handle associated with the packet buffer. + * @param offset Offset to location in buffer to start read from. + * @param length Length to read. + * @return pData Pointer to buffer for bytes read out @ offset. +*/ +void gpPd_ReadByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData); + +/** @brief Write a bytestream to a Pd buffer. + * + * @param pdHandle Handle associated with the packet buffer. + * @param offset Offset to location in buffer to start write operation. + * @param length Length to write. + * @return pData Pointer to buffer of bytes written @ offset. +*/ +void gpPd_WriteByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData); + +//Data handling with update of pdLoh +/** @brief Append a bytestream to a Pd buffer and update the pdLoh structure. + * + * @param pPdLoh Pointer to Length,Offset,Handle associated with the packet buffer. + * @param length Length to write. + * @param pData Pointer to buffer of bytes written @ Offset (in pdLoh structure). +*/ +void gpPd_AppendWithUpdate(gpPd_Loh_t* pPdLoh, UInt8 length, UInt8 const* pData); + +/** @brief Prepend a bytestream to a Pd buffer and update the pdLoh structure. + * Typically used to add header information in front of payload bytes of higher layers. + * + * @param pPdLoh Pointer to Length,Offset,Handle associated with the packet buffer. + * @param length Length to write. + * @param pData Pointer to buffer of bytes written @ Offset (in pdLoh structure). +*/ +void gpPd_PrependWithUpdate(gpPd_Loh_t* pPdLoh, UInt8 length, UInt8 const* pData); + +/** @brief Read a bytestream from a Pd buffer and update the pdLoh structure. + * Typically used to scroll through bytes in a Pd. + * + * @param pPdLoh Pointer to Length,Offset,Handle associated with the packet buffer. + * @param length Length to read. + * @param pData Pointer to buffer for bytes read out @ Offset (in pdLoh structure). +*/ +void gpPd_ReadWithUpdate(gpPd_Loh_t* pPdLoh, UInt8 length, UInt8* pData); + +//Properties handling +//Rx +/** @brief Return the Relative Signal Strength Indication (RSSI) of the received packet. + * + * @param pdHandle Handle associated with the packet buffer. + * @return rssi RSSI value in dBm. +*/ +gpPd_Rssi_t gpPd_GetRssi(gpPd_Handle_t pdHandle); + +/** @brief Return the Link Quality Indication (LQI) of the received packet. + * + * @param pdHandle Handle associated with the packet buffer. + * @return lqi LQI value (as specified in 802.15.4 PHY specification). +*/ +gpPd_Lqi_t gpPd_GetLqi(gpPd_Handle_t pdHandle); + +/** @brief Return the timestamp of the received packet. + * + * @param pdHandle Handle associated with the packet buffer. + * @return timestamp Timestamp in us, taken from the timebase of the OS (hal timing). +*/ +gpPd_TimeStamp_t gpPd_GetRxTimestamp(gpPd_Handle_t pdHandle); + +/** @brief Return the timestamp of the received packet taken from the chip HW timer. + * + * @param pdHandle Handle associated with the packet buffer. + * @return timestamp Timestamp in us, taken from the timer of the chip HW (gpHal timing). + * The timestamp will be equivalent to gpPd_GetRxTimestamp() when running fully embedded (no transceiver setup). +*/ +gpPd_TimeStamp_t gpPd_GetRxTimestampChip(gpPd_Handle_t pdHandle); + +/** @brief Return the channel on which the packet was received. + * + * @param pdHandle Handle associated with the packet buffer. + * @return rxChannel Channel on which the packet was received. + * +*/ +UInt8 gpPd_GetRxChannel(gpPd_Handle_t pdHandle); + +/** @brief Return the buffer of BLE phase samples of the received packet. + * + * @param pdHandle Handle associated with the packet buffer. + * @return pSamples Pointer to the received phase samples. + * NULL if not available and valid untill free of the pdHandle. +*/ +UInt16* gpPd_GetPhaseSamplesBuffer(gpPd_Handle_t pdHandle); + +//TxConfirm +/** @brief Return the timestamp of a transmitted packet. + * + * @param pdHandle Handle associated with the packet. + * @return timestamp Timestamp in us at which the packet was sent, taken from the timebase of the OS (hal timing). +*/ +gpPd_TimeStamp_t gpPd_GetTxTimestamp(gpPd_Handle_t pdHandle); + +/** @brief Return the timestamp of a transmitted packet. + * + * @param pdHandle Handle associated with the packet. + * @return channel The last channel at which the packet was sent +*/ +UInt8 gpPd_GetTxChannel(gpPd_Handle_t pdHandle); + +/** @brief Return the Link Quality Indication (LQI) of the ACK for the transmitted packet. + * + * @param pdHandle Handle associated with the packet. + * @return lqi LQI value of the received ACK - only valid when there was an ACK present. +*/ +gpPd_Lqi_t gpPd_GetTxAckLqi(gpPd_Handle_t pdHandle); + +/** @brief Return the amount of CCA retries of the transmitted packet + * + * @param pdHandle Handle associated with the packet. + * @return retries Amount of CCA retries performed. +*/ +UInt8 gpPd_GetTxCCACntr(gpPd_Handle_t pdHandle); + +/** @brief Return the amount of MAC retries of the transmitted packet + * + * @param pdHandle Handle associated with the packet. + * @return retries Amount of MAC retries. 0 if the first attempt succeeded. +*/ +UInt8 gpPd_GetTxRetryCntr(gpPd_Handle_t pdHandle); + +/** @brief Return the framepending bit from the ACK of a transmitted packet. + * + * @param pdHandle Handle associated with the packet. + * @return framePending True if the frame pending bit was set in the associated ACK. +*/ +UInt8 gpPd_GetFramePendingAfterTx(gpPd_Handle_t pdHandle); + +/** @brief Returns a bool indicating the reception of an enhanced ack after a transmission of a packet. + * + * @param pdHandle Handle associated with the transmitted packet. + * @return enhancedAck True if the an enhanced ack was received. +*/ +Bool gpPd_GetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle); + +/** @brief Return the framecontrol field from the ACK transmitted after receiving a frame. + * + * @param pdHandle Handle associated with the rx packet. + * @return frameControl The framecontrol field as it was was set in the tx ACK. +*/ +UInt16 gpPd_GetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle); + +/** @brief Get the framecounter for the ACK transmitted after receiving a frame. + * + * This function returns the value of the framecounter on a Tx Ack. + * @param pdHandle Handle associated with the rx packet. + * @return frameCounter The framecounter field used in the Ack frame. +*/ +UInt32 gpPd_GetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle); + +/** @brief Get the keyid field for the ACK transmitted after receiving a frame. + * + * This function returns the value of the keyid field on a Tx Ack. + * @param pdHandle Handle associated with the rx packet. + * @return keyId The keyid field used in the Ack frame. +*/ +UInt8 gpPd_GetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle); + +//Internal Helper functions + +/****************************** + * Rx Flow fill-in + ******************************/ +/** @brief Function to fill in RSSI value during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param rssi RSSI value (in dBm) +*/ +void gpPd_SetRssi(gpPd_Handle_t pdHandle, gpPd_Rssi_t rssi); + +/** @brief Function to fill in LQI value during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param lqi LQI value. +*/ +void gpPd_SetLqi(gpPd_Handle_t pdHandle, gpPd_Lqi_t lqi); + +/** @brief Function to fill in timestamp value during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param timestamp Time of reception (in us) of the associated packet. +*/ +void gpPd_SetRxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp); + +/** @brief Function to fill in channel on which packet was received during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param rxChannel Channel on which packet was received. + * 802.15.4 or BLE channel range will be filled in according to the type of Pd. +*/ +void gpPd_SetRxChannel(gpPd_Handle_t pdHandle, UInt8 rxChannel); + +/** @brief Function to fill in FrameControl of Ack sent during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param frameControl 802.15.4 frame control field of the ACK sent out in response of packet. +*/ +void gpPd_SetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt16 frameControl); + +/** @brief Function to fill in FrameCounter of Ack sent during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param frameCounter 802.15.4 security frame counter field of the ACK sent out in response of packet. +*/ +void gpPd_SetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt32 frameCounter); + +/** @brief Function to fill in KeyId for Ack sent during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param keyId 802.15.4 security key Id used for the ACK sent out in response of packet. +*/ +void gpPd_SetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt8 keyId); + +/****************************** + * Tx Flow fill-in + ******************************/ +/** @brief Function to fill in timestamp during processing of an confirm of a sent packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the Tx packet. + * @param timestamp Time of Tx (in us) of the associated packet. +*/ +void gpPd_SetTxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp); + +/** @brief Function to fill in the retry count during processing of an confirm of a sent packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the Tx packet. + * @param txRetryCntr Retry count of the transmit. +*/ +void gpPd_SetTxRetryCntr(gpPd_Handle_t pdHandle, UInt8 txRetryCntr); + +/** @brief Function to fill in the frame pending bit of the ack during processing of an confirm of a sent packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the Tx packet. + * @param framePending set to @True if the frame pending bit was set in the associated + * ACK.Time of Tx (in us) of the associated packet. +*/ +void gpPd_SetFramePendingAfterTx(gpPd_Handle_t pdHandle, UInt8 framePending); + +/** @brief Function to fill in the ack type during processing of an confirm of a sent packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the Tx packet. + * @param enhancedAck set to @True if the transmitted frame was acked with an enhanced ack +*/ +void gpPd_SetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle, Bool enhancedAck); + +/****************************** + * Internal stack calls + ******************************/ +//Data +/** @brief Function to prepare a Packet Descriptor for transmission. + * + * Only to be used by stack when processing a packet transmission. + * @param p_PdLoh Pointer to relevant data. + * @return pdHandle Allocated handle for data to be sent. +*/ +UInt8 gpPd_DataRequest(gpPd_Loh_t* p_PdLoh); + +/** @brief Function to prepare a Packet Descriptor after a Tx + * + * Only to be used by stack when processing a packet Tx confirm. + * Will translate HW buffers into a Packet Descriptor + * + * @param pbmHandle HW buffer handle + * @param pbmOffset Offset of the data in the buffer + * @param pbmLength Length of data + * @param[out] p_PdLoh Pointer to output processed Packet Descriptor +*/ +void gpPd_cbDataConfirm(UInt8 pbmHandle, UInt16 pbmOffset, UInt16 pbmLength, gpPd_Loh_t* p_PdLoh); + +/** @brief Function to prepare a Packet Descriptor after a received packet + * + * Only to be used by stack when processing a packet reception. + * Will translate HW buffers into a Packet Descriptor + * + * @param pbmHandle HW buffer handle + * @param pbmOffset Offset of the data in the buffer + * @param pbmLength Length of data + * @param[out] p_PdLoh Pointer to output processed Packet Descriptor + * @param type Type of received data (802.15.4/BLE) +*/ +void gpPd_DataIndication(UInt8 pbmHandle, UInt16 pbmOffset, UInt16 pbmLength, gpPd_Loh_t* p_PdLoh, gpPd_BufferType_t type); + +//Security +/** @brief Function to prepare a Packet Descriptor for a Security operation + * + * Only to be used by stack when processing a security operation. + * Will translate HW buffers into a Packet Descriptor + * + * @param pdHandle Packet Descriptor handle + * @param dataOffset Offset of the data in the buffer + * @param dataLength Length of data + * @param auxOffset Offset of auxiliary security data. Can be part of overal data. + * @param auxLength Length of auxiliary security data + * + * @return pbmHandle HW buffer handle +*/ +UInt8 gpPd_SecRequest(gpPd_Handle_t pdHandle, UInt8 dataOffset, UInt8 dataLength, UInt8 auxOffset, UInt8 auxLength); + +/** @brief Function to prepare a Packet Descriptor after completing a security operation. + * + * Only to be used by stack when processing a security operation. + * Will translate HW buffers into a Packet Descriptor + * + * @param pbmHandle HW buffer handle + * @param dataOffset Offset of the data in the buffer + * @param dataLength Length of data + * + * @return pdHandle Packet Descriptor handle containing processed security operation +*/ +gpPd_Handle_t gpPd_cbSecConfirm(UInt8 pbmHandle, UInt8 dataOffset, UInt8 dataLength); + +//Purge +/** @brief Function to prepare a Packet Descriptor for a Purge operation + * + * Only to be used by stack when processing a purge operation. + * Will translate HW buffers into a Packet Descriptor + * + * @param pdHandle Packet Descriptor handle + * + * @return pbmHandle HW buffer handle +*/ +UInt8 gpPd_PurgeRequest(gpPd_Handle_t pdHandle); + +/** @brief Function to prepare a Packet Descriptor after completing a Purge operation. + * + * Only to be used by stack when processing a purge operation. + * Will finalize work for the operation. + * + * @param pbmHandle HW buffer handle +*/ +void gpPd_cbPurgeConfirm(UInt8 pbmHandle); + + +#include "gpPd_ram.h" + +/****************************** + * Serialization helper functions + ******************************/ + +/** @brief Initialize mapping between incoming and internal handles. + * + * When a serialized component uses Pd handles, the ones used at client side + * are different from the ones managed in the server side. + * A mapping is kept to track the ones from the client to return correct handles + * in any confirm. + * +*/ +void gpPd_InitPdHandleMapping(void); + +/** @brief Store a pair of mapped and new handle + * + * @param newPdHandle Handle taken at server side to store in mapping + * @param pdHandle Handle coming from client side to store + * + * @return success Returns true if mapping was succesfull, false if no space was available. +*/ +Bool gpPd_StorePdHandle(gpPd_Handle_t newPdHandle, gpPd_Handle_t pdHandle); + +/** @brief Retrieve a mapped pdHandle + * + * @param[out] storedPdHandle Pointer to return stored Packet Descriptor handle. + Will return GP_INVALID_HANDLE if not found. + * @param pdHandle Local handle used to look up external handle. + * + * @return success Returns true if operation was succesfull, false if invalid could not be set. +*/ +Bool gpPd_GetStoredPdHandle(gpPd_Handle_t* storedPdHandle, gpPd_Handle_t pdHandle); + +/** @brief Retrieve a mapped pdHandle and remove if necessary + * + * @param newPdHandle Local handle used when storing the external handle. + * @param remove Remove the handle from the mapping if true. + * + * @return pdHandle Returns GP_INVALID_HANDLE if not found. +*/ +gpPd_Handle_t gpPd_RestorePdHandle(gpPd_Handle_t newPdHandle, Bool remove); + +#if defined(GP_COMP_UNIT_TEST) +#include "gpPd_ut.h" +#endif //GP_COMP_UNIT_TEST + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPPD_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd_ram.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd_ram.h new file mode 100644 index 0000000..a25febc --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd_ram.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPPD_RAM_H_ +#define _GPPD_RAM_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#ifndef GP_PD_BUFFER_SIZE +#define GP_PD_BUFFER_SIZE 0x80 +#endif //GP_PD_BUFFER_SIZE + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ +typedef struct gpPd_RxAttributes_s { + UInt32 rxTimestamp; + UInt32 rxTimestampChip; + gpPd_Rssi_t rssi; + gpPd_Lqi_t lqi; + UInt8 rxChannel; + UInt8 txAckKeyId; + UInt16 txAckFc; + UInt32 txAckFrameCounter; +} gpPd_RxAttributes_t; + +typedef struct gpPd_TxCfmAttributes_s { + UInt32 txTimestamp; + UInt8 lastChannel; + UInt8 txRetryCntr; + UInt8 framePendingFromTxPbm; + UInt8 txCCACntr; + gpPd_Lqi_t ackLqi; + Bool rxEnhancedAck; +} gpPd_TxCfmAttributes_t; + +typedef struct { + gpPd_BufferType_t type; + union { + gpPd_RxAttributes_t rx; + gpPd_TxCfmAttributes_t txcfm; + }attr; + UInt8 buffer[GP_PD_BUFFER_SIZE]; +} gpPd_Descriptor_t; + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + + +#endif // _GPPD_RAM_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c new file mode 100644 index 0000000..17b4452 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpPd_marshalling.c" + * + * Packet Descriptor interface + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpPd.h" +#include "gpPd_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_PD + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpPd_Loh_t_buf2api(gpPd_Loh_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex , Bool storePdHandle ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + pDest->handle = gpPd_GetPd(); + if(gpPd_ResultValidHandle != gpPd_CheckPdValid(pDest->handle)) + { + return gpMarshall_AckStatusExecutionFailed;/* Failure to allocate handle. */ + } + gpPd_Length_t_buf2api_1(&(pDest->length), pSource, pIndex); + // 0-length parameter offset + pDest->offset = 0; + gpPd_WriteByteStream(pDest->handle, pDest->offset, pDest->length, &(pSource[*pIndex])); + *pIndex += pDest->length; + if(storePdHandle && !gpPd_StorePdHandle(pDest->handle,pSource[*pIndex]))/* sticky client side handle p_PdLoh has to be aasciated with server side handle. */ + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF("handle assoc failed",0); +#endif + /* Failure to associate client and server side handles causes freeing of server side handle... */ +#ifdef GP_COMP_UNIT_TEST + gpPd_FreeRealPd(pDest->handle); +#else + gpPd_FreePd(pDest->handle); +#endif //GP_COMP_UNIT_TEST + /* ...and causes server to indicate failure in acknowledge to client. */ + return gpMarshall_AckStatusExecutionFailed; + } + *pIndex += 1; + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpPd_Loh_t_api2buf(UInt8Buffer* pDest , const gpPd_Loh_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpPd_Length_t_api2buf_1(pDest , &(pSource->length), pIndex); + // 0-length parameter offset + gpPd_ReadByteStream(pSource->handle, pSource->offset, pSource->length, &(pDest[*pIndex])); + *pIndex += pSource->length; +#ifdef GP_COMP_UNIT_TEST + { + gpPd_Handle_t uthandle = gpPd_GetUtPd(pSource->handle); + gpPd_Handle_t_api2buf_1(pDest, &uthandle, pIndex); + } +#else + gpPd_Handle_t_api2buf_1(pDest, &pSource->handle, pIndex); +#endif //GP_COMP_UNIT_TEST + pSource++; + } +} + + +void gpPd_InitMarshalling(void) +{ +/* gpPd_InitMarshalling */ + gpPd_InitPdHandleMapping(); +/* gpPd_InitMarshalling */ +} + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c new file mode 100644 index 0000000..b474c27 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + + + +// General includes +#include "gpLog.h" +#include "gpAssert.h" +#include "gpStat.h" + +#include "gpPd.h" +#include "gpPd_marshalling.h" + + + +#define GP_COMPONENT_ID GP_COMPONENT_ID_PD +#define GP_MODULE_ID GP_MODULE_ID_PD + +#include "gpPd_ram.c" +#include "gpPd_common.c" + +//#define GP_LOCAL_LOG + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpPd_Init(void) +{ + Pd_Init(); + gpPd_InitMarshalling(); +} + +void gpPd_DeInit(void) +{ + Pd_DeInit(); + gpPd_Init(); +} + +gpPd_Handle_t gpPd_GetPd(void) +{ + return Pd_GetPd(gpPd_BufferTypeZigBee, GP_PD_BUFFER_SIZE_ZIGBEE); +} + +gpPd_Handle_t gpPd_GetCustomPd(gpPd_BufferType_t type, UInt16 size) +{ + GP_STAT_SAMPLE_TIME(); + return Pd_GetPd(type, size); +} + +void gpPd_FreePd(gpPd_Handle_t pdHandle) +{ + GP_STAT_SAMPLE_TIME(); + Pd_FreePd( pdHandle); +} + +gpPd_Result_t gpPd_CheckPdValid(gpPd_Handle_t pdHandle) +{ + return Pd_CheckPdValid( pdHandle); +} + +gpPd_BufferType_t gpPd_GetPdType(gpPd_Handle_t pdHandle) +{ + return Pd_GetPdType(pdHandle); +} + +UInt8 gpPd_ReadByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset) +{ + return Pd_ReadByte( pdHandle, offset); +} + +void gpPd_WriteByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 byte) +{ + Pd_WriteByte( pdHandle, offset, byte); +} + +void gpPd_ReadByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData) +{ + Pd_ReadByteStream( pdHandle, offset, length, pData); +} + +void gpPd_WriteByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData) +{ + Pd_WriteByteStream( pdHandle, offset, length, pData); +} + +//Convenience functions +void gpPd_AppendWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 const *pData) +{ + Pd_AppendWithUpdate(pPdLoh, length, pData); +} +void gpPd_PrependWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 const *pData) +{ + Pd_PrependWithUpdate(pPdLoh, length, pData); +} +void gpPd_ReadWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 *pData) +{ + Pd_ReadWithUpdate(pPdLoh, length, pData); +} + +//Properties handling + +gpPd_Rssi_t gpPd_GetRssi(gpPd_Handle_t pdHandle) +{ + return Pd_GetRssi(pdHandle); +} + +void gpPd_SetRssi(gpPd_Handle_t pdHandle, gpPd_Rssi_t rssi) +{ + Pd_SetRssi(pdHandle, rssi); +} + +gpPd_Lqi_t gpPd_GetLqi(gpPd_Handle_t pdHandle) +{ + return Pd_GetLqi(pdHandle); +} + +void gpPd_SetLqi(gpPd_Handle_t pdHandle, gpPd_Lqi_t lqi) +{ + Pd_SetLqi(pdHandle, lqi); +} + +gpPd_TimeStamp_t gpPd_GetRxTimestamp(gpPd_Handle_t pdHandle) +{ + return Pd_GetRxTimestamp( pdHandle); +} + +gpPd_TimeStamp_t gpPd_GetRxTimestampChip(gpPd_Handle_t pdHandle) +{ + return Pd_GetRxTimestampChip(pdHandle); +} + +UInt16* gpPd_GetPhaseSamplesBuffer(gpPd_Handle_t pdHandle) +{ + return Pd_GetPhaseSamplesBuffer(pdHandle); +} + +gpPd_TimeStamp_t gpPd_GetTxTimestamp(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxTimestamp( pdHandle); +} + +UInt8 gpPd_GetTxChannel(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxChannel( pdHandle); +} + +void gpPd_SetRxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp) +{ + Pd_SetRxTimestamp(pdHandle, timestamp); +} + +void gpPd_SetTxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp) +{ + Pd_SetTxTimestamp(pdHandle, timestamp); +} + +gpPd_Handle_t gpPd_CopyPd(gpPd_Handle_t pdHandle) +{ + return Pd_CopyPd( pdHandle ); +} + +gpPd_Lqi_t gpPd_GetTxAckLqi(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxAckLqi(pdHandle); +} + +UInt8 gpPd_GetTxCCACntr(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxCCACntr(pdHandle); +} + +UInt8 gpPd_GetTxRetryCntr(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxRetryCntr(pdHandle); +} + +void gpPd_SetTxRetryCntr(gpPd_Handle_t pdHandle, UInt8 txRetryCntr) +{ + Pd_SetTxRetryCntr(pdHandle, txRetryCntr); +} + +UInt8 gpPd_GetFramePendingAfterTx(gpPd_Handle_t pdHandle) +{ + return Pd_GetFramePendingAfterTx(pdHandle); +} + +void gpPd_SetFramePendingAfterTx(gpPd_Handle_t pdHandle, UInt8 framePending) +{ + Pd_SetFramePendingAfterTx(pdHandle, framePending); +} + +Bool gpPd_GetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle) +{ + return Pd_GetRxEnhancedAckFromTxPbm(pdHandle); +} + +void gpPd_SetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle, Bool enhancedAck) +{ + Pd_SetRxEnhancedAckFromTxPbm(pdHandle, enhancedAck); +} + +UInt16 gpPd_GetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + return Pd_GetFrameControlFromTxAckAfterRx(pdHandle); +} + +void gpPd_SetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt16 frameControl) +{ + Pd_SetFrameControlFromTxAckAfterRx(pdHandle, frameControl); +} + + +UInt32 gpPd_GetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + return Pd_GetFrameCounterFromTxAckAfterRx(pdHandle); +} + +void gpPd_SetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt32 frameCounter) +{ + Pd_SetFrameCounterFromTxAckAfterRx(pdHandle, frameCounter); +} + +UInt8 gpPd_GetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + return Pd_GetKeyIdFromTxAckAfterRx(pdHandle); +} + +void gpPd_SetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt8 keyId) +{ + Pd_SetKeyIdFromTxAckAfterRx(pdHandle, keyId); +} + + +UInt8 gpPd_GetRxChannel(gpPd_Handle_t pdHandle) +{ + return Pd_GetRxChannel(pdHandle); +} + +void gpPd_SetRxChannel(gpPd_Handle_t pdHandle, UInt8 rxChannel) +{ + Pd_SetRxChannel(pdHandle, rxChannel); +} + +#if defined(GP_COMP_GPHAL) + +UInt8 gpPd_DataRequest(gpPd_Loh_t *p_PdLoh) +{ + return Pd_DataRequest(p_PdLoh); +} + + +UInt8 gpPd_SecRequest(gpPd_Handle_t pdHandle, UInt8 dataOffset, UInt8 dataLength, UInt8 auxOffset, UInt8 auxLength ) +{ + return Pd_SecRequest(pdHandle, dataOffset, dataLength, auxOffset,auxLength ); +} + +gpPd_Handle_t gpPd_cbSecConfirm(gpPd_Handle_t pbmHandle, UInt8 dataOffset, UInt8 dataLength) +{ + return Pd_cbSecConfirm(pbmHandle, dataOffset, dataLength); +} + +void gpPd_DataIndication(gpPd_Handle_t pbmHandle, UInt16 pbmOffset, UInt16 pbmLength, gpPd_Loh_t *p_PdLoh, gpPd_BufferType_t type) +{ + Pd_DataIndication(pbmHandle, pbmOffset, pbmLength, p_PdLoh, type); +} + +UInt8 gpPd_PurgeRequest(gpPd_Handle_t pdHandle) +{ + return Pd_PurgeRequest(pdHandle); +} + +void gpPd_cbPurgeConfirm(UInt8 pbmHandle) +{ + Pd_cbPurgeConfirm(pbmHandle); +} + +gpPd_Handle_t gpPd_GetPdFromPBM(UInt8 pbmHandle) +{ + return Pd_GetPdFromPBM(pbmHandle); +} +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_common.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_common.c new file mode 100644 index 0000000..78b11f1 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_common.c @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +INLINE static void Pd_AppendWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 const *pData) +{ + if (pPdLoh && length && pData) + { + if (length == 1) + { + Pd_WriteByte(pPdLoh->handle, pPdLoh->offset + pPdLoh->length, *pData); + } + else + { + Pd_WriteByteStream(pPdLoh->handle, pPdLoh->offset + pPdLoh->length, length, (UInt8*)pData); + } + pPdLoh->length += length; + } +} +INLINE static void Pd_PrependWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 const *pData) +{ + if (pPdLoh && length && pData) + { + pPdLoh->offset -= length; + if (length == 1) + { + Pd_WriteByte(pPdLoh->handle, pPdLoh->offset, *pData); + } + else + { + Pd_WriteByteStream(pPdLoh->handle, pPdLoh->offset, length, (UInt8*)pData); + } + pPdLoh->length += length; + } +} + +INLINE static void Pd_ReadWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 *pData) +{ + if (pPdLoh && length && pData) + { + if (length == 1) + { + *pData = Pd_ReadByte(pPdLoh->handle, pPdLoh->offset); + } + else + { + Pd_ReadByteStream(pPdLoh->handle, pPdLoh->offset, length, pData); + } + pPdLoh->offset += length; + pPdLoh->length -= length; + } +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_ram.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_ram.c new file mode 100644 index 0000000..b0274c5 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_ram.c @@ -0,0 +1,868 @@ +/* + * Copyright (c) 2011-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +//#define GP_LOCAL_LOG +#if defined(GP_COMP_GPHAL) +#include "gpHal.h" +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) +#include "gpPoolMem.h" +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +#define PD_CHECK_HANDLE_VALID(pdHandle) (pdHandle < GP_PD_NR_OF_HANDLES) +#define PD_CHECK_HANDLE_IN_USE(pdHandle) (gpPd_Descriptors[pdHandle]) +#define PD_CHECK_HANDLE_ACCESSIBLE(pdHandle) (PD_CHECK_HANDLE_VALID(pdHandle) && PD_CHECK_HANDLE_IN_USE(pdHandle)) + +/** @brief Check a given buffer type is valid + * + * @param type Pd buffer type to check +*/ +#define GP_PD_IS_BUFFERTYPE_VALID(type) (type < gpPd_BufferTypeInvalid) + +#define PBM_CHECK_HANDLE_ACCESSIBLE(PbmHandle) (GP_HAL_CHECK_PBM_VALID(PbmHandle) && GP_HAL_IS_PBM_ALLOCATED(PbmHandle)) + +// Only allowed for ZigBee pds +#define PD_WRAP_OFFSET(offset) (offset &= 0x7f) +#if defined(GP_COMP_GPHAL) +#define PD_TMP_SIZE 128 +#endif // defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) + +#define PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle) do { \ + if(!PD_CHECK_HANDLE_ACCESSIBLE(pdHandle)) \ + { \ + GP_ASSERT_DEV_EXT(false); \ + return; \ + } \ +} while(false) + +#define PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, retVal) do { \ + if(!PD_CHECK_HANDLE_ACCESSIBLE(pdHandle)) \ + { \ + GP_ASSERT_DEV_EXT(false); \ + return retVal; \ + } \ +} while(false) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +//Pointers to Packet buffers and meta-data +gpPd_Descriptor_t* gpPd_Descriptors[GP_PD_NR_OF_HANDLES]; + +#if defined(GP_COMP_GPHAL) +// lookup table to bind a PD to a PBM +static gpPd_Handle_t Pd_Pbm2pd[GPHAL_NUMBER_OF_PBMS_USED]; +static UInt8 Pd_NmbrOfPbmsClaimedBySw; +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +#if defined(GP_COMP_GPHAL) +static void Pd_RestoreFromPbm(UInt8 pbmHandle, UInt8 pbmOffset, UInt8 pbmLength, gpPd_Handle_t pdHandle); +static void Pd_CopyToPbm(UInt8 pbmHandle, UInt8 offset, UInt8 length); +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +static void Pd_Init(void); +static void Pd_DeInit(void); + +//Descriptor handling +static gpPd_Handle_t Pd_GetPd(gpPd_BufferType_t type, UInt16 size); +static void Pd_FreePd(gpPd_Handle_t pdHandle); +static gpPd_Result_t Pd_CheckPdValid(gpPd_Handle_t pdHandle); +static gpPd_BufferType_t Pd_GetPdType(gpPd_Handle_t pdHandle); +#if defined(GP_COMP_GPHAL) +static UInt8 Pd_GetPBM(UInt8 pdHandle); +static UInt8 Pd_AllocatePBM(gpPd_Handle_t pdHandle,UInt16 size); +#endif + +//Data handling +static UInt8 Pd_ReadByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset); +static void Pd_WriteByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 byte); +static void Pd_ReadByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData); +static void Pd_WriteByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData); + +//Properties handling +static gpPd_Rssi_t Pd_GetRssi(gpPd_Handle_t pdHandle); +static void Pd_SetRssi(gpPd_Handle_t pdHandle, gpPd_Rssi_t rssi); +static gpPd_Lqi_t Pd_GetLqi(gpPd_Handle_t pdHandle); +static void Pd_SetLqi(gpPd_Handle_t pdHandle, gpPd_Lqi_t lqi); +static UInt32 Pd_GetRxTimestamp(gpPd_Handle_t pdHandle); +static UInt32 Pd_GetRxTimestampChip(gpPd_Handle_t pdHandle); +static void Pd_SetRxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp); +static UInt32 Pd_GetTxTimestamp(gpPd_Handle_t pdHandle); +static UInt8 Pd_GetTxChannel(gpPd_Handle_t pdHandle); +static UInt16* Pd_GetPhaseSamplesBuffer(gpPd_Handle_t pdHandle); +static UInt8 Pd_GetTxRetryCntr(gpPd_Handle_t pdHandle); +static void Pd_SetFramePendingAfterTx(gpPd_Handle_t pdHandle, UInt8 framePending); +static UInt8 Pd_GetFramePendingAfterTx(gpPd_Handle_t pdHandle); + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +static void Pd_Init(void) +{ + UInt8 i; + + for(i = 0; i < GP_PD_NR_OF_HANDLES; i++) + { + gpPd_Descriptors[i] = NULL; + } + //Cleanup lookup table +#if defined(GP_COMP_GPHAL) + Pd_NmbrOfPbmsClaimedBySw=0; + for(i = 0; i < GPHAL_NUMBER_OF_PBMS_USED; i++) + { + Pd_Pbm2pd[i] = GP_PD_INVALID_HANDLE; + } +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) +#ifdef GP_COMP_UNIT_TEST + gpPd_InitUnit(); +#endif // GP_COMP_UNIT_TEST +} + +static void Pd_DeInit(void) +{ + UInt8 i; + + for(i = 0; i < GP_PD_NR_OF_HANDLES; i++) + { + if(gpPd_Descriptors[i] != NULL) + { + Pd_FreePd(i); + } + } +} + +static gpPd_Handle_t Pd_AllocatePdHandle(void) +{ + gpPd_Handle_t pdHandle; + for(pdHandle = 0; pdHandle < GP_PD_NR_OF_HANDLES; pdHandle++) + { + if(!PD_CHECK_HANDLE_IN_USE(pdHandle)) + { + return pdHandle; + } + } + return GP_PD_INVALID_HANDLE; +} + +#if defined(GP_COMP_GPHAL) +static UInt8 Pd_AllocatePBM(gpPd_Handle_t pdHandle,UInt16 size) +{ + UInt8 pbmHandle; + pbmHandle = gpHal_GetHandle(size); + if(!GP_HAL_CHECK_PBM_VALID(pbmHandle)) + { + return GP_PBM_INVALID_HANDLE; + } + Pd_NmbrOfPbmsClaimedBySw++; + Pd_Pbm2pd[pbmHandle] = pdHandle; + return pbmHandle; +} +#endif + +void* Pd_AllocatePdMemory(gpPd_Handle_t pdHandle, gpPd_BufferType_t type) +{ + UInt16 mallocsize; + if (gpPd_BufferTypeBle == type) + { + /* allocate struct with buffer size for BLE packets */ + mallocsize = sizeof(gpPd_Descriptor_t)-GP_PD_BUFFER_SIZE+GP_PD_BUFFER_SIZE_BLE; + } + else + { + mallocsize = sizeof(gpPd_Descriptor_t); + } + return GP_POOLMEM_MALLOC(mallocsize); +} + +static gpPd_Handle_t Pd_GetPd(gpPd_BufferType_t type, UInt16 size) +{ + gpPd_Handle_t pdHandle = 0; + + if(!GP_PD_IS_BUFFERTYPE_VALID(type)) + { + GP_LOG_SYSTEM_PRINTF("inv 1",0); + return GP_PD_INVALID_HANDLE; + } + + + if(type == gpPd_BufferTypeZigBee) + { + // Make sure size is always 128 when using ZigBee, since current PD ram has only support for one size for all PDs + GP_ASSERT_DEV_EXT(GP_PD_BUFFER_SIZE == 0x80); + } + pdHandle = Pd_AllocatePdHandle(); + if (pdHandle == GP_PD_INVALID_HANDLE) + { + GP_LOG_PRINTF("G 0xFF",0); + return GP_PD_INVALID_HANDLE; + } + + + gpPd_Descriptors[pdHandle] = Pd_AllocatePdMemory(pdHandle, type); + + if (!gpPd_Descriptors[pdHandle]) + { + GP_LOG_SYSTEM_PRINTF("No mem for Pd found",0); + return GP_PD_INVALID_HANDLE; + } + + gpPd_Descriptors[pdHandle]->type = type; + return pdHandle; + +} + +static void Pd_FreePd(gpPd_Handle_t pdHandle) +{ + GP_LOG_PRINTF("F %i",0,(UInt16)pdHandle); + + if (pdHandle == GP_PD_INVALID_HANDLE) + { + return; + } + + if (( pdHandle < GP_PD_NR_OF_HANDLES ) && gpPd_Descriptors[pdHandle] != NULL ) + { + gpPoolMem_Free(gpPd_Descriptors[pdHandle]); + gpPd_Descriptors[pdHandle] = NULL; +#if defined(GP_COMP_GPHAL) + { + UInt8 pbmHandle; + for(pbmHandle = 0; pbmHandle < GPHAL_NUMBER_OF_PBMS_USED; pbmHandle++) + { + if(Pd_Pbm2pd[pbmHandle] == pdHandle) + { + Pd_Pbm2pd[pbmHandle] = GP_PD_INVALID_HANDLE; + } + } + } +#endif + + + return; + } + else + { + GP_ASSERT_DEV_EXT(false); //Make no fun about freeing unused handles! + } +} +#if defined(GP_COMP_GPHAL) +static void Pd_FreePBM(UInt8 pbmHandle) +{ + GP_ASSERT_DEV_EXT(Pd_NmbrOfPbmsClaimedBySw); + Pd_NmbrOfPbmsClaimedBySw--; + gpHal_FreeHandle(pbmHandle); + Pd_Pbm2pd[pbmHandle] = GP_PD_INVALID_HANDLE; +#if defined(GP_COMP_UNIT_TEST) + if( Pd_NmbrOfPbmsClaimedBySw == 0 ) + { + gpHal_GoToSleepWhenIdle(true); + } +#endif // GP_DIVERSITY_GPHAL_EXTERN +} + +static UInt8 Pd_GetPBM( UInt8 pdHandle ) +{ + UInt8 pbmHandle; + + GP_ASSERT_DEV_EXT(PD_CHECK_HANDLE_ACCESSIBLE(pdHandle)); + + //Check if pdHandle is already in table + for(pbmHandle = 0; pbmHandle < GPHAL_NUMBER_OF_PBMS_USED; pbmHandle++) + { + if(Pd_Pbm2pd[pbmHandle] == pdHandle) + { + //Would indicate duplicate use of handle for request + GP_LOG_SYSTEM_PRINTF("pbm %u<>handle %u exists",0, pbmHandle, pdHandle); + GP_ASSERT_DEV_EXT(false); + return GP_PBM_INVALID_HANDLE; + } + } +#if defined(GP_COMP_UNIT_TEST) + if(Pd_NmbrOfPbmsClaimedBySw == 0) + { + gpHal_GoToSleepWhenIdle(false); + } +#endif // GP_DIVERSITY_GPHAL_EXTERN + //Allocate PBM +//#warning implement size for gppd ram - SW-4772 + pbmHandle = Pd_AllocatePBM(pdHandle, PD_TMP_SIZE); + if(!GP_HAL_CHECK_PBM_VALID(pbmHandle)) + { +#if defined(GP_COMP_UNIT_TEST) + if(Pd_NmbrOfPbmsClaimedBySw == 0) + { + gpHal_GoToSleepWhenIdle(true); + } +#endif // GP_DIVERSITY_GPHAL_EXTERN + return GP_PBM_INVALID_HANDLE; + } + + return pbmHandle; +} + +gpPd_Handle_t Pd_GetPdFromPBM(UInt8 pbmHandle) +{ + //Protect out of range access + if(pbmHandle >= GPHAL_NUMBER_OF_PBMS_USED) + { + return GP_PD_INVALID_HANDLE; + } + + return Pd_Pbm2pd[pbmHandle]; +} +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) + +static gpPd_Result_t Pd_CheckPdValid(gpPd_Handle_t pdHandle) +{ + gpPd_Result_t result = gpPd_ResultValidHandle; + + if(!PD_CHECK_HANDLE_VALID(pdHandle)) + { + result = gpPd_ResultInvalidHandle; + } + else if(!PD_CHECK_HANDLE_IN_USE(pdHandle)) + { + result = gpPd_ResultNotInUse; + } + GP_LOG_PRINTF("Chck %i %i",0,(UInt16)pdHandle, (UInt16)result); + + return result; +} + +gpPd_BufferType_t Pd_GetPdType(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, gpPd_BufferTypeInvalid); + return gpPd_Descriptors[pdHandle]->type; +} + +//------------------------------ +// Data +//------------------------------ + +static UInt8 Pd_ReadByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset) +{ + GP_LOG_PRINTF("R %i %i",0,(UInt16)pdHandle, (UInt16)offset); + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0xFF); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(offset); + } + + return gpPd_Descriptors[pdHandle]->buffer[offset]; +} + +static void Pd_WriteByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 byte) +{ + GP_LOG_PRINTF("W %i %i %x access %x",0,(UInt16)pdHandle, (UInt16)offset, (UInt16)byte, PD_CHECK_HANDLE_ACCESSIBLE(pdHandle) ); + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(offset); + } + + gpPd_Descriptors[pdHandle]->buffer[offset] = byte; +} + +static void Pd_ReadByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData) +{ + UInt8 splitlength = 0; + GP_LOG_PRINTF("RS %i %i %i",0,(UInt16)pdHandle, (UInt16)offset, (UInt16)length); + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(offset); + // Out of bounds: 2 times memcpy (before and after cyclic part) + if(offset + length > GP_PD_BUFFER_SIZE) + { + // split in 2 + splitlength = (length + offset) - GP_PD_BUFFER_SIZE ; + // read first part of pd and copy it to second part of pData + MEMCPY( &pData[length-splitlength] , &gpPd_Descriptors[pdHandle]->buffer[0] , splitlength); + } + } + + // write first part or full part + MEMCPY( pData , &gpPd_Descriptors[pdHandle]->buffer[offset] , length-splitlength); +} + +static void Pd_WriteByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData) +{ + UInt8 splitlength = 0; + GP_LOG_PRINTF("WS %i %i %i",0,(UInt16)pdHandle, (UInt16)offset, (UInt16)length); + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(offset); + // Out of bounds: 2 times memcpy (before and after cyclic part) + if(offset + length > GP_PD_BUFFER_SIZE) + { + // split in 2 + splitlength = (length + offset) - GP_PD_BUFFER_SIZE ; + // write second part of pData to first part of pd. + // to address 0, , from &pData[length-splitLength] , splitLength + MEMCPY(&gpPd_Descriptors[pdHandle]->buffer[0] , &pData[length-splitlength] , splitlength); + } + } + + // write first part or full part + MEMCPY(&gpPd_Descriptors[pdHandle]->buffer[offset], pData, length-splitlength); +} + +//------------------------------ +// Attributes +//------------------------------ + +static gpPd_Rssi_t Pd_GetRssi(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.rssi; +} + +static void Pd_SetRssi(gpPd_Handle_t pdHandle, gpPd_Rssi_t rssi) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.rssi = rssi; +} + +static gpPd_Lqi_t Pd_GetLqi(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.lqi; +} + +static void Pd_SetLqi(gpPd_Handle_t pdHandle, gpPd_Lqi_t lqi) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.lqi = lqi; +} + +static UInt32 Pd_GetRxTimestamp(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.rxTimestamp; +} + +static UInt32 Pd_GetRxTimestampChip(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.rxTimestampChip; +} + +static void Pd_SetRxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.rxTimestamp = timestamp; +} + +static UInt32 Pd_GetTxTimestamp(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.txTimestamp; +} + +static void Pd_SetTxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.txcfm.txTimestamp = timestamp; +} + +static UInt8 Pd_GetTxChannel(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.lastChannel; +} + +static UInt16* Pd_GetPhaseSamplesBuffer(gpPd_Handle_t pdHandle) +{ + NOT_USED(pdHandle); + return NULL; +} + +static gpPd_Lqi_t Pd_GetTxAckLqi(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.ackLqi; +} + +static UInt8 Pd_GetTxCCACntr(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.txCCACntr; +} + +static UInt8 Pd_GetTxRetryCntr(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.txRetryCntr; + +} + +static void Pd_SetTxRetryCntr(gpPd_Handle_t pdHandle, UInt8 txRetryCntr) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.txcfm.txRetryCntr = txRetryCntr; +} + +static UInt8 Pd_GetFramePendingAfterTx(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.framePendingFromTxPbm; +} + +static void Pd_SetFramePendingAfterTx(gpPd_Handle_t pdHandle, UInt8 framePending) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.txcfm.framePendingFromTxPbm = framePending; +} + +static Bool Pd_GetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.rxEnhancedAck; +} + +static void Pd_SetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle, Bool enhancedAck) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.txcfm.rxEnhancedAck = enhancedAck; +} + +static UInt16 Pd_GetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.txAckFc; +} + +static void Pd_SetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt16 frameControl) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.txAckFc = frameControl; +} + +static UInt32 Pd_GetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.txAckFrameCounter; +} + +static void Pd_SetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt32 frameCounter) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.txAckFrameCounter = frameCounter; +} + +static UInt8 Pd_GetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.txAckKeyId; +} + +static void Pd_SetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt8 keyId) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.txAckKeyId = keyId; +} + +static UInt8 Pd_GetRxChannel(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.rxChannel; + +} + +static void Pd_SetRxChannel(gpPd_Handle_t pdHandle, UInt8 rxChannel) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.rxChannel = rxChannel; + +} +//------------------------------ +// Helper functions +//------------------------------ + +static gpPd_Handle_t Pd_CopyPd(gpPd_Handle_t pdHandle) +{ + gpPd_Handle_t pdHandleCopy; + + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, GP_PD_INVALID_HANDLE); + pdHandleCopy = gpPd_GetPd(); + if(pdHandleCopy != GP_PD_INVALID_HANDLE ) + { + MEMCPY( &gpPd_Descriptors[pdHandleCopy]->attr, &gpPd_Descriptors[pdHandle]->attr, sizeof(gpPd_Descriptors[pdHandle]->attr)); + MEMCPY( gpPd_Descriptors[pdHandleCopy]->buffer, gpPd_Descriptors[pdHandle]->buffer, GP_PD_BUFFER_SIZE); + } + return pdHandleCopy; +} + +#if defined(GP_COMP_GPHAL) +static void Pd_RestoreFromPbm(UInt8 pbmHandle, UInt8 pbmOffset, UInt8 pbmLength, gpPd_Handle_t pdHandle) +{ + gpHal_Address_t address; + UInt8 splitlength = 0; + + address = GP_HAL_PBM_ENTRY2ADDR(pbmHandle); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(pbmOffset); + // copy PBM -> RAM + // if PBM is cyclic PD should also be cyclic (exact copy): Copy to 2 parts + if(pbmOffset + pbmLength > GP_PD_BUFFER_SIZE) + { + // split in 2 + splitlength = (pbmOffset + pbmLength) - GP_PD_BUFFER_SIZE; + GP_HAL_READ_DATA_IN_PBM(address, gpPd_Descriptors[pdHandle]->buffer, splitlength, 0); + } + } + + // write first part or full part + GP_HAL_READ_DATA_IN_PBM(address, &gpPd_Descriptors[pdHandle]->buffer[pbmOffset], (pbmLength - splitlength), pbmOffset); +} + +static void Pd_CopyToPbm(UInt8 pbmHandle, UInt8 offset, UInt8 length) +{ + UInt8 splitLength = 0; + gpPd_Handle_t pdHandle; + gpHal_Address_t address = GP_HAL_PBM_ENTRY2ADDR(pbmHandle); + + pdHandle = Pd_GetPdFromPBM(pbmHandle); + GP_ASSERT_DEV_EXT(PD_CHECK_HANDLE_ACCESSIBLE(pdHandle)); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + if(offset + length > GP_PD_BUFFER_SIZE) + {// split in 2 + splitLength = (offset + length) - GP_PD_BUFFER_SIZE; + GP_HAL_WRITE_DATA_IN_PBM(address, gpPd_Descriptors[pdHandle]->buffer, splitLength, 0); + } + } + + // write first part or full part + GP_HAL_WRITE_DATA_IN_PBM(address, &gpPd_Descriptors[pdHandle]->buffer[offset], length-splitLength,offset); +} + +//-------------------- +// Request/indications +//-------------------- + +static UInt8 Pd_DataRequest(gpPd_Loh_t *p_PdLoh) +{ + UInt8 pbmHandle; + GP_ASSERT_DEV_EXT(p_PdLoh); + + pbmHandle = Pd_GetPBM(p_PdLoh->handle); + if(!GP_HAL_CHECK_PBM_VALID(pbmHandle)) + { + return GP_PD_INVALID_HANDLE; + } + + if(gpPd_Descriptors[p_PdLoh->handle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(p_PdLoh->offset); + } + { + // Copy RAM -> PBM + Pd_CopyToPbm(pbmHandle,p_PdLoh->offset,p_PdLoh->length); + } + + return pbmHandle; +} + + + +static void Pd_DataIndication(UInt8 pbmHandle, gpPd_Offset_t pbmOffset, gpPd_Length_t pbmLength, gpPd_Loh_t *p_PdLoh, gpPd_BufferType_t type) +{ + GP_ASSERT_DEV_EXT(p_PdLoh); + // get RAM PD + // This should be the max RX size (chip dependent) + + { + p_PdLoh->handle = Pd_GetPd(type, GP_PD_BUFFER_SIZE); + } + + if( p_PdLoh->handle != GP_PD_INVALID_HANDLE ) + { + gpPd_TimeStamp_t rxTimeStampChip; + gpPd_TimeStamp_t currentChipTime; + UInt32 currentHostTime; + + gpPd_Descriptors[p_PdLoh->handle]->type = type; + + // Copy PBM -> RAM + Pd_RestoreFromPbm(pbmHandle, pbmOffset, pbmLength, p_PdLoh->handle); + p_PdLoh->offset = pbmOffset; + p_PdLoh->length = pbmLength; + + // copy LQI, RSSI, rx channel + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.lqi = gpHal_GetLQI(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.rssi = gpHal_GetRSSI(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.rxChannel = gpHal_GetRxedChannel(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.txAckFc = gpHal_GetFrameControlFromTxAckAfterRx(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.txAckKeyId = gpHal_GetKeyIdFromTxAckAfterRx(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.txAckFrameCounter = gpHal_GetFrameCounterFromTxAckAfterRx(pbmHandle); + + // Get timestamp + correct + gpHal_GetRxTimestamp(pbmHandle, &rxTimeStampChip); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.rxTimestampChip = rxTimeStampChip; + + // convert "chip time basis" to "host time basis" + gpHal_GetTime(¤tChipTime); + HAL_TIMER_GET_CURRENT_TIME_1US(currentHostTime); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.rxTimestamp = currentHostTime - (currentChipTime - rxTimeStampChip); + + } + { + // Free PBM + gpHal_FreeHandle(pbmHandle); + } +} + +static UInt8 Pd_SecRequest(gpPd_Handle_t pdHandle, UInt8 dataOffset, UInt8 dataLength, UInt8 auxOffset, UInt8 auxLength ) +{ + UInt8 pbmHandle; + + //Allocate PBM + pbmHandle = Pd_GetPBM(pdHandle); + if(!GP_HAL_CHECK_PBM_VALID(pbmHandle)) + { + return GP_PBM_INVALID_HANDLE; + } + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(dataOffset); + PD_WRAP_OFFSET(auxOffset); + } + + if(dataLength > 0) + { + //Copy data + Pd_CopyToPbm(pbmHandle,dataOffset,dataLength); + } + if(auxLength > 0) + { + //Copy aux + Pd_CopyToPbm(pbmHandle,auxOffset,auxLength); + } + return pbmHandle; +} + +static gpPd_Handle_t Pd_cbSecConfirm(UInt8 pbmHandle, UInt8 dataOffset, UInt8 dataLength) +{ + // Get previous claimed RAM PD + gpPd_Handle_t pdHandle; + + pdHandle = Pd_GetPdFromPBM(pbmHandle); + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, GP_PD_INVALID_HANDLE); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(dataOffset); + } + { + // Copy PBM -> RAM + Pd_RestoreFromPbm(pbmHandle, dataOffset, dataLength, pdHandle); + // free PBM and keep lookup table clean + Pd_FreePBM(pbmHandle); + } + + return pdHandle; +} + +static UInt8 Pd_PurgeRequest(gpPd_Handle_t pdHandle) +{ + UInt8 pbmHandle; + //check if Pd valid + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, GP_PD_INVALID_HANDLE); + + //Lookup corresponding PBM from Pd + for (pbmHandle = 0; pbmHandle < GPHAL_NUMBER_OF_PBMS_USED; pbmHandle++) + { + if (Pd_Pbm2pd[pbmHandle] == pdHandle && PBM_CHECK_HANDLE_ACCESSIBLE(pbmHandle)) + { + return pbmHandle; + } + } + //Invalid Pd given. + GP_LOG_PRINTF("PdHandle %x not found!",0,pdHandle); + return GP_PD_INVALID_HANDLE; +} + +static void Pd_cbPurgeConfirm(UInt8 pbmHandle) +{ + gpPd_Handle_t pdHandle; + + //Check associated pdHandle + pdHandle = Pd_GetPdFromPBM(pbmHandle); + + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + + //Free PBM and keep lookup table free + Pd_FreePBM(pbmHandle); +} + +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c new file mode 100644 index 0000000..1728de5 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c @@ -0,0 +1,157 @@ + +/* + * Copyright (c) 2017, Qorvo Inc + * + * This file contains the implementation of the gpPd API protocol. + * + * Packet Descriptor interface + * Handler Implementations + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpPd.h" + +#define GP_COMPONENT_ID GP_COMPONENT_ID_APP + +#ifndef GP_PD_NR_OF_HANDLES +/* workaround for when gpPd is not configured properly, but marshalling code + included anyhow */ +#define GP_PD_NR_OF_HANDLES (1) +#endif // ifndef GP_PD_NR_OF_HANDLES +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GPPD_HANDLE_ASSOCIATION_NUMBER (GP_PD_NR_OF_HANDLES + 1) //Place for all available pd's + 1 invalid + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +typedef struct { + UInt8 oldHandle; + UInt8 newHandle; +} Pd_pdHandleMapping_t; + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ +static Pd_pdHandleMapping_t Pd_handleAssociations[GPPD_HANDLE_ASSOCIATION_NUMBER]; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpPd_InitPdHandleMapping(void) +{ + UIntLoop i; + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + Pd_handleAssociations[i].newHandle = GP_PD_INVALID_HANDLE; + Pd_handleAssociations[i].oldHandle = GP_PD_INVALID_HANDLE; + } +} + +Bool gpPd_StorePdHandle(gpPd_Handle_t newPdHandle, gpPd_Handle_t pdHandle) +{ + UIntLoop i; + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + if( GP_PD_INVALID_HANDLE == Pd_handleAssociations[i].oldHandle ) + { + Pd_handleAssociations[i].newHandle = newPdHandle; + Pd_handleAssociations[i].oldHandle = pdHandle; + return true; + } + } + return false; +} + +/* This function will check if pdHandle exist in list, if not it will return GP_INVALID_HANDLE for storedPdHandle and return true + If no free entry in list for GP_INVALID_HANDLE it will return false */ +Bool gpPd_GetStoredPdHandle(gpPd_Handle_t* storedPdHandle, gpPd_Handle_t pdHandle) +{ + UIntLoop i; + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + if(Pd_handleAssociations[i].oldHandle == pdHandle) + { + *storedPdHandle = Pd_handleAssociations[i].newHandle; + return true; + } + } + *storedPdHandle = GP_PD_INVALID_HANDLE; + + //We can add only 1 invalid entry, check if already exist + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + if(GP_PD_INVALID_HANDLE == Pd_handleAssociations[i].newHandle + && GP_PD_INVALID_HANDLE != Pd_handleAssociations[i].oldHandle) + { + return false; + } + } + //No invalid found, add to list + return gpPd_StorePdHandle(GP_PD_INVALID_HANDLE,pdHandle); +} + +gpPd_Handle_t gpPd_RestorePdHandle(gpPd_Handle_t newPdHandle, Bool remove) +{ + UIntLoop i; + gpPd_Handle_t oldPdHandle = GP_PD_INVALID_HANDLE; + + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + if(Pd_handleAssociations[i].newHandle == newPdHandle + && GP_PD_INVALID_HANDLE != Pd_handleAssociations[i].oldHandle) + { + oldPdHandle = Pd_handleAssociations[i].oldHandle; + if(remove) + { + Pd_handleAssociations[i].newHandle = GP_PD_INVALID_HANDLE; + Pd_handleAssociations[i].oldHandle = GP_PD_INVALID_HANDLE; + } + break; + } + } + return oldPdHandle; +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gen/gpHal_Coex_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gen/gpHal_Coex_marshalling.h new file mode 100644 index 0000000..622c120 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gen/gpHal_Coex_marshalling.h @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPHAL_COEX_MARSHALLING_H_ +#define _GPHAL_COEX_MARSHALLING_H_ + +//DOCUMENTATION HAL_COEX: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpHal_Coex.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + Bool request; + UInt8 priority; +} gpHal_Set_MAC_RX_Packet_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_RX_Packet_Input_struct_t data; +} gpHal_Set_MAC_RX_Packet_Input_marshall_struct_t; + + +typedef struct { + Bool request; + UInt8 priority; + gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t txAckNotGrantedAction; +} gpHal_Set_MAC_TX_ACK_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_TX_ACK_Input_struct_t data; +} gpHal_Set_MAC_TX_ACK_Input_marshall_struct_t; + + +typedef struct { + Bool request; + UInt8 priority; + gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t txNotGrantedAction; +} gpHal_Set_MAC_TX_Packet_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_TX_Packet_Input_struct_t data; +} gpHal_Set_MAC_TX_Packet_Input_marshall_struct_t; + + +typedef struct { + Bool request; + UInt8 priority; +} gpHal_Set_MAC_RX_ACK_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_RX_ACK_Input_struct_t data; +} gpHal_Set_MAC_RX_ACK_Input_marshall_struct_t; + + +typedef struct { + gpHal_MAC_ReqExtTrigger_t trigger; + UInt8 priority; +} gpHal_Set_MAC_RX_ReqExt_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_RX_ReqExt_Input_struct_t data; +} gpHal_Set_MAC_RX_ReqExt_Input_marshall_struct_t; + + +typedef struct { + gpHal_GainControl_Mode_t gainControlMode; + gpHal_AttLna_t attLnaLow; + gpHal_AttLna_t attLnaHigh; +} gpHal_Set_GainControl_Input_struct_t; + +typedef struct { + gpHal_Set_GainControl_Input_struct_t data; +} gpHal_Set_GainControl_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpHal_Set_GainControl_Output_struct_t; + +typedef struct { + gpHal_Set_GainControl_Output_struct_t data; +} gpHal_Set_GainControl_Output_marshall_struct_t; + + +typedef struct { + Bool enableEarlyPreambleDetect; +} gpHal_Set_MAC_EarlyPreambleDetect_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_EarlyPreambleDetect_Input_struct_t data; +} gpHal_Set_MAC_EarlyPreambleDetect_Input_marshall_struct_t; + + +typedef struct { + UInt32 extCoexTimeout; +} gpHal_Set_MAC_ExtensionTimeout_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_ExtensionTimeout_Input_struct_t data; +} gpHal_Set_MAC_ExtensionTimeout_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpHal_Set_MAC_ExtensionTimeout_Output_struct_t; + +typedef struct { + gpHal_Set_MAC_ExtensionTimeout_Output_struct_t data; +} gpHal_Set_MAC_ExtensionTimeout_Output_marshall_struct_t; + + +typedef struct { + UInt8 retriesCnt; +} gpHal_Set_MAC_MacRetriesTreshold_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_MacRetriesTreshold_Input_struct_t data; +} gpHal_Set_MAC_MacRetriesTreshold_Input_marshall_struct_t; + + +typedef struct { + UInt8 retriesCnt; +} gpHal_Set_MAC_CcaRetriesTreshold_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_CcaRetriesTreshold_Input_struct_t data; +} gpHal_Set_MAC_CcaRetriesTreshold_Input_marshall_struct_t; + + +typedef struct { + gpHal_MAC_ReRequestTrigger_t trigger; + UInt8 offTime; + UInt8 onTime; +} gpHal_Set_MAC_ReRequest_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_ReRequest_Input_struct_t data; +} gpHal_Set_MAC_ReRequest_Input_marshall_struct_t; + + +typedef union { + gpHal_Set_MAC_RX_Packet_Input_marshall_struct_t gpHal_Set_MAC_RX_Packet; + gpHal_Set_MAC_TX_ACK_Input_marshall_struct_t gpHal_Set_MAC_TX_ACK; + gpHal_Set_MAC_TX_Packet_Input_marshall_struct_t gpHal_Set_MAC_TX_Packet; + gpHal_Set_MAC_RX_ACK_Input_marshall_struct_t gpHal_Set_MAC_RX_ACK; + gpHal_Set_MAC_RX_ReqExt_Input_marshall_struct_t gpHal_Set_MAC_RX_ReqExt; + gpHal_Set_GainControl_Input_marshall_struct_t gpHal_Set_GainControl; + gpHal_Set_MAC_EarlyPreambleDetect_Input_marshall_struct_t gpHal_Set_MAC_EarlyPreambleDetect; + gpHal_Set_MAC_ExtensionTimeout_Input_marshall_struct_t gpHal_Set_MAC_ExtensionTimeout; + gpHal_Set_MAC_MacRetriesTreshold_Input_marshall_struct_t gpHal_Set_MAC_MacRetriesTreshold; + gpHal_Set_MAC_CcaRetriesTreshold_Input_marshall_struct_t gpHal_Set_MAC_CcaRetriesTreshold; + gpHal_Set_MAC_ReRequest_Input_marshall_struct_t gpHal_Set_MAC_ReRequest; + UInt8 dummy; //ensure none empty union definition +} gpHal_Coex_Server_Input_union_t; + +typedef union { + gpHal_Set_GainControl_Output_marshall_struct_t gpHal_Set_GainControl; + gpHal_Set_MAC_ExtensionTimeout_Output_marshall_struct_t gpHal_Set_MAC_ExtensionTimeout; + UInt8 dummy; //ensure none empty union definition +} gpHal_Coex_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpHal_MAC_ReRequestTrigger_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_MAC_ReRequestTrigger_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_MAC_ReRequestTrigger_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_MAC_ReRequestTrigger_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_MAC_ReqExtTrigger_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_MAC_ReqExtTrigger_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_MAC_ReqExtTrigger_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_MAC_ReqExtTrigger_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_GainControl_Mode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_GainControl_Mode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_GainControl_Mode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_GainControl_Mode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_AttLna_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_AttLna_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_AttLna_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_AttLna_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +// Server functions +gpMarshall_AckStatus_t gpHal_Set_MAC_RX_Packet_Input_buf2api( gpHal_Set_MAC_RX_Packet_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_TX_ACK_Input_buf2api( gpHal_Set_MAC_TX_ACK_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_TX_Packet_Input_buf2api( gpHal_Set_MAC_TX_Packet_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_RX_ACK_Input_buf2api( gpHal_Set_MAC_RX_ACK_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_RX_ReqExt_Input_buf2api( gpHal_Set_MAC_RX_ReqExt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_GainControl_Input_buf2api( gpHal_Set_GainControl_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +void gpHal_Set_GainControl_Output_api2buf( UInt8Buffer* pDest , gpHal_Set_GainControl_Output_marshall_struct_t* pSourceoutput , gpHal_Set_GainControl_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_EarlyPreambleDetect_Input_buf2api( gpHal_Set_MAC_EarlyPreambleDetect_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_ExtensionTimeout_Input_buf2api( gpHal_Set_MAC_ExtensionTimeout_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +void gpHal_Set_MAC_ExtensionTimeout_Output_api2buf( UInt8Buffer* pDest , gpHal_Set_MAC_ExtensionTimeout_Output_marshall_struct_t* pSourceoutput , gpHal_Set_MAC_ExtensionTimeout_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_MacRetriesTreshold_Input_buf2api( gpHal_Set_MAC_MacRetriesTreshold_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_CcaRetriesTreshold_Input_buf2api( gpHal_Set_MAC_CcaRetriesTreshold_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_ReRequest_Input_buf2api( gpHal_Set_MAC_ReRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); + +// Client functions +void gpHal_Set_MAC_RX_Packet_Input_par2buf( UInt8Buffer* pDest , Bool request , UInt8 priority , UInt16* pIndex ); +void gpHal_Set_MAC_TX_ACK_Input_par2buf( UInt8Buffer* pDest , Bool request , UInt8 priority , gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t txAckNotGrantedAction , UInt16* pIndex ); +void gpHal_Set_MAC_TX_Packet_Input_par2buf( UInt8Buffer* pDest , Bool request , UInt8 priority , gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t txNotGrantedAction , UInt16* pIndex ); +void gpHal_Set_MAC_RX_ACK_Input_par2buf( UInt8Buffer* pDest , Bool request , UInt8 priority , UInt16* pIndex ); +void gpHal_Set_MAC_RX_ReqExt_Input_par2buf( UInt8Buffer* pDest , gpHal_MAC_ReqExtTrigger_t trigger , UInt8 priority , UInt16* pIndex ); +void gpHal_Set_GainControl_Input_par2buf( UInt8Buffer* pDest , gpHal_GainControl_Mode_t gainControlMode , gpHal_AttLna_t attLnaLow , gpHal_AttLna_t attLnaHigh , UInt16* pIndex ); +void gpHal_Set_GainControl_Output_buf2par( Bool* result , gpHal_GainControl_Mode_t gainControlMode , gpHal_AttLna_t attLnaLow , gpHal_AttLna_t attLnaHigh , UInt8Buffer* pSource , UInt16* pIndex ); +void gpHal_Set_MAC_EarlyPreambleDetect_Input_par2buf( UInt8Buffer* pDest , Bool enableEarlyPreambleDetect , UInt16* pIndex ); +void gpHal_Set_MAC_ExtensionTimeout_Input_par2buf( UInt8Buffer* pDest , UInt32 extCoexTimeout , UInt16* pIndex ); +void gpHal_Set_MAC_ExtensionTimeout_Output_buf2par( Bool* result , UInt32 extCoexTimeout , UInt8Buffer* pSource , UInt16* pIndex ); +void gpHal_Set_MAC_MacRetriesTreshold_Input_par2buf( UInt8Buffer* pDest , UInt8 retriesCnt , UInt16* pIndex ); +void gpHal_Set_MAC_CcaRetriesTreshold_Input_par2buf( UInt8Buffer* pDest , UInt8 retriesCnt , UInt16* pIndex ); +void gpHal_Set_MAC_ReRequest_Input_par2buf( UInt8Buffer* pDest , gpHal_MAC_ReRequestTrigger_t trigger , UInt8 offTime , UInt8 onTime , UInt16* pIndex ); + +void gpHal_Coex_InitMarshalling( void ); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPHAL_COEX_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal.h new file mode 100644 index 0000000..9b824e5 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal.h @@ -0,0 +1,288 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * The GreenPeak Hardware Abstraction Layer (HAL) implements the API to control the GP chip + * + * The HAL code is subdivided in different C-files as the chip itself consists of different blocks. + * In this way the user can quickly use the code of the block he needs. + * + * The file gpHal.h contains the general functions of the HAL (init, reset, interrupts). + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_H_ +#define _HAL_GP_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/** + * @file gpHal.h + * + * The general functions of the HAL including initialization, reset and interrupt mask control and MCU settings + * are included in the file gpHal.h + * + * @brief The file gpHal.h contains the general functions of the HAL (init, reset, interrupts). +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#ifdef GP_HAL_DIVERSITY_SINGLE_ANTENNA +#if (GP_HAL_DIVERSITY_SINGLE_ANTENNA!=0) && (GP_HAL_DIVERSITY_SINGLE_ANTENNA!=1) +#error error: gpHal GP_HAL_DIVERSITY_SINGLE_ANTENNA is unsupported single antenna +#endif +#endif + +#ifndef GP_DIVERSITY_NR_OF_STACKS +//Overruled from build normally +#define GP_DIVERSITY_NR_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS + +#include "global.h" +#include "gp_global.h" + +//Chip specific includes +#include "gpHal_reg.h" + +//Different GP blocks +#include "gpHal_HW.h" + + +#include "gpHal_MAC.h" //All 802.15.4 RF related functions +#include "gpHal_MAC_Ext.h" +#include "gpHal_ES.h" //Event Scheduler functions +#include "gpHal_SEC.h" //Security functions +#include "gpHal_MISC.h" //Miscellaneous functions +#include "gpHal_DP.h" //Data Pending functionality +#include "gpHal_DPI.h" //Deep Packet Inspection functionality + + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_HAL_DEFAULT_TIMEOUT 10000UL //10ms +#define GP_HAL_MAXIMUM_TIMEOUT 2097119UL // 2.097s - max 16-bit counter value shifted 5 positions -1 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +#define GP_HAL_TIME_DIFF(t1,t2) (t2 <= t1 ? (t1 - t2) : (0xFFFFFFFF - (t1 - t2))) +/** @brief Compares times from the chip's timebase - check if t1 < t2 +*/ +#define GP_HAL_TIME_COMPARE_LOWER(t1,t2) (!((UInt32)((t1) - (t2))/*&(0xFFFFFFFF)*/ < (0x80000000LU))) +/** @brief Compares times from the chip's timebase - check if t1 >= t2 +*/ +#define GP_HAL_TIME_COMPARE_BIGGER_EQUAL(t1,t2) ( ((UInt32)((t1) - (t2))/*&(0xFFFFFFFF)*/ < (0x80000000LU))) +/** @brief Compares times from the chip's timebase - check if t1 > t2 +*/ +#define GP_HAL_TIME_COMPARE_BIGGER(t1,t2) (!((UInt32)((t2) - (t1))/*&(0xFFFFFFFF)*/ < (0x80000000LU))) +/** @brief Compares times from the chip's timebase - check if t1 <= t2 +*/ +#define GP_HAL_TIME_COMPARE_LOWER_EQUAL(t1,t2) ( ((UInt32)((t2) - (t1))/*&(0xFFFFFFFF)*/ < (0x80000000LU))) + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** @brief Reads a register of the GP chip. + * + * Reads a register of the GP chip. + * @param Register The register address to read data from. +*/ +GP_API UInt8 gpHal_ReadReg(gpHal_Address_t Register); +/** @brief Reads a block of registers of the GP chip. + * + * Reads a block of registers of the GP chip. + * @param Address The register address where the block read starts. + * @param pBuffer The pointer to a byte buffer where the read data will be stored. + * @param Length The number of bytes to be read. +*/ +GP_API void gpHal_ReadRegs(gpHal_Address_t Address, void* pBuffer, UInt8 Length); + +/** @brief Write a register of the GP chip. + * + * Write a register of the GP chip. + * @param Register The register address to write to. + * @param Data The data to write to the register. +*/ +GP_API void gpHal_WriteReg(gpHal_Address_t Register, UInt8 Data); +/** + * @brief Writes a block of registers to the GP chip. + * + * Writes a block of registers to the GP chip. + * @param Address The register address where the block write starts. + * @param pBuffer The pointer to a byte buffer where the data to be written are stored. + * @param Length The number of bytes to be written. +*/ +GP_API void gpHal_WriteRegs(gpHal_Address_t Address, void* pBuffer, UInt8 Length); + +// AND register contents with inverted mask, OR in data, and write the result +/** @brief Reads a register, modifies the data with a certain mask and data, writes the register back. */ +GP_API void gpHal_ReadModifyWriteReg(gpHal_Address_t Register, UInt8 Mask, UInt8 Data); + +/** @brief Checks if MSI communication is possible and correct by reading a known register. */ +GP_API Bool gpHal_CheckMsi(void); + +/** + * @brief Returns the version information of the chip + * + * This function returns the version information of the chip. It indicates the current revision of the chip and other information + * +*/ +GP_API UInt16 gpHal_GetHWVersionId(void); + +/** + * @brief Getter method for the chip ID. + * @return The identifier of the silicon. +*/ +#define gpHal_GetChipId() (GP_HAL_EXPECTED_CHIP_ID) + +/** + * @brief Getter method for the chip version. + * @return The metal fix version of the chip. +*/ +GP_API UInt8 gpHal_GetChipVersion(void); + +/** + * @brief Getter method for the ROM BL version. + * + * Note that this function returns -on purpose- only the MSB of the ROM bootloader version. + * + * @return The version of the ROM bootloader. +*/ +GP_API UInt8 gpHal_GetRomBlVersion(void); + +/** + * @brief Initializes HAL variables and sets basic GP chip register values. + * + * The function has to be called at the beginning of the application as it initializes variables that are used throughout operation. + * At startup a decision is made to use the timed operation of the GP chip or not, by setting the parameter timedMAC. + * + * @param timedMAC If set to true, the GP chip will be used with a timed MAC. + * When a timed MAC is used all transmission is done using scheduled triggers from the Event Scheduler (ES). + * +*/ +GP_API void gpHal_Init(Bool timedMAC); + +/** + * @brief Initializes Advanced HAL variables + * + * The function has to be called at the end of the application initialization. In comparison with the basic gpHal_Init() + * method, the settings triggered by this initialization could interfere with initializations of other components. + * +*/ +GP_API void gpHal_AdvancedInit(void); + +/** + * @brief This function performs a reset of the chip. + * + * This function performs a reset of the functional registers. All registers are reverted to their default value and all memories are cleared. + * +*/ +GP_API void gpHal_Reset(void); +/** + * @brief This function checks if radio is awake + * @return Returns if value is awake. If value is 0, chip is asleep else the device is awake. + * +*/ +GP_API UInt8 gpHal_IsRadioAccessible(void); +/** + * @brief This function detects if a reset of the GP chip has occurred. + * + * This function will return true if the GP chip has resetted since its first startup. + * +*/ +GP_API Bool gpHal_DidGPReset(void); +/** + * @brief Thie functions enables the interrupt line of the GP chip. + * + * Sets the main interrupt mask of the GP chip. + * + * @param enable If set to true: main interrupt mask is switched on. +*/ +#define gpHal_EnableInterrupts(enable) GP_HAL_ENABLE_INTERRUPTS(enable) + +// Main interrupt service routine - to be registered by user using HAL_GP_INTERRUPT_INIT() +/** + * @brief The interrupt service routine to be called when the interrupt of the GP chip is seen. + * + * This ISR needs to be called when the interrupt line (INTOUTn) goes low (active low signal). + * It will handle the pending interrupt according to the callback functions registered to the different sources. + * +*/ +GP_API void gpHal_Interrupt(void); + +/** + * @brief This function regulates the GP chip sleep behaviour + * + * This function enables the sleep mode of the GP chip when the GP chip is idle. + * Enabling GoToSleepWhenIdle will cause the GP chip to go to sleep mode when nothing is busy (TX/RX/Receiver on/...) + * Be aware that the GP chip remains in sleep if no wakeup trigger or event is enabled and registered. + * + * It also regulates the GP chip sleep behaviour by keeping track of a "stay awake counter". + * When the counter reaches '0' the GP chip is put into sleep. + * It always needs to be used in pairs, one to wake up the GP chip when its needed and one to set it to sleep when the GP chip is no longer of use. + * In this way different functions can use the sleep functionality without overriding each others settings. + * + * @param enable + * - if set to true : The GP chip will be put to sleep if no other wake requests are pending, counter decremented + * - if set to false: The GP chip will be kept awake, counter incremented +*/ +GP_API void gpHal_GoToSleepWhenIdle(Bool enable); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif //_HAL_GP_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Coex.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Coex.h new file mode 100644 index 0000000..98d17b9 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Coex.h @@ -0,0 +1,294 @@ +/* + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpHal_Coex.h" + * + * gpHal Coexistence subcomponent + * + * Declarations of the public functions and enumerations of gpHal_Coex. +*/ + +#ifndef _GPHAL_COEX_H_ +#define _GPHAL_COEX_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" + +/***************************************************************************** + * Enum Definitions + *****************************************************************************/ + +/** @enum gpHal_MAC_ReRequestTrigger_t */ +//@{ +/** @brief No action. */ +#define gpHal_MAC_ReRequestTrigger_None 0x00 +/** @brief Re-Request if grant is lost or not given. */ +#define gpHal_MAC_ReRequestTrigger_NoGrant 0x01 +/** @brief Re-Request on priority change during ongoing request. */ +#define gpHal_MAC_ReRequestTrigger_PrioChange 0x02 +/** @typedef gpHal_MAC_ReRequestTrigger_t + @brief Mask with the ReRequest triggers. +*/ +typedef UInt8 gpHal_MAC_ReRequestTrigger_t; +//@} + +/** @enum gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t */ +//@{ +/** @brief No action, grant not aware. */ +#define gpHal_MAC_TX_Packet_Ignore 0x00 +/** @brief If not granted, then disable PA */ +#define gpHal_Coex_MAC_TX_Packet_DisablePa 0x01 +/** @brief If not granted, then trigger a CMSA_CA failure. Only applicable to TX_packet. */ +#define gpHal_Coex_MAC_TX_Packet_CcaFailure 0x02 +/** @brief If not granted, CSMA-CA delay backoff counter get frozen. Once grant is received, conter proceeds. Can be used to force wait for grant before CCA measurement. When using SW CSMA-CA, backoff delay is handled by SW, so this option is ignored. */ +#define gpHal_Coex_MAC_TX_Packet_CcaHold 0x04 +/** @brief If not granted, TX state machine is hold after doing CSMA-CA, but before starting the TX. Once Grant is received, TX starts imediatelly. */ +#define gpHal_Coex_MAC_TX_Packet_DelayedStart 0x08 +/** @typedef gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t + @brief Mask that sets the MAC packet TX actions upon not having grant. +*/ +typedef UInt8 gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t; +//@} + +/** @enum gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t */ +//@{ +/** @brief No action, grant not aware. */ +#define gpHal_MAC_TX_ACK_Ignore 0x00 +/** @brief If not granted, then disable PA */ +#define gpHal_Coex_MAC_TX_ACK_DisablePa 0x01 +/** @brief If not granted, skip sending of the ACK. */ +#define gpHal_Coex_MAC_TX_ACK_SkipTx 0x02 +/** @typedef gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t + @brief Mask that sets the MAC ACK TX actions upon not having grant. +*/ +typedef UInt8 gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t; +//@} + +/** @enum gpHal_MAC_ReqExtTrigger_t */ +//@{ +/** @brief No extension. */ +#define gpHal_MAC_ExtensionTriggers_None 0x00 +/** @brief Extend on preamble detect */ +#define gpHal_MAC_ExtensionTriggers_Preamble 0x01 +/** @brief Extend on SFD reception */ +#define gpHal_MAC_ExtensionTriggers_SFD 0x02 +/** @brief Extend on macfilter */ +#define gpHal_MAC_ExtensionTriggers_PacketAbort 0x04 +/** @brief Extend on CRC failure */ +#define gpHal_MAC_ExtensionTriggers_FCSERR 0x08 +/** @typedef gpHal_MAC_ReqExtTrigger_t + @brief Mask that sets request extension triggers +*/ +typedef UInt8 gpHal_MAC_ReqExtTrigger_t; +//@} + +/** @enum gpHal_GainControl_Mode_t */ +//@{ +/** @brief Use default fixed gain control level LNA0 */ +#define gpHal_GainControl_Mode_Default 0x00 +/** @brief Gain control levels will be fixed to the specified lowLnaAtt setting */ +#define gpHal_GainControl_Mode_Fixed 0x01 +/** @brief Gain control levels will be controlled by the internal AGC */ +#define gpHal_GainControl_Mode_RssiBasedAgc 0x02 +/** @brief Gain control levels will be controlled by the configured COEX_ATT_CTRL BSP setting */ +#define gpHal_GainControl_Mode_GpioBasedAgc 0x03 +/** @typedef gpHal_GainControl_Mode_t + @brief Enumeration specifying the gain control mode +*/ +typedef UInt8 gpHal_GainControl_Mode_t; +//@} + +/** @enum gpHal_AttLna_t */ +//@{ +/** @brief Select LNA0 */ +#define gpHal_AttLna_LNA0 0x00 +/** @brief Select LNA1 */ +#define gpHal_AttLna_LNA1 0x01 +/** @brief Select LNA2 */ +#define gpHal_AttLna_LNA2 0x02 +/** @brief Select LNA3 */ +#define gpHal_AttLna_LNA3 0x03 +/** @brief Select LNA4 */ +#define gpHal_AttLna_LNA4 0x04 +/** @brief Select LNA5 */ +#define gpHal_AttLna_LNA5 0x05 +/** @brief Don't use/update LNA setting */ +#define gpHal_AttLna_Ignore 0xFF +/** @typedef gpHal_AttLna_t + @brief Selection of predefined LNA condif +*/ +typedef UInt8 gpHal_AttLna_t; +//@} + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/* Callbacks for data confirm and GPIO interrupt */ +typedef void (*gpHal_CoexCbDataConfirm_t)(UInt8 result, UInt8 retries, UInt8 priority); +typedef UInt8 (*gpHal_CoexCbGpioInt_t)(UInt8 interruptsMasked); +typedef void (*gpHal_CoexCbCSMARetry_t)(UInt8 result, void *pCSMA_CA_State); + +/***************************************************************************** + * Public Function Prototypes + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +//Requests +/** @brief Set the coexistence parameters for 802.15.4 packet RX +* +* @param request +* @param priority +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_RX_Packet(Bool request, UInt8 priority); + +/** @brief Set the coexistence parameters for 802.15.4 ACK TX +* +* @param request +* @param priority +* @param txAckNotGrantedAction +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_TX_ACK(Bool request, UInt8 priority, gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t txAckNotGrantedAction); + +/** @brief Set the coexistence parameters for 802.15.4 packet TX +* +* @param request +* @param priority +* @param txNotGrantedAction +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_TX_Packet(Bool request, UInt8 priority, gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t txNotGrantedAction); + +/** @brief Set the coexistence parameters for 802.15.4 ACK RX +* +* @param request +* @param priority +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_RX_ACK(Bool request, UInt8 priority); + +/** @brief Configure the request extensions +* +* @param trigger +* @param priority +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_RX_ReqExt(gpHal_MAC_ReqExtTrigger_t trigger, UInt8 priority); + +/** @brief Set the gain control +* +* @param gainControlMode +* @param attLnaLow +* @param attLnaHigh +* @return result +*/ +gpHal_Result_t gpHal_Set_GainControl(gpHal_GainControl_Mode_t gainControlMode, gpHal_AttLna_t attLnaLow, gpHal_AttLna_t attLnaHigh); + +/** @brief Enable early preamble detection +* +* @param enableEarlyPreambleDetect +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_EarlyPreambleDetect(Bool enableEarlyPreambleDetect); + +/** @brief Set extension timeout in multiples of 16 us. +* +* @param extCoexTimeout +* @return result Returns false when value out of range, else sucess. +*/ +gpHal_Result_t gpHal_Set_MAC_ExtensionTimeout(UInt32 extCoexTimeout); + +/** @brief Set the number of consecutive mac retries before raising the priority of the packet TX. Setting to 0 deactivate it +* +* @param retriesCnt +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_MacRetriesTreshold(UInt8 retriesCnt); + +/** @brief Set the number of consecutive cca retries before raising the priority of the packet TX. Setting to 0 deactivate it +* +* @param retriesCnt +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_CcaRetriesTreshold(UInt8 retriesCnt); + +/** @brief Configure if the request line should be re-requested on case of grant not given or lost for over x time +* +* @param trigger Enable re-request upon no-grant or priority change +* @param offTime Set the time in uS that request should be off during a re-request toggle. +* @param onTime Set the time in uS it should wait for the grant, before turning request off to turn it on again. +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_ReRequest(gpHal_MAC_ReRequestTrigger_t trigger, UInt8 offTime, UInt8 onTime); + +/** @brief Configure if an 802.15.4 indirect packet TX should have a different priority level as normal TX. +* +* @param enable Enable the priority boost for indirect TX. +* When enabled, all indirect TX will use the priority defined by this API. +* When disabled, the priority applied is the same on for a normal packet TX. +* @param priority Priority level to be used when enabled. +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_IndTxPriorityBoost(Bool enable, UInt8 priority); + +//Indications +/** @brief Finalize handling after timeout on "Wait for COEX GRANT" +* Actions: +* Restore saved configuration for PA (internal and, if applcable, external PA) +* Modify result accordingly +* +*/ +UInt8 gpHal_CompletePossibleGrantimeoutByConfigRestore(UInt8 result); +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //_GPHAL_COEX_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DP.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DP.h new file mode 100644 index 0000000..7f0916a --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DP.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2013-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + + +#ifndef _GPHAL_DATAPENDING_H_ +#define _GPHAL_DATAPENDING_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_RomCode_DP.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/** @file gpHal_DP.h + * @brief This file contains all the functions needed for DataPending functionality. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @enum gpHal_AddressMode_t */ +//@{ +/** @brief No Address */ +#define gpHal_AddressModeNoAddress 0 +/** @brief Reserved */ +#define gpHal_AddressModeReserved 1 +/** @brief Short (i.e. 16-bit) address */ +#define gpHal_AddressModeShortAddress 2 +/** @brief Extended (i.e. 8-byte) address */ +#define gpHal_AddressModeExtendedAddress 3 +/** @typedef gpHal_AddressMode_t + @brief Selection of the address mode +*/ +typedef UInt8 gpHal_AddressMode_t; +//@} + +/** @union gpHal_RfAddress_t */ +typedef union { +/** The short address (2 bytes).*/ + UInt16 Short; +/** The extended address (MAC address), 8 bytes.*/ + MACAddress_t Extended; +} gpHal_RfAddress_t; + +/** @union gpHal_AddressInfo_t */ +typedef struct { + gpHal_RfAddress_t address; + UInt16 panId; + gpHal_AddressMode_t addressMode; +} gpHal_AddressInfo_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs_DP.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +gpHal_Result_t gpHal_DpClearEntries(UInt8 id); + +/** @brief Add an entry to the list of addresses for which a data packet is pending transission +* +* @param pAddressInfo The address for which a data packet is pending +* @param id The stack id which has the data packet pending +* @return result The return parameter indicating success or the failure code +* +*/ +gpHal_Result_t gpHal_DpAddEntry(gpHal_AddressInfo_t* pAddressInfo, UInt8 id); +/** @brief Remove an entry from the list of addresses for which a data packet is pending transission +* +* @param pAddressInfo The address for which a data packet is no longer pending +* @param id The stack id which had the data packet pending +* @return result The return parameter indicating success or the failure code +* +*/ +gpHal_Result_t gpHal_DpRemoveEntry(gpHal_AddressInfo_t* pAddressInfo, UInt8 id); + +/** @brief Check if there are datapending entries in the list +* +* @return result A boolean indicating if any stack has pending data packets in the list. +* +*/ +Bool gpHal_DPEntriesPending(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif /* _GPHAL_DATAPENDING_H_ */ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DPI.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DPI.h new file mode 100644 index 0000000..a24283a --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DPI.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_DPI_H_ +#define _HAL_GP_DPI_H_ + +/** @file gpHal_DPI.h + * @brief This file contains functions for Deep Packet Inspection +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + /** + * @brief This function prepares the DPI block for further configuration +*/ +void gpHal_DpiPrepareForConfig(void); + +/** + * @brief Returns true if enabling without conflicts is allowed +*/ +Bool gpHal_DpiCheckPreConditions(void); + +/** + * @brief Returns true if DPI is running +*/ +Bool gpHal_DpiIsDpiRunning(void); + +/** + * @brief Enable the DPI block - only call when gpHal_DpiCheckPreConditions() returned true +*/ +gpHal_Result_t gpHal_DpiEnable(void); + +/** + * @brief Disable the DPI block +*/ +gpHal_Result_t gpHal_DpiDisable(void); + +/** + * @brief Add a pattern to be checked by DPI +*/ +void gpHal_DpiAddPattern(UInt8* pPattr, UInt8 length); + +/** + * @brief Add a device to be checked by DPI +*/ +void gpHal_DpiAddDevice(UInt32* pFrameCnt, UInt16* pShortAddr, MACAddress_t* pLongAddr, UInt8* pSecKey); + +#ifdef __cplusplus +} +#endif + +#endif //_HAL_GP_DPI_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_ES.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_ES.h new file mode 100644 index 0000000..aa49e05 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_ES.h @@ -0,0 +1,461 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpHal_ES.h + * + * This file defines all functions for the event scheduler and sleep modes. These functions can be used to schedule certain actions : an interrupt, TX of a packet, etc. + * The diffent sleep and wakeup modes can also be initialized and used with these functions. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_ES_H_ +#define _HAL_GP_ES_H_ + +/** @file gpHal_ES.h + * This file defines all functions for the event scheduler and sleep modes. These functions can be used to schedule certain actions : an interrupt, TX of a packet, etc. + * The different sleep and wakeup modes can also be initialized and used with these functions. + * + * @brief All functions for the event scheduler and sleep modes. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpHal_reg.h" +#include "gpHal_HW.h" + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +//Execution options +/** @brief Event exection options mask. */ +#define GP_ES_EXECUTION_OPTIONS_MASK 0xF +/** @brief Event exection options : Execute the event even if the trigger time has passed. */ +#define GP_ES_EXECUTION_OPTIONS_EXECUTE_IF_TOO_LATE 0x4 +/** @brief Event exection options : Prohibit standby as long as event is pending */ +#define GP_ES_EXECUTION_OPTIONS_PROHIBIT_STANDBY 0x8 +/** @brief Event exection options : Execute the event only if the event was triggered on time. */ +#define GP_ES_EXECUTION_OPTIONS_NOT_EXECUTE_IF_TOO_LATE 0x0 + +//Interrupt options +/** @brief Event interrupt options mask (enables all interrupt options).*/ +#define GP_ES_INTERRUPT_OPTIONS_MASK 0x3F +/** @brief Event interrupt option: generate interrupt on first event execution that is on time.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_FIRST_ON_TIME 0x01 //First bit +/** @brief Event interrupt option: generate interrupt on event execution other then first or last execution that is on time.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_OTHERS_ON_TIME 0x02 //2nd bit +/** @brief Event interrupt option: generate interrupt on last event execution that is on time.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_LAST_ON_TIME 0x04 //3rd bit +/** @brief Event interrupt option: generate interrupt on first event execution that is too late.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_FIRST_TOO_LATE 0x08 //4th bit +/** @brief Event interrupt option: generate interrupt on execution other then first or last execution that is too late.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_OTHERS_TOO_LATE 0x10 //5th bit +/** @brief Event interrupt option: generate interrupt on last event execution that is too late.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_LAST_TOO_LATE 0x20 //6th bit + +/** @brief Default value for the calibration of the 32kHz crystal */ +#define GPHAL_ES_32KHZ_SLEEP_DEFAULT_CALIB 0x3D090000 // 32,768kHz +/** @brief Default value for the calibration of the 16MHz crystal */ +#define GPHAL_ES_16MHZ_SLEEP_DEFAULT_CALIB 0x40000000 + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +//Result and state fields in the event control field +/** @brief Get the event result (top 4 bits of the control field). */ +#define GP_ES_GET_EVENT_RESULT(control) (((control)>>4) & 0xF) +/** @brief Get the event state (last 4 bits of the control field). */ +#define GP_ES_GET_EVENT_STATE(control) ( (control) & 0xF) +/** @brief Set the event result (top 4 bits of the control field). */ +#define GP_ES_SET_EVENT_RESULT(control,result) (control = (control & 0x0F) | (((result)<<4) & 0xF0)) +/** @brief Set the event state (last 4 bits of the control field). */ +#define GP_ES_SET_EVENT_STATE(control,state) (control = (control & 0xF0) | ( (state) & 0x0F)) + + +#define GPHAL_ES_ABSOLUTE_EVENT_ID_INVALID 0xFF + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +/** @name gpHal_EventType_t */ +//@{ +/** @typedef gpHal_EventType_t + * @brief The gpHal_EventType_t type defines the event type. +*/ +typedef UInt8 gpHal_EventType_t; +//@} +// +/** @name gpHal_AbsoluteEventId_t */ +//@{ +/** @typedef gpHal_AbsoluteEventId_t + * @brief The gpHal_AbsoluteEventId_t type holds an absolue event index +*/ +typedef UInt8 gpHal_AbsoluteEventId_t; +//@} + + +//Standby modes +/** @name gpHal_SleepMode_t */ +//@{ +/** @typedef gpHal_SleepMode_t + * @brief The gpHal_SleepMode_t type defines the GP chip sleep mode. +*/ +typedef UInt8 gpHal_SleepMode_t; +//@} + +// The status of a sleep mode (determined by oscillator benchmark measurements, by comparision against 32 MHz clock) +#define gpHal_SleepClockMeasurementStatusNotStarted 0x00 +#define gpHal_SleepClockMeasurementStatusPending 0x01 +#define gpHal_SleepClockMeasurementStatusNotStable 0x02 +#define gpHal_SleepClockMeasurementStatusStable 0x03 + +typedef UInt8 gpHal_SleepClockMeasurementStatus_t; + +//Event states enumeration +/** @name gpHal_EventState_t */ +//@{ +/** @brief The event is invalid, will not be executed if execution time is reached.*/ +#define gpHal_EventStateInvalid GPHAL_ENUM_EVENT_STATE_INVALID +/** @brief The event is scheduled, it will be executed if execution time is reached.*/ +#define gpHal_EventStateScheduled GPHAL_ENUM_EVENT_STATE_SCHEDULED +/** @brief The event is scheduled for immediate, it will be executed as soon as possible.*/ +#define gpHal_EventStateScheduledForImmediate GPHAL_ENUM_EVENT_STATE_SCHEDULED_FOR_IMMEDIATE_EXECUTION +/** @brief The event is rescheduled after being triggered before. It will be executed if execution time is reached.*/ +#define gpHal_EventStateReScheduled GPHAL_ENUM_EVENT_STATE_RESCHEDULED +/** @brief The event has been executed.*/ +#define gpHal_EventStateDone GPHAL_ENUM_EVENT_STATE_DONE +/** @typedef gpHal_EventState_t + * @brief The gpHal_EventState_t type defines the Absolute Event state. +*/ +typedef UInt8 gpHal_EventState_t; +//@} + +/** @name gpHal_EventResult_t */ +//@{ +/** @brief Event not yet executed. */ +#define gpHal_EventResultInvalid GPHAL_ENUM_EVENT_RESULT_UNKNOWN +/** @brief Event was executed on time. */ +#define gpHal_EventResultOnTime GPHAL_ENUM_EVENT_RESULT_EXECUTED_ON_TIME +/** @brief Event was executed too late and GP_ES_EXECUTION_OPTIONS_EXECUTE_IF_TOO_LATE was set */ +#define gpHal_EventResultTooLate GPHAL_ENUM_EVENT_RESULT_EXECUTED_TOO_LATE +/** @brief Event was executed too late and GP_ES_EXECUTION_OPTIONS_NOT_EXECUTE_IF_TOO_LATE was set */ +#define gpHal_EventResultMissed GPHAL_ENUM_EVENT_RESULT_MISSED_TOO_LATE +/** @typedef gpHal_EventResult_t + * @brief The gpHal_EventResult_t type defines the event result. +*/ +typedef UInt8 gpHal_EventResult_t; +//@} + +//Absolute event descriptor +/** @struct gpHal_AbsoluteEventDescriptor + * @brief The gpHal_AbsoluteEventDescriptor structure specifying the parameters of an Absolute Event. + * @typedef gpHal_AbsoluteEventDescriptor_t + * @brief The gpHal_AbsoluteEventDescriptor_t type definition based on the structure gpHal_AbsoluteEventDescriptor. +*/ +typedef struct gpHal_AbsoluteEventDescriptor +{ +/** This field contains the absolute time (absolute to the symbol counter of the GP chip) at which the event should be executed. */ + UInt32 exTime; +/** This field contains the period between different periodic executions of this event. This value will only be used by the GP chip when recAmount > 0. */ + UInt32 recPeriod; //Recurrence Period +/** This field contains the amount of recurrences of the event. If set to 0 = 1 execution, set to 1 = 2 executions. Value 0xFFFF indicates an endless recurrent event. */ + UInt16 recAmount; //Recurrence Amount +/** This field contains Custom Data that can be associated with the event. This data can be read when using the gpHal_MonitorAbsoluteEvent() function.*/ + UInt16 customData; //custom uP data +/** This field contains the bitfield specifying the execution of the event (see GP_ES_EXECUTION_OPTIONS_MASK).*/ + UInt8 executionOptions; +/** This field contains the bitfield specifying the interrupts given by the event (see GP_ES_INTERRUPT_OPTIONS_MASK).*/ + UInt8 interruptOptions; //interrupt on_first/others/last_on_time +/** This field contains the Event state (see enum gpHal_EventState_t) and the Event result + * (see enum gpHal_EventResult_t). The macro GP_ES_SET_EVENT_STATE() (resp. GP_ES_SET_EVENT_RESULT()) + * should be used in order to extract the information and the macro GP_ES_SET_EVENT_STATE() (resp. GP_ES_SET_EVENT_RESULT()) in order to initialize this field. + * + * Preferably the result field is written to INVALID at schedule time. After the event was triggered, + * this field will return information about the execution status. */ + UInt8 control; //Control +/** This field contains the Event type (see enum gpHal_EventType_t). This specifies what action needs to be performed on execution of the event. */ + UInt8 type; //Type +} gpHal_AbsoluteEventDescriptor_t; + +/** @struct gpHal_ExternalEventDescriptor + * @brief The gpHal_ExternalEventDescriptor structure specifying the External Event. + * @typedef gpHal_ExternalEventDescriptor_t + * @brief The gpHal_ExternalEventDescriptor_t type definition based on the structure gpHal_ExternalEventDescriptor. +*/ +typedef struct gpHal_ExternalEventDescriptor +{ +/** This field contains the Event type (see enum gpHal_EventType_t). This specifies what action needs to be performed on execution of the event. */ + gpHal_EventType_t type; +} gpHal_ExternalEventDescriptor_t; + + + +/***************************************************************************** + * Public function prototypes + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif +//ES Enable/Disable callbacks + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs_ES.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** + * @brief This function enables the interrupt line of the External Event interrupt. + * + * This function enables the interrupt line of the External Event interrupt by setting the interrupt mask of the External Event interrupt. + * + * @param enable Enables the interrupt source if true. +*/ +#define gpHal_EnableExternalEventCallbackInterrupt(enable) GP_HAL_ENABLE_EXTERNAL_EVENT_INTERRUPT(enable) + +/** + * @brief This function enables the interrupt line of an Absolute Event interrupt. + * + * This function enables the interrupt line of an Absolute Event interrupt by setting the interrupt mask of the Absolute Event with index eventNbr. + * + * @param eventNbr The index of the Absolute Event (1..16). + * @param enable Enables the interrupt source if true. +*/ +GP_API void gpHal_EnableAbsoluteEventCallbackInterrupt(UInt8 eventNbr, Bool enable); + +//ES register callbacks +/** + * @brief Registers the callback for an Absolute Event. + * + * This function registers the callback for an Absolute Event. The callback will be executed when the Absolute Event is triggered. + * The Absolute Event with the correct index needs to be enabled. + * + * @param callback The pointer to the callback function. + * @param eventNbr The index of the Absolute Event (1..16). +*/ +GP_API void gpHal_RegisterAbsoluteEventCallback(gpHal_AbsoluteEventCallback_t callback, UInt8 eventNbr); + +/** + * @brief Registers the callback for a External Event. + * + * This function registers the callback for a External Event. It returns the callback that was + * registered earlier or NULL if none was registered. Multiple External Event handlers can be + * threaded by calling previously registered handler from the new handler. + * + * The callback will be executed when the External Event is triggered. + * The External Event interrupt must be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API gpHal_ExternalEventCallback_t gpHal_RegisterExternalEventCallback(gpHal_ExternalEventCallback_t callback); + +// ES functions + +/** @brief Resets the timebase of the GP chip */ +GP_API void gpHal_ResetTime(void); + +/** + * @brief Gets the time of the GP chip. + * + * This function returns the current time of the GP chip in us. + * + * @param pTime Pointer to the variable where the time will be stored. +*/ +GP_API void gpHal_GetTime(UInt32* pTime); + +/** + * @brief Calibrates the timer of the GP chip. + * + * This function calibrates the GP chip time base by applying a correction of the current time and an adjustment of the timer slope. + * + * @param phaseAdjustment The phase adjustment to be applied to the GP chip timer. + * @param frequency The desired frequency of the timer/slope of the counter. +*/ +GP_API void gpHal_ApplyCalibration( Int32 phaseAdjustment, UInt32 frequency); + +/** + * @brief Schedules an Absolute Event in the GP chip. + * + * This function uploads and activates an event in the GP chip Event Scheduler. To facilitate a callback on the execution of the event + * one must register the callback using gpHal_RegisterAbsoluteEventCallback() and enable the interrupt using gpHal_EnableAbsoluteEventCallbackInterrupt(). + * + * @param pAbsoluteEventDescriptor Pointer to the AbsoluteEventDescriptor_t structure containing the Event options. + * @param eventNbr The index of the Absolute Event (1..16). +*/ +GP_API void gpHal_ScheduleAbsoluteEvent(gpHal_AbsoluteEventDescriptor_t* pAbsoluteEventDescriptor, gpHal_AbsoluteEventId_t eventNbr); + +/** + * @brief Allocates an available absolute event id + * +*/ +GP_API gpHal_AbsoluteEventId_t gpHal_GetAbsoluteEvent(void); +/** + * @brief Frees an allocated absolute event id + * +*/ +GP_API void gpHal_FreeAbsoluteEvent(gpHal_AbsoluteEventId_t EventId); + +/** + * @brief Refreshes an Absolute Event in the GP chip. + * + * This function refreshes an already prepared Absolute Event. The event descriptor gpHal_AbsoluteEventDescriptor_t needs to be written as part of the preparation. + * Writing the gpHal_AbsoluteEventDescriptor_t can be done with GP_ES_WRITE_EVENT_DESCRIPTOR(). + * + * @param eventNbr The index of the Absolute Event (1..16). + * @param absTime The absolute execution time of the event (in us) + * @param control The control field of the event descriptor (see gpHal_AbsoluteEventDescriptor_t). + * +*/ +GP_API void gpHal_RefreshAbsoluteEvent(gpHal_AbsoluteEventId_t eventNbr, UInt32 absTime, UInt8 control); + +/** + * @brief Unschedules an Absolute Event. + * + * This function disables the Absolute Event in the GP chip and returns the current EventState. + * Possible Event States are enumerated in the enumeration gpHal_EventState. + * + * @param eventNbr The index of the Absolute Event (1..16). +*/ +GP_API gpHal_EventState_t gpHal_UnscheduleAbsoluteEvent(gpHal_AbsoluteEventId_t eventNbr); + +/** + * @brief Returns all information about a registered event. + * + * This function returns the AbsoluteEventDescriptor_t structure of an Absolute Event. + * + * This function needs to be used carefully, because it temporarilly disables the event and the event could be missed. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidHandle (no Absolute Event registered at given index) + * + * @param eventNbr The index of the Absolute Event (1..16). + * @param pAbsoluteEvent The pointer where the AbsoluteEventDescriptor_t structure is returned. +*/ +GP_API gpHal_Result_t gpHal_MonitorAbsoluteEvent(UInt8 eventNbr, gpHal_AbsoluteEventDescriptor_t* pAbsoluteEvent); + +/** + * @brief Schedules an immediate event trigger in the GP chip. + * + * This function uploads and activates the Relative Event in the GP chip Event Scheduler immediately. + * + * @param type Type of event to execute without delay +*/ +GP_API void gpHal_ScheduleImmediateEvent(gpHal_EventType_t type); + +/** + * @brief Schedules the External Event in the GP chip + * + * This function uploads and activates the External Event in the GP chip Event Scheduler. To facilitate a callback on the execution of the event + * the callback must be registered using gpHal_RegisterExternalEventCallback() and the interrupt enabled using gpHal_EnableExternalEventCallbackInterrupt(). + * + * @param pExternalEventDescriptor Pointer to the gpHal_ExternalEventDescriptor_t structure containing the Event options. +*/ +GP_API void gpHal_ScheduleExternalEvent(gpHal_ExternalEventDescriptor_t* pExternalEventDescriptor); + +/** + * @brief Unschedules the External Event. + * + * This function disables the External Event in the GP chip. + * + * Possible results are: + * - gpHal_ResultSuccess +*/ +GP_API gpHal_Result_t gpHal_UnscheduleExternalEvent(void); + +/** + * @brief Returns all information about the External Event. + * + * This funcion returns the gpHal_ExternalEventDescriptor_t structure of the External Event. + * The contents of the structure are only valid in case the function returns gpHal_ResultSuccess. + * + * Possible results are: + * - gpHal_ResultSuccess (valid External Event found) + * - gpHal_ResultInvalidRequest (no valid External Event present) + * + * @param pExternalEventDescriptor The pointer where the gpHal_ExternalEventDescriptor_t structure is returned. +*/ +GP_API gpHal_Result_t gpHal_MonitorExternalEvent(gpHal_ExternalEventDescriptor_t* pExternalEventDescriptor); + +// Sleep functions +/** + * @brief Sets the sleep mode of the GP chip. + * + * This function sets the sleep mode of the GP chip. As enumerated under the enumeration gpHal_SleepMode the GP chip can be put into 4 different sleep modes. + * The desired setting can be made using this function. + * + * @param mode The sleepmode enumerated in gpHal_SleepMode. + * @return gpHal_ResultSuccess only if the operation was successful +*/ +GP_API gpHal_Result_t gpHal_SetSleepMode(gpHal_SleepMode_t mode); + +/** + * @brief Gets the sleep mode of the GP chip. + * + * This function returns which sleep mode is currently set. The return mode is returned as enumerated under the enumeration gpHal_SleepMode. +*/ +GP_API gpHal_SleepMode_t gpHal_GetSleepMode(void); +/** + * @brief Gets the actual (measured) deviation of a sleep clock with respect to the 32 MHz clock + * + * This function returns whether the measurements for the requested sleep mode have been performed and what the + * measured frequency is. +*/ +GP_API gpHal_SleepClockMeasurementStatus_t gpHal_GetMeasuredSleepClockFrequency(gpHal_SleepMode_t mode, UInt32* frequencymHz); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +/** + * @brief Returns the average sleep clock accuracy of the currently selected sleep clock +*/ +GP_API UInt16 gpHal_GetSleepClockAccuracy(void); + +/** + * @brief Returns the worst-case sleep clock accuracy of the currently selected sleep clock +*/ +GP_API UInt16 gpHal_GetWorstSleepClockAccuracy(void); + +#ifdef __cplusplus +} +#endif + + +#endif /* _HAL_GP_ES_H_ */ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW.h new file mode 100644 index 0000000..174908d --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW.h @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * gpHal_HW.h + * + * This file switches between the HW access modes (SPI, I2C, ...) + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * + */ + +#ifndef _HAL_GP_HW_H_ +#define _HAL_GP_HW_H_ + +/** + * @file gpHal_HW.h + * @brief This file switches between the HW access modes (SPI, I2C, ...) +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "hal.h" +#include "gpAssert.h" + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/** @brief A macro that is used to print log messages. + * + * A macro that is used to print log messages inside of the GPHAL. This macro is + * inserted in the GPHAL where the log messages are useful. By default, + * this macro is empty and it is up to the GPHAL user to implement it. + * + * @param fmt The format string of the print message. + * @param ... List of parameters for the print message. The first parameter of this list should be + * the length of the parameters in bytes. + */ +#if defined(GP_DIVERSITY_LOG) +#include "gpLog.h" + +#ifndef HAVE_NO_VARIABLE_LENGTH_MACRO +#define GP_LOG(fmt, ...) GP_LOG_SYSTEM_PRINTF(fmt, __VA_ARGS__) +#else +/* workaround for Holtek and others + * to avoid varargs macro trouble with holtec we always define it + * as GP_LOG_PRINTF, and not as an empty statement. + * gpLog.h is responsible to make it an empty statement/function + */ +#define GP_LOG GP_LOG_PRINTF +#endif //HAVE_NO_VARIABLE_LENGTH_MACRO + +#else + +#ifndef HAVE_NO_VARIABLE_LENGTH_MACRO +#define GP_LOG(fmt, ...) do {} while (false) +#else +#define GP_LOG +#endif //HAVE_NO_VARIABLE_LENGTH_MACRO + +#endif //GP_DIVERSITY_DEVELOPMENT && defined(GP_DIVERSITY_LOG) + +# include "gpHal_HW_MSI.h" + +/** only defined for internal usage*/ +#define GP_HAL_IS_ONLY_PROP_IN_REG(prop) (prop##_MASK == prop##_REG_BITS_IN_USE) +#define GP_HAL_CHECK_ONLY_PROP_IN_REG(prop) COMPILE_TIME_ASSERT(GP_HAL_IS_ONLY_PROP_IN_REG(prop)) +#define GP_HAL_CHECK_PROP_MATCHES_REG(prop,reg) COMPILE_TIME_ASSERT(prop##_REGISTER == reg) +#define GP_HAL_PROPOFFSET2REG(Offset, Property) (((UInt16) (Offset)) + Property##_REGISTER) +#define GP_HAL_CHECK_ONLY_PROPS_IN_REG(prop1, prop2) \ + do { \ + COMPILE_TIME_ASSERT(prop1##_REGISTER == prop2##_REGISTER); \ + COMPILE_TIME_ASSERT((prop1##_MASK | prop2##_MASK) == prop1##_REG_BITS_IN_USE); \ + } while (0) + +//actual check should be: if arrays on stack with run-time size is allowed +#ifdef __GNUC__ +//compile time assert on non-const will succeed, we can use it always +/**part of implementation, don't use*/ +#define GP_ASSERT_EARLY(cond) \ + do { \ + COMPILE_TIME_ASSERT(cond); \ + GP_ASSERT_DEV_INT(cond); \ + } while (false) +#else +//compile time assert on non-const will give syntax error, don't use +/**part of implementation, don't use*/ +#define GP_ASSERT_EARLY(cond) GP_ASSERT_DEV_INT(cond) +#endif +/** part of implementation, don't use */ +#define GP_HAL_VAL2PLACEDVAL(Value, Property) (((UInt8) (Value)) << Property##_LSB) +/** part of implementation, don't use! Use GP_HAL_WRITE_PROPTO */ +#define GP_HAL_BASE_WRITE_PROPTO(Byte, Property, Value) \ + do { \ + COMPILE_TIME_ASSERT(Property##_WRITABLE==1); \ + /* check if the value fits in the property*/ \ + GP_ASSERT_EARLY(((Value) & (Property##_MASK >> Property##_LSB)) == (Value)); \ + /* the if clause produces better code than the else on the xap, */ \ + /* even for mask 0xFF: no (value and 0xFF)*/ \ + if (GP_HAL_IS_ONLY_PROP_IN_REG(Property)) \ + { \ + (Byte) = GP_HAL_VAL2PLACEDVAL(Value, Property); \ + } \ + else \ + { \ + (Byte) = ((Byte) & ~(Property##_MASK)) \ + | (GP_HAL_VAL2PLACEDVAL(Value, Property) & (Property##_MASK)); \ + } \ + } while (0) + +/** @brief A macro to modify a property in a cached version of a GP chip register. + * + * A macro to modify a property in a cached version of a GP chip register. + * This cached memory has to written to the real register to have any effect. + * Use this to change several properties in the same register in an efficient manner. + * + * @param Byte the cached version register in memory. + * @param Property Property name (only use with regprop definition). + * @param Value Value to be set. + * @param Reg The GP chip register name that the Byte parameter represents. + */ +#define GP_HAL_WRITE_PROPTO(Byte, Reg, Property, Value) \ + do { \ + GP_HAL_CHECK_PROP_MATCHES_REG(Property, Reg); \ + GP_HAL_BASE_WRITE_PROPTO(Byte, Property, Value); \ + } while (0) + +/** internal usage, main code in auxiliary macro to make property substitution work as intended */ +#define GP_HAL_WRITE_PROP_OFFSET_AUX(Offset, Property, Value) \ + do { \ + COMPILE_TIME_ASSERT(Property##_WRITABLE==1); \ + /* check if the value fits in the property*/ \ + GP_ASSERT_EARLY(((Value) & (Property##_MASK >> Property##_LSB)) == (Value)); \ + if (Property##_READABLE && !(GP_HAL_IS_ONLY_PROP_IN_REG(Property))) \ + { \ + GP_HAL_READMODIFYWRITE_REG( ((UInt16) (Offset)) + Property##_REGISTER, Property##_MASK, GP_HAL_VAL2PLACEDVAL(Value, Property) );\ + } \ + else \ + { /* not readable/write to whole register*/ \ + GP_HAL_WRITE_REG( ((UInt16) (Offset)) + Property##_REGISTER, GP_HAL_VAL2PLACEDVAL(Value, Property)); \ + } \ + } while (0) + +/** @brief A macro to write a specific field (=property) in a register, + * for a property that is offset based. + * + * A macro to write a specific field (= property) in a register, + * for a property that is offset based. + * Register definitions are needed to preprocess these instructions. + * The register must be relative to a base address: for use with PBM, ES and other repeating structures. + * + * @param Offset Base address of the entry to which the property applies. + * @param Property Property name (only use with regprop definition). + * @param Value Value to be set. +*/ +#define GP_HAL_WRITE_PROP_OFFSET(Offset, Property, Value) GP_HAL_WRITE_PROP_OFFSET_AUX(Offset, Property, Value) + +/** @brief A macro to write a specific field (= property) in a register . + * + * A macro to write a specific field (= property) in a register. Register definitions are needed to preprocess these instructions . + * + * @param Property Property name (only use with regprop definition). + * @param Value Value to be set. +*/ +#define GP_HAL_WRITE_PROP(Property, Value) GP_HAL_WRITE_PROP_OFFSET(0, Property, Value) + + +/** internal*/ +#define GP_HAL_UNSAFE_WRITE_PROP(Property, Value) GP_HAL_WRITE_PROP_OFFSET_AUX(0, Property, Value) + +/* use this to force low-level signals */ +#define GP_HAL_TDC_ENABLE(Property, Value) \ + do \ + { \ + GP_HAL_WRITE_PROP(Property, Value); \ + GP_HAL_UNSAFE_WRITE_PROP(Property##_TDC_ENABLE, true); \ + } while (false) + + +/** part of implementation, don't use */ +#define GP_HAL_PLACEDVAL2VAL(Byte, Prop) \ + ( GP_HAL_IS_ONLY_PROP_IN_REG(Prop) \ + ? (((UInt8) (Byte)) >> Prop##_LSB) \ + : ((((UInt8) (Byte)) & Prop##_MASK) >> Prop##_LSB) \ + ) + +#define GP_HAL_BASE_READ_PROPFROM(Byte, Property) \ + ( COMPILE_TIME_ASSERT(Property##_READABLE), \ + (UInt8) GP_HAL_PLACEDVAL2VAL(Byte, Property) \ + ) + +/** @brief Read a property from a byte buffer. + * A macro to read a specific bit field (=property) of a byte buffer. + * + * @param Byte The byte buffer. + * @param Reg The register of the property to access. This parameter is used in order to check + * the consistency between the byte buffer and the accessed property. + * @param Property Property name (only use with regprop definition). +*/ +#define GP_HAL_READ_PROPFROM(Byte, Reg, Property) \ + ( GP_HAL_CHECK_PROP_MATCHES_REG(Property, Reg), \ + GP_HAL_BASE_READ_PROPFROM(Byte, Property) \ + ) + + +/** main code in auxiliary macro to make property substitution work as intended */ +#define GP_HAL_READ_PROP_OFFSET_AUX(Offset, Property) \ + GP_HAL_BASE_READ_PROPFROM(GP_HAL_READ_REG(((UInt16) (Offset)) + Property##_REGISTER), Property) + +/** @brief A macro to read a specific field (= property) of a register, + * for a property that is offset based + * + * A macro to read a specific field (= property) of a register, + * for a property that is offset based. + * Register definitions are needed to preprocess these instructions. + * + * @param Offset Base address of the entry to which the property applies. + * @param Property Property name (only use with regprop definition). +*/ +#define GP_HAL_READ_PROP_OFFSET(Offset, Property) GP_HAL_READ_PROP_OFFSET_AUX(Offset, Property) + +/** @brief A macro to read a specific field (= property) of a register. + * + * A macro to read a specific field (= property) of a register. Register definitions are needed to preprocess these instructions. + * + * @param Property Property name (only use with regprop definition). +*/ +#define GP_HAL_READ_PROP(Property) GP_HAL_READ_PROP_OFFSET(0, Property) + + +/** @brief A macro to modify some bits of a specific field (= property) in a register . + * + * A macro to modify some bits in a specific field (= property) in a register. Register definitions are needed to preprocess these instructions . + * + * @param Prop Property name (only use with regprop definition). + * @param Mask The read-modify-write mask. + * @param Data The Value to write. +*/ +#define GP_HAL_READMODIFYWRITE_PROP(Prop, Mask, Data) do \ +{ \ + UInt8 newData = (GP_HAL_READ_PROP(Prop) & ~(Mask)) | ((Data) & (Mask)); \ + GP_HAL_WRITE_PROP(Prop, newData); \ +} while (false) + +/* These macros read or write 2,4 or 8 bytes. (no endiannness conversion) + * if a particular implementation has efficient methods to access two/four/eight bytes, it can provide it's own implementations. + * (macro or inline). It should however set the various HAVE_ macros. + * for ease of use we define here default implementations. + */ +#ifndef GP_HAL_HAVE_READ_TWO_BYTES +#define GP_HAL_READ_TWO_BYTES(Address, pBuffer) GP_HAL_READ_BYTE_STREAM(Address, pBuffer, 2) +#endif +#ifndef GP_HAL_HAVE_READ_FOUR_BYTES +#define GP_HAL_READ_FOUR_BYTES(Address, pBuffer) GP_HAL_READ_BYTE_STREAM(Address, pBuffer, 4) +#endif +#ifndef GP_HAL_HAVE_READ_EIGHT_BYTES +#define GP_HAL_READ_EIGHT_BYTES(Address, pBuffer) GP_HAL_READ_BYTE_STREAM(Address, pBuffer, 8) +#endif +#ifndef GP_HAL_HAVE_WRITE_TWO_BYTES +#define GP_HAL_WRITE_TWO_BYTES(Address, pBuffer) GP_HAL_WRITE_BYTE_STREAM(Address, pBuffer, 2) +#endif +#define GP_HAL_WRITE_THREE_BYTES(Address, pBuffer) GP_HAL_WRITE_BYTE_STREAM(Address, pBuffer, 3) +#ifndef GP_HAL_HAVE_WRITE_FOUR_BYTES +#define GP_HAL_WRITE_FOUR_BYTES(Address, pBuffer) GP_HAL_WRITE_BYTE_STREAM(Address, pBuffer, 4) +#endif +#ifndef GP_HAL_HAVE_WRITE_EIGHT_BYTES +#define GP_HAL_WRITE_EIGHT_BYTES(Address, pBuffer) GP_HAL_WRITE_BYTE_STREAM(Address, pBuffer, 8) +#endif + +/** @brief A macro to read a 16 bit value. + * + * A macro to read a 16 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to read + * @param pBuffer The buffer where the data is returned. +*/ +#define GP_HAL_READ_REGS16(Address, pBuffer) do { GP_HAL_READ_TWO_BYTES(Address, pBuffer); RF_TO_HOST_UINT16(pBuffer); } while(false) + +/** @brief A macro to read a 32 bit value. + * + * A macro to read a 32 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to read + * @param pBuffer The buffer where the data is returned. +*/ +#define GP_HAL_READ_REGS32(Address, pBuffer) do { GP_HAL_READ_FOUR_BYTES(Address, pBuffer); RF_TO_HOST_UINT32(pBuffer); } while(false) + +/** @brief A macro to read a 64 bit value. + * + * A macro to read a 64 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to read + * @param pBuffer The buffer where the data is returned. +*/ +#define GP_HAL_READ_REGS64(Address, pBuffer) do { GP_HAL_READ_EIGHT_BYTES(Address, pBuffer); RF_TO_HOST_UINT64(pBuffer); } while(false) + +/** @brief A macro to write a 16 bit value. + * + * A macro to write a 16 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to write + * @param pBuffer The buffer where the data to write is read from. +*/ +#define GP_HAL_WRITE_REGS16(Address,pBuffer) do { HOST_TO_RF_UINT16(pBuffer); GP_HAL_WRITE_TWO_BYTES(Address, pBuffer); RF_TO_HOST_UINT16(pBuffer); } while(false) + +/** @brief A macro to write a 24 bit value. + * + * A macro to write a 24 bit value. The macro takes care of the endianness of the host processor. The argument should be a 32-bit value. + * + * @param Address The address of the value to write + * @param pBuffer The buffer where the data to write is read from. +*/ +#define GP_HAL_WRITE_REGS24(Address,pBuffer) do { HOST_TO_RF_UINT32(pBuffer); GP_HAL_WRITE_THREE_BYTES(Address, pBuffer); RF_TO_HOST_UINT32(pBuffer); } while(false) + +/** @brief A macro to write a 32 bit value. + * + * A macro to write a 32 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to write + * @param pBuffer The buffer where the data to write is read from. +*/ +#define GP_HAL_WRITE_REGS32(Address,pBuffer) do { HOST_TO_RF_UINT32(pBuffer); GP_HAL_WRITE_FOUR_BYTES(Address, pBuffer); RF_TO_HOST_UINT32(pBuffer); } while(false) + +/** @brief A macro to write a 64 bit value. + * + * A macro to write a 64 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to write + * @param pBuffer The buffer where the data to write is read from. +*/ +#define GP_HAL_WRITE_REGS64(Address,pBuffer) do { HOST_TO_RF_UINT64(pBuffer); GP_HAL_WRITE_EIGHT_BYTES(Address, pBuffer); RF_TO_HOST_UINT64(pBuffer); } while(false) + +//------------------------------------------------------------------------------ +// INTERRUPT CONTROL COMMANDS +//------------------------------------------------------------------------------ + +//Turn off/on all interrupt sources of the micro processor +/** @brief Enable the interrupts on the micro processor*/ +#define ENABLE_GP_GLOBAL_INT() HAL_ENABLE_GLOBAL_INT() +/** @brief Disables the interrupts on the micro processor */ +#define DISABLE_GP_GLOBAL_INT() HAL_DISABLE_GLOBAL_INT() + +#endif //_HAL_GP_HW_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW_MSI.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW_MSI.h new file mode 100644 index 0000000..91e1196 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW_MSI.h @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2009-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpHal_HW_MSI.h + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPHAL_HW_MSI_H_ +#define _GPHAL_HW_MSI_H_ + +/** + * @file gpHal_HW_MSI.h + * @brief This file contains the functions dependent on the choice of MCU : MSI, Interrupts,... + * This particular file does it using the MSI protcol + our own hal functionality + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "gpBsp.h" //uC MSI (SPI/I2C) functions +#include "hal.h" //uC INT functions + +//this header implements GP_HAL_READ_REG, GP_HAL_WRITE_REG etc. +#include "gpHal_MSI.h" +//Get chip specific MSI definitions +#include "gpHal_reg.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ +//------------------------------------------------------------------------------ + +//Initialize MSI and wakeup,interrupt and reset pins +/** @brief Micro processor dependent macro to initialize communication interface and reset,interrupt and wakeup pins. */ +#define HAL_GP_HW_INIT() { HAL_WKUP_START(); HAL_SET_RESET_INACTIVE(); GP_MSI_INIT(); CONFIG_INTERRUPT_LINE(); } + +//------------------------------------------------------------------------------ +// INTERRUPT CONTROL COMMANDS +//------------------------------------------------------------------------------ + +#ifndef HAL_ISR_RADIO_INTERRUPT_START +#define HAL_ISR_RADIO_INTERRUPT_START(x) // not implemented yet for all ucHal variants +#endif + +//Register interrupt GP +/** @brief Intializes the interrupt line at micro processor side. + * + * This macro configures the pin on which the GP chip INTOUTn pin is connected as an input pin and configures the interrupt + * attached to this pin as a low level interrupt. +*/ +#define HAL_GP_INTERRUPT_INIT() \ + do { \ + HAL_ISR_RADIO_INTERRUPT_START( gpHal_ISR_Interrupt ); \ + HAL_RADIO_INTERRUPT_START( gpHal_Interrupt ); \ + } while(0) +//------------------------------------------------------------------------------ +// I/O CONTROL COMMANDS +//------------------------------------------------------------------------------ + +/** @brief Puts a high signal on the WKUP pin of the GP chip. + * + * Wakeup of the GP chip is done on a falling edge of the WKUP pin. +*/ +#define HAL_GP_SET_WAKEUP() HAL_SET_WKUP_ACTIVE() +/** @brief Puts a low signal on the WKUP pin of the GP chip. + * + * Wakeup of the GP chip is done on a falling edge of the WKUP pin. +*/ +#define HAL_GP_CLR_WAKEUP() HAL_SET_WKUP_INACTIVE() + + +#define HAL_GP_PULSE_WAKEUP() \ +do{ \ + HAL_GP_SET_WAKEUP();\ + HAL_GP_CLR_WAKEUP();\ +}while(false); + +/** @brief Sets the reset of the GP chip active. + * + * This macro sets and holds the GP chip in a reset state. + */ +#define HAL_GP_SET_RESET(level) HAL_SET_RESET_ACTIVE(level) +/** @brief Puts the reset of the GP chip inactive + * + * This macro releases the reset of the GP chip. +*/ +#define HAL_GP_CLR_RESET() HAL_SET_RESET_INACTIVE() + +#endif /* _GPHAL_HW_MSI_H_ */ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC.h new file mode 100644 index 0000000..c06d020 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC.h @@ -0,0 +1,722 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + + +#ifndef _GPHAL_MAC_H_ +#define _GPHAL_MAC_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_RomCode_MAC.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/** @file gpHal_MAC.h + * @brief This file contains all the functions needed for MAC functionality. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpHal_reg.h" +#include "gpHal_HW.h" +#include "gpHal_Phy.h" +#include "gpPd.h" +#include "gpPad.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/** @brief Default value of the time to live setting of a PBM entry. */ +#define GPHAL_TTL_START_VALUE 20 + +/** @brief Maximum amount of channels used to do multi channel retries */ +#define GP_HAL_MULTICHANNEL_MAX_CHANNELS 3 + +/** @brief Maximum number of slots (simultaneously active RX channels) */ +#define GP_HAL_MAX_NUM_OF_SLOTS 6 + +/** @brief Define to ignore channel used in the multiChannel options struct */ +#define GP_HAL_MULTICHANNEL_INVALID_CHANNEL 0xFF + +/** @brief Offset in IEEE packet to check if Ack Request is required */ +#define GPHAL_ACK_REQ_LSB 5 + +// the result from formula 14 from the IEEE-802.15.4 spec is 31776 us ==> 0x7C2 symbols +#define GPHAL_POLL_REQ_MAX_WAIT_TIME 0x7C2 + +#define GPHAL_MAX_15_4_FCS_LENGTH 2 + +#define GPHAL_MAX_15_4_PACKET_LENGTH 127UL + +/** @brief Maximum length of a payload that can be written into a PBM entry. */ +#define GPHAL_MAX_15_4_PACKET_LENGTH_NO_FCS (GPHAL_MAX_15_4_PACKET_LENGTH - GPHAL_MAX_15_4_FCS_LENGTH) + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ +//------------------------------------------------------------------------------ +// ENUMERATIONS +//------------------------------------------------------------------------------ + + + +//@{ +/** @name gpHal_MacScenario_t */ +// MacScenarios +#define gpHal_MacDefault 0x0 +/** gpHal_MacSPollReq Mac Scenario to send a Poll Req*/ +#define gpHal_MacPollReq 0x1 +/** gpHal_MacTimedTx Put frame on timed TX queue; will be sent at next event gpHal_EventTypeTXPacket */ +#define gpHal_MacTimedTx 0x2 +/** gpHal_MacManualCrc Mac scenario to manually set a CRC checksum (a corrupt one if applicable for the test) */ +#define gpHal_MacManualCrc 0x3 +/** gpHal_MacManualCrc Mac scenario to manually set a CRC checksum (a corrupt one if applicable for the test), and force the retries tp 0 */ +#define gpHal_MacManualCrc_NoRetries 0x4 +/** @typedef gpHal_MacScenario_t + * @brief The gpHal_MacScenario_t type defines the Mac Scenario as defined in the databook. +*/ +typedef UInt8 gpHal_MacScenario_t; +//@} + + + + +/** @name gpHal_SourceIdentifier_t */ +//@{ +/** @brief Identifier for first Pan (pan 0) */ +#define gpHal_SourceIdentifier_0 0x0 +/** @brief Identifier for second Pan (pan 1) */ +#define gpHal_SourceIdentifier_1 0x1 +/** @brief Identifier for third Pan (pan 2) */ +#define gpHal_SourceIdentifier_2 0x2 +/** @brief Identifier for invalid value */ +#define gpHal_SourceIdentifier_Inv 0xFF +/** @typedef gpHal_SourceIdentifier_t + * @brief A source identifier refers to a group of settings (address, PAN, channel). + * + * The number of supported source identifiers depends on the device type and is specified as GP_HAL_NUMBER_OF_RX_SRCIDS. + */ +typedef UInt8 gpHal_SourceIdentifier_t; +//@} + +/** @brief This function sets the rx mode configuration for the MAC part of the radio. + * + * This function sets the rx mode configuration for the MAC part of the radio. + * + * @param enableMultiStandard Allows concurrent listening on ZigBee and BLE channels (not compatible with the other two options). + This option is also known as ConcurrentConnect™. Note that this is not available on some older products. + * + * @param enableMultiChannel Allows listening to multiple ZigBee channels simultaneously (not compatible with the other two options) + * + * @param enableHighSensitivity Allows for higher sensitivity ZigBee reception (not compatible with the other two options) + * + * @return gpHal_Result_t + * Possible results are : + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidParameter (invalid combination was selected) + */ +gpHal_Result_t gpHal_SetMacRxMode(Bool enableMultiStandard, Bool enableMultiChannel, Bool enableHighSensitivity); + +/** @brief This function gets the rx mode configuration for the MAC part of the radio. + * + * This function gets the rx mode configuration for the MAC part of the radio. + * + * @param enableMultiStandard Pointer to Bool indicating: concurrent listening on ZigBee and BLE channels (not compatible with the other two options) + * + * @param enableMultiChannel Pointer to Bool indicating: listening to multiple ZigBee channels simultaniously (not compatible with the other two options) + * + * @param enableHighSensitivity Pointer to Bool indicating: for higher sensitivity ZigBee reception (not compatible with the other two options) + * + * @return void + */ +void gpHal_GetMacRxMode(Bool* enableMultiStandard, Bool* enableMultiChannel, Bool* enableHighSensitivity); + +//@{ +/** @struct gpHal_DataReqOptions_t + * @param gpHal_MacScenario_t + * @brief These options dictate the way a data packet should be transmitted +*/ +typedef struct gpHal_DataReqOptions_s{ + gpHal_MacScenario_t macScenario; + gpHal_SourceIdentifier_t srcId; +}gpHal_DataReqOptions_t; +//@} + + + +/** @typedef gpHal_DataIndicationCallback_t + * @brief The gpHal_DataIndicationCallback_t callback type definition defines the callback prototype of the DataIndication.*/ +typedef void (*gpHal_DataIndicationCallback_t)(gpPd_Loh_t pdLoh, gpHal_RxInfo_t *rxInfo); + +/** @typedef gpHal_SnifferDataIndicationCallback_t + * @brief The gpHal_SnifferDataIndicationCallback_t callback type definition defines the callback prototype of the SnifferDataIndication.*/ +typedef void (*gpHal_SnifferDataIndicationCallback_t)(gpPd_Loh_t pdLoh, gpHal_RxInfo_t *rxInfo); + +/** @typedef gpHal_DataConfirmCallback_t + * @brief The gpHal_DataConfirmCallback_t callback type definition defines the callback prototype of the DataConfirm.*/ +typedef void (*gpHal_DataConfirmCallback_t)(UInt8 status, gpPd_Loh_t pdLoh, UInt8 lastChannelUsed); + +/** @typedef gpHal_EDConfirmCallback_t + * @brief The gpHal_EDConfirmCallback_t callback typedef defines the callback prototype of the EDConfirm. + * + * The parameter protoED isn't the real energy level. The real energy level needs to be calculated with the function gpHal_CalculateED(). + */ +typedef void (*gpHal_EDConfirmCallback_t)(UInt16 channelMask, UInt8 *protoED); + +/** @typedef gpHal_BusyTXCallback_t + * @brief The gpHal_BusyTXCallback_t callback type definition defines the callback prototype of the BusyTX interrupt. */ +typedef void (*gpHal_BusyTXCallback_t)(void); + +/** @typedef gpHal_EmptyQueueCallback_t + * @brief The gpHal_EmptyQueueCallback_t callback type definition defines the callback prototype of the EmptyQueue interrupt. */ +typedef void (*gpHal_EmptyQueueCallback_t)(void); + +/** @typedef gpHal_CmdDataReqCallback_t + * @brief The gpHal_CmdDataReqCallback_t callback type definition defines the callback prototype of the Cmd Data Req interrupt. */ +typedef void (*gpHal_CmdDataReqCallback_t)(void); + +typedef void (*gpHal_MacFrameQueued_t)(void); +typedef void (*gpHal_MacFrameUnqueued_t)(void); + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif +// see gpHal_DEFS.h +// MAC public functions + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs_MAC.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +//MAC-SEC interrupts +/** + * @brief Enables the interrupt line of the MAC and SEC operations. + * + * This function sets the interrupt mask of the PIO block. + * + * @param enable Enables the interrupt source if true. +*/ +#define gpHal_EnablePrimitiveCallbackInterrupt(enable) GP_HAL_ENABLE_PIO_INT(enable) +/** + * @brief Enables the interrupt line of the Empty Queue interrupt. + * + * This function sets the interrupt mask of the Empty Queue interrupt. + * + * @param enable Enables the interrupt source if true. +*/ +#define gpHal_EnableEmptyQueueCallbackInterrupt(enable) GP_HAL_ENABLE_EMPTY_QUEUE_CALLBACK_INTERRUPT(enable) + +/** + * @brief Enables the interrupt line of the BusyTX interrupt. + * + * This function sets the interrupt mask of the BusyTX interrupt. + * + * @param enable Enables the interrupt source if true. +*/ +#define gpHal_EnableBusyTXCallbackInterrupt(enable) GP_HAL_ENABLE_BUSY_TX_CALLBACK_INTERRUPT(enable) +/** + * @brief Registers the callback for a DataConfirm. + * + * This function registers the callback for a DataConfirm. The callback will be executed on a DataConfirm interrupt. + * This DataConfirm will be given after a DataRequest is finished. + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterDataConfirmCallback(gpHal_DataConfirmCallback_t callback); + +/** + * @brief Registers the callback for a DataIndication. + * + * This function registers the DataIndication callback. The callback will be executed on a DataIndication interrupt + * This DataIndication will be given if a packet is received. + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterDataIndicationCallback(gpHal_DataIndicationCallback_t callback); + + +/** + * @brief Registers the callback for a EDConfirm. + * + * This function registers the EDConfirm callback. The callback will be executed on a EDConfirm interrupt + * This EDConfirm will be given after a EDRequest is finished + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterEDConfirmCallback(gpHal_EDConfirmCallback_t callback); + +/** + * @brief Registers the callback for a BusyTX interrupt. + * + * This function registers the BusyTX callback. The callback will be executed on a BusyTX interrupt, i.e. + * is triggered when the MAC receives a TX trigger while he is already transmitting another packet. + * The BusyTX interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterBusyTXCallback(gpHal_BusyTXCallback_t callback); + +/** + * @brief Registers the callback for Empty Queue interrupt. + * + * This function registers the EmptyQueue callback. The callback will be executed on an Empty Queue interrupt, i.e. + * is triggered when a TX trigger is given to the MAC when no packet is pending in the TX queue. + * The Empty Queue interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterEmptyQueueCallback(gpHal_EmptyQueueCallback_t callback); + +/** + * @brief Registers the callback for the reception of a Cmd Data Req interrupt. + * + * This function registers the CmdDataReq callback. + * This function determines whether the Frame Pending bit in an Ack needs to be set. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterCmdDataReqConfirmCallback(gpHal_CmdDataReqCallback_t callback); + +/** @brief Start a data transmission. + * + * Performs a DataRequest(according to the IEEE802.15.4 specification). + * The DataConfirm function can be registered as a callback using gpHal_RegisterDataConfirmCallback(). + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy (no packet buffer available) + * - gpHal_ResultInvalidParameter + * + * @param dataReqOptions csma, multiChannelOptions, macScenario + * @param pdLoh The packet descriptor structure that contains length, offset and unique handle of the packet content. +*/ +GP_API gpHal_Result_t gpHal_DataRequest(gpHal_DataReqOptions_t *dataReqOptions, gpPad_Handle_t padHandle, gpPd_Loh_t pdLoh); + +/** @brief Returns the listening channel currently used + * + * @param srcId The source identifier. +*/ +GP_API UInt8 gpHal_GetRxChannel(gpHal_SourceIdentifier_t srcId); + +/** @brief This function returns the last 802.15.4 channel used to transmit on. + * + * This function returns the last 802.15.4 channel used to transmit on. + * + * @param PBMentry The last transmitted PBM + * @return channel The last 802.15.4 channel the radio transmitted on + * + */ +GP_API UInt8 gpHal_GetLastUsedChannel(UInt8 PBMentry); + + +/** @brief Configure the default transmit power for each channel + * + * @param pointer to 16 byte array with default transmit power for each IEEE channel (11..26). + * +*/ +GP_API void gpHal_SetDefaultTransmitPowers(gpHal_TxPower_t* pDefaultTransmitPowerTable ); + +/** @brief Get the current default transmit power for the specified channel. + */ +GP_API gpHal_TxPower_t gpHal_GetDefaultTransmitPower(gpHal_Channel_t channel); + +/** @brief Set the CCA Threshold setting */ + +GP_API void gpHal_SetCCAThreshold(void); + + + + + +/** @brief Writes data in the specified pbm address*/ +#define gpHal_WriteDataInPbm(address,pData,length,offset) GP_HAL_WRITE_DATA_IN_PBM(address,pData,length,offset) + +#define gpHal_CalculateTxPbmDataBufferAddress(pbmEntry) GP_HAL_CALCULATE_TX_PBM_DATA_BUFFER_ADDRESS(pbmEntry) + +#define gpHal_CheckPbmValid(pbmEntry) GP_HAL_CHECK_PBM_VALID(pbmEntry) + +/** @brief Sets the Rx packet in packet mode + * + * The function sets the Rx packet in packet mode on or off + * +*/ +#define gpHal_SetPipMode(pipmode) GP_HAL_SET_PIP_MODE(pipmode) + +/** @brief Returns the number packet in packet mode */ +#define gpHal_GetPipMode() GP_HAL_GET_PIP_MODE() + + +GP_API gpHal_Result_t gpHal_GetRadioState(void); + +// MAC ED Request +/** @brief Performs a Energy Detect request according to the IEEE802.15.4 spec + * + * This function triggers an energy detection. The energy value of this function is given in the + * EDConfirm callback (to be registered with gpHal_RegisterEDConfirmCallback). + * + * To stop an ongoing ED Request, call this function again with time_us 0 and channelMask 0x0000. + * The scan will be aborted and the confirm will be generated with the results up to that point. + * Note this stop request will not generate a confirm. + * + * Possible results are : + * - gpHal_ResultSuccess + * - gpHal_ResultBusy (no packet buffer available) + * + * @param time_us Time period to scan on each channel given in the channelMask (in us). + * @param channelMask Mask of channels to scan. LSB bit = channel 11, MSB bit = channel 26. +*/ +GP_API gpHal_Result_t gpHal_EDRequest(UInt32 time_us , UInt16 channelMask); + +/** @brief Set the PAN ID + * + * This function sets the PAN ID . + * Setting the PAN ID of your network enables the automatic filter of + * packets not intended for your device. + * + * @param panId The PAN ID of the network. + * @param srcId The PAN src, we want to change the ID from. +*/ +GP_API void gpHal_SetPanId(UInt16 panId, gpHal_SourceIdentifier_t srcId); + +/** @brief Returns the PAN ID stored + * + * @param srcId The src id of the Pan. + **/ +GP_API UInt16 gpHal_GetPanId(gpHal_SourceIdentifier_t srcId); + +/** @brief Sets the Short Address. + * + * This functions sets the Short Address. + * Setting the Short Address of your device enables the automatic filter of + * packets not intended for your device. + * + * @param shortAddress The Short Address of the device. + * @param srcId The src id of the pan where we want to change the short address. +*/ +GP_API void gpHal_SetShortAddress(UInt16 shortAddress, gpHal_SourceIdentifier_t srcId); + +/** @brief Returns the ShortAddress + * + * @param srcId The src id of the pan where we want to get the short address. + */ +GP_API UInt16 gpHal_GetShortAddress(gpHal_SourceIdentifier_t srcId); + +/** @brief Set the Extended Address + * + * This function sets the Extended Address. + * Setting the Extended Address of your device enables the automatic filter of + * packets not intended for your device. + * @param pExtendedAddress The pointer to the Extended Address of the device. + * @param srcId The src id of the extended address. +*/ +GP_API void gpHal_SetExtendedAddress(MACAddress_t* pExtendedAddress, gpHal_SourceIdentifier_t srcId); + +/** @brief Returns the ExtendedAddress stored + * + * This function returns the extended address stored. + * @param pExtendedAddress pointer where the Extended Address is read back to + * @param srcId The src id of the extended address. +*/ +GP_API void gpHal_GetExtendedAddress(MACAddress_t* pExtendedAddress, gpHal_SourceIdentifier_t srcId); + +/** @brief Resets the ExtendedAddress to its factory value + * + * This function resets the extended address to its initial factory value. + * @param srcId The src id of the extended address. +*/ +GP_API void gpHal_ResetExtendedAddress(gpHal_SourceIdentifier_t srcId); + +/** @brief Set the Coordinator Address + * + * Setting the Coordinator Address enables the filtering of + * packets not coming from the coordinator. + * @param Address The pointer to the Address of the coordinator. +*/ +GP_API void gpHal_SetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress); +GP_API void gpHal_SetCoordShortAddress(UInt16 shortCoordAddress); + + +/** @brief Set the pan coordinator property + * + * This function sets the pan coordinator property of the device. + * + * @param panCoordinator true if the device is the pan coordinator, false otherwise. +*/ +GP_API void gpHal_SetPanCoordinator(Bool panCoordinator); + +/** @brief Returns the pan coordinator property of this device */ +GP_API Bool gpHal_GetPanCoordinator(void); + +/** @brief Enables/Disables Address Recognition. + * + * This function sets the address recognition options. + * @param enable Possible values are : + * - set to true : destination address of a packet will checked against the address (set by gpHal_SetExtendedAddress and gpHal_SetShortAddress) and destination PAN ID of incoming packets. + * - set to false: address recognition disabled. + * @param panCoordinator Possible values are : + * - set to true : The device is a PAN coordinator. He will accept messages without a destination address. + * - set to false: Normal filtering will be applied according to recognition settings. +*/ +GP_API void gpHal_SetAddressRecognition(Bool enable, Bool panCoordinator); + +/** @brief Returns the addressRecognition flag. */ +#define gpHal_GetAddressRecognition() GP_HAL_GET_ADDRESS_RECOGNITION() + +/** @brief Sets the HW FrameType FilterMask. + * + * This function sets the Frame Type filter mask used by HW + * + * Packets can be filtered out based on their frametype (BCN, DATA, CMD, RSV). + * This can be controlled by setting the filter bitmap with this function. + * Setting a certain type's mask bit to 1 will filter out the packet with that type. + * + * @param bitmap The FrameType FilterMask. +*/ +#define gpHal_SetFrameTypeFilterMask(bitmap) GP_HAL_SET_FRAME_TYPE_FILTER_MASK((bitmap)) + +/** @brief Returns the HW FrameType FilterMask. + * + * This function returns the Frame Type filter mask set in HW. + * Frametypes which have their mask bit set will be filtered out. + * + * @return bitmap The FrameType FilterMask. +*/ +#define gpHal_GetFrameTypeFilterMask() GP_HAL_GET_FRAME_TYPE_FILTER_MASK() + +/** @brief Sets the property for filtering beacons based on src pan. + * + * This function sets the property for filtering beacons based on src pan. + * + * @param enable If we want to enable beacon filtering on src pan or not. +*/ +GP_API void gpHal_SetBeaconSrcPanChecking(Bool enable); + + +/** @brief Gets the property for filtering beacons based on src pan. + * + * This function gets the property for filtering beacons based on src pan. + * +*/ +GP_API Bool gpHal_GetBeaconSrcPanChecking(void); + +/** @brief Sets the RxOnWhenIdle flag. + * + * This function sets the RxOnWhenIdle flag. + * Turns on the receiver when the device is idle. Switching between + * TX and RX is done automatically. + * + * @param srcId Source identifier. + * @param flag Possible values are : + * - set to true : RxOnWhenIdle is activated and the radio is turned on. + * - set to false: RxOnWhenIdle is deactivated. + * @param channel channel to enable radio on +*/ +GP_API void gpHal_SetRxOnWhenIdle(gpHal_SourceIdentifier_t srcId, Bool flag, UInt8 channel); +/** @brief Returns the RxOnWhenIdle flag. */ +#define gpHal_GetRxOnWhenIdle() GP_HAL_GET_RX_ON_WHEN_IDLE() + +/** @brief Sets the Auto Acknowledge flag. + * + * This function sets the Auto Acknowledge flag. + * All packets addressed to the device (see address recognition) will be automatically acknowledge + * (if requested by the MAC headerof the packet). + * @param flag + * - Set to true : Automatic acknowledgement enabled. + * - Set to false: Automatic acknowledgement disabled. +*/ +GP_API void gpHal_SetAutoAcknowledge(Bool flag); +/** @brief Returns the AutoAcknowledge flag. */ +GP_API Bool gpHal_GetAutoAcknowledge(void); + +extern UInt8 gpHal_MacState; + +/** @brief Sets the chip to timed MAC mode + * + * This function sets the chip to timed MAC mode. + * When a timed MAC is used all transmission is done using scheduled triggers from the Event Scheduler (ES). + * This function may only be called once after the initialization of the stack. + */ +GP_API void gpHal_SetTimedMode(Bool timedMode); + +/** @brief Calculate the protoRSSI from the protoED returned by the data indication handler. + * + * This function calculates the protoRSSI from the protoED value returned by the data indication handler. + * @param protoRSSI Value returned by data indication handler. +*/ +GP_API UInt8 gpHal_ConvertProtoEDToProtoRSSI( UInt8 protoED ); + +/** @brief Calculate the ED value from the protoED returned by the ED scan handler, values are conform the ZIP phy testspec. + * + * This function calculates the ED value from the protoED returned by the ED scan handler. The lowest value is 0, which is at -75dBm, the highest value is 0xFF, which is at -35dBm. + * @param protoED Value returned by ED scan handler. +*/ +GP_API UInt8 gpHal_CalculateED(UInt8 protoED); + +/** @brief Checks if a NO LOCK was triggerd by the radio. + * + * This function reports if a lock loss was detected by the radio. + * @return Result of the check. +*/ +GP_API Bool gpHal_CheckNoLock(void); + +/** @brief Enables the promiscuous mode. + * + * In promiscuous mode, all packets will be received. In order to enable the receiver the + * RxOnWhenIdle flag must be set. + * + * @param flag Possible values are : + * - set to true : Promiscuous mode is enabled and the filters disabled. + * - set to false: Normal filtering is applied on incoming packets. +*/ +GP_API void gpHal_SetPromiscuousMode(Bool flag); + +/** @brief Returns promiscuous mode state. +*/ +GP_API Bool gpHal_GetPromiscuousMode(void); + + +/** @brief Set the default ack frame pending bit. */ +#define gpHal_SetFramePendingAckDefault(enable) GP_HAL_WRITE_PROP(GPHAL_PROP_RIB_FP_ACK_DEFAULT_VALUE , enable ); + +/** @brief Returns the default ack frame pending bit. */ +#define gpHal_GetFramePendingAckDefault() GP_HAL_GET_ACK_DATA_PENDING() + + +/** @brief Get the last used chip transmit power +*/ +GP_API gpHal_TxPower_t gpHal_GetLastUsedTxPower(void); + +/** @brief Reset the history of the Tx power compensation. +*/ + + + +/** @brief This function gets the number of channels which can be used by different Zigbee/MAC stacks simultaniously. + * + * This function gets the number of channels on which different Zigbee/MAC stacks can listen simultaniously + * + * @return UInt8 The number of indexes on which a seperate rx channel can be configured. + * + */ +UInt8 gpHal_GetAvailableSrcIds(void); + +#if defined(GP_DIVERSITY_OOB) +/** @brief This function set channel frequency for OOB. + * + * This function set channel frequency, it is for supporting OOB + * + * @param frequency channel frequency (in mHz) + * + */ +GP_API void gpHal_SetChannelFrequency_OOB(UInt16 frequency); + +/** @brief This function cancel channel frequency for OOB. + * + * This function cancel the channel frequency to be used for OOB + * + */ +GP_API void gpHal_CancelChannelFrequency_OOB(void); + +/** @brief This function cancel channel frequency for OOB. + * + * This function restore the channel frequency to be used for OOB + * + */ +GP_API void gpHal_RestoreChannelFrequency_OOB(void); +#endif //GP_DIVERSITY_OOB + + +#if defined(GP_DIVERSITY_JUMPTABLES) +GP_API Int8 gpHalPhy_GetMinTransmitPower(void); +GP_API Int8 gpHalPhy_GetMaxTransmitPower(void); +#endif //defined(GP_DIVERSITY_JUMPTABLES) + +void gpHal_MacSetMaxTransferTime(UInt32 MacMaxTransferTime); + + +/** @brief This function enables the Enhanced FramePending behavior. + * + * This function enables the Enhanced FramePending behavior + * + * @param srcId The source identifier for which the Enhanced FramePending behavior needs to be configured. + * @param enable Enable or disable the Enhanced FramePending behavior + * + */ +GP_API void gpHal_MacEnableEnhancedFramePending(gpHal_SourceIdentifier_t srcId, Bool enable); + +/** @brief This function configures the insertion of a VS IE header in the Enh Ack frames containing probing data. + * + * This function configures the insertion of a VS IE header in the Enh Ack frames containing probing data. + * + * @param vsIeLen The length of the VS IE, including IE header which needs to be added to the EnhAck frame. + * @param pVsIeData A Pointer to the VS IE data, including IE header which needs to be added to the EnhAck frame. + * + */ +GP_API void gpHal_SetEnhAckVSIE(UInt8 vsIeLen, UInt8* pVsIeData); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif /* _GPHAL_MAC_H_ */ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC_Ext.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC_Ext.h new file mode 100644 index 0000000..52994fc --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC_Ext.h @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2012-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * gpHal_MAC_Ext.h + * This file contains all the functions needed for Extra MAC functionality. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + + +#ifndef _GPHAL_MAC_EXT_H_ +#define _GPHAL_MAC_EXT_H_ + +/** @file gpHal_MAC_Ext.h + * @brief This file contains all the extra functionality for MAC. +*/ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpHal_MAC.h" +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief Purges packet from TX queue. + * + * This function purges a packet currently in the TX queue using the pd handle of the packet. + * When the handle is non-existent or the packet is already transmitted an error is returned. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidRequest (Invalid pd handle given) + * - gpHal_ResultBusy (Packet already sent) + * + * @param pdHandle Unique pd handle given to packet at request time. +*/ +gpHal_Result_t gpHal_PurgeRequest(gpPd_Handle_t pdHandle); + +#ifdef GP_HAL_DIVERSITY_MACFILT_PATTERN_MATCH +/** + * @brief Hook to the application that determines if the data contained in the + * Pd is "custom data" or regular data + * + * @param pdLoh Contains info to retrieve the Tx data from the gpPd module + * @return gpHal_ResultSuccess on custom data + * gpHal_ResultInvalidRequest on regular data + * + * @details Using the gpPd API one can verify the contents of the Tx data + * e.g. gpPd_ReadByte() or gpPd_ReadByteStream() + */ +GP_API gpHal_Result_t gpHal_cbIsCustomData(gpPd_Loh_t pdLoh); + +/** + * @brief Registers the callback for a CUSTOM data confirm. + * + * This function registers the callback for a CustomDataConfirm. The callback will be executed on a DataConfirm interrupt, if the data is transmitted from the custom stack. + * This DataConfirm will be given after a DataRequest is finished. + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterCustomDataConfirmCallback(gpHal_DataConfirmCallback_t callback); + +/** + * @brief Registers the callback for CUSTOM data indication. + * + * This function registers the CustomDataIndication callback. The callback will be executed on a DataIndication interrupt, when pattern matches for custom data + * This DataIndication will be given if a packet is received. + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterCustomDataIndicationCallback(gpHal_DataIndicationCallback_t callback); + +/** + * @brief Start matching all incoming radio packets to the supplied pattern. + * In case the pattern matches the first 2 bytes of the received data, + * it will bypass the MAC handling completely and offer the callback + * registered by gpHal_RegisterCustomDataIndicationCallback(). + */ +GP_API void gpHal_EnableCustomMac(UInt8 pattern[2]); + +/** + * @brief Stop pattern matching for custom MAC implementations + */ +GP_API void gpHal_DisableCustomMac(); +#endif /* GP_HAL_DIVERSITY_MACFILT_PATTERN_MATCH */ + +#ifdef __cplusplus +} +#endif +#endif /* _GPHAL_MAC_EXT_H_ */ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MISC.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MISC.h new file mode 100644 index 0000000..97333fe --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MISC.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpHal_MISC.h + * + * This file contains miscellaneous functions for GPIO and OTP functionality + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_MISC_H_ +#define _HAL_GP_MISC_H_ + +/** @file gpHal_MISC.h + * @brief This file contains miscellaneous functions for GPIO and OTP functionality +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpHal_reg.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief Returns a 8-bit random value. + * + * This function returns a 8-bit random value using samples of the GP chip radio I and Q signals. + */ +GP_API UInt8 gpHal_GetRandomSeed(void); + + + +#ifdef GP_DIVERSITY_GPHAL_DCDC_ENABLED + + +#define gpHal_DCDC_ResultSuccess 0 +#define gpHal_DCDC_ResultTimeout 1 + + +typedef UInt8 gpHal_DCDC_Result_t; + +GP_API void gpHal_DCDCEnable(void); +GP_API Bool gpHalDCDC_IsActive(void); +#endif // GP_DIVERSITY_GPHAL_DCDC_ENABLED + +#ifdef __cplusplus +} +#endif +#endif //_HAL_GP_MISC_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MSI.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MSI.h new file mode 100644 index 0000000..314f2c6 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MSI.h @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2009-2010, 2012-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * gpHal_MSI.h + * + * This file contains the functions dependent on the choice of MCU : MSI, Interrupts,... + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPHAL_MSI_H_ +#define _GPHAL_MSI_H_ + +/** + * @file gpHal_MSI.h + * @brief This file declares functions to access the radio over the MSI protocol. + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" + +#include "gpBsp.h" //uC SPI functions +#include "hal.h" //uC INT functions + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt16 gpHal_Address_t; + +#define gphal_msi_resultSuccess 0 +#define gphal_msi_resultFailure 1 +typedef UInt8 gphal_msi_result_t; + + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +extern gphal_msi_result_t gpHal_msi_lastMsiResult; + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ +//------------------------------------------------------------------------------ + + +//GP Register Access +GP_API UInt8 readRegExternal (gpHal_Address_t Address); +GP_API void readByteStreamExternal (gpHal_Address_t Address, UInt8* pBuffer, UInt8 Length); +GP_API void writeRegExternal (gpHal_Address_t Address, UInt8 Data); +GP_API void writeByteStreamExternal (gpHal_Address_t Address, const UInt8* pBuffer, UInt8 Length); +GP_API void readModifyWriteRegExternal(gpHal_Address_t Address, UInt8 Mask, UInt8 Data); + +/** @brief Read register access macro. + * + * This is the raw macro for reading registers. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Address The address of the register. +*/ +#define GP_HAL_READ_REG(Address) readRegExternal(Address) +/** @brief Write register access macro. + * + * This is the raw macro for writing registers. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Address The address of the register. + * @param Data The data to write. +*/ +#define GP_HAL_WRITE_REG(Address,Data) writeRegExternal(Address, Data) +/** @brief Read byte stream access macro. + * + * This is the raw macro for reading bytes from consecutive registers. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Address The address of the first register to access. + * @param pBuffer The pointer to the buffer that receives the read data. + * @param Length The number of bytes to read. +*/ +#define GP_HAL_READ_BYTE_STREAM(Address, pBuffer, Length) readByteStreamExternal(Address, (UInt8*)pBuffer, Length) +/** @brief Write byte stream access macro. + * + * This is the raw macro for writing bytes to consecutive registers. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Address The address of the first register to access. + * @param pBuffer The pointer to the buffer that contains the data to write. + * @param Length The number of bytes to write. +*/ +#define GP_HAL_WRITE_BYTE_STREAM(Address,pBuffer, Length) writeByteStreamExternal(Address, (const UInt8*)pBuffer, Length) + +/** @brief Read-moify-write access macro. + * + * This is the raw macro for changing register bits with a read-modify-write action. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Register The address of the register. + * @param Mask The read-modify-write mask. + * @param Data The value to write. +*/ +#define GP_HAL_READMODIFYWRITE_REG(Address, Mask, Data) readModifyWriteRegExternal(Address, Mask, Data) + + +#endif /* _GPHAL_MSI_H_ */ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Phy.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Phy.h new file mode 100644 index 0000000..0a5d7b6 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Phy.h @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + + +#ifndef _GPHAL_PHY_H_ +#define _GPHAL_PHY_H_ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +/** @brief Default Tx Antenna selection + * + * This macros selects the antenna configuration. By default (macro GP_HAL_DIVERSITY_SINGLE_ANTENNA + * not defined), both antennas are used with antenna diversity. + * When the macro GP_HAL_DIVERSITY_SINGLE_ANTENNA is defined + * through the command line option of the compiler, the single antenna is selected. +*/ +#if defined(GP_HAL_DIVERSITY_SINGLE_ANTENNA) +#define GP_HAL_TX_ANTENNA GP_HAL_DIVERSITY_SINGLE_ANTENNA +#else +#define GP_HAL_TX_ANTENNA 0 +#endif +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +//Antenna selection options +/** @name gpHal_AntennaSelection_t */ +//@{ +/** @brief Force antenna 0 (termed RF Port 1 or Ant1 in datasheet) to be used*/ +#define gpHal_AntennaSelection_Ant0 0x0 +/** @brief Force antenna 1 (termed RF Port 2 or Ant2 in datasheet) to be used*/ +#define gpHal_AntennaSelection_Ant1 0x1 +/** @brief Automatic antenna seletion based on BBP-RX for RX and on MAC settings for TX */ +#define gpHal_AntennaSelection_Auto 0x2 +/** @brief Not possible to dedect which antenna is selected (error condition) */ +#define gpHal_AntennaSelection_Unknown 0x3 +/** @typedef gpHal_AntennaSelection_t + * @brief The gpHal_AntennaSelection_t type defines the antenna selection mode. +*/ +typedef UInt8 gpHal_AntennaSelection_t; +//@} + +/** @name gpHal_FirFilter_t */ +//@{ +/** @brief None means: no filtering, i.e. FIR is a dirac impulse. */ +#define gpHal_FirFilter_None 0x00 +/** @brief applies FIR 25 filter values. */ +#define gpHal_FirFilter_FIR25 0x01 +/** @typedef gpHal_FirFilter_t + * @brief The gpHal_FirFilter_t type defines the FIR filter type that will be used by the radio. + */ +typedef UInt8 gpHal_FirFilter_t; +//@} + +/** @name gpHal_ContinuousWaveMode_t */ +//@{ +/** @brief Unmodulated Continuous Wave Mode */ +#define gpHal_CW_Unmodulated 'U' /*0x55*/ +/** @brief Unmodulated (ble channelindex + unmodulated ) */ +#define gpHal_CW_Ble_UnModulated 'D' /*0x44*/ +/** @brief Modulated Continuous Wave Mode */ +#define gpHal_CW_Modulated 'M' /*0x4D*/ +/** @brief Modulated BLE (ble channelindex + blemode) */ +#define gpHal_CW_Ble_Modulated 'B' /*0x42*/ +/** @brief High Data Rate Modulated BLE (ble channelindex + blemode) */ +#define gpHal_CW_Ble_HDRModulated 'H' /*0x48*/ +/** @brief Continuous Wave Mode is off */ +#define gpHal_CW_Off 'O' /*0x4F*/ +/** @typedef gpHal_ContinuousWaveMode_t + * @brief The gpHal_ContinuousWaveMode_t type defines the different continuous wave modes. +*/ +typedef UInt8 gpHal_ContinuousWaveMode_t; +//@} + +/** @name gpHal_TxPower_t*/ +//@{ +/** @brief Default transmit power configured by gpHal_SetDefaultTransmitPowers. */ +#define gpHal_MinTransmitPower 0x7d +#define gpHal_MaxTransmitPower 0x7e +#define gpHal_DefaultTransmitPower 0x7f +/** @typedef gpHal_TxPower_t + * @brief The gpHal_TxPower_t type defines the transmit power in dBm or the default, min or max define. +*/ +typedef Int8 gpHal_TxPower_t; + + +/** @name gpHal_CCAMode_t*/ +//@{ +/** @brief CCA based on Energy Detect will be performed. */ +#define gpHal_CCAModeEnergy 0x1 +/** @brief CCA based on detection of modulated carrier will be performed. */ +#define gpHal_CCAModeModulatedCarrier 0x2 +/** @brief CCA based on an AND of Energy and Modulated Carrier Detect will be performed. */ +#define gpHal_CCAModeEnergyAndModulated 0x3 +/** @typedef gpHal_CCAMode_t + * @brief The gpHal_CCAMode_t type defines the CCA measurement method. +*/ +typedef UInt8 gpHal_CCAMode_t; +//@} + +/** @name gpHal_CollisionAvoidanceMode_t */ +//@{ +/** @brief No CCA nor CSMA will be performed. */ +#define gpHal_CollisionAvoidanceModeNoCCA 0 +/** @brief Only CCA will be performed. */ +#define gpHal_CollisionAvoidanceModeCCA 1 +/** @brief CSMA will be performed. */ +#define gpHal_CollisionAvoidanceModeCSMA 2 +/** @typedef gpHal_CollisionAvoidanceMode_t + * @brief The gpHal_CollisionAvoidanceMode_t type defines the CSMA/CA method in TX. +*/ +typedef UInt8 gpHal_CollisionAvoidanceMode_t; +//@} + +// RxMode selection options +/** @name gpHal_RxMode_t */ +//@{ +/** @brief Mode Normal to be used*/ +#define gpHal_RxModeNormal 0x1 +#define gpHal_RxModeHighSensitivity 0x1 /* new name for the normal mode */ +/** @brief Mode Low Power Listening to be used*/ +#define gpHal_RxModeLowPower 0x2 +/** @brief Mode Multi Channel Listening to be used*/ +#define gpHal_RxModeMultiChannel 0x4 +/** @brief Mode Multi Standard Listening to be used*/ +#define gpHal_RxModeMultiStandard 0x5 +/** @typedef gpHal_RxMode_t + @brief The gpHal_RxMode_t type defines the receiver mode selection. +*/ +typedef UInt8 gpHal_RxMode_t; +//@} + +#define gpHal_AntennaModeDiversity 0x0 +#define gpHal_AntennaModeAntenna0 0x1 +#define gpHal_AntennaModeAntenna1 0x2 +typedef UInt8 gpHal_AntennaMode_t; + +typedef UInt8 gpHal_Channel_t; + +//Channelslot identifier +/** @name gpHal_ChannelSlotIdentifier_t */ +//@{ +/** @brief ChannelSlot for first slot */ +#define gpHal_ChannelSlotIdentifier_0 0x0 +/** @brief ChannelSlot for second slot */ +#define gpHal_ChannelSlotIdentifier_1 0x1 +/** @brief ChannelSlot for third slot */ +#define gpHal_ChannelSlotIdentifier_2 0x2 +/** @brief ChannelSlot for fourth slot */ +#define gpHal_ChannelSlotIdentifier_3 0x3 +/** @brief ChannelSlot for fifth slot */ +#define gpHal_ChannelSlotIdentifier_4 0x4 +/** @brief ChannelSlot for sixth slot */ +#define gpHal_ChannelSlotIdentifier_5 0x5 +/** @typedef gpHal_ChannelSlotIdentifier_t + * @brief The gpHal_ChannelSlotIdentifier_t type defines the channel slot used +*/ +typedef UInt8 gpHal_ChannelSlotIdentifier_t; +//@} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief Set continuous wave mode on/off. + * + * This function sets the continuous wave mode + * + * @param mode Continuous wave mode can be Unmodulated, Modulated or Off. + * @param channel channel on which CW will be generated + * @param txpower power at which the CW will be generated (in dB) + * @param antenna antenna on which CW will be generated. Auto will default to Ant0 or the antenna selected with GP_HAL_DIVERSITY_SINGLE_ANTENNA diversity +*/ +void gpHal_SetContinuousWaveMode( gpHal_ContinuousWaveMode_t mode, UInt8 channel, Int8 txpower, gpHal_AntennaSelection_t antenna); + +void gpHal_CalibrateFllChannel(gpHal_ChannelSlotIdentifier_t slotId, UInt8 fllChannel); +// Same functionality as gpHal_CalibrateFllChannel, but without claiming the radio (the caller function is responsible for this) +void gpHal_CalibrateFllChannelUnprotected(gpHal_ChannelSlotIdentifier_t slotId, UInt8 fllChannel); + +/** @brief Claim radio management and wait for it to be granted +*/ +void gpHal_ClaimRadioMgmt(void); + +/** @brief Release radio management + */ +void gpHal_ReleaseRadioMgmt(void); + +UInt8 gpHalPhy_FillInModeSignals(UInt8 txEn, UInt8 rxEn, UInt8 mode); +void gpHalPhy_SetTxAntenna(UInt8 antenna); +UInt8 gpHalPhy_GetTxAntenna(void); + +/** @brief RX antenna select + * intAntSel - Select internal antenna port + * extAntSel - Select external antenna port + */ +void gpHalPhy_UpdateRxAntennaSelection(UInt8 intAntSel, UInt8 extAntSel); + +/** @brief Initialize signal to control an MODE bit for an external antenna switch */ +GP_API void gpHalPhy_InitExternalModeSignal(UInt8 mode_signal); + + +void gpHal_InitPhy(void); + + +/** @brief Gets the antenna used to transmit a packet + * + * This function queries the antenna used to transmit a packet + * @return the antenna used to transmit a packet, possible values defined in enumeration gpHal_AntennaSelection + */ +GP_API gpHal_AntennaSelection_t gpHal_GetTxAntenna(void); + +/** @brief Gets the antenna used to receive packets + * + * This function queries the antenna used to receive packets + * @return the antenna used to receive packets, possible values defined in enumeration gpHal_AntennaSelection + */ +GP_API gpHal_AntennaSelection_t gpHal_GetRxAntenna(void); + +/** @brief Sets the antenna used to transmit and receiving packets + * + * This function selects the used antenna used to transmit a packet + * Note that this function is obsolete, gpHal_SetRxAntenna should be used instead. + * @param antenna The antenna used to transmit and receive packets, possible values defined in enumeration gpHal_AntennaSelection + */ +GP_API void gpHal_SetAntenna(gpHal_AntennaSelection_t antenna); + +/** @brief Sets the antenna used to receive packets + * + * This function selects the used antenna used to receive a packet + * @param antenna The antenna used to receive packets, possible values defined in enumeration gpHal_AntennaSelection_t + */ +GP_API void gpHal_SetRxAntenna(gpHal_AntennaSelection_t antenna); + +/** @brief This function returns the antenna which is used by the BLE stack. + * + * @return gpHal_AntennaSelection_t The antenna which is used + */ +GP_API gpHal_AntennaSelection_t gpHal_GetBleAntenna(void); + +/** @brief Returns antenna diversity mode +* +* @return true if antenna diversity is enabled +*/ +GP_API Bool gpHal_GetRxAntennaDiversity(void); + +/** @brief Sets the FIR filter config + * + * This primitive is for configuring the values for the TX FIR filter. + * This affects the ZB transmission. + * @param firFilter An enum value that corresponds to one of the predefined sets of FIR filter coefficients. + */ +void gpHal_SetRadioFirFilter(gpHal_FirFilter_t firFilter); + +#ifdef __cplusplus +} +#endif + +#endif // _GPHAL_PHY_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_SEC.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_SEC.h new file mode 100644 index 0000000..4a5bb86 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_SEC.h @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpHal_SEC.h + * + * Contains all security functionality of the HAL + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_SEC_H_ +#define _HAL_GP_SEC_H_ + +/** @file gpHal_SEC.h + * This file contains all security functionality of the HAL. Standalone AES encryption can be performed as well as CCM encryption and decryption. + * + * @brief Contains all security functionality of the HAL +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpEncryption.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Performs a synchronous AES Encryption. + * + * The function will encrypt the number of bytes specified in keylen with the AES algorithm and return the result in place. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy + * - gpHal_ResultInvalidParameter + * + * @param pInplaceBuffer Pointer to the buffer of the 16 to be encrypted bytes. Encrypted result will be returned in same buffer + * @param pAESKey Pointer to the byte key, this key is only uses if specified by the options parameter. When used but specified as NULL, 0 will be used as key value. + * @param AESOptions This parameter specifies the keylen and an 8bit bitmask specifying the options: bits[6:0] specify the keyid to be used (see gpEncryption_API_Manual); bit[7] indicates additional hardening + */ +GP_API gpHal_Result_t gpHal_AESEncrypt(UInt8* pInplaceBuffer, UInt8* pAESKey, gpEncryption_AESOptions_t AESOptions); + +/** + * @brief Performs a synchronous CCM Encryption with support for larger buffers. + * + * The function will encrypt the bytes with the CCM algorithm according to the specified options + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidRequest + * + * @param pCCMOptions Pointer to the gpHal_CCMOptions structure. + */ +gpHal_Result_t gpHal_CCMEncrypt_RAM(UInt16 dataLength, UInt16 auxLength, UInt8 micLength, UInt8* dataPtr, UInt8* auxPtr, UInt8* micPtr, UInt8* pKey, UInt8* pNonce, UInt8* dataOutPtr); + +/** + * @brief Performs a synchronous CCM Decryption with support for larger buffers. + * + * The function will decrypt the bytes with the CCM algorithm according to the specified options + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidRequest + * + * @param pCCMOptions Pointer to the gpHal_CCMOptions structure. + */ +gpHal_Result_t gpHal_CCMDecrypt_RAM(UInt16 dataLength, UInt16 auxLength, UInt8 micLength, UInt8* dataPtr, UInt8* auxPtr, UInt8* micPtr, UInt8* pKey, UInt8* pNonce, UInt8* dataOutPtr); + +/** + * @brief Performs a synchronous CCM Encryption. + * + * The function will encrypt the bytes with the CCM algorithm according to the specified options + * in the gpHal_CCMOptions structure. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy + * + * @param pCCMOptions Pointer to the gpHal_CCMOptions structure. + */ +GP_API gpHal_Result_t gpHal_CCMEncrypt(gpEncryption_CCMOptions_t * pCCMOptions); + +/** + * @brief Performs a synchronous CCM Decryption. + * + * The function will decrypt the bytes with the CCM algorithm according to the specified options + * in the gpHal_CCMOptions structure. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy + * - gpHal_ResultInvalidParameter + * + * @param pCCMOptions Pointer to the gpHal_CCMOptions structure. + */ +GP_API gpHal_Result_t gpHal_CCMDecrypt(gpEncryption_CCMOptions_t * pCCMOptions); + +/** + * @brief Hash-based message authentication code. + * + * This function performs HMAC, a mechanism for message authentication using cryptographic hash functions. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy + * - gpHal_ResultUnsupported + * + * @param hashFct Type of hash funtion. + * @param pKey Secret cryptographic Key. + * @param pMsg Message for authentication. + * @param pResult Message Authentication Codes Result, The size of the output of HMAC is the same as that of the underlying hash function. + */ +GP_API gpHal_Result_t gpHal_HMAC(UInt8 hashFct, UInt16 keyLength, UInt16 msgLength, UInt8 resultLength, UInt8* pKey, UInt8* pMsg, UInt8* pResult); + + + + +#ifdef __cplusplus +} +#endif + +#endif //_HAL_GP_SEC_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_reg.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_reg.h new file mode 100644 index 0000000..0996d17 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_reg.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * gpHal_reg.h + * + * The file gpHal_reg.h is a wrapper around the correct register definitions + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_HAL_REG_H_ +#define _GP_HAL_REG_H_ + +/** + * @file gpHal_reg.h + * + * Wrapper around the register definitions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#ifdef GP_COMP_UNIT_TEST +//Only be used for gpHal as Tbc +#include "utTbc_gpHal_defs.h" +#endif + +#endif //_GP_HAL_REG_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gp_global.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gp_global.h new file mode 100644 index 0000000..22eb8c0 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/inc/gp_global.h @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2008-2010, 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpHal_global.h + * + * Contains general definitions used in the different blocks. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPHAL_GLOBAL_H_ +#define _GPHAL_GLOBAL_H_ + +/** @file gp_global.h + * The file gp_global.h contains general definitions used in the different blocks. The result enumeration for the gphal functions and different callbacks can be found here. + * + * @brief Contains general definitions used in the different blocks. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @name gpHal_Result_t*/ +//@{ +/** @brief The function returned successful. */ +#define gpHal_ResultSuccess 0x0 +/** @brief An invalid parameter was given as a parameter to this function. */ +#define gpHal_ResultInvalidParameter 0x5 +/** @brief The GP chip is in receive mode. */ +#define gpHal_ResultRxOn 0x6 +/** @brief The GP chip is busy. */ +#define gpHal_ResultBusy 0x7 +/** @brief The GP chip radio is off. */ +#define gpHal_ResultTrxOff 0x8 +/** @brief The GP chip radio is transmitting. */ +#define gpHal_ResultTxOn 0x9 +/** @brief The GP chip has timed out waiting for the COEX Grant signal. */ +#define gpHal_ResultGrantTimeout 0xa +/** @brief The GP chip unsupported operation*/ +#define gpHal_ResultUnsupported 0xb +/** @brief The request was invalid (event not present, ...)*/ +#define gpHal_ResultInvalidRequest 0xc2 +/** @brief The handle given as parameter cannot be found. */ +#define gpHal_ResultInvalidHandle 0xe7 +/** @brief Channel access failure. */ +#define gpHal_ResultCCAFailure 0xe1 +/** @brief Ack was required but no ack received. */ +#define gpHal_ResultNoAck 0xe9 +/** @typedef gpHal_Result_t + * @brief The gpHal_Result_t type defines the result of various HAL functions. +*/ +typedef UInt8 gpHal_Result_t; +//@} + +/** @typedef gpHal_AbsoluteEventCallback_t + * @brief The gpHal_AbsoluteEventCallback_t callback type definition defines the callback prototype of an Absolute Event interrupt. */ +typedef void (*gpHal_AbsoluteEventCallback_t)(void); + +/** @typedef gpHal_ExternalEventCallback_t + * @brief The gpHal_ExternalEventCallback_t callback typedef defines the callback prototype of the External Event interrupt. */ +typedef void (*gpHal_ExternalEventCallback_t)(void); + +typedef void (*gpHal_LowBatteryCallback_t)(void); + +/** @name gpHal_RxInfo_t */ +//@{ +typedef struct { +/** @brief The channel the packet was received on */ + UInt8 rxChannel; +/** @typedef gpHal_RxInfo_t + * @brief The gpHal_MultiChannelOptions_t struct contains some info about the rx of a packet. +*/ +} gpHal_RxInfo_t; +//@} + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs_gpglobal.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + + +/** + * @brief This callback indicates the reception of a data. + * + * This callback is called when a data packet has been received. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * + * @param pdLoh Packet descriptor structure that contains length, offset and unique handle of the received packet. + * @param rxInfo Additional information about the rx of the packet. +*/ +GP_API void gpHal_cbDataIndication(gpPd_Loh_t pdLoh, gpHal_RxInfo_t *rxInfo); + +/** + * @brief This callback indicates the completion of a data transmission. + * + * This callback is called when a data transmission has been completed. The transmission has been + * initiated by calling the gpHal_DataRequest() function. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * + * @param pdLoh Packet descriptor structure that contains length, offset + and unique handle of the transmitted packet. + * @param status The status of the data transfer. + * @param lastChannelUsed The channel where the packet has been sent. + * +*/ +GP_API void gpHal_cbDataConfirm(gpHal_Result_t status, gpPd_Loh_t pdLoh, UInt8 lastChannelUsed); + +/** + * @brief This callback indicates the reception of a commabd data request request. + * + * It's goal is to set the FP bit correctly in the Ack + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * +*/ +GP_API void gpHal_cbCmdDataRequest(void); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +/** + * @brief This callback indicates the completion of an Energy detection (ED). + * + * This callback is called when an energy detection (ED) has been completed. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * + * @param channelMask The measured channels. + * @param protoED The raw energy level measured. This value needs to be converted by gpHal_CalculateED() + * in order to get the real energy level. +*/ +GP_API void gpHal_cbEDConfirm(UInt16 channelMask, UInt8 *protoED); +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + +/** + * @brief This callback indicates that a timed trigger for a data transmission has failed. + * + * This callback is called when a timed transmission for a data transmission has failed due + * to a busy state of the transmitter. This can occur for instance, when the transmitter is + * transmitting a acknowledge frame at the moment the transmission triggers gets fired. + * + * When this occurs, the pending data packet in the transmission queue needs to be handled + * by the software (by clearing the pending packet or by rescheduling a new trigger). + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * +*/ +GP_API void gpHal_cbBusyTX(void); + +/** + * @brief This callback indicates the transmission queue was empty, when a timed transmission was triggered. + * + * This callback is called when the transmission queue is empty and a timed transmission should be started. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * +*/ +GP_API void gpHal_cbEmptyQueue(void); + +/** + * @brief This callback is called when an absolute event has occured. + * + * This callback is called when an absolute event has occured. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * +*/ +GP_API void gpHal_cbExternalEvent(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif +#endif /* _GPHAL_GLOBAL_H_ */ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c new file mode 100644 index 0000000..b4fd7ac --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpHal_Coex_marshalling.c" + * + * gpHal Coexistence subcomponent + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpHal_Coex.h" +#include "gpHal_Coex_marshalling.h" + +#include "gpLog.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_HAL_COEX + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +void gpHal_Coex_InitMarshalling( void ) +{ +} + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/inc/gen/gpAssert_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/inc/gen/gpAssert_marshalling.h new file mode 100644 index 0000000..060346b --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/inc/gen/gpAssert_marshalling.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPASSERT_MARSHALLING_H_ +#define _GPASSERT_MARSHALLING_H_ + +//DOCUMENTATION ASSERT: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + + + + +typedef struct { + UInt16 componentId; + UInt16 lineNumber; +} gpAssert_cbIndication_Input_struct_t; + +typedef struct { + gpAssert_cbIndication_Input_struct_t data; +} gpAssert_cbIndication_Input_marshall_struct_t; + + +typedef union { + gpAssert_cbIndication_Input_marshall_struct_t gpAssert_cbIndication; + UInt8 dummy; //ensure none empty union definition +} gpAssert_Client_Input_union_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's + +// Structure copy functions +// Server functions +void gpAssert_cbIndication_Input_par2api(UInt8Buffer* pDest , UInt16 componentId , UInt16 lineNumber , UInt16* pIndex); + +// Client functions +gpMarshall_AckStatus_t gpAssert_cbIndication_Input_buf2api(gpAssert_cbIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); + +void gpAssert_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPASSERT_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/inc/gpAssert.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/inc/gpAssert.h new file mode 100644 index 0000000..10513d7 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/inc/gpAssert.h @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpAssert.h + * This file contains the definitions of the public functions and enumerations of the gpAssert. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_ASSERT_H_ +#define _GP_ASSERT_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpAssert_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "global.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +#ifdef GP_COMP_UNIT_TEST +//Make sure unit and stacktest are able to stop after unexpected assert +#define GP_DIVERSITY_ASSERT_ACTION_EXIT +#endif //GP_COMP_UNIT_TEST + +// level of assert that should be kept (lower means more critical) +#define GP_DIVERSITY_ASSERT_LEVEL_SYSTEM 0 +#define GP_DIVERSITY_ASSERT_LEVEL_DEV_EXT 1 +#define GP_DIVERSITY_ASSERT_LEVEL_DEV_INT 2 +typedef UInt8 gpAssert_AssertLevel_t; + +// Id of the assert -- Fixme: add more ids here +#define GP_ASSERT_ID_UNDEFINED 0x00 +typedef UInt8 gpAssert_AssertId_t; + +// typedef for first parameter of assert macro (currently contains 2 bits level and optional 4 bits id) +typedef UInt8 gpAssert_AssertInfo_t; + +// structure that is passed to assert callback function +typedef struct { +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + gpAssert_AssertLevel_t level; + gpAssert_AssertId_t id; +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + UInt8 componentId; + UInt16 lineNumber; + FLASH_STRING fileName; +} gpAssert_NotifyInfo_t; + +// define type of assert callback +typedef void (*gpAssert_cbAssertIndication_t)(gpAssert_NotifyInfo_t* notifyInfo); + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifdef GP_FILENAME +#ifdef GP_DIVERSITY_LOG +//Define a FileName only once for use in Assertions - name comes from make environment +#if defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +static const char ROM gpFileName[] FLASH_PROGMEM @ ".rom" = { XSTRINGIFY(GP_FILENAME) }; +#else +static const char ROM gpFileName[] FLASH_PROGMEM = { XSTRINGIFY(GP_FILENAME) }; +#endif // defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +#define GP_ASSERT_FILENAME gpFileName +#endif //GP_DIVERSITY_LOG +#endif //GP_FILENAME + +#ifndef GP_ASSERT_FILENAME +#define GP_ASSERT_PSTR(s) (FLASH_STRING)GEN_STR2FLASH(s) +#ifdef GP_DIVERSITY_LOG +#if defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +static const char ROM gpFileName[] FLASH_PROGMEM @ ".rom" = { XSTRINGIFY(__FILE__) }; +#define GP_ASSERT_FILENAME gpFileName +#else +#define GP_ASSERT_FILENAME GP_ASSERT_PSTR(__FILE__) +#endif +#else +#define GP_ASSERT_FILENAME 0 +#endif +#endif //GP_ASSERT_FILENAME + +// In case no global assert level is provided, define it (maps on previous structure). +#ifndef GP_DIVERSITY_GLOBAL_ASSERT_LEVEL +#define GP_DIVERSITY_GLOBAL_ASSERT_LEVEL GP_DIVERSITY_ASSERT_LEVEL_DEV_INT +#endif //GP_DIVERSITY_GLOBAL_ASSERT_LEVEL + + +// when no reporting is defined, take callback (has also logging) as default +#if !defined(GP_DIVERSITY_ASSERT_REPORTING_LOG) && !defined(GP_DIVERSITY_ASSERT_REPORTING_CALLBACK) && !defined(GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG) && !defined(GP_DIVERSITY_ASSERT_REPORTING_NOTHING) +#define GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +#endif //!defined(GP_DIVERSITY_ASSERT_REPORTING_LOG) && !defined(GP_DIVERSITY_ASSERT_REPORTING_CALLBACK) && !defined(GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG) && !defined(GP_DIVERSITY_ASSERT_REPORTING_NOTHING) + +// when no action is defined, take endless loop (blinking led) as default +#if !defined(GP_DIVERSITY_ASSERT_ACTION_BLINK_LED) && !defined(GP_DIVERSITY_ASSERT_ACTION_EXIT) && !defined(GP_DIVERSITY_ASSERT_ACTION_RESET) && !defined(GP_DIVERSITY_ASSERT_ACTION_NOTHING) +#define GP_DIVERSITY_ASSERT_ACTION_BLINK_LED +#endif //!defined(GP_DIVERSITY_ASSERT_ACTION_BLINK_LED) && !defined(GP_DIVERSITY_ASSERT_ACTION_EXIT) && !defined(GP_DIVERSITY_ASSERT_ACTION_RESET) && !defined(GP_DIVERSITY_ASSERT_ACTION_NOTHING) + +#if defined(GP_DIVERSITY_ASSERT_REPORTING_LOG) && !defined(GP_DIVERSITY_LOG) +#error Log reporting only possible when log is defined! +#endif + +// define reporting behavior +#if defined(GP_DIVERSITY_ASSERT_REPORTING_CALLBACK) +#define GP_ASSERT_REPORT(info, compId, file, line) gpAssert_CallCbAssertIndication(info,compId,file,line) +#elif defined(GP_DIVERSITY_ASSERT_REPORTING_LOG) +#define GP_ASSERT_REPORT(info, compId, file, line) gpAssert_PrintLogString(compId,file,line) +#elif defined(GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG) +#define GP_ASSERT_REPORT(info, compId, file, line) gpAssert_LedDebug(line) +#elif defined(GP_DIVERSITY_ASSERT_REPORTING_NOTHING) +#define GP_ASSERT_REPORT(info, compId, file, line) do {} while(false) +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK + +// define action behavior +#if defined(GP_DIVERSITY_ASSERT_ACTION_BLINK_LED) +#define GP_ASSERT_FOLLOW_UP_ACTION() gpAssert_BlinkLed() +#elif defined(GP_DIVERSITY_ASSERT_ACTION_EXIT) +#define GP_ASSERT_FOLLOW_UP_ACTION() gpAssert_Exit() +#elif defined(GP_DIVERSITY_ASSERT_ACTION_RESET) +#define GP_ASSERT_FOLLOW_UP_ACTION() gpAssert_ResetSystem() +#elif defined(GP_DIVERSITY_ASSERT_ACTION_NOTHING) +#define GP_ASSERT_FOLLOW_UP_ACTION() do {} while(false) +#endif + +// basic or extend handling (assert identifier specified or not) +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +#define GP_ASSERT_DO_ASSERT_HANDLING(info, compId, file, line) gpAssert_DoAssertHandling_Extended(info, compId, file, line) +#else +#define GP_ASSERT_DO_ASSERT_HANDLING(info, compId, file, line) gpAssert_DoAssertHandling_Basic(compId, file, line) +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + +// default assert macro +#define GP_ASSERT(info, check) \ +do { \ + if(GP_DIVERSITY_GLOBAL_ASSERT_LEVEL >= GP_ASSERT_GET_LEVEL(info)) \ + { \ + if (!(check)) \ + { \ + GP_ASSERT_DO_ASSERT_HANDLING(info, GP_COMPONENT_ID, GP_ASSERT_FILENAME, __LINE__); \ + } \ + } \ +} while (false) + +// assert macro that only checks value, but leaves handling to the user +#define GP_ASSERT_IF(level, check) ((GP_DIVERSITY_GLOBAL_ASSERT_LEVEL >= level) ? (!(check)) : (false)) + +//debug backdoor +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +#define GP_ASSERT_ENABLE_DEBUG() gpAssert_EnableDebug() +#else +#define GP_ASSERT_ENABLE_DEBUG() do {} while(false) +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// map old asserts to new structure +#define GP_ASSERT_DEV_INT(x) GP_ASSERT(GP_DIVERSITY_ASSERT_LEVEL_DEV_INT,x) +#define GP_ASSERT_DEV_EXT(x) GP_ASSERT(GP_DIVERSITY_ASSERT_LEVEL_DEV_EXT,x) +#define GP_ASSERT_SYSTEM(x) GP_ASSERT(GP_DIVERSITY_ASSERT_LEVEL_SYSTEM,x) + +// fixme: move this functionality to a global place? +#define ASSERT_BM_SET(bf,bm,idx,v) bf &= ~bm; bf |= (((UInt16)v) << idx) +#define ASSERT_BM_GET(value, mask, idx) ((value & mask) >> idx) + +// structure of info field +// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +// | id | x | x | level | +#define GP_ASSERT_LEVEL_BM 0x03 +#define GP_ASSERT_ID_BM 0xF0 +#define GP_ASSERT_LEVEL_IDX 0 +#define GP_ASSERT_ID_IDX 4 + +#define GP_ASSERT_GET_LEVEL(info) ASSERT_BM_GET(info, GP_ASSERT_LEVEL_BM, GP_ASSERT_LEVEL_IDX) +#define GP_ASSERT_SET_LEVEL(info, level) ASSERT_BM_SET(info, GP_ASSERT_LEVEL_BM, GP_ASSERT_LEVEL_IDX, level) + +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +#define GP_ASSERT_GET_ID(info) ASSERT_BM_GET(info, GP_ASSERT_ID_BM, GP_ASSERT_ID_IDX) +#define GP_ASSERT_SET_ID(info, id) ASSERT_BM_SET(info, GP_ASSERT_ID_BM, GP_ASSERT_ID_IDX, id) +#else +#define GP_ASSERT_GET_ID(info) GP_ASSERT_ID_UNDEFINED +#define GP_ASSERT_SET_ID(info, id) do {} while(false) +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + +/** @brief Call condition until timeout expires. + * + * @param cond code snippet that will be called in a while loop. Has to evaluate to a usable value. + * @param timeout timeout in us + * @param pTimedOut Pointer to variable is set to true if timeout has occured +*/ +#define GP_DO_WHILE_TIMEOUT(cond, timeout, pTimedOut) do { \ + UInt32 __timeout = timeout; \ + while ( (cond) ) \ + { \ + __timeout = Assert_doWhileTimeOutBody(__timeout); \ + if (__timeout == 0) \ + { \ + break; \ + } \ + }; \ + *pTimedOut = (__timeout == 0); \ +} while(false) + +/** @brief Call condition until timeout expires. Assert if timeout is reached. + * + * @param cond code that will be called in a while loop + * @param timeout timeout in us +*/ +#define GP_DO_WHILE_TIMEOUT_ASSERT(cond, timeout) do { \ + UInt32 __timeout = timeout; \ + while ( (cond) ) \ + { \ + __timeout = Assert_doWhileTimeOutBody_Assert(__timeout ,GP_COMPONENT_ID,GP_ASSERT_FILENAME, __LINE__); \ + if (__timeout == 0) \ + { \ + break; \ + } \ + }; \ +} while(false) + + +/***************************************************************************** + * 'Private' Function Definitions + *****************************************************************************/ + +// These methods used by the GP_DO_WHILE_TIMEOUT(_ASSERT) macro's for code optimisations and should not be called a +// such. The macro implemenations are required to have proper condition evaluation and line printing in case of an +// assert. Reinstanciating the code has however code size impact so these methods reduce the reinstanciated code. +UInt32 Assert_doWhileTimeOutBody(UInt32 timeout); +UInt32 Assert_doWhileTimeOutBody_Assert(UInt32 timeout,UInt8 compId, FLASH_STRING filename, UInt16 line); + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpAssert_CodeJumpTableFlash_Defs.h" +#endif //defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +void gpAssert_DoAssertHandling_Extended(gpAssert_AssertInfo_t assertInfo, UInt8 componentId, FLASH_STRING filename, UInt16 line); +#else +void gpAssert_DoAssertHandling_Basic(UInt8 componentId, FLASH_STRING filename, UInt16 line); +#endif // GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +gpAssert_cbAssertIndication_t gpAssert_RegisterCbAssertIndication(gpAssert_cbAssertIndication_t cbAssertIndication); +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +GP_API void gpAssert_EnableDebug(void); +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// reporting functions +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +void gpAssert_CallCbAssertIndication(gpAssert_AssertInfo_t assertInfo, UInt8 componentId, FLASH_STRING filename, UInt16 line); +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +#ifdef GP_DIVERSITY_LOG +void gpAssert_PrintLogString(UInt8 componentId, FLASH_STRING filename, UInt16 line); +#endif //GP_DIVERSITY_LOG +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +void gpAssert_LedDebug(UInt16 line); +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// action functions +#ifdef GP_DIVERSITY_ASSERT_ACTION_RESET +void gpAssert_ResetSystem(void); +#endif //GP_DIVERSITY_ASSERT_ACTION_RESET +#ifdef GP_DIVERSITY_ASSERT_ACTION_EXIT +void gpAssert_Exit(void); +#endif //GP_DIVERSITY_ASSERT_ACTION_EXIT +#ifdef GP_DIVERSITY_ASSERT_ACTION_BLINK_LED +void gpAssert_BlinkLed(void); +#endif //GP_DIVERSITY_ASSERT_ACTION_BLINK_LED +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ +/** @brief Notify an assert happened +* +* @param componentId +* @param lineNumber +*/ +void gpAssert_cbIndication(UInt16 componentId, UInt16 lineNumber); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //defined(GP_DIVERSITY_ROM_CODE) +#endif //_GP_ASSERT_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c new file mode 100644 index 0000000..08929d2 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpAssert_marshalling.c" + * + * gpAssert component + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpAssert.h" +#include "gpAssert_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_ASSERT + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +void gpAssert_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c new file mode 100644 index 0000000..334aefe --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c @@ -0,0 +1,339 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpAssert.c + * This file contains the implementation of the Assert functions. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_ASSERT + +#include "gpAssert.h" +#include "hal.h" +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif //GP_DIVERSITY_LOG +#ifdef GP_DIVERSITY_ASSERT_ACTION_RESET +#include "gpReset.h" +#endif //GP_DIVERSITY_ASSERT_ACTION_RESET + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +#define GP_ASSERT_DIVERSITY_LED_DEBUG_MAGIC_WORD 0x72 +#endif + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +static void Assert_blinkLedAssert(UInt16 number); +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +gpAssert_cbAssertIndication_t gpAssert_cbAssertIndication = NULL; +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK + +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +static Bool gpAssert_DebugEnabled = 0; +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +#ifdef GP_DIVERSITY_LOG + +#if !defined(GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH) +#define GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH 30 +#endif + +FLASH_STRING gpAssert_filename; +UInt16 gpAssert_line; +#endif //GP_DIVERSITY_LOG + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +#if defined(GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG) +static void Assert_blinkLedAssert(UInt16 number) +{ + UIntLoop i = 5; + + HAL_LED_SET(RED); + while(i) + { + UInt16 subtractor= 0; + UIntLoop j; + + switch(i) + { + case 1: + subtractor = 1; + break; + case 2: + subtractor = 10; + break; + case 3: + subtractor = 100; + break; + case 4: + subtractor = 1000; + break; + case 5: + subtractor = 10000; + break; + default: + break; + } + + for(j=0; j< 10; j++) + { + if(number >= subtractor) + { + HAL_LED_SET(GRN); + number-=subtractor; + } + else + { + HAL_LED_CLR(GRN); + } + HAL_WAIT_MS(1); + HAL_LED_CLR(GRN); + HAL_WAIT_MS(1); + } + + i--; + } + HAL_LED_CLR(RED); +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +UInt32 Assert_doWhileTimeOutBody(UInt32 timeout) +{ + const UInt8 TimeDecrement = 4; + + if (timeout < TimeDecrement) + { + return 0; + } + + HAL_WDT_RESET(); + HAL_WAIT_US(TimeDecrement); + + return (timeout - TimeDecrement); +} + +UInt32 Assert_doWhileTimeOutBody_Assert(UInt32 timeout, UInt8 compId, FLASH_STRING filename, UInt16 line) +{ + UInt32 __timeout = Assert_doWhileTimeOutBody(timeout); + if (__timeout == 0) + GP_ASSERT_DO_ASSERT_HANDLING (GP_DIVERSITY_ASSERT_LEVEL_SYSTEM, compId,filename,line); + return __timeout; +} + +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +void gpAssert_DoAssertHandling_Extended(gpAssert_AssertInfo_t assertInfo, UInt8 componentId, FLASH_STRING filename, UInt16 line) +{ + NOT_USED(assertInfo); + NOT_USED(componentId); + NOT_USED(filename); + NOT_USED(line); + + GP_ASSERT_REPORT(assertInfo, componentId, filename, line); + GP_ASSERT_FOLLOW_UP_ACTION(); +} +#else +void gpAssert_DoAssertHandling_Basic(UInt8 componentId, FLASH_STRING filename, UInt16 line) +{ + NOT_USED(componentId); + NOT_USED(filename); + NOT_USED(line); + + GP_ASSERT_REPORT(0, componentId, filename, line); + GP_ASSERT_FOLLOW_UP_ACTION(); +} +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +gpAssert_cbAssertIndication_t gpAssert_RegisterCbAssertIndication(gpAssert_cbAssertIndication_t cbAssertIndication) +{ + gpAssert_cbAssertIndication_t prevCb; + + prevCb = gpAssert_cbAssertIndication; + gpAssert_cbAssertIndication = cbAssertIndication; + + return prevCb; +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK + +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +void gpAssert_EnableDebug(void) +{ + gpAssert_DebugEnabled = GP_ASSERT_DIVERSITY_LED_DEBUG_MAGIC_WORD; +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// reporting +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +void gpAssert_CallCbAssertIndication(gpAssert_AssertInfo_t assertInfo, UInt8 componentId, FLASH_STRING filename, UInt16 line) +{ +#ifndef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + NOT_USED(assertInfo); +#endif //not defined GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + if(gpAssert_cbAssertIndication != NULL) + { + gpAssert_NotifyInfo_t notifyInfo; +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + notifyInfo.level = GP_ASSERT_GET_LEVEL(assertInfo); + notifyInfo.id = GP_ASSERT_GET_ID(assertInfo); +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + notifyInfo.componentId = componentId; + notifyInfo.lineNumber = line; + notifyInfo.fileName = filename; + gpAssert_cbAssertIndication(¬ifyInfo); + } + else + { +#if defined(GP_DIVERSITY_LOG) + // print logging when enabled + gpAssert_PrintLogString(componentId, filename, line); +#endif //GP_DIVERSITY_LOG + } +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK + +#ifdef GP_DIVERSITY_LOG +void gpAssert_PrintLogString(UInt8 componentID, FLASH_STRING filename, UInt16 line) +{ + Char gpAssert_File[11+GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH] = "Assert %i!"; + + HAL_DISABLE_GLOBAL_INT(); + + //Store in static variables for debuggers + gpAssert_filename = filename; + gpAssert_line = line; + + //Copy filename after '!' + STRNCPY_P(&(gpAssert_File[10]), filename,GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH); + gpLog_Flush(); + gpLog_Printf(componentID, false , (FLASH_STRING)gpAssert_File,2,line); + gpLog_Flush(); + hal_dump_backtrace(0); + + HAL_ENABLE_GLOBAL_INT(); + return; +} +#endif //#ifdef GP_DIVERSITY_LOG + +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +void gpAssert_LedDebug(UInt16 line) +{ + HAL_FORCE_DISABLE_GLOBAL_INT(); + if(gpAssert_DebugEnabled == GP_ASSERT_DIVERSITY_LED_DEBUG_MAGIC_WORD) + { +#ifdef GP_DIVERSITY_LOG + //Flush out any pending messages + gpLog_Flush(); +#endif //GP_DIVERSITY_LOG + volatile Bool EndlessLoop = true; + while(EndlessLoop) + { + HAL_WDT_RESET(); + HAL_WAIT_MS(10); + Assert_blinkLedAssert(line); + } + } +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// action functions +#ifdef GP_DIVERSITY_ASSERT_ACTION_RESET +void gpAssert_ResetSystem(void) +{ + gpReset_ResetSystem(); +} +#endif //GP_DIVERSITY_ASSERT_ACTION_RESET + +#ifdef GP_DIVERSITY_ASSERT_ACTION_EXIT +void gpAssert_Exit(void) +{ +#ifdef GP_DIVERSITY_LOG + gpLog_Flush(); +#endif + exit(-1); +} +#endif //GP_DIVERSITY_ASSERT_ACTION_EXIT + +#if defined(GP_DIVERSITY_ASSERT_ACTION_BLINK_LED) +void gpAssert_BlinkLed(void) +{ + volatile Bool EndLessLoop = true; + + //Performs the end loop with LED blink + + // When the debugger reset the variable EndLessLoop, the CPU can return to the position, where the assert was called + while (EndLessLoop) + { + //toggle green led + HAL_WDT_RESET(); + HAL_LED_TGL(GRN); + HAL_WAIT_MS(500); +#ifdef GP_DIVERSITY_LOG + //Flush out any pending messages + gpLog_Flush(); +#endif //GP_DIVERSITY_LOG + } +} +#endif //GP_DIVERSITY_ASSERT_ACTION_BLINK_LED + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpBaseComps/inc/gpBaseComps.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpBaseComps/inc/gpBaseComps.h new file mode 100644 index 0000000..a741453 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpBaseComps/inc/gpBaseComps.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpBaseComps.h + * + * Initialization function of the BaseComps components. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ +#ifndef _GPBASECOMPS_H_ +#define _GPBASECOMPS_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpBaseComps_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +#include "global.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpBaseComps_CodeJumpTableFlash_Defs.h" +#include "gpBaseComps_CodeJumpTableRom_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +GP_API void gpBaseComps_StackInit(void); +GP_API void gpBaseComps_StackDeInit(void); + +GP_API void gpBaseComps_RegisterPreReInitCallback(void (*callback)(void)); +GP_API void gpBaseComps_RegisterPostReInitCallback(void (*callback)(void)); +GP_API void gpBaseComps_StackReInit(void); + + + + +GP_API void gpBaseComps_MacDeInit(void); +GP_API void gpBaseComps_MacInit(void); + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPBASECOMPS_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c new file mode 100644 index 0000000..a868696 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2021, Qorvo Inc + * + * gpBaseComps_StackInit.c + * + * The file contains the function that initializes all the base components that are used. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#define GP_COMPONENT_ID GP_COMPONENT_ID_BASECOMPS + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpBaseComps.h" + +#include "hal.h" + +#if defined(GP_DIVERSITY_JUMPTABLES) +#include "gpJumpTables.h" + +//Adding symbol pointing to Jump table to avoid optimizing out during linking +#include "gpJumpTables_DataTable.h" +const void* gpBaseComps_ForceDataJumpTableInclude = &JumpTables_DataTable; +#endif + +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER +#include "gpJumpTablesMatter.h" +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + +#include "gpSched.h" + + +#ifdef GP_COMP_RESET +#include "gpReset.h" +#endif //GP_COMP_RESET + +#ifdef GP_COMP_UNIT_TEST +#include "gpUnitTest.h" +#endif //GP_COMP_UNIT_TEST + + +#ifdef GP_COMP_COM +#include "gpCom.h" +#endif //GP_COMP_COM + +#include "gpLog.h" + + + +#ifdef GP_COMP_GPHAL +#include "gpHal.h" +#endif //GP_COMP_GPHAL + +#ifdef GP_COMP_RADIO +#include "gpRadio.h" +#endif //GP_COMP_RADIO + +#ifdef GP_COMP_MACCORE +#include "gpMacCore.h" +#endif //GP_COMP_MACCORE +#ifdef GP_COMP_MACDISPATCHER +#include "gpMacDispatcher.h" +#endif // GP_COMP_MACDISPATCHER + +#ifdef GP_COMP_RANDOM +#include "gpRandom.h" +#endif //GP_COMP_RANDOM +#ifdef GP_COMP_ENCRYPTION +#include "gpEncryption.h" +#endif //GP_COMP_ENCRYPTION + +#include "gpStat.h" + +#ifdef GP_COMP_POOLMEM +#include "gpPoolMem.h" +#endif //GP_COMP_POOLMEM + +#ifdef GP_COMP_PD +#include "gpPd.h" +#endif //GP_COMP_PD +#ifdef GP_COMP_PAD +#include "gpPad.h" +#endif //GP_COMP_PAD + +#ifdef GP_COMP_NVM +#include "gpNvm.h" +#endif //GP_COMP_NVM + +#ifdef GP_COMP_BSPRECFG +#include "gpBspReCfg.h" +#endif //GP_COMP_BSPRECFG + +#ifdef GP_COMP_KEYSCAN +#include "gpKeyScan.h" +#endif //GP_COMP_KEYSCAN + + + +#ifdef GP_COMP_TXMONITOR +#include "gpTxMonitor.h" +#endif //GP_COMP_TXMONITOR + +#ifdef GP_COMP_RANDOM +#include "gpRandom.h" +#endif /* GP_COMP_RANDOM */ + +#ifdef GP_COMP_VERSION +#include "gpVersion.h" +#endif //GP_COMP_VERSION + + +#include "gpAssert.h" +#include "gpRxArbiter.h" + +#ifdef GP_COMP_RFCHANNEL +#include "gpRFChannel.h" +#endif //GP_COMP_RFCHANNEL + + + +#ifdef GP_COMP_SILEXCRYPTOSOC +#include "silexCryptoSoc.h" +#endif + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpBaseComps_StackInit(void) +{ +//-------------------------- +//Initialize logging components +//-------------------------- + + + +#if defined(GP_COMP_COM) && !defined(TBC_GPCOM) + gpCom_Init(); +#endif + +#ifdef GP_DIVERSITY_LOG + gpLog_Init(); +#endif //GP_DIVERSITY_LOG + +//-------------------------- +//Init low level components +//-------------------------- + +#ifdef GP_COMP_GPHAL + gpHal_Init(false); + gpHal_EnableInterrupts(true); +#endif //GP_COMP_GPHAL + +#ifdef GP_COMP_RADIO + gpRadio_Init(); +#endif //GP_COMP_RADIO + + +#if defined(GP_DIVERSITY_JUMPTABLES) + GP_LOG_SYSTEM_PRINTF("NRT ROM v%d",0,gpJumpTables_GetRomVersion()); + /* Make sure the application has been built with the right minimal ROM version */ + GP_ASSERT_SYSTEM(gpJumpTables_GetRomVersion() >= GPJUMPTABLES_MIN_ROMVERSION); +#endif // defined(GP_DIVERSITY_JUMPTABLES) && !defined(GP_DIVERSITY_KEEP_NRT_IN_FLASH) && !defined(GP_DIVERSITY_ROM_BUILD) + +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER + gpJumpTablesMatter_Init(); +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + + gpSched_Init(); + +#ifdef GP_FREERTOS_DIVERSITY_SLEEP +#endif //GP_FREERTOS_DIVERSITY_SLEEP + + + +#ifdef GP_COMP_POOLMEM + gpPoolMem_Init(); +#endif //GP_COMP_POOLMEM + +#ifdef GP_COMP_VERSION + gpVersion_Init(); +#endif //GP_COMP_VERSION + + + + + + gpSched_StartTimeBase(); +#ifndef GP_SCHED_FREE_CPU_TIME +#ifndef GP_DIVERSITY_FREERTOS + gpSched_SetGotoSleepEnable(false); +#endif +#endif //GP_SCHED_FREE_CPU_TIME + +#ifdef GP_FREERTOS_DIVERSITY_SLEEP + hal_SleepSetGotoSleepEnable(false); +#endif //GP_FREERTOS_DIVERSITY_SLEEP + +#ifdef GP_COMP_UNIT_TEST + gpUnitTest_Init(); +#endif //GP_COMP_UNIT_TEST + + +#ifdef GP_COMP_TXMONITOR + gpTxMonitor_Init(GP_BSP_TXMONITOR_SETTLING_TIME_IN_SYMBOLS()); +#endif //GP_COMP_TXMONITOR + +//-------------------------- +// Init low level components with possible external communication +//-------------------------- + +#ifdef GP_COMP_NVM + gpNvm_Init(); +#endif //GP_COMP_NVM + +#ifdef GP_COMP_RESET + gpReset_Init(); +#endif //GP_COMP_RESET + + gpRxArbiter_Init(); + +#ifdef GP_COMP_PD + gpPd_Init(); +#endif //GP_COMP_PD +#ifdef GP_COMP_PAD + gpPad_Init(); +#endif //GP_COMP_PAD + +#ifdef GP_COMP_GPHAL + gpHal_AdvancedInit(); +#endif //GP_COMP_GPHAL + +#ifdef GP_COMP_SILEXCRYPTOSOC + silexCryptoSoc_InitFuncptr(); +#endif + +//-------------------------- +//Init higher level components +//-------------------------- +#ifdef GP_COMP_RANDOM + gpRandom_Init(); +#endif //GP_COMP_RANDOM +#ifdef GP_COMP_ENCRYPTION + gpEncryption_Init(); +#endif //GP_COMP_ENCRYPTION + + gpStat_Init(); + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && !defined(GP_COMP_UNIT_TEST) + if (gpVersion_ExchangeCompatibility() != gpVersion_CompatibilityResultCompatible) + { + GP_ASSERT_DEV_EXT(false); + } +#endif + + gpBaseComps_MacInit(); + +#ifdef GP_COMP_BSPRECFG + gpBspReCfg_Init(); +#endif //GP_COMP_STAT + +#ifdef GP_COMP_KEYSCAN + gpKeyScan_Init(); +#endif //GP_COMP_KEYSCAN + + + +#ifdef GP_COMP_RFCHANNEL + gpRFChannel_Init(); +#endif //GP_COMP_RFCHANNEL + +} + +void gpBaseComps_MacInit(void) +{ +#ifdef GP_COMP_MACCORE + gpMacCore_Init(); +#endif //GP_COMP_MACCORE +#ifdef GP_COMP_MACDISPATCHER + gpMacDispatcher_Init(); +#endif //GP_COMP_MACDISPATCHER +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpLog/inc/gpLog.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpLog/inc/gpLog.h new file mode 100644 index 0000000..5b62723 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpLog/inc/gpLog.h @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2021, Qorvo Inc + * + * gpLog.h + * + * This file contains the API definition of the logging module (printfs and asserts). + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPLOG_H_ +#define _GPLOG_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpLog_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_LOG_PSTR(s) (FLASH_STRING) GEN_STR2FLASH(s) + +#define GP_LOG_SPLIT_UINT32(i) (UInt16)(((i)&0xFFFF0000) >> 16), (UInt16)((i)&0xFFFF) + +#if defined(GP_DIVERSITY_LOG) && defined(GP_LOCAL_LOG) + +#if defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +#define GP_LOG_PRINTF(s, ...) \ + do { \ + static const char ROM rom_str[] @ ".rom" = s; \ + gpLog_Printf(GP_COMPONENT_ID, true, rom_str, __VA_ARGS__); \ + } while(false) +#else +#define GP_LOG_PRINTF(s, ...) gpLog_Printf(GP_COMPONENT_ID, true, GP_LOG_PSTR(s), __VA_ARGS__) +#endif + + +#else //defined(GP_DIVERSITY_LOG) && defined(GP_LOCAL_LOG) +#ifndef HAVE_NO_VARIABLE_LENGTH_MACRO +#define GP_LOG_PRINTF(s, ...) +#else +#define GP_LOG_PRINTF +#endif //HAVE_NO_VARIABLE_LENGTH_MACRO +#endif //defined(GP_DIVERSITY_LOG) && defined(GP_LOCAL_LOG) + +#ifdef GP_DIVERSITY_LOG +#if defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +#define GP_LOG_SYSTEM_PRINTF(s, ...) \ + do { \ + static const char ROM rom_str[] @ ".rom" = s; \ + gpLog_Printf(GP_COMPONENT_ID, true, rom_str, __VA_ARGS__); \ + } while(false) +#else +#define GP_LOG_SYSTEM_PRINTF(s, ...) gpLog_Printf(GP_COMPONENT_ID, true, GP_LOG_PSTR(s), __VA_ARGS__) +#endif +#else //GP_COMP_LOG +#ifndef HAVE_NO_VARIABLE_LENGTH_MACRO +#define GP_LOG_SYSTEM_PRINTF(s, ...) +#else +#define GP_LOG_SYSTEM_PRINTF +#endif //HAVE_NO_VARIABLE_LENGTH_MACRO +#define gpLog_PrintBuffer(length, pData) +#define gpLog_Flush() +#endif //GP_DIVERSITY_LOG + +#define gpLog_PrintfEnable(enable) + +/* Print bits easily */ +#define BYTE_TO_BIN(byte) \ + (byte & 0x80 ? '1' : '0'), \ + (byte & 0x40 ? '1' : '0'), \ + (byte & 0x20 ? '1' : '0'), \ + (byte & 0x10 ? '1' : '0'), \ + (byte & 0x08 ? '1' : '0'), \ + (byte & 0x04 ? '1' : '0'), \ + (byte & 0x02 ? '1' : '0'), \ + (byte & 0x01 ? '1' : '0') + +#define BYTE_TO_BIN_PATTERN "%c%c%c%c%c%c%c%c" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpLog_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** +* @brief Initializes the logging module +*/ +GP_API void gpLog_Init(void); + +/** +* @brief Prints a string with formats through the debug interface. +* +* @param componentID Component ID of component calling the print function. +* @param progmem Indicate if format string buffer originates from FLASH or RAM memory. +* @param format_str NULL terminated string with formatting parameters. +* @param length Deprecated variable, previously indication size of following parameters. +*/ +#ifdef __GNUC__ +GP_API void gpLog_Printf(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...) __attribute__((format(printf, 3, 5))); +#else +GP_API void gpLog_Printf(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...); +#endif + +/** +* @brief Prints a string with formats through the debug interface. +* +* @param componentID Component ID of component calling the print function. +* @param progmem Indicate if format string buffer originates from FLASH or RAM memory. +* @param format_str NULL terminated string with formatting parameters. +* @param length Deprecated variable, previously indication size of following parameters. +*/ +#ifdef __GNUC__ +GP_API void gpLog_Printf_Com(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...) __attribute__((format(printf, 3, 5))); +#else +GP_API void gpLog_Printf_Com(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...); +#endif + +#ifdef GP_DIVERSITY_LOG +/** +* @brief Prints a data buffer in hex format. +* +* @param pData pointer to the buffer +* @param length length to be printed +*/ +GP_API void gpLog_PrintBuffer(UInt16 length, UInt8* pData); + +/** +* @brief Flush any pending logging. +*/ +GP_API void gpLog_Flush(void); + + +/** +* @brief Enable or disable the default gpLog print to console on terminal based applications. +* +* @param enable true or false to enable or disable the print +*/ +GP_API void gpLog_EnableConsoleLog(Bool enable); + +/** +* @brief Retrieve the value of the 'gpLog print to console on terminal based applications' setting +* +* @return Bool true if the print is enabled +*/ +GP_API Bool gpLog_GetConsoleLog(void); + +/** +* @brief Set a file pointer to output the Logging to. File creation should be managed by the caller. +* +* @param pFile file pointer to print to. If NULL print to file is disabled. +*/ +GP_API void gpLog_SetFilePointer(void* pFile); + + +#endif //GP_DIVERSITY_LOG + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPLOG_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c new file mode 100644 index 0000000..c339bab --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * This file contains the implementation of the logging module (forward to printf version). + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_LOG + +#include "gpLog.h" +#include "hal.h" /*HAVE_LOCALTIME setting*/ + +#include +#include +#include + + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define LOG_MAX_LEN 200 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +#ifdef GP_LOG_BUFFERED_COMPID +static char Log_BufferCompId[LOG_MAX_LEN]; +#endif //GP_LOG_BUFFERED_COMPID + +static FILE* Log_pLogFile = NULL; +static Bool Log_Enabled = true; + + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +static void Log_Formatted(UInt8 componentID, char* buf); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +#ifdef GP_LOG_BUFFERED_COMPID +Bool Log_Buffer(char* buf) +{ + UIntLoop i; + Bool buffered; + + UInt8 newBufLength; + UInt8 logBufLength; + + newBufLength = strlen(buf); + logBufLength = strlen(Log_BufferCompId); + + //Max buffering exceeded - dump what is stored + if((newBufLength + logBufLength) >= LOG_MAX_LEN) + { + Log_Formatted(GP_LOG_BUFFERED_COMPID, Log_BufferCompId); + //Reset buffer + MEMSET(Log_BufferCompId, 0, sizeof(Log_BufferCompId)); + logBufLength = 0; + } + + //buffer to static buffer - limited to max length + STRNCPY(&Log_BufferCompId[logBufLength], buf, LOG_MAX_LEN - logBufLength); + buffered = true; + + // check for \n present: + for(i = 0; i < newBufLength; i++) + { + if(buf[i] == '\n') //End of line found + { + //Add buffered logging to end-of-line logging and let it pass + STRNCPY(buf, Log_BufferCompId, LOG_MAX_LEN); + + buf[strlen(buf) - 1] = 0x0; //remove /n + + //Reset buffer + MEMSET(Log_BufferCompId, 0, sizeof(Log_BufferCompId)); + buffered = false; + break; + } + } + + return buffered; +} +#endif //GP_LOG_BUFFERED_COMPID + +static void Log_Formatted(UInt8 componentID, char* buf) +{ +#if defined(HAVE_LOCALTIME) + char timeBuf[10]; + struct tm* local; +#endif +#if defined(GP_COMP_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + UInt16 ms, us; +#endif + +#ifdef HAVE_LOCALTIME +#if defined(GP_COMP_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + time_t t; + t = (time_t)hal_GetCurrentTime()*32; + us = (UInt16)(t % 1000); + t = t / 1000; + ms = (UInt16)(t % 1000); + t = t / 1000; + local = localtime(&t); + strftime(timeBuf, 10, "%H:%M:%S", local); + printf("%s.%03d.%03d: %02X %s\n", timeBuf, ms, us, componentID, buf); +#else + struct timeval tv; + gettimeofday(&tv, NULL); + local = localtime(&tv.tv_sec); + strftime(timeBuf, 10, "%H:%M:%S", local); + if(Log_Enabled) + { + printf("%s:%03u %02X %s\n", timeBuf, (UInt16)(tv.tv_usec / 1000), componentID, buf); + } + if(Log_pLogFile) + { + fprintf(Log_pLogFile, "%s:%03u %02X %s\n", timeBuf, (UInt16)(tv.tv_usec / 1000), componentID, buf); + fflush(Log_pLogFile); + } +#endif +#else + printf("%02X %s\n", componentID, buf); +#endif +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpLog_Init(void) +{ +#ifdef GP_LOG_BUFFERED_COMPID + MEMSET(Log_BufferCompId, 0, sizeof(Log_BufferCompId)); +#endif //GP_LOG_BUFFERED_COMPID +} + +void gpLog_Printf(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...) +{ + NOT_USED(progmem); + char buf[LOG_MAX_LEN]; + + va_list ap; + va_start(ap, length); + vsnprintf(buf, LOG_MAX_LEN, format_str, ap); + va_end(ap); + +#ifdef GP_LOG_BUFFERED_COMPID + if((componentID == GP_LOG_BUFFERED_COMPID) && Log_Buffer(buf)) + { + return; + } +#endif + Log_Formatted(componentID, buf); +} + +void gpLog_PrintBuffer(UInt16 length, UInt8* buf) +{ + int i; + + for(i = 0; i < length; i += 8) + { + gpLog_Printf(GP_COMPONENT_ID, true, "%u/%u: %04x %04x %04x %04x", 0, + i, length, ((buf[i] << 8) | buf[i + 1]), + ((buf[i + 2] << 8) | buf[i + 3]), + ((buf[i + 4] << 8) | buf[i + 5]), + ((buf[i + 6] << 8) | buf[i + 7])); + gpLog_Flush(); + } +} + +void gpLog_Flush(void) +{ + fflush(stdout); +} + +void gpLog_EnableConsoleLog(Bool enable) +{ + Log_Enabled = enable; +} +Bool gpLog_GetConsoleLog(void) +{ + return Log_Enabled; +} +void gpLog_SetFilePointer(void* pFile) +{ + Log_pLogFile = (FILE*)pFile; +} + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/inc/gpPoolMem.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/inc/gpPoolMem.h new file mode 100644 index 0000000..9415a06 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/inc/gpPoolMem.h @@ -0,0 +1,157 @@ + +/* + * Copyright (c) 2011-2012, 2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPPOOLMEM_H_ +#define _GPPOOLMEM_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpPoolMem_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +//DOCUMENTATION GENERATION: no @file required as all documented items are refered to a group + +/** + *@defgroup DEF_POOLMEM General PoolMem Definitions + * @brief The general PoolMem Definitions + * + * Maximal 3 different sizes of chunks available + * + * @image html chunk.png + * @image latex chunk.png "Single Chunk structure" + * + *@defgroup GEN_POOLMEM General PoolMem Public Functions + * @brief The general public PoolMem functionality is implemented in these functions + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpPd.h" // for gpPd_Descriptor_t +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_POOLMEM_MALLOC(nbytes) gpPoolMem_Malloc(GP_COMPONENT_ID,(nbytes), false) +#define GP_POOLMEM_TRYMALLOC(nbytes) gpPoolMem_Malloc(GP_COMPONENT_ID,(nbytes), true) + + +#define GP_POOLMEM_PD_SIZE (sizeof(gpPd_Descriptor_t)) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpPoolMem_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/**@ingroup GEN_POOLMEM + * @brief This function initialize the chunks, it basically sets all the guards and the InUse flags on false. + * +*/ +void gpPoolMem_Init(void); + +/**@ingroup GEN_POOLMEM + * @brief This function is almost similar as PoolMem_Init; invoked at warm restart. + * +*/ +void gpPoolMem_Reset(void); + +/**@ingroup GEN_POOLMEM + * @brief This function allocates a free chunk + * +* @param nbytes Minimal Chunk size +* @param try avoid assert and returning a NULL is handled +* @return void* Returns pointer to allocated chunk +* @return Assert When no chunk free (depends on try) +* @return Assert When nbytes > size of biggest chunk +* @return Assert When GuardEnd or GuardStart overwritten of free chunk +*/ +void* gpPoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_); + + +/**@ingroup GEN_POOLMEM + * @brief This function will free an allocated chunk + * +* @param pData Pointer to Chunk +* @return Assert When wrong pointer given +* @return Assert When GuardEnd or GuardStart overwritten +*/ +void gpPoolMem_Free (void* pData); + +/**@ingroup GEN_POOLMEM + * @brief This function will dump all PoolMem content and check consistency + * +* @param checkConsistency Assert when consistency check fails +* @return Assert When consistency is compromised +*/ +void gpPoolMem_Dump(Bool checkConsistency); + +#ifdef GP_COMP_UNIT_TEST +// Backdoor interface for Unit Tests +void PoolMem_Init(void); +void* PoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_); +void PoolMem_Free (void* pData); +void PoolMem_Free_ByCompId(UInt8 comp_id); +UInt8 PoolMem_InUse(void); +#endif //GP_COMP_UNIT_TEST + +UInt32 gpPoolMem_GetMaxAvailableChunkSize(void); + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPPOOLMEM_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c new file mode 100644 index 0000000..bef6394 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c @@ -0,0 +1,85 @@ + +/* + * Copyright (c) 2011-2012, 2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This file implements a pool memory allocator + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright law + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_POOLMEM + +// General includes +#include "gpPoolMem.h" +#include "gpPoolMem_defs.h" + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + /* Init amount of chunks inside memory */ + void gpPoolMem_Init(void) + { + PoolMem_Init(); + } + + /* Implement malloc function */ +void *gpPoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_) +{ + void *handle; + handle = PoolMem_Malloc(comp_id,nbytes, try_); + return handle; +} + +/* Implement free function */ +void gpPoolMem_Free (void* pData) +/* Check guards and free chunk, if guard error -> assert */ +{ + // If chunk not found, wrong pointer is given or InUse flag overwritten -> assert + PoolMem_Free(pData); +} + +#if defined(GP_DIVERSITY_JUMPTABLES) +// Full debugging disabled in application, but ROM code will still call this function. +void gpPoolMem_SetDebugLine(UInt16 lineNumber) +{ + NOT_USED(lineNumber); +} +#endif // GP_POOLMEM_DIVERSITY_DUMP_FULL_POOL diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c new file mode 100644 index 0000000..c5b64f0 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c @@ -0,0 +1,59 @@ + +/* + * Copyright (c) 2012-2014, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * This file defines the pools used by the pool memory allocator + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright law + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Include Definitions + *****************************************************************************/ + +#include "gpPoolMem.h" +#include "gpPoolMem_defs.h" + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ +#if GP_POOLMEM_CHUNK_AMOUNT1 == 0 +#error Minimum need 1 buffer to play with +#endif + +//Various data +gpPoolMem_Chunkpd_t Chunkpd[GP_POOLMEM_PD_AMOUNT] GP_EXTRAM_SECTION_ATTR; +gpPoolMem_Chunks1_t Chunks1[GP_POOLMEM_CHUNK_AMOUNT1] GP_EXTRAM_SECTION_ATTR; +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 +gpPoolMem_Chunks2_t Chunks2[GP_POOLMEM_CHUNK_AMOUNT2] GP_EXTRAM_SECTION_ATTR; +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 +gpPoolMem_Chunks3_t Chunks3[GP_POOLMEM_CHUNK_AMOUNT3] GP_EXTRAM_SECTION_ATTR; +#endif diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_defs.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_defs.h new file mode 100644 index 0000000..92a3af1 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_defs.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2012, 2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPPOOLMEM_DEFS_H_ +#define _GPPOOLMEM_DEFS_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include +#include "gpPoolMem.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + /** @ingroup DEF_POOLMEM + * @brief Size of Chunk size 1 +*/ +#ifndef GP_POOLMEM_CHUNK_SIZE1 +#define GP_POOLMEM_CHUNK_SIZE1 50 +#endif //GP_POOLMEM_CHUNK_SIZE1 + /** @ingroup DEF_POOLMEM + * @brief Size of Chunk size 2 +*/ +#ifndef GP_POOLMEM_CHUNK_SIZE2 +#define GP_POOLMEM_CHUNK_SIZE2 100 +#endif //GP_POOLMEM_CHUNK_SIZE2 + /** @ingroup DEF_POOLMEM + * @brief Size of Chunk size 3 +*/ +#ifndef GP_POOLMEM_CHUNK_SIZE3 +#define GP_POOLMEM_CHUNK_SIZE3 150 +#endif //GP_POOLMEM_CHUNK_SIZE3 + /** @ingroup DEF_POOLMEM + * @brief Amount of Chunk Size 1 +*/ +#ifndef GP_POOLMEM_CHUNK_AMOUNT1 +#define GP_POOLMEM_CHUNK_AMOUNT1 1 +#endif //GP_POOLMEM_CHUNK_AMOUNT1 + /** @ingroup DEF_POOLMEM + * @brief Amount of Chunk Size 2 +*/ +#ifndef GP_POOLMEM_CHUNK_AMOUNT2 +#define GP_POOLMEM_CHUNK_AMOUNT2 1 +#endif //GP_POOLMEM_CHUNK_AMOUNT2 + /** @ingroup DEF_POOLMEM + * @brief Amount of Chunk Size 3 +*/ +#ifndef GP_POOLMEM_CHUNK_AMOUNT3 +#define GP_POOLMEM_CHUNK_AMOUNT3 0 +#endif //GP_POOLMEM_CHUNK_AMOUNT3 + +/** @ingroup DEF_POOLMEM + * @brief Amount of PD Size +*/ + +#ifndef GP_POOLMEM_PD_AMOUNT + #ifdef GP_PD_NR_OF_HANDLES + #define GP_POOLMEM_PD_AMOUNT GP_PD_NR_OF_HANDLES + #else + #define GP_POOLMEM_PD_AMOUNT 5 + #endif //GP_PD_NR_OF_HANDLES +#endif // GP_POOLMEM_PD_AMOUNT + +#ifdef GP_POOLMEM_PD_AMOUNT +#define GP_POOLMEM_MAX_ENTRIES (GP_POOLMEM_PD_AMOUNT + GP_POOLMEM_CHUNK_AMOUNT1 + GP_POOLMEM_CHUNK_AMOUNT2 + GP_POOLMEM_CHUNK_AMOUNT3) +#else +#define GP_POOLMEM_MAX_ENTRIES (GP_POOLMEM_CHUNK_AMOUNT1 + GP_POOLMEM_CHUNK_AMOUNT2 + GP_POOLMEM_CHUNK_AMOUNT3) +#endif // GP_POOLMEM_PD_AMOUNT + +#ifdef ALIGNMENT_NEEDED +typedef UInt32 GUARD; +#else +typedef UInt16 GUARD; +#endif + /** @ingroup DEF_POOLMEM + * @brief Guard Pattern +*/ + +#ifdef ALIGNMENT_NEEDED +#define GP_POOLMEM_GUARD 0xCA4EE4AC +#else +#define GP_POOLMEM_GUARD 0xCA4E +#endif + /** @ingroup DEF_POOLMEM + * @brief NotUsed pattern +*/ +#define GP_POOLMEM_NOTUSED 0xFF + +/* Chunk structure, max 3 different sizes to use */ + +/** @ingroup DEF_POOLMEM + * @brief Structure of Chunk s1 +*/ +typedef struct gpPoolMem_Chunks1 { + GUARD GuardStart; + UInt8 Data[GP_POOLMEM_CHUNK_SIZE1]; + GUARD GuardEnd; + Bool InUse; +} gpPoolMem_Chunks1_t; + + +/** @ingroup DEF_POOLMEM + * @brief Structure of Chunk s2 +*/ +typedef struct gpPoolMem_Chunks2 { + GUARD GuardStart; + UInt8 Data[GP_POOLMEM_CHUNK_SIZE2]; + GUARD GuardEnd; + Bool InUse; +} gpPoolMem_Chunks2_t; + + +/** @ingroup DEF_POOLMEM + * @brief Structure of Chunk s3 +*/ +typedef struct gpPoolMem_Chunks3 { + GUARD GuardStart; + UInt8 Data[GP_POOLMEM_CHUNK_SIZE3]; + GUARD GuardEnd; + Bool InUse; +} gpPoolMem_Chunks3_t; + +/** @ingroup DEF_POOLMEM + * @brief Structure of Chunk pd +*/ +typedef struct gpPoolMem_Chunkpd { + GUARD GuardStart; + UInt8 Data[GP_POOLMEM_PD_SIZE]; + GUARD GuardEnd; + Bool InUse; +} gpPoolMem_Chunkpd_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void PoolMem_Init(void); +void *PoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_); +void PoolMem_Free (void* pData); + +#endif // _GPPOOLMEM_DEFS_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c new file mode 100644 index 0000000..637b6b7 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c @@ -0,0 +1,374 @@ + +/* + * Copyright (c) 2012-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This file implements a pool memory allocator + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright law + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_POOLMEM +#define GP_MODULE_ID GP_MODULE_ID_POOLMEM + +//#define GP_LOCAL_LOG + +#include "gpLog.h" +#include "gpAssert.h" +#include "gpWmrk.h" +#include "gpPoolMem.h" +#include "gpPoolMem_defs.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define POOLMEM_CHECK(size,amount) do { \ + UIntLoop i; \ + Bool failure = false; \ + for (i = 0; i < amount; i++) \ + { \ + if(!(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD)) \ + { \ + GP_LOG_SYSTEM_PRINTF("BA-%u[%u]-grd fail",8,(UInt16)sizeof(Chunk##size[i].Data),(UInt16)i);\ + failure = true; \ + } \ + } \ + GP_ASSERT_SYSTEM(!failure); \ + } while(false) + +#define POOLMEM_DUMP(size,amount) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + gpLog_PrintBuffer(sizeof(Chunk##size[i]), (UInt8*)&Chunk##size[i]); \ + } \ + } while(false) + +/* Init chunks, put all InUse flags on false and fill Guard with pattern */ +/* InUse flag on GP_POOLMEM_NOTUSED when not used. If used we will place CompId inside */ +#define POOLMEM_INIT(size,amount) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + Chunk##size[i].InUse = GP_POOLMEM_NOTUSED; \ + Chunk##size[i].GuardStart = GP_POOLMEM_GUARD;\ + Chunk##size[i].GuardEnd = GP_POOLMEM_GUARD; \ + } \ + } while(false) + +/* Look for free chunk and return pointer to data. Check guardStart before checking InUse flag. */ +/* Component Id will be used as InUse flag */ +#define POOLMEM_MALLOC(size,amount,nbytes,comp_id) do { \ + UIntLoop i; \ + for (i = 0; i < amount; ++i) \ + { \ + if (Chunk##size[i].InUse == GP_POOLMEM_NOTUSED) \ + { \ + GP_LOG_PRINTF("BA-%u[%u]-CId:%u-S:%lu",8,(UInt16)sizeof(Chunk##size[i].Data),(UInt16)i,(UInt16)comp_id,(UInt32)nbytes);\ + GP_ASSERT_SYSTEM(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD);\ + Chunk##size[i].InUse = comp_id; \ + gpWmrk_CntrToLimit(gpPoolMemWmrk##size); \ + gpWmrk_CntrSet(gpPoolMemWmrkSize, nbytes); \ + return &(Chunk##size[i].Data[0]); \ + } \ + } \ + } while(false) + +/* Look for chunk to be freed */ +#define POOLMEM_FREE(size,amount) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + if (pData == &(Chunk##size[i].Data[0])) \ + { \ + GP_LOG_PRINTF("BF-%u[%u]:%u",6,(UInt16)sizeof(Chunk##size[i].Data),(UInt16)i,(UInt16)Chunk##size[i].InUse);\ + GP_ASSERT_SYSTEM(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD\ + && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD && Chunk##size[i].InUse != GP_POOLMEM_NOTUSED);\ + Chunk##size[i].InUse = GP_POOLMEM_NOTUSED; \ + gpWmrk_CntrFromLimit(gpPoolMemWmrk##size); \ + return; \ + } \ + }\ + } while(false) + +#define POOLMEM_FREE_BY_COMPID(size,amount, comp_id) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + if (comp_id == Chunk##size[i].InUse) \ + { \ + GP_LOG_PRINTF("BF-%u[%u]:CId:%u %u",6,(UInt16)sizeof(Chunk##size[i].Data),(UInt16)i, comp_id, (UInt16)Chunk##size[i].InUse);\ + GP_ASSERT_SYSTEM(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD\ + && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD );\ + Chunk##size[i].InUse = GP_POOLMEM_NOTUSED; \ + gpWmrk_CntrFromLimit(gpPoolMemWmrk##size); \ + } \ + }\ + } while(false) + +#define POOLMEM_IN_USE(size,amount,amountInUse) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + if (GP_POOLMEM_NOTUSED != Chunk##size[i].InUse) \ + { \ + GP_ASSERT_SYSTEM(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD\ + && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD );\ + amountInUse++; \ + } \ + }\ + } while(false) +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +#if defined GP_POOLMEM_CHUNK_AMOUNT1 == 0 +#error Minimum need 1 buffer to play with +#endif + +//Data pools +extern gpPoolMem_Chunkpd_t Chunkpd[]; +extern gpPoolMem_Chunks1_t Chunks1[]; +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 +extern gpPoolMem_Chunks2_t Chunks2[]; +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 +extern gpPoolMem_Chunks3_t Chunks3[]; +#endif + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +/* Init of chunks inside memory */ + void PoolMem_Init(void) + { + GP_LOG_PRINTF("Init PoolMem",0); + POOLMEM_INIT(pd,GP_POOLMEM_PD_AMOUNT); + POOLMEM_INIT(s1,GP_POOLMEM_CHUNK_AMOUNT1); +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_INIT(s2,GP_POOLMEM_CHUNK_AMOUNT2); +#endif // GP_POOLMEM_CHUNK_AMOUNT2 > 0 +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_INIT(s3,GP_POOLMEM_CHUNK_AMOUNT3); +#endif + } + +void gpPoolMem_Reset(void) + { + GP_LOG_PRINTF("Reset PoolMem",0); + POOLMEM_INIT(pd,GP_POOLMEM_PD_AMOUNT); + POOLMEM_INIT(s1,GP_POOLMEM_CHUNK_AMOUNT1); + +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_INIT(s2,GP_POOLMEM_CHUNK_AMOUNT2); +#endif // GP_POOLMEM_CHUNK_AMOUNT2 > 0 + +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_INIT(s3,GP_POOLMEM_CHUNK_AMOUNT3); +#endif // GP_POOLMEM_CHUNK_AMOUNT3 > 0 + } + +/* Implementation Malloc function */ +void *PoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_) +{ + /* Look for free chunk + Check GuardStart before checking InUse flag */ + if ((GP_POOLMEM_CHUNK_SIZE1 < GP_POOLMEM_PD_SIZE) && (GP_POOLMEM_CHUNK_AMOUNT2 == 0) && (GP_POOLMEM_CHUNK_AMOUNT3 == 0)) + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE1) POOLMEM_MALLOC(s1,GP_POOLMEM_CHUNK_AMOUNT1,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + } + else if((GP_POOLMEM_CHUNK_SIZE1 > GP_POOLMEM_PD_SIZE) && (GP_POOLMEM_CHUNK_AMOUNT2 == 0) && (GP_POOLMEM_CHUNK_AMOUNT3 == 0)) + { + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE1) POOLMEM_MALLOC(s1,GP_POOLMEM_CHUNK_AMOUNT1,nbytes,comp_id); + } +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + else if((GP_POOLMEM_CHUNK_AMOUNT2 > 0) && (GP_POOLMEM_CHUNK_AMOUNT3 == 0)) + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE1) POOLMEM_MALLOC(s1,GP_POOLMEM_CHUNK_AMOUNT1,nbytes,comp_id); + + if (GP_POOLMEM_PD_SIZE < GP_POOLMEM_CHUNK_AMOUNT2) + { + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE2) POOLMEM_MALLOC(s2,GP_POOLMEM_CHUNK_AMOUNT2,nbytes,comp_id); + } + else + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE2) POOLMEM_MALLOC(s2,GP_POOLMEM_CHUNK_AMOUNT2,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + } + } +#endif // GP_POOLMEM_CHUNK_AMOUNT2 > 0 +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + else // (GP_POOLMEM_CHUNK_AMOUNT3 > 0) && (GP_POOLMEM_CHUNK_AMOUNT2 > 0) + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE1) POOLMEM_MALLOC(s1,GP_POOLMEM_CHUNK_AMOUNT1,nbytes,comp_id); + if (GP_POOLMEM_PD_SIZE < GP_POOLMEM_CHUNK_AMOUNT2) + { + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE2) POOLMEM_MALLOC(s2,GP_POOLMEM_CHUNK_AMOUNT2,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE3) POOLMEM_MALLOC(s3,GP_POOLMEM_CHUNK_AMOUNT3,nbytes,comp_id); + } + else + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE2) POOLMEM_MALLOC(s2,GP_POOLMEM_CHUNK_AMOUNT2,nbytes,comp_id); + if (GP_POOLMEM_PD_SIZE < GP_POOLMEM_CHUNK_AMOUNT3) + { + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE3) POOLMEM_MALLOC(s3,GP_POOLMEM_CHUNK_AMOUNT3,nbytes,comp_id); + } + else + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE3) POOLMEM_MALLOC(s3,GP_POOLMEM_CHUNK_AMOUNT3,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + } + } + } +#endif // GP_POOLMEM_CHUNK_AMOUNT3 > 0 + //If no buffer available or buffer sizes too small: + GP_LOG_PRINTF("Chunk size too small: CId:%u - size:%lu",4,(UInt16)comp_id,(UInt32)nbytes); + + if(!try_) + { + GP_ASSERT_DEV_EXT(false); + } + return NULL; +} + +/* Implementation Free function */ +void PoolMem_Free (void* pData) +/* Check guards and free chunk, if guard error -> assert */ +{ + // Release chunk + POOLMEM_FREE(pd,GP_POOLMEM_PD_AMOUNT); + POOLMEM_FREE(s1,GP_POOLMEM_CHUNK_AMOUNT1); +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_FREE(s2,GP_POOLMEM_CHUNK_AMOUNT2); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_FREE(s3,GP_POOLMEM_CHUNK_AMOUNT3); +#endif + // If chunk not found, wrong pointer is given: + GP_ASSERT_DEV_EXT(false); +} + +#ifdef GP_COMP_UNIT_TEST + +void PoolMem_Free_ByCompId (UInt8 comp_id) +{ + // Release chunk by CompId + POOLMEM_FREE_BY_COMPID(pd,GP_POOLMEM_PD_AMOUNT, comp_id); + POOLMEM_FREE_BY_COMPID(s1,GP_POOLMEM_CHUNK_AMOUNT1, comp_id); +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_FREE_BY_COMPID(s2,GP_POOLMEM_CHUNK_AMOUNT2, comp_id); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_FREE_BY_COMPID(s3,GP_POOLMEM_CHUNK_AMOUNT3, comp_id); +#endif + return; +} + +UInt8 PoolMem_InUse (void) +{ + UInt8 amountInUse = 0; + + POOLMEM_IN_USE(pd,GP_POOLMEM_PD_AMOUNT,amountInUse); + POOLMEM_IN_USE(s1,GP_POOLMEM_CHUNK_AMOUNT1,amountInUse); +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_IN_USE(s2,GP_POOLMEM_CHUNK_AMOUNT2,amountInUse); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_IN_USE(s3,GP_POOLMEM_CHUNK_AMOUNT3,amountInUse); +#endif + return amountInUse; +} +#endif //GP_COMP_UNIT_TEST + +void gpPoolMem_Dump(Bool checkConsistency) +{ +#if GP_POOLMEM_CHUNK_AMOUNT1 > 0 + POOLMEM_DUMP(s1, GP_POOLMEM_CHUNK_AMOUNT1); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_DUMP(s2, GP_POOLMEM_CHUNK_AMOUNT2); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_DUMP(s3, GP_POOLMEM_CHUNK_AMOUNT3); +#endif + + if(checkConsistency) + { +#if GP_POOLMEM_CHUNK_AMOUNT1 > 0 + POOLMEM_CHECK(s1, GP_POOLMEM_CHUNK_AMOUNT1); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_CHECK(s2, GP_POOLMEM_CHUNK_AMOUNT2); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_CHECK(s3, GP_POOLMEM_CHUNK_AMOUNT3); +#endif + } +} + +UInt32 gpPoolMem_GetMaxAvailableChunkSize(void) +{ + UIntLoop i; +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + for (i = 0; i < GP_POOLMEM_CHUNK_AMOUNT3; i++) + { + if (GP_POOLMEM_NOTUSED == Chunks3[i].InUse) + { + return GP_POOLMEM_CHUNK_SIZE3; + } + } +#endif +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + for (i = 0; i < GP_POOLMEM_CHUNK_AMOUNT2; i++) + { + if (GP_POOLMEM_NOTUSED == Chunks2[i].InUse) + { + return GP_POOLMEM_CHUNK_SIZE2; + } + } +#endif +#if GP_POOLMEM_CHUNK_AMOUNT1 > 0 + for (i = 0; i < GP_POOLMEM_CHUNK_AMOUNT1; i++) + { + if (GP_POOLMEM_NOTUSED == Chunks1[i].InUse) + { + return GP_POOLMEM_CHUNK_SIZE1; + } + } +#endif + return 0; +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/inc/gpSched.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/inc/gpSched.h new file mode 100644 index 0000000..29c64c7 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/inc/gpSched.h @@ -0,0 +1,362 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2021, Qorvo Inc + * + * gpSched.h + * This file contains the definitions of the scheduler, wich is the operating system. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ +/** + * @file gpSched.h + * @brief The cooperative scheduling component that handles all Qorvo stack events. + */ + +#ifndef _GPSCHED_H_ +#define _GPSCHED_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_SCHED_DISTANTEVENTS_INTERVAL (20 * 60) +#define GP_SCHED_EVENT_TIME_NOW ((UInt32)-1L) +#define GP_SCHED_EVENT_TIME_MAX 0x7FFFFFFFUL + +/** @brief Compares times from the chip's timebase - check if t1 < t2 (in us) +*/ +#define GP_SCHED_TIME_COMPARE_LOWER_US(t1, t2) (!((UInt32)((t1) - (t2)) /*&(0xFFFFFFFF)*/ < (0x80000000LU))) + +/** @brief Allow sleep only if no events are pending +*/ +#define GP_SCHED_NO_EVENTS_GOTOSLEEP_THRES ((UInt32)(0xFFFFFFFF)) + +/** @brief Default time between events before going to sleep is considered */ +#ifndef GP_SCHED_DEFAULT_GOTOSLEEP_THRES +#define GP_SCHED_DEFAULT_GOTOSLEEP_THRES GP_SCHED_NO_EVENTS_GOTOSLEEP_THRES +#endif + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef void (*gpSched_EventCallback_t)(void*); + +typedef Bool (*gpSched_GotoSleepCheckCallback_t)(void); + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpJumpTables_DataTable.h" +#include "gpSched_CodeJumpTableFlash_Defs.h" +#include "gpSched_CodeJumpTableRom_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + +/** + * @brief Initializes the scheduler + * + * This function intializes the scheduler. + * + */ +GP_API void gpSched_Init(void); +GP_API void gpSched_DeInit(void); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ +/** + * @brief Sets the minimum time required between events for going to sleep. + * + * This function sets a threshold in us, that is used for determining if we can go to sleep. + * If the next scheduled event is at a time later than the current time + the defined threshold (- wakeup threshold) + * then going to sleep is allowed + * + * @param Threshold threshold in us + */ +GP_API Bool gpSched_SetGotoSleepThreshold(UInt32 Threshold); +GP_API void gpSched_SetGotoSleepCheckCallback(gpSched_GotoSleepCheckCallback_t gotoSleepCheckCallback); +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +GP_API void gpSched_SetGotoSleepEnable(Bool enable); + +GP_API void gpSched_GoToSleep(void); +GP_API UInt32 Sched_CanGoToSleep(void); + +/** + * @brief Starts the time base. + * + * Starts the time base, i.e. the timer interrupts are enabled. + */ +GP_API void gpSched_StartTimeBase(void); + +/** + * @brief Returns the current time of the time base. + * + * @return The current time in time base units of 1us. + */ +GP_API UInt32 gpSched_GetCurrentTime(void); + +/** + * @brief Compare 2 times (in 1us) taking overflows into account. + * + * @param n_time1 Time (in us) to be compared. + * @param n_time2 Second time (in us) to compare against n_time1. + * + * @return return True if n_time1 is earlier then n_time2 + */ +GP_API Bool gpSched_TimeCompareLower(UInt32 n_time1, UInt32 n_time2); + +/** + * @brief Clears the event queue. + * + * Clears the event queue. + * + */ +GP_API void gpSched_Clear(void); + +/** + * @brief Returns the event queue status. + * + * Returns the next event to execute. The return pointer is NULL when no event is pending yet. This function + * should be called in a polling loop in the main thread. + * + * @return Event queue status: + * - true: Queue is empty + * - false: Still events in the queue + */ +GP_API Bool gpSched_EventQueueEmpty(void); + +/** + * @brief Schedules a scheduled event. + * + * Schedules an event. The event is inserted into the event queue. + * + * @param rel_time Relative execution time (delay) in us. If the delay equals 0, the function will be scheduled for immedate execution. rel_time shall not exceed GP_SCHED_EVENT_TIME_MAX. + * @param callback Callback function. + */ +GP_API void gpSched_ScheduleEvent(UInt32 rel_time, void_func callback); + +/** + * @brief Schedules a scheduled event. + * + * Schedules an event. The event is inserted into the event queue. + * + * @param rel_time Relative execution time (delay) in us. If the delay equals 0, the function will be scheduled for immedate execution. rel_time shall not exceed GP_SCHED_EVENT_TIME_MAX. + * @param callback Callback function. + * @param arg Pointer to the argument buffer. + * Limitation: Passing a NULL pointer or ((void*) 0) as @p arg will result in calling @p callback + * WITHOUT an argument: i.e. callback(); instead of callback(arg); + * If the callback were to use the argument, it will use random data from the stack. + */ +GP_API void gpSched_ScheduleEventArg(UInt32 rel_time, gpSched_EventCallback_t callback, void* arg); + +/** + * @brief Unschedule a scheduled event. + * + * Unschedules a scheduled event before its execution. The event is identified with the callback pointer + * + * @param callback Scheduled event callback. + * @return True if event was found. False if event was no longer in the queue. + */ +GP_API Bool gpSched_UnscheduleEvent(void_func callback); + +/** + * @brief Check if an event is still waiting for execution + * + * @param callback Scheduled event callback to check. + * @return True if callback is still pending. +*/ +GP_API Bool gpSched_ExistsEvent(void_func callback); +/** + * @brief Get the remaining time untill event execution + * + * @param callback Scheduled event callback to check. + * @return Time in us untill event normally executes. If event is not found 0xFFFFFFFF is returned. +*/ +GP_API UInt32 gpSched_GetRemainingTime(void_func callback); + +/** + * @brief Unschedule a scheduled event. + * + * Unschedules a scheduled event before its execution. The event is identified with the callback pointer and the + * arguments content. + * + * @param callback Scheduled event callback. + * @param arg Pointer to the the arguments used when scheduling. Use NULL to skip matching the arg pointer. + * @return True if event was found. False if event was no longer in the queue. + */ +GP_API Bool gpSched_UnscheduleEventArg(gpSched_EventCallback_t callback, void* arg); +/** + * @brief Check if an event is still waiting for execution. + * + * @param callback Scheduled event callback to check. + * @param arg Pointer to the the arguments used when scheduling. Use NULL to skip matching the arg pointer. + * @return True if callback is still pending. +*/ +GP_API Bool gpSched_ExistsEventArg(gpSched_EventCallback_t callback, void* arg); +/** + * @brief Get the remaining time untill event execution. + * + * @param callback Scheduled event callback to check. + * @param arg Pointer to the the arguments used when scheduling. Use NULL to skip matching the arg pointer. + * @return Time in us untill event normally executes. If event is not found 0xFFFFFFFF is returned. +*/ +GP_API UInt32 gpSched_GetRemainingTimeArg(gpSched_EventCallback_t callback, void* arg); + +/** + * @brief Get the remaining time untill event execution. + * The remaining time for the event can be computed from the *sec parameter and the return parameter as: (*sec * 1000000 + returnvalue) microseconds. + * + * @param callback Scheduled event callback to check. + * @param arg Pointer to the the arguments used when scheduling. Use NULL to skip matching the arg pointer. + * @param sec Pointer to a UInt32, where the remaining time in seconds will be stored. If event is not found 0xFFFFFFFF is filled in. + * @return Time in us untill event normally executes. If event is not found 0xFFFFFFFF is returned. +*/ +GP_API UInt32 gpSched_GetRemainingTimeArgInSecAndUs(gpSched_EventCallback_t callback, void* arg, UInt32* sec); + + +GP_API void gpSched_Main_Body(void); + +/** + * + * This primitive is used to schedule an event with seconds resolution. + * The gpSched_ScheduleEvent has a limit on 30 minutes, therefore this function was built to allow scheduling beyond that limit + * + * @param delayInSec Relative execution time (delay) in seconds. If the delay equals 0, the function will be scheduled for immediate execution. + * @param callback Callback function. + * @param arg Pointer to the argument buffer. +*/ +GP_API void gpSched_ScheduleEventInSeconds(UInt32 delayInSec, gpSched_EventCallback_t callback, void* arg); + +/** + * + * This primitive is used to schedule an event with seconds and microseconds resolution + * The event will be scheduled after a delay of (delayInSec * 1000000 + delayInUs) microseconds. + * + * @param delayInSec Relative execution time (delay) in seconds. + * @param delayInUs Relative execution time (delay) in microseconds. If both delay parameters equal 0, the function will be scheduled for immediate execution. + * @param callback Callback function. + * @param arg Pointer to the argument buffer. +*/ +void gpSched_ScheduleEventInSecAndUs(UInt32 delayInSec, UInt32 delayInUs, gpSched_EventCallback_t callback, void* arg); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + + +GP_API UInt32 gpSched_GetTimeToNextEvent(void); +GP_API UInt32 gpSched_GetGoToSleepThreshold(void); +GP_API Bool gpSched_IsSleepEnabled(void); + +/** + * @brief Function to notify gpSched task/thread when running on an OS. + * + * Will notify the thread to run again in an OS-dependent manner. + */ +void gpSched_NotifySchedTask(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 +typedef void (*gpSched_OnIdleCallback_t)(void); + +/** + * @brief Register a function that should be called when nothing is scheduled. + * This is also referred to as post processing. + * The callback should be: + * - non-blocking + * - Use the scheduler for deffered work (using gpSched_ScheduleEvent) + * + * @param callback Function that will be triggered when the scheduler(OS) is idle. +*/ +GP_API void gpSched_RegisterOnIdleCallback(gpSched_OnIdleCallback_t callback); + +/** + * @brief Execute all registered idle callback functions + * +*/ +GP_API void gpSched_PostProcessIdle(void); +#endif /* GP_SCHED_NR_OF_IDLE_CALLBACKS > 0*/ + +/** + * @brief the MAIN_FUNCTION_NAME define will be used as entry point for the gpSched scheduler + * + * When defining MAIN_FUNCTION_NAME to a certain function, another main() implementation is expected + * To start the normal gpSched operation, the MAIN_FUNCTION_NAME can be called. + * gpSched will then loop infinitely, executing any scheduled event and servicing stack functionality +*/ +#ifndef GP_SCHED_EXTERNAL_MAIN +#ifdef MAIN_FUNCTION_NAME +GP_API MAIN_FUNCTION_RETURN_TYPE MAIN_FUNCTION_NAME(void); +#else //MAIN_FUNCTION_NAME +#define MAIN_FUNCTION_NAME main +#endif //MAIN_FUNCTION_NAME +#endif // not defined GP_SCHED_EXTERNAL_MAIN + +GP_API void gpSched_Main_Init(void); + +#define GP_SCHED_GET_TIME_DIFF(earliestTs, latestTs) ((UInt32)(latestTs) - (UInt32)(earliestTs)) + + +/** + * @brief Callback to initialize gpSched task/thread when running on an OS + * + * This function should be used in the main() to register the gpSched main loop as a task within an OS (FreeRTOS/Linux/...) + * + * @return success True if creation succeeded, False if task creation/registration failed. + */ +Bool gpSched_InitTask(void); + +/** + * @brief A function that checks if an schedule event should be deferred to the context of the task + * + * @return success True if need be deffered, False if called from task without deffer. + */ +Bool gpSched_ScheduleEventDeferred(UInt32 rel_time, gpSched_EventCallback_t callback, void* arg); + +/** + * @brief A function that notifies the gpSched task to process new events. + */ +void gpSched_Trigger(void); +#ifdef __cplusplus +} +#endif + +#endif // _GPSCHED_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched.c new file mode 100644 index 0000000..0e191aa --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched.c @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpSched.c + * This file contains the implementation of the scheduler, which is the operating system. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_SCHED + +#include "gpSched.h" +#include "gpSched_defs.h" +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" + +UInt32 gpSched_GetTimeToNextEvent (void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + UInt32 timeToNextEvent = 0; + gpSched_Event_t* pevt; + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = (gpSched_Event_t*)gpUtils_LLGetFirstElem(sched_globals->gpSched_EventList_p); + if(pevt) + { + UInt32 time_now; + HAL_TIMER_GET_CURRENT_TIME_1US(time_now); + + if(GP_SCHED_TIME_COMPARE_BIGGER_EQUAL(pevt->time, time_now)) + { + timeToNextEvent = GP_SCHED_GET_TIME_DIFF(time_now, pevt->time); + } + else + { + timeToNextEvent = 0; + } + } + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + + return timeToNextEvent; +} + +UInt32 gpSched_GetGoToSleepThreshold (void) +{ + UInt32 threshold; + + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + threshold = (sched_globals->gpSched_GoToSleepTreshold); + return threshold; +} + +/* return 1 if sleep is enabled and 0 otherwise */ +Bool gpSched_IsSleepEnabled(void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + return (sched_globals->gpSched_GoToSleepDisableCounter == 0); +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c new file mode 100644 index 0000000..673a60e --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2010-2013, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpSched_simple.c + * This file contains the data buffers used by the scheduler + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_SCHED + +#include "gpUtils.h" +#include "gpSched.h" +#include "gpSched_defs.h" + +#include "gpLog.h" +#include "gpAssert.h" + + +/***************************************************************************** + * Precompiler checks + *****************************************************************************/ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +//Size definitions +#ifndef GP_SCHED_EVENT_LIST_SIZE +#define GP_SCHED_EVENT_LIST_SIZE 10 +#endif + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +GP_UTILS_LL_MEMORY_DECLARATION(gpSched_Event_t, GP_SCHED_EVENT_LIST_SIZE); + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +GP_UTILS_LL_MEMORY_ALOCATION(gpSched_Event_t, gpSched_EventArray) GP_EXTRAM_SECTION_ATTR; + +gpSched_globals_t gpSched_globals; + +#if (defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2)) +gpUtils_LinkFree_t gpSched_eventLinkFree; +gpUtils_LinkList_t gpSched_eventLinkList; +#endif + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 +static gpSched_OnIdleCallback_t sched_OnIdleCallbacks[GP_SCHED_NR_OF_IDLE_CALLBACKS]; /**< Array with functions to call when the scheduler is idle */ +#endif /* GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 */ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 +void gpSched_RegisterOnIdleCallback(gpSched_OnIdleCallback_t callback) +{ + UInt32 i; + + GP_ASSERT_DEV_EXT(callback != NULL); + + for(i=0; i 0 */ + + +void gpSched_InitExtramData(void) +{ +#if (defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2)) + gpSched_globals.gpSched_EventFree_p = &gpSched_eventLinkFree; + gpSched_globals.gpSched_EventList_p = &gpSched_eventLinkList; +#endif + gpUtils_LLInit(gpSched_EventArray, GP_UTILS_LL_SIZE_OF (gpSched_Event_t) , GP_SCHED_EVENT_LIST_SIZE, gpSched_globals.gpSched_EventFree_p); + +#if defined(GP_DIVERSITY_JUMPTABLES) + gpSched_globals.AppDiversitySleep = SCHED_APP_DIVERSITY_SLEEP(); + gpSched_globals.AppDiversityCom = SCHED_APP_DIVERSITY_COM(); + gpSched_globals.AppDiversityComNoRx = SCHED_APP_DIVERSITY_COM_NO_RX(); +#endif //defined(GP_DIVERSITY_JUMPTABLES) + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 + MEMSET(sched_OnIdleCallbacks, 0, sizeof(sched_OnIdleCallbacks)); +#endif /* GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 */ + +} + + +void gpSched_SetGotoSleepCheckCallback( gpSched_GotoSleepCheckCallback_t gotoSleepCheckCallback ) +{ + NOT_USED(gotoSleepCheckCallback); + gpSched_globals.gpSched_cbGotoSleepCheck = gotoSleepCheckCallback; +} + +Bool gpSched_SetGotoSleepThreshold (UInt32 Threshold /*us*/) +{ + //This defines the minimum time between SW events required for allowing to go to sleep + gpSched_globals.gpSched_GoToSleepTreshold = Threshold; + return true; +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched_defs.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched_defs.h new file mode 100644 index 0000000..d982a03 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched_defs.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2010-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpSched_defs.h + * This file holds the internal defines, typedefs,... of the gpSched component + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_SCHED_DEFS_H_ +#define _GP_SCHED_DEFS_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "gpUtils.h" +#include "gpSched.h" + +/***************************************************************************** + * Precompiler checks + *****************************************************************************/ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_SCHED_TIME_COMPARE_BIGGER(t1,t2) (!((UInt32)(((t2) - (t1))) <= 0x80000000LU)) +#define GP_SCHED_TIME_COMPARE_BIGGER_EQUAL(t1,t2) ( ((UInt32)(((t1) - (t2))) < 0x80000000LU)) +#define GP_SCHED_TIME_COMPARE_LOWER_EQUAL(t1,t2) ( ((UInt32)(((t2) - (t1))) <= 0x80000000LU)) +#define GP_SCHED_TIME_COMPARE_LOWER(t1,t2) (!((UInt32)(((t1) - (t2))) < 0x80000000LU)) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +typedef union { + void_func callback; // Event to be executed without arguments + gpSched_EventCallback_t callbackarg; // Event to be executed with arguments +} gpSched_func_t; + +typedef struct gpSched_Event { + UInt32 time; // sorting key : Absolute in 1us + gpSched_func_t func; + void* arg; + UInt32 RemainderInSeconds; +} gpSched_Event_t; + +typedef struct gpSched_globals_s { + UInt8 gpSched_GoToSleepDisableCounter; + gpSched_GotoSleepCheckCallback_t gpSched_cbGotoSleepCheck; + UInt32 gpSched_GoToSleepTreshold; +#if (defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2)) + gpUtils_LinkFree_t *gpSched_EventFree_p; + gpUtils_LinkList_t *gpSched_EventList_p; +#else + gpUtils_LinkFree_t gpSched_EventFree_p[1]; + gpUtils_LinkList_t gpSched_EventList_p[1]; +#endif + #if defined(GP_DIVERSITY_JUMPTABLES) + Bool AppDiversitySleep; + Bool AppDiversityCom; + Bool AppDiversityComNoRx; + #endif //defined(GP_DIVERSITY_JUMPTABLES) +} gpSched_globals_t; + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +//extern gpUtils_LinkFree_t gpSched_EventFree[1]; +//extern gpUtils_LinkList_t gpSched_EventList[1]; + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpJumpTables_DataTable.h" +#include "gpSched_CodeJumpTableFlash_Defs_defs.h" +#endif// defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +void gpSched_InitExtramData(void); +void Sched_Integration_Init(void); +void Sched_Integration_DeInit(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + // in case we are in ROM, we need to retrieve the pointer via a shim table entry +#define GP_SCHED_GET_GLOBALS() ((gpSched_globals_t*) JumpTables_DataTable.gpSched_globals_ptr) +#else // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + // in case we're not in ROM, we can directly fetch the address of the global vars. +extern gpSched_globals_t gpSched_globals; +#define GP_SCHED_GET_GLOBALS() (&gpSched_globals) +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +// When running from ROM, check run-time application diversities. + +#define SCHED_APP_DIVERSITY_SLEEP() (GP_SCHED_GET_GLOBALS()->AppDiversitySleep) +#define SCHED_APP_DIVERSITY_COM() (GP_SCHED_GET_GLOBALS()->AppDiversityCom) +#define SCHED_APP_DIVERSITY_COM_NO_RX() (GP_SCHED_GET_GLOBALS()->AppDiversityComNoRx) + +#else // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +// When running from flash, check compile-time application diversities. + +#define SCHED_APP_DIVERSITY_SLEEP() (true) + +#ifdef GP_COMP_COM +#define SCHED_APP_DIVERSITY_COM() (true) +#else +#define SCHED_APP_DIVERSITY_COM() (false) +#endif + +#define SCHED_APP_DIVERSITY_COM_NO_RX() (false) + +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +#ifdef __cplusplus +} +#endif + +#endif //_GP_SCHED_DEFS_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c new file mode 100644 index 0000000..a668954 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c @@ -0,0 +1,835 @@ +/* + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpSched.c + * This file contains the implementation of the scheduler, which is the operating system. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_SCHED +#ifdef GP_DIVERSITY_JUMPTABLES +#define GP_DIVERSITY_ROM_CODE +#endif //def GP_DIVERSITY_JUMPTABLES + +#include "gpSched.h" +#include "gpSched_defs.h" +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#ifdef GP_COMP_COM +#include "gpCom.h" +#endif +#include "gpAssert.h" + +#include "gpWmrk.h" + +#ifdef GP_COMP_CHIPEMU +#include "gpChipEmu.h" +#endif + +#ifdef GP_DIVERSITY_JUMPTABLES +#include "gpJumpTables_DataTable.h" +#endif //def GP_DIVERSITY_JUMPTABLES + +/***************************************************************************** + * Precompiler checks + *****************************************************************************/ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/* Macros defining hook for SCHED_MAIN_BODY patch */ +#define SCHED_MAIN_BODY(pS) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + + + +/***************************************************************************** + * External Function Prototypes + *****************************************************************************/ + + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpSched_CodeJumpTableFlash_Defs_rom_c.h" +#include "gpSched_CodeJumpTableRom_Defs_rom_c.h" +#include "gpSched_CodeJumpTableRom_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* + * @brief Internal helper function to schedule an event with argument + * + * @param time relative time in us, or, in case scheduleAbsTime==true, absolute time in us + * @param scheduleAbsTime Set to true when specifying an absolute time + * @param RemainderInSeconds An additional value in seconds to be added to the time argument + */ +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +STATIC_FUNC void Sched_ScheduleEvent( UInt32 time, gpSched_EventCallback_t callback, void* arg,UInt32 RemainderInSeconds ,Bool scheduleAbsTime); +STATIC_FUNC void Sched_ScheduleEventInSeconds(UInt32 delayInSec, UInt32 delayInUs, Bool reScheduling, UInt32 delayerror, gpSched_EventCallback_t callback, void* arg); + +STATIC_FUNC gpSched_Event_t* Sched_GetEvent( void ); +STATIC_FUNC gpSched_Event_t* Sched_FindEventArg(gpUtils_LinkList_t* plst, gpSched_EventCallback_t callback, void* arg, Bool unscheduleWhenFound ); +STATIC_FUNC void Sched_RescheduleEvent (UInt32 rel_time, gpSched_Event_t * pevt); +STATIC_FUNC void Sched_RescheduleEventAbs (UInt32 time, gpSched_Event_t * pevt); +STATIC_FUNC void Sched_ReleaseEventBody(gpSched_Event_t* pevt ); + + +STATIC_FUNC UInt32 Sched_GetEventIdlePeriod(void); + + +STATIC_FUNC UInt32 Sched_GetRemainingTime(gpSched_Event_t* pevt, UInt32* sec); + +STATIC_FUNC void Sched_ExecEvent(gpSched_Event_t * pevt); +STATIC_FUNC void Sched_ReleaseEvent(gpSched_Event_t * pevt); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +void Sched_ExecEvent(gpSched_Event_t * pevt) +{ + if (pevt->arg) pevt->func.callbackarg(pevt->arg); + else pevt->func.callback(); +} + +void Sched_ReleaseEvent(gpSched_Event_t * pevt) +{ + HAL_DISABLE_GLOBAL_INT(); + Sched_ReleaseEventBody(pevt); + HAL_ENABLE_GLOBAL_INT(); +} + +void Sched_RescheduleEvent (UInt32 rel_time, gpSched_Event_t * pevt) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpUtils_LinkList_t* pList = sched_globals->gpSched_EventList_p; + gpSched_Event_t* pevt_nxt = NULL; + UInt32 now; + + GP_ASSERT_DEV_INT(pevt); //pevt pointer should be != NULL + + HAL_TIMER_GET_CURRENT_TIME_1US(now); + if (rel_time == GP_SCHED_EVENT_TIME_NOW) + { + UInt32 first_time; + + if (pList->plnk_first) + { + pevt_nxt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(pList->plnk_first); + first_time = pevt_nxt->time; + } + else + { + first_time = now; + } + pevt->time = GP_SCHED_TIME_COMPARE_LOWER_EQUAL (first_time, now)? + first_time - 1L + : + now - 1L; + } + else + { + pevt->time = now + rel_time; + } + + // You can't schedule negative times. + // This is aLready checked: GP_ASSERT_SYSTEM((rel_time <= GP_SCHED_EVENT_TIME_MAX) || (rel_time == GP_SCHED_EVENT_TIME_NOW)); + // But you also can't schedule further then GP_SCHED_EVENT_TIME_MAX from the first event in the list (else the order in the list will be wrong) + // This is especially true if the first event in the list is in the past (before 'now'). + + if(pList->plnk_first) + { + pevt_nxt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(pList->plnk_first); + + // equal mean max time event already exist + GP_ASSERT_SYSTEM(rel_time <= (pevt_nxt->time - now + GP_SCHED_EVENT_TIME_MAX)); + } + + Sched_RescheduleEventAbs (pevt->time, pevt); +} + +STATIC_FUNC void Sched_RescheduleEventAbs (UInt32 time, gpSched_Event_t * pevt) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpUtils_LinkList_t* pList = sched_globals->gpSched_EventList_p; + gpSched_Event_t* pevt_nxt = NULL; + gpUtils_Link_t* plnk = NULL; + + pevt->time = time; + + // Scroll pointer + // Insert event + // Duration : 8us per loop + { + // Search for first item, that should be executed later as the current one + // or that will be executed as last + for (plnk = pList->plnk_first; + plnk; + plnk = plnk->plnk_nxt) + { + pevt_nxt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(plnk); + if (GP_SCHED_TIME_COMPARE_BIGGER( pevt_nxt->time, pevt->time )) + { + break; + } + } + } + + if (plnk) + { + gpUtils_LLInsertBefore( pevt, pevt_nxt, pList); + } + else + { + gpUtils_LLAdd( pevt, pList ); + } + gpSched_Trigger(); +} + +void Sched_ScheduleEvent( UInt32 time, gpSched_EventCallback_t callback, void* arg,UInt32 RemainderInSeconds ,Bool scheduleAbsTime) +{ + gpSched_Event_t* pevt; + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventFree_p); + pevt = (gpSched_Event_t*)gpUtils_LLNew(sched_globals->gpSched_EventFree_p); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventFree_p); + + if (!pevt) + { + + /* Maximum number of events scheduled has been reached (maximum number of scheduled events can be changed with GP_SCHED_EVENT_LIST_SIZE) */ + GP_ASSERT_SYSTEM(false); + } + else + { + { + pevt->arg = arg; + } + pevt->func.callbackarg = callback; + pevt->RemainderInSeconds = RemainderInSeconds; + if (scheduleAbsTime) + { + Sched_RescheduleEventAbs(time, pevt); + } + else + { + Sched_RescheduleEvent( time, pevt); + } + + } +} + +void Sched_ReleaseEventBody(gpSched_Event_t* pevt ) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + // Free event (Unlink has been done by GetEvent) + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventFree_p); + gpUtils_LLFree(pevt, sched_globals->gpSched_EventFree_p); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventFree_p); +} + + + +/* +* @brief Returns time untill next event (in microseconds) compared with the gpSched_GoToSleepTreshold. +*/ +UInt32 Sched_GetEventIdlePeriod (void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + UInt32 idleTime = HAL_SLEEP_INDEFINITE_SLEEP_TIME; + + gpSched_Event_t* pevt; + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = (gpSched_Event_t*)gpUtils_LLGetFirstElem(sched_globals->gpSched_EventList_p); + if (pevt) + { + if(sched_globals->gpSched_GoToSleepTreshold == GP_SCHED_NO_EVENTS_GOTOSLEEP_THRES) //Only sleep if no events are pending + { + idleTime = 0; + } + else + { + UInt32 time_now; + HAL_TIMER_GET_CURRENT_TIME_1US(time_now); + + if(GP_SCHED_TIME_COMPARE_BIGGER(pevt->time,(time_now + sched_globals->gpSched_GoToSleepTreshold))) + { + idleTime = GP_SCHED_GET_TIME_DIFF(time_now, pevt->time); + } + else + { + idleTime = 0; + } + } + } + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + + return (idleTime); +} + + +STATIC_FUNC gpSched_Event_t* Sched_GetEvent(void) +{ + gpSched_Event_t* pevt = NULL; + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = (gpSched_Event_t*)gpUtils_LLGetFirstElem(sched_globals->gpSched_EventList_p); + if(pevt) + { + UInt32 time_now; + //Check the eventList for overdue events + HAL_TIMER_GET_CURRENT_TIME_1US(time_now); + + if (GP_SCHED_TIME_COMPARE_BIGGER_EQUAL (time_now, pevt->time)) + { + gpUtils_LLUnlink(pevt, sched_globals->gpSched_EventList_p); + } + else + { + pevt = NULL; + } + } + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + return pevt; +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpSched_Init(void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + // Inititialize event lists + gpSched_InitExtramData(); //Initialize free list and event data buffer + gpUtils_LLClear(sched_globals->gpSched_EventList_p); + + sched_globals->gpSched_GoToSleepTreshold = GP_SCHED_DEFAULT_GOTOSLEEP_THRES; + + + sched_globals->gpSched_GoToSleepDisableCounter = 0; // Enable GotoSleep by default + sched_globals->gpSched_cbGotoSleepCheck = NULL; + Sched_Integration_Init(); +} //gpSched_init + +void gpSched_DeInit(void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpUtils_LLDeInit(sched_globals->gpSched_EventList_p); + gpUtils_LLDeInitFree(sched_globals->gpSched_EventFree_p); + + Sched_Integration_DeInit(); +} + +void gpSched_StartTimeBase( void ) +{ + //Startup sync timer + + HAL_DISABLE_GLOBAL_INT(); + + //init the timer1 + HAL_TIMER_START( 0 ); + HAL_ENABLE_GLOBAL_INT(); +} + +UInt32 gpSched_GetCurrentTime( void ) +{ + // This function should not be called from an interrupt service routine, + // since it uses atomic_on/off, and this can cause unwanted nested interrupt + // service routines; instead, HAL_TIMER_GET_CURRENT_TIME_1US() should be used in such cases + UInt32 time; + + HAL_TIMER_GET_CURRENT_TIME_1US( time ); + + return time; +} + +Bool gpSched_TimeCompareLower (UInt32 n_time1, UInt32 n_time2) +{ + return GP_SCHED_TIME_COMPARE_LOWER(n_time1,n_time2); +} + +void gpSched_Clear( void ) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + while(sched_globals->gpSched_EventList_p->plnk_last) + { + gpSched_Event_t* pevt; + + pevt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(sched_globals->gpSched_EventList_p->plnk_last); + GP_LOG_SYSTEM_PRINTF("event %p",2, pevt->func.callback); + gpUtils_LLUnlink(pevt, sched_globals->gpSched_EventList_p); + Sched_ReleaseEventBody(pevt); + } + + + sched_globals->gpSched_GoToSleepDisableCounter = 0; // Enable GotoSleep by default + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); +} + +Bool gpSched_EventQueueEmpty( void ) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + Bool Empty; + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + Empty = (!sched_globals->gpSched_EventList_p->plnk_first); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + return Empty; +} + +void gpSched_ScheduleEventArg(UInt32 rel_time, gpSched_EventCallback_t callback, void* arg) +{ + gpSched_globals_t* sched_globals; + GP_ASSERT_SYSTEM((rel_time <= GP_SCHED_EVENT_TIME_MAX) || (rel_time == GP_SCHED_EVENT_TIME_NOW)); +#ifdef GP_DIVERSITY_FREERTOS + if(gpSched_ScheduleEventDeferred(rel_time, callback, arg)) + { + return; + } +#endif + sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + + Sched_ScheduleEvent(rel_time , callback , arg, 0, false); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); +} + +void gpSched_ScheduleEvent(UInt32 rel_time, void_func callback ) +{ + gpSched_ScheduleEventArg(rel_time,(gpSched_EventCallback_t)callback, NULL); +} + +Bool gpSched_UnscheduleEventArg(gpSched_EventCallback_t callback, void* arg) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpSched_Event_t* pevt; + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = Sched_FindEventArg(sched_globals->gpSched_EventList_p, callback, arg, true); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + return pevt?true:false; +} + +Bool gpSched_ExistsEventArg(gpSched_EventCallback_t callback, void* arg) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpSched_Event_t* pevt; + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = Sched_FindEventArg(sched_globals->gpSched_EventList_p,callback, arg, false); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + return pevt?true:false; +} + +STATIC_FUNC UInt32 Sched_GetRemainingTime(gpSched_Event_t* pevt, UInt32* sec) +{ + UInt32 RemainderInSec = 0xffffffff; + UInt32 RemainderInUs = 0xffffffff; + + if(pevt) + { + UInt32 time_now; + HAL_TIMER_GET_CURRENT_TIME_1US(time_now); + + if(GP_SCHED_TIME_COMPARE_BIGGER_EQUAL(pevt->time, time_now)) + { + RemainderInUs = GP_SCHED_GET_TIME_DIFF(time_now, pevt->time); + } + else + { + RemainderInUs = 0; + } + RemainderInSec = pevt->RemainderInSeconds; + } + if(sec) + { + *sec = RemainderInSec; + *sec += (RemainderInUs / 1000000); + RemainderInUs = RemainderInUs % 1000000; + } + + GP_LOG_PRINTF("delta %u evt %u cb 0x%lx",10, RemainderInUs, pevt->time,(UIntPtr) pevt->func.callback); + + return RemainderInUs; +} + +UInt32 gpSched_GetRemainingTimeArg(gpSched_EventCallback_t callback, void* arg) +{ + return gpSched_GetRemainingTimeArgInSecAndUs(callback, arg, NULL); +} + +UInt32 gpSched_GetRemainingTimeArgInSecAndUs(gpSched_EventCallback_t callback, void* arg, UInt32* sec) +{ + gpSched_Event_t* pevt=NULL; + UInt32 remainingTime = 0xffffffff; + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = Sched_FindEventArg(sched_globals->gpSched_EventList_p, callback, arg, false); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + + remainingTime = Sched_GetRemainingTime(pevt, sec); + + return remainingTime; +} + +gpSched_Event_t* Sched_FindEventArg(gpUtils_LinkList_t* plst , gpSched_EventCallback_t callback, void* arg, Bool unscheduleWhenFound) +{ + gpUtils_Link_t* plnk; + for (plnk = plst->plnk_first;plnk;plnk = plnk->plnk_nxt) + { + gpSched_Event_t* pevt; + pevt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(plnk); + //using (arg == NULL) as wildcard + + if ((pevt->func.callbackarg == callback) && ((pevt->arg == arg) || (arg == NULL))) + { + if (unscheduleWhenFound) + { + gpUtils_LLUnlink (pevt, plst); + Sched_ReleaseEventBody(pevt); + } + return pevt; + } + } + + return NULL; +} + +Bool gpSched_UnscheduleEvent(void_func callback) +{ + return gpSched_UnscheduleEventArg((gpSched_EventCallback_t)callback, NULL); +} + +Bool gpSched_ExistsEvent(void_func callback) +{ + return gpSched_ExistsEventArg((gpSched_EventCallback_t)callback, NULL); +} + +UInt32 gpSched_GetRemainingTime(void_func callback) +{ + return gpSched_GetRemainingTimeArg((gpSched_EventCallback_t)callback,NULL); +} + +void gpSched_ScheduleEventInSeconds (UInt32 delayInSec, gpSched_EventCallback_t callback, void* arg) +{ + Sched_ScheduleEventInSeconds(delayInSec, 0, false, 0, callback, arg); +} +void gpSched_ScheduleEventInSecAndUs(UInt32 delayInSec, UInt32 delayInUs, gpSched_EventCallback_t callback, void* arg) +{ + Sched_ScheduleEventInSeconds(delayInSec, delayInUs, false, 0, callback, arg); +} + +STATIC_FUNC void Sched_ScheduleEventInSeconds(UInt32 delayInSec, UInt32 delayInUs, Bool reScheduling, UInt32 prevDeadline, gpSched_EventCallback_t callback, void* arg) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + UInt32 RemainderInUs = delayInUs % 1000000; + UInt32 RemainderInSec = delayInSec + (delayInUs / 1000000); + UInt32 NextIntervalInSec; + const Bool scheduleAbsTime = reScheduling; + + if(RemainderInSec > GP_SCHED_DISTANTEVENTS_INTERVAL) + { + NextIntervalInSec = GP_SCHED_DISTANTEVENTS_INTERVAL; + RemainderInSec -= GP_SCHED_DISTANTEVENTS_INTERVAL; + } + else + { + NextIntervalInSec = RemainderInSec; + RemainderInSec = 0; + } + + RemainderInUs += NextIntervalInSec * 1000000; + + if (reScheduling) { + RemainderInUs += prevDeadline; + } + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + Sched_ScheduleEvent( + RemainderInUs, + callback, + arg, + RemainderInSec, + scheduleAbsTime + ); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); +} + + + + +/* +* @brief Returns time to sleep (in microseconds). +* Will return 0 if no sleep is permitted at this point (pending actions, idle time below threshold) +*/ +UInt32 Sched_CanGoToSleep(void) +{ + UInt32 result = 0; + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + HAL_DISABLE_GLOBAL_INT(); + result = Sched_GetEventIdlePeriod(); + + if (sched_globals->gpSched_GoToSleepDisableCounter || + (sched_globals->gpSched_cbGotoSleepCheck && !sched_globals->gpSched_cbGotoSleepCheck())) + { +#ifdef GP_SCHED_FREE_CPU_TIME +/* Even when sleep is disabled, sleep for GP_SCHED_FREE_CPU_TIME */ + if(result > GP_SCHED_FREE_CPU_TIME) + { + result = GP_SCHED_FREE_CPU_TIME; + } +#else + result = 0; +#endif //GP_SCHED_FREE_CPU_TIME + } + +#if defined(GP_COMP_COM) && !defined(TBC_GPCOM) + if (SCHED_APP_DIVERSITY_COM() && !SCHED_APP_DIVERSITY_COM_NO_RX()) + { + //overrule if pending RX data on COM + if(gpCom_IsReceivedPacketPending()) + { + result = 0; + } + } +#endif //defined(GP_COMP_COM) && !defined(GP_COM_DIVERSITY_NO_RX) + +#if defined(GP_COMP_COM) && !defined(TBC_GPCOM) + if (SCHED_APP_DIVERSITY_COM()) + { + //overrule if pending TX data on COM + if(gpCom_TXDataPending()) + { + result = 0; + } + } +#endif //defined(GP_COMP_COM) && !defined(GP_COM_DIVERSITY_NO_RX) + + /* the radio is on a FD, so it is also checked in hal_HandleFds, except for halLinux/hal_noradio.c */ + if (hal_HandleFds(false)) + { + result = 0; + } +#if !defined(HAL_LINUX_DIVERSITY_INTERRUPT_WAKES_IOTHREAD) + //Don't go to sleep when Radio interrupt is pending + if(HAL_RADIO_INT_CHECK_IF_OCCURED()) + { + result = 0; + } +#endif + + + +// FIXME: should implement this callback also for other chipemu variants. + + HAL_ENABLE_GLOBAL_INT(); + + + return result; +} + +/* +* @brief Goes to sleep if able. Flushes com, stops timers, ... +*/ +void gpSched_GoToSleep( void ) +{ + if (SCHED_APP_DIVERSITY_SLEEP()) + { + UInt32 timeTosleep; + + timeTosleep = Sched_CanGoToSleep(); + if (timeTosleep) + { + + + HAL_DISABLE_GLOBAL_INT(); + // Disable unneeded interrupts + HAL_TIMER_STOP(); // Re-enabled by TIMER_RESTART() + + HAL_ENABLE_SLEEP_UC(); + HAL_ENABLE_GLOBAL_INT(); + + while (true) + { + timeTosleep = Sched_CanGoToSleep(); + if(timeTosleep == 0) + { + break; + } + HAL_SLEEP_UC_1US(timeTosleep); + HAL_ENABLE_SLEEP_UC(); + } + + // Restart timer of uC without initialization + // Note: if we have a HAL that supports going to sleep while an event is pending, + // we have to forward the time of the scheduler when a new event is scheduled from an ISR or + // when we wake-up to execute the pending event. + HAL_TIMER_RESTART(); + } + } +} + +void gpSched_SetGotoSleepEnable( Bool enable ) +{ +#if !defined(GP_FREERTOS_DIVERSITY_SLEEP) + if (SCHED_APP_DIVERSITY_SLEEP()) + { + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + //gpSched_GoToSleepEnable = enable; + HAL_DISABLE_GLOBAL_INT(); + if (enable) + { + GP_ASSERT_DEV_EXT(sched_globals->gpSched_GoToSleepDisableCounter); + sched_globals->gpSched_GoToSleepDisableCounter--; + } + else + { + sched_globals->gpSched_GoToSleepDisableCounter++; + } + HAL_ENABLE_GLOBAL_INT(); + } +#else // GP_SCHED_DIVERSITY_SLEEP + NOT_USED(enable); +#endif // GP_SCHED_DIVERSITY_SLEEP +} + + +/***************************************************************************** + * Main function + *****************************************************************************/ + +void gpSched_Main_Body(void) +{ + gpSched_Event_t* pevt; + + + + // Check stack before event (after coming from sleep) + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); + + GP_ASSERT_DEV_EXT(HAL_GLOBAL_INT_ENABLED()); + + HAL_WDT_RESET(); + + /* service radio before hal_HandleFds */ + // Handle radio interrupts +#if !defined(HAL_LINUX_DIVERSITY_INTERRUPT_WAKES_IOTHREAD) + HAL_RADIO_INT_EXEC_IF_OCCURED(); +#endif + GP_UTILS_CPUMON_PROCDONE(RADIO_INT); + /* the radio will be serviced again if possible, since it is in the list of FD's! */ + (void)hal_HandleFds(true); + +#if defined(GP_COMP_COM) && !defined(TBC_GPCOM) + if (SCHED_APP_DIVERSITY_COM()) + { + // Handle non-interrupt driven actions from gpCom + gpCom_HandleTx(); + if (!SCHED_APP_DIVERSITY_COM_NO_RX()) + { + gpCom_HandleRx(); + } + GP_UTILS_CPUMON_PROCDONE(GPCOMTXRX); + } +#endif //GP_COMP_COM + + // Handle events + pevt = Sched_GetEvent(); + SCHED_MAIN_BODY( pevt ); + if (pevt) // get event + { + GP_ASSERT_DEV_EXT(HAL_GLOBAL_INT_ENABLED()); + //GP_LOG_SYSTEM_PRINTF("sched: %08lx",0, pevt->func.callback); + if (pevt->RemainderInSeconds) { + Sched_ScheduleEventInSeconds(pevt->RemainderInSeconds, 0, true, pevt->time, pevt->func.callbackarg, pevt->arg); + } else + { + Sched_ExecEvent(pevt); + } + + // check stack after event + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); + + if (!HAL_GLOBAL_INT_ENABLED()) + { + GP_LOG_PRINTF("AtomF %p",2,pevt->func.callback); + GP_ASSERT_DEV_EXT(HAL_GLOBAL_INT_ENABLED()); + } + Sched_ReleaseEvent(pevt); // release event + // check stack after event release + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); + GP_UTILS_CHECK_STACK_USAGE(); + } + GP_UTILS_CPUMON_PROCDONE(SCHEDEVENT); + +#ifdef GP_COMP_CHIPEMU + gpChipEmu_RunEmu(); +#endif // GP_COMP_CHIPEMU + + GP_ASSERT_DEV_EXT(HAL_GLOBAL_INT_ENABLED()); +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c new file mode 100644 index 0000000..43f972a --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + */ + +/** + * @file gpSched_il.c + * @brief GP Scheduler integration layer implementation + * + * This file implements the for gpSched integration layer interface APIs + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_SCHED + +#include "hal.h" +#include "gpLog.h" +#include "gpUtils.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpSched_defs.h" + +/***************************************************************************** + * External Function Prototypes + *****************************************************************************/ + +extern void Application_Init( void ); +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +#ifndef GP_SCHED_EXTERNAL_MAIN +void gpSched_Main_Init(void) +{ + HAL_INITIALIZE_GLOBAL_INT(); + + // Hardware initialization + HAL_INIT(); + + // Radio interrupts that occur will only be handled later on in the main loop + // Other interrupt source do not trigger any calls to blocks that are not initialized yet + HAL_ENABLE_GLOBAL_INT(); + + Application_Init(); + + GP_UTILS_DUMP_STACK_POINTER(); + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); +} +#endif + +#ifndef GP_SCHED_EXTERNAL_MAIN +MAIN_FUNCTION_RETURN_TYPE MAIN_FUNCTION_NAME(void) +{ + //the line below destroys the stack. so don't call it from a function! + GP_UTILS_INIT_STACK(); + gpSched_Main_Init(); + GP_UTILS_CPUMON_INIT(); + for (;;) + { + GP_UTILS_CPUMON_NEW_SCHEDULER_LOOP(); + /* The scheduler task flag serves to notice events scheduled + * asynchronously, we clear it now to avoid dropping out of sleep + * immediately since CanGoToSleep will consider these events created up + * until now. */ + hal_ClearWakeUpEvent(); + // Check if the system can go to sleep + gpSched_GoToSleep(); + gpSched_Main_Body(); + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 + /* When new work can be indicated to an external stack/scheduler at many locations in our stack it is + * easier and less error-prone to service that stack here than at all these different code locations. + * Continuously rescheduling a handler event is not a good alternative because this prohibits sleeping. */ + /* Call all registered post processing callbacks*/ + gpSched_PostProcessIdle(); + GP_UTILS_CPUMON_PROCDONE(POSTPROCESSING); +#endif /* GP_SCHED_NR_OF_IDLE_CALLBACKS > 0*/ + } + + return MAIN_FUNCTION_RETURN_VALUE; +} +#endif + + +/* + * @brief Wake up a sleeping scheduler thread + * + * This function can used to wake up a sleeping scheduler thread. + */ +void gpSched_NotifySchedTask(void) +{ + hal_WakeEventloop(); +} + +void Sched_Integration_Init(void) +{ +} + +void Sched_Integration_DeInit(void) +{ +} + +void gpSched_Trigger(void) +{ + hal_WakeEventloop(); +} diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_clientServerCmdId.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_clientServerCmdId.h new file mode 100644 index 0000000..e6b34e0 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_clientServerCmdId.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpVersion_clientServerCmdId.h" + * + * GPVERSION + * + * Client Server Link Command IDs +*/ + +#ifndef _GPVERSION_CLIENTSERVERCMDID_H_ +#define _GPVERSION_CLIENTSERVERCMDID_H_ + +/***************************************************************************** + * Common timeout + *****************************************************************************/ + +#ifndef GPVERSION_GPCOMTIMEOUT_US +#define GPVERSION_GPCOMTIMEOUT_US 10000000UL //10s +#endif //GPVERSION_GPCOMTIMEOUT_US + +/***************************************************************************** + * Component Specific Command IDs + *****************************************************************************/ + +#define Version_ExchangeGlobalVersion_CmdId 0x02 /*02*/ +#define Version_NegotiateModuleVersion_CmdId 0x03 /*03*/ + +/***************************************************************************** + * Fixed Command IDs + *****************************************************************************/ + +#define gpVersion_Acknowledge_CmdId 0xfe /*254*/ +#define gpVersion_GetServerCompatibilityNumber_CmdId 0xfd /*253*/ + +#endif //_GPVERSION_CLIENTSERVERCMDID_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_marshalling.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_marshalling.h new file mode 100644 index 0000000..559c47f --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_marshalling.h @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPVERSION_MARSHALLING_H_ +#define _GPVERSION_MARSHALLING_H_ + +//DOCUMENTATION VERSION: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpVersion.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpVersion_ReleaseInfo_t data[1]; +} gpVersion_ReleaseInfo_t_l1_pointer_marshall_t; + +typedef struct { + gpVersion_ReleaseInfo_t data[6]; +} gpVersion_ReleaseInfo_t_l6_pointer_marshall_t; + + +typedef struct { + gpVersion_SoftwareInfo_t data[1]; +} gpVersion_SoftwareInfo_t_l1_pointer_marshall_t; + + + +typedef struct { + gpVersion_ReleaseInfo_t clientInfo; +} Version_ExchangeGlobalVersion_Input_struct_t; + +typedef struct { + Version_ExchangeGlobalVersion_Input_struct_t data; + gpVersion_ReleaseInfo_t_l1_pointer_marshall_t clientInfo; +} Version_ExchangeGlobalVersion_Input_marshall_struct_t; + +typedef struct { + gpVersion_VersionStatusResult_t result; + gpVersion_ReleaseInfo_t* serverInfo; +} Version_ExchangeGlobalVersion_Output_struct_t; + +typedef struct { + Version_ExchangeGlobalVersion_Output_struct_t data; + gpVersion_ReleaseInfo_t_l1_pointer_marshall_t serverInfo; +} Version_ExchangeGlobalVersion_Output_marshall_struct_t; + + +typedef struct { + UInt8 moduleId; + UInt8 nrOfClientVersions; + gpVersion_ReleaseInfo_t* pClientVersions; +} Version_NegotiateModuleVersion_Input_struct_t; + +typedef struct { + Version_NegotiateModuleVersion_Input_struct_t data; + gpVersion_ReleaseInfo_t_l6_pointer_marshall_t pClientVersions; +} Version_NegotiateModuleVersion_Input_marshall_struct_t; + +typedef struct { + gpVersion_VersionStatusResult_t result; + gpVersion_ReleaseInfo_t* serverInfo; +} Version_NegotiateModuleVersion_Output_struct_t; + +typedef struct { + Version_NegotiateModuleVersion_Output_struct_t data; + gpVersion_ReleaseInfo_t_l1_pointer_marshall_t serverInfo; +} Version_NegotiateModuleVersion_Output_marshall_struct_t; + + +typedef struct { + gpVersion_VersionStatusResult_t result; +} gpVersion_ExchangeCompatibility_Output_struct_t; + +typedef struct { + gpVersion_ExchangeCompatibility_Output_struct_t data; +} gpVersion_ExchangeCompatibility_Output_marshall_struct_t; + + + +typedef union { + Version_ExchangeGlobalVersion_Input_marshall_struct_t Version_ExchangeGlobalVersion; + Version_NegotiateModuleVersion_Input_marshall_struct_t Version_NegotiateModuleVersion; + UInt8 dummy; //ensure none empty union definition +} gpVersion_Server_Input_union_t; + +typedef union { + Version_ExchangeGlobalVersion_Output_marshall_struct_t Version_ExchangeGlobalVersion; + Version_NegotiateModuleVersion_Output_marshall_struct_t Version_NegotiateModuleVersion; + gpVersion_ExchangeCompatibility_Output_marshall_struct_t gpVersion_ExchangeCompatibility; + UInt8 dummy; //ensure none empty union definition +} gpVersion_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpVersion_VersionNumber_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpVersion_VersionNumber_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpVersion_VersionNumber_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpVersion_VersionNumber_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpVersion_VersionStatusResult_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpVersion_VersionStatusResult_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpVersion_VersionStatusResult_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpVersion_VersionStatusResult_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +gpMarshall_AckStatus_t gpVersion_ReleaseInfo_t_buf2api(gpVersion_ReleaseInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpVersion_ReleaseInfo_t_api2buf(UInt8Buffer* pDest , const gpVersion_ReleaseInfo_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpVersion_SoftwareInfo_t_buf2api(gpVersion_SoftwareInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpVersion_SoftwareInfo_t_api2buf(UInt8Buffer* pDest , const gpVersion_SoftwareInfo_t* pSource , UInt16 length , UInt16* pIndex); +// Server functions +gpMarshall_AckStatus_t Version_ExchangeGlobalVersion_Input_buf2api(Version_ExchangeGlobalVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void Version_ExchangeGlobalVersion_Output_api2buf(UInt8Buffer* pDest , Version_ExchangeGlobalVersion_Output_marshall_struct_t* pSourceoutput , Version_ExchangeGlobalVersion_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t Version_NegotiateModuleVersion_Input_buf2api(Version_NegotiateModuleVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void Version_NegotiateModuleVersion_Output_api2buf(UInt8Buffer* pDest , Version_NegotiateModuleVersion_Output_marshall_struct_t* pSourceoutput , Version_NegotiateModuleVersion_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpVersion_ExchangeCompatibility_Output_api2buf(UInt8Buffer* pDest , gpVersion_ExchangeCompatibility_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); + +// Client functions +void Version_ExchangeGlobalVersion_Input_par2buf(UInt8Buffer* pDest , gpVersion_ReleaseInfo_t clientInfo , UInt16* pIndex); +void Version_ExchangeGlobalVersion_Output_buf2par(gpVersion_VersionStatusResult_t* result , gpVersion_ReleaseInfo_t clientInfo , gpVersion_ReleaseInfo_t* serverInfo , UInt8Buffer* pSource , UInt16* pIndex); +void Version_NegotiateModuleVersion_Input_par2buf(UInt8Buffer* pDest , UInt8 moduleId , UInt8 nrOfClientVersions , gpVersion_ReleaseInfo_t* pClientVersions , UInt16* pIndex); +void Version_NegotiateModuleVersion_Output_buf2par(gpVersion_VersionStatusResult_t* result , UInt8 moduleId , UInt8 nrOfClientVersions , gpVersion_ReleaseInfo_t* pClientVersions , gpVersion_ReleaseInfo_t* serverInfo , UInt8Buffer* pSource , UInt16* pIndex); +void gpVersion_ExchangeCompatibility_Output_buf2par(gpVersion_VersionStatusResult_t* result , UInt8Buffer* pSource , UInt16* pIndex); + +void gpVersion_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPVERSION_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/inc/gpVersion.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/inc/gpVersion.h new file mode 100644 index 0000000..ee74795 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/inc/gpVersion.h @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_VERSION_H_ +#define _GP_VERSION_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_DIVERSITY_NR_OF_STACKS +#define GP_DIVERSITY_NR_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS + +#define GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE (8*GP_DIVERSITY_NR_OF_STACKS) +#define GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE 6 + +#define GP_VERSION_VERSION_FLATTEN(v) (((UInt32)((v).major) << 24) | ((UInt32)((v).minor) << 16) | ((UInt32)((v).revision) << 8) | ((v).patch)) +#define GP_VERSION_VERSIONS_EQUAL(v1, v2) ((v1).major == (v2).major && (v1).minor == (v2).minor && (v1).revision == (v2).revision && (v1).patch == (v2).patch) +#define GP_VERSION_VERSIONS_SMALLER(v1, v2) (GP_VERSION_VERSION_FLATTEN(v1) < GP_VERSION_VERSION_FLATTEN(v2)) +#define GP_VERSION_VERSIONS_GREATER(v1, v2) (GP_VERSION_VERSION_FLATTEN(v1) > GP_VERSION_VERSION_FLATTEN(v2)) + +#define GP_VERSION_MODULE_ID_INVALID 0xFF +#define GP_VERSION_VERSION_INDEX_INVALID 0xFF + +#define GP_VERSION_MAKE_VERSION_STRING_FROM_PARTS(major,minor,revision,patch,cl) \ + #major "." #minor "." #revision "." #patch " - CL" #cl +#define GP_VERSION_MAKE_VERSION_STRING(version,cl) GP_VERSION_MAKE_VERSION_STRING_FROM_PARTS(version,cl) +#define GP_VERSION_STRING GP_VERSION_MAKE_VERSION_STRING(GP_VERSIONINFO_GLOBAL_VERSION,GP_CHANGELIST) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +#define gpVersion_CompatibilityResultCompatible 0 +#define gpVersion_CompatibilityResultMaybeCompatible 1 +#define gpVersion_CompatibilityResultNotCompatible 2 +#define gpVersion_CompatibilityResultInvalidParameter 0xFF +typedef UInt8 gpVersion_VersionStatusResult_t; + +typedef UInt8 gpVersion_VersionNumber_t; + +// defines release version +typedef struct { + gpVersion_VersionNumber_t major; + gpVersion_VersionNumber_t minor; + gpVersion_VersionNumber_t revision; + gpVersion_VersionNumber_t patch; +} gpVersion_ReleaseInfo_t; + +// defines software information +typedef struct { + gpVersion_ReleaseInfo_t version; + UInt8 ctrl; + UInt8 reserved; + UInt16 number; + UInt32 changeList; +} gpVersion_SoftwareInfo_t; + +typedef struct { + gpVersion_ReleaseInfo_t versions[GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE]; +} gpVersion_ModuleVersions_t; + +// callback structure for all modules +typedef struct { + UInt32 commId; + UInt8 moduleId; + UInt8 nrOfVersions; + UInt8 selectedVersionIndex; + gpVersion_ReleaseInfo_t versionInfo[GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE]; +} gpVersion_ModuleVersionInfo_t; + +// callback type for wrappers +typedef void (*gpVersion_cbSetModuleVersion_t)(gpVersion_ModuleVersionInfo_t* moduleVersionInfo); + +// structure that contains all useful module information +typedef struct { + gpVersion_ModuleVersionInfo_t moduleVersionInfo; + gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion; +} gpVersion_ModuleInfo_t; + +typedef struct { + UInt32 commId; + UInt8 moduleId; + gpVersion_ReleaseInfo_t version; +} gpVersion_ClientVersionMapping_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +void gpVersion_Init(void); + +/** @brief Return the compile-time application version number. + * @param[out] swVersion Buffer to hold version number. + */ +void gpVersion_GetSoftwareVersion(gpVersion_ReleaseInfo_t* swVersion); + +/** @brief Return software information, including application version number and changelist number. + * @param[out] swInfo Buffer to hold software information. + */ +void gpVersion_GetSoftwareInfo(gpVersion_SoftwareInfo_t* swInfo); + +/** @brief Return the compile-time BaseComps version number. + * @param[out] pVersion Buffer to hold version number. + */ +void gpVersion_GetBaseCompsVersion(gpVersion_ReleaseInfo_t* pVersion); + +// for backward compatibility +#define gpVersion_GetBcVersion gpVersion_GetBaseCompsVersion + +/** @brief Return the compile-time Components/Qorvo/BleController version number. + * @param[out] pVersion Buffer to hold version number. + */ +void gpVersion_GetBleControllerVersion(gpVersion_ReleaseInfo_t* pVersion); + + + + +/** @brief Function to fetch NRT ROM version + * @return ROM version number. Returns 0xFF when no valid ROM is found. Returns 0 if no ROM code is used. + */ +UInt8 gpVersion_GetNrtRomVersion(void); + +/** @brief Function to get minimal Matter ROM version needed + * @return ROM version number. Returns 0 if no Matter ROM code is used. + */ +UInt8 gpVersion_GetMinimalMatterRomVersion(void); + +/** @brief Function to fetch Matter ROM version + * @return ROM version number. Returns 0xFF when no valid ROM is found. Returns 0 if no Matter ROM code is used. + */ +UInt8 gpVersion_GetMatterRomVersion(void); + +UInt32 gpVersion_GetChangelist(void); + +/** @brief Register a module to the version administration. + * + * This function is only available in client/server applications. + * It should be called for each module used accross the client/server barrier. + * This function is typically called by the clientwrapper/serverwrapper code + * of the corresponding module. + * + * @param moduleId GP_MODULE_ID of the module to be registered + * @param versions Array of API versions supported for this module, preferred version first. + * @param nrOfVersions Number of valid array elements in @a versions + * @param cbSetModuleApiVersion Function to be called when an API version is selected + */ +void gpVersion_RegisterModule(UInt8 moduleId, gpVersion_ReleaseInfo_t* versions, UInt8 nrOfVersions, gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion); + +/** @brief De-register a module to the version administration. + * + * This function is only available in client/server applications. + * It should be called for each module used accross the client/server barrier. + * This function is typically called by the clientwrapper/serverwrapper code + * of the corresponding module. + * + * @param moduleId GP_MODULE_ID of the module to be de-registered + */ +void gpVersion_DeRegisterModule(UInt8 moduleId); + + +/* Dump Functions */ +void gpVersion_DumpVersion(gpVersion_ReleaseInfo_t swVersion); +void gpVersion_DumpModuleMapping(void); + + +/** @brief Exchange version numbers and negotiate API compatibility between client and server. + * + * This function is only available in client applications. + * It should be called once at the start of the application, as early as + * possible after component initialization. + * + * @return gpVersion_CompatibilityResultCompatible if all modules are compatible with the server API + * @return gpVersion_CompatibilityResultNotCompatible if some modules are incompatible with the server API +*/ +gpVersion_VersionStatusResult_t gpVersion_ExchangeCompatibility(void); + +/** @brief Return server version number. + * + * This function is only available in client applications. + * It may be called after gpVersion_ExchangeCompatibility to obtain the + * server application version number. + * + * @param[out] serverVersion Buffer to hold version number. + */ +void gpVersion_GetServerVersion(gpVersion_ReleaseInfo_t* serverVersion); + +//for backward compatibility - prefered to use gpVersion_ExchangeCompatibility() +gpVersion_VersionStatusResult_t gpVersion_ExchangeGlobalVersion(gpVersion_ReleaseInfo_t clientInfo, gpVersion_ReleaseInfo_t* serverInfo); + + +#ifdef __cplusplus +} +#endif + +#endif // _GP_VERSION_H_ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c new file mode 100644 index 0000000..ff44f39 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpVersion_marshalling.c" + * + * GPVERSION + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpVersion.h" +#include "gpVersion_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpVersion_ReleaseInfo_t_buf2api(gpVersion_ReleaseInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpVersion_VersionNumber_t_buf2api_1(&(pDest->major), pSource, pIndex); + gpVersion_VersionNumber_t_buf2api_1(&(pDest->minor), pSource, pIndex); + gpVersion_VersionNumber_t_buf2api_1(&(pDest->revision), pSource, pIndex); + gpVersion_VersionNumber_t_buf2api_1(&(pDest->patch), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpVersion_ReleaseInfo_t_api2buf(UInt8Buffer* pDest , const gpVersion_ReleaseInfo_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpVersion_VersionNumber_t_api2buf_1(pDest , &(pSource->major), pIndex); + gpVersion_VersionNumber_t_api2buf_1(pDest , &(pSource->minor), pIndex); + gpVersion_VersionNumber_t_api2buf_1(pDest , &(pSource->revision), pIndex); + gpVersion_VersionNumber_t_api2buf_1(pDest , &(pSource->patch), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpVersion_SoftwareInfo_t_buf2api(gpVersion_SoftwareInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpVersion_ReleaseInfo_t_buf2api(&(pDest->version), pSource, 1, pIndex); + UInt8_buf2api_1(&(pDest->ctrl), pSource, pIndex); + UInt8_buf2api_1(&(pDest->reserved), pSource, pIndex); + UInt16_buf2api_1(&(pDest->number), pSource, pIndex); + UInt32_buf2api_1(&(pDest->changeList), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpVersion_SoftwareInfo_t_api2buf(UInt8Buffer* pDest , const gpVersion_SoftwareInfo_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpVersion_ReleaseInfo_t_api2buf(pDest , &(pSource->version), 1, pIndex); + UInt8_api2buf_1(pDest , &(pSource->ctrl), pIndex); + UInt8_api2buf_1(pDest , &(pSource->reserved), pIndex); + UInt16_api2buf_1(pDest , &(pSource->number), pIndex); + UInt32_api2buf_1(pDest , &(pSource->changeList), pIndex); + pSource++; + } +} + + +void gpVersion_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c new file mode 100644 index 0000000..8154624 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpVersion_marshalling_client.c" + * + * GPVERSION + * + * Marshalling structures and functions +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpVersion.h" +#include "gpVersion_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void Version_ExchangeGlobalVersion_Input_par2buf(UInt8Buffer* pDest , gpVersion_ReleaseInfo_t clientInfo , UInt16* pIndex) +{ + gpVersion_ReleaseInfo_t_api2buf(pDest, &(clientInfo), 1, pIndex); +} + +void Version_ExchangeGlobalVersion_Output_buf2par(gpVersion_VersionStatusResult_t* result , gpVersion_ReleaseInfo_t clientInfo , gpVersion_ReleaseInfo_t* serverInfo , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpVersion_VersionStatusResult_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(clientInfo); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpVersion_ReleaseInfo_t_buf2api(serverInfo , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } +} + +void Version_NegotiateModuleVersion_Input_par2buf(UInt8Buffer* pDest , UInt8 moduleId , UInt8 nrOfClientVersions , gpVersion_ReleaseInfo_t* pClientVersions , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(moduleId), pIndex); + UInt8_api2buf_1(pDest, &(nrOfClientVersions), pIndex); + pDest[(*pIndex)++] = (NULL == pClientVersions); + if (NULL != pClientVersions) + { + gpVersion_ReleaseInfo_t_api2buf(pDest, pClientVersions, nrOfClientVersions, pIndex); + } +} + +void Version_NegotiateModuleVersion_Output_buf2par(gpVersion_VersionStatusResult_t* result , UInt8 moduleId , UInt8 nrOfClientVersions , gpVersion_ReleaseInfo_t* pClientVersions , gpVersion_ReleaseInfo_t* serverInfo , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpVersion_VersionStatusResult_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(moduleId); + NOT_USED(nrOfClientVersions); + NOT_USED(pClientVersions); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpVersion_ReleaseInfo_t_buf2api(serverInfo , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c new file mode 100644 index 0000000..42e1c3d --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c @@ -0,0 +1,277 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpVersion_wrapper_client.c" + * + * GPVERSION + * + * Wrapper implementation +*/ + +/***************************************************************************** + * Includes Definition + *****************************************************************************/ + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpCom.h" +#include "gpModule.h" +#include "gpVersion_clientServerCmdId.h" +#include "gpVersion.h" +#include "gpVersion_marshalling.h" +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +#include "gpVersion.h" +#endif +/* AdditionalIncludes */ +#include "gpVersion_defs.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Functions Declaration + *****************************************************************************/ + +static void gpVersion_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId); +static void Version_HandleConnectionClose(gpCom_CommunicationId_t communicationId); + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION +#define GP_MODULE_ID GP_COMPONENT_ID + + +#ifndef GP_VERSION_COMM_ID +#define GP_VERSION_COMM_ID GP_COM_DEFAULT_COMMUNICATION_ID +#endif + +#define REGISTER_MODULE(handle) GP_COM_REGISTER_MODULE(handle) +#define DATA_REQUEST(len,buf,commId) GP_COM_DATA_REQUEST(len,buf,commId) +#define DATA_REQUEST_ACKED(len,buf,commId) gpCom_DataRequestAndWaitForAck(GP_MODULE_ID, len, buf, commId, &gpVersion_reqAcked, GPVERSION_GPCOMTIMEOUT_US, gpVersion_Acknowledge_CmdId) + +/* AdditionalMacros */ +#define gpVersion_ResultInvalidParameter gpVersion_CompatibilityResultInvalidParameter +/* AdditionalMacros */ +/***************************************************************************** + * Static Data + *****************************************************************************/ + +typedef union ackDataNeeded { + UInt8 dataBuf0[(1 + 1 + 1 + 1)+1]; +} ackDataNeeded_t; +static UInt8 gpVersion_ackBuffer[1 + 1 + 1 + sizeof(ackDataNeeded_t)]; +static Bool gpVersion_reqAcked; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +static Bool Version_clientApiVersionSelected = false; +#endif + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +static void Version_HandleConnectionClose(gpCom_CommunicationId_t communicationId) +{ +} + +static void gpVersion_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId) +{ +#define commandId pPayload[0] + UInt8 ackBuffer[1 + 1 + 1]; + UInt8 ackBytes = 0; /*No ack's on indication - fill in length when needed - 3+x */ + + if(pPayload == NULL) + { + Version_HandleConnectionClose(communicationId); + return; + } + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Version_clientApiVersionSelected); +#endif + + ackBuffer[0] = gpVersion_Acknowledge_CmdId; + ackBuffer[1] = gpMarshall_AckStatusSuccess; + ackBuffer[2] = commandId; + + switch(commandId) + { + + case gpVersion_Acknowledge_CmdId: + { + GP_ASSERT_SYSTEM(length <= sizeof(gpVersion_ackBuffer)); + MEMCPY(gpVersion_ackBuffer, pPayload, length); + gpVersion_reqAcked = true; + return; + } + default: + { + GP_ASSERT_DEV_INT(false); + break; + } + } +#undef commandId + if(0 < ackBytes) + { + DATA_REQUEST(ackBytes, ackBuffer, communicationId); + } +} +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +void gpVersion_SetDefaultApiVersion(gpVersion_ModuleVersionInfo_t* moduleVersionInfo) +{ + Version_clientApiVersionSelected = true; + //TBD +} +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + + +void gpVersion_DeInit(void) +{ +/* DeInit */ + Version_Init(); + Version_InitClient(); +/* DeInit */ + + gpCom_DeRegisterModule(GP_MODULE_ID); +} + +void gpVersion_Init(void) +{ +/* Init */ + Version_Init(); + Version_InitClient(); +/* Init */ + + gpVersion_InitMarshalling(); + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + gpVersion_ReleaseInfo_t versions[1] = {{2,0,0,0}}; + Version_clientApiVersionSelected = false; + gpVersion_RegisterModule(GP_MODULE_ID, versions,1,gpVersion_SetDefaultApiVersion); +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + REGISTER_MODULE(gpVersion_HandleIndicationClient); +} + +/***************************************************************************** + * gpVersion Require Functions + *****************************************************************************/ + +gpVersion_VersionStatusResult_t Version_ExchangeGlobalVersion(gpVersion_ReleaseInfo_t clientInfo, gpVersion_ReleaseInfo_t* serverInfo) +{ + UInt16 _index = 1; + gpVersion_VersionStatusResult_t result; + UInt8 dataBuf[1 + (1 + 1 + 1 + 1)]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Version_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = Version_ExchangeGlobalVersion_CmdId; + + Version_ExchangeGlobalVersion_Input_par2buf(dataBuf + , clientInfo + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_VERSION_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpVersion_ackBuffer[1]); + GP_ASSERT_SYSTEM(Version_ExchangeGlobalVersion_CmdId == gpVersion_ackBuffer[2]); + + _index = 3; + Version_ExchangeGlobalVersion_Output_buf2par( + &result + , clientInfo + , serverInfo + , gpVersion_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpVersion_ackBuffer)); + +#undef commandId + return result; +} + +gpVersion_VersionStatusResult_t Version_NegotiateModuleVersion(UInt8 moduleId, UInt8 nrOfClientVersions, gpVersion_ReleaseInfo_t* pClientVersions, gpVersion_ReleaseInfo_t* serverInfo) +{ + UInt16 _index = 1; + gpVersion_VersionStatusResult_t result; + UInt8 dataBuf[1 + 1 + 1 + 1 + 6*(1 + 1 + 1 + 1)]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Version_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = Version_NegotiateModuleVersion_CmdId; + + Version_NegotiateModuleVersion_Input_par2buf(dataBuf + , moduleId + , nrOfClientVersions + , pClientVersions + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_VERSION_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpVersion_ackBuffer[1]); + GP_ASSERT_SYSTEM(Version_NegotiateModuleVersion_CmdId == gpVersion_ackBuffer[2]); + + _index = 3; + Version_NegotiateModuleVersion_Output_buf2par( + &result + , moduleId + , nrOfClientVersions + , pClientVersions + , serverInfo + , gpVersion_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpVersion_ackBuffer)); + +#undef commandId + return result; +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c new file mode 100644 index 0000000..6177264 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2014-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +//#define GP_LOCAL_LOG + +#include "gpAssert.h" +#include "gpVersion.h" +#include "gpLog.h" +#include "gpVersion_defs.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static Bool Version_ExchangeDone; +static gpVersion_ReleaseInfo_t Version_ServerAppVersion; + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void Version_InitClient(void) +{ + Version_ExchangeDone = false; + MEMSET(&Version_ServerAppVersion, -1, sizeof(Version_ServerAppVersion)); +} + +static gpVersion_VersionStatusResult_t Version_ExchangeModuleCompatibility(UInt8 moduleIndex) +{ + gpVersion_VersionStatusResult_t moduleResult; + gpVersion_ReleaseInfo_t apiVersion; + + GP_ASSERT_DEV_EXT(moduleIndex < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE); + + moduleResult = Version_NegotiateModuleVersion(Version_ModuleMapping[moduleIndex].moduleVersionInfo.moduleId, + Version_ModuleMapping[moduleIndex].moduleVersionInfo.nrOfVersions, + Version_ModuleMapping[moduleIndex].moduleVersionInfo.versionInfo, + &apiVersion); + + GP_LOG_PRINTF("Mod 0x%x r%i v%i.%i.%i.%i", 0, + Version_ModuleMapping[moduleIndex].moduleVersionInfo.moduleId, + moduleResult, + apiVersion.major, + apiVersion.minor, + apiVersion.revision, + apiVersion.patch); + + if (moduleResult == gpVersion_CompatibilityResultCompatible) + { + Version_UpdateModuleVersion(&(Version_ModuleMapping[moduleIndex]), apiVersion, 0xFFFFFFFF); + } + + return moduleResult; +} + +gpVersion_VersionStatusResult_t gpVersion_ExchangeCompatibility(void) +{ + gpVersion_ReleaseInfo_t ownSwVersion; + gpVersion_VersionStatusResult_t appsCompatibilityResult; + UIntLoop i; + + // Exchange application version number with the server. + gpVersion_GetSoftwareVersion(&ownSwVersion); + + GP_LOG_PRINTF("Client v%i.%i.%i.%i", 0, + ownSwVersion.major, + ownSwVersion.minor, + ownSwVersion.revision, + ownSwVersion.patch); + + appsCompatibilityResult = Version_ExchangeGlobalVersion(ownSwVersion, &Version_ServerAppVersion); + + GP_LOG_PRINTF("Server r%i v%i.%i.%i.%i", 0, + appsCompatibilityResult, + Version_ServerAppVersion.major, + Version_ServerAppVersion.minor, + Version_ServerAppVersion.revision, + Version_ServerAppVersion.patch); + + if (appsCompatibilityResult == gpVersion_CompatibilityResultMaybeCompatible) + { + // Assume compatible. Each registered module API version will be checked anyway. + appsCompatibilityResult = gpVersion_CompatibilityResultCompatible; + } + + // Consider each registered module. + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + // only check valid API's + if(Version_ModuleMapping[i].moduleVersionInfo.moduleId != GP_VERSION_MODULE_ID_INVALID) + { + gpVersion_VersionStatusResult_t moduleResult; + + // Negotiate the API version of this module with the server. + // This is necessary even when the application version numbers match; + // application version number does not guarantee component APIs. + moduleResult = Version_ExchangeModuleCompatibility(i); + + if (moduleResult != gpVersion_CompatibilityResultCompatible) + { + appsCompatibilityResult = gpVersion_CompatibilityResultNotCompatible; + GP_LOG_SYSTEM_PRINTF("Warning: non matching API for module: %x. Communication not possible!", 0, Version_ModuleMapping[i].moduleVersionInfo.moduleId); + } + } + } + + if (appsCompatibilityResult != gpVersion_CompatibilityResultCompatible) + { + gpVersion_DumpModuleMapping(); + } + + Version_ExchangeDone = true; + return appsCompatibilityResult; +} + +void gpVersion_GetServerVersion(gpVersion_ReleaseInfo_t* serverVersion) +{ + GP_ASSERT_DEV_EXT(Version_ExchangeDone); + *serverVersion = Version_ServerAppVersion; +} + +gpVersion_VersionStatusResult_t gpVersion_ExchangeGlobalVersion(gpVersion_ReleaseInfo_t clientInfo, gpVersion_ReleaseInfo_t* serverInfo) +{ + gpVersion_VersionStatusResult_t appsCompatibilityResult; + + appsCompatibilityResult = gpVersion_ExchangeCompatibility(); + gpVersion_GetServerVersion(serverInfo); + + return appsCompatibilityResult; +} + +void gpVersion_RegisterModule(UInt8 moduleId, gpVersion_ReleaseInfo_t* versions, UInt8 nrOfVersions, gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion) +{ + GP_LOG_PRINTF("gpVersion_RegisterModule %d", 0, moduleId); + Version_RegisterModule_Common(moduleId, versions, nrOfVersions, cbSetModuleApiVersion); + + if (Version_ExchangeDone) + { + // Initial version exchange has already happened. + // Negotiate the API version of this module immediately after it gets registered. + UIntLoop i; + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + if (Version_ModuleMapping[i].moduleVersionInfo.moduleId == moduleId) + { + gpVersion_VersionStatusResult_t moduleResult = Version_ExchangeModuleCompatibility(i); + + if (moduleResult != gpVersion_CompatibilityResultCompatible) + { + GP_LOG_SYSTEM_PRINTF("Warning: non matching API for module: %x. Communication not possible!", 0, Version_ModuleMapping[i].moduleVersionInfo.moduleId); + GP_ASSERT_DEV_EXT(false); + } + + return; + } + } + + GP_ASSERT_DEV_EXT(false); // module just registered but not in module table + } +} + +void gpVersion_DeRegisterModule(UInt8 moduleId) +{ + GP_LOG_PRINTF("gpVersion_DeRegisterModule %d", 0, moduleId); + Version_DeRegisterModule_Common(moduleId); +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_defs.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_defs.h new file mode 100644 index 0000000..dee253a --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_defs.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2014-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "gpVersion.h" +#ifdef GP_COMP_COM +#include "gpCom.h" +#endif //GP_COMP_COM + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +extern gpVersion_ModuleInfo_t Version_ModuleMapping[GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE]; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void Version_Init(void); +void Version_UpdateModuleVersion(gpVersion_ModuleInfo_t* moduleInfo, gpVersion_ReleaseInfo_t apiVersion, UInt32 commId); +void Version_RegisterModule_Common(UInt8 moduleId, gpVersion_ReleaseInfo_t* versions, UInt8 nrOfVersions, gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion); +void Version_DeRegisterModule_Common(UInt8 moduleId); +#ifdef GP_COMP_COM +void Version_ConnectionClose(UInt8 moduleId, gpCom_CommunicationId_t communicationId); +#endif + +void Version_InitClient(void); +gpVersion_VersionStatusResult_t Version_ExchangeGlobalVersion(gpVersion_ReleaseInfo_t clientInfo, gpVersion_ReleaseInfo_t* serverInfo); +gpVersion_VersionStatusResult_t Version_NegotiateModuleVersion(UInt8 moduleId, UInt8 nrOfClientVersions, gpVersion_ReleaseInfo_t* clientVersions, gpVersion_ReleaseInfo_t* serverInfo); + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c new file mode 100644 index 0000000..0f2c364 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2014-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "gpVersion.h" +#include "gpVersion_defs.h" +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +gpVersion_ModuleInfo_t Version_ModuleMapping[GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE]; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +void Version_Init(void) +{ + MEMSET(Version_ModuleMapping, -1, sizeof(gpVersion_ModuleInfo_t)*GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE); +} + +void Version_UpdateModuleVersion(gpVersion_ModuleInfo_t* moduleInfo, gpVersion_ReleaseInfo_t apiVersion, UInt32 commId) +{ + UIntLoop i; + + GP_ASSERT_DEV_EXT(moduleInfo->moduleVersionInfo.nrOfVersions <= GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE); + + moduleInfo->moduleVersionInfo.commId = commId; + moduleInfo->moduleVersionInfo.selectedVersionIndex = GP_VERSION_VERSION_INDEX_INVALID; + for (i = 0; i < moduleInfo->moduleVersionInfo.nrOfVersions; i++) + { + if (GP_VERSION_VERSIONS_EQUAL(moduleInfo->moduleVersionInfo.versionInfo[i], apiVersion)) + { + moduleInfo->moduleVersionInfo.selectedVersionIndex = i; + break; + } + } + + GP_ASSERT_DEV_EXT(moduleInfo->moduleVersionInfo.selectedVersionIndex < moduleInfo->moduleVersionInfo.nrOfVersions); + + if (moduleInfo->cbSetModuleApiVersion) + { + moduleInfo->cbSetModuleApiVersion(&(moduleInfo->moduleVersionInfo)); + } +} + +void gpVersion_DumpModuleMapping(void) +{ + UIntLoop i,j; + + GP_LOG_SYSTEM_PRINTF("Module Mapping...",0); + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + if(Version_ModuleMapping[i].moduleVersionInfo.moduleId != 0xFF) + { + GP_LOG_SYSTEM_PRINTF("Module: %x sel=%i", 0, + Version_ModuleMapping[i].moduleVersionInfo.moduleId, + Version_ModuleMapping[i].moduleVersionInfo.selectedVersionIndex); + for(j=0; j < Version_ModuleMapping[i].moduleVersionInfo.nrOfVersions; j++) + { + gpVersion_DumpVersion(Version_ModuleMapping[i].moduleVersionInfo.versionInfo[j]); + } + } + } + GP_LOG_SYSTEM_PRINTF("End of module list",0); +} + +void Version_RegisterModule_Common(UInt8 moduleId, gpVersion_ReleaseInfo_t* versions, UInt8 nrOfVersions, gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion) +{ + UIntLoop i; + + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + if(Version_ModuleMapping[i].moduleVersionInfo.moduleId == 0xFF) + { + Version_ModuleMapping[i].moduleVersionInfo.moduleId = moduleId; + Version_ModuleMapping[i].moduleVersionInfo.nrOfVersions = nrOfVersions; + Version_ModuleMapping[i].cbSetModuleApiVersion = cbSetModuleApiVersion; + GP_ASSERT_SYSTEM(nrOfVersions <= GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE); + MEMCPY(&Version_ModuleMapping[i].moduleVersionInfo.versionInfo, &versions[0], sizeof(gpVersion_ReleaseInfo_t)*nrOfVersions); + return; + } + } + GP_ASSERT_DEV_EXT(false); // table is full +} + +void Version_DeRegisterModule_Common(UInt8 moduleId) +{ + UIntLoop i; + + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + if(Version_ModuleMapping[i].moduleVersionInfo.moduleId == moduleId) + { + Version_ModuleMapping[i].moduleVersionInfo.moduleId = 0xFF; + } + } +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c new file mode 100644 index 0000000..8304ebd --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2014, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "gpVersion.h" +#include "gpVersion_defs.h" +#include "gpLog.h" + + +#ifdef GP_DIVERSITY_JUMPTABLES +#include "gpJumpTables.h" +#endif // GP_DIVERSITY_JUMPTABLES +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER +#include "gpJumpTablesMatter.h" +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + +// changelist is 3 bytes and LSB is reserved +static const ROM gpVersion_SoftwareInfo_t FLASH_PROGMEM gpVersionSw LINKER_SECTION(".version_sw") + = {{GP_VERSIONINFO_GLOBAL_VERSION},0x00,0,0,((0x00FFFFFFUL & GP_CHANGELIST)<<8)}; +static const ROM gpVersion_ReleaseInfo_t FLASH_PROGMEM gpVersionBaseComps = {GP_VERSIONINFO_BASE_COMPS}; +static const ROM gpVersion_ReleaseInfo_t FLASH_PROGMEM gpVersionBleController = {GP_VERSIONINFO_BLE_COMPS}; + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpVersion_GetSoftwareVersion(gpVersion_ReleaseInfo_t* swVersion) +{ + MEMCPY_P(swVersion, &(gpVersionSw.version), sizeof(gpVersion_ReleaseInfo_t)); +} + + +void gpVersion_GetSoftwareInfo(gpVersion_SoftwareInfo_t* swInfo) +{ + MEMCPY_P(swInfo, &gpVersionSw, sizeof(gpVersion_SoftwareInfo_t)); + +} + +void gpVersion_GetBaseCompsVersion(gpVersion_ReleaseInfo_t* pVersion) +{ + MEMCPY_P(pVersion, &gpVersionBaseComps, sizeof(gpVersion_ReleaseInfo_t)); +} + +void gpVersion_GetBleControllerVersion(gpVersion_ReleaseInfo_t* pVersion) +{ + MEMCPY_P(pVersion, &gpVersionBleController, sizeof(gpVersion_ReleaseInfo_t)); +} + + + +UInt8 gpVersion_GetNrtRomVersion(void) +{ + UInt8 nrtRomVersion = 0; + +#ifdef GP_DIVERSITY_JUMPTABLES + nrtRomVersion = gpJumpTables_GetRomVersionFromRom(); +#endif //GP_DIVERSITY_JUMPTABLES + + return nrtRomVersion; +} + +UInt8 gpVersion_GetMinimalMatterRomVersion(void) +{ + UInt8 minMatterRomVersion = 0; + +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER + minMatterRomVersion = GPJUMPTABLESMATTER_MIN_ROMVERSION; +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + + return minMatterRomVersion; +} + +UInt8 gpVersion_GetMatterRomVersion(void) +{ + UInt8 matterRomVersion = 0; + +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER + matterRomVersion = gpJumpTablesMatter_GetVersion(); +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + + return matterRomVersion; +} + +UInt32 gpVersion_GetChangelist(void) +{ + return GP_CHANGELIST; +} + +void gpVersion_DumpVersion(gpVersion_ReleaseInfo_t swVersion) +{ + GP_LOG_SYSTEM_PRINTF("Version is: v%i.%i.%i.%i",0, swVersion.major, swVersion.minor, swVersion.revision, swVersion.patch); +} + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms/utils/uart.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms/utils/uart.h new file mode 100644 index 0000000..6366dfe --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms/utils/uart.h @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes the platform abstraction for UART communication. + */ + +#ifndef OPENTHREAD_PLATFORM_UART_H_ +#define OPENTHREAD_PLATFORM_UART_H_ + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-uart + * + * @brief + * This module includes the platform abstraction for UART communication. + * + * @{ + * + */ + +/** + * Enable the UART. + * + * @retval OT_ERROR_NONE Successfully enabled the UART. + * @retval OT_ERROR_FAILED Failed to enabled the UART. + * + */ +otError otPlatUartEnable(void); + +/** + * Disable the UART. + * + * @retval OT_ERROR_NONE Successfully disabled the UART. + * @retval OT_ERROR_FAILED Failed to disable the UART. + * + */ +otError otPlatUartDisable(void); + +/** + * Send bytes over the UART. + * + * @param[in] aBuf A pointer to the data buffer. + * @param[in] aBufLength Number of bytes to transmit. + * + * @retval OT_ERROR_NONE Successfully started transmission. + * @retval OT_ERROR_FAILED Failed to start the transmission. + * + */ +otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength); + +/** + * Flush the outgoing transmit buffer and wait for the data to be sent. + * This is called when the CLI UART interface has a full buffer but still + * wishes to send more data. + * + * @retval OT_ERROR_NONE Flush succeeded, we can proceed to write more + * data to the buffer. + * + * @retval OT_ERROR_NOT_IMPLEMENTED Driver does not support synchronous flush. + * @retval OT_ERROR_INVALID_STATE Driver has no data to flush. + */ +otError otPlatUartFlush(void); + +/** + * The UART driver calls this method to notify OpenThread that the requested bytes have been sent. + * + */ +extern void otPlatUartSendDone(void); + +/** + * The UART driver calls this method to notify OpenThread that bytes have been received. + * + * @param[in] aBuf A pointer to the received bytes. + * @param[in] aBufLength The number of bytes received. + * + */ +extern void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_UART_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/config.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/config.h new file mode 100644 index 0000000..090532c --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/config.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes required defines config header. + */ + +#ifndef OPENTHREAD_CONFIG_H_ +#define OPENTHREAD_CONFIG_H_ + +/** + * @def OPENTHREAD_CONFIG_FILE + * + * The OpenThread feature configuration file. + * + */ +#if defined(OPENTHREAD_CONFIG_FILE) +#include OPENTHREAD_CONFIG_FILE +#endif + +#endif // OPENTHREAD_CONFIG_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/error.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/error.h new file mode 100644 index 0000000..66cb3c5 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/error.h @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file defines the errors used in the OpenThread. + */ + +#ifndef OPENTHREAD_ERROR_H_ +#define OPENTHREAD_ERROR_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup api-error + * + * @brief + * This module includes error definitions used in OpenThread. + * + * @{ + * + */ + +/** + * This enumeration represents error codes used throughout OpenThread. + * + */ +typedef enum OT_MUST_USE_RESULT otError +{ + /** + * No error. + */ + OT_ERROR_NONE = 0, + + /** + * Operational failed. + */ + OT_ERROR_FAILED = 1, + + /** + * Message was dropped. + */ + OT_ERROR_DROP = 2, + + /** + * Insufficient buffers. + */ + OT_ERROR_NO_BUFS = 3, + + /** + * No route available. + */ + OT_ERROR_NO_ROUTE = 4, + + /** + * Service is busy and could not service the operation. + */ + OT_ERROR_BUSY = 5, + + /** + * Failed to parse message. + */ + OT_ERROR_PARSE = 6, + + /** + * Input arguments are invalid. + */ + OT_ERROR_INVALID_ARGS = 7, + + /** + * Security checks failed. + */ + OT_ERROR_SECURITY = 8, + + /** + * Address resolution requires an address query operation. + */ + OT_ERROR_ADDRESS_QUERY = 9, + + /** + * Address is not in the source match table. + */ + OT_ERROR_NO_ADDRESS = 10, + + /** + * Operation was aborted. + */ + OT_ERROR_ABORT = 11, + + /** + * Function or method is not implemented. + */ + OT_ERROR_NOT_IMPLEMENTED = 12, + + /** + * Cannot complete due to invalid state. + */ + OT_ERROR_INVALID_STATE = 13, + + /** + * No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006). + */ + OT_ERROR_NO_ACK = 14, + + /** + * A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed + * (IEEE 802.15.4-2006). + */ + OT_ERROR_CHANNEL_ACCESS_FAILURE = 15, + + /** + * Not currently attached to a Thread Partition. + */ + OT_ERROR_DETACHED = 16, + + /** + * FCS check failure while receiving. + */ + OT_ERROR_FCS = 17, + + /** + * No frame received. + */ + OT_ERROR_NO_FRAME_RECEIVED = 18, + + /** + * Received a frame from an unknown neighbor. + */ + OT_ERROR_UNKNOWN_NEIGHBOR = 19, + + /** + * Received a frame from an invalid source address. + */ + OT_ERROR_INVALID_SOURCE_ADDRESS = 20, + + /** + * Received a frame filtered by the address filter (allowlisted or denylisted). + */ + OT_ERROR_ADDRESS_FILTERED = 21, + + /** + * Received a frame filtered by the destination address check. + */ + OT_ERROR_DESTINATION_ADDRESS_FILTERED = 22, + + /** + * The requested item could not be found. + */ + OT_ERROR_NOT_FOUND = 23, + + /** + * The operation is already in progress. + */ + OT_ERROR_ALREADY = 24, + + /** + * The creation of IPv6 address failed. + */ + OT_ERROR_IP6_ADDRESS_CREATION_FAILURE = 26, + + /** + * Operation prevented by mode flags + */ + OT_ERROR_NOT_CAPABLE = 27, + + /** + * Coap response or acknowledgment or DNS, SNTP response not received. + */ + OT_ERROR_RESPONSE_TIMEOUT = 28, + + /** + * Received a duplicated frame. + */ + OT_ERROR_DUPLICATED = 29, + + /** + * Message is being dropped from reassembly list due to timeout. + */ + OT_ERROR_REASSEMBLY_TIMEOUT = 30, + + /** + * Message is not a TMF Message. + */ + OT_ERROR_NOT_TMF = 31, + + /** + * Received a non-lowpan data frame. + */ + OT_ERROR_NOT_LOWPAN_DATA_FRAME = 32, + + /** + * The link margin was too low. + */ + OT_ERROR_LINK_MARGIN_LOW = 34, + + /** + * Input (CLI) command is invalid. + */ + OT_ERROR_INVALID_COMMAND = 35, + + /** + * Special error code used to indicate success/error status is pending and not yet known. + * + */ + OT_ERROR_PENDING = 36, + + /** + * Request rejected. + */ + OT_ERROR_REJECTED = 37, + + /** + * The number of defined errors. + */ + OT_NUM_ERRORS, + + /** + * Generic error (should not use). + */ + OT_ERROR_GENERIC = 255, +} otError; + +/** + * This function converts an otError enum into a string. + * + * @param[in] aError An otError enum. + * + * @returns A string representation of an otError. + * + */ +const char *otThreadErrorToString(otError aError); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_ERROR_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/instance.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/instance.h new file mode 100644 index 0000000..5eee72d --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/instance.h @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file defines the OpenThread Instance API. + */ + +#ifndef OPENTHREAD_INSTANCE_H_ +#define OPENTHREAD_INSTANCE_H_ + +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The OpenThread API monotonic version number. + * + * This number MUST increase by one each time the contents of public OpenThread API include headers change. + * + * @note This number versions both OpenThread platform and user APIs. + * + */ +#define OPENTHREAD_API_VERSION (238) + +/** + * @addtogroup api-instance + * + * @brief + * This module includes functions that control the OpenThread Instance. + * + * @{ + * + */ + +/** + * This structure represents the OpenThread instance structure. + */ +typedef struct otInstance otInstance; + +/** + * This function initializes the OpenThread library. + * + * This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be + * called before any other calls to OpenThread. + * + * This function is available and can only be used when support for multiple OpenThread instances is enabled. + * + * @param[in] aInstanceBuffer The buffer for OpenThread to use for allocating the otInstance structure. + * @param[in,out] aInstanceBufferSize On input, the size of aInstanceBuffer. On output, if not enough space for + * otInstance, the number of bytes required for otInstance. + * + * @returns A pointer to the new OpenThread instance. + * + * @sa otInstanceFinalize + * + */ +otInstance *otInstanceInit(void *aInstanceBuffer, size_t *aInstanceBufferSize); + +/** + * This function initializes the static single instance of the OpenThread library. + * + * This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be + * called before any other calls to OpenThread. + * + * This function is available and can only be used when support for multiple OpenThread instances is disabled. + * + * @returns A pointer to the single OpenThread instance. + * + */ +otInstance *otInstanceInitSingle(void); + +/** + * This function indicates whether or not the instance is valid/initialized. + * + * The instance is considered valid if it is acquired and initialized using either `otInstanceInitSingle()` (in single + * instance case) or `otInstanceInit()` (in multi instance case). A subsequent call to `otInstanceFinalize()` causes + * the instance to be considered as uninitialized. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns TRUE if the given instance is valid/initialized, FALSE otherwise. + * + */ +bool otInstanceIsInitialized(otInstance *aInstance); + +/** + * This function disables the OpenThread library. + * + * Call this function when OpenThread is no longer in use. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + */ +void otInstanceFinalize(otInstance *aInstance); + +/** + * This function returns the current instance uptime (in msec). + * + * This function requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled. + * + * The uptime is given as number of milliseconds since OpenThread instance was initialized. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The uptime (number of milliseconds). + * + */ +uint64_t otInstanceGetUptime(otInstance *aInstance); + +#define OT_UPTIME_STRING_SIZE 24 ///< Recommended size for string representation of uptime. + +/** + * This function returns the current instance uptime as a human-readable string. + * + * This function requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled. + * + * The string follows the format "::." for hours, minutes, seconds and millisecond (if uptime is + * shorter than one day) or "
d.::." (if longer than a day). + * + * If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated + * but the outputted string is always null-terminated. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[out] aBuffer A pointer to a char array to output the string. + * @param[in] aSize The size of @p aBuffer (in bytes). Recommended to use `OT_UPTIME_STRING_SIZE`. + * + */ +void otInstanceGetUptimeAsString(otInstance *aInstance, char *aBuffer, uint16_t aSize); + +/** + * This enumeration defines flags that are passed as part of `otStateChangedCallback`. + * + */ +enum +{ + OT_CHANGED_IP6_ADDRESS_ADDED = 1 << 0, ///< IPv6 address was added + OT_CHANGED_IP6_ADDRESS_REMOVED = 1 << 1, ///< IPv6 address was removed + OT_CHANGED_THREAD_ROLE = 1 << 2, ///< Role (disabled, detached, child, router, leader) changed + OT_CHANGED_THREAD_LL_ADDR = 1 << 3, ///< The link-local address changed + OT_CHANGED_THREAD_ML_ADDR = 1 << 4, ///< The mesh-local address changed + OT_CHANGED_THREAD_RLOC_ADDED = 1 << 5, ///< RLOC was added + OT_CHANGED_THREAD_RLOC_REMOVED = 1 << 6, ///< RLOC was removed + OT_CHANGED_THREAD_PARTITION_ID = 1 << 7, ///< Partition ID changed + OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER = 1 << 8, ///< Thread Key Sequence changed + OT_CHANGED_THREAD_NETDATA = 1 << 9, ///< Thread Network Data changed + OT_CHANGED_THREAD_CHILD_ADDED = 1 << 10, ///< Child was added + OT_CHANGED_THREAD_CHILD_REMOVED = 1 << 11, ///< Child was removed + OT_CHANGED_IP6_MULTICAST_SUBSCRIBED = 1 << 12, ///< Subscribed to a IPv6 multicast address + OT_CHANGED_IP6_MULTICAST_UNSUBSCRIBED = 1 << 13, ///< Unsubscribed from a IPv6 multicast address + OT_CHANGED_THREAD_CHANNEL = 1 << 14, ///< Thread network channel changed + OT_CHANGED_THREAD_PANID = 1 << 15, ///< Thread network PAN Id changed + OT_CHANGED_THREAD_NETWORK_NAME = 1 << 16, ///< Thread network name changed + OT_CHANGED_THREAD_EXT_PANID = 1 << 17, ///< Thread network extended PAN ID changed + OT_CHANGED_NETWORK_KEY = 1 << 18, ///< Network key changed + OT_CHANGED_PSKC = 1 << 19, ///< PSKc changed + OT_CHANGED_SECURITY_POLICY = 1 << 20, ///< Security Policy changed + OT_CHANGED_CHANNEL_MANAGER_NEW_CHANNEL = 1 << 21, ///< Channel Manager new pending Thread channel changed + OT_CHANGED_SUPPORTED_CHANNEL_MASK = 1 << 22, ///< Supported channel mask changed + OT_CHANGED_COMMISSIONER_STATE = 1 << 23, ///< Commissioner state changed + OT_CHANGED_THREAD_NETIF_STATE = 1 << 24, ///< Thread network interface state changed + OT_CHANGED_THREAD_BACKBONE_ROUTER_STATE = 1 << 25, ///< Backbone Router state changed + OT_CHANGED_THREAD_BACKBONE_ROUTER_LOCAL = 1 << 26, ///< Local Backbone Router configuration changed + OT_CHANGED_JOINER_STATE = 1 << 27, ///< Joiner state changed + OT_CHANGED_ACTIVE_DATASET = 1 << 28, ///< Active Operational Dataset changed + OT_CHANGED_PENDING_DATASET = 1 << 29, ///< Pending Operational Dataset changed +}; + +/** + * This type represents a bit-field indicating specific state/configuration that has changed. See `OT_CHANGED_*` + * definitions. + * + */ +typedef uint32_t otChangedFlags; + +/** + * This function pointer is called to notify certain configuration or state changes within OpenThread. + * + * @param[in] aFlags A bit-field indicating specific state that has changed. See `OT_CHANGED_*` definitions. + * @param[in] aContext A pointer to application-specific context. + * + */ +typedef void (*otStateChangedCallback)(otChangedFlags aFlags, void *aContext); + +/** + * This function registers a callback to indicate when certain configuration or state changes within OpenThread. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aCallback A pointer to a function that is called with certain configuration or state changes. + * @param[in] aContext A pointer to application-specific context. + * + * @retval OT_ERROR_NONE Added the callback to the list of callbacks. + * @retval OT_ERROR_ALREADY The callback was already registered. + * @retval OT_ERROR_NO_BUFS Could not add the callback due to resource constraints. + * + */ +otError otSetStateChangedCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aContext); + +/** + * This function removes a callback to indicate when certain configuration or state changes within OpenThread. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aCallback A pointer to a function that is called with certain configuration or state changes. + * @param[in] aContext A pointer to application-specific context. + * + */ +void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aContext); + +/** + * This method triggers a platform reset. + * + * The reset process ensures that all the OpenThread state/info (stored in volatile memory) is erased. Note that the + * `otPlatformReset` does not erase any persistent state/info saved in non-volatile memory. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + */ +void otInstanceReset(otInstance *aInstance); + +/** + * Deletes all the settings stored on non-volatile memory, and then triggers a platform reset. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + */ +void otInstanceFactoryReset(otInstance *aInstance); + +/** + * This method resets the internal states of the OpenThread radio stack. + * + * Callbacks and configurations are preserved. + * + * This API is only available under radio builds (`OPENTHREAD_RADIO = 1`). + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + */ +void otInstanceResetRadioStack(otInstance *aInstance); + +/** + * This function erases all the OpenThread persistent info (network settings) stored on non-volatile memory. + * Erase is successful only if the device is in `disabled` state/role. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @retval OT_ERROR_NONE All persistent info/state was erased successfully. + * @retval OT_ERROR_INVALID_STATE Device is not in `disabled` state/role. + * + */ +otError otInstanceErasePersistentInfo(otInstance *aInstance); + +/** + * This function gets the OpenThread version string. + * + * @returns A pointer to the OpenThread version. + * + */ +const char *otGetVersionString(void); + +/** + * This function gets the OpenThread radio version string. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns A pointer to the OpenThread radio version. + * + */ +const char *otGetRadioVersionString(otInstance *aInstance); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_INSTANCE_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/crypto.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/crypto.h new file mode 100644 index 0000000..7cadc8e --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/crypto.h @@ -0,0 +1,500 @@ +/* + * Copyright (c) 2021, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes the platform abstraction for Crypto operations. + */ + +#ifndef OPENTHREAD_PLATFORM_CRYPTO_H_ +#define OPENTHREAD_PLATFORM_CRYPTO_H_ + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-crypto + * + * @brief + * This module includes the platform abstraction for Crypto. + * + * @{ + * + */ + +/** + * This enumeration defines the key types. + * + */ +typedef enum +{ + OT_CRYPTO_KEY_TYPE_RAW, ///< Key Type: Raw Data. + OT_CRYPTO_KEY_TYPE_AES, ///< Key Type: AES. + OT_CRYPTO_KEY_TYPE_HMAC, ///< Key Type: HMAC. +} otCryptoKeyType; + +/** + * This enumeration defines the key algorithms. + * + */ +typedef enum +{ + OT_CRYPTO_KEY_ALG_VENDOR, ///< Key Algorithm: Vendor Defined. + OT_CRYPTO_KEY_ALG_AES_ECB, ///< Key Algorithm: AES ECB. + OT_CRYPTO_KEY_ALG_HMAC_SHA_256, ///< Key Algorithm: HMAC SHA-256. +} otCryptoKeyAlgorithm; + +/** + * This enumeration defines the key usage flags. + * + */ +enum +{ + OT_CRYPTO_KEY_USAGE_NONE = 0, ///< Key Usage: Key Usage is empty. + OT_CRYPTO_KEY_USAGE_EXPORT = 1 << 0, ///< Key Usage: Key can be exported. + OT_CRYPTO_KEY_USAGE_ENCRYPT = 1 << 1, ///< Key Usage: Encryption (vendor defined). + OT_CRYPTO_KEY_USAGE_DECRYPT = 1 << 2, ///< Key Usage: AES ECB. + OT_CRYPTO_KEY_USAGE_SIGN_HASH = 1 << 3, ///< Key Usage: HMAC SHA-256. +}; + +/** + * This enumeration defines the key storage types. + * + */ +typedef enum +{ + OT_CRYPTO_KEY_STORAGE_VOLATILE, ///< Key Persistence: Key is volatile. + OT_CRYPTO_KEY_STORAGE_PERSISTENT, ///< Key Persistence: Key is persistent. +} otCryptoKeyStorage; + +/** + * This datatype represents the key reference. + * + */ +typedef uint32_t otCryptoKeyRef; + +/** + * @struct otCryptoKey + * + * This structure represents the Key Material required for Crypto operations. + * + */ +typedef struct otCryptoKey +{ + const uint8_t *mKey; ///< Pointer to the buffer containing key. NULL indicates to use `mKeyRef`. + uint16_t mKeyLength; ///< The key length in bytes (applicable when `mKey` is not NULL). + uint32_t mKeyRef; ///< The PSA key ref (requires `mKey` to be NULL). +} otCryptoKey; + +/** + * @struct otCryptoContext + * + * This structure stores the context object for platform APIs. + * + */ +typedef struct otCryptoContext +{ + void * mContext; ///< Pointer to the context. + uint16_t mContextSize; ///< The length of the context in bytes. +} otCryptoContext; + +/** + * Initialize the Crypto module. + * + */ +void otPlatCryptoInit(void); + +/** + * Import a key into PSA ITS. + * + * @param[in,out] aKeyRef Pointer to the key ref to be used for crypto operations. + * @param[in] aKeyType Key Type encoding for the key. + * @param[in] aKeyAlgorithm Key algorithm encoding for the key. + * @param[in] aKeyUsage Key Usage encoding for the key (combinations of `OT_CRYPTO_KEY_USAGE_*`). + * @param[in] aKeyPersistence Key Persistence for this key + * @param[in] aKey Actual key to be imported. + * @param[in] aKeyLen Length of the key to be imported. + * + * @retval OT_ERROR_NONE Successfully imported the key. + * @retval OT_ERROR_FAILED Failed to import the key. + * @retval OT_ERROR_INVALID_ARGS @p aKey was set to NULL. + * + * @note If OT_CRYPTO_KEY_STORAGE_PERSISTENT is passed for aKeyPersistence then @p aKeyRef is input and platform + * should use the given aKeyRef and MUST not change it. + * + * If OT_CRYPTO_KEY_STORAGE_VOLATILE is passed for aKeyPersistence then @p aKeyRef is output, the initial + * value does not matter and platform API MUST update it to return the new key ref. + * + * This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled. + * + */ +otError otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef, + otCryptoKeyType aKeyType, + otCryptoKeyAlgorithm aKeyAlgorithm, + int aKeyUsage, + otCryptoKeyStorage aKeyPersistence, + const uint8_t * aKey, + size_t aKeyLen); + +/** + * Export a key stored in PSA ITS. + * + * @param[in] aKeyRef The key ref to be used for crypto operations. + * @param[out] aBuffer Pointer to the buffer where key needs to be exported. + * @param[in] aBufferLen Length of the buffer passed to store the exported key. + * @param[out] aKeyLen Pointer to return the length of the exported key. + * + * @retval OT_ERROR_NONE Successfully exported @p aKeyRef. + * @retval OT_ERROR_FAILED Failed to export @p aKeyRef. + * @retval OT_ERROR_INVALID_ARGS @p aBuffer was NULL + * + * @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled. + * + */ +otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen); + +/** + * Destroy a key stored in PSA ITS. + * + * @param[in] aKeyRef The key ref to be destroyed + * + * @retval OT_ERROR_NONE Successfully destroyed the key. + * @retval OT_ERROR_FAILED Failed to destroy the key. + * + * @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled. + * + */ +otError otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef); + +/** + * Check if the key ref passed has an associated key in PSA ITS. + * + * @param[in] aKeyRef The Key Ref to check. + * + * @retval TRUE There is an associated key with @p aKeyRef. + * @retval FALSE There is no associated key with @p aKeyRef. + * + * @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled. + * + */ +bool otPlatCryptoHasKey(otCryptoKeyRef aKeyRef); + +/** + * Initialize the HMAC operation. + * + * @param[in] aContext Context for HMAC operation. + * + * @retval OT_ERROR_NONE Successfully initialized HMAC operation. + * @retval OT_ERROR_FAILED Failed to initialize HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + * @note The platform driver shall point the context to the correct object such as psa_mac_operation_t or + * mbedtls_md_context_t. + * + */ +otError otPlatCryptoHmacSha256Init(otCryptoContext *aContext); + +/** + * Uninitialize the HMAC operation. + * + * @param[in] aContext Context for HMAC operation. + * + * @retval OT_ERROR_NONE Successfully uninitialized HMAC operation. + * @retval OT_ERROR_FAILED Failed to uninitialized HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoHmacSha256Deinit(otCryptoContext *aContext); + +/** + * Start HMAC operation. + * + * @param[in] aContext Context for HMAC operation. + * @param[in] aKey Key material to be used for for HMAC operation. + * + * @retval OT_ERROR_NONE Successfully started HMAC operation. + * @retval OT_ERROR_FAILED Failed to start HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aKey was NULL + * + */ +otError otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey *aKey); + +/** + * Update the HMAC operation with new input. + * + * @param[in] aContext Context for HMAC operation. + * @param[in] aBuf A pointer to the input buffer. + * @param[in] aBufLength The length of @p aBuf in bytes. + * + * @retval OT_ERROR_NONE Successfully updated HMAC with new input operation. + * @retval OT_ERROR_FAILED Failed to update HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aBuf was NULL + * + */ +otError otPlatCryptoHmacSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength); + +/** + * Complete the HMAC operation. + * + * @param[in] aContext Context for HMAC operation. + * @param[out] aBuf A pointer to the output buffer. + * @param[in] aBufLength The length of @p aBuf in bytes. + * + * @retval OT_ERROR_NONE Successfully completed HMAC operation. + * @retval OT_ERROR_FAILED Failed to complete HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aBuf was NULL + * + */ +otError otPlatCryptoHmacSha256Finish(otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength); + +/** + * Initialise the AES operation. + * + * @param[in] aContext Context for AES operation. + * + * @retval OT_ERROR_NONE Successfully Initialised AES operation. + * @retval OT_ERROR_FAILED Failed to Initialise AES operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * @retval OT_ERROR_NO_BUFS Cannot allocate the context. + * + * @note The platform driver shall point the context to the correct object such as psa_key_id + * or mbedtls_aes_context_t. + * + */ +otError otPlatCryptoAesInit(otCryptoContext *aContext); + +/** + * Set the key for AES operation. + * + * @param[in] aContext Context for AES operation. + * @param[out] aKey Key to use for AES operation. + * + * @retval OT_ERROR_NONE Successfully set the key for AES operation. + * @retval OT_ERROR_FAILED Failed to set the key for AES operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aKey was NULL + * + */ +otError otPlatCryptoAesSetKey(otCryptoContext *aContext, const otCryptoKey *aKey); + +/** + * Encrypt the given data. + * + * @param[in] aContext Context for AES operation. + * @param[in] aInput Pointer to the input buffer. + * @param[in] aOutput Pointer to the output buffer. + * + * @retval OT_ERROR_NONE Successfully encrypted @p aInput. + * @retval OT_ERROR_FAILED Failed to encrypt @p aInput. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aKey or @p aOutput were NULL + * + */ +otError otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput); + +/** + * Free the AES context. + * + * @param[in] aContext Context for AES operation. + * + * @retval OT_ERROR_NONE Successfully freed AES context. + * @retval OT_ERROR_FAILED Failed to free AES context. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoAesFree(otCryptoContext *aContext); + +/** + * Initialise the HKDF context. + * + * @param[in] aContext Context for HKDF operation. + * + * @retval OT_ERROR_NONE Successfully Initialised AES operation. + * @retval OT_ERROR_FAILED Failed to Initialise AES operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + * @note The platform driver shall point the context to the correct object such as psa_key_derivation_operation_t + * or HmacSha256::Hash + * + */ +otError otPlatCryptoHkdfInit(otCryptoContext *aContext); + +/** + * Perform HKDF Expand step. + * + * @param[in] aContext Operation context for HKDF operation. + * @param[in] aInfo Pointer to the Info sequence. + * @param[in] aInfoLength Length of the Info sequence. + * @param[out] aOutputKey Pointer to the output Key. + * @param[in] aOutputKeyLength Size of the output key buffer. + * + * @retval OT_ERROR_NONE HKDF Expand was successful. + * @retval OT_ERROR_FAILED HKDF Expand failed. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoHkdfExpand(otCryptoContext *aContext, + const uint8_t * aInfo, + uint16_t aInfoLength, + uint8_t * aOutputKey, + uint16_t aOutputKeyLength); + +/** + * Perform HKDF Extract step. + * + * @param[in] aContext Operation context for HKDF operation. + * @param[in] aSalt Pointer to the Salt for HKDF. + * @param[in] aSaltLength Length of Salt. + * @param[in] aInputKey Pointer to the input key. + * + * @retval OT_ERROR_NONE HKDF Extract was successful. + * @retval OT_ERROR_FAILED HKDF Extract failed. + * + */ +otError otPlatCryptoHkdfExtract(otCryptoContext * aContext, + const uint8_t * aSalt, + uint16_t aSaltLength, + const otCryptoKey *aInputKey); + +/** + * Uninitialize the HKDF context. + * + * @param[in] aContext Context for HKDF operation. + * + * @retval OT_ERROR_NONE Successfully un-initialised HKDF operation. + * @retval OT_ERROR_FAILED Failed to un-initialised HKDF operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoHkdfDeinit(otCryptoContext *aContext); + +/** + * Initialise the SHA-256 operation. + * + * @param[in] aContext Context for SHA-256 operation. + * + * @retval OT_ERROR_NONE Successfully initialised SHA-256 operation. + * @retval OT_ERROR_FAILED Failed to initialise SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + * + * @note The platform driver shall point the context to the correct object such as psa_hash_operation_t + * or mbedtls_sha256_context. + */ +otError otPlatCryptoSha256Init(otCryptoContext *aContext); + +/** + * Uninitialize the SHA-256 operation. + * + * @param[in] aContext Context for SHA-256 operation. + * + * @retval OT_ERROR_NONE Successfully un-initialised SHA-256 operation. + * @retval OT_ERROR_FAILED Failed to un-initialised SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoSha256Deinit(otCryptoContext *aContext); + +/** + * Start SHA-256 operation. + * + * @param[in] aContext Context for SHA-256 operation. + * + * @retval OT_ERROR_NONE Successfully started SHA-256 operation. + * @retval OT_ERROR_FAILED Failed to start SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoSha256Start(otCryptoContext *aContext); + +/** + * Update SHA-256 operation with new input. + * + * @param[in] aContext Context for SHA-256 operation. + * @param[in] aBuf A pointer to the input buffer. + * @param[in] aBufLength The length of @p aBuf in bytes. + * + * @retval OT_ERROR_NONE Successfully updated SHA-256 with new input operation. + * @retval OT_ERROR_FAILED Failed to update SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aBuf was NULL + * + */ +otError otPlatCryptoSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength); + +/** + * Finish SHA-256 operation. + * + * @param[in] aContext Context for SHA-256 operation. + * @param[in] aHash A pointer to the output buffer, where hash needs to be stored. + * @param[in] aHashSize The length of @p aHash in bytes. + * + * @retval OT_ERROR_NONE Successfully completed the SHA-256 operation. + * @retval OT_ERROR_FAILED Failed to complete SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aHash was NULL + * + */ +otError otPlatCryptoSha256Finish(otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize); + +/** + * Initialize cryptographically-secure pseudorandom number generator (CSPRNG). + * + */ +void otPlatCryptoRandomInit(void); + +/** + * Deinitialize cryptographically-secure pseudorandom number generator (CSPRNG). + * + */ +void otPlatCryptoRandomDeinit(void); + +/** + * Fills a given buffer with cryptographically secure random bytes. + * + * @param[out] aBuffer A pointer to a buffer to fill with the random bytes. + * @param[in] aSize Size of buffer (number of bytes to fill). + * + * @retval OT_ERROR_NONE Successfully filled buffer with random values. + * @retval OT_ERROR_FAILED Operation failed. + * + */ +otError otPlatCryptoRandomGet(uint8_t *aBuffer, uint16_t aSize); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // end of extern "C" +#endif +#endif // OPENTHREAD_PLATFORM_CRYPTO_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/diag.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/diag.h new file mode 100644 index 0000000..9dee346 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/diag.h @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file defines the platform diag interface. + * + */ + +#ifndef OPENTHREAD_PLATFORM_DIAG_H_ +#define OPENTHREAD_PLATFORM_DIAG_H_ + +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-factory-diagnostics + * + * @brief + * This module includes the platform abstraction for diagnostics features. + * + * @{ + * + */ + +/** + * This function processes a factory diagnostics command line. + * + * The output of this function (the content written to @p aOutput) MUST terminate with `\0` and the `\0` is within the + * output buffer. + * + * @param[in] aInstance The OpenThread instance for current request. + * @param[in] aArgsLength The number of arguments in @p aArgs. + * @param[in] aArgs The arguments of diagnostics command line. + * @param[out] aOutput The diagnostics execution result. + * @param[in] aOutputMaxLen The output buffer size. + * + * @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided. + * @retval OT_ERROR_NONE The command is successfully process. + * @retval OT_ERROR_INVALID_COMMAND The command is not valid or not supported. + * + */ +otError otPlatDiagProcess(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen); + +/** + * This function enables/disables the factory diagnostics mode. + * + * @param[in] aMode TRUE to enable diagnostics mode, FALSE otherwise. + * + */ +void otPlatDiagModeSet(bool aMode); + +/** + * This function indicates whether or not factory diagnostics mode is enabled. + * + * @returns TRUE if factory diagnostics mode is enabled, FALSE otherwise. + * + */ +bool otPlatDiagModeGet(void); + +/** + * This function sets the channel to use for factory diagnostics. + * + * @param[in] aChannel The channel value. + * + */ +void otPlatDiagChannelSet(uint8_t aChannel); + +/** + * This function sets the transmit power to use for factory diagnostics. + * + * @param[in] aTxPower The transmit power value. + * + */ +void otPlatDiagTxPowerSet(int8_t aTxPower); + +/** + * This function processes the received radio frame. + * + * @param[in] aInstance The OpenThread instance for current request. + * @param[in] aFrame The received radio frame. + * @param[in] aError The received radio frame status. + * + */ +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError); + +/** + * This function processes the alarm event. + * + * @param[in] aInstance The OpenThread instance for current request. + * + */ +void otPlatDiagAlarmCallback(otInstance *aInstance); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // end of extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_DIAG_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/logging.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/logging.h new file mode 100644 index 0000000..adf123f --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/logging.h @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes the platform abstraction for the debug log service. + */ + +#ifndef OPENTHREAD_PLATFORM_LOGGING_H_ +#define OPENTHREAD_PLATFORM_LOGGING_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-logging + * + * @brief + * This module includes the platform abstraction for the debug log service. + * + * @{ + * + */ + +/** + * Log level None. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_NONE 0 + +/** + * Log level Critical. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_CRIT 1 + +/** + * Log level Warning. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_WARN 2 + +/** + * Log level Notice. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_NOTE 3 + +/** + * Log level Informational. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_INFO 4 + +/** + * Log level Debug. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_DEBG 5 + +/** + * This type represents the log level. + * + */ +typedef int otLogLevel; + +/** + * This enumeration represents log regions. + * + * The support for log region is removed and instead each core module can define its own name to appended to the logs. + * However, the `otLogRegion` enumeration is still defined as before to help with platforms which we may be using it + * in their `otPlatLog()` implementation. The OT core will always emit all logs with `OT_LOG_REGION_CORE`. + * + */ +typedef enum otLogRegion +{ + OT_LOG_REGION_API = 1, ///< OpenThread API + OT_LOG_REGION_MLE = 2, ///< MLE + OT_LOG_REGION_ARP = 3, ///< EID-to-RLOC mapping. + OT_LOG_REGION_NET_DATA = 4, ///< Network Data + OT_LOG_REGION_ICMP = 5, ///< ICMPv6 + OT_LOG_REGION_IP6 = 6, ///< IPv6 + OT_LOG_REGION_TCP = 7, ///< TCP + OT_LOG_REGION_MAC = 8, ///< IEEE 802.15.4 MAC + OT_LOG_REGION_MEM = 9, ///< Memory + OT_LOG_REGION_NCP = 10, ///< NCP + OT_LOG_REGION_MESH_COP = 11, ///< Mesh Commissioning Protocol + OT_LOG_REGION_NET_DIAG = 12, ///< Network Diagnostic + OT_LOG_REGION_PLATFORM = 13, ///< Platform + OT_LOG_REGION_COAP = 14, ///< CoAP + OT_LOG_REGION_CLI = 15, ///< CLI + OT_LOG_REGION_CORE = 16, ///< OpenThread Core + OT_LOG_REGION_UTIL = 17, ///< Utility module + OT_LOG_REGION_BBR = 18, ///< Backbone Router (available since Thread 1.2) + OT_LOG_REGION_MLR = 19, ///< Multicast Listener Registration (available since Thread 1.2) + OT_LOG_REGION_DUA = 20, ///< Domain Unicast Address (available since Thread 1.2) + OT_LOG_REGION_BR = 21, ///< Border Router + OT_LOG_REGION_SRP = 22, ///< Service Registration Protocol (SRP) + OT_LOG_REGION_DNS = 23, ///< DNS +} otLogRegion; + +/** + * This function outputs logs. + * + * Note that the support for log region is removed. The OT core will always emit all logs with `OT_LOG_REGION_CORE` + * as @p aLogRegion. + * + * @param[in] aLogLevel The log level. + * @param[in] aLogRegion The log region. + * @param[in] aFormat A pointer to the format string. + * @param[in] ... Arguments for the format specification. + * + */ +void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...); + +/** + * This function handles OpenThread log level changes. + * + * This platform function is called whenever the OpenThread log level changes. + * This platform function is optional since an empty weak implementation has been provided. + * + * @note Only applicable when `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1`. + * + * @param[in] aLogLevel The new OpenThread log level. + * + */ +void otPlatLogHandleLevelChanged(otLogLevel aLogLevel); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_LOGGING_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/radio.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/radio.h new file mode 100644 index 0000000..3ac715c --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/radio.h @@ -0,0 +1,1158 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file defines the radio interface for OpenThread. + * + */ + +#ifndef OPENTHREAD_PLATFORM_RADIO_H_ +#define OPENTHREAD_PLATFORM_RADIO_H_ + +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-radio + * + * @brief + * This module includes the platform abstraction for radio communication. + * + * @{ + * + */ + +/** + * @defgroup radio-types Radio Types + * + * @brief + * This module includes the platform abstraction for a radio frame. + * + * @{ + * + */ + +enum +{ + OT_RADIO_FRAME_MAX_SIZE = 127, ///< aMaxPHYPacketSize (IEEE 802.15.4-2006) + OT_RADIO_FRAME_MIN_SIZE = 3, ///< Minimal size of frame FCS + CONTROL + OT_RADIO_SYMBOLS_PER_OCTET = 2, ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_BIT_RATE = 250000, ///< 2.4 GHz IEEE 802.15.4 (bits per second) + OT_RADIO_BITS_PER_OCTET = 8, ///< Number of bits per octet + + OT_RADIO_SYMBOL_TIME = ((OT_RADIO_BITS_PER_OCTET / OT_RADIO_SYMBOLS_PER_OCTET) * 1000000) / OT_RADIO_BIT_RATE, + OT_RADIO_LQI_NONE = 0, ///< LQI measurement not supported + OT_RADIO_RSSI_INVALID = 127, ///< Invalid or unknown RSSI value + OT_RADIO_POWER_INVALID = 127, ///< Invalid or unknown power value +}; + +/** + * This enumeration defines the channel page. + * + */ +enum +{ + OT_RADIO_CHANNEL_PAGE_0 = 0, ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_CHANNEL_PAGE_0_MASK = (1U << OT_RADIO_CHANNEL_PAGE_0), ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_CHANNEL_PAGE_2 = 2, ///< 915 MHz IEEE 802.15.4-2006 + OT_RADIO_CHANNEL_PAGE_2_MASK = (1U << OT_RADIO_CHANNEL_PAGE_2), ///< 915 MHz IEEE 802.15.4-2006 +}; + +/** + * This enumeration defines the frequency band channel range. + * + */ +enum +{ + OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN = 1, ///< 915 MHz IEEE 802.15.4-2006 + OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX = 10, ///< 915 MHz IEEE 802.15.4-2006 + OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK = 0x3ff << OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN, ///< 915 MHz IEEE 802.15.4-2006 + OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN = 11, ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX = 26, ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK = 0xffff << OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN, ///< 2.4 GHz IEEE 802.15.4-2006 +}; + +/** + * This type represents radio capabilities. + * + * The value is a bit-field indicating the capabilities supported by the radio. See `OT_RADIO_CAPS_*` definitions. + * + */ +typedef uint8_t otRadioCaps; + +/** + * This enumeration defines constants that are used to indicate different radio capabilities. See `otRadioCaps`. + * + */ +enum +{ + OT_RADIO_CAPS_NONE = 0, ///< Radio supports no capability. + OT_RADIO_CAPS_ACK_TIMEOUT = 1 << 0, ///< Radio supports AckTime event. + OT_RADIO_CAPS_ENERGY_SCAN = 1 << 1, ///< Radio supports Energy Scans. + OT_RADIO_CAPS_TRANSMIT_RETRIES = 1 << 2, ///< Radio supports tx retry logic with collision avoidance (CSMA). + OT_RADIO_CAPS_CSMA_BACKOFF = 1 << 3, ///< Radio supports CSMA backoff for frame transmission (but no retry). + OT_RADIO_CAPS_SLEEP_TO_TX = 1 << 4, ///< Radio supports direct transition from sleep to TX with CSMA. + OT_RADIO_CAPS_TRANSMIT_SEC = 1 << 5, ///< Radio supports tx security. + OT_RADIO_CAPS_TRANSMIT_TIMING = 1 << 6, ///< Radio supports tx at specific time. + OT_RADIO_CAPS_RECEIVE_TIMING = 1 << 7, ///< Radio supports rx at specific time. +}; + +#define OT_PANID_BROADCAST 0xffff ///< IEEE 802.15.4 Broadcast PAN ID + +/** + * This type represents the IEEE 802.15.4 PAN ID. + * + */ +typedef uint16_t otPanId; + +/** + * This type represents the IEEE 802.15.4 Short Address. + * + */ +typedef uint16_t otShortAddress; + +#define OT_EXT_ADDRESS_SIZE 8 ///< Size of an IEEE 802.15.4 Extended Address (bytes) + +/** + * This enumeration defines constants about size of header IE in ACK. + * + */ +enum +{ + OT_IE_HEADER_SIZE = 2, ///< Size of IE header in bytes. + OT_CSL_IE_SIZE = 4, ///< Size of CSL IE content in bytes. + OT_ACK_IE_MAX_SIZE = 16, ///< Max length for header IE in ACK. + OT_ENH_PROBING_IE_DATA_MAX_SIZE = 2, ///< Max length of Link Metrics data in Vendor-Specific IE. +}; + +#define CSL_IE_HEADER_BYTES_LO 0x04 ///< Fixed CSL IE header first byte +#define CSL_IE_HEADER_BYTES_HI 0x0d ///< Fixed CSL IE header second byte + +/** + * @struct otExtAddress + * + * This structure represents the IEEE 802.15.4 Extended Address. + * + */ +OT_TOOL_PACKED_BEGIN +struct otExtAddress +{ + uint8_t m8[OT_EXT_ADDRESS_SIZE]; ///< IEEE 802.15.4 Extended Address bytes +} OT_TOOL_PACKED_END; + +/** + * This structure represents the IEEE 802.15.4 Extended Address. + * + */ +typedef struct otExtAddress otExtAddress; + +#define OT_MAC_KEY_SIZE 16 ///< Size of the MAC Key in bytes. + +/** + * @struct otMacKey + * + * This structure represents a MAC Key. + * + */ +OT_TOOL_PACKED_BEGIN +struct otMacKey +{ + uint8_t m8[OT_MAC_KEY_SIZE]; ///< MAC Key bytes. +} OT_TOOL_PACKED_END; + +/** + * This structure represents a MAC Key. + * + */ +typedef struct otMacKey otMacKey; + +/** + * This type represents a MAC Key Ref used by PSA. + * + */ +typedef otCryptoKeyRef otMacKeyRef; + +/** + * @struct otMacKeyMaterial + * + * This structure represents a MAC Key. + * + */ +typedef struct otMacKeyMaterial +{ + union + { + otMacKeyRef mKeyRef; ///< Reference to the key stored. + otMacKey mKey; ///< Key stored as literal. + } mKeyMaterial; +} otMacKeyMaterial; + +/** + * This enumeration defines constants about key types. + * + */ +typedef enum +{ + OT_KEY_TYPE_LITERAL_KEY = 0, ///< Use Literal Keys. + OT_KEY_TYPE_KEY_REF = 1, ///< Use Reference to Key. +} otRadioKeyType; + +/** + * This structure represents the IEEE 802.15.4 Header IE (Information Element) related information of a radio frame. + */ +typedef struct otRadioIeInfo +{ + int64_t mNetworkTimeOffset; ///< The time offset to the Thread network time. + uint8_t mTimeIeOffset; ///< The Time IE offset from the start of PSDU. + uint8_t mTimeSyncSeq; ///< The Time sync sequence. +} otRadioIeInfo; + +/** + * This structure represents an IEEE 802.15.4 radio frame. + */ +typedef struct otRadioFrame +{ + uint8_t *mPsdu; ///< The PSDU. + + uint16_t mLength; ///< Length of the PSDU. + uint8_t mChannel; ///< Channel used to transmit/receive the frame. + + uint8_t mRadioType; ///< Radio link type - should be ignored by radio driver. + + /** + * The union of transmit and receive information for a radio frame. + */ + union + { + /** + * Structure representing radio frame transmit information. + */ + struct + { + const otMacKeyMaterial *mAesKey; ///< The key material used for AES-CCM frame security. + otRadioIeInfo * mIeInfo; ///< The pointer to the Header IE(s) related information. + uint32_t mTxDelay; ///< The delay time for this transmission (based on `mTxDelayBaseTime`). + uint32_t mTxDelayBaseTime; ///< The base time for the transmission delay. + uint8_t mMaxCsmaBackoffs; ///< Maximum number of backoffs attempts before declaring CCA failure. + uint8_t mMaxFrameRetries; ///< Maximum number of retries allowed after a transmission failure. + + /** + * Indicates whether frame counter and CSL IEs are properly updated in the header. + * + * If the platform layer does not provide `OT_RADIO_CAPS_TRANSMIT_SEC` capability, it can ignore this flag. + * + * If the platform provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability, then platform is expected to handle tx + * security processing and assignment of frame counter. In this case the following behavior is expected: + * + * When `mIsHeaderUpdated` is set, it indicates that OpenThread core has already set the frame counter and + * CSL IEs (if security is enabled) in the prepared frame. The counter is ensured to match the counter value + * from the previous attempts of the same frame. The platform should not assign or change the frame counter + * (but may still need to perform security processing depending on `mIsSecurityProcessed` flag). + * + * If `mIsHeaderUpdated` is not set, then the frame counter and key CSL IE not set in the frame by + * OpenThread core and it is the responsibility of the radio platform to assign them. The platform + * must update the frame header (assign counter and CSL IE values) before sending the frame over the air, + * however if the the transmission gets aborted and the frame is never sent over the air (e.g., channel + * access error) the platform may choose to not update the header. If the platform updates the header, + * it must also set this flag before passing the frame back from the `otPlatRadioTxDone()` callback. + * + */ + bool mIsHeaderUpdated : 1; + bool mIsARetx : 1; ///< Indicates whether the frame is a retransmission or not. + bool mCsmaCaEnabled : 1; ///< Set to true to enable CSMA-CA for this packet, false otherwise. + bool mCslPresent : 1; ///< Set to true if CSL header IE is present. + bool mIsSecurityProcessed : 1; ///< True if SubMac should skip the AES processing of this frame. + } mTxInfo; + + /** + * Structure representing radio frame receive information. + */ + struct + { + /** + * The timestamp when the frame was received in microseconds. + * + * The value SHALL be the time when the SFD was received when TIME_SYNC or CSL is enabled. + * Otherwise, the time when the MAC frame was fully received is also acceptable. + * + */ + uint64_t mTimestamp; + + uint32_t mAckFrameCounter; ///< ACK security frame counter (applicable when `mAckedWithSecEnhAck` is set). + uint8_t mAckKeyId; ///< ACK security key index (applicable when `mAckedWithSecEnhAck` is set). + int8_t mRssi; ///< Received signal strength indicator in dBm for received frames. + uint8_t mLqi; ///< Link Quality Indicator for received frames. + + // Flags + bool mAckedWithFramePending : 1; ///< This indicates if this frame was acknowledged with frame pending set. + bool mAckedWithSecEnhAck : 1; ///< This indicates if this frame was acknowledged with secured enhance ACK. + } mRxInfo; + } mInfo; +} otRadioFrame; + +/** + * This structure represents the state of a radio. + * Initially, a radio is in the Disabled state. + */ +typedef enum otRadioState +{ + OT_RADIO_STATE_DISABLED = 0, + OT_RADIO_STATE_SLEEP = 1, + OT_RADIO_STATE_RECEIVE = 2, + OT_RADIO_STATE_TRANSMIT = 3, + OT_RADIO_STATE_INVALID = 255, +} otRadioState; + +/** + * The following are valid radio state transitions: + * + * (Radio ON) + * +----------+ Enable() +-------+ Receive() +---------+ Transmit() +----------+ + * | |----------->| |----------->| |-------------->| | + * | Disabled | | Sleep | | Receive | | Transmit | + * | |<-----------| |<-----------| |<--------------| | + * +----------+ Disable() +-------+ Sleep() +---------+ Receive() +----------+ + * (Radio OFF) or + * signal TransmitDone + * + * During the IEEE 802.15.4 data request command the transition Sleep->Receive->Transmit + * can be shortened to direct transition from Sleep to Transmit if the platform supports + * the OT_RADIO_CAPS_SLEEP_TO_TX capability. + */ + +/** + * This structure represents radio coexistence metrics. + */ +typedef struct otRadioCoexMetrics +{ + uint32_t mNumGrantGlitch; ///< Number of grant glitches. + uint32_t mNumTxRequest; ///< Number of tx requests. + uint32_t mNumTxGrantImmediate; ///< Number of tx requests while grant was active. + uint32_t mNumTxGrantWait; ///< Number of tx requests while grant was inactive. + uint32_t mNumTxGrantWaitActivated; ///< Number of tx requests while grant was inactive that were ultimately granted. + uint32_t mNumTxGrantWaitTimeout; ///< Number of tx requests while grant was inactive that timed out. + uint32_t mNumTxGrantDeactivatedDuringRequest; ///< Number of tx that were in progress when grant was deactivated. + uint32_t mNumTxDelayedGrant; ///< Number of tx requests that were not granted within 50us. + uint32_t mAvgTxRequestToGrantTime; ///< Average time in usec from tx request to grant. + uint32_t mNumRxRequest; ///< Number of rx requests. + uint32_t mNumRxGrantImmediate; ///< Number of rx requests while grant was active. + uint32_t mNumRxGrantWait; ///< Number of rx requests while grant was inactive. + uint32_t mNumRxGrantWaitActivated; ///< Number of rx requests while grant was inactive that were ultimately granted. + uint32_t mNumRxGrantWaitTimeout; ///< Number of rx requests while grant was inactive that timed out. + uint32_t mNumRxGrantDeactivatedDuringRequest; ///< Number of rx that were in progress when grant was deactivated. + uint32_t mNumRxDelayedGrant; ///< Number of rx requests that were not granted within 50us. + uint32_t mAvgRxRequestToGrantTime; ///< Average time in usec from rx request to grant. + uint32_t mNumRxGrantNone; ///< Number of rx requests that completed without receiving grant. + bool mStopped; ///< Stats collection stopped due to saturation. +} otRadioCoexMetrics; + +/** + * This structure represents what metrics are specified to query. + * + */ +typedef struct otLinkMetrics +{ + bool mPduCount : 1; ///< Pdu count. + bool mLqi : 1; ///< Link Quality Indicator. + bool mLinkMargin : 1; ///< Link Margin. + bool mRssi : 1; ///< Received Signal Strength Indicator. + bool mReserved : 1; ///< Reserved, this is for reference device. +} otLinkMetrics; + +/** + * @} + * + */ + +/** + * @defgroup radio-config Radio Configuration + * + * @brief + * This module includes the platform abstraction for radio configuration. + * + * @{ + * + */ + +/** + * Get the radio capabilities. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The radio capability bit vector (see `OT_RADIO_CAP_*` definitions). + * + */ +otRadioCaps otPlatRadioGetCaps(otInstance *aInstance); + +/** + * Get the radio version string. + * + * This is an optional radio driver platform function. If not provided by platform radio driver, OpenThread uses + * the OpenThread version instead (@sa otGetVersionString()). + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns A pointer to the OpenThread radio version. + * + */ +const char *otPlatRadioGetVersionString(otInstance *aInstance); + +/** + * Get the radio receive sensitivity value. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The radio receive sensitivity value in dBm. + * + */ +int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance); + +/** + * Gets the factory-assigned IEEE EUI-64 for this interface. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aIeeeEui64 A pointer to the factory-assigned IEEE EUI-64. + * + */ +void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64); + +/** + * Set the PAN ID for address filtering. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aPanId The IEEE 802.15.4 PAN ID. + * + */ +void otPlatRadioSetPanId(otInstance *aInstance, otPanId aPanId); + +/** + * Set the Extended Address for address filtering. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aExtAddress A pointer to the IEEE 802.15.4 Extended Address stored in little-endian byte order. + * + * + */ +void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtAddress); + +/** + * Set the Short Address for address filtering. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aShortAddress The IEEE 802.15.4 Short Address. + * + */ +void otPlatRadioSetShortAddress(otInstance *aInstance, otShortAddress aShortAddress); + +/** + * Get the radio's transmit power in dBm. + * + * @note The transmit power returned will be no larger than the power specified in the max power table for + * the current channel. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aPower The transmit power in dBm. + * + * @retval OT_ERROR_NONE Successfully retrieved the transmit power. + * @retval OT_ERROR_INVALID_ARGS @p aPower was NULL. + * @retval OT_ERROR_NOT_IMPLEMENTED Transmit power configuration via dBm is not implemented. + * + */ +otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower); + +/** + * Set the radio's transmit power in dBm. + * + * @note The real transmit power will be no larger than the power specified in the max power table for + * the current channel. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aPower The transmit power in dBm. + * + * @retval OT_ERROR_NONE Successfully set the transmit power. + * @retval OT_ERROR_NOT_IMPLEMENTED Transmit power configuration via dBm is not implemented. + * + */ +otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower); + +/** + * Get the radio's CCA ED threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE Successfully retrieved the CCA ED threshold. + * @retval OT_ERROR_INVALID_ARGS @p aThreshold was NULL. + * @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented. + * + */ +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold); + +/** + * Set the radio's CCA ED threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE Successfully set the transmit power. + * @retval OT_ERROR_INVALID_ARGS Given threshold is out of range. + * @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented. + * + */ +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold); + +/** + * Gets the external FEM's Rx LNA gain in dBm. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aGain The external FEM's Rx LNA gain in dBm. + * + * @retval OT_ERROR_NONE Successfully retrieved the external FEM's LNA gain. + * @retval OT_ERROR_INVALID_ARGS @p aGain was NULL. + * @retval OT_ERROR_NOT_IMPLEMENTED External FEM's LNA setting is not implemented. + * + */ +otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain); + +/** + * Sets the external FEM's Rx LNA gain in dBm. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aGain The external FEM's Rx LNA gain in dBm. + * + * @retval OT_ERROR_NONE Successfully set the external FEM's LNA gain. + * @retval OT_ERROR_NOT_IMPLEMENTED External FEM's LNA gain setting is not implemented. + * + */ +otError otPlatRadioSetFemLnaGain(otInstance *aInstance, int8_t aGain); + +/** + * Get the status of promiscuous mode. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @retval TRUE Promiscuous mode is enabled. + * @retval FALSE Promiscuous mode is disabled. + * + */ +bool otPlatRadioGetPromiscuous(otInstance *aInstance); + +/** + * Enable or disable promiscuous mode. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnable TRUE to enable or FALSE to disable promiscuous mode. + * + */ +void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable); + +/** + * Update MAC keys and key index + * + * This function is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aKeyIdMode The key ID mode. + * @param[in] aKeyId Current MAC key index. + * @param[in] aPrevKey A pointer to the previous MAC key. + * @param[in] aCurrKey A pointer to the current MAC key. + * @param[in] aNextKey A pointer to the next MAC key. + * @param[in] aKeyType Key Type used. + * + */ +void otPlatRadioSetMacKey(otInstance * aInstance, + uint8_t aKeyIdMode, + uint8_t aKeyId, + const otMacKeyMaterial *aPrevKey, + const otMacKeyMaterial *aCurrKey, + const otMacKeyMaterial *aNextKey, + otRadioKeyType aKeyType); + +/** + * This method sets the current MAC frame counter value. + * + * This function is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aMacFrameCounter The MAC frame counter value. + * + */ +void otPlatRadioSetMacFrameCounter(otInstance *aInstance, uint32_t aMacFrameCounter); + +/** + * Get the current estimated time (in microseconds) of the radio chip. + * + * This microsecond timer must be a free-running timer. The timer must continue to advance with microsecond precision + * even when the radio is in the sleep state. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The current time in microseconds. UINT64_MAX when platform does not support or radio time is not ready. + * + */ +uint64_t otPlatRadioGetNow(otInstance *aInstance); + +/** + * Get the bus speed in bits/second between the host and the radio chip. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The bus speed in bits/second between the host and the radio chip. + * Return 0 when the MAC and above layer and Radio layer resides on the same chip. + * + */ +uint32_t otPlatRadioGetBusSpeed(otInstance *aInstance); + +/** + * @} + * + */ + +/** + * @defgroup radio-operation Radio Operation + * + * @brief + * This module includes the platform abstraction for radio operations. + * + * @{ + * + */ + +/** + * Get current state of the radio. + * + * This function is not required by OpenThread. It may be used for debugging and/or application-specific purposes. + * + * @note This function may be not implemented. It does not affect OpenThread. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @return Current state of the radio. + * + */ +otRadioState otPlatRadioGetState(otInstance *aInstance); + +/** + * Enable the radio. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @retval OT_ERROR_NONE Successfully enabled. + * @retval OT_ERROR_FAILED The radio could not be enabled. + * + */ +otError otPlatRadioEnable(otInstance *aInstance); + +/** + * Disable the radio. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @retval OT_ERROR_NONE Successfully transitioned to Disabled. + * @retval OT_ERROR_INVALID_STATE The radio was not in sleep state. + * + */ +otError otPlatRadioDisable(otInstance *aInstance); + +/** + * Check whether radio is enabled or not. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns TRUE if the radio is enabled, FALSE otherwise. + * + */ +bool otPlatRadioIsEnabled(otInstance *aInstance); + +/** + * Transition the radio from Receive to Sleep (turn off the radio). + * + * @param[in] aInstance The OpenThread instance structure. + * + * @retval OT_ERROR_NONE Successfully transitioned to Sleep. + * @retval OT_ERROR_BUSY The radio was transmitting. + * @retval OT_ERROR_INVALID_STATE The radio was disabled. + * + */ +otError otPlatRadioSleep(otInstance *aInstance); + +/** + * Transition the radio from Sleep to Receive (turn on the radio). + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aChannel The channel to use for receiving. + * + * @retval OT_ERROR_NONE Successfully transitioned to Receive. + * @retval OT_ERROR_INVALID_STATE The radio was disabled or transmitting. + * + */ +otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel); + +/** + * Schedule a radio reception window at a specific time and duration. + * + * @param[in] aChannel The radio channel on which to receive. + * @param[in] aStart The receive window start time, in microseconds. + * @param[in] aDuration The receive window duration, in microseconds + * + * @retval OT_ERROR_NONE Successfully scheduled receive window. + * @retval OT_ERROR_FAILED The receive window could not be scheduled. + */ +otError otPlatRadioReceiveAt(otInstance *aInstance, uint8_t aChannel, uint32_t aStart, uint32_t aDuration); + +/** + * The radio driver calls this method to notify OpenThread of a received frame. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed. + * @param[in] aError OT_ERROR_NONE when successfully received a frame, + * OT_ERROR_ABORT when reception was aborted and a frame was not received, + * OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space. + * + */ +extern void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); + +/** + * The radio driver calls this method to notify OpenThread diagnostics module of a received frame. + * + * This function is used when diagnostics is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed. + * @param[in] aError OT_ERROR_NONE when successfully received a frame, + * OT_ERROR_ABORT when reception was aborted and a frame was not received, + * OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space. + * + */ +extern void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); + +/** + * Get the radio transmit frame buffer. + * + * OpenThread forms the IEEE 802.15.4 frame in this buffer then calls `otPlatRadioTransmit()` to request transmission. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns A pointer to the transmit frame buffer. + * + */ +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance); + +/** + * Begin the transmit sequence on the radio. + * + * The caller must form the IEEE 802.15.4 frame in the buffer provided by `otPlatRadioGetTransmitBuffer()` before + * requesting transmission. The channel and transmit power are also included in the otRadioFrame structure. + * + * The transmit sequence consists of: + * 1. Transitioning the radio to Transmit from one of the following states: + * - Receive if RX is on when the device is idle or OT_RADIO_CAPS_SLEEP_TO_TX is not supported + * - Sleep if RX is off when the device is idle and OT_RADIO_CAPS_SLEEP_TO_TX is supported. + * 2. Transmits the psdu on the given channel and at the given transmit power. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the frame to be transmitted. + * + * @retval OT_ERROR_NONE Successfully transitioned to Transmit. + * @retval OT_ERROR_INVALID_STATE The radio was not in the Receive state. + * + */ +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame); + +/** + * The radio driver calls this method to notify OpenThread that the transmission has started. + * + * @note This function should be called by the same thread that executes all of the other OpenThread code. It should + * not be called by ISR or any other task. + * + * @param[in] aInstance A pointer to the OpenThread instance structure. + * @param[in] aFrame A pointer to the frame that is being transmitted. + * + */ +extern void otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame); + +/** + * The radio driver calls this function to notify OpenThread that the transmit operation has completed, + * providing both the transmitted frame and, if applicable, the received ack frame. + * + * When radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability, radio platform layer updates @p aFrame + * with the security frame counter and key index values maintained by the radio. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the frame that was transmitted. + * @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received. + * @param[in] aError OT_ERROR_NONE when the frame was transmitted, + * OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received, + * OT_ERROR_CHANNEL_ACCESS_FAILURE tx could not take place due to activity on the channel, + * OT_ERROR_ABORT when transmission was aborted for other reasons. + * + */ +extern void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); + +/** + * The radio driver calls this method to notify OpenThread diagnostics module that the transmission has completed. + * + * This function is used when diagnostics is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the frame that was transmitted. + * @param[in] aError OT_ERROR_NONE when the frame was transmitted, + * OT_ERROR_CHANNEL_ACCESS_FAILURE tx could not take place due to activity on the channel, + * OT_ERROR_ABORT when transmission was aborted for other reasons. + * + */ +extern void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); + +/** + * Get the most recent RSSI measurement. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The RSSI in dBm when it is valid. 127 when RSSI is invalid. + * + */ +int8_t otPlatRadioGetRssi(otInstance *aInstance); + +/** + * Begin the energy scan sequence on the radio. + * + * This function is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aScanChannel The channel to perform the energy scan on. + * @param[in] aScanDuration The duration, in milliseconds, for the channel to be scanned. + * + * @retval OT_ERROR_NONE Successfully started scanning the channel. + * @retval OT_ERROR_BUSY The radio is performing enery scanning. + * @retval OT_ERROR_NOT_IMPLEMENTED The radio doesn't support energy scanning. + * + */ +otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration); + +/** + * The radio driver calls this method to notify OpenThread that the energy scan is complete. + * + * This function is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnergyScanMaxRssi The maximum RSSI encountered on the scanned channel. + * + */ +extern void otPlatRadioEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi); + +/** + * Enable/Disable source address match feature. + * + * The source address match feature controls how the radio layer decides the "frame pending" bit for acks sent in + * response to data request commands from children. + * + * If disabled, the radio layer must set the "frame pending" on all acks to data request commands. + * + * If enabled, the radio layer uses the source address match table to determine whether to set or clear the "frame + * pending" bit in an ack to a data request command. + * + * The source address match table provides the list of children for which there is a pending frame. Either a short + * address or an extended/long address can be added to the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnable Enable/disable source address match feature. + * + */ +void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable); + +/** + * Add a short address to the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aShortAddress The short address to be added. + * + * @retval OT_ERROR_NONE Successfully added short address to the source match table. + * @retval OT_ERROR_NO_BUFS No available entry in the source match table. + * + */ +otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress); + +/** + * Add an extended address to the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aExtAddress The extended address to be added stored in little-endian byte order. + * + * @retval OT_ERROR_NONE Successfully added extended address to the source match table. + * @retval OT_ERROR_NO_BUFS No available entry in the source match table. + * + */ +otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress); + +/** + * Remove a short address from the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aShortAddress The short address to be removed. + * + * @retval OT_ERROR_NONE Successfully removed short address from the source match table. + * @retval OT_ERROR_NO_ADDRESS The short address is not in source address match table. + * + */ +otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress); + +/** + * Remove an extended address from the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aExtAddress The extended address to be removed stored in little-endian byte order. + * + * @retval OT_ERROR_NONE Successfully removed the extended address from the source match table. + * @retval OT_ERROR_NO_ADDRESS The extended address is not in source address match table. + * + */ +otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress); + +/** + * Clear all short addresses from the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * + */ +void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance); + +/** + * Clear all the extended/long addresses from source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * + */ +void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance); + +/** + * Get the radio supported channel mask that the device is allowed to be on. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The radio supported channel mask. + * + */ +uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance); + +/** + * Gets the radio preferred channel mask that the device prefers to form on. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The radio preferred channel mask. + * + */ +uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance); + +/** + * Enable the radio coex. + * + * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnabled TRUE to enable the radio coex, FALSE otherwise. + * + * @retval OT_ERROR_NONE Successfully enabled. + * @retval OT_ERROR_FAILED The radio coex could not be enabled. + * + */ +otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled); + +/** + * Check whether radio coex is enabled or not. + * + * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns TRUE if the radio coex is enabled, FALSE otherwise. + * + */ +bool otPlatRadioIsCoexEnabled(otInstance *aInstance); + +/** + * Get the radio coexistence metrics. + * + * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aCoexMetrics A pointer to the coexistence metrics structure. + * + * @retval OT_ERROR_NONE Successfully retrieved the coex metrics. + * @retval OT_ERROR_INVALID_ARGS @p aCoexMetrics was NULL. + */ +otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics); + +/** + * Enable or disable CSL receiver. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aCslPeriod CSL period, 0 for disabling CSL. + * @param[in] aShortAddr The short source address of CSL receiver's peer. + * @param[in] aExtAddr The extended source address of CSL receiver's peer. + * + * @note Platforms should use CSL peer addresses to include CSL IE when generating enhanced acks. + * + * @retval kErrorNotImplemented Radio driver doesn't support CSL. + * @retval kErrorFailed Other platform specific errors. + * @retval kErrorNone Successfully enabled or disabled CSL. + * + */ +otError otPlatRadioEnableCsl(otInstance * aInstance, + uint32_t aCslPeriod, + otShortAddress aShortAddr, + const otExtAddress *aExtAddr); + +/** + * Update CSL sample time in radio driver. + * + * Sample time is stored in radio driver as a copy to calculate phase when sending ACK with CSL IE. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aCslSampleTime The latest sample time. + * + */ +void otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTime); + +/** + * Get the current accuracy, in units of ± ppm, of the clock used for scheduling CSL operations. + * + * @note Platforms may optimize this value based on operational conditions (i.e.: temperature). + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The current CSL rx/tx scheduling drift, in units of ± ppm. + * + */ +uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance); + +/** + * The fixed uncertainty of the Device for scheduling CSL Transmissions in units of 10 microseconds. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The CSL Uncertainty in units of 10 us. + * + */ +uint8_t otPlatRadioGetCslUncertainty(otInstance *aInstance); + +/** + * Set the max transmit power for a specific channel. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aChannel The radio channel. + * @param[in] aMaxPower The max power in dBm, passing OT_RADIO_RSSI_INVALID will disable this channel. + * + * @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented + * @retval OT_ERROR_INVALID_ARGS The specified channel is not valid. + * @retval OT_ERROR_FAILED Other platform specific errors. + * @retval OT_ERROR_NONE Successfully set max transmit power. + * + */ +otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower); + +/** + * Set the region code. + * + * The radio region format is the 2-bytes ascii representation of the + * ISO 3166 alpha-2 code. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aRegionCode The radio region. + * + * @retval OT_ERROR_FAILED Other platform specific errors. + * @retval OT_ERROR_NONE Successfully set region code. + * + */ +otError otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode); + +/** + * Get the region code. + * + * The radio region format is the 2-bytes ascii representation of the + * ISO 3166 alpha-2 code. + + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aRegionCode The radio region. + * + * @retval OT_ERROR_INVALID_ARGS @p aRegionCode is nullptr. + * @retval OT_ERROR_FAILED Other platform specific errors. + * @retval OT_ERROR_NONE Successfully got region code. + * + */ +otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode); + +/** + * Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator. + * + * After Enhanced-ACK Based Probing is configured by a specific Probing Initiator, the Enhanced-ACK sent to that + * node should include Vendor-Specific IE containing Link Metrics data. This method informs the radio to start/stop to + * collect Link Metrics data and include Vendor-Specific IE that containing the data in Enhanced-ACK sent to that + * Probing Initiator. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aLinkMetrics This parameter specifies what metrics to query. Per spec 4.11.3.4.4.6, at most 2 metrics + * can be specified. The probing would be disabled if @p `aLinkMetrics` is bitwise 0. + * @param[in] aShortAddress The short address of the Probing Initiator. + * @param[in] aExtAddress The extended source address of the Probing Initiator. @p aExtAddr MUST NOT be `NULL`. + * + * @retval OT_ERROR_NONE Successfully configured the Enhanced-ACK Based Probing. + * @retval OT_ERROR_INVALID_ARGS @p aExtAddress is `NULL`. + * @retval OT_ERROR_NOT_FOUND The Initiator indicated by @p aShortAddress is not found when trying to clear. + * @retval OT_ERROR_NO_BUFS No more Initiator can be supported. + * + */ +otError otPlatRadioConfigureEnhAckProbing(otInstance * aInstance, + otLinkMetrics aLinkMetrics, + otShortAddress aShortAddress, + const otExtAddress *aExtAddress); + +/** + * @} + * + */ + +/** + * @} + * + */ + +#ifdef __cplusplus +} // end of extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_RADIO_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/toolchain.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/toolchain.h new file mode 100644 index 0000000..5610985 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/toolchain.h @@ -0,0 +1,288 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @addtogroup plat-toolchain + * + * @brief + * This module defines a toolchain abstraction layer through macros. + * + * Usage: + * + * @code + * + * typedef + * OT_TOOL_PACKED_BEGIN + * struct + * { + * char mField1; + * union + * { + * char mField2; + * long mField3; + * } OT_TOOL_PACKED_FIELD; + * } OT_TOOL_PACKED_END packed_struct_t; + * + * @endcode + * + * @{ + * + */ + +#ifndef OPENTHREAD_PLATFORM_TOOLCHAIN_H_ +#define OPENTHREAD_PLATFORM_TOOLCHAIN_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @def OT_MUST_USE_RESULT + * + * Compiler-specific indication that a class or enum must be used when it is + * the return value of a function. + * + * @note This is currently only available with clang (C++17 implements it + * as attribute [[nodiscard]]). + * @note To suppress the 'unused-result' warning/error, please use the + * '-Wno-unused-result' compiler option. + * + */ +#if defined(__clang__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 9)) +#define OT_MUST_USE_RESULT __attribute__((warn_unused_result)) +#else +#define OT_MUST_USE_RESULT +#endif + +/** + * @def OT_TOOL_PACKED_BEGIN + * + * Compiler-specific indication that a class or struct must be byte packed. + * + */ + +/** + * @def OT_TOOL_PACKED_FIELD + * + * Indicate to the compiler a nested struct or union to be packed + * within byte packed class or struct. + * + */ + +/** + * @def OT_TOOL_PACKED_END + * + * Compiler-specific indication at the end of a byte packed class or struct. + * + */ + +/** + * @def OT_TOOL_WEAK + * + * Compiler-specific weak symbol modifier. + * + */ + +// =========== TOOLCHAIN SELECTION : START =========== + +#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) || defined(__TI_ARM__) + +// https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html +// http://www.keil.com/support/man/docs/armcc/armcc_chr1359124973480.htm + +#define OT_TOOL_PACKED_BEGIN +#define OT_TOOL_PACKED_FIELD __attribute__((packed)) +#define OT_TOOL_PACKED_END __attribute__((packed)) +#define OT_TOOL_WEAK __attribute__((weak)) + +#elif defined(__ICCARM__) || defined(__ICC8051__) + +// http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf + +#include "intrinsics.h" + +#define OT_TOOL_PACKED_BEGIN __packed +#define OT_TOOL_PACKED_FIELD +#define OT_TOOL_PACKED_END +#define OT_TOOL_WEAK __weak + +#elif defined(__SDCC) + +// Structures are packed by default in sdcc, as it primarily targets 8-bit MCUs. + +#define OT_TOOL_PACKED_BEGIN +#define OT_TOOL_PACKED_FIELD +#define OT_TOOL_PACKED_END +#define OT_TOOL_WEAK + +#else + +#error "Error: No valid Toolchain specified" + +// Symbols for Doxygen + +#define OT_TOOL_PACKED_BEGIN +#define OT_TOOL_PACKED_FIELD +#define OT_TOOL_PACKED_END +#define OT_TOOL_WEAK + +#endif + +// =========== TOOLCHAIN SELECTION : END =========== + +/** + * @def OT_UNUSED_VARIABLE + * + * Suppress unused variable warning in specific toolchains. + * + */ + +/** + * @def OT_UNREACHABLE_CODE + * + * Suppress Unreachable code warning in specific toolchains. + * + */ + +#if defined(__ICCARM__) + +#include + +#define OT_UNUSED_VARIABLE(VARIABLE) \ + do \ + { \ + if (&VARIABLE == NULL) \ + { \ + } \ + } while (false) + +#define OT_UNREACHABLE_CODE(CODE) \ + _Pragma("diag_suppress=Pe111") _Pragma("diag_suppress=Pe128") CODE _Pragma("diag_default=Pe111") \ + _Pragma("diag_default=Pe128") + +#elif defined(__CC_ARM) + +#include + +#define OT_UNUSED_VARIABLE(VARIABLE) \ + do \ + { \ + if (&VARIABLE == NULL) \ + { \ + } \ + } while (false) + +#define OT_UNREACHABLE_CODE(CODE) CODE + +#elif defined(__TI_ARM__) + +#include + +#define OT_UNUSED_VARIABLE(VARIABLE) \ + do \ + { \ + if (&VARIABLE == NULL) \ + { \ + } \ + } while (false) + +/* + * #112-D statement is unreachable + * #129-D loop is not reachable + */ +#define OT_UNREACHABLE_CODE(CODE) \ + _Pragma("diag_push") _Pragma("diag_suppress 112") _Pragma("diag_suppress 129") CODE _Pragma("diag_pop") + +#else + +#define OT_UNUSED_VARIABLE(VARIABLE) \ + do \ + { \ + (void)(VARIABLE); \ + } while (false) + +#define OT_UNREACHABLE_CODE(CODE) CODE + +#endif + +/* + * Keil and IAR compiler doesn't provide type limits for C++. + */ +#ifdef __cplusplus +#if defined(__CC_ARM) || defined(__ICCARM__) + +#ifndef UINT8_MAX +#define UINT8_MAX 0xff +#endif + +#ifndef UINT16_MAX +#define UINT16_MAX 0xffff +#endif + +#endif +#endif + +#ifdef __APPLE__ +#define OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT(...) \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wgnu-folding-constant\"") \ + __VA_ARGS__ _Pragma("GCC diagnostic pop") +#else +#define OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT(...) __VA_ARGS__ +#endif + +/** + * @def OT_FALL_THROUGH + * + * Suppress fall through warning in specific compiler. + * + */ +#if defined(__cplusplus) && (__cplusplus >= 201703L) +#define OT_FALL_THROUGH [[fallthrough]] +#elif defined(__clang__) +#define OT_FALL_THROUGH [[clang::fallthrough]] +#elif defined(__GNUC__) && (__GNUC__ >= 7) +#define OT_FALL_THROUGH __attribute__((fallthrough)) +#else +#define OT_FALL_THROUGH \ + do \ + { \ + } while (false) /* fallthrough */ +#endif + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_TOOLCHAIN_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/arg_macros.hpp b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/arg_macros.hpp new file mode 100644 index 0000000..e832f2f --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/arg_macros.hpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2020, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes macros for parsing variadic arguments. + */ + +#ifndef OT_ARG_MACROS_HPP_ +#define OT_ARG_MACROS_HPP_ + +/** + * This macro returns the first argument in a list of input arguments. + * + * @param[in] ... A list of arguments (MUST contain at least one). + * + * @returns The first argument in the given list of input arguments. + * + */ +#define OT_FIRST_ARG(...) _OT_GET_FIRST_ARG(__VA_ARGS__, JUNK) + +/** + * This macro returns the second argument in a list of input arguments if any. + * + * @note: This macro works when the list contains either one or two arguments. + * + * @param[in] ... A list of arguments (MUST contain either one or two arguments). + * + * @returns The second argument if any. + * + */ +#define OT_SECOND_ARG(...) _OT_GET_SECOND_ARG(_OT_HAS_ONE_ARG_OR_TWO_ARGS(__VA_ARGS__), __VA_ARGS__) + +/** + * This macro expands to comma separated list of arguments excluding the first one. + * + * If there is only one argument, it expands to empty. If there is more than one argument, it expands to an initial + * comma followed by all the rest of arguments excluding the first one. + * + * @note: This macro supports up to 20 arguments. + * + * @param[in] ... A list of arguments (MUST contain at least one). + * + * @returns A comma separated list of arguments excluding the first one. + * + */ +#define OT_REST_ARGS(...) _OT_GET_REST_ARGS(_OT_HAS_ONE_ARG_VS_TWO_OR_MORE(__VA_ARGS__), __VA_ARGS__) + +//--------------------------------------------------------------------------------------------------------------------- +// Private/local macros - for use in this header only. + +#define _OT_GET_FIRST_ARG(aFirst, ...) aFirst + +#define _OT_HAS_ONE_ARG_OR_TWO_ARGS(...) _OT_SELECT_3(__VA_ARGS__, TWO_ARGS, ONE_ARG, JUNK) +#define _OT_SELECT_3(a1, a2, a3, ...) a3 + +#define _OT_GET_SECOND_ARG(aNum, ...) _OT_GET_SECOND_APPEND_NUM_ARGS(aNum, __VA_ARGS__) +#define _OT_GET_SECOND_APPEND_NUM_ARGS(aNum, ...) _OT_GET_SECOND_WITH_##aNum(__VA_ARGS__) + +#define _OT_GET_SECOND_WITH_ONE_ARG(aFirst) +#define _OT_GET_SECOND_WITH_TWO_ARGS(aFirst, aSecond) aSecond + +#define _OT_GET_REST_ARGS(aNum, ...) _OT_GET_REST_APPEND_NUM_ARGS(aNum, __VA_ARGS__) +#define _OT_GET_REST_APPEND_NUM_ARGS(aNum, ...) _OT_GET_REST_WITH_##aNum(__VA_ARGS__) + +#define _OT_GET_REST_WITH_ONE_ARG(aFirst) +#define _OT_GET_REST_WITH_TWO_OR_MORE_ARGS(aFirst, ...) , __VA_ARGS__ + +#define _OT_HAS_ONE_ARG_VS_TWO_OR_MORE(...) \ + _OT_SELECT_20(__VA_ARGS__, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, \ + TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, \ + TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, \ + TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, ONE_ARG, JUNK) + +#define _OT_SELECT_20(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, ...) \ + a20 + +#endif // OT_ARG_MACROS_HPP_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/code_utils.hpp b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/code_utils.hpp new file mode 100644 index 0000000..78e01c6 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/code_utils.hpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes macros for validating runtime conditions. + */ + +#ifndef CODE_UTILS_HPP_ +#define CODE_UTILS_HPP_ + +#include + +#include + +#include "common/arg_macros.hpp" + +/** + * This macro calculates the number of elements in an array. + * + * @param[in] aArray Name of the array variable. + * + * @returns Number of elements in the array. + * + */ +#define OT_ARRAY_LENGTH(aArray) (sizeof(aArray) / sizeof(aArray[0])) + +/** + * This macro returns a pointer to end of a given array (pointing to the past-the-end element). + * + * Note that the past-the-end element is a theoretical element that would follow the last element in the array. It does + * not point to an actual element in array, and thus should not be dereferenced. + * + * @param[in] Name of the array variable + * + * @returns Pointer to the past-the-end element. + * + */ +#define OT_ARRAY_END(aArray) (&aArray[OT_ARRAY_LENGTH(aArray)]) + +/** + * This macro returns a pointer aligned by @p aAlignment. + * + * @param[in] aPointer A pointer to contiguous space. + * @param[in] aAlignment The desired alignment. + * + * @returns The aligned pointer. + * + */ +#define OT_ALIGN(aPointer, aAlignment) \ + ((void *)(((uintptr_t)(aPointer) + (aAlignment)-1UL) & ~((uintptr_t)(aAlignment)-1UL))) + +// Calculates the aligned variable size. +#define OT_ALIGNED_VAR_SIZE(size, align_type) (((size) + (sizeof(align_type) - 1)) / sizeof(align_type)) + +// Allocate the structure using "raw" storage. +#define OT_DEFINE_ALIGNED_VAR(name, size, align_type) \ + align_type name[(((size) + (sizeof(align_type) - 1)) / sizeof(align_type))] + +/** + * This macro returns the smaller of @p a and @p b. + * + */ +#define OT_MIN(a, b) ((b) < (a) ? (b) : (a)) + +/** + * This macro returns the greater of @p a and @p b. + * + */ +#define OT_MAX(a, b) ((a) < (b) ? (b) : (a)) + +/** + * This macro checks for the specified status, which is expected to commonly be successful, and branches to the local + * label 'exit' if the status is unsuccessful. + * + * @param[in] aStatus A scalar status to be evaluated against zero (0). + * + */ +#define SuccessOrExit(aStatus) \ + do \ + { \ + if ((aStatus) != 0) \ + { \ + goto exit; \ + } \ + } while (false) + +/** + * This macro checks for the specified condition, which is expected to commonly be true, and both executes @a ... and + * branches to the local label 'exit' if the condition is false. + * + * @param[in] aCondition A Boolean expression to be evaluated. + * @param[in] aAction An optional expression or block to execute when the assertion fails. + * + */ +#define VerifyOrExit(...) \ + do \ + { \ + if (!(OT_FIRST_ARG(__VA_ARGS__))) \ + { \ + OT_SECOND_ARG(__VA_ARGS__); \ + goto exit; \ + } \ + } while (false) + +/** + * This macro unconditionally executes @a ... and branches to the local label 'exit'. + * + * @note The use of this interface implies neither success nor failure for the overall exit status of the enclosing + * function body. + * + * @param[in] ... An optional expression or block to execute when the assertion fails. + * + */ +#define ExitNow(...) \ + do \ + { \ + __VA_ARGS__; \ + goto exit; \ + } while (false) + +/* + * This macro executes the `statement` and ignores the return value. + * + * This is primarily used to indicate the intention of developer that the return value of a function/method can be + * safely ignored. + * + * @param[in] aStatement The function/method to execute. + * + */ +#define IgnoreReturnValue(aStatement) \ + do \ + { \ + if (aStatement) \ + { \ + } \ + } while (false) + +/** + * This function ignores an error explicitly. + * + * This is primarily used to indicate the intention of developer that + * the error can be safely ignored or there is guaranteed to be no error. + * + * @param[in] aError The error to be ignored. + * + */ +static inline void IgnoreError(otError aError) +{ + OT_UNUSED_VARIABLE(aError); +} + +#endif // CODE_UTILS_HPP_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/IncludeFile.QorvoGP712_rpi_cli_ftd_socket b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/IncludeFile.QorvoGP712_rpi_cli_ftd_socket new file mode 100644 index 0000000..c3ced72 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/IncludeFile.QorvoGP712_rpi_cli_ftd_socket @@ -0,0 +1,238 @@ +# To be used with an 'include' statement in another makefile +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/gp712_rpi_cli_ftd_socket.py + +PYTHON_BIN?=/usr/bin/python3 + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_config.h + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_config.h +FLAGS= +FLAGS+=-DGP_CONFIG_HEADER + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) + + +#Depends on: +# src: +COMPS+=gpBaseComps +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) + + +#Depends on: +# src: +COMPS+=gpBsp +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) + + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) + + +#Depends on: +# src: gpAssert +COMPS+=gpLog +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) + + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC+=$(INC_gpMacCore) + + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC+=$(INC_gpMacDispatcher) + + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) + + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) + + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) + + +#Depends on: +# src: +COMPS+=gpVersion +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC+=$(INC_gpVersion) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + + +#Depends on: +# src: gpAssert, gpReset, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=rt +LIB_halLinux+=pthread +LIB+=$(LIB_halLinux) + + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/gp712 +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC+=$(INC_qvOT) + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_config.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_config.h new file mode 100644 index 0000000..25a1551 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_config.h @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_config.h" + * + */ + +#ifndef _QORVO_CONFIG_H_ +#define _QORVO_CONFIG_H_ + +/* + * Version info + */ + +#define GP_CHANGELIST 144207 +#define GP_VERSIONINFO_APP QorvoGP712_rpi_cli_ftd_socket +#define GP_VERSIONINFO_BASE_COMPS 0,0,0,0 +#define GP_VERSIONINFO_BLE_COMPS 2,10,3,1 +#define GP_VERSIONINFO_DATE 2023-07-06 +#define GP_VERSIONINFO_GLOBAL_VERSION 1,2,0,4 +#define GP_VERSIONINFO_HOST UNKNOWN +#define GP_VERSIONINFO_PROJECT P959_OpenThread +#define GP_VERSIONINFO_USER ak105542@UNKNOWN + + +/* + * Component: gpAssert + */ + +/* Length of the filename string to be printed */ +#define GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH 160 + + +/* + * Component: gpBsp + */ + +/* Contains filename of BSP header file to include */ +#define GP_BSP_FILENAME "gpBsp_linux_user.h" + + +/* + * Component: gpCom + */ + +/* To be specified when using multiple comms */ +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_IOCTL_USER1 + +/* Maximum amount of modules supported for Rx handling by gpCom. Environment already calculates minimal required module ID's */ +#define GP_COM_MAX_NUMBER_OF_MODULE_IDS 10 + +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE 500 + +#define GP_COM_RX_PACKET_BUFFERS 50 + + +/* + * Component: gphal + */ + +/* Amount of 64-bit long IEEE addresses entries to keep data pending for */ +#define GPHAL_DP_LONG_LIST_MAX 10 + +/* Amount of 16-bit short address entries to keep data pending for */ +#define GPHAL_DP_SHORT_LIST_MAX 10 + + +/* + * Component: gpMacCore + */ + +/* Number of known Neighbours for use with indirect transmission */ +#define GP_MACCORE_MAX_NEIGHBOURS 10 + + +/* + * Component: gpPoolMem + */ + +/* Number of packet descriptors */ +#define GP_PD_NR_OF_HANDLES 20 + + +/* + * Component: gpSched + */ + +#define GP_SCHED_EVENT_LIST_SIZE 50 + +/* Don't include the implementation for our mainloop MAIN_FUNCTION_NAME */ +#define GP_SCHED_EXTERNAL_MAIN + +/* Callback after every main loop iteration. */ +#define GP_SCHED_NR_OF_IDLE_CALLBACKS 0 + + +#include "qorvo_internals.h" + +#endif //_QORVO_CONFIG_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_internals.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_internals.h new file mode 100644 index 0000000..8c0b659 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_ftd_socket/gen/qorvo_internals.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_internals.h" + * + */ + +#ifndef _QORVO_INTERNALS_H_ +#define _QORVO_INTERNALS_H_ + +/* + * Enabled components + */ + +#define GP_COMP_ASSERT +#define GP_COMP_BASECOMPS +#define GP_COMP_COM +#define GP_COMP_MACDISPATCHER +#define GP_COMP_PD +#define GP_COMP_POOLMEM +#define GP_COMP_RANDOM +#define GP_COMP_VERSION + +/* + * Components numeric ids + */ + +#define GP_COMPONENT_ID_APP 1 +#define GP_COMPONENT_ID_ASSERT 29 +#define GP_COMPONENT_ID_BASECOMPS 35 +#define GP_COMPONENT_ID_BSP 8 +#define GP_COMPONENT_ID_COM 10 +#define GP_COMPONENT_ID_ENCRYPTION 124 +#define GP_COMPONENT_ID_GPHAL 7 +#define GP_COMPONENT_ID_HALLINUX 6 +#define GP_COMPONENT_ID_LOG 11 +#define GP_COMPONENT_ID_MACCORE 109 +#define GP_COMPONENT_ID_MACDISPATCHER 114 +#define GP_COMPONENT_ID_PAD 126 +#define GP_COMPONENT_ID_PD 104 +#define GP_COMPONENT_ID_POOLMEM 106 +#define GP_COMPONENT_ID_QVOT 157 +#define GP_COMPONENT_ID_RANDOM 108 +#define GP_COMPONENT_ID_RESET 33 +#define GP_COMPONENT_ID_RXARBITER 2 +#define GP_COMPONENT_ID_SCHED 9 +#define GP_COMPONENT_ID_STAT 22 +#define GP_COMPONENT_ID_UTILS 4 +#define GP_COMPONENT_ID_VERSION 129 +#define GP_COMPONENT_ID_WMRK 51 + +/* + * Other flags + */ + +#define GP_DIVERSITY_LOG +#define GP_DIVERSITY_NR_OF_STACKS 2 +#define GP_GIT_SHA 2334f506f9cba16a755256babb1eb0a69878a600 +#define GP_GIT_SHA_SHORT 2334f +#define GP_SCHED_DEFAULT_GOTOSLEEP_THRES 1000 +#define OPENTHREAD_COMMISSIONER +#define QORVOOPENTHREAD_MAX_CHILDREN 10 + +#endif //_QORVO_INTERNALS_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/IncludeFile.QorvoGP712_rpi_cli_mtd_socket b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/IncludeFile.QorvoGP712_rpi_cli_mtd_socket new file mode 100644 index 0000000..ae806cd --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/IncludeFile.QorvoGP712_rpi_cli_mtd_socket @@ -0,0 +1,238 @@ +# To be used with an 'include' statement in another makefile +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/gp712_rpi_cli_mtd_socket.py + +PYTHON_BIN?=/usr/bin/python3 + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_config.h + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_config.h +FLAGS= +FLAGS+=-DGP_CONFIG_HEADER + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) + + +#Depends on: +# src: +COMPS+=gpBaseComps +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) + + +#Depends on: +# src: +COMPS+=gpBsp +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) + + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) + + +#Depends on: +# src: gpAssert +COMPS+=gpLog +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) + + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC+=$(INC_gpMacCore) + + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC+=$(INC_gpMacDispatcher) + + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) + + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) + + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) + + +#Depends on: +# src: +COMPS+=gpVersion +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC+=$(INC_gpVersion) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + + +#Depends on: +# src: gpAssert, gpReset, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=rt +LIB_halLinux+=pthread +LIB+=$(LIB_halLinux) + + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/gp712 +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC+=$(INC_qvOT) + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_config.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_config.h new file mode 100644 index 0000000..f0c1a97 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_config.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_config.h" + * + */ + +#ifndef _QORVO_CONFIG_H_ +#define _QORVO_CONFIG_H_ + +/* + * Version info + */ + +#define GP_CHANGELIST 144207 +#define GP_VERSIONINFO_APP QorvoGP712_rpi_cli_mtd_socket +#define GP_VERSIONINFO_BASE_COMPS 0,0,0,0 +#define GP_VERSIONINFO_BLE_COMPS 2,10,3,1 +#define GP_VERSIONINFO_DATE 2023-07-06 +#define GP_VERSIONINFO_GLOBAL_VERSION 1,2,0,4 +#define GP_VERSIONINFO_HOST UNKNOWN +#define GP_VERSIONINFO_PROJECT P959_OpenThread +#define GP_VERSIONINFO_USER ak105542@UNKNOWN + + +/* + * Component: gpAssert + */ + +/* Length of the filename string to be printed */ +#define GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH 160 + + +/* + * Component: gpBsp + */ + +/* Contains filename of BSP header file to include */ +#define GP_BSP_FILENAME "gpBsp_linux_user.h" + + +/* + * Component: gpCom + */ + +/* To be specified when using multiple comms */ +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_IOCTL_USER1 + +/* Maximum amount of modules supported for Rx handling by gpCom. Environment already calculates minimal required module ID's */ +#define GP_COM_MAX_NUMBER_OF_MODULE_IDS 10 + +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE 500 + +#define GP_COM_RX_PACKET_BUFFERS 50 + + +/* + * Component: gpPoolMem + */ + +/* Number of packet descriptors */ +#define GP_PD_NR_OF_HANDLES 20 + + +/* + * Component: gpSched + */ + +#define GP_SCHED_EVENT_LIST_SIZE 50 + +/* Don't include the implementation for our mainloop MAIN_FUNCTION_NAME */ +#define GP_SCHED_EXTERNAL_MAIN + +/* Callback after every main loop iteration. */ +#define GP_SCHED_NR_OF_IDLE_CALLBACKS 0 + + +#include "qorvo_internals.h" + +#endif //_QORVO_CONFIG_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_internals.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_internals.h new file mode 100644 index 0000000..5d94b32 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_cli_mtd_socket/gen/qorvo_internals.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_internals.h" + * + */ + +#ifndef _QORVO_INTERNALS_H_ +#define _QORVO_INTERNALS_H_ + +/* + * Enabled components + */ + +#define GP_COMP_ASSERT +#define GP_COMP_BASECOMPS +#define GP_COMP_COM +#define GP_COMP_MACDISPATCHER +#define GP_COMP_PD +#define GP_COMP_POOLMEM +#define GP_COMP_RANDOM +#define GP_COMP_VERSION + +/* + * Components numeric ids + */ + +#define GP_COMPONENT_ID_APP 1 +#define GP_COMPONENT_ID_ASSERT 29 +#define GP_COMPONENT_ID_BASECOMPS 35 +#define GP_COMPONENT_ID_BSP 8 +#define GP_COMPONENT_ID_COM 10 +#define GP_COMPONENT_ID_ENCRYPTION 124 +#define GP_COMPONENT_ID_GPHAL 7 +#define GP_COMPONENT_ID_HALLINUX 6 +#define GP_COMPONENT_ID_LOG 11 +#define GP_COMPONENT_ID_MACCORE 109 +#define GP_COMPONENT_ID_MACDISPATCHER 114 +#define GP_COMPONENT_ID_PAD 126 +#define GP_COMPONENT_ID_PD 104 +#define GP_COMPONENT_ID_POOLMEM 106 +#define GP_COMPONENT_ID_QVOT 157 +#define GP_COMPONENT_ID_RANDOM 108 +#define GP_COMPONENT_ID_RESET 33 +#define GP_COMPONENT_ID_RXARBITER 2 +#define GP_COMPONENT_ID_SCHED 9 +#define GP_COMPONENT_ID_STAT 22 +#define GP_COMPONENT_ID_UTILS 4 +#define GP_COMPONENT_ID_VERSION 129 +#define GP_COMPONENT_ID_WMRK 51 + +/* + * Other flags + */ + +#define GP_DIVERSITY_LOG +#define GP_DIVERSITY_NR_OF_STACKS 2 +#define GP_GIT_SHA 2334f506f9cba16a755256babb1eb0a69878a600 +#define GP_GIT_SHA_SHORT 2334f +#define GP_SCHED_DEFAULT_GOTOSLEEP_THRES 1000 + +#endif //_QORVO_INTERNALS_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/IncludeFile.QorvoGP712_rpi_rcp_socket b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/IncludeFile.QorvoGP712_rpi_rcp_socket new file mode 100644 index 0000000..cfee9a5 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/IncludeFile.QorvoGP712_rpi_rcp_socket @@ -0,0 +1,238 @@ +# To be used with an 'include' statement in another makefile +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/gp712_rpi_rcp_socket.py + +PYTHON_BIN?=/usr/bin/python3 + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_config.h + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_config.h +FLAGS= +FLAGS+=-DGP_CONFIG_HEADER + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) + + +#Depends on: +# src: +COMPS+=gpBaseComps +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) + + +#Depends on: +# src: +COMPS+=gpBsp +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) + + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) + + +#Depends on: +# src: gpAssert +COMPS+=gpLog +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) + + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC+=$(INC_gpMacCore) + + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC+=$(INC_gpMacDispatcher) + + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) + + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) + + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) + + +#Depends on: +# src: +COMPS+=gpVersion +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC+=$(INC_gpVersion) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + + +#Depends on: +# src: gpAssert, gpReset, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=rt +LIB_halLinux+=pthread +LIB+=$(LIB_halLinux) + + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/gp712 +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC+=$(INC_qvOT) + + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_config.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_config.h new file mode 100644 index 0000000..adc87a4 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_config.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_config.h" + * + */ + +#ifndef _QORVO_CONFIG_H_ +#define _QORVO_CONFIG_H_ + +/* + * Version info + */ + +#define GP_CHANGELIST 144207 +#define GP_VERSIONINFO_APP QorvoGP712_rpi_rcp_socket +#define GP_VERSIONINFO_BASE_COMPS 0,0,0,0 +#define GP_VERSIONINFO_BLE_COMPS 2,10,3,1 +#define GP_VERSIONINFO_DATE 2023-07-06 +#define GP_VERSIONINFO_GLOBAL_VERSION 1,2,0,4 +#define GP_VERSIONINFO_HOST UNKNOWN +#define GP_VERSIONINFO_PROJECT P959_OpenThread +#define GP_VERSIONINFO_USER ak105542@UNKNOWN + + +/* + * Component: gpAssert + */ + +/* Length of the filename string to be printed */ +#define GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH 160 + + +/* + * Component: gpBsp + */ + +/* Contains filename of BSP header file to include */ +#define GP_BSP_FILENAME "gpBsp_linux_user.h" + + +/* + * Component: gpCom + */ + +/* To be specified when using multiple comms */ +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_IOCTL_USER1 + +/* Maximum amount of modules supported for Rx handling by gpCom. Environment already calculates minimal required module ID's */ +#define GP_COM_MAX_NUMBER_OF_MODULE_IDS 10 + +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE 500 + +#define GP_COM_RX_PACKET_BUFFERS 50 + + +/* + * Component: gpPoolMem + */ + +/* Number of packet descriptors */ +#define GP_PD_NR_OF_HANDLES 20 + + +/* + * Component: gpSched + */ + +#define GP_SCHED_EVENT_LIST_SIZE 50 + +/* Don't include the implementation for our mainloop MAIN_FUNCTION_NAME */ +#define GP_SCHED_EXTERNAL_MAIN + +/* Callback after every main loop iteration. */ +#define GP_SCHED_NR_OF_IDLE_CALLBACKS 0 + + +#include "qorvo_internals.h" + +#endif //_QORVO_CONFIG_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_internals.h b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_internals.h new file mode 100644 index 0000000..5d94b32 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/code/Work/Applications/P959_OpenThread/QorvoGP712_rpi_rcp_socket/gen/qorvo_internals.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_internals.h" + * + */ + +#ifndef _QORVO_INTERNALS_H_ +#define _QORVO_INTERNALS_H_ + +/* + * Enabled components + */ + +#define GP_COMP_ASSERT +#define GP_COMP_BASECOMPS +#define GP_COMP_COM +#define GP_COMP_MACDISPATCHER +#define GP_COMP_PD +#define GP_COMP_POOLMEM +#define GP_COMP_RANDOM +#define GP_COMP_VERSION + +/* + * Components numeric ids + */ + +#define GP_COMPONENT_ID_APP 1 +#define GP_COMPONENT_ID_ASSERT 29 +#define GP_COMPONENT_ID_BASECOMPS 35 +#define GP_COMPONENT_ID_BSP 8 +#define GP_COMPONENT_ID_COM 10 +#define GP_COMPONENT_ID_ENCRYPTION 124 +#define GP_COMPONENT_ID_GPHAL 7 +#define GP_COMPONENT_ID_HALLINUX 6 +#define GP_COMPONENT_ID_LOG 11 +#define GP_COMPONENT_ID_MACCORE 109 +#define GP_COMPONENT_ID_MACDISPATCHER 114 +#define GP_COMPONENT_ID_PAD 126 +#define GP_COMPONENT_ID_PD 104 +#define GP_COMPONENT_ID_POOLMEM 106 +#define GP_COMPONENT_ID_QVOT 157 +#define GP_COMPONENT_ID_RANDOM 108 +#define GP_COMPONENT_ID_RESET 33 +#define GP_COMPONENT_ID_RXARBITER 2 +#define GP_COMPONENT_ID_SCHED 9 +#define GP_COMPONENT_ID_STAT 22 +#define GP_COMPONENT_ID_UTILS 4 +#define GP_COMPONENT_ID_VERSION 129 +#define GP_COMPONENT_ID_WMRK 51 + +/* + * Other flags + */ + +#define GP_DIVERSITY_LOG +#define GP_DIVERSITY_NR_OF_STACKS 2 +#define GP_GIT_SHA 2334f506f9cba16a755256babb1eb0a69878a600 +#define GP_GIT_SHA_SHORT 2334f +#define GP_SCHED_DEFAULT_GOTOSLEEP_THRES 1000 + +#endif //_QORVO_INTERNALS_H_ diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/make/compilers/bcmcommon/compiler_defines.mk b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/make/compilers/bcmcommon/compiler_defines.mk new file mode 100644 index 0000000..1838dc5 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/make/compilers/bcmcommon/compiler_defines.mk @@ -0,0 +1,77 @@ +#------- Toolchain ------------------------ + +TOOLCHAIN ?=$(error specify TOOLCHAIN dir) +TOOLCHAINBIN ?=$(TOOLCHAIN)/bin +ARCH ?=$(error specify ARCH) +CROSS_COMPILE ?=$(error specify CROSS_COMPILE) + +# Define programs and commands. +CC = $(TOOLCHAINBIN)/$(CROSS_COMPILE)gcc +CXX = $(TOOLCHAINBIN)/$(CROSS_COMPILE)g++ +AR = $(TOOLCHAINBIN)/$(CROSS_COMPILE)ar rsc +LINK = $(TOOLCHAINBIN)/$(CROSS_COMPILE)ld +OBJCOPY = $(TOOLCHAINBIN)/$(CROSS_COMPILE)objcopy +OBJDUMP = $(TOOLCHAINBIN)/$(CROSS_COMPILE)objdump +SIZE = $(TOOLCHAINBIN)/$(CROSS_COMPILE)size -A +NM = $(TOOLCHAINBIN)/$(CROSS_COMPILE)nm + +#------- Extensions ------------------------ + +PROGRAM_EXT :=elf +LIB_EXT :=a + +#------- Specific defines ------------------------ + +MCU_HAL ?= halLinux + +#------- C compiler options ------------------------ + +# Compiler flag to set the C Standard level. +# c89 = "ANSI" C +# gnu89 = c89 plus GCC extensions +# c99 = ISO C99 standard (not yet fully implemented) +# gnu99 = c99 plus GCC extensions +CFLAGS_COMPILER +=-std=gnu99 +CFLAGS_COMPILER +=$(subst $<,-Werror,$(filter $<,$(SRC_NOWARNING))) +ifneq (,$(PREINCLUDE_HEADER)) +CFLAGS_COMPILER +=-include $(PREINCLUDE_HEADER) +endif + +#------- C++ compiler options ------------------------ + +CXXFLAGS_COMPILER +=-std=c++11 +ifneq (,$(PREINCLUDE_HEADER)) +CXXFLAGS_COMPILER +=-include $(PREINCLUDE_HEADER) +endif + +#------- Assemble options ------------------------ + +ASFLAGS_COMPILER += + +#------- Linker options ------------------------ + +ifneq (,$(BUILDOPT_STRIP)) + # Strip symbols and debug info from executable file. + LDFLAGS_COMPILER += -Wl,--strip-all +endif + +# FIXME - Check use - Compiler flags to generate dependency files. +GENDEPFLAGS_COMPILER = -MM -MF $(DIRDEP)/$(*F).d -MT $(DIROBJ)/$(*F).o +#------- Library options ------------------------ + +#Check if real location of library was used +LIBFILES =$(wildcard $(LIB)) +LIBIMPLICIT =$(filter-out $(LIBFILES),$(LIB)) + +LIBFLAGS_DIR=$(sort $(subst \,/, $(patsubst %, -L%, $(dir $(LIBFILES))))) +#end up with -lLibName for full location and implicit location +LIBNAMES =$(sort $(addprefix -l,$(patsubst lib%,%,$(notdir $(basename $(LIBFILES)) $(LIBIMPLICIT))))) + +LIBFLAGS_COMPILER+=-Wl,--start-group $(LIBNAMES) -Wl,--end-group +ifneq (,$(LIBNAMES_WHOLE)) +LIBFLAGS_COMPILER+=-Wl,--whole-archive $(LIBNAMES_WHOLE) -Wl,--no-whole-archive +endif +LIBFLAGS_COMPILER+=$(LIBFLAGS_DIR) + +#------- Linkerscripts ------------------------ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/make/compilers/rpi_bcm2708/compiler_defines.mk b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/make/compilers/rpi_bcm2708/compiler_defines.mk new file mode 100644 index 0000000..b0c4c1d --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/make/compilers/rpi_bcm2708/compiler_defines.mk @@ -0,0 +1,85 @@ +#------- Toolchain ------------------------ + +# Define directories, if needed. + +include $(ENV_PATH)/make/compilers/bcmcommon/compiler_defines.mk + +#---------------- Compiler Options ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing + +FLAGS_COMPILER += -Os +FLAGS_COMPILER += -march=armv6j +FLAGS_COMPILER += -Wall +#Find alignment problems due to casting +#FLAGS_COMPILER += -Wcast-align +FLAGS_COMPILER += -fomit-frame-pointer +FLAGS_COMPILER += -fno-strict-aliasing +#CFLAGS_COMPILER += -mno-abicalls +ifneq (,$(FLAGS_COMPILER_PIC_CODE)) +FLAGS_COMPILER += -fPIC +else +FLAGS_COMPILER += -fno-pic +endif +FLAGS_COMPILER += -ffreestanding +ifneq (,$(PREINCLUDE_HEADER)) +FLAGS_COMPILER += -include $(PREINCLUDE_HEADER) +endif + +#-- folowing compiler flags added by BRDB +FLAGS_COMPILER += -mfloat-abi=hard +FLAGS_COMPILER += -mfpu=vfp +FLAGS_COMPILER += -pipe +FLAGS_COMPILER +=--sysroot=$(SYSTEMROOT) + +ifeq (,$(FLAGS_COMPILER_DISABLE_ALIGNMENT_WARNING)) +FLAGS_COMPILER += $(if $(filter $<,$(SRC_DISABLE_ALIGNMENT_WARNING)),,-Wcast-align) +endif + +#Option to remove FLAGS +FLAGS_COMPILER_FILTERED = $(filter-out $(FLAGS_COMPILER_FILTER_OUT), $(FLAGS_COMPILER)) +ifneq (,$(FLAGS_COMPILER_FILTER_OUT)) +$(warning Filtering out compiler flags: $(FLAGS_COMPILER_FILTER_OUT)) +endif +#------- C compiler options ------------------------ + +CFLAGS_COMPILER += $(FLAGS_COMPILER_FILTERED) + +#------- C++ compiler options ------------------------ + +CXXFLAGS_COMPILER += $(FLAGS_COMPILER_FILTERED) +CXXFLAGS_COMPILER +=-Wno-reorder +CXXFLAGS_COMPILER +=-Wno-unknown-pragmas +CXXFLAGS_COMPILER +=-Wno-sign-compare +CXXFLAGS_COMPILER +=-Wno-unused-function +CXXFLAGS_COMPILER +=-std=c++11 +CXXFLAGS_COMPILER +=-g + + +#------- Assemble options ------------------------ + +ASFLAGS_COMPILER+= + +#------- Linker options ------------------------ + +LDFLAGS_COMPILER+=--sysroot=$(SYSTEMROOT) + +#Split in file and extension - if rule linking has no $* +word-dot = $(word $2,$(subst ., ,$1)) +MAP_FILENAME=$(call word-dot,$@,1).map + +LDFLAGS_COMPILER+=-Wl,-Map=$(MAP_FILENAME),--cref +#Drop unused sections +LDFLAGS_COMPILER+=-Wl,--gc-sections +#LDFLAGS_COMPILER+=-Wl,--print-gc-sections + +#------- Library options ------------------------ + +LIBFLAGS_COMPILER+= + +#------- Linkerscripts ------------------------ + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/make/gpcommon.mk b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/make/gpcommon.mk new file mode 100644 index 0000000..29c8166 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/make/gpcommon.mk @@ -0,0 +1,430 @@ + +###### Definitions ####### +PREREQ_HEADER_GENERATION_TARGETS ?= +COMMA=, +SPACE=$(EMPTY) $(EMPTY) +list2lines = $(subst $(SPACE),\n,$(1)) + +RM =rm -rf +MKDIR =mkdir -p +MV =mv + +#Quick Non-Linux shell check +ifeq (,$(PWD)) +OS_USED?=WIN +ECHO =echo -e +Color_Off=\e[0m +# Bold +BBlack=\e[1;30m +BRed=\e[1;31m +BGreen=\e[1;32m +BYellow=\e[1;33m +BBlue=\e[1;34m +BPurple=\e[1;35m +BCyan=\e[1;36m +BWhite=\e[1;37m +else +OS_USED?=LINUX +ECHO =echo +Color_Off= +# Bold +BBlack= +BRed= +BGreen= +BYellow= +BBlue= +BPurple= +BCyan= +BWhite= +endif + +###### Function to convert Linux-style paths to Windows-style ##### +# Roots +LINUX_WSL_ROOT := /home/ +WINDOWS_WSL_ROOT := wsl$$/Ubuntu-18.04/home/ +LINUX_C_ROOT := /mnt/c/ +WINDOWS_C_ROOT := C:/ +LINUX_D_ROOT := /mnt/d/ +WINDOWS_D_ROOT := D:/ +LINUX_E_ROOT := /mnt/e/ +WINDOWS_E_ROOT := E:/ +LINUX_R_ROOT := /mnt/r/ +WINDOWS_R_ROOT := R:/ +LINUX_Q_ROOT := /mnt/q/ +WINDOWS_Q_ROOT := Q:/ +# GPHUB_ROOT will be set by m.py normally, but need to strip trailing slashes as IAR cannot handle double slashes in paths +GPHUB_ROOT ?= $(ROOTDIR)/gpHub +override GPHUB_ROOT := $(patsubst %\,%,$(GPHUB_ROOT)) +override GPHUB_ROOT := $(patsubst %/,%,$(GPHUB_ROOT)) +# Replace windows roots "function" +replace_win_roots = $(patsubst $(LINUX_Q_ROOT)%,$(WINDOWS_Q_ROOT)%,$(patsubst $(LINUX_R_ROOT)%,$(WINDOWS_R_ROOT)%,$(patsubst $(LINUX_C_ROOT)%,$(WINDOWS_C_ROOT)%,$(patsubst $(LINUX_D_ROOT)%,$(WINDOWS_D_ROOT)%,$(patsubst $(LINUX_E_ROOT)%,$(WINDOWS_E_ROOT)%,$(1)))))) +replace_win_roots_includes = $(patsubst -I$(LINUX_Q_ROOT)%,-I$(WINDOWS_Q_ROOT)%,$(patsubst -I$(LINUX_R_ROOT)%,-I$(WINDOWS_R_ROOT)%,$(patsubst -I$(LINUX_C_ROOT)%,-I$(WINDOWS_C_ROOT)%,$(patsubst -I$(LINUX_D_ROOT)%,-I$(WINDOWS_D_ROOT)%,$(patsubst -I$(LINUX_E_ROOT)%,-I$(WINDOWS_E_ROOT)%,$(1)))))) + + +###### Speed optimizations ####### + +#Disable Parallel build with PAR= +PAR?=j4 +ifeq (s,$(findstring s, $(MAKEFLAGS))) +MAKEFLAGS=sr$(PAR) +else +MAKEFLAGS=r$(PAR) +endif + +###### Build rules ###### + +# Deleting the default suffixes +# Slight casing variations on Windows could give compilation using default rules iso our own +.SUFFIXES: + +#Rules only active if a configuration was included +ifneq (,$(CURRENT_CONF)) + +# Used flags by compiler: +CFLAGS_COMPILER ?= +ASFLAGS_COMPILER ?= +LDFLAGS_COMPILER ?= +LIBFLAGS_COMPILER?= + +##### Compiler-specific definitions ####### +NR_OF_PROCESSORS=$(shell nproc) +ifeq ($(shell test $(NR_OF_PROCESSORS) -le 4; echo $$?),0) + # For regression machines, use all cores + NR_OF_PROCESSORS_FOR_COMPILATION?=$(NR_OF_PROCESSORS) +else + # For local machines, free up one core + NR_OF_PROCESSORS_FOR_COMPILATION?=$$(( $(NR_OF_PROCESSORS) - 1 )) +endif + +COMPILER_DEFINES?=$(ENV_PATH)/make/compilers/$(COMPILER)/compiler_defines.mk +-include $(COMPILER_DEFINES) + +# Define all object files. +ALL_SOURCES := $(SRC) $(ASRC) +# Change wanted output directory to workdirectory +ALL_SOURCES := $(subst $(GPHUB_ROOT),$(WORKDIR),$(subst $(ROOTDIR),$(WORKDIR),$(subst \,/, $(ALL_SOURCES)))) +# Available file extensions that lead to objects +OBJS:= $(ALL_SOURCES) +OBJS:= $(OBJS:.cpp=.o) +OBJS:= $(OBJS:.c=.o) +OBJS:= $(OBJS:.S=.o) +OBJS:= $(OBJS:.s=.o) + +# Define all listing files. +LSTS:= $(OBJS:.o=.lst) +# Define all dependency files. +DEPS:= $(OBJS:.o=.d) +# Define all library files +LIB := $(subst \,/, $(LIB)) +LIB_DEP := $(filter %.$(LIB_EXT), $(LIB)) + +OBJ_DIRS:= $(foreach file,$(OBJS),$(dir $(file))) +EXPORT_OBJ_DIRS:= $(foreach file,$(subst $(GPHUB_ROOT),$(WORKDIR),$(subst $(ROOTDIR),$(WORKDIR),$(subst \,/, $(patsubst %, %.o, $(basename $(foreach comp,$(EXPORT_LIBCOMPS),$(SRC_$(comp)) $(ASRC_$(comp)))))))),$(dir $(file))) +LST_DIRS:= $(foreach file,$(LSTS),$(dir $(file))) +DEP_DIRS:= $(foreach file,$(DEPS),$(dir $(file))) +TARGET_DIRS:= $(sort $(OBJ_DIRS) $(EXPORT_OBJ_DIRS) $(LST_DIRS) $(DEP_DIRS) $(dir $(APPFILE))) # sort removes duplicates :-) + +#Adjust paths +SRC_NOWARNING := $(subst \,/,$(SRC_NOWARNING)) +SRC_DISABLE_ALIGNMENT_WARNING := $(subst \,/,$(SRC_DISABLE_ALIGNMENT_WARNING)) +SRC_DISABLE_STRICT_ALIASING_WARNING := $(subst \,/,$(SRC_DISABLE_STRICT_ALIASING_WARNING)) +SRC_DISABLE_UNDEF_WARNING := $(subst \,/,$(SRC_DISABLE_UNDEF_WARNING)) + +###### Output files ###### + +#Primary target - executable +ifneq (,$(APPFILE)) +TARGET_FILES = $(APPFILE) +else +ifneq (,$(SOLIB)) +TARGET_FILES = $(SOLIB) +else +TARGET_FILES = $(APPLIB) +endif +endif +#Secondary targets - mainly used in debugging +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).elf +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).map +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).lss +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).sym +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).size.sym +TARGET_FILES_SEC+=$(LSTS) + +#Digsim targets - mainly used in Digsim debugging +TARGET_FILES_DIGSIM+=$(WORKDIR)/$(APPNAME).elf +TARGET_FILES_DIGSIM+=$(WORKDIR)/$(APPNAME).sym + +###### Flags used in build rules ###### + +INC := $(subst \,/,$(INC)) +CFLAGS =$(CFLAGS_COMPILER) $(FLAGS) +ASFLAGS =$(ASFLAGS_COMPILER) $(FLAGS) +CXXFLAGS =$(CXXFLAGS_COMPILER) $(FLAGS) +ALL_CFLAGS =$(CFLAGS) $(INC) +ALL_CXXFLAGS =$(CXXFLAGS) $(INC) +ALL_ASFLAGS =$(ASFLAGS) $(AINC) + +#Library inclusion +LIBFLAGS =$(LIBFLAGS_COMPILER) +LDFLAGS =$(LDFLAGS_COMPILER) + +###### Convert Linux-style paths to Windows-style ##### +ifneq (, $(CONVERT_TO_WIN_PATHS)) + # Convert paths: + INC := $(call replace_win_roots_includes,$(INC)) + AINC := $(call replace_win_roots_includes,$(AINC)) + LIB := $(call replace_win_roots,$(LIB)) + OBJS_COMP := $(call replace_win_roots,$(OBJS)) + TARGET = $(call replace_win_roots,$(@)) + SOURCE = $(call replace_win_roots,$(<)) + STEM = $(call replace_win_roots,$(*)) + PRE_REQS = $(call replace_win_roots,$(^)) + BINSHIPPED_COMP = $(call replace_win_roots,$(BINSHIPPED)) + # Dependency files will be generated with Windows paths => convert back to linux + CORRECT_DEPS := $(PYTHON_BIN) $(ENV_PATH)/make/compilers/windows_only/correctdep.py -r $(WINDOWS_WSL_ROOT) $(LINUX_WSL_ROOT) -r $(WINDOWS_C_ROOT) $(LINUX_C_ROOT) -r $(WINDOWS_R_ROOT) $(LINUX_R_ROOT) -r $(WINDOWS_D_ROOT) $(LINUX_D_ROOT) -r $(WINDOWS_E_ROOT) $(LINUX_E_ROOT) + # we need a temporary dependency file to not leave a corrupt one + DEP_FILE = $(@:.o=.dd) + DEP_FILE_FLAG = -MF $(call replace_win_roots,$(DEP_FILE)) + PREINCLUDE_HEADER := $(call replace_win_roots,$(PREINCLUDE_HEADER)) +else + # INC := $(INC) + # LIB := $(LIB) + TARGET = $@ + SOURCE = $< + STEM = $* + PRE_REQS = $^ + OBJS_COMP := $(OBJS) + BINSHIPPED_COMP = $(BINSHIPPED) + # No need to correct dependencies when not converting paths + CORRECT_DEPS := + DEP_FILE := + DEP_FILE_FLAG := + CONFIG_HEADER := $(subst \,/,$(CONFIG_HEADER)) + INTERNALS_HEADER := $(subst \,/,$(INTERNALS_HEADER)) + PREINCLUDE_HEADER := $(subst \,/,$(PREINCLUDE_HEADER)) +endif + +###### Default build target ###### + +.PHONY:app all postbuild-app postbuild-all build-app build-all prebuild-script app-target all-target +app: postbuild-app +all: postbuild-all +digsim: $(TARGET_FILES) $(TARGET_FILES_DIGSIM) + +postbuild-app: build-app +ifneq (,$(POSTBUILD_SCRIPT)) + cd "$(WORKDIR)" && \ + export ENV_PATH="$(ENV_PATH)" && \ + sh $(POSTBUILD_SCRIPT) $(dir $(firstword $(MAKEFILE_LIST))) $(APPFILE) && \ + cd - +endif + +postbuild-all: build-all +ifneq (,$(POSTBUILD_SCRIPT)) + cd "$(WORKDIR)" && \ + export ENV_PATH="$(ENV_PATH)" && \ + sh $(POSTBUILD_SCRIPT) $(dir $(firstword $(MAKEFILE_LIST))) $(APPFILE) && \ + cd - +endif + +ifneq (,$(PREBUILD_SCRIPT)) +build-app: prebuild-script + @$(MAKE) -f $(firstword $(MAKEFILE_LIST)) --no-print-directory app-target +else +build-app: app-target +endif + +ifneq (,$(PREBUILD_SCRIPT)) +build-all: prebuild-script + @$(MAKE) -f $(firstword $(MAKEFILE_LIST)) --no-print-directory all-target +else +build-all: all-target +endif + +prebuild-script: +ifneq (,$(PREBUILD_SCRIPT)) + sh $(PREBUILD_SCRIPT) $(dir $(firstword $(MAKEFILE_LIST))) $(APPFILE) +endif + +app-target: $(TARGET_FILES) +all-target: $(TARGET_FILES) $(TARGET_FILES_SEC) + +###### Default build rules ###### + +# We make all target directories sequentially because we noticed some strange mkdir errors +# when running mkdir in the compile rule which we suspect enabled to some race condition +$(TARGET_DIRS) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)): + for d in $@; do $(MKDIR) $$d; done + +.PRECIOUS : $(WORKDIR)/%.o + +#Include compiler specific rules +COMPILER_RULES?=$(ENV_PATH)/make/compilers/$(COMPILER)/compiler_rules.mk +-include $(COMPILER_RULES) + +#Use C or CXX compiler to link +ifdef LINK_CXX +LINK_COMMAND=$(CXX) +else +LINK_COMMAND=$(CC) +endif + +.SECONDEXPANSION: +%.elf %.map: $(OBJS) $(BINSHIPPED) $(LINKERSCRIPT) $(LIB_DEP) | $$(dir $$@) + @$(ECHO) "$(BYellow)Linking $(notdir $@)$(Color_Off)" + $(LINK_COMMAND) $(OBJS_COMP) $(BINSHIPPED) $(LIBFLAGS) --output $(STEM).elf $(LDFLAGS) + +%.sym %.size.sym: %.elf + @$(ECHO) "$(BWhite)Creating symbol table:$(Color_Off)" $@ + $(NM) -S -n -l $< > $(dir $@)/tmp.sym + $(MV) $(dir $@)tmp.sym $@ + $(NM) -S --size-sort $< > $(dir $@).size.sym + +%.lss: %.elf + @$(ECHO) "$(BWhite)Creating basic listing:$(Color_Off)" $@ + $(OBJDUMP) -h -d -l $(SOURCE) > $(TARGET) + +# Define compilation function to avoid repeating recipes +define compile # (compiler, flags) + @$(ECHO) "$(BYellow)Building $(notdir $@)$(Color_Off)" + $(1) -c $(2) $(INC) -DGP_FILENAME=$(basename $(notdir $<)). -MMD $(DEP_FILE_FLAG) $(SOURCE) -o $(TARGET) + $(CORRECT_DEPS) $(DEP_FILE) +endef + +# flag_lookup: if the flag is present, return its name +# flag_value: if the flag has a value, return its value +ifdef CONFIG_HEADER +flag_lookup = $(shell grep -Eq -e '\#define[[:space:]]+$(1)$$' -e '\#define[[:space:]]+$(1)[[:space:]]+' $(CONFIG_HEADER) $(INTERNALS_HEADER) && echo $(1)) +flag_value = $(shell sed -ne 's/\#define[[:space:]][[:space:]]*$(1)[[:space:]][[:space:]]*(..*)[[:space:]]*/\1/p' $(CONFIG_HEADER) $(INTERNALS_HEADER)) +else +flag_lookup = $(patsubst %,$(1),$(filter -D$(1) -D$(1)=%,$(FLAGS))) +flag_value = $(patsubst -D$(1)=%,%,$(filter -D$(1)=%,$(FLAGS))) +endif + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(ROOTDIR)/%.c | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(CFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(GPHUB_ROOT)/%.c | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(CFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(ROOTDIR)/%.cpp | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CXX), $(CXXFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(GPHUB_ROOT)/%.cpp | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CXX), $(CXXFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(ROOTDIR)/%.S | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(ROOTDIR)/%.s | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(GPHUB_ROOT)/%.S | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(GPHUB_ROOT)/%.s | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(ASFLAGS)) + +# Define listing function to avoid repeating recipes +define list # (compiler, flags) + @$(ECHO) "$(BYellow)Creating $(notdir $@)$(Color_Off)" + $(1) -c $(2) $(INC) -DGP_FILENAME=$(basename $(notdir $<)). -Wa,-adhlns=$(TARGET) -MMD $(SOURCE) +endef + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(ROOTDIR)/%.c | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(CFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(GPHUB_ROOT)/%.c | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(CFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(ROOTDIR)/%.cpp | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CXX), $(CXXFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(GPHUB_ROOT)/%.cpp | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CXX), $(CXXFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(ROOTDIR)/%.S | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(GPHUB_ROOT)/%.S | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(ROOTDIR)/%.s | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(GPHUB_ROOT)/%.s | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(ASFLAGS)) + +ifeq (,$(COMPILER_SPECIFIC_LIB_RULE)) +.PHONY: +applib: $(APPLIB) + +$(APPLIB): $(BINSHIPPED) $(OBJS) + #create or update archive + @$(ECHO) "$(BYellow)Archiving $@$(Color_Off)" + $(RM) $@ ; \ + $(AR) $(TARGET) $(BINSHIPPED) $(OBJS_COMP) +#Adding libraries flattend through ar scripting + (echo "OPEN $(TARGET)"; \ + for lib in $(LIBFILES) ; do echo "ADDLIB " $$lib; done; \ + echo "SAVE"; \ + echo "END") | $(firstword $(AR)) -M +endif + +ifeq (,$(COMPILER_SPECIFIC_SO_LIB_RULE)) +.PHONY: +solib: $(SOLIB) + +$(SOLIB): $(BINSHIPPED) $(OBJS) + #create or update library + @$(ECHO) "$(BYellow)Creating .so lib $@$(Color_Off)" + $(RM) $@ ; \ + $(CXX) -shared -o $(TARGET) $(BINSHIPPED) $(OBJS_COMP) $(LIBFLAGS) $(LDFLAGS) +endif + +#Include extra programmer rules +PROGRAMMER_RULES?=$(ENV_PATH)/make/programmers/$(PROGRAMMER)/programmer_rules.mk +-include $(PROGRAMMER_RULES) + +###### Dependencies ###### + +# We generate a file for each .d files with addition rules to avoid the +# "no rule to make target" whenever a .h-file is deleted or renamed. +%.sd: %.d $(ENV_PATH)/make/make_d_rules.py + $(PYTHON_BIN) $(ENV_PATH)/make/make_d_rules.py <$< >$@ + +SAFE_DEPS:= $(OBJS:.o=.sd) + +-include $(DEPS) $(SAFE_DEPS) +endif + +#Include GreenPeak specific rules +-include $(ENV_PATH)/make/gpinternal.mk + +.PHONY:clean +clean: + $(ECHO) "$(BGreen)---- Cleaning $(APPNAME) ----$(Color_Off)" + $(RM) $(WORKDIR) + +help:: + $(ECHO) "$(BWhite)--- Common ---$(Color_Off)\n\ +app - create targets $(BWhite)(default)$(Color_Off)\n$(call list2lines,$(TARGET_FILES))\n\ +all - create targets+secondary\n$(call list2lines,$(filter-out $(LSTS),$(TARGET_FILES_SEC)))\n\ +digsim - make for digsim - create targets\n$(call list2lines,$(filter-out $(LSTS),$(TARGET_FILES_DIGSIM)))\n\ +clean - clean working directory\n$(WORKDIR)\n" diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/overview.QorvoGP712_rpi_cli_ftd_socket.txt b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/overview.QorvoGP712_rpi_cli_ftd_socket.txt new file mode 100644 index 0000000..8b5c7f0 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/overview.QorvoGP712_rpi_cli_ftd_socket.txt @@ -0,0 +1,32 @@ +Package created from: +Applications/P959_OpenThread/v1.2.0.4/apps/lib_qorvo/gp712_rpi_cli_ftd_socket.py - commit reference 2334f506f9cba16a755256babb1eb0a69878a600 + +Components in source: +--------------------- +gpAssert - Components/Qorvo/OS/vlatest +gpBaseComps - Components/Qorvo/OS/vlatest +gpBsp - Components/Qorvo/BSP/vlatest +gpCom - Components/Qorvo/BaseUtils/vlatest +gpEncryption - Components/Qorvo/BaseUtils/vlatest +gpLog - Components/Qorvo/OS/vlatest +gpMacCore - Components/Qorvo/802_15_4/vlatest +gpMacDispatcher - Components/Qorvo/802_15_4/vlatest +gpPad - Components/Qorvo/HAL_RF/vlatest +gpPd - Components/Qorvo/HAL_RF/vlatest +gpPoolMem - Components/Qorvo/OS/vlatest +gpRandom - Components/Qorvo/BaseUtils/vlatest +gpReset - Components/Qorvo/OS/vlatest +gpRxArbiter - Components/Qorvo/802_15_4/vlatest +gpSched - Components/Qorvo/OS/vlatest +gpStat - Components/Qorvo/BaseUtils/vlatest +gpUtils - Components/Qorvo/BaseUtils/vlatest +gpVersion - Components/Qorvo/OS/vlatest +gpWmrk - Components/Qorvo/BaseUtils/vlatest +gphal - Components/Qorvo/HAL_RF/vlatest +halLinux - Components/Qorvo/HAL_PLATFORM/v2.10.3.1 +qvOT - Applications/P959_OpenThread/v1.2.0.4 + +Repositories: +--------------------- +P959_ot-qorvo - P959_ot-qorvo/v1.2.0.4 + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/overview.QorvoGP712_rpi_cli_mtd_socket.txt b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/overview.QorvoGP712_rpi_cli_mtd_socket.txt new file mode 100644 index 0000000..e6b6735 --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/overview.QorvoGP712_rpi_cli_mtd_socket.txt @@ -0,0 +1,32 @@ +Package created from: +Applications/P959_OpenThread/v1.2.0.4/apps/lib_qorvo/gp712_rpi_cli_mtd_socket.py - commit reference 2334f506f9cba16a755256babb1eb0a69878a600 + +Components in source: +--------------------- +gpAssert - Components/Qorvo/OS/vlatest +gpBaseComps - Components/Qorvo/OS/vlatest +gpBsp - Components/Qorvo/BSP/vlatest +gpCom - Components/Qorvo/BaseUtils/vlatest +gpEncryption - Components/Qorvo/BaseUtils/vlatest +gpLog - Components/Qorvo/OS/vlatest +gpMacCore - Components/Qorvo/802_15_4/vlatest +gpMacDispatcher - Components/Qorvo/802_15_4/vlatest +gpPad - Components/Qorvo/HAL_RF/vlatest +gpPd - Components/Qorvo/HAL_RF/vlatest +gpPoolMem - Components/Qorvo/OS/vlatest +gpRandom - Components/Qorvo/BaseUtils/vlatest +gpReset - Components/Qorvo/OS/vlatest +gpRxArbiter - Components/Qorvo/802_15_4/vlatest +gpSched - Components/Qorvo/OS/vlatest +gpStat - Components/Qorvo/BaseUtils/vlatest +gpUtils - Components/Qorvo/BaseUtils/vlatest +gpVersion - Components/Qorvo/OS/vlatest +gpWmrk - Components/Qorvo/BaseUtils/vlatest +gphal - Components/Qorvo/HAL_RF/vlatest +halLinux - Components/Qorvo/HAL_PLATFORM/v2.10.3.1 +qvOT - Applications/P959_OpenThread/v1.2.0.4 + +Repositories: +--------------------- +P959_ot-qorvo - P959_ot-qorvo/v1.2.0.4 + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/overview.QorvoGP712_rpi_rcp_socket.txt b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/overview.QorvoGP712_rpi_rcp_socket.txt new file mode 100644 index 0000000..a9fceea --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/OpenThread_Lib_GP712/overview.QorvoGP712_rpi_rcp_socket.txt @@ -0,0 +1,32 @@ +Package created from: +Applications/P959_OpenThread/v1.2.0.4/apps/lib_qorvo/gp712_rpi_rcp_socket.py - commit reference 2334f506f9cba16a755256babb1eb0a69878a600 + +Components in source: +--------------------- +gpAssert - Components/Qorvo/OS/vlatest +gpBaseComps - Components/Qorvo/OS/vlatest +gpBsp - Components/Qorvo/BSP/vlatest +gpCom - Components/Qorvo/BaseUtils/vlatest +gpEncryption - Components/Qorvo/BaseUtils/vlatest +gpLog - Components/Qorvo/OS/vlatest +gpMacCore - Components/Qorvo/802_15_4/vlatest +gpMacDispatcher - Components/Qorvo/802_15_4/vlatest +gpPad - Components/Qorvo/HAL_RF/vlatest +gpPd - Components/Qorvo/HAL_RF/vlatest +gpPoolMem - Components/Qorvo/OS/vlatest +gpRandom - Components/Qorvo/BaseUtils/vlatest +gpReset - Components/Qorvo/OS/vlatest +gpRxArbiter - Components/Qorvo/802_15_4/vlatest +gpSched - Components/Qorvo/OS/vlatest +gpStat - Components/Qorvo/BaseUtils/vlatest +gpUtils - Components/Qorvo/BaseUtils/vlatest +gpVersion - Components/Qorvo/OS/vlatest +gpWmrk - Components/Qorvo/BaseUtils/vlatest +gphal - Components/Qorvo/HAL_RF/vlatest +halLinux - Components/Qorvo/HAL_PLATFORM/v2.10.3.1 +qvOT - Applications/P959_OpenThread/v1.2.0.4 + +Repositories: +--------------------- +P959_ot-qorvo - P959_ot-qorvo/v1.2.0.4 + diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/build.sh b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/build.sh new file mode 100755 index 0000000..08844ee --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/build.sh @@ -0,0 +1,133 @@ +#!/bin/bash +set -x +# Script settings + +# shellcheck disable=SC1091 +source package_defs.sh + +if grep -qE "(Microsoft|WSL)" /proc/sys/kernel/osrelease ; then + BUILD_OS='OS_USED=WSL' +fi + +# Print log +log () +{ + echo "$1" +} + +# Fail with message +failed() +{ + log "[BUILD FAILED] $1"; + exit 255 +} + +print_info() +{ + log "${BUNDLE_NAME}" +} + +preconditions() +{ + pushd . || failed + COUNTER=0 + + test -f Module.symvers && rm Module.symvers + for DEPENDENCY_LINK in "${BUILD_DEPENDENCIES[@]}"; do + # LKM build Workaround: with 5.10.17, MODPOST fails unless Kbuild or Makefile + # exist and point to the Makefile.xxx + DEPENDENCY_KEY="${DEPENDENCY_LINK%%|*}" + if [ "${DEPENDENCY_KEY}" != "$1" ] + then + continue + fi + DEPENDENCY="${DEPENDENCY_LINK#*|}" + # word splitting with cp destination in variable (SC2086,SC2225 are required) + # shellcheck disable=SC2086,SC2225 + test -f Kbuild && rm Kbuild + # shellcheck disable=SC2086 + ln -s ${DEPENDENCY%% *} Kbuild + # shellcheck disable=SC2086 + make -j4 -f ${DEPENDENCY} ${BUILD_OS}|| failed "Unable to do make ${DEPENDENCY}" + if [ -f Module.symvers ] + then + mv Module.symvers Module.symvers.$COUNTER + ((COUNTER++)) + fi + done +# cat Module.symvers.* |sort -k 1 |tee Module.symvers + + popd || failed + +} + +make_unpack() +{ + pushd . || failed + for ARCHIVE in "${PACKAGE_ARCHIVES[@]}"; do + ARCHIVE_NAME=$(basename -- "${ARCHIVE}") + ARCHIVE_DIR=$(dirname -- "${ARCHIVE}") + UNPACKED_ARCHIVE="${ARCHIVE_NAME%_*_*}" + cd "${ARCHIVE_DIR}" || failed + if [ -d "${UNPACKED_ARCHIVE}" ] ; then + log "${UNPACKED_ARCHIVE} already available, extracting ${ARCHIVE_NAME} skipped" + else + tar -xzvf "${ARCHIVE_NAME}" || failed "Unable to extract tar" + fi + + cd - || failed + done + popd || failed +} + +make_target() +{ + pushd . || failed + cd "${BUNDLE_NAME}/" || failed + for TARGET in "${MAKE_TARGETS[@]}"; do + for COPY_DEPENDENCY in "${COPY_DEPENDENCIES[@]}"; do + if [[ "${TARGET%% *}" == Makefile."${COPY_DEPENDENCY%%|*}" ]]; then + # word splitting with cp destination in variable (SC2086,SC2225 are required) + # shellcheck disable=SC2086,SC2225 + cp -v ${COPY_DEPENDENCY##*|} || failed + fi + done + # LKM build Workaround: with 5.10.17, MODPOST fails unless Kbuild or Makefile + # exist and point to the Makefile.xxx + preconditions "${TARGET%% *}" + # word splitting (SC2086 is required) + test -f Kbuild && rm Kbuild + # shellcheck disable=SC2086 + ln -s ${TARGET%% *} Kbuild + # shellcheck disable=SC2086 + make -f ${TARGET} ${BUILD_OS}|| failed "Unable to do make ${TARGET}" + done + popd || failed +} + +check_artifacts() +{ + pushd . || failed + for ARTIFACT in "${PACKAGE_ARTIFACTS[@]}"; do + if [ ! -f "${ARTIFACT}" ]; then + failed "Artifact not found: ${ARTIFACT}" + fi + done + popd || failed +} + +make_clean() +{ + pushd . || failed + cd "${BUNDLE_NAME}/" || failed + for TARGET in "${CLEAN_TARGETS[@]}"; do + # word splitting (SC2086 is required) + # shellcheck disable=SC2086 + make -f ${TARGET} ${BUILD_OS}|| failed "Unable to do make ${TARGET}" + done + popd || failed +} + +print_info && make_unpack +[[ $1 == "clean" ]] && make_clean +make_target && check_artifacts diff --git a/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/package_defs.sh b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/package_defs.sh new file mode 100644 index 0000000..f954c0f --- /dev/null +++ b/Software/OpenThread/src/gp712/GP_P1053_SW_15656_Smart_Home_Gateway_OpenThread_Lib_GP712/Software/package_defs.sh @@ -0,0 +1,25 @@ +BUNDLE_NAME=OpenThread_Lib_GP712 +TOOLCHAIN_RPI="${TOOLCHAIN_RPI-/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf}" + +PACKAGE_ARCHIVES=( \ +"OpenThread_Lib_GP712_2334f_v1.5.2.0.tgz" \ +) +PACKAGE_ARTIFACTS=( \ +"OpenThread_Lib_GP712/Work/QorvoGP712_rpi_cli_mtd_socket/libQorvoGP712_rpi_cli_mtd_socket.a" \ +"OpenThread_Lib_GP712/Work/QorvoGP712_rpi_cli_ftd_socket/libQorvoGP712_rpi_cli_ftd_socket.a" \ +"OpenThread_Lib_GP712/Work/QorvoGP712_rpi_rcp_socket/libQorvoGP712_rpi_rcp_socket.a" \ +) +MAKE_TARGETS=( \ +"Makefile.QorvoGP712_rpi_cli_mtd_socket applib TOOLCHAIN=${TOOLCHAIN_RPI}" \ +"Makefile.QorvoGP712_rpi_cli_ftd_socket applib TOOLCHAIN=${TOOLCHAIN_RPI}" \ +"Makefile.QorvoGP712_rpi_rcp_socket applib TOOLCHAIN=${TOOLCHAIN_RPI}" \ +) +CLEAN_TARGETS=( \ +"Makefile.QorvoGP712_rpi_cli_mtd_socket clean TOOLCHAIN=${TOOLCHAIN_RPI}" \ +"Makefile.QorvoGP712_rpi_cli_ftd_socket clean TOOLCHAIN=${TOOLCHAIN_RPI}" \ +"Makefile.QorvoGP712_rpi_rcp_socket clean TOOLCHAIN=${TOOLCHAIN_RPI}" \ +) +BUILD_DEPENDENCIES=( \ +) +COPY_DEPENDENCIES=( \ +) diff --git a/Software/OpenThread/src/gp712/alarm.c b/Software/OpenThread/src/gp712/alarm.c new file mode 100644 index 0000000..6a04fef --- /dev/null +++ b/Software/OpenThread/src/gp712/alarm.c @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file implements the OpenThread platform abstraction for the alarm. + * + */ + +#include +#include + +#include "qvOT/inc/alarm_qorvo.h" +#include +#include +#include + +uint32_t otPlatAlarmMilliGetNow(void) +{ + return qorvoAlarmGetTimeMs(); +} + +static void qorvoAlarmMilliFired(void *aInstance) +{ + otPlatAlarmMilliFired((otInstance *)aInstance); +} + +void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt) +{ + OT_UNUSED_VARIABLE(t0); + + qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance); + qorvoAlarmMilliStart(dt, qorvoAlarmMilliFired, aInstance); +} + +void otPlatAlarmMilliStop(otInstance *aInstance) +{ + qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance); +} + +uint32_t otPlatAlarmMicroGetNow(void) +{ + return qorvoAlarmGetTimeUs(); +} + +static void qorvoAlarmMicroFired(void *aInstance) +{ + otPlatAlarmMicroFired((otInstance *)aInstance); +} + +void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt) +{ + OT_UNUSED_VARIABLE(t0); + + qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance); + qorvoAlarmMicroStart(dt, qorvoAlarmMicroFired, aInstance); +} + +void otPlatAlarmMicroStop(otInstance *aInstance) +{ + qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance); +} diff --git a/Software/OpenThread/src/gp712/arm-linux-gnueabihf.cmake b/Software/OpenThread/src/gp712/arm-linux-gnueabihf.cmake new file mode 100644 index 0000000..ff6855a --- /dev/null +++ b/Software/OpenThread/src/gp712/arm-linux-gnueabihf.cmake @@ -0,0 +1,43 @@ +# +# Copyright (c) 2020, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_PROCESSOR ARM) + +set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) +set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) +set(CMAKE_ASM_COMPILER arm-linux-gnueabihf-as) +set(CMAKE_RANLIB arm-linux-gnueabihf-ranlib) + +set(COMMON_C_FLAGS "-fdata-sections -ffunction-sections") + + +set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99") +set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti") +set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS}") diff --git a/Software/OpenThread/src/gp712/crypto/gp712-mbedtls-config.h b/Software/OpenThread/src/gp712/crypto/gp712-mbedtls-config.h new file mode 100644 index 0000000..a8b1768 --- /dev/null +++ b/Software/OpenThread/src/gp712/crypto/gp712-mbedtls-config.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef GP712_MBEDTLS_CONFIG_H +#define GP712_MBEDTLS_CONFIG_H + +#if defined(QORVO_MBEDTLS_DEBUG) +#ifndef MBEDTLS_DEBUG_C +#define MBEDTLS_DEBUG_C +#endif // MBEDTLS_DEBUG_C +#else +#ifdef MBEDTLS_DEBUG_C +#undef MBEDTLS_DEBUG_C +#endif // MBEDTLS_DEBUG_C +#endif // QORVO_MBEDTLS_DEBUG + +#include "mbedtls/check_config.h" + +#endif // GP712_MBEDTLS_CONFIG_H diff --git a/Software/OpenThread/src/gp712/diag.c b/Software/OpenThread/src/gp712/diag.c new file mode 100644 index 0000000..e79c2f2 --- /dev/null +++ b/Software/OpenThread/src/gp712/diag.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include +#include +#include + +#if OPENTHREAD_CONFIG_DIAG_ENABLE + +/** + * Diagnostics mode variables. + * + */ +static bool sDiagMode = false; + +void otPlatDiagModeSet(bool aMode) +{ + sDiagMode = aMode; +} + +bool otPlatDiagModeGet() +{ + return sDiagMode; +} + +void otPlatDiagChannelSet(uint8_t aChannel) +{ + OT_UNUSED_VARIABLE(aChannel); +} + +void otPlatDiagTxPowerSet(int8_t aTxPower) +{ + OT_UNUSED_VARIABLE(aTxPower); +} + +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aFrame); + OT_UNUSED_VARIABLE(aError); +} + +void otPlatDiagAlarmCallback(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); +} + +#endif // OPENTHREAD_CONFIG_DIAG_ENABLE diff --git a/Software/OpenThread/src/gp712/entropy.c b/Software/OpenThread/src/gp712/entropy.c new file mode 100644 index 0000000..bf25db5 --- /dev/null +++ b/Software/OpenThread/src/gp712/entropy.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file implements an entropy source based on /dev/urandom or pseudo-random generator. + * + */ + +#include + +#include +#include + +#include + +#include "utils/code_utils.h" + +void qorvoRandomInit(void) +{ +} + +otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength) +{ + otError error = OT_ERROR_NONE; + + FILE * file = NULL; + size_t readLength; + + otEXPECT_ACTION(aOutput && aOutputLength, error = OT_ERROR_INVALID_ARGS); + + file = fopen("/dev/urandom", "rb"); + otEXPECT_ACTION(file != NULL, error = OT_ERROR_FAILED); + + readLength = fread(aOutput, 1, aOutputLength, file); + otEXPECT_ACTION(readLength == aOutputLength, error = OT_ERROR_FAILED); + +exit: + + if (file != NULL) + { + fclose(file); + } + + return error; +} diff --git a/Software/OpenThread/src/gp712/flash.c b/Software/OpenThread/src/gp712/flash.c new file mode 100644 index 0000000..3314656 --- /dev/null +++ b/Software/OpenThread/src/gp712/flash.c @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 500 + +#include "qvOT/inc/platform_qorvo.h" + +#undef NDEBUG +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static int sFlashFd = -1; + +enum +{ + SWAP_SIZE = 2048, + SWAP_NUM = 2, +}; + +void otPlatFlashInit(otInstance *aInstance) +{ + char fileName[20]; + struct stat st; + bool create = false; + + memset(&st, 0, sizeof(st)); + + if (stat("tmp", &st) == -1) + { + mkdir("tmp", 0777); + } + + snprintf(fileName, sizeof(fileName), "tmp/node.flash"); + + if (access(fileName, 0)) + { + create = true; + } + + sFlashFd = open(fileName, O_RDWR | O_CREAT, 0600); + lseek(sFlashFd, 0, SEEK_SET); + + assert(sFlashFd >= 0); + + if (create) + { + for (uint8_t index = 0; index < SWAP_NUM; index++) + { + otPlatFlashErase(aInstance, index); + } + } +} + +uint32_t otPlatFlashGetSwapSize(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + return SWAP_SIZE; +} + +void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex) +{ + OT_UNUSED_VARIABLE(aInstance); + uint32_t address; + uint8_t buffer[SWAP_SIZE]; + ssize_t r; + + assert((sFlashFd) >= 0 && (aSwapIndex < SWAP_NUM)); + + address = aSwapIndex ? SWAP_SIZE : 0; + memset(buffer, 0xff, sizeof(buffer)); + + // Write the page + r = pwrite(sFlashFd, buffer, sizeof(buffer), (off_t)address); + assert(r == SWAP_SIZE); +} + +void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize) +{ + OT_UNUSED_VARIABLE(aInstance); + + uint32_t address; + ssize_t rval; + + assert((sFlashFd >= 0) && (aSwapIndex < SWAP_NUM) && (aSize <= SWAP_SIZE) && (aOffset <= (SWAP_SIZE - aSize))); + + address = aSwapIndex ? SWAP_SIZE : 0; + + rval = pread(sFlashFd, aData, aSize, (off_t)(address + aOffset)); + assert((uint32_t)rval == aSize); +} + +void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize) +{ + OT_UNUSED_VARIABLE(aInstance); + + uint32_t address; + uint8_t byte; + ssize_t rval; + + assert((sFlashFd >= 0) && (aSwapIndex < SWAP_NUM) && (aSize <= SWAP_SIZE) && (aOffset <= (SWAP_SIZE - aSize))); + + address = aSwapIndex ? SWAP_SIZE : 0; + address += aOffset; + + for (uint32_t offset = 0; offset < aSize; offset++) + { + rval = pread(sFlashFd, &byte, sizeof(byte), (off_t)(address + offset)); + assert(rval == sizeof(byte)); + + // Use bitwise AND to emulate the behavior of flash memory + byte &= ((uint8_t *)aData)[offset]; + + rval = pwrite(sFlashFd, &byte, sizeof(byte), (off_t)(address + offset)); + assert(rval == sizeof(byte)); + } +} diff --git a/Software/OpenThread/src/gp712/logging.c b/Software/OpenThread/src/gp712/logging.c new file mode 100644 index 0000000..8dfe147 --- /dev/null +++ b/Software/OpenThread/src/gp712/logging.c @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "qvOT/inc/platform_qorvo.h" +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "qvOT/inc/uart_qorvo.h" +#include "utils/code_utils.h" + +// Macro to append content to end of the log string. + +#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) + +int PlatOtLogLevelToSysLogLevel(otLogLevel aLogLevel) +{ + int sysloglevel; + + switch (aLogLevel) + { + case OT_LOG_LEVEL_NONE: + sysloglevel = LOG_ERR; + break; + + case OT_LOG_LEVEL_CRIT: + sysloglevel = LOG_CRIT; + break; + + case OT_LOG_LEVEL_WARN: + sysloglevel = LOG_WARNING; + break; + + case OT_LOG_LEVEL_INFO: + sysloglevel = LOG_INFO; + break; + + case OT_LOG_LEVEL_DEBG: + sysloglevel = LOG_DEBUG; + break; + + default: + sysloglevel = LOG_ERR; + } + + return sysloglevel; +} + +OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...) +{ + va_list args; + va_start(args, aFormat); + qorvoUartLog(aLogLevel, aLogRegion, aFormat, args); + va_end(args); +} + +#endif diff --git a/Software/OpenThread/src/gp712/misc.c b/Software/OpenThread/src/gp712/misc.c new file mode 100644 index 0000000..daaaaf0 --- /dev/null +++ b/Software/OpenThread/src/gp712/misc.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "qvOT/inc/platform_qorvo.h" + +#include +#include + +#include "qvOT/inc/radio_qorvo.h" +#include + +#include +#include + +extern int gArgumentsCount; +extern char **gArguments; + +extern void platformUartRestore(void); + +void otPlatReset(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + char *argv[gArgumentsCount + 1]; + + for (int i = 0; i < gArgumentsCount; ++i) + { + argv[i] = gArguments[i]; + } + + argv[gArgumentsCount] = NULL; + + qorvoRadioReset(); + platformUartRestore(); + + execvp(argv[0], argv); + perror("reset failed"); + exit(EXIT_FAILURE); +} + +otPlatResetReason otPlatGetResetReason(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return OT_PLAT_RESET_REASON_POWER_ON; +} + +void otPlatWakeHost(void) +{ + // TODO: implement an operation to wake the host from sleep state. +} diff --git a/Software/OpenThread/src/gp712/openthread-core-gp712-config-check.h b/Software/OpenThread/src/gp712/openthread-core-gp712-config-check.h new file mode 100644 index 0000000..6121cb5 --- /dev/null +++ b/Software/OpenThread/src/gp712/openthread-core-gp712-config-check.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPENTHREAD_CORE_GP712_CONFIG_CHECK_H_ +#define OPENTHREAD_CORE_GP712_CONFIG_CHECK_H_ + +#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#error "Platform gp712 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE" +#endif + +#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT +#error "Platform gp712 doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT" +#endif + +#endif /* OPENTHREAD_CORE_GP712_CONFIG_CHECK_H_ */ diff --git a/Software/OpenThread/src/gp712/openthread-core-gp712-config.h b/Software/OpenThread/src/gp712/openthread-core-gp712-config.h new file mode 100644 index 0000000..e05e6a7 --- /dev/null +++ b/Software/OpenThread/src/gp712/openthread-core-gp712-config.h @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes gp712 compile-time configuration constants for OpenThread. + */ + +#ifndef OPENTHREAD_CORE_GP712_CONFIG_H_ +#define OPENTHREAD_CORE_GP712_CONFIG_H_ + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_INFO + * + * The platform-specific string to insert into the OpenThread version string. + * + */ +#define OPENTHREAD_CONFIG_PLATFORM_INFO "GP712" + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_INFO + * + * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage. + * + * When defined to 1, the platform MUST implement the otPlatFlash* APIs + * instead of the otPlatSettings* + * + */ +#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT + * + * The assert is managed by platform defined logic when this flag is set. + * + */ +#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 0 + +/** + * @def OPENTHREAD_CONFIG_DIAG_ENABLE + * + * Define as 1 to enable the diag feature. + * + */ +#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE +#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE + * + * This is required for the CSL receiver feature + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE +#endif + +#if defined(OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE) && defined(DEBUG) +#define OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE + * + * Define as 1 to enable SPI NCP interface. + * + */ +#ifndef OPENTHREAD_CONFIG_NCP_SPI_ENABLE +#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE + * + * Define to 1 to enable NCP HDLC support. + * + */ +#ifndef OPENTHREAD_CONFIG_NCP_HDLC_ENABLE +#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE + * + * Configure the available heap size. + * The heap is used by Mbedtls + * + */ +#ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE +#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (2048 * sizeof(void *)) +#endif + +#endif // OPENTHREAD_CORE_GP712_CONFIG_H_ diff --git a/Software/OpenThread/src/gp712/radio.c b/Software/OpenThread/src/gp712/radio.c new file mode 100644 index 0000000..549a5d1 --- /dev/null +++ b/Software/OpenThread/src/gp712/radio.c @@ -0,0 +1,512 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file implements the OpenThread platform abstraction for radio communication. + * + */ + +#include + +#include +#include + +#include "utils/code_utils.h" + +#include "qvOT/inc/radio_qorvo.h" + +enum +{ + QPG_RECEIVE_SENSITIVITY = -100, // dBm +}; + +enum +{ + IEEE802154_MIN_LENGTH = 5, + IEEE802154_MAX_LENGTH = 127, + IEEE802154_ACK_LENGTH = 5, + IEEE802154_FRAME_TYPE_MASK = 0x7, + IEEE802154_FRAME_TYPE_ACK = 0x2, + IEEE802154_FRAME_PENDING = 1 << 4, + IEEE802154_ACK_REQUEST = 1 << 5, + IEEE802154_DSN_OFFSET = 2, +}; + +enum +{ + QORVO_RSSI_OFFSET = 73, + QORVO_CRC_BIT_MASK = 0x80, + QORVO_LQI_BIT_MASK = 0x7f, +}; + +extern otRadioFrame sTransmitFrame; + +static otRadioState sState; +static otInstance * pQorvoInstance; + +typedef struct otCachedSettings_s +{ + uint16_t panid; +} otCachedSettings_t; + +static otCachedSettings_t otCachedSettings; + +/* Upper layer relies on txpower could be set before receive, but MAC have per-channel config for it. + Store txpower until channel set in Receive(). */ +#define PENDING_TX_POWER_NONE (-1) +static int8_t pendingTxPower = PENDING_TX_POWER_NONE; + +static uint8_t sScanstate = 0; +static int8_t sLastReceivedPower = 127; + +otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES; +} + +const char *otPlatRadioGetVersionString(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return "OPENTHREAD/Qorvo/0.0"; +} + +int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return QPG_RECEIVE_SENSITIVITY; +} + +void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioGetIeeeEui64(aIeeeEui64); +} + +void otPlatRadioSetPanId(otInstance *aInstance, otPanId aPanId) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetPanId((uint16_t)aPanId); + otCachedSettings.panid = aPanId; +} + +void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *address) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetExtendedAddress(address->m8); +} + +void otPlatRadioSetShortAddress(otInstance *aInstance, otShortAddress aShortAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetShortAddress((uint16_t)aShortAddress); +} + +otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower) +{ + OT_UNUSED_VARIABLE(aInstance); + + otError result; + + if (aPower == NULL) + { + return OT_ERROR_INVALID_ARGS; + } + + if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0)) + { + *aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower; + return OT_ERROR_NONE; + } + + result = qorvoRadioGetTransmitPower(aPower); + + if (result == OT_ERROR_INVALID_STATE) + { + // Channel was not set, so txpower is ambigious + *aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower; + return OT_ERROR_NONE; + } + + return result; +} + +otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) +{ + OT_UNUSED_VARIABLE(aInstance); + + otError result; + + if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0)) + { + pendingTxPower = aPower; + return OT_ERROR_NONE; + } + + result = qorvoRadioSetTransmitPower(aPower); + + if (result == OT_ERROR_INVALID_STATE) + { + // Channel was not set, so txpower is ambigious + pendingTxPower = aPower; + result = OT_ERROR_NONE; + } + + return result; +} + +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aGain); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetFemLnaGain(otInstance *aInstance, int8_t aGain) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aGain); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +bool otPlatRadioGetPromiscuous(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioGetPromiscuous(); +} + +void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetPromiscuous(aEnable); +} + +uint64_t otPlatTimeGet(void) +{ + // required for RCP/spinel + return qorvoRadioGetNow(); +} + +uint32_t otPlatRadioGetBusSpeed(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return 0; +} + +otError otPlatRadioEnable(otInstance *aInstance) +{ + pQorvoInstance = aInstance; + memset(&otCachedSettings, 0x00, sizeof(otCachedSettings_t)); + + if (!otPlatRadioIsEnabled(aInstance)) + { + sState = OT_RADIO_STATE_SLEEP; + } + + return OT_ERROR_NONE; +} + +otError otPlatRadioDisable(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + otEXPECT(otPlatRadioIsEnabled(aInstance)); + + if (sState == OT_RADIO_STATE_RECEIVE) + { + qorvoRadioSetRxOnWhenIdle(false); + } + + sState = OT_RADIO_STATE_DISABLED; + +exit: + return OT_ERROR_NONE; +} + +bool otPlatRadioIsEnabled(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return (sState != OT_RADIO_STATE_DISABLED); +} + +otError otPlatRadioSleep(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + otError error = OT_ERROR_INVALID_STATE; + + if (sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_SLEEP) + { + qorvoRadioSetRxOnWhenIdle(false); + error = OT_ERROR_NONE; + sState = OT_RADIO_STATE_SLEEP; + } + return error; +} + +otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) +{ + otError error = OT_ERROR_INVALID_STATE; + + pQorvoInstance = aInstance; + + if ((sState != OT_RADIO_STATE_DISABLED) && (sScanstate == 0)) + { + qorvoRadioSetCurrentChannel(aChannel); + if (pendingTxPower != PENDING_TX_POWER_NONE) + { + qorvoRadioSetTransmitPower(pendingTxPower); + pendingTxPower = PENDING_TX_POWER_NONE; + } + error = OT_ERROR_NONE; + } + + if (sState == OT_RADIO_STATE_SLEEP) + { + qorvoRadioSetRxOnWhenIdle(true); + error = OT_ERROR_NONE; + sState = OT_RADIO_STATE_RECEIVE; + } + + return error; +} + +void cbQorvoRadioReceiveDone(otRadioFrame *aFrame, otError aError) +{ + if (aError == OT_ERROR_NONE) + { + sLastReceivedPower = aFrame->mInfo.mRxInfo.mRssi; + } + + otPlatRadioReceiveDone(pQorvoInstance, aFrame, aError); +} + +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return &sTransmitFrame; +} + +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) +{ + otError err = OT_ERROR_NONE; + + pQorvoInstance = aInstance; + + otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, err = OT_ERROR_INVALID_STATE); + + err = qorvoRadioTransmit(aFrame); + +exit: + return err; +} + +void cbQorvoRadioTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError) +{ + // TODO: pass received ACK frame instead of generating one. + otRadioFrame ackFrame; + uint8_t psdu[IEEE802154_ACK_LENGTH]; + + ackFrame.mPsdu = psdu; + ackFrame.mLength = IEEE802154_ACK_LENGTH; + ackFrame.mPsdu[0] = IEEE802154_FRAME_TYPE_ACK; + + if (aFramePending) + { + ackFrame.mPsdu[0] |= IEEE802154_FRAME_PENDING; + } + + ackFrame.mPsdu[1] = 0; + ackFrame.mPsdu[2] = aFrame->mPsdu[IEEE802154_DSN_OFFSET]; + + otPlatRadioTxDone(pQorvoInstance, aFrame, (aError == OT_ERROR_NONE) ? &ackFrame : NULL, aError); +} + +int8_t otPlatRadioGetRssi(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return sLastReceivedPower; +} + +otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration) +{ + OT_UNUSED_VARIABLE(aInstance); + + sScanstate = 1; + return qorvoRadioEnergyScan(aScanChannel, aScanDuration); +} + +void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi) +{ + sScanstate = 0; + otPlatRadioEnergyScanDone(pQorvoInstance, aEnergyScanMaxRssi); +} + +void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioEnableSrcMatch(aEnable); +} + +otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioAddSrcMatchShortEntry((uint16_t)aShortAddress, otCachedSettings.panid); +} + +otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioAddSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid); +} + +otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioClearSrcMatchShortEntry((uint16_t)aShortAddress, otCachedSettings.panid); +} + +otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioClearSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid); +} + +void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + /* clear both short and extended addresses here */ + qorvoRadioClearSrcMatchEntries(); +} + +void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + /* not implemented */ + /* assumes clearing of short and extended entries is done simultaniously by the openthread stack */ +} +uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return 0x03fff800; +} + +uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return 0x03fff800; +} + +otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aEnabled); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +bool otPlatRadioIsCoexEnabled(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return false; +} + +otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aCoexMetrics); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aChannel); + OT_UNUSED_VARIABLE(aMaxPower); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aRegionCode); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aRegionCode); + + return OT_ERROR_NOT_IMPLEMENTED; +} diff --git a/Software/OpenThread/src/gp712/random_qorvo.h b/Software/OpenThread/src/gp712/random_qorvo.h new file mode 100644 index 0000000..277019c --- /dev/null +++ b/Software/OpenThread/src/gp712/random_qorvo.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the declarations of the random functions from the Qorvo library. + * + */ + +#ifndef RANDOM_QORVO_H_ +#define RANDOM_QORVO_H_ + +#include + +/** + * This function initializes the random number service used by OpenThread. + * + */ +void qorvoRandomInit(void); + +/** + * This function returns an array of random numbers. + * + * @param[out] aOutput Pointer to an array which will be filled with random data. + * @param[in] aOutputLength number of bytes which will be written into the array. + * + */ +void qorvoRandomGet(uint8_t *aOutput, uint8_t aOutputLength); + +#endif // RANDOM_QORVO_H_ diff --git a/Software/OpenThread/src/gp712/system.c b/Software/OpenThread/src/gp712/system.c new file mode 100644 index 0000000..de1c9f0 --- /dev/null +++ b/Software/OpenThread/src/gp712/system.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes the platform-specific initializers. + */ + +#include "stdio.h" +#include "stdlib.h" + +#include + +#include "utils/uart.h" + +#include "qvOT/inc/alarm_qorvo.h" +#include "qvOT/inc/platform_qorvo.h" +#include "qvOT/inc/radio_qorvo.h" +#include "random_qorvo.h" +#include "qvOT/inc/uart_qorvo.h" + +void platformUartInit(void); +void platformUartProcess(void); + +otInstance *localInstance = NULL; + +int gArgumentsCount = 0; +char **gArguments = NULL; + +uint8_t qorvoPlatGotoSleepCheck(void) +{ + bool canGotoSleep = false; + + if (localInstance) + { + canGotoSleep = !otTaskletsArePending(localInstance); + } + + return canGotoSleep; +} + +void otSysInit(int argc, char *argv[]) +{ + gArgumentsCount = argc; + gArguments = argv; + + qorvoPlatInit((qorvoPlatGotoSleepCheckCallback_t)qorvoPlatGotoSleepCheck); + platformUartInit(); + qorvoAlarmInit(); + qorvoRandomInit(); + qorvoRadioInit(); +} + +bool otSysPseudoResetWasRequested(void) +{ + return false; +} + +void otSysProcessDrivers(otInstance *aInstance) +{ + if (localInstance == NULL) + { + // local copy in case we need to perform a callback. + localInstance = aInstance; + } + + qorvoPlatMainLoop(!otTaskletsArePending(aInstance)); + platformUartProcess(); + // qorvoRadioProcess(); + // qorvoAlarmProcess(); +} diff --git a/Software/OpenThread/src/gp712/uart-posix.c b/Software/OpenThread/src/gp712/uart-posix.c new file mode 100644 index 0000000..dd402d7 --- /dev/null +++ b/Software/OpenThread/src/gp712/uart-posix.c @@ -0,0 +1,364 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#define _XOPEN_SOURCE 500 + +#include "qvOT/inc/alarm_qorvo.h" +#include "qvOT/inc/platform_qorvo.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utils/code_utils.h" +#include "utils/uart.h" + +#ifdef __linux__ +#include +int posix_openpt(int oflag); +int grantpt(int fildes); +int unlockpt(int fd); +char *ptsname(int fd); +#endif // __linux__ + +static uint8_t s_receive_buffer[128]; +static const uint8_t *s_write_buffer; +static uint16_t s_write_length; +static int s_in_fd; +static int s_out_fd; + +static struct termios original_stdin_termios; +static struct termios original_stdout_termios; + +static void restore_stdin_termios(void) +{ + tcsetattr(s_in_fd, TCSAFLUSH, &original_stdin_termios); +} + +static void restore_stdout_termios(void) +{ + tcsetattr(s_out_fd, TCSAFLUSH, &original_stdout_termios); +} + +void platformDummy(void *dummyPointer) +{ + OT_UNUSED_VARIABLE(dummyPointer); +} + +static void cbKeyPressed(uint8_t Param) +{ + OT_UNUSED_VARIABLE(Param); + + qorvoAlarmScheduleEventArg(0, platformDummy, (void *)&s_in_fd); +} + +void platformUartRestore(void) +{ + restore_stdin_termios(); + restore_stdout_termios(); + dup2(s_out_fd, STDOUT_FILENO); + + qorvoPlatUnRegisterPollFunction(s_in_fd); + qorvoPlatUnRegisterPollFunction(s_out_fd); + + otPlatUartDisable(); +} + +void platformUartInit(void) +{ + s_in_fd = dup(STDIN_FILENO); + s_out_fd = dup(STDOUT_FILENO); + dup2(STDERR_FILENO, STDOUT_FILENO); + + int res = fcntl(s_in_fd, F_SETFD, fcntl(s_in_fd, F_GETFD) | FD_CLOEXEC); + otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed")); + + res = fcntl(s_out_fd, F_SETFD, fcntl(s_out_fd, F_GETFD) | FD_CLOEXEC); + otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed")); + + qorvoPlatRegisterPollFunction(s_in_fd, cbKeyPressed); + qorvoPlatRegisterPollFunction(s_out_fd, cbKeyPressed); + + return; + +exit: + exit(1); +} + +otError otPlatUartEnable(void) +{ + otError error = OT_ERROR_NONE; + struct termios termios; + +#ifdef __linux__ + // Ensure we terminate this process if the + // parent process dies. + prctl(PR_SET_PDEATHSIG, SIGHUP); +#endif + + // We need this signal to make sure that this + // process terminates properly. + signal(SIGPIPE, SIG_DFL); + + if (isatty(s_in_fd)) + { + tcgetattr(s_in_fd, &original_stdin_termios); + atexit(&restore_stdin_termios); + } + + if (isatty(s_out_fd)) + { + tcgetattr(s_out_fd, &original_stdout_termios); + atexit(&restore_stdout_termios); + } + + if (isatty(s_in_fd)) + { + // get current configuration + otEXPECT_ACTION(tcgetattr(s_in_fd, &termios) == 0, perror("tcgetattr"); error = OT_ERROR_GENERIC); + + // Set up the termios settings for raw mode. This turns + // off input/output processing, line processing, and character processing. + cfmakeraw(&termios); + + // Set up our cflags for local use. Turn on hangup-on-close. + termios.c_cflag |= HUPCL | CREAD | CLOCAL; + + // "Minimum number of characters for noncanonical read" + termios.c_cc[VMIN] = 1; + + // "Timeout in deciseconds for noncanonical read" + termios.c_cc[VTIME] = 0; + + // configure baud rate + otEXPECT_ACTION(cfsetispeed(&termios, B115200) == 0, perror("cfsetispeed"); error = OT_ERROR_GENERIC); + + // set configuration + otEXPECT_ACTION(tcsetattr(s_in_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC); + } + + if (isatty(s_out_fd)) + { + // get current configuration + otEXPECT_ACTION(tcgetattr(s_out_fd, &termios) == 0, perror("tcgetattr"); error = OT_ERROR_GENERIC); + + // Set up the termios settings for raw mode. This turns + // off input/output processing, line processing, and character processing. + cfmakeraw(&termios); + + // Absolutely obliterate all output processing. + termios.c_oflag = 0; + + // Set up our cflags for local use. Turn on hangup-on-close. + termios.c_cflag |= HUPCL | CREAD | CLOCAL; + + // configure baud rate + otEXPECT_ACTION(cfsetospeed(&termios, B115200) == 0, perror("cfsetospeed"); error = OT_ERROR_GENERIC); + + // set configuration + otEXPECT_ACTION(tcsetattr(s_out_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC); + } + + return error; + +exit: + close(s_in_fd); + close(s_out_fd); + return error; +} + +otError otPlatUartDisable(void) +{ + otError error = OT_ERROR_NONE; + + close(s_in_fd); + close(s_out_fd); + + return error; +} + +otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength) +{ + otError error = OT_ERROR_NONE; + + otEXPECT_ACTION(s_write_length == 0, error = OT_ERROR_BUSY); + + s_write_buffer = aBuf; + s_write_length = aBufLength; + + qorvoAlarmScheduleEventArg(0, platformDummy, (void *)&s_in_fd); + +exit: + return error; +} + +void platformUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, fd_set *aErrorFdSet, int *aMaxFd) +{ + if (aReadFdSet != NULL) + { + FD_SET(s_in_fd, aReadFdSet); + + if (aErrorFdSet != NULL) + { + FD_SET(s_in_fd, aErrorFdSet); + } + + if (aMaxFd != NULL && *aMaxFd < s_in_fd) + { + *aMaxFd = s_in_fd; + } + } + + if ((aWriteFdSet != NULL) && (s_write_length > 0)) + { + FD_SET(s_out_fd, aWriteFdSet); + + if (aErrorFdSet != NULL) + { + FD_SET(s_out_fd, aErrorFdSet); + } + + if (aMaxFd != NULL && *aMaxFd < s_out_fd) + { + *aMaxFd = s_out_fd; + } + } +} + +otError otPlatUartFlush(void) +{ + otError error = OT_ERROR_NONE; + ssize_t count; + + otEXPECT_ACTION(s_write_buffer != NULL && s_write_length > 0, error = OT_ERROR_INVALID_STATE); + + while ((count = write(s_out_fd, s_write_buffer, s_write_length)) > 0 && (s_write_length -= count) > 0) + { + s_write_buffer += count; + } + + if (count != -1) + { + assert(s_write_length == 0); + s_write_buffer = NULL; + } + else + { + perror("write(UART)"); + exit(EXIT_FAILURE); + } + +exit: + return error; +} + +void platformUartProcess(void) +{ + ssize_t rval; + const int error_flags = POLLERR | POLLNVAL | POLLHUP; + struct pollfd pollfd[] = { + {s_in_fd, POLLIN | error_flags, 0}, + {s_out_fd, POLLOUT | error_flags, 0}, + }; + + errno = 0; + + rval = poll(pollfd, sizeof(pollfd) / sizeof(*pollfd), 0); + + if (rval < 0) + { + perror("poll"); + exit(EXIT_FAILURE); + } + + if (rval > 0) + { + if ((pollfd[0].revents & error_flags) != 0) + { + perror("s_in_fd"); + exit(EXIT_FAILURE); + } + + if ((pollfd[1].revents & error_flags) != 0) + { + perror("s_out_fd"); + exit(EXIT_FAILURE); + } + + if (pollfd[0].revents & POLLIN) + { + rval = read(s_in_fd, s_receive_buffer, sizeof(s_receive_buffer)); + + if (rval <= 0) + { + perror("read"); + exit(EXIT_FAILURE); + } + otPlatUartReceived(s_receive_buffer, (uint16_t)rval); + } + + if ((s_write_length > 0) && (pollfd[1].revents & POLLOUT)) + { + rval = write(s_out_fd, s_write_buffer, s_write_length); + + if (rval >= 0) + { + s_write_buffer += (uint16_t)rval; + s_write_length -= (uint16_t)rval; + + if (s_write_length == 0) + { + otPlatUartSendDone(); + } + } + else if (errno != EINTR) + { + perror("write"); + exit(EXIT_FAILURE); + } + } + } +} + +/** + * The weak stubs functions definition. + */ +OT_TOOL_WEAK void otPlatUartSendDone(void) +{ +} + +OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) +{ + (void)aBuf; + (void)aBufLength; +} diff --git a/Software/OpenThread/src/gp712/uart-socket.c b/Software/OpenThread/src/gp712/uart-socket.c new file mode 100644 index 0000000..2238577 --- /dev/null +++ b/Software/OpenThread/src/gp712/uart-socket.c @@ -0,0 +1,385 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file implements the OpenThread platform abstraction for cli over ip socket communication. + * + */ + +#include "qvOT/inc/alarm_qorvo.h" +#include "qvOT/inc/platform_qorvo.h" +#include "qvOT/inc/uart_qorvo.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include "utils/code_utils.h" +#include "utils/uart.h" + +#define BUFFER_MAX_SIZE 255 +#define SOCKET_PORT 9190 +#define SOCKET_WRITE(socketInfo, buf, length) \ + sendto(socketInfo.socketId, (const char *)buf, length, 0, &socketInfo.addr, sizeof(socketInfo.addr)) +#define SOCKET_READ(socketId, buf, length) recv(socketId, buf, length, 0) + +typedef struct +{ + int socketId; + bool isValid; + struct sockaddr addr; + pthread_t rfReadThread; +} PlatSocket_t; + +PlatSocket_t PlatSocketConnection = {-1, 0, {0}, 0}; +int PlatSocketPipeFd[2] = {-1, -1}; +int PlatServerSocketId = -1; + +void PlatSocketRxNewConn(uint8_t id); +void PlatSocketInit(void); +void PlatSocketDeInit(void); +int PlatSocketTxData(uint16_t length, uint8_t *pData, int socketId); + +#define PLAT_UART_MAX_CHAR 1024 + +uint32_t PlatSocketId = 0; + +void PlatSocketSendInput(void *buffer) +{ + uint16_t len = 0; + uint8_t *buf = &((uint8_t *)buffer)[2]; + + len = ((uint16_t *)buffer)[0]; + otPlatUartReceived(buf, len); + free(buffer); +} + +void PlatSocketRx(uint16_t length, const char *buffer, uint32_t socketId) +{ + uint8_t *buf = 0; + PlatSocketId = socketId; + + if (length > 0) + { + buf = malloc(sizeof(length) + length); + memcpy(buf, &length, sizeof(length)); + memcpy(buf + sizeof(length), buffer, length); + qorvoAlarmMilliStart(0, PlatSocketSendInput, (void *)buf); + } +} + +void PlatSocketClose(uint32_t socketId) +{ + close(socketId); +} + +otError otPlatUartEnable(void) +{ + PlatSocketInit(); + return OT_ERROR_NONE; +} + +otError otPlatUartDisable(void) +{ + PlatSocketDeInit(); + return OT_ERROR_NONE; +} + +otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength) +{ + otError error = OT_ERROR_NONE; + char localbuf[PLAT_UART_MAX_CHAR]; + + if (aBufLength > PLAT_UART_MAX_CHAR - 1) + { + perror("Max buffer length exceeded"); + return OT_ERROR_GENERIC; + } + + memcpy(localbuf, aBuf, aBufLength); + localbuf[aBufLength] = 0; + printf("%s", localbuf); + + if (PlatSocketId) + { + PlatSocketTxData(aBufLength, (uint8_t *)aBuf, PlatSocketId); + } + + otPlatUartSendDone(); + return error; +} + +otError otPlatUartFlush(void) +{ + return OT_ERROR_NOT_IMPLEMENTED; +} + +int PlatSocketListenForClients() +{ + // Setup server side socket + int sockfd; + struct sockaddr_in serv_addr; + uint32_t flag = 1; + int ret; + + sockfd = socket(AF_INET, SOCK_STREAM, 0); + otEXPECT_ACTION(sockfd >= 0, sockfd = -1); + + // disable Nagle's algorithm to avoid long latency + setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag)); + // allow reuse of the same address + setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof(flag)); + memset(&serv_addr, 0, sizeof(serv_addr)); + + serv_addr.sin_addr.s_addr = INADDR_ANY; + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(SOCKET_PORT); + ret = bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)); + otEXPECT_ACTION(ret >= 0, close(sockfd); sockfd = -1; perror("bind() failed"); exit(ret)); + ret = listen(sockfd, 10); + otEXPECT_ACTION(ret != -1, perror("listen() failed"); exit(1)); +exit: + return sockfd; +} + +void PlatSocketRxSignaled(uint8_t id) +{ + OT_UNUSED_VARIABLE(id); + + // Dummy callback function to flush pipe + uint8_t readChar; + // Remove trigger byte from pipe + read(PlatSocketPipeFd[0], &readChar, 1); +} + +void *PlatSocketReadThread(void *pClientSocket) +{ + char buffer[BUFFER_MAX_SIZE]; + PlatSocket_t *clientSocket = ((PlatSocket_t *)pClientSocket); + + memset(buffer, 0, BUFFER_MAX_SIZE); + + while (1) + { + int readLen = SOCKET_READ(clientSocket->socketId, buffer, BUFFER_MAX_SIZE); + + if (readLen < 0) + { + perror("Reading socket"); + break; + } + else + { + if (readLen == 0) + { + break; + } + + { + uint8_t someByte = 0x12; // No functional use only using pipe to kick main thread + + PlatSocketRx(readLen, buffer, clientSocket->socketId); + + write(PlatSocketPipeFd[1], &someByte, 1); //[1] = write fd + } + } + } + + clientSocket->isValid = 0; + qorvoPlatUnRegisterPollFunction(clientSocket->socketId); + + PlatSocketClose(clientSocket->socketId); + + return NULL; +} + +void PlatSocketRxNewConn(uint8_t id) +{ + // Find first non-valid client in list - add here + if (PlatSocketConnection.isValid == 0) + { + // Add new client to client list + socklen_t len; + len = sizeof(PlatSocketConnection.addr); + int retval = accept(id, (struct sockaddr *)&PlatSocketConnection.addr, (socklen_t *)&len); + + if (retval >= 0) + { + int retErr; + PlatSocketConnection.socketId = retval; + retErr = + pthread_create(&PlatSocketConnection.rfReadThread, NULL, PlatSocketReadThread, &PlatSocketConnection); + + if (retErr) + { + close(PlatSocketConnection.socketId); + } + else + { + PlatSocketConnection.isValid = 1; + } + } + } + else + { + int tempfd; + tempfd = accept(id, (struct sockaddr *)NULL, NULL); + + if (tempfd >= 0) + { + close(tempfd); + } + } +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void PlatSocketInit(void) +{ + int res; + memset(&PlatSocketConnection, 0, sizeof(PlatSocketConnection)); + + // in case we are a server, setup listening for client + PlatServerSocketId = PlatSocketListenForClients(); + qorvoPlatRegisterPollFunction(PlatServerSocketId, PlatSocketRxNewConn); + + // hack + res = pipe(PlatSocketPipeFd); + otEXPECT_ACTION(res == 0, perror("pipe() failed")); + + res = fcntl(PlatSocketPipeFd[0], F_SETFD, fcntl(PlatSocketPipeFd[0], F_GETFD) | FD_CLOEXEC); + otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed")); + + res = fcntl(PlatSocketPipeFd[1], F_SETFD, fcntl(PlatSocketPipeFd[1], F_GETFD) | FD_CLOEXEC); + otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed")); + + qorvoPlatRegisterPollFunction(PlatSocketPipeFd[0], PlatSocketRxSignaled); + + return; + +exit: + qorvoPlatUnRegisterPollFunction(PlatServerSocketId); + close(PlatServerSocketId); + exit(1); +} + +void platformUartRestore(void) +{ + PlatSocketDeInit(); +} + +void PlatSocketDeInit(void) +{ + if (PlatServerSocketId >= 0) + { + qorvoPlatUnRegisterPollFunction(PlatServerSocketId); + close(PlatServerSocketId); + } + + if (PlatSocketPipeFd[0] >= 0) + { + qorvoPlatUnRegisterPollFunction(PlatSocketPipeFd[0]); + close(PlatSocketPipeFd[0]); + } + + if (PlatSocketPipeFd[1] >= 0) + { + close(PlatSocketPipeFd[1]); + } + + if (PlatSocketConnection.socketId >= 0) + { + close(PlatSocketConnection.socketId); + } + sync(); +} + +int PlatSocketTxData(uint16_t length, uint8_t *pData, int socketId) +{ + int result = -1; + + // All sockets + if (PlatSocketConnection.isValid) + { + if (PlatSocketConnection.socketId == socketId) + { + if (SOCKET_WRITE(PlatSocketConnection, (const char *)pData, length) < 0) + { + perror("TxSocket: Error Writing to client"); + close(PlatSocketConnection.socketId); + PlatSocketConnection.isValid = 0; + } + else + { + result = 0; + } + } + } + + return result; +} + +void platformUartProcess(void) +{ +} + +void platformUartInit(void) +{ +} + +OT_TOOL_WEAK void otPlatUartSendDone(void) +{ +} + +OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) +{ + OT_UNUSED_VARIABLE(aBuf); + OT_UNUSED_VARIABLE(aBufLength); +} diff --git a/Software/OpenThread/src/qpg7015m/CMakeLists.txt b/Software/OpenThread/src/qpg7015m/CMakeLists.txt new file mode 100644 index 0000000..0df9e8c --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/CMakeLists.txt @@ -0,0 +1,162 @@ +# +# Copyright (c) 2020, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +list(APPEND OT_PLATFORM_DEFINES + "_BSD_SOURCE=1" + "_DEFAULT_SOURCE=1" + "OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1" +) + +target_compile_definitions(ot-config INTERFACE + "MBEDTLS_USER_CONFIG_FILE=\"qpg7015m-mbedtls-config.h\"" +) + +list(APPEND OT_PUBLIC_INCLUDES + "${CMAKE_CURRENT_SOURCE_DIR}/crypto" + "${CMAKE_CURRENT_SOURCE_DIR}/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread" +) + +set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE) + +set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE) + +if(OT_CFLAGS MATCHES "-pedantic-errors") + string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}") +endif() + +if(OT_CFLAGS MATCHES "-Wno-c\\+\\+14-compat") + string(REPLACE "-Wno-c++14-compat" "" OT_CFLAGS "${OT_CFLAGS}") +endif() + +set(PLATFORM_SOURCES + alarm.c + diag.c + entropy.c + flash.c + logging.c + misc.c + radio.c + system.c +) + +if(OT_QORVO_SOCKET) + list(APPEND PLATFORM_SOURCES + uart-socket.c + ) +else() + list(APPEND PLATFORM_SOURCES + uart-posix.c + ) +endif() + +add_library(openthread-qpg7015m-ftd + STATIC + ${PLATFORM_SOURCES} +) + +set_target_properties( + openthread-qpg7015m-ftd + PROPERTIES + C_STANDARD 99 + CXX_STANDARD 11 +) + +target_link_libraries(openthread-qpg7015m-ftd + PRIVATE + -Wl,--start-group + qpg7015m-driver-ftd + ${OT_MBEDTLS} + ot-config + -Wl,--end-group + PUBLIC + -lrt + -pthread + -Wl,--gc-sections + -Wl,-Map=$.map +) + +target_compile_definitions(openthread-qpg7015m-ftd + PUBLIC + ${OT_PLATFORM_DEFINES} +) + +target_compile_options(openthread-qpg7015m-ftd + PRIVATE + ${OT_CFLAGS} +) + +target_include_directories(openthread-qpg7015m-ftd + PRIVATE + ${OT_PUBLIC_INCLUDES} + ${OPENTHREAD_DIR}/examples/platforms +) + +add_library(openthread-qpg7015m-mtd + STATIC + ${PLATFORM_SOURCES} +) + +set_target_properties( + openthread-qpg7015m-mtd + PROPERTIES + C_STANDARD 99 + CXX_STANDARD 11 +) + +target_link_libraries(openthread-qpg7015m-mtd + PRIVATE + -Wl,--start-group + qpg7015m-driver-mtd + ${OT_MBEDTLS} + ot-config + -Wl,--end-group + PUBLIC + -lrt + -pthread + -Wl,--gc-sections + -Wl,-Map=$.map +) + +target_compile_definitions(openthread-qpg7015m-mtd + PUBLIC + ${OT_PLATFORM_DEFINES} +) + +target_compile_options(openthread-qpg7015m-mtd + PRIVATE + ${OT_CFLAGS} +) + +target_include_directories(openthread-qpg7015m-mtd + PRIVATE + ${OT_PUBLIC_INCLUDES} + ${OPENTHREAD_DIR}/examples/platforms +) + +target_include_directories(ot-config INTERFACE ${OT_PUBLIC_INCLUDES}) +target_compile_definitions(ot-config INTERFACE ${OT_PLATFORM_DEFINES}) diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Documents/ReleaseNotes/ReleaseNotes.pdf b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Documents/ReleaseNotes/ReleaseNotes.pdf new file mode 100644 index 0000000..43808fa Binary files /dev/null and b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Documents/ReleaseNotes/ReleaseNotes.pdf differ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Documents/User Manuals/GP_P1053_AN_14876_Open_Thread.pdf b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Documents/User Manuals/GP_P1053_AN_14876_Open_Thread.pdf new file mode 100644 index 0000000..e494af9 Binary files /dev/null and b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Documents/User Manuals/GP_P1053_AN_14876_Open_Thread.pdf differ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Documents/document_overview.txt b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Documents/document_overview.txt new file mode 100644 index 0000000..c506cfa --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Documents/document_overview.txt @@ -0,0 +1,5 @@ + +document revisions: +------------------- +User Manuals/GP_P1053_AN_14876_Open_Thread.pdf - rev. 1.8 +../GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf - rev. 1.19 diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/End_User_License_Agreement.pdf b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/End_User_License_Agreement.pdf new file mode 100644 index 0000000..3d08d8a Binary files /dev/null and b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/End_User_License_Agreement.pdf differ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf new file mode 100644 index 0000000..deca380 Binary files /dev/null and b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf differ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/README.txt b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/README.txt new file mode 100644 index 0000000..2dbfeec --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/README.txt @@ -0,0 +1,11 @@ + +Getting started: +=============== +* Discover new features, resolved and known issues: GP_P1053_RN_15263_Smart_Home_Gateway_OpenThread_Lib.pdf +* Explore the projects + + +Folder structure: +================ + Software Example projects + Documents diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Makefile.QorvoQPG7015M_rpi_cli_ftd_socket b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Makefile.QorvoQPG7015M_rpi_cli_ftd_socket new file mode 100644 index 0000000..b1ad8a8 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Makefile.QorvoQPG7015M_rpi_cli_ftd_socket @@ -0,0 +1,392 @@ +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/qpg7015m_rpi_cli_ftd_socket.py + +ifndef BASEDIR +BASEDIR:=$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) +endif +# Global vars +OS_USED?=LINUX +ROOTDIR?=$(BASEDIR) +WORKDIR=$(BASEDIR)/Work/QorvoQPG7015M_rpi_cli_ftd_socket +ENV_PATH?=$(BASEDIR) +PYTHON_BIN?=/usr/bin/python3 +CURRENT_CONF:=qpg7015m_rpi_cli_ftd_socket.py +EXTRA_CONF:= + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_config.h + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +FLAGS= +# Build variables +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/cryptodma.c +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/memcmp.c +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/sx_derive_key_alg.c +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/sx_rng.c + +# Main target file +APPLIB:=$(BASEDIR)/Work/QorvoQPG7015M_rpi_cli_ftd_socket/libQorvoQPG7015M_rpi_cli_ftd_socket.a + + +# Compiler specifics +COMPILER?=rpi_bcm2708 +COMPILER_VERSION:= +TOOLCHAIN?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf +CROSS_COMPILE?=arm-linux-gnueabihf- +SYSTEMROOT?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot +PROGRAMMER?=linux +PROGRAM_EXT:=a +LIB_EXT:=a + +SRC= +SRC_NOWARNING= +ASRC= +INC= +AINC= +LIB= + +# Application defines +APPNAME:=QorvoQPG7015M_rpi_cli_ftd_socket +SRC_APP:= +SRC_APP+=$(BASEDIR)/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c +SRC+=$(SRC_APP) +INC_APP:= +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708 +INC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen +INC+=$(INC_APP) +AINC_APP:= +AINC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen +AINC+=$(AINC_APP) + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_config.h +FLAGS+=-DGP_CONFIG_HEADER +APPFIRMWARE:= + +COMPS:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +SRC_gpAssert:= +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c +SRC+=$(SRC_gpAssert) +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) +SRC_NOWARNING+=$(SRC_gpAssert) + +#Depends on: +# src: +COMPS+=gpBaseComps +SRC_gpBaseComps:= +SRC_gpBaseComps+=$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c +SRC+=$(SRC_gpBaseComps) +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) +SRC_NOWARNING+=$(SRC_gpBaseComps) + +#Depends on: +# src: +COMPS+=gpBsp +SRC_gpBsp:= +SRC_gpBsp+=$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c +SRC+=$(SRC_gpBsp) +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) +SRC_NOWARNING+=$(SRC_gpBsp) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +SRC_gpCom:= +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c +SRC+=$(SRC_gpCom) +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) +SRC_NOWARNING+=$(SRC_gpCom) + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +SRC_gpEncryption:= +SRC_gpEncryption+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c +SRC+=$(SRC_gpEncryption) +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) +SRC_NOWARNING+=$(SRC_gpEncryption) + +#Depends on: +# src: gpAssert +COMPS+=gpLog +SRC_gpLog:= +SRC_gpLog+=$(BASEDIR)/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c +SRC+=$(SRC_gpLog) +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) +SRC_NOWARNING+=$(SRC_gpLog) + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +SRC_gpMacCore:= +SRC_gpMacCore+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c +SRC+=$(SRC_gpMacCore) +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC+=$(INC_gpMacCore) +SRC_NOWARNING_EXCLUDES_gpMacCore:= +SRC_NOWARNING+=$(filter-out $(SRC_NOWARNING_EXCLUDES_gpMacCore), $(SRC_gpMacCore)) + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +SRC_gpMacDispatcher:= +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c +SRC+=$(SRC_gpMacDispatcher) +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC+=$(INC_gpMacDispatcher) + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +SRC_gpPd:= +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c +SRC+=$(SRC_gpPd) +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +SRC_gpPoolMem:= +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c +SRC+=$(SRC_gpPoolMem) +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) +SRC_NOWARNING+=$(SRC_gpPoolMem) + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +SRC_gpRandom:= +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c +SRC+=$(SRC_gpRandom) +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +SRC_gpRxArbiter:= +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c +SRC+=$(SRC_gpRxArbiter) +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) +SRC_NOWARNING+=$(SRC_gpRxArbiter) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +SRC_gpSched:= +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c +SRC+=$(SRC_gpSched) +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) +SRC_NOWARNING+=$(SRC_gpSched) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +SRC_gpStat:= +SRC_gpStat+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c +SRC+=$(SRC_gpStat) +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) +SRC_NOWARNING+=$(SRC_gpStat) + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +SRC_gpUtils:= +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c +SRC+=$(SRC_gpUtils) +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) +SRC_NOWARNING+=$(SRC_gpUtils) + +#Depends on: +# src: +COMPS+=gpVersion +SRC_gpVersion:= +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c +SRC+=$(SRC_gpVersion) +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC+=$(INC_gpVersion) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + +#Depends on: +# src: gpAssert, gpReset, silexCryptoSoc, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +SRC_gphal:= +SRC_gphal+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c +SRC+=$(SRC_gphal) +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +SRC_halLinux:= +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Timer.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c +SRC+=$(SRC_halLinux) +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=pthread +LIB_halLinux+=rt +LIB+=$(LIB_halLinux) + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +SRC_qvOT:= +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c +SRC+=$(SRC_qvOT) +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/qpg7015m +INC+=$(INC_qvOT) +SRC_NOWARNING+=$(SRC_qvOT) + +#Depends on: +# src: gpAssert, gpLog +COMPS+=silexCryptoSoc +INC_silexCryptoSoc:= +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/silexCryptoSoc/inc +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/include +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src +INC+=$(INC_silexCryptoSoc) +AINC_silexCryptoSoc:= +AINC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/include +AINC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src +AINC+=$(AINC_silexCryptoSoc) + + +-include $(BASEDIR)/custom.mk +include $(ENV_PATH)/make/gpcommon.mk diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Makefile.QorvoQPG7015M_rpi_cli_mtd_socket b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Makefile.QorvoQPG7015M_rpi_cli_mtd_socket new file mode 100644 index 0000000..5b2aca8 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Makefile.QorvoQPG7015M_rpi_cli_mtd_socket @@ -0,0 +1,392 @@ +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/qpg7015m_rpi_cli_mtd_socket.py + +ifndef BASEDIR +BASEDIR:=$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) +endif +# Global vars +OS_USED?=LINUX +ROOTDIR?=$(BASEDIR) +WORKDIR=$(BASEDIR)/Work/QorvoQPG7015M_rpi_cli_mtd_socket +ENV_PATH?=$(BASEDIR) +PYTHON_BIN?=/usr/bin/python3 +CURRENT_CONF:=qpg7015m_rpi_cli_mtd_socket.py +EXTRA_CONF:= + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_config.h + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +FLAGS= +# Build variables +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/cryptodma.c +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/memcmp.c +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/sx_derive_key_alg.c +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/sx_rng.c + +# Main target file +APPLIB:=$(BASEDIR)/Work/QorvoQPG7015M_rpi_cli_mtd_socket/libQorvoQPG7015M_rpi_cli_mtd_socket.a + + +# Compiler specifics +COMPILER?=rpi_bcm2708 +COMPILER_VERSION:= +TOOLCHAIN?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf +CROSS_COMPILE?=arm-linux-gnueabihf- +SYSTEMROOT?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot +PROGRAMMER?=linux +PROGRAM_EXT:=a +LIB_EXT:=a + +SRC= +SRC_NOWARNING= +ASRC= +INC= +AINC= +LIB= + +# Application defines +APPNAME:=QorvoQPG7015M_rpi_cli_mtd_socket +SRC_APP:= +SRC_APP+=$(BASEDIR)/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c +SRC+=$(SRC_APP) +INC_APP:= +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708 +INC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen +INC+=$(INC_APP) +AINC_APP:= +AINC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen +AINC+=$(AINC_APP) + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_config.h +FLAGS+=-DGP_CONFIG_HEADER +APPFIRMWARE:= + +COMPS:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +SRC_gpAssert:= +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c +SRC+=$(SRC_gpAssert) +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) +SRC_NOWARNING+=$(SRC_gpAssert) + +#Depends on: +# src: +COMPS+=gpBaseComps +SRC_gpBaseComps:= +SRC_gpBaseComps+=$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c +SRC+=$(SRC_gpBaseComps) +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) +SRC_NOWARNING+=$(SRC_gpBaseComps) + +#Depends on: +# src: +COMPS+=gpBsp +SRC_gpBsp:= +SRC_gpBsp+=$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c +SRC+=$(SRC_gpBsp) +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) +SRC_NOWARNING+=$(SRC_gpBsp) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +SRC_gpCom:= +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c +SRC+=$(SRC_gpCom) +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) +SRC_NOWARNING+=$(SRC_gpCom) + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +SRC_gpEncryption:= +SRC_gpEncryption+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c +SRC+=$(SRC_gpEncryption) +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) +SRC_NOWARNING+=$(SRC_gpEncryption) + +#Depends on: +# src: gpAssert +COMPS+=gpLog +SRC_gpLog:= +SRC_gpLog+=$(BASEDIR)/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c +SRC+=$(SRC_gpLog) +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) +SRC_NOWARNING+=$(SRC_gpLog) + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +SRC_gpMacCore:= +SRC_gpMacCore+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c +SRC+=$(SRC_gpMacCore) +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC+=$(INC_gpMacCore) +SRC_NOWARNING_EXCLUDES_gpMacCore:= +SRC_NOWARNING+=$(filter-out $(SRC_NOWARNING_EXCLUDES_gpMacCore), $(SRC_gpMacCore)) + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +SRC_gpMacDispatcher:= +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c +SRC+=$(SRC_gpMacDispatcher) +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC+=$(INC_gpMacDispatcher) + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +SRC_gpPd:= +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c +SRC+=$(SRC_gpPd) +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +SRC_gpPoolMem:= +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c +SRC+=$(SRC_gpPoolMem) +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) +SRC_NOWARNING+=$(SRC_gpPoolMem) + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +SRC_gpRandom:= +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c +SRC+=$(SRC_gpRandom) +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +SRC_gpRxArbiter:= +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c +SRC+=$(SRC_gpRxArbiter) +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) +SRC_NOWARNING+=$(SRC_gpRxArbiter) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +SRC_gpSched:= +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c +SRC+=$(SRC_gpSched) +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) +SRC_NOWARNING+=$(SRC_gpSched) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +SRC_gpStat:= +SRC_gpStat+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c +SRC+=$(SRC_gpStat) +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) +SRC_NOWARNING+=$(SRC_gpStat) + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +SRC_gpUtils:= +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c +SRC+=$(SRC_gpUtils) +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) +SRC_NOWARNING+=$(SRC_gpUtils) + +#Depends on: +# src: +COMPS+=gpVersion +SRC_gpVersion:= +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c +SRC+=$(SRC_gpVersion) +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC+=$(INC_gpVersion) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + +#Depends on: +# src: gpAssert, gpReset, silexCryptoSoc, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +SRC_gphal:= +SRC_gphal+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c +SRC+=$(SRC_gphal) +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +SRC_halLinux:= +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Timer.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c +SRC+=$(SRC_halLinux) +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=pthread +LIB_halLinux+=rt +LIB+=$(LIB_halLinux) + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +SRC_qvOT:= +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c +SRC+=$(SRC_qvOT) +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/qpg7015m +INC+=$(INC_qvOT) +SRC_NOWARNING+=$(SRC_qvOT) + +#Depends on: +# src: gpAssert, gpLog +COMPS+=silexCryptoSoc +INC_silexCryptoSoc:= +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/silexCryptoSoc/inc +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/include +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src +INC+=$(INC_silexCryptoSoc) +AINC_silexCryptoSoc:= +AINC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/include +AINC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src +AINC+=$(AINC_silexCryptoSoc) + + +-include $(BASEDIR)/custom.mk +include $(ENV_PATH)/make/gpcommon.mk diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Makefile.QorvoQPG7015M_rpi_rcp_socket b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Makefile.QorvoQPG7015M_rpi_rcp_socket new file mode 100644 index 0000000..04ef764 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Makefile.QorvoQPG7015M_rpi_rcp_socket @@ -0,0 +1,392 @@ +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/qpg7015m_rpi_rcp_socket.py + +ifndef BASEDIR +BASEDIR:=$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) +endif +# Global vars +OS_USED?=LINUX +ROOTDIR?=$(BASEDIR) +WORKDIR=$(BASEDIR)/Work/QorvoQPG7015M_rpi_rcp_socket +ENV_PATH?=$(BASEDIR) +PYTHON_BIN?=/usr/bin/python3 +CURRENT_CONF:=qpg7015m_rpi_rcp_socket.py +EXTRA_CONF:= + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_config.h + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +FLAGS= +# Build variables +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/cryptodma.c +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/memcmp.c +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/sx_derive_key_alg.c +SRC_DISABLE_ALIGNMENT_ERROR+=$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src/sx_rng.c + +# Main target file +APPLIB:=$(BASEDIR)/Work/QorvoQPG7015M_rpi_rcp_socket/libQorvoQPG7015M_rpi_rcp_socket.a + + +# Compiler specifics +COMPILER?=rpi_bcm2708 +COMPILER_VERSION:= +TOOLCHAIN?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf +CROSS_COMPILE?=arm-linux-gnueabihf- +SYSTEMROOT?=/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot +PROGRAMMER?=linux +PROGRAM_EXT:=a +LIB_EXT:=a + +SRC= +SRC_NOWARNING= +ASRC= +INC= +AINC= +LIB= + +# Application defines +APPNAME:=QorvoQPG7015M_rpi_rcp_socket +SRC_APP:= +SRC_APP+=$(BASEDIR)/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c +SRC+=$(SRC_APP) +INC_APP:= +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc +INC_APP+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708 +INC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen +INC+=$(INC_APP) +AINC_APP:= +AINC_APP+=-I$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen +AINC+=$(AINC_APP) + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_config.h +FLAGS+=-DGP_CONFIG_HEADER +APPFIRMWARE:= + +COMPS:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +SRC_gpAssert:= +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c +SRC_gpAssert+=$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c +SRC+=$(SRC_gpAssert) +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) +SRC_NOWARNING+=$(SRC_gpAssert) + +#Depends on: +# src: +COMPS+=gpBaseComps +SRC_gpBaseComps:= +SRC_gpBaseComps+=$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c +SRC+=$(SRC_gpBaseComps) +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) +SRC_NOWARNING+=$(SRC_gpBaseComps) + +#Depends on: +# src: +COMPS+=gpBsp +SRC_gpBsp:= +SRC_gpBsp+=$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c +SRC+=$(SRC_gpBsp) +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) +SRC_NOWARNING+=$(SRC_gpBsp) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +SRC_gpCom:= +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c +SRC_gpCom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c +SRC+=$(SRC_gpCom) +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) +SRC_NOWARNING+=$(SRC_gpCom) + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +SRC_gpEncryption:= +SRC_gpEncryption+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c +SRC+=$(SRC_gpEncryption) +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) +SRC_NOWARNING+=$(SRC_gpEncryption) + +#Depends on: +# src: gpAssert +COMPS+=gpLog +SRC_gpLog:= +SRC_gpLog+=$(BASEDIR)/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c +SRC+=$(SRC_gpLog) +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) +SRC_NOWARNING+=$(SRC_gpLog) + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +SRC_gpMacCore:= +SRC_gpMacCore+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c +SRC+=$(SRC_gpMacCore) +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC+=$(INC_gpMacCore) +SRC_NOWARNING_EXCLUDES_gpMacCore:= +SRC_NOWARNING+=$(filter-out $(SRC_NOWARNING_EXCLUDES_gpMacCore), $(SRC_gpMacCore)) + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +SRC_gpMacDispatcher:= +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c +SRC_gpMacDispatcher+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c +SRC+=$(SRC_gpMacDispatcher) +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC+=$(INC_gpMacDispatcher) + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +SRC_gpPd:= +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c +SRC_gpPd+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c +SRC+=$(SRC_gpPd) +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +SRC_gpPoolMem:= +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c +SRC_gpPoolMem+=$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c +SRC+=$(SRC_gpPoolMem) +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) +SRC_NOWARNING+=$(SRC_gpPoolMem) + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +SRC_gpRandom:= +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c +SRC_gpRandom+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c +SRC+=$(SRC_gpRandom) +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +SRC_gpRxArbiter:= +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c +SRC_gpRxArbiter+=$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c +SRC+=$(SRC_gpRxArbiter) +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) +SRC_NOWARNING+=$(SRC_gpRxArbiter) + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +SRC_gpSched:= +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c +SRC_gpSched+=$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c +SRC+=$(SRC_gpSched) +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) +SRC_NOWARNING+=$(SRC_gpSched) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +SRC_gpStat:= +SRC_gpStat+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c +SRC+=$(SRC_gpStat) +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) +SRC_NOWARNING+=$(SRC_gpStat) + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +SRC_gpUtils:= +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c +SRC_gpUtils+=$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c +SRC+=$(SRC_gpUtils) +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) +SRC_NOWARNING+=$(SRC_gpUtils) + +#Depends on: +# src: +COMPS+=gpVersion +SRC_gpVersion:= +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c +SRC_gpVersion+=$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c +SRC+=$(SRC_gpVersion) +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC+=$(INC_gpVersion) + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + +#Depends on: +# src: gpAssert, gpReset, silexCryptoSoc, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +SRC_gphal:= +SRC_gphal+=$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c +SRC+=$(SRC_gphal) +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +SRC_halLinux:= +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Timer.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c +SRC_halLinux+=$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c +SRC+=$(SRC_halLinux) +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=pthread +LIB_halLinux+=rt +LIB+=$(LIB_halLinux) + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +SRC_qvOT:= +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c +SRC_qvOT+=$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c +SRC+=$(SRC_qvOT) +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/qpg7015m +INC+=$(INC_qvOT) +SRC_NOWARNING+=$(SRC_qvOT) + +#Depends on: +# src: gpAssert, gpLog +COMPS+=silexCryptoSoc +INC_silexCryptoSoc:= +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/silexCryptoSoc/inc +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/include +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src +INC+=$(INC_silexCryptoSoc) +AINC_silexCryptoSoc:= +AINC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/include +AINC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src +AINC+=$(AINC_silexCryptoSoc) + + +-include $(BASEDIR)/custom.mk +include $(ENV_PATH)/make/gpcommon.mk diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c new file mode 100644 index 0000000..5702985 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/apps/OpenThreadCliSocket/src/main.c @@ -0,0 +1,17 @@ +#define GP_COMPONENT_ID GP_COMPONENT_ID_APP + +#include "gpLog.h" + +#include + +// #define GP_LOCAL_LOG + +void qorvoThreadApp_Main() +{ + GP_LOG_PRINTF(">> TEST APP STARTED", 0); +} + +void qorvoThreadApp_Init(otInstance *sInstance) +{ + GP_LOG_PRINTF(">> TEST APP INIT", 0); +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/alarm_qorvo.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/alarm_qorvo.h new file mode 100644 index 0000000..5a157b5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/alarm_qorvo.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the declarations of the Alarm functions from the Qorvo library. + * + */ + +#ifndef _ALARM_QORVO_H_ +#define _ALARM_QORVO_H_ + +#include +#include +#include +#include + +typedef void (*qorvoAlarmCallback_t)(void *); + +/** + * This function initializes the alarm service used by OpenThread. + * + */ +void qorvoAlarmInit(void); + +/** + * This function retrieves the current host time in milliseconds. + * + * @param[out] The current time in ms. + * + */ +uint32_t qorvoAlarmGetTimeMs(void); + +/** + * This function retrieves the current host time in microseconds. + * + * @param[out] The current time in us. + * + */ +uint32_t qorvoAlarmGetTimeUs(void); + +/** + * This function schedules a callback after a relative amount of time. + * + * @param[in] rel_time The relative time in ms. + * @param[in] callback A callback function which will be called. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +void qorvoAlarmMilliStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); + +/** + * This function schedules a callback after a relative amount of time. + * + * @param[in] rel_time The relative time in us. + * @param[in] callback A callback function which will be called. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +void qorvoAlarmMicroStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); + +/** + * This function unschedules the callback. + * + * @param[in] callback A callback function which will be removed from the list. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +bool qorvoAlarmStop(qorvoAlarmCallback_t callback, void *arg); + +/** + * This function schedules a callback after a relative amount of time. + * This function exists for backwards compatibility reasons + * + * @param[in] rel_time The relative time in ms. + * @param[in] callback A callback function which will be called. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +void qorvoAlarmScheduleEventArg(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg); + +/** + * This function unschedules the callback. + * This function exists for backwards compatibility reasons + * + * @param[in] callback A callback function which will be removed from the list. + * @param[in] arg A context pointer which will be passed as an argument to the callback. + * + */ +bool qorvoAlarmUnScheduleEventArg(qorvoAlarmCallback_t callback, void *arg); + +#endif // _ALARM_QORVO_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/openthread-core-config.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/openthread-core-config.h new file mode 100644 index 0000000..62feaeb --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/openthread-core-config.h @@ -0,0 +1,10 @@ +#ifndef _OPENTHREAD_CORE_CONFIG_H_ +#define _OPENTHREAD_CORE_CONFIG_H_ +// +// Qorvo created file: +// +// This file is required to jailbreak the OpenThread build process +// So we don't need to be build OpenThread twice just to have the +// the file of the same name, which we don't need for our driver, +// generated in 'build/' +#endif // _OPENTHREAD_CORE_CONFIG_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/platform_qorvo.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/platform_qorvo.h new file mode 100644 index 0000000..f163642 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/platform_qorvo.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the platform-specific initializers. + * + */ + +#ifndef _PLATFORM_QORVO_H_ +#define _PLATFORM_QORVO_H_ + +#include + +#include +#include +#include + +typedef void (*qorvoPlatPollFunction_t)(uint8_t); +typedef uint8_t (*qorvoPlatGotoSleepCheckCallback_t)(void); + +/** + * This function registers a callback to a file descriptor. + * + * @param[in] fd The file descriptor. + * @param[in] pollFunction The callback which should be called when data is ready or needed for the file descriptor. + * + */ +void qorvoPlatRegisterPollFunction(int fd, qorvoPlatPollFunction_t pollFunction); + +/** + * This function unregisters a callback for a file descriptor. + * + * @param[in] fd The file descriptor. + * + */ +void qorvoPlatUnRegisterPollFunction(int fd); + +/** + * This function initializes the platform. + * + * @param[in] gotoSleepCheckCallback The callback which needs to return if sleep is allowed. + * + */ +void qorvoPlatInit(qorvoPlatGotoSleepCheckCallback_t gotoSleepCheckCallback); + +/** + * This function runs the main loop of the platform once. + * + * @param[in] canGoToSleep Indicates if the platform can got to sleep. + * + */ +void qorvoPlatMainLoop(bool canGoToSleep); + +#endif // _PLATFORM_QORVO_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/radio_qorvo.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/radio_qorvo.h new file mode 100644 index 0000000..51bdf1f --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/radio_qorvo.h @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the declarations of the radio functions from the Qorvo library. + * + */ + +#ifndef _RADIO_QORVO_H_ +#define _RADIO_QORVO_H_ + +#include +#include + +#include +#include + +/** + * This function initializes the radio. + * + */ +void qorvoRadioInit(void); + +/** + * This function resets the radio. + * + */ +void qorvoRadioReset(void); + +/** + * This function processes event to/from the radio. + * + */ +void qorvoRadioProcess(void); + +/** + * This function starts an ED scan. + * + * @param[in] aScanChannel The channel which needs to be scanned. + * @param[in] aScanDuration The amount of time in ms which needs to be scanned. + * + */ +otError qorvoRadioEnergyScan(uint8_t aScanChannel, uint16_t aScanDuration); + +/** + * This function sets the current channel. + * + * @param[in] channel The channel index. + * + */ +void qorvoRadioSetCurrentChannel(uint8_t channel); + +/** + * This function sets the idle behaviour of the radio. + * + * @param[in] rxOnWhenIdle If true, the radio remains on which not transmitting. + * + */ +void qorvoRadioSetRxOnWhenIdle(bool rxOnWhenIdle); + +/** + * This function retrieves the MAC address of the radio. + * + * @param[out] aIeeeEui64 The MAC address of the radio. + * + */ +void qorvoRadioGetIeeeEui64(uint8_t *aIeeeEui64); + +/** + * This function transmits a frame. + * + * @param[in] aFrame The frame which needs to be transmitted. + * + */ +otError qorvoRadioTransmit(otRadioFrame *aFrame); + +/** + * This function sets the PanId. + * + * @param[in] panid The panId. + * + */ +void qorvoRadioSetPanId(uint16_t panid); + +/** + * This function sets the short address. + * + * @param[in] address The short address. + * + */ +void qorvoRadioSetShortAddress(uint16_t address); + +/** + * This function sets the extended address. + * + * @param[in] address The extended address. + * + */ +void qorvoRadioSetExtendedAddress(const uint8_t *address); + +/** + * This function enables source address matching for indirect transmit. + * + * @param[in] aEnable if True will enable source address matching, false will disable. + * + */ +void qorvoRadioEnableSrcMatch(bool aEnable); + +/** + * This function clears all entries from the source address match list. + * + */ +void qorvoRadioClearSrcMatchEntries(void); + +/** + * This function adds an short address plus panid to the source address match list. + * + * @param[in] aShortAddress The short address which should be added. + * @param[in] panid The panid. + * + */ +otError qorvoRadioAddSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid); + +/** + * This function adds an extended address plus panid to the source address match list. + * + * @param[in] aExtAddress The extended address which should be added. + * @param[in] panid The panid. + * + */ +otError qorvoRadioAddSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid); + +/** + * This function removes an short address plus panid from the source address match list. + * + * @param[in] aShortAddress The short address which should be removed. + * @param[in] panid The panid. + * + */ +otError qorvoRadioClearSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid); + +/** + * This function removes an extended address plus panid from the source address match list. + * + * @param[in] aExtAddress The extended address which should be removed. + * @param[in] panid The panid. + * + */ +otError qorvoRadioClearSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid); + +/** + * This function gets the transmit power for current channel + * + * @param[out] aPower The transmit power + * + */ +otError qorvoRadioGetTransmitPower(int8_t *aPower); + +/** + * This function sets the transmit power for current channel + * + * @param[in] aPower The transmit power + * + */ +otError qorvoRadioSetTransmitPower(int8_t aPower); + +/** + * Get the status of promiscuous mode. + * + * @retval TRUE Promiscuous mode is enabled. + * @retval FALSE Promiscuous mode is disabled. + * + */ +bool qorvoRadioGetPromiscuous(void); + +/** + * Enable or disable promiscuous mode. + * + * @param[in] aEnable TRUE to enable or FALSE to disable promiscuous mode. + * + */ +void qorvoRadioSetPromiscuous(bool aEnable); + +/** + * Update MAC keys and key index + * + * This function is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability. + * + * @param[in] aKeyIdMode The key ID mode. + * @param[in] aKeyId Current MAC key index. + * @param[in] aPrevKey A pointer to the previous MAC key. + * @param[in] aCurrKey A pointer to the current MAC key. + * @param[in] aNextKey A pointer to the next MAC key. + * @param[in] aKeyType Key Type used. + * + */ +void qorvoRadioSetMacKey(uint8_t aKeyIdMode, + uint8_t aKeyId, + const uint8_t *aPrevKey, + const uint8_t *aCurrKey, + const uint8_t *aNextKey, + uint8_t aKeyType); + +/** + * This method sets the current MAC frame counter value. + * + * This function is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability. + * + * @param[in] aMacFrameCounter The MAC frame counter value. + * + */ +void qorvoRadioSetMacFrameCounter(uint32_t aMacFrameCounter); + +/** + * Enable or disable CSL receiver. + * + * @param[in] aCslPeriod CSL period, 0 for disabling CSL. + * @param[in] aShortAddr The short source address of CSL receiver's peer. + * @param[in] aExtAddr The extended source address of CSL receiver's peer. + * + * @note Platforms should use CSL peer addresses to include CSL IE when generating enhanced acks. + * + * @retval kErrorNotImplemented Radio driver doesn't support CSL. + * @retval kErrorFailed Other platform specific errors. + * @retval kErrorNone Successfully enabled or disabled CSL. + * + */ +otError qorvoRadioEnableCsl(uint32_t aCslPeriod, + uint16_t aShortAddr, + const uint8_t *aExtAddr); + +/** + * Update CSL sample time in radio driver. + * + * Sample time is stored in radio driver as a copy to calculate phase when sending ACK with CSL IE. + * + * @param[in] aCslSampleTime The latest sample time. + * + */ +void qorvoRadioUpdateCslSampleTime(uint32_t aCslSampleTime); + +/** + * Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator. + * + * After Enhanced-ACK Based Probing is configured by a specific Probing Initiator, the Enhanced-ACK sent to that + * node should include Vendor-Specific IE containing Link Metrics data. This method informs the radio to start/stop to + * collect Link Metrics data and include Vendor-Specific IE that containing the data in Enhanced-ACK sent to that + * Probing Initiator. + * + * @param[in] aLinkMetrics This parameter specifies what metrics to query. Per spec 4.11.3.4.4.6, at most 2 metrics + * can be specified. The probing would be disabled if @p `aLinkMetrics` is bitwise 0. + * @param[in] aShortAddr The short address of the Probing Initiator. + * @param[in] aExtAddr The extended source address of the Probing Initiator. @p aExtAddr MUST NOT be `NULL`. + * + * @retval OT_ERROR_NONE Successfully configured the Enhanced-ACK Based Probing. + * @retval OT_ERROR_INVALID_ARGS @p aExtAddress is `NULL`. + * @retval OT_ERROR_NOT_FOUND The Initiator indicated by @p aShortAddress is not found when trying to clear. + * @retval OT_ERROR_NO_BUFS No more Initiator can be supported. + * + */ +otError qorvoRadioConfigureEnhAckProbing(otLinkMetrics aLinkMetrics, + uint16_t aShortAddress, + const uint8_t *aExtAddress); + +/** + * Get the current estimated time (in microseconds) of the radio chip. + * + * This microsecond timer must be a free-running timer. The timer must continue to advance with microsecond precision + * even when the radio is in the sleep state. + * + * @returns The current time in microseconds. UINT64_MAX when platform does not support or radio time is not ready. + * + */ +uint64_t qorvoRadioGetNow(void); + +/** + * Schedule a radio reception window at a specific time and duration. + * + * @param[in] aChannel The radio channel on which to receive. + * @param[in] aStart The receive window start time, in microseconds. + * @param[in] aDuration The receive window duration, in microseconds + * + * @retval OT_ERROR_NONE Successfully scheduled receive window. + * @retval OT_ERROR_FAILED The receive window could not be scheduled. + */ +otError qorvoRadioReceiveAt(uint8_t aChannel, uint32_t aStart, uint32_t aDuration); + +/** + * Retrieve the radio capabilities of the radio + * + * @returns caps The radio capabilities as described in include/openthread/platform/radio.h + */ +otRadioCaps qorvoRadioGetCaps(void); + +/** + * This callback is called when the energy scan is finished. + * + * @param[in] aEnergyScanMaxRssi The amount of energy detected during the ED scan. + * + */ +void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi); + +/** + * This callback is called after a transmission is completed (and if required an ACK is received). + * + * @param[in] aFrame The packet which was transmitted. + * @param[in] aFramePending Indicates if the FP bit was set in the ACK frame or not. + * @param[in] aError Indicates if an error occurred during transmission. + * + */ +void cbQorvoRadioTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError); + +/** + * This callback is called after a transmission is completed (and if required an ACK is received). + * + * @param[in] aFrame The packet which was transmitted. + * @param[in] aAckFrame The complete 802.15.4-2015 enhanced ack frame. + * @param[in] aError Indicates if an error occurred during transmission. + * + */ +void cbQorvoRadioTransmitDone_AckFrame(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); + +/** + * This callback is called after a frame is received. + * + * @param[in] aFrame The packet which was received. + * @param[in] aError Any error which occurred during reception of the packet. + * + */ +void cbQorvoRadioReceiveDone(otRadioFrame *aFrame, otError aError); + +/** + * This callback is called to notify OpenThread that the transmission has started. + * + * @note This function should be called by the same thread that executes all of the other OpenThread code. It should + * not be called by ISR or any other task. + * + * @param[in] aFrame A pointer to the frame that is being transmitted. + * + */ +void cbQorvoRadioTxStarted(otRadioFrame *aFrame); + +#endif // _RADIO_QORVO_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/uart_qorvo.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/uart_qorvo.h new file mode 100644 index 0000000..be21438 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/inc/uart_qorvo.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the declarations of the uart functions from the Qorvo library. + * + */ + +#ifndef _UART_QORVO_H_ +#define _UART_QORVO_H_ + +#include +#include +#include +#include + +/** + * This function enables the UART driver. + * + */ +void qorvoUartInit(void); + +/** + * This function disables the UART driver. + * + */ +void qorvoUartDeInit(void); + +/** + * Callback function which will be called when uart transmission is done. + * + */ +void cbQorvoUartTxDone(void); + +/** + * Callback function which will be called when uart data is received. + * + * @param[in] aBuf A pointer to an array of received bytes. + * @param[in] aBufLength The number of bytes received from the uart. + * + */ +void qorvoUartSendInput(uint8_t *aBuf, uint16_t aBufLength); + +/** + * Function which transmits data via the uart. + * + * @param[out] aBuf A pointer to an array of bytes which need to be transmitted. + * @param[in] aBufLength The number of bytes to be transmitted via the uart. + * + */ +void qorvoUartSendOutput(const uint8_t *aBuf, uint16_t aBufLength); + +/** + * Function which transmits logging via the qorvo platform. + * + * @param[in] aLogLevel The severity level of logging. + * @param[in] aLogRegion The code region where the logging originated from. + * @param[in] aFormat The format strings. + * @param[in] args The arguments for the format string. + * + */ +void qorvoUartLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list args); + +/** + * Flush the outgoing transmit buffer and wait for the data to be sent. + * This is called when the CLI UART interface has a full buffer but still + * wishes to send more data. + * + * @retval OT_ERROR_NONE Flush succeeded, we can proceed to write more + * data to the buffer. + * + * @retval OT_ERROR_NOT_IMPLEMENTED Driver does not support synchronous flush. + * @retval OT_ERROR_INVALID_STATE Driver has no data to flush. + */ +otError qorvoUartFlush(void); +#endif // _UART_QORVO_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c new file mode 100644 index 0000000..2679fda --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/alarm_qorvo.c @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2017-2018, 2020-2021, Qorvo Inc + * + * alarm_qorvo.c + * This file contains the implementation of the qorvo alarm api for openthread. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_QVOT + +// #define GP_LOCAL_LOG +#define LOG_PREFIX "[Q] Alarm---------: " + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "gpAssert.h" +#include "gpLog.h" +#include "gpSched.h" + +#include "alarm_qorvo.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define QORVO_ALARM_MILLI_WRAP ((uint32_t)(0xFFFFFFFF / 1000UL)) +#define QORVO_ALARM_KEEP_ALIVE_PERIOD ((uint32_t)QORVO_ALARM_MILLI_WRAP - 10000) // in milliseconds + +#define us_to_ms(x) ((x) / 1000UL) +#define ms_to_us(x) ((x) * 1000UL) +#define ms_to_s(x) ((x) / 1000UL) +#define us_to_s(x) ((x) / 1000000UL) +#define ms_remaining(x) ((x) % 1000UL) +#define us_remaining(x) ((x) % 1000000UL) + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static uint16_t qorvoAlarmWrapCounter; +static uint32_t qorvoAlarmPrev; + +typedef struct TimeSAndUS +{ + uint32_t sec; + uint32_t usec; +} TimeSAndUs_t; + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +static void qorvoAlarmResetWrapCounter(void); +static void qorvoAlarmKeepAlive(void); +static void qorvoAlarmUpdateWrapAround(uint32_t now); +static void qorvoAlarmScheduleKeepAlive(void); +static TimeSAndUs_t qorvoGetSecondsAndMicrosecondsFromMilliseconds(uint32_t milliseconds); +static TimeSAndUs_t qorvoGetSecondsAndMicrosecondsFromMicroseconds(uint32_t microseconds); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +TimeSAndUs_t qorvoGetSecondsAndMicrosecondsFromMilliseconds(uint32_t milliseconds) +{ + TimeSAndUs_t time = {ms_to_s(milliseconds), ms_to_us(ms_remaining(milliseconds))}; + return time; +} + +TimeSAndUs_t qorvoGetSecondsAndMicrosecondsFromMicroseconds(uint32_t microseconds) +{ + TimeSAndUs_t time = {us_to_s(microseconds), us_remaining(microseconds)}; + return time; +} + +void qorvoAlarmScheduleKeepAlive(void) +{ + TimeSAndUs_t time = qorvoGetSecondsAndMicrosecondsFromMilliseconds(QORVO_ALARM_KEEP_ALIVE_PERIOD); + gpSched_UnscheduleEventArg((gpSched_EventCallback_t)qorvoAlarmKeepAlive, NULL); + gpSched_ScheduleEventInSecAndUs(time.sec, time.usec, (gpSched_EventCallback_t)qorvoAlarmKeepAlive, NULL); +} + +void qorvoAlarmResetWrapCounter(void) +{ + qorvoAlarmWrapCounter = 0; + GP_LOG_PRINTF(LOG_PREFIX "QorvoAlarm: internal timer reset. cnt=%u", 0, qorvoAlarmWrapCounter); + + qorvoAlarmPrev = gpSched_GetCurrentTime(); + qorvoAlarmScheduleKeepAlive(); +} + +void qorvoAlarmKeepAlive(void) +{ + GP_LOG_PRINTF(LOG_PREFIX "QorvoAlarm: Keep Alive triggered", 0); + qorvoAlarmGetTimeMs(); +} + +void qorvoAlarmUpdateWrapAround(uint32_t now) +{ + if(now < qorvoAlarmPrev) + { + qorvoAlarmWrapCounter += (qorvoAlarmWrapCounter < 1000 ? 1 : -1000); + GP_LOG_PRINTF(LOG_PREFIX "QorvoAlarm: internal timer wrap. cnt=%u", 0, qorvoAlarmWrapCounter); + GP_ASSERT_DEV_INT(qorvoAlarmWrapCounter <= 1000); + } + qorvoAlarmPrev = now; + + qorvoAlarmScheduleKeepAlive(); +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void qorvoAlarmInit(void) +{ + qorvoAlarmResetWrapCounter(); +} + +uint32_t qorvoAlarmGetTimeMs(void) +{ + uint32_t now = gpSched_GetCurrentTime(); + + qorvoAlarmUpdateWrapAround(now); + return (uint32_t)((uint32_t)us_to_ms(now) + qorvoAlarmWrapCounter * QORVO_ALARM_MILLI_WRAP); +} + +uint32_t qorvoAlarmGetTimeUs(void) +{ + return gpSched_GetCurrentTime(); +} + +void qorvoAlarmMilliStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void* arg) +{ + TimeSAndUs_t time = qorvoGetSecondsAndMicrosecondsFromMilliseconds(rel_time); + GP_LOG_PRINTF(LOG_PREFIX "Start milli timer for %lu ms -> %lu s, %lu us", 0, (unsigned long)rel_time, (unsigned long)time.sec, (unsigned long)time.usec); + gpSched_ScheduleEventInSecAndUs(time.sec, time.usec, (gpSched_EventCallback_t)callback, arg); +} + +void qorvoAlarmMicroStart(uint32_t rel_time, qorvoAlarmCallback_t callback, void* arg) +{ + TimeSAndUs_t time = qorvoGetSecondsAndMicrosecondsFromMicroseconds(rel_time); + GP_LOG_PRINTF(LOG_PREFIX "Start micro timer for %lu us -> %lu s, %lu us", 0, (unsigned long)rel_time, (unsigned long)time.sec, (unsigned long)time.usec); + gpSched_ScheduleEventInSecAndUs(time.sec, time.usec, (gpSched_EventCallback_t)callback, arg); +} + +bool qorvoAlarmStop(qorvoAlarmCallback_t callback, void* arg) +{ + return (bool)gpSched_UnscheduleEventArg((gpSched_EventCallback_t)callback, arg); +} + +/***************************************************************************** + * Public functions for backwards compatibility + *****************************************************************************/ +void qorvoAlarmScheduleEventArg(uint32_t rel_time, qorvoAlarmCallback_t callback, void* arg) +{ + qorvoAlarmMilliStart(rel_time, callback, arg); +} + +bool qorvoAlarmUnScheduleEventArg(qorvoAlarmCallback_t callback, void* arg) +{ + return qorvoAlarmStop(callback, arg); +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c new file mode 100644 index 0000000..217c479 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/platform_qorvo.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2017-2021, Qorvo Inc + * + * platform_qorvo.c + * This file contains the implementation of the qorvo platform api for openthread. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_APP + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "platform_qorvo.h" +#include "gpLog.h" +#include "hal.h" +#include "gpSched.h" +#include "gpUtils.h" +#include "gpBaseComps.h" +#if defined(GP_DIVERSITY_JUMPTABLES) +#include "gpJumpTables.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void qorvoPlatMainLoop(bool canGoToSleep) +{ +#ifndef GP_DIVERSITY_FREERTOS + if(canGoToSleep) + { + //printf("sleep\n"); + gpSched_GoToSleep(); + //printf("wake\n"); + } + gpSched_Main_Body(); +#endif //GP_DIVERSITY_FREERTOS +} + +void qorvoPlatInit(qorvoPlatGotoSleepCheckCallback_t gotoSleepCheckCallback) +{ +#ifndef GP_DIVERSITY_FREERTOS + HAL_INITIALIZE_GLOBAL_INT(); + + //Hardware initialisation + HAL_INIT(); + + //Radio interrupts that occur will only be handled later on in the main loop + //Other interrupt source do not trigger any calls to blocks that are not initialized yet + HAL_ENABLE_GLOBAL_INT(); + + //Application_Init(); + gpBaseComps_StackInit(); + GP_UTILS_DUMP_STACK_POINTER(); + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); + + + gpSched_SetGotoSleepCheckCallback((gpSched_GotoSleepCheckCallback_t)gotoSleepCheckCallback); +#endif //GP_DIVERSITY_FREERTOS +#if defined(GP_DIVERSITY_JUMPTABLES) + gpJumpTables_GetRomVersionFromRom(); +#endif // defined(GP_DIVERSITY_JUMPTABLES) +} + +void qorvoPlatRegisterPollFunction(int fd, qorvoPlatPollFunction_t pollFunction) +{ + hal_RegisterPollFunction(fd, (hal_PollFunction_t)pollFunction); +} +void qorvoPlatUnRegisterPollFunction(int fd) +{ + hal_UnRegisterPollFunction(fd); +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c new file mode 100644 index 0000000..d474add --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/radio_qorvo.c @@ -0,0 +1,1044 @@ +/* + * Copyright (c) 2017-2020, Qorvo Inc + * + * radio_qorvo.c + * This file contains the implementation of the qorvo radio api for openthread. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_APP + +// #define GP_LOCAL_LOG +#define LOG_PREFIX "[Q] Radio---------: " + +// #define DEBUG + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "platform_qorvo.h" +#include +#include + +#include "global.h" +#include "radio_qorvo.h" +#include "alarm_qorvo.h" +#include "gpMacDispatcher.h" +#include "gpMacCore_defsDefines.h" +#include "gpLog.h" +#include "gpEncryption.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpPd.h" + +/***************************************************************************** + * Compile Time Verifications + *****************************************************************************/ + +#ifndef GP_SCHED_FREE_CPU_TIME +GP_COMPILE_TIME_VERIFY(GP_SCHED_DEFAULT_GOTOSLEEP_THRES>0); +#endif //GP_SCHED_FREE_CPU_TIME + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +#define QVOT_IS_MAC_2015_FRAME(frameControl) (gpMacCore_MacVersion2015 == (MACCORE_FRAMECONTROL_FRAMEVERSION_GET((frameControl)))) +#define QVOT_IS_ACK_FRAME(frameControl) (gpMacCore_FrameTypeAcknowledge == (MACCORE_FRAMECONTROL_FRAMETYPE_GET((frameControl)))) +#define QVOT_ACKED_WITH_FP(frameControl) (MACCORE_FRAMECONTROL_FRAMEPENDING_GET((frameControl))) +#define QVOT_SECURITY_ENABLED(frameControl) (MACCORE_FRAMECONTROL_SECURITY_GET((frameControl))) +#define QVOT_FRAME_GET_FCTRL(psdu) ((uint16_t)(((psdu)[1] << 8) + (psdu)[0])) +#define QVOT_FRAME_GET_PANID(psdu) ((uint16_t)(((psdu)[4] << 8) + (psdu)[3])) + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +static void gpMacDispatcher_cbDataIndication(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, uint8_t dsn, + gpMacCore_Security_t* pSecOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId); +static void gpMacDispatcher_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, uint32_t unscannedChannels, + UInt8 resultListSize, UInt8* pResultList, gpMacCore_StackId_t stackId); +static void gpMacDispatcher_cbDataConfirm(gpMacCore_Result_t status, uint8_t msduHandle, gpMacCore_StackId_t stackId); + +static void gpMacDispatcher_cbDriverResetIndication(gpMacCore_Result_t status, gpMacCore_StackId_t stackId); + +static void gpMacDispatcher_cbSecurityFrameCounterIndication(uint32_t framecounter, gpMacDispatcher_StackId_t stackId); + +gpMacDispatcher_Callbacks_t mac802154_callbacks = { + gpMacDispatcher_cbDataIndication, + gpMacDispatcher_cbDataConfirm, + NULL, // gpMacDispatcher_cbPollIndication, + NULL, // gpMacDispatcher_cbPollConfirm, + NULL, // gpMacDispatcher_cbPurgeConfirm, + NULL, // gpMacDispatcher_cbBeaconNotifyIndication, + gpMacDispatcher_cbScanConfirm, + NULL, // gpMacDispatcher_cbAssocIndication, + NULL, // gpMacDispatcher_cbAssocConfirm, + NULL, // gpMacDispatcher_cbOrphanIndication_t + NULL, // gpMacDispatcher_cbSecurityFailureCommStatusIndication, + NULL, // gpMacDispatcher_cbAssociateCommStatusIndication_t + NULL, // gpMacDispatcher_cbOrphanCommStatusIndication_t + gpMacDispatcher_cbDriverResetIndication, + NULL, // gpMacDispatcher_cbPollNotify, + gpMacDispatcher_cbSecurityFrameCounterIndication +}; + +static gpMacCore_StackId_t qorvoGetStackId(void); +static void qorvoSetStackId(gpMacCore_StackId_t stackId); +static bool qorvoValidStackId(gpMacCore_StackId_t stackId); +static otError qorvoToThreadError(gpMacCore_Result_t res); +static uint8_t qorvoGetFrameCounterIndex(uint8_t* frame); + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static otRadioFrame sReceiveFrame; + +static uint8_t sTransmitPsdu[OT_RADIO_FRAME_MAX_SIZE]; +static uint8_t sReceivePsdu[OT_RADIO_FRAME_MAX_SIZE]; +static otError sTransmitStatus; +static uint32_t sFrameCounter; +static bool sFrameCounterSet; + +#ifdef QVOT_THREAD_1_2 +#define QVOT_THREAD_1_2_ENABLED 1 +#else +#define QVOT_THREAD_1_2_ENABLED 0 +#endif // QVOT_THREAD_1_2 + +#ifdef QVOT_THREAD_1_2 +static bool qorvoDataConfirmReceived; +static bool qorvoDataIndicationReceived; +#endif // QVOT_THREAD_1_2 + +static uint32_t qorvoTimePreviousValue; +static uint32_t qorvoTimeWrapAroundCounter; + +// Storage of MAC settings changed by OT +static MACAddress_t qorvoOriginalExtendedMac; +static MACAddress_t qorvoRadioExtendedMac; +static uint16_t qorvoRadioPanId; +static uint16_t qorvoRadioShortAddress; +static bool qorvoRadioRxOnWhenIdle; + +static uint8_t qorvoScanResult[1]; +static uint8_t qorvoThreadChannel; + +#define OPENTHREAD_STRING_IDENTIFIER OTHR +static gpMacCore_StackId_t openThreadStackId = GP_MAC_DISPATCHER_INVALID_STACK_ID; + + +/***************************************************************************** + * Public Data Definitions + *****************************************************************************/ + +// Accessed from radio.c OpenThread glue +otRadioFrame sTransmitFrame; + + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +gpMacCore_StackId_t qorvoGetStackId(void) +{ + return openThreadStackId; +} + +void qorvoSetStackId(gpMacCore_StackId_t stackId) +{ + openThreadStackId = stackId; +} + +static bool qorvoValidStackId(gpMacCore_StackId_t stackId) +{ + bool result = true; + if(stackId != qorvoGetStackId()) + { + GP_LOG_SYSTEM_PRINTF(LOG_PREFIX "CRIT: stackId %u != qorvoStackId %u", 0, stackId, qorvoGetStackId()); + GP_ASSERT_DEV_INT(0); + result = false; + } + return result; +} + +otError qorvoToThreadError(gpMacCore_Result_t res) +{ + switch(res) + { + case gpMacCore_ResultSuccess: + { + return OT_ERROR_NONE; + break; + } + case gpMacCore_ResultTransactionOverflow: + { + return OT_ERROR_BUSY; + break; + } + case gpMacCore_ResultInvalidParameter: + { + return OT_ERROR_INVALID_ARGS; + break; + } + case gpMacCore_ResultChannelAccessFailure: + { + return OT_ERROR_CHANNEL_ACCESS_FAILURE; + break; + } + case gpMacCore_ResultNoAck: + { + return OT_ERROR_NO_ACK; + break; + } + default: + { + return OT_ERROR_GENERIC; + break; + } + } +} + +static uint8_t qorvoGetFrameCounterIndex(uint8_t* frame) +{ + uint8_t idx = 4; // FrameControl(2) + SequenceNumber(1) + SecurityHeader(1) + + uint16_t frameControl = QVOT_FRAME_GET_FCTRL(frame); + + // if there is a panid it is in bytes 3 and 4 + // we ignore the possibility of a second panid here + if(QVOT_FRAME_GET_PANID(frame) == qorvoRadioPanId) + { + idx += 2; + } + + if (MACCORE_FRAMECONTROL_DSTADDRMODE_GET(frameControl) == gpMacCore_AddressModeShortAddress) + { + idx += 2; + } + else if (MACCORE_FRAMECONTROL_DSTADDRMODE_GET(frameControl) == gpMacCore_AddressModeExtendedAddress) + { + idx += 8; + } + + if (MACCORE_FRAMECONTROL_SRCADDRMODE_GET(frameControl) == gpMacCore_AddressModeShortAddress) + { + idx += 2; + } + else if (MACCORE_FRAMECONTROL_SRCADDRMODE_GET(frameControl) == gpMacCore_AddressModeExtendedAddress) + { + idx += 8; + } + return idx; +} + + +void qorvoRadioCslDisable(void* arg) +{ + NOT_USED(arg); + gpMacDispatcher_DisableRxWindows(qorvoGetStackId()); +} + +/***************************************************************************** + * gpMacDispatcher callbacks + *****************************************************************************/ + +void gpMacDispatcher_cbDataIndication(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, uint8_t dsn, + gpMacCore_Security_t* pSecOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId) +{ + // Note: the cbDataIndication is used for reporting + // * Received data/command frames + // * Received Enhanced Acks + + NOT_USED(pSecOptions); + NOT_USED(pSrcAddrInfo); + NOT_USED(pDstAddrInfo); + NOT_USED(dsn); + + if(!qorvoValidStackId(stackId)) + { + return; + } + + // Copy packet into OT structure + gpPd_ReadByteStream(pdLoh.handle, pdLoh.offset, pdLoh.length, &sReceiveFrame.mPsdu[0]); + + // Frame Control bytes of the received frame + uint16_t fctrlPsdu = (sReceiveFrame.mPsdu[1] << 8) + sReceiveFrame.mPsdu[0]; + + sReceiveFrame.mPsdu[pdLoh.length] = 0x00; // dummy crc byte + sReceiveFrame.mPsdu[pdLoh.length + 1] = 0x00; // dummy crc byte + sReceiveFrame.mLength = pdLoh.length + 2; + sReceiveFrame.mChannel = gpPd_GetRxChannel(pdLoh.handle); + sReceiveFrame.mInfo.mRxInfo.mRssi = gpPd_GetRssi(pdLoh.handle); + sReceiveFrame.mInfo.mRxInfo.mLqi = gpPd_GetLqi(pdLoh.handle); +#ifdef QVOT_THREAD_1_2 + UInt32 rxTs = gpPd_GetRxTimestamp(pdLoh.handle); + sReceiveFrame.mInfo.mRxInfo.mTimestamp = + (uint64_t)rxTs + ((uint64_t)(qorvoTimeWrapAroundCounter + ((rxTs < qorvoTimePreviousValue ? 1 : 0))) << 32); +#else + sReceiveFrame.mInfo.mRxInfo.mTimestamp = (uint64_t)gpPd_GetRxTimestamp(pdLoh.handle); +#endif // QVOT_THREAD_1_2 + +#ifdef QVOT_THREAD_1_2 + uint16_t fctrlAck = 0; +#endif // QVOT_THREAD_1_2 + + if(!QVOT_IS_ACK_FRAME(fctrlPsdu)) + { +#ifdef QVOT_THREAD_1_2 + // Frame Control bytes of the transmitted Ack frame (in response the received pdLoh) + fctrlAck = gpPd_GetFrameControlFromTxAckAfterRx(pdLoh.handle); + + sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending = QVOT_ACKED_WITH_FP(fctrlAck); + sReceiveFrame.mInfo.mRxInfo.mAckedWithSecEnhAck = QVOT_SECURITY_ENABLED(fctrlAck); + sReceiveFrame.mInfo.mRxInfo.mAckFrameCounter = gpPd_GetFrameCounterFromTxAckAfterRx(pdLoh.handle); +#else + sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending = true; + sReceiveFrame.mInfo.mRxInfo.mAckedWithSecEnhAck = false; +#endif // QVOT_THREAD_1_2 + } + + gpPd_FreePd(pdLoh.handle); + + GP_LOG_PRINTF(LOG_PREFIX "cbDataInd: sn:%u ch:%u t:%u fp:%u secAck:%u ts: %llu", 0, + sReceiveFrame.mPsdu[2], + sReceiveFrame.mChannel, + MACCORE_FRAMECONTROL_FRAMETYPE_GET(fctrlPsdu), +#ifdef QVOT_THREAD_1_2 + QVOT_ACKED_WITH_FP((!QVOT_IS_ACK_FRAME(fctrlPsdu)) ? fctrlAck : fctrlPsdu), +#else + false, +#endif // QVOT_THREAD_1_2 + sReceiveFrame.mInfo.mRxInfo.mAckedWithSecEnhAck, + sReceiveFrame.mInfo.mRxInfo.mTimestamp); + +#ifdef QVOT_THREAD_1_2 + bool isEnhancedAckFrame = (QVOT_IS_MAC_2015_FRAME(fctrlPsdu) && QVOT_IS_ACK_FRAME(fctrlPsdu)); + + + if(isEnhancedAckFrame) + { + if(qorvoDataConfirmReceived) + { + cbQorvoRadioTransmitDone_AckFrame(&sTransmitFrame, &sReceiveFrame, sTransmitStatus); + qorvoDataIndicationReceived = false; + qorvoDataConfirmReceived = false; + } + else + { + qorvoDataIndicationReceived = true; + qorvoDataConfirmReceived = false; + } + } + else +#endif // QVOT_THREAD_1_2 + { + cbQorvoRadioReceiveDone(&sReceiveFrame, OT_ERROR_NONE); + } +} + +void gpMacDispatcher_cbDataConfirm(gpMacCore_Result_t status, uint8_t msduHandle, gpMacCore_StackId_t stackId) +{ + if(!qorvoValidStackId(stackId)) + { + return; + } + + // We reuse the value from the DataRequest, which is already written + // in @sTransmitFrame + + sTransmitStatus = qorvoToThreadError(status); + + // Copy the transmitted frame from the Pd to the sTransmitFrame + // But the length of the transmitted frame was already stored in the sTransmitFrame + // when receiving the transmit request + gpPd_ReadByteStream(msduHandle, 0, sTransmitFrame.mLength, sTransmitFrame.mPsdu); + + uint16_t fctrl = QVOT_FRAME_GET_FCTRL(sTransmitFrame.mPsdu); + + if(!sTransmitFrame.mInfo.mTxInfo.mIsHeaderUpdated) + { + // if mIsHeaderUpdated was already `1`, then OpenThread handled the frameCounter and IEs already + // We don't need to update frameCounter nor this flag + + if(sFrameCounterSet) + { + // The frame counter as written by RT is not in the gpPd. We can only extract + // it through cbSecurityFrameCounterIndication (which set @sFrameCounterSet). + // sTransmitFrame still needs to be updated + uint8_t fc_idx = qorvoGetFrameCounterIndex(sTransmitFrame.mPsdu); + MEMCPY(&sTransmitFrame.mPsdu[fc_idx], &sFrameCounter, sizeof(sFrameCounter)); + sFrameCounterSet = false; + sTransmitFrame.mInfo.mTxInfo.mIsHeaderUpdated = true; + } + if(MACCORE_FRAMECONTROL_IE_PRESENT_GET(fctrl)) + { + // IEs are present, but not set by OpenThread, so we updated the Header + sTransmitFrame.mInfo.mTxInfo.mIsHeaderUpdated = true; + } + } + + GP_LOG_PRINTF(LOG_PREFIX "cbDataCfm: sn:%u res:%x l:%u ch:%u rtx: %u", 0, + gpPd_ReadByte(msduHandle, 2), + status, + sTransmitFrame.mLength, + sTransmitFrame.mChannel, + gpPd_GetTxRetryCntr(msduHandle)); + +#ifdef QVOT_THREAD_1_2 + if (QVOT_IS_MAC_2015_FRAME(fctrl)) + { + if(qorvoDataIndicationReceived) + { + cbQorvoRadioTransmitDone_AckFrame(&sTransmitFrame, &sReceiveFrame, sTransmitStatus); + qorvoDataConfirmReceived = false; + qorvoDataIndicationReceived = false; + } + else if(status != gpMacCore_ResultSuccess) + { + // Transmission failed, we don't expect the ack anymore + cbQorvoRadioTransmitDone_AckFrame(&sTransmitFrame, &sReceiveFrame, sTransmitStatus); + qorvoDataConfirmReceived = false; + qorvoDataIndicationReceived = false; + } + else + { + qorvoDataConfirmReceived = true; + qorvoDataIndicationReceived = false; + } + } + else +#endif // QVOT_THREAD_1_2 + { + bool aFramePending = true; + uint8_t fp; + + fp = gpPd_GetFramePendingAfterTx(msduHandle); + /* use the fp value unless it's invalid (0xff), then use 'true' */ + aFramePending = (fp == 0xff) ? true : (fp == 1); + + cbQorvoRadioTransmitDone(&sTransmitFrame, aFramePending, sTransmitStatus); + } + gpPd_FreePd(msduHandle); +} + +void gpMacDispatcher_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, uint32_t unscannedChannels, + uint8_t resultListSize, uint8_t* pResultList, gpMacCore_StackId_t stackId) +{ + NOT_USED(status); + NOT_USED(scanType); + NOT_USED(unscannedChannels); + NOT_USED(resultListSize); + NOT_USED(pResultList); + + if(!qorvoValidStackId(stackId)) + { + return; + } + + int8_t aEnergyScanMaxRssi = ((uint8_t*)pResultList)[0]; + + cbQorvoRadioEnergyScanDone(aEnergyScanMaxRssi); +} + +void gpMacDispatcher_cbDriverResetIndication(gpMacCore_Result_t status, gpMacCore_StackId_t stackId) +{ + NOT_USED(status); + + if(!qorvoValidStackId(stackId)) + { + return; + } + + gpMacDispatcher_StringIdentifier_t openThreadStringId = {{XSTRINGIFY(OPENTHREAD_STRING_IDENTIFIER)}}; + + //register NWK layer to MAC layer + qorvoSetStackId(gpMacDispatcher_RegisterNetworkStack(&openThreadStringId)); + gpMacDispatcher_RegisterCallbacks(qorvoGetStackId(), &mac802154_callbacks); + + qorvoRadioReset(); + gpMacDispatcher_SetRxOnWhenIdle(qorvoRadioRxOnWhenIdle, qorvoGetStackId()); + gpMacDispatcher_SetExtendedAddress(&qorvoRadioExtendedMac, qorvoGetStackId()); + gpMacDispatcher_SetShortAddress(qorvoRadioShortAddress, qorvoGetStackId()); + gpMacDispatcher_SetPanId(qorvoRadioPanId, qorvoGetStackId()); +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void qorvoRadioReset(void) +{ + gpMacDispatcher_Reset(true, qorvoGetStackId()); + gpMacDispatcher_SetDataPendingMode(gpMacCore_DataPendingModeMac802154, qorvoGetStackId()); + + GP_LOG_PRINTF(LOG_PREFIX "otst=%d bl=%x", 0, qorvoGetStackId(), 0xFF); + gpMacDispatcher_SetStackInRawMode(1, qorvoGetStackId()); + + gpMacDispatcher_SetRetransmitOnCcaFail(QVOT_THREAD_1_2_ENABLED, qorvoGetStackId()); + gpMacDispatcher_SetRetransmitRandomBackoff(QVOT_THREAD_1_2_ENABLED, qorvoGetStackId()); + gpMacDispatcher_EnableEnhancedFramePending(QVOT_THREAD_1_2_ENABLED, qorvoGetStackId()); + + gpMacDispatcher_SetTransactionPersistenceTime(0, qorvoGetStackId()); + gpMacDispatcher_SetMacVersion(gpMacCore_MacVersion2006, qorvoGetStackId()); + +#ifdef QVOT_THREAD_1_2 + qorvoTimePreviousValue = gpMacDispatcher_GetCurrentTimeUs(); + qorvoTimeWrapAroundCounter = 0; +#endif // QVOT_THREAD_1_2 + qorvoThreadChannel = GP_MACCORE_INVALID_CHANNEL; + +} + +void qorvoRadioInit(void) +{ + gpMacDispatcher_StringIdentifier_t openThreadStringId = {{XSTRINGIFY(OPENTHREAD_STRING_IDENTIFIER)}}; + + sTransmitFrame.mLength = 0; + sTransmitFrame.mPsdu = sTransmitPsdu; + sReceiveFrame.mLength = 0; + sReceiveFrame.mPsdu = sReceivePsdu; + + //register NWK layer to MAC layer + qorvoSetStackId(gpMacDispatcher_RegisterNetworkStack(&openThreadStringId)); + gpMacDispatcher_RegisterCallbacks(qorvoGetStackId(), &mac802154_callbacks); + + qorvoRadioReset(); + + // Save initial IEEE MAC address + gpMacDispatcher_GetExtendedAddress(&qorvoOriginalExtendedMac, qorvoGetStackId()); + MEMCPY(&qorvoRadioExtendedMac, &qorvoOriginalExtendedMac, sizeof(MACAddress_t)); + qorvoRadioShortAddress = GP_MACCORE_SHORT_ADDR_UNALLOCATED; + qorvoRadioPanId = GP_MACCORE_SHORT_ADDR_UNALLOCATED; + + // Set sleep behavior + gpSched_SetGotoSleepEnable(true); + +} + +otError qorvoRadioTransmit(otRadioFrame* aFrame) +{ + uint8_t offset = 0; + gpPd_Loh_t pdLoh; + gpMacCore_Security_t secOptions; + gpMacCore_MultiChannelOptions_t multiChannelOptions; + gpMacCore_AddressMode_t srcAddrMode; + gpMacCore_AddressInfo_t dstAddrInfo; + uint8_t txOptions = GP_MACCORE_TX_OPT_NONE; + + pdLoh.handle = gpPd_GetPd(); + if(pdLoh.handle == GP_PD_INVALID_HANDLE) + { + GP_LOG_SYSTEM_PRINTF(LOG_PREFIX "WARN: no more pd handles!", 0); + return OT_ERROR_NO_BUFS; + } + + pdLoh.length = aFrame->mLength - offset; + pdLoh.length -= 2; // drop the 2 crc bytes + + pdLoh.offset = 0; + gpPd_WriteByteStream(pdLoh.handle, pdLoh.offset, pdLoh.length, aFrame->mPsdu + offset); + + if (aFrame->mChannel < 11 || aFrame->mChannel > 26) + { + GP_ASSERT_DEV_INT(aFrame->mChannel >= 11); + GP_ASSERT_DEV_INT(aFrame->mChannel <= 26); + return OT_ERROR_INVALID_ARGS; + } + multiChannelOptions.channel[0] = aFrame->mChannel; + multiChannelOptions.channel[1] = GP_MACCORE_INVALID_CHANNEL; + multiChannelOptions.channel[2] = GP_MACCORE_INVALID_CHANNEL; + + MEMSET(&secOptions, 0, sizeof(gpMacCore_Security_t)); + + uint16_t fctrl = QVOT_FRAME_GET_FCTRL(aFrame->mPsdu); + srcAddrMode = MACCORE_FRAMECONTROL_SRCADDRMODE_GET(fctrl); + dstAddrInfo.addressMode = MACCORE_FRAMECONTROL_DSTADDRMODE_GET(fctrl); + + // Handle mIsSecurityProcessed + if(QVOT_SECURITY_ENABLED(fctrl) && !aFrame->mInfo.mTxInfo.mIsSecurityProcessed) + { + secOptions.securityLevel = gpEncryption_SecLevelENC_MIC32; + } + else + { + // No absolute need to set it, the memset took care or this, but it's clearer + secOptions.securityLevel = gpEncryption_SecLevelNothing; + } + + // Set the Raw option for the frame + txOptions |= GP_MACCORE_TX_OPT_RAW; + + gpMacDispatcher_SetNumberOfRetries(aFrame->mInfo.mTxInfo.mMaxFrameRetries, qorvoGetStackId()); + + // handle delayed tx + if(aFrame->mInfo.mTxInfo.mTxDelayBaseTime) + { + txOptions |= GP_MACCORE_TX_OPT_TIMEDTX; + gpMacDispatcher_SetCsmaMode(gpHal_CollisionAvoidanceModeNoCCA, qorvoGetStackId()); + } + + // Handle mIsCsmaCaEnable (CsmaCa is incompatible with timed tx) + else if(aFrame->mInfo.mTxInfo.mCsmaCaEnabled) + { + gpMacDispatcher_SetMaxCsmaBackoffs(aFrame->mInfo.mTxInfo.mMaxCsmaBackoffs, qorvoGetStackId()); + } + + GP_LOG_PRINTF(LOG_PREFIX "DataReq: sn:%u fctrl:%04x l:%u csma:%u csl:%u sec:%u|%u hdrU:%u retr:%u bT:%lu dt:%lu", 0, + aFrame->mPsdu[2], + fctrl, + aFrame->mLength, + aFrame->mInfo.mTxInfo.mCsmaCaEnabled, + aFrame->mInfo.mTxInfo.mCslPresent, + aFrame->mInfo.mTxInfo.mIsSecurityProcessed, + QVOT_SECURITY_ENABLED(fctrl), + aFrame->mInfo.mTxInfo.mIsHeaderUpdated, + aFrame->mInfo.mTxInfo.mMaxFrameRetries, + (unsigned long)aFrame->mInfo.mTxInfo.mTxDelayBaseTime, + (unsigned long)aFrame->mInfo.mTxInfo.mTxDelay); + + // Handle mIsHeaderUpdated + if(aFrame->mInfo.mTxInfo.mIsHeaderUpdated) + { + // OpenThread has set the CSL IEs and/or FrameCounter, + // MacCore/RT should not update those anymore + txOptions |= GP_MACCORE_TX_OPT_RAW_KEEP_FRAMECOUNTER; + } + + // Reset FrameCounter, will be set by the cbFrameCounterIndication + sFrameCounterSet = false; + + gpMacDispatcher_DataRequest(srcAddrMode, &dstAddrInfo, txOptions, &secOptions, multiChannelOptions, pdLoh, qorvoGetStackId()); + + if(aFrame->mInfo.mTxInfo.mTxDelayBaseTime) + { + gpMacCore_Result_t result = gpMacCore_ResultSuccess; + gpMacDispatcher_SetCsmaMode(gpHal_CollisionAvoidanceModeCSMA, qorvoGetStackId()); + gpMacCore_TxTimingOptions_t timingOptions = { + .txTimestamp = aFrame->mInfo.mTxInfo.mTxDelayBaseTime + aFrame->mInfo.mTxInfo.mTxDelay + }; + + result = gpMacDispatcher_ScheduleTimedTx(pdLoh.handle, timingOptions, qorvoGetStackId()); + return qorvoToThreadError(result); + } + + sTransmitFrame.mLength = aFrame->mLength; + return OT_ERROR_NONE; +} + +void gpMacDispatcher_cbSecurityFrameCounterIndication(uint32_t frameCounter, gpMacDispatcher_StackId_t stackId) +{ + if(!qorvoValidStackId(stackId)) + { + return; + } + sFrameCounter = frameCounter; + sFrameCounterSet = true; +} + +void qorvoRadioProcess(void) +{ +} + +void qorvoRadioGetIeeeEui64(uint8_t* aIeeeEui64) +{ + for(uint8_t i = 0; i < OT_EXT_ADDRESS_SIZE; i++) + { + aIeeeEui64[i] = ((uint8_t*)(&qorvoOriginalExtendedMac))[7 - i]; + } + GP_LOG_PRINTF(LOG_PREFIX "otPlatRadioGetIeeeEui64 = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", 0, + aIeeeEui64[0], aIeeeEui64[1], aIeeeEui64[2], aIeeeEui64[3], + aIeeeEui64[4], aIeeeEui64[5], aIeeeEui64[6], aIeeeEui64[7]); +} + +void qorvoRadioSetCurrentChannel(uint8_t channel) +{ + if (qorvoThreadChannel == GP_MACCORE_INVALID_CHANNEL) + { + // No Thread channel known, accept channel + GP_LOG_PRINTF(LOG_PREFIX "initiate channel to %u", 0, channel); + gpMacDispatcher_SetCurrentChannel(channel, qorvoGetStackId()); + qorvoThreadChannel = channel; + } + else if (qorvoThreadChannel != gpMacDispatcher_GetCurrentChannel(qorvoGetStackId())) + { + // We assume CSL is ongoing, so we store the new channel, but do not switch + qorvoThreadChannel = channel; + GP_LOG_PRINTF(LOG_PREFIX "update thread channel to %u, working on csl channel %u", 0, channel, gpMacDispatcher_GetCurrentChannel(qorvoGetStackId())); + } + else if (qorvoThreadChannel != channel) + { + GP_LOG_PRINTF(LOG_PREFIX "update channel to %u", 0, channel); + gpMacDispatcher_SetCurrentChannel(channel, qorvoGetStackId()); + qorvoThreadChannel = channel; + } + else + { + // Channel doesn't change + } +} + +void qorvoRadioSetRxOnWhenIdle(bool rxOnWhenIdle) +{ + qorvoRadioRxOnWhenIdle = rxOnWhenIdle; + // GP_LOG_PRINTF(LOG_PREFIX "RxOnWhenIdle: %u", 0, rxOnWhenIdle); + gpMacDispatcher_SetRxOnWhenIdle(rxOnWhenIdle, qorvoGetStackId()); +} + +void qorvoRadioSetPanId(uint16_t panid) +{ + GP_LOG_PRINTF(LOG_PREFIX "SetPanId: 0x%04x", 0, panid); + qorvoRadioPanId = panid; + gpMacDispatcher_SetPanId(panid, qorvoGetStackId()); +} + +void qorvoRadioSetExtendedAddress(const uint8_t* address) +{ + MEMCPY(&qorvoRadioExtendedMac, address, sizeof(MACAddress_t)); + GP_LOG_PRINTF(LOG_PREFIX "SetExtendedAddress: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", 0, + address[0], address[1], address[2], address[3], + address[4], address[5], address[6], address[7]); + gpMacDispatcher_SetExtendedAddress(&qorvoRadioExtendedMac, qorvoGetStackId()); +} + +void qorvoRadioSetShortAddress(uint16_t address) +{ + GP_LOG_PRINTF(LOG_PREFIX "SetShortAddress: 0x%04x", 0, address); + qorvoRadioShortAddress = address; + gpMacDispatcher_SetShortAddress(address, qorvoGetStackId()); +} + +void qorvoRadioEnableSrcMatch(bool aEnable) +{ + // We are already in gpMacCore_DataPendingModeMac802154, no need to change it +} + +otError qorvoRadioAddSrcMatchShortEntry(const uint16_t aShortAddress, uint16_t panid) +{ + gpMacCore_Result_t res = gpMacCore_ResultSuccess; + gpMacCore_AddressInfo_t addrInfo; + + addrInfo.addressMode = gpMacCore_AddressModeShortAddress; + addrInfo.panId = panid; + addrInfo.address.Short = aShortAddress; + + res = gpMacDispatcher_DataPending_QueueAdd(&addrInfo, qorvoGetStackId()); + GP_LOG_PRINTF(LOG_PREFIX "Add SrcMatchEntry (res: %u): panid: %04x, addr: %04x", 0, + res, panid, aShortAddress); + return qorvoToThreadError(res); +} + +otError qorvoRadioAddSrcMatchExtEntry(const uint8_t* aExtAddress, uint16_t panid) +{ + gpMacCore_Result_t res = gpMacCore_ResultSuccess; + gpMacCore_AddressInfo_t addrInfo; + + addrInfo.addressMode = gpMacCore_AddressModeExtendedAddress; + addrInfo.panId = panid; + MEMCPY(&addrInfo.address.Extended, aExtAddress, sizeof(MACAddress_t)); + + res = gpMacDispatcher_DataPending_QueueAdd(&addrInfo, qorvoGetStackId()); + GP_LOG_PRINTF(LOG_PREFIX "Add SrcMatchEntry (res: %u): panid: %04x, addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", 0, + res, panid, + aExtAddress[0], aExtAddress[1], aExtAddress[2], aExtAddress[3], + aExtAddress[4], aExtAddress[5], aExtAddress[6], aExtAddress[7]); + return qorvoToThreadError(res); +} + +otError qorvoRadioClearSrcMatchShortEntry(const uint16_t aShortAddress, uint16_t panid) +{ + gpMacCore_Result_t res = gpMacCore_ResultSuccess; + gpMacCore_AddressInfo_t addrInfo; + + addrInfo.addressMode = gpMacCore_AddressModeShortAddress; + addrInfo.panId = panid; + addrInfo.address.Short = aShortAddress; + + res = gpMacDispatcher_DataPending_QueueRemove(&addrInfo, qorvoGetStackId()); + GP_LOG_PRINTF(LOG_PREFIX "Del SrcMatchEntry (res: %u): panid: %04x, addr: %04x", 0, + res, panid, aShortAddress); + return qorvoToThreadError(res); +} + +otError qorvoRadioClearSrcMatchExtEntry(const uint8_t* aExtAddress, uint16_t panid) +{ + gpMacCore_Result_t res = gpMacCore_ResultSuccess; + gpMacCore_AddressInfo_t addrInfo; + + addrInfo.addressMode = gpMacCore_AddressModeExtendedAddress; + addrInfo.panId = panid; + MEMCPY(&addrInfo.address.Extended, aExtAddress, sizeof(MACAddress_t)); + + res = gpMacDispatcher_DataPending_QueueRemove(&addrInfo, qorvoGetStackId()); + GP_LOG_PRINTF(LOG_PREFIX "Del SrcMatchEntry (res: %u): panid: %04x, addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", 0, + res, panid, + aExtAddress[0], aExtAddress[1], aExtAddress[2], aExtAddress[3], + aExtAddress[4], aExtAddress[5], aExtAddress[6], aExtAddress[7]); + return qorvoToThreadError(res); +} + +void qorvoRadioClearSrcMatchEntries(void) +{ + /* clear both short and extended addresses here */ + GP_LOG_PRINTF(LOG_PREFIX "Clear all SrcMatchEntries", 0); + gpMacDispatcher_DataPending_QueueClear(qorvoGetStackId()); +} + +otError qorvoRadioGetTransmitPower(int8_t* aPower) +{ + uint8_t channel = gpMacDispatcher_GetCurrentChannel(qorvoGetStackId()); + if(channel == GP_MACCORE_INVALID_CHANNEL) + { + return OT_ERROR_INVALID_STATE; + } + *aPower = gpMacDispatcher_GetTransmitPower(qorvoGetStackId()); + return OT_ERROR_NONE; +} + +otError qorvoRadioSetTransmitPower(int8_t aPower) +{ + uint8_t channel = gpMacDispatcher_GetCurrentChannel(qorvoGetStackId()); + if(channel == GP_MACCORE_INVALID_CHANNEL) + { + return OT_ERROR_INVALID_STATE; + } + gpMacDispatcher_SetTransmitPower(aPower, qorvoGetStackId()); + return OT_ERROR_NONE; +} + +otError qorvoRadioEnergyScan(uint8_t aScanChannel, uint16_t aScanDuration) +{ + uint32_t scanChannels = 1 << aScanChannel; + uint8_t scanDuration = 0; + uint32_t durationInUs = (((uint32_t)GP_MACCORE_BASE_SUPERFRAME_DURATION * ((uint32_t)(((uint16_t)1) << scanDuration) + 1)) * GP_MACCORE_SYMBOL_DURATION); + uint8_t resultListSize = 1; + uint8_t* pResultList = qorvoScanResult; + + GP_ASSERT_DEV_INT(scanDuration < 16); + + while((durationInUs < ((uint32_t)aScanDuration * 1000)) && (scanDuration < 15)) + { + scanDuration++; + durationInUs = (((uint32_t)GP_MACCORE_BASE_SUPERFRAME_DURATION * ((uint32_t)(((uint16_t)1) << scanDuration) + 1)) * GP_MACCORE_SYMBOL_DURATION); + } + + gpMacDispatcher_ScanRequest(gpMacCore_ScanTypeED, scanChannels, scanDuration, resultListSize, pResultList, qorvoGetStackId()); + + return OT_ERROR_NONE; +} + +bool qorvoRadioGetPromiscuous(void) +{ + return gpMacDispatcher_GetPromiscuousMode(qorvoGetStackId()); +} + +void qorvoRadioSetPromiscuous(bool aEnable) +{ + gpMacDispatcher_SetPromiscuousMode(aEnable, qorvoGetStackId()); +} + +void qorvoRadioSetMacKey(uint8_t aKeyIdMode, + uint8_t aKeyId, + const uint8_t *aPrevKey, + const uint8_t *aCurrKey, + const uint8_t *aNextKey, + uint8_t aKeyType) +{ + NOT_USED(aPrevKey); + NOT_USED(aNextKey); + if((aKeyType != OT_KEY_TYPE_LITERAL_KEY) || (aCurrKey == NULL)) + { + // We cannot set the new Current Key, and we cannot communicate the failure + GP_LOG_SYSTEM_PRINTF(LOG_PREFIX "CRIT: Key not set properly", 0); + GP_ASSERT_DEV_INT(aKeyType == OT_KEY_TYPE_LITERAL_KEY); // Requires literal key + GP_ASSERT_DEV_INT(aCurrKey != NULL); // key needs to be valid + return; + } + + UInt8 keyIdMode = MACCORE_SECCONTROL_KEYIDMODE_GET(aKeyIdMode); // The value obtained from OT is as read from the framecontrol byte + gpMacDispatcher_SetRawModeEncryptionKeys(keyIdMode, aKeyId, (UInt8*)aCurrKey, qorvoGetStackId()); +} + +uint64_t qorvoRadioGetNow(void) +{ + uint32_t newValue = gpMacDispatcher_GetCurrentTimeUs(); + if (newValue < qorvoTimePreviousValue) + { + qorvoTimeWrapAroundCounter++; + } + qorvoTimePreviousValue = newValue; + uint64_t time = ((uint64_t)qorvoTimeWrapAroundCounter << 32) + newValue; + GP_LOG_PRINTF(LOG_PREFIX "qorvoRadioGetNow: %llu", 0, time); + return time; +} + +otError qorvoRadioReceiveAt(uint8_t aChannel, uint32_t aStart, uint32_t aDuration) +{ + if ((qorvoThreadChannel != GP_MACCORE_INVALID_CHANNEL) && (aChannel != qorvoThreadChannel)) + { + GP_LOG_PRINTF(LOG_PREFIX "Switch to CSL channel: %u", 0, aChannel); + gpMacDispatcher_SetCurrentChannel(aChannel, qorvoGetStackId()); + } + GP_LOG_PRINTF(LOG_PREFIX "rx wd: start at %lu, for %lu us on ch:%u", 0, (unsigned long)aStart, (unsigned long)aDuration, aChannel); + // Note the processing delay is the number of us that has to be destracted from the window start time, so the window + // opens at the expected moment. This is, logically, depending on the amount of calculations/printing that happens between + // the call to `Get().ReceiveAt()` and the call to `gpMacDispatcher_EnableRxWindows()`. A call to + // `gpMacDispatcher_GetCurrentTimeUs` and printing the result takes ~130us. + // The amount of time between _now_ and the opening of the window is dominated by `OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE`. + // With a default value of 320us, the opening of the window lies already in the past, the moment we get _here_. When the value + // exceeds 1250 the calculation of `start` ends up negative. + + uint32_t now = gpMacDispatcher_GetCurrentTimeUs(); + uint32_t diff = (aStart > now) ? aStart - now : 0; + gpMacDispatcher_EnableRxWindows(aDuration + diff, aDuration + diff, 0, now, qorvoGetStackId()); + + // Schedule the disabling of Csl, otherwise, the radio remains in Dutycycle state after + // all instances of EnableRxWindows have been executed + int32_t t_disable = aStart - now + aDuration; + uint32_t end = (t_disable < 0) ? 0 : (uint32_t)t_disable; + gpSched_ScheduleEventInSecAndUs(end / 1000000, end % 1000000, (gpSched_EventCallback_t)qorvoRadioCslDisable, NULL); + GP_LOG_PRINTF(LOG_PREFIX "now: %lu, wd_s: %lu, dt %li: wd: ->[ %lu ; %lu ]", 0, + (unsigned long)now, (unsigned long)aStart, (signed long)aStart - now, + (unsigned long)diff, (unsigned long)end); + + return OT_ERROR_NONE; +} + + +void qorvoRadioSetMacFrameCounter(uint32_t aMacFrameCounter) +{ + GP_LOG_PRINTF(LOG_PREFIX "set frame counter: %lu", 0, (unsigned long)aMacFrameCounter); + gpMacDispatcher_SetFrameCounter(aMacFrameCounter, qorvoGetStackId()); +} + +otError qorvoRadioEnableCsl(uint32_t aCslPeriod, + uint16_t aShortAddr, + const uint8_t *aExtAddr) +{ + NOT_USED(aShortAddr); + NOT_USED(aExtAddr); + // Note: This function enables/disables the CSL receiver on this device. + // It also provides the long and short address of its CSL peer + if (aCslPeriod) + { + GP_LOG_PRINTF(LOG_PREFIX "enable CSL for neighbour device 0x%04X, period: %lu", 0, aShortAddr, (unsigned long)aCslPeriod); + + } + else + { + GP_LOG_PRINTF(LOG_PREFIX "disable CSL for neighbour device 0x%04X", 0, aShortAddr); + // Leave the CSL channel, go back to the Thread Channel + gpMacDispatcher_SetCurrentChannel(qorvoThreadChannel, qorvoGetStackId()); + } + gpMacDispatcher_EnableCsl(aCslPeriod, qorvoGetStackId()); + return OT_ERROR_NONE; +} + +void qorvoRadioUpdateCslSampleTime(uint32_t aCslSampleTime) +{ + GP_LOG_PRINTF(LOG_PREFIX "update CSL sample time: %lu", 0, (unsigned long)aCslSampleTime); + gpMacDispatcher_UpdateCslSampleTime(aCslSampleTime, qorvoGetStackId()); +} + +otError qorvoRadioConfigureEnhAckProbing(otLinkMetrics aLinkMetrics, + uint16_t aShortAddress, + const uint8_t *aExtAddress) +{ +#ifndef QVOT_THREAD_1_2 + NOT_USED(aLinkMetrics); + NOT_USED(aShortAddress); + NOT_USED(aExtAddress); + return OT_ERROR_NOT_IMPLEMENTED; +#else + if (aExtAddress == NULL) + { + GP_LOG_PRINTF(LOG_PREFIX "WARN: Invalid extended address", 0); + return OT_ERROR_INVALID_ARGS; + } + + gpMacCore_Result_t res; + + MACAddress_t extendedAddress; + MEMCPY(&extendedAddress, aExtAddress, sizeof(MACAddress_t)); + + uint8_t link_metrics = 0; + if(aLinkMetrics.mPduCount) + { + BIT_SET(link_metrics, 0); + } + if(aLinkMetrics.mLqi) + { + BIT_SET(link_metrics, 1); + } + if(aLinkMetrics.mLinkMargin) + { + BIT_SET(link_metrics, 2); + } + if(aLinkMetrics.mRssi) + { + BIT_SET(link_metrics, 3); + } + + res = gpMacDispatcher_ConfigureEnhAckProbing(link_metrics, &extendedAddress, (uint16_t)aShortAddress, qorvoGetStackId()); +#ifdef GP_LOCAL_LOG + uint8_t* a = (uint8_t*)aExtAddress; + if (res == gpMacCore_ResultSuccess) + { + GP_LOG_PRINTF(LOG_PREFIX "link metrics %02x configuration for 0x%04x | %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x succeeded", 0, + link_metrics, aShortAddress, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]); + } + else + { + GP_LOG_PRINTF(LOG_PREFIX "link metrics %02x configuration for 0x%04x | %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x failed: 0x%02x", 0, + link_metrics, aShortAddress, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], res); + } +#endif // GP_LOCAL_LOG + return qorvoToThreadError(res); +#endif // QVOT_THREAD_1_2 +} + +otRadioCaps qorvoRadioGetCaps(void) +{ + otRadioCaps caps = OT_RADIO_CAPS_NONE; ///< Radio supports no capability. + caps |= OT_RADIO_CAPS_ACK_TIMEOUT; ///< Radio supports AckTime event. + caps |= OT_RADIO_CAPS_TRANSMIT_RETRIES; ///< Radio supports tx retry logic with collision avoidance (CSMA). + caps |= OT_RADIO_CAPS_CSMA_BACKOFF; ///< Radio supports CSMA backoff for frame transmission (but no retry). + caps |= OT_RADIO_CAPS_ENERGY_SCAN; ///< Radio supports Energy Scans. + caps |= OT_RADIO_CAPS_TRANSMIT_SEC; ///< Radio supports tx security. + caps |= OT_RADIO_CAPS_TRANSMIT_TIMING; ///< Radio supports tx at specific time. + caps |= OT_RADIO_CAPS_RECEIVE_TIMING; ///< Radio supports rx at specific time. + + return caps; +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c new file mode 100644 index 0000000..26b77cb --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Applications/P959_OpenThread/qvOT/src/uart_rpi_qorvo.c @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * uart_rpi_qorvo.c + * This file contains the implementation of the qorvo uart api for openthread. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_QVOT + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "platform_qorvo.h" +#include "uart_qorvo.h" +#include "gpLog.h" +#include "hal.h" + +#include +#include +#include + +#include +#include + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void qorvoUartLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list args) +{ + NOT_USED(aLogLevel); + NOT_USED(aLogRegion); + + char logString[512]; + + vsnprintf(&logString[0], sizeof(logString), aFormat, args); + + GP_LOG_SYSTEM_PRINTF("%s", 0, logString); + gpLog_Flush(); +} + +void myPlatLog(const char *aFormat, ...) +{ + va_list args; + + va_start(args, aFormat); + qorvoUartLog(OT_LOG_LEVEL_CRIT, OT_LOG_REGION_PLATFORM, aFormat, args); + va_end(args); +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen/gpMacCore_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen/gpMacCore_marshalling.h new file mode 100644 index 0000000..a5db090 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen/gpMacCore_marshalling.h @@ -0,0 +1,2660 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPMACCORE_MARSHALLING_H_ +#define _GPMACCORE_MARSHALLING_H_ + +//DOCUMENTATION MACCORE: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpMacCore.h" +/* AdditionalIncludes */ +#include "gpPd_marshalling.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpMacCore_DeviceDescriptor_t data[1]; +} gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeyUsageDescriptor_t data[1]; +} gpMacCore_KeyUsageDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeyDeviceDescriptor_t data[1]; +} gpMacCore_KeyDeviceDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_Security_t data[1]; +} gpMacCore_Security_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_AddressInfo_t data[1]; +} gpMacCore_AddressInfo_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_PanDescriptor_t data[1]; +} gpMacCore_PanDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeyIdLookupDescriptor_t data[1]; +} gpMacCore_KeyIdLookupDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeyDescriptor_t data[1]; +} gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_SecurityLevelDescriptor_t data[1]; +} gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_MultiChannelOptions_t data[1]; +} gpMacCore_MultiChannelOptions_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_TxTimingOptions_t data[1]; +} gpMacCore_TxTimingOptions_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_DiagRxCntr_t data[1]; +} gpMacCore_DiagRxCntr_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_DiagTxCntr_t data[1]; +} gpMacCore_DiagTxCntr_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_Address_t data[1]; +} gpMacCore_Address_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacCore_KeySource_t data[1]; +} gpMacCore_KeySource_t_l1_pointer_marshall_t; + + +typedef union { + UInt16 Short; + MACAddress_t Extended; +} gpMacCore_Address_t_marshall_t; + +typedef union { + UInt8 pKeySource4; + UInt8 pKeySource8; +} gpMacCore_KeySource_t_marshall_t; + +typedef struct { + Bool setDefaultPib; + gpMacCore_StackId_t stackId; +} gpMacCore_Reset_Input_struct_t; + +typedef struct { + gpMacCore_Reset_Input_struct_t data; +} gpMacCore_Reset_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_Reset_Output_struct_t; + +typedef struct { + gpMacCore_Reset_Output_struct_t data; +} gpMacCore_Reset_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressMode_t srcAddrMode; + gpMacCore_AddressInfo_t* pDstAddressInfo; + UInt8 txOptions; + gpMacCore_Security_t* pSecOptions; + gpMacCore_MultiChannelOptions_t multiChannelOptions; + gpPd_Loh_t pdLoh; + gpMacCore_StackId_t stackId; +} gpMacCore_DataRequest_Input_struct_t; + +typedef struct { + gpMacCore_DataRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; + gpMacCore_MultiChannelOptions_t_l1_pointer_marshall_t multiChannelOptions; + gpPd_Loh_t_l1_pointer_marshall_t pdLoh; +} gpMacCore_DataRequest_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_ScanType_t scanType; + UInt32 scanChannels; + UInt8 scanDuration; + UInt8 resultListSize; + UInt8* pEdScanResultList; + gpMacCore_StackId_t stackId; +} gpMacCore_ScanRequest_Input_struct_t; + +typedef struct { + gpMacCore_ScanRequest_Input_struct_t data; +} gpMacCore_ScanRequest_Input_marshall_struct_t; + + +typedef struct { + UInt8 logicalChannel; + gpMacCore_AddressInfo_t* coordAddrInfo; + UInt8 capabilityInformation; + gpMacCore_StackId_t stackId; +} gpMacCore_AssociateRequest_Input_struct_t; + +typedef struct { + gpMacCore_AssociateRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; +} gpMacCore_AssociateRequest_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pDeviceAddress; + UInt16 associateShortAddress; + gpMacCore_Result_t status; + gpMacCore_StackId_t stackId; +} gpMacCore_AssociateResponse_Input_struct_t; + +typedef struct { + gpMacCore_AssociateResponse_Input_struct_t data; + MACAddress_t pDeviceAddress[1]; +} gpMacCore_AssociateResponse_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* coordAddrInfo; + gpMacCore_Security_t* pSecOptions; + gpMacCore_StackId_t stackId; +} gpMacCore_PollRequest_Input_struct_t; + +typedef struct { + gpMacCore_PollRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; +} gpMacCore_PollRequest_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_PanId_t panId; + UInt8 logicalChannel; + Bool panCoordinator; + gpMacCore_StackId_t stackId; +} gpMacCore_Start_Input_struct_t; + +typedef struct { + gpMacCore_Start_Input_struct_t data; +} gpMacCore_Start_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_Start_Output_struct_t; + +typedef struct { + gpMacCore_Start_Output_struct_t data; +} gpMacCore_Start_Output_marshall_struct_t; + + +typedef struct { + Bool securityEnabled; + gpMacCore_StackId_t stackId; +} gpMacCore_SetSecurityEnabled_Input_struct_t; + +typedef struct { + gpMacCore_SetSecurityEnabled_Input_struct_t data; +} gpMacCore_SetSecurityEnabled_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceDescriptor_t* pDeviceDescriptor; + gpMacCore_Index_t index; +} gpMacCore_SetDeviceDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_SetDeviceDescriptor_Input_struct_t data; + gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t pDeviceDescriptor; +} gpMacCore_SetDeviceDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetDeviceDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_SetDeviceDescriptor_Output_struct_t data; +} gpMacCore_SetDeviceDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; +} gpMacCore_GetDeviceDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_GetDeviceDescriptor_Input_struct_t data; +} gpMacCore_GetDeviceDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_DeviceDescriptor_t* pDeviceDescriptor; +} gpMacCore_GetDeviceDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_GetDeviceDescriptor_Output_struct_t data; + gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t pDeviceDescriptor; +} gpMacCore_GetDeviceDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceTablesEntries_t deviceTableEntries; +} gpMacCore_SetDeviceTableEntries_Input_struct_t; + +typedef struct { + gpMacCore_SetDeviceTableEntries_Input_struct_t data; +} gpMacCore_SetDeviceTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceTablesEntries_t deviceTableEntries; +} gpMacCore_GetDeviceTableEntries_Output_struct_t; + +typedef struct { + gpMacCore_GetDeviceTableEntries_Output_struct_t data; +} gpMacCore_GetDeviceTableEntries_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_KeyDescriptor_t* pKeyDescriptor; + gpMacCore_Index_t index; +} gpMacCore_SetKeyDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_SetKeyDescriptor_Input_struct_t data; + gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t pKeyDescriptor; +} gpMacCore_SetKeyDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetKeyDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_SetKeyDescriptor_Output_struct_t data; +} gpMacCore_SetKeyDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; +} gpMacCore_GetKeyDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_GetKeyDescriptor_Input_struct_t data; +} gpMacCore_GetKeyDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_KeyDescriptor_t* pKeyDescriptor; +} gpMacCore_GetKeyDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_GetKeyDescriptor_Output_struct_t data; + gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t pKeyDescriptor; +} gpMacCore_GetKeyDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_KeyTablesEntries_t keyTableEntries; +} gpMacCore_SetKeyTableEntries_Input_struct_t; + +typedef struct { + gpMacCore_SetKeyTableEntries_Input_struct_t data; +} gpMacCore_SetKeyTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor; + gpMacCore_Index_t index; +} gpMacCore_SetSecurityLevelDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_SetSecurityLevelDescriptor_Input_struct_t data; + gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t pSecurityLevelDescriptor; +} gpMacCore_SetSecurityLevelDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetSecurityLevelDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_SetSecurityLevelDescriptor_Output_struct_t data; +} gpMacCore_SetSecurityLevelDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; +} gpMacCore_GetSecurityLevelDescriptor_Input_struct_t; + +typedef struct { + gpMacCore_GetSecurityLevelDescriptor_Input_struct_t data; +} gpMacCore_GetSecurityLevelDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor; +} gpMacCore_GetSecurityLevelDescriptor_Output_struct_t; + +typedef struct { + gpMacCore_GetSecurityLevelDescriptor_Output_struct_t data; + gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t pSecurityLevelDescriptor; +} gpMacCore_GetSecurityLevelDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; +} gpMacCore_SetSecurityLevelTableEntries_Input_struct_t; + +typedef struct { + gpMacCore_SetSecurityLevelTableEntries_Input_struct_t data; +} gpMacCore_SetSecurityLevelTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; +} gpMacCore_GetSecurityLevelTableEntries_Output_struct_t; + +typedef struct { + gpMacCore_GetSecurityLevelTableEntries_Output_struct_t data; +} gpMacCore_GetSecurityLevelTableEntries_Output_marshall_struct_t; + + +typedef struct { + UInt8* pDefaultKeySource; +} gpMacCore_SetDefaultKeySource_Input_struct_t; + +typedef struct { + gpMacCore_SetDefaultKeySource_Input_struct_t data; + UInt8 pDefaultKeySource[8]; +} gpMacCore_SetDefaultKeySource_Input_marshall_struct_t; + + +typedef struct { + UInt16 shortAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_SetShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetShortAddress_Input_struct_t data; +} gpMacCore_SetShortAddress_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pExtendedAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_SetExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetExtendedAddress_Input_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacCore_SetExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + UInt16 panId; + gpMacCore_StackId_t stackId; +} gpMacCore_SetPanId_Input_struct_t; + +typedef struct { + gpMacCore_SetPanId_Input_struct_t data; +} gpMacCore_SetPanId_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetPanId_Input_struct_t; + +typedef struct { + gpMacCore_GetPanId_Input_struct_t data; +} gpMacCore_GetPanId_Input_marshall_struct_t; + +typedef struct { + gpMacCore_PanId_t panId; +} gpMacCore_GetPanId_Output_struct_t; + +typedef struct { + gpMacCore_GetPanId_Output_struct_t data; +} gpMacCore_GetPanId_Output_marshall_struct_t; + + +typedef struct { + UInt32 frameCounter; + gpMacCore_StackId_t stackId; +} gpMacCore_SetFrameCounter_Input_struct_t; + +typedef struct { + gpMacCore_SetFrameCounter_Input_struct_t data; +} gpMacCore_SetFrameCounter_Input_marshall_struct_t; + + +typedef struct { + UInt8 dsn; + gpMacCore_StackId_t stackId; +} gpMacCore_SetDsn_Input_struct_t; + +typedef struct { + gpMacCore_SetDsn_Input_struct_t data; +} gpMacCore_SetDsn_Input_marshall_struct_t; + + +typedef struct { + UInt8 channel; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCurrentChannel_Input_struct_t; + +typedef struct { + gpMacCore_SetCurrentChannel_Input_struct_t data; +} gpMacCore_SetCurrentChannel_Input_marshall_struct_t; + + +typedef struct { + UInt8* pBeaconPayload; + gpMacCore_StackId_t stackId; +} gpMacCore_SetBeaconPayload_Input_struct_t; + +typedef struct { + gpMacCore_SetBeaconPayload_Input_struct_t data; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} gpMacCore_SetBeaconPayload_Input_marshall_struct_t; + + +typedef struct { + UInt8 beaconPayloadLength; + gpMacCore_StackId_t stackId; +} gpMacCore_SetBeaconPayloadLength_Input_struct_t; + +typedef struct { + gpMacCore_SetBeaconPayloadLength_Input_struct_t data; +} gpMacCore_SetBeaconPayloadLength_Input_marshall_struct_t; + + +typedef struct { + Bool rxOnWhenIdle; + gpMacCore_StackId_t stackId; +} gpMacCore_SetRxOnWhenIdle_Input_struct_t; + +typedef struct { + gpMacCore_SetRxOnWhenIdle_Input_struct_t data; +} gpMacCore_SetRxOnWhenIdle_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_GetExtendedAddress_Input_struct_t data; +} gpMacCore_GetExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pExtendedAddress; +} gpMacCore_GetExtendedAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetExtendedAddress_Output_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacCore_GetExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxCsmaBackoffs; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMaxCsmaBackoffs_Input_struct_t; + +typedef struct { + gpMacCore_SetMaxCsmaBackoffs_Input_struct_t data; +} gpMacCore_SetMaxCsmaBackoffs_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMaxCsmaBackoffs_Input_struct_t; + +typedef struct { + gpMacCore_GetMaxCsmaBackoffs_Input_struct_t data; +} gpMacCore_GetMaxCsmaBackoffs_Input_marshall_struct_t; + +typedef struct { + UInt8 maxCsmaBackoffs; +} gpMacCore_GetMaxCsmaBackoffs_Output_struct_t; + +typedef struct { + gpMacCore_GetMaxCsmaBackoffs_Output_struct_t data; +} gpMacCore_GetMaxCsmaBackoffs_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetDsn_Input_struct_t; + +typedef struct { + gpMacCore_GetDsn_Input_struct_t data; +} gpMacCore_GetDsn_Input_marshall_struct_t; + +typedef struct { + UInt8 dsn; +} gpMacCore_GetDsn_Output_struct_t; + +typedef struct { + gpMacCore_GetDsn_Output_struct_t data; +} gpMacCore_GetDsn_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCurrentChannel_Input_struct_t; + +typedef struct { + gpMacCore_GetCurrentChannel_Input_struct_t data; +} gpMacCore_GetCurrentChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 channel; +} gpMacCore_GetCurrentChannel_Output_struct_t; + +typedef struct { + gpMacCore_GetCurrentChannel_Output_struct_t data; +} gpMacCore_GetCurrentChannel_Output_marshall_struct_t; + + +typedef struct { + UInt8 numberOfRetries; + gpMacCore_StackId_t stackId; +} gpMacCore_SetNumberOfRetries_Input_struct_t; + +typedef struct { + gpMacCore_SetNumberOfRetries_Input_struct_t data; +} gpMacCore_SetNumberOfRetries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetNumberOfRetries_Input_struct_t; + +typedef struct { + gpMacCore_GetNumberOfRetries_Input_struct_t data; +} gpMacCore_GetNumberOfRetries_Input_marshall_struct_t; + +typedef struct { + UInt8 numberOfRetries; +} gpMacCore_GetNumberOfRetries_Output_struct_t; + +typedef struct { + gpMacCore_GetNumberOfRetries_Output_struct_t data; +} gpMacCore_GetNumberOfRetries_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetFrameCounter_Input_struct_t; + +typedef struct { + gpMacCore_GetFrameCounter_Input_struct_t data; +} gpMacCore_GetFrameCounter_Input_marshall_struct_t; + +typedef struct { + UInt32 frameCounter; +} gpMacCore_GetFrameCounter_Output_struct_t; + +typedef struct { + gpMacCore_GetFrameCounter_Output_struct_t data; +} gpMacCore_GetFrameCounter_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetRxOnWhenIdle_Input_struct_t; + +typedef struct { + gpMacCore_GetRxOnWhenIdle_Input_struct_t data; +} gpMacCore_GetRxOnWhenIdle_Input_marshall_struct_t; + +typedef struct { + Bool rxOnWhenIdle; +} gpMacCore_GetRxOnWhenIdle_Output_struct_t; + +typedef struct { + gpMacCore_GetRxOnWhenIdle_Output_struct_t data; +} gpMacCore_GetRxOnWhenIdle_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_GetShortAddress_Input_struct_t data; +} gpMacCore_GetShortAddress_Input_marshall_struct_t; + +typedef struct { + UInt16 address; +} gpMacCore_GetShortAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetShortAddress_Output_struct_t data; +} gpMacCore_GetShortAddress_Output_marshall_struct_t; + + +typedef struct { + UInt16 panCoordShortAddress; +} gpMacCore_SetPanCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetPanCoordShortAddress_Input_struct_t data; +} gpMacCore_SetPanCoordShortAddress_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; +} gpMacCore_SetPanCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetPanCoordExtendedAddress_Input_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacCore_SetPanCoordExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + Bool associationPermit; + gpMacCore_StackId_t stackId; +} gpMacCore_SetAssociationPermit_Input_struct_t; + +typedef struct { + gpMacCore_SetAssociationPermit_Input_struct_t data; +} gpMacCore_SetAssociationPermit_Input_marshall_struct_t; + + +typedef struct { + Int8* pDefaultTransmitPowerTable; +} gpMacCore_SetDefaultTransmitPowers_Input_struct_t; + +typedef struct { + gpMacCore_SetDefaultTransmitPowers_Input_struct_t data; + Int8 pDefaultTransmitPowerTable[16]; +} gpMacCore_SetDefaultTransmitPowers_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_TxPower_t transmitPower; + gpMacCore_StackId_t stackId; +} gpMacCore_SetTransmitPower_Input_struct_t; + +typedef struct { + gpMacCore_SetTransmitPower_Input_struct_t data; +} gpMacCore_SetTransmitPower_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetTransmitPower_Input_struct_t; + +typedef struct { + gpMacCore_GetTransmitPower_Input_struct_t data; +} gpMacCore_GetTransmitPower_Input_marshall_struct_t; + +typedef struct { + Int8 transmitPower; +} gpMacCore_GetTransmitPower_Output_struct_t; + +typedef struct { + gpMacCore_GetTransmitPower_Output_struct_t data; +} gpMacCore_GetTransmitPower_Output_marshall_struct_t; + + + +typedef struct { + Bool panCoordinator; + gpMacCore_StackId_t stackId; +} gpMacCore_SetPanCoordinator_Input_struct_t; + +typedef struct { + gpMacCore_SetPanCoordinator_Input_struct_t data; +} gpMacCore_SetPanCoordinator_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetPanCoordinator_Input_struct_t; + +typedef struct { + gpMacCore_GetPanCoordinator_Input_struct_t data; +} gpMacCore_GetPanCoordinator_Input_marshall_struct_t; + +typedef struct { + Bool panCoordinator; +} gpMacCore_GetPanCoordinator_Output_struct_t; + +typedef struct { + gpMacCore_GetPanCoordinator_Output_struct_t data; +} gpMacCore_GetPanCoordinator_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pOrphanAddress; + UInt16 shortAddress; + Bool associatedMember; + gpMacCore_StackId_t stackId; +} gpMacCore_OrphanResponse_Input_struct_t; + +typedef struct { + gpMacCore_OrphanResponse_Input_struct_t data; + MACAddress_t pOrphanAddress[1]; +} gpMacCore_OrphanResponse_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetSecurityEnabled_Input_struct_t; + +typedef struct { + gpMacCore_GetSecurityEnabled_Input_struct_t data; +} gpMacCore_GetSecurityEnabled_Input_marshall_struct_t; + +typedef struct { + Bool securityEnabled; +} gpMacCore_GetSecurityEnabled_Output_struct_t; + +typedef struct { + gpMacCore_GetSecurityEnabled_Output_struct_t data; +} gpMacCore_GetSecurityEnabled_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetTransactionPersistenceTime_Input_struct_t; + +typedef struct { + gpMacCore_GetTransactionPersistenceTime_Input_struct_t data; +} gpMacCore_GetTransactionPersistenceTime_Input_marshall_struct_t; + +typedef struct { + UInt16 time; +} gpMacCore_GetTransactionPersistenceTime_Output_struct_t; + +typedef struct { + gpMacCore_GetTransactionPersistenceTime_Output_struct_t data; +} gpMacCore_GetTransactionPersistenceTime_Output_marshall_struct_t; + + +typedef struct { + UInt16 time; + gpMacCore_StackId_t stackId; +} gpMacCore_SetTransactionPersistenceTime_Input_struct_t; + +typedef struct { + gpMacCore_SetTransactionPersistenceTime_Input_struct_t data; +} gpMacCore_SetTransactionPersistenceTime_Input_marshall_struct_t; + + + + +typedef struct { + Bool BeaconStarted; + gpMacCore_StackId_t stackId; +} gpMacCore_SetBeaconStarted_Input_struct_t; + +typedef struct { + gpMacCore_SetBeaconStarted_Input_struct_t data; +} gpMacCore_SetBeaconStarted_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetBeaconStarted_Input_struct_t; + +typedef struct { + gpMacCore_GetBeaconStarted_Input_struct_t data; +} gpMacCore_GetBeaconStarted_Input_marshall_struct_t; + +typedef struct { + Bool BeaconStarted; +} gpMacCore_GetBeaconStarted_Output_struct_t; + +typedef struct { + gpMacCore_GetBeaconStarted_Output_struct_t data; +} gpMacCore_GetBeaconStarted_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; +} gpMacCore_GetPanCoordExtendedAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetPanCoordExtendedAddress_Output_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacCore_GetPanCoordExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetCoordExtendedAddress_Input_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacCore_SetCoordExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacCore_GetCoordExtendedAddress_Input_struct_t data; +} gpMacCore_GetCoordExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; +} gpMacCore_GetCoordExtendedAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetCoordExtendedAddress_Output_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacCore_GetCoordExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + UInt16 panCoordShortAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_SetCoordShortAddress_Input_struct_t data; +} gpMacCore_SetCoordShortAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacCore_GetCoordShortAddress_Input_struct_t data; +} gpMacCore_GetCoordShortAddress_Input_marshall_struct_t; + +typedef struct { + UInt16 panCoordShortAddress; +} gpMacCore_GetCoordShortAddress_Output_struct_t; + +typedef struct { + gpMacCore_GetCoordShortAddress_Output_struct_t data; +} gpMacCore_GetCoordShortAddress_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetAssociationPermit_Input_struct_t; + +typedef struct { + gpMacCore_GetAssociationPermit_Input_struct_t data; +} gpMacCore_GetAssociationPermit_Input_marshall_struct_t; + +typedef struct { + Bool associationPermit; +} gpMacCore_GetAssociationPermit_Output_struct_t; + +typedef struct { + gpMacCore_GetAssociationPermit_Output_struct_t data; +} gpMacCore_GetAssociationPermit_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetBeaconPayload_Input_struct_t; + +typedef struct { + gpMacCore_GetBeaconPayload_Input_struct_t data; +} gpMacCore_GetBeaconPayload_Input_marshall_struct_t; + +typedef struct { + UInt8* pBeaconPayload; +} gpMacCore_GetBeaconPayload_Output_struct_t; + +typedef struct { + gpMacCore_GetBeaconPayload_Output_struct_t data; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} gpMacCore_GetBeaconPayload_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetBeaconPayloadLength_Input_struct_t; + +typedef struct { + gpMacCore_GetBeaconPayloadLength_Input_struct_t data; +} gpMacCore_GetBeaconPayloadLength_Input_marshall_struct_t; + +typedef struct { + UInt8 beaconPayloadLength; +} gpMacCore_GetBeaconPayloadLength_Output_struct_t; + +typedef struct { + gpMacCore_GetBeaconPayloadLength_Output_struct_t data; +} gpMacCore_GetBeaconPayloadLength_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacCore_SetIndicateBeaconNotifications_Input_struct_t; + +typedef struct { + gpMacCore_SetIndicateBeaconNotifications_Input_struct_t data; +} gpMacCore_SetIndicateBeaconNotifications_Input_marshall_struct_t; + + +typedef struct { + UInt8 promiscuousMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetPromiscuousMode_Input_struct_t; + +typedef struct { + gpMacCore_SetPromiscuousMode_Input_struct_t data; +} gpMacCore_SetPromiscuousMode_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_MacVersion_t macVersion; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMacVersion_Input_struct_t; + +typedef struct { + gpMacCore_SetMacVersion_Input_struct_t data; +} gpMacCore_SetMacVersion_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMacVersion_Input_struct_t; + +typedef struct { + gpMacCore_GetMacVersion_Input_struct_t data; +} gpMacCore_GetMacVersion_Input_marshall_struct_t; + +typedef struct { + gpMacCore_MacVersion_t macVersion; +} gpMacCore_GetMacVersion_Output_struct_t; + +typedef struct { + gpMacCore_GetMacVersion_Output_struct_t data; +} gpMacCore_GetMacVersion_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_StackAdded_Input_struct_t; + +typedef struct { + gpMacCore_StackAdded_Input_struct_t data; +} gpMacCore_StackAdded_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_StackRemoved_Input_struct_t; + +typedef struct { + gpMacCore_StackRemoved_Input_struct_t data; +} gpMacCore_StackRemoved_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetIndicateBeaconNotifications_Input_struct_t; + +typedef struct { + gpMacCore_GetIndicateBeaconNotifications_Input_struct_t data; +} gpMacCore_GetIndicateBeaconNotifications_Input_marshall_struct_t; + +typedef struct { + Bool enabled; +} gpMacCore_GetIndicateBeaconNotifications_Output_struct_t; + +typedef struct { + gpMacCore_GetIndicateBeaconNotifications_Output_struct_t data; +} gpMacCore_GetIndicateBeaconNotifications_Output_marshall_struct_t; + + +typedef struct { + UInt8 cCAMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCCAMode_Input_struct_t; + +typedef struct { + gpMacCore_SetCCAMode_Input_struct_t data; +} gpMacCore_SetCCAMode_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCCAMode_Input_struct_t; + +typedef struct { + gpMacCore_GetCCAMode_Input_struct_t data; +} gpMacCore_GetCCAMode_Input_marshall_struct_t; + +typedef struct { + UInt8 cCAMode; +} gpMacCore_GetCCAMode_Output_struct_t; + +typedef struct { + gpMacCore_GetCCAMode_Output_struct_t data; +} gpMacCore_GetCCAMode_Output_marshall_struct_t; + + +typedef struct { + UInt8 minBE; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMinBE_Input_struct_t; + +typedef struct { + gpMacCore_SetMinBE_Input_struct_t data; +} gpMacCore_SetMinBE_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMinBE_Input_struct_t; + +typedef struct { + gpMacCore_GetMinBE_Input_struct_t data; +} gpMacCore_GetMinBE_Input_marshall_struct_t; + +typedef struct { + UInt8 minBE; +} gpMacCore_GetMinBE_Output_struct_t; + +typedef struct { + gpMacCore_GetMinBE_Output_struct_t data; +} gpMacCore_GetMinBE_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetPromiscuousMode_Input_struct_t; + +typedef struct { + gpMacCore_GetPromiscuousMode_Input_struct_t data; +} gpMacCore_GetPromiscuousMode_Input_marshall_struct_t; + +typedef struct { + Bool promiscuousMode; +} gpMacCore_GetPromiscuousMode_Output_struct_t; + +typedef struct { + gpMacCore_GetPromiscuousMode_Output_struct_t data; +} gpMacCore_GetPromiscuousMode_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpMacCore_StackId_t stackId; +} gpMacCore_PurgeRequest_Input_struct_t; + +typedef struct { + gpMacCore_PurgeRequest_Input_struct_t data; +} gpMacCore_PurgeRequest_Input_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacCore_SetForwardPollIndications_Input_struct_t; + +typedef struct { + gpMacCore_SetForwardPollIndications_Input_struct_t data; +} gpMacCore_SetForwardPollIndications_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetForwardPollIndications_Input_struct_t; + +typedef struct { + gpMacCore_GetForwardPollIndications_Input_struct_t data; +} gpMacCore_GetForwardPollIndications_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacCore_GetForwardPollIndications_Output_struct_t; + +typedef struct { + gpMacCore_GetForwardPollIndications_Output_struct_t data; +} gpMacCore_GetForwardPollIndications_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxBE; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMaxBE_Input_struct_t; + +typedef struct { + gpMacCore_SetMaxBE_Input_struct_t data; +} gpMacCore_SetMaxBE_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMaxBE_Input_struct_t; + +typedef struct { + gpMacCore_GetMaxBE_Input_struct_t data; +} gpMacCore_GetMaxBE_Input_marshall_struct_t; + +typedef struct { + UInt8 maxBE; +} gpMacCore_GetMaxBE_Output_struct_t; + +typedef struct { + gpMacCore_GetMaxBE_Output_struct_t data; +} gpMacCore_GetMaxBE_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacCore_AddNeighbour_Input_struct_t; + +typedef struct { + gpMacCore_AddNeighbour_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacCore_AddNeighbour_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacCore_AddNeighbour_Output_struct_t; + +typedef struct { + gpMacCore_AddNeighbour_Output_struct_t data; +} gpMacCore_AddNeighbour_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacCore_RemoveNeighbour_Input_struct_t; + +typedef struct { + gpMacCore_RemoveNeighbour_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacCore_RemoveNeighbour_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacCore_RemoveNeighbour_Output_struct_t; + +typedef struct { + gpMacCore_RemoveNeighbour_Output_struct_t data; +} gpMacCore_RemoveNeighbour_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DataPendingMode_t dataPendingMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetDataPendingMode_Input_struct_t; + +typedef struct { + gpMacCore_SetDataPendingMode_Input_struct_t data; +} gpMacCore_SetDataPendingMode_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetDataPendingMode_Output_struct_t; + +typedef struct { + gpMacCore_SetDataPendingMode_Output_struct_t data; +} gpMacCore_SetDataPendingMode_Output_marshall_struct_t; + + + +typedef struct { + UInt8 addressMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetAddressModeOverrideForBeacons_Input_struct_t; + +typedef struct { + gpMacCore_SetAddressModeOverrideForBeacons_Input_struct_t data; +} gpMacCore_SetAddressModeOverrideForBeacons_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_ClearNeighbours_Input_struct_t; + +typedef struct { + gpMacCore_ClearNeighbours_Input_struct_t data; +} gpMacCore_ClearNeighbours_Input_marshall_struct_t; + + +typedef struct { + UInt8 csmaMode; + gpMacCore_StackId_t stackId; +} gpMacCore_SetCsmaMode_Input_struct_t; + +typedef struct { + gpMacCore_SetCsmaMode_Input_struct_t data; +} gpMacCore_SetCsmaMode_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetCsmaMode_Input_struct_t; + +typedef struct { + gpMacCore_GetCsmaMode_Input_struct_t data; +} gpMacCore_GetCsmaMode_Input_marshall_struct_t; + +typedef struct { + UInt8 csmaMode; +} gpMacCore_GetCsmaMode_Output_struct_t; + +typedef struct { + gpMacCore_GetCsmaMode_Output_struct_t data; +} gpMacCore_GetCsmaMode_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpMacCore_TxTimingOptions_t timingOptions; + gpMacCore_StackId_t stackId; +} gpMacCore_ScheduleTimedTx_Input_struct_t; + +typedef struct { + gpMacCore_ScheduleTimedTx_Input_struct_t data; + gpMacCore_TxTimingOptions_t_l1_pointer_marshall_t timingOptions; +} gpMacCore_ScheduleTimedTx_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_ScheduleTimedTx_Output_struct_t; + +typedef struct { + gpMacCore_ScheduleTimedTx_Output_struct_t data; +} gpMacCore_ScheduleTimedTx_Output_marshall_struct_t; + + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacCore_DataPending_QueueAdd_Input_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueAdd_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacCore_DataPending_QueueAdd_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_DataPending_QueueAdd_Output_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueAdd_Output_struct_t data; +} gpMacCore_DataPending_QueueAdd_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacCore_DataPending_QueueRemove_Input_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueRemove_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacCore_DataPending_QueueRemove_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_DataPending_QueueRemove_Output_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueRemove_Output_struct_t data; +} gpMacCore_DataPending_QueueRemove_Output_marshall_struct_t; + + + + + +typedef struct { + Int8* pInterferenceLevels; +} gpMacCore_SetMinInterferenceLevels_Input_struct_t; + +typedef struct { + gpMacCore_SetMinInterferenceLevels_Input_struct_t data; + Int8 pInterferenceLevels[16]; +} gpMacCore_SetMinInterferenceLevels_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_SetMinInterferenceLevels_Output_struct_t; + +typedef struct { + gpMacCore_SetMinInterferenceLevels_Output_struct_t data; +} gpMacCore_SetMinInterferenceLevels_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_DataPending_QueueClear_Input_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueClear_Input_struct_t data; +} gpMacCore_DataPending_QueueClear_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_DataPending_QueueClear_Output_struct_t; + +typedef struct { + gpMacCore_DataPending_QueueClear_Output_struct_t data; +} gpMacCore_DataPending_QueueClear_Output_marshall_struct_t; + + +typedef struct { + Bool pending; +} gpMacCore_DataPendingGetAckDataPending_Output_struct_t; + +typedef struct { + gpMacCore_DataPendingGetAckDataPending_Output_struct_t data; +} gpMacCore_DataPendingGetAckDataPending_Output_marshall_struct_t; + + +typedef struct { + Bool rawModeEnabled; + gpMacCore_StackId_t stackId; +} gpMacCore_SetStackInRawMode_Input_struct_t; + +typedef struct { + gpMacCore_SetStackInRawMode_Input_struct_t data; +} gpMacCore_SetStackInRawMode_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetStackInRawMode_Input_struct_t; + +typedef struct { + gpMacCore_GetStackInRawMode_Input_struct_t data; +} gpMacCore_GetStackInRawMode_Input_marshall_struct_t; + +typedef struct { + Bool rawModeEnabled; +} gpMacCore_GetStackInRawMode_Output_struct_t; + +typedef struct { + gpMacCore_GetStackInRawMode_Output_struct_t data; +} gpMacCore_GetStackInRawMode_Output_marshall_struct_t; + + +typedef struct { + Bool enableEnhancedFramePending; + gpMacCore_StackId_t stackId; +} gpMacCore_EnableEnhancedFramePending_Input_struct_t; + +typedef struct { + gpMacCore_EnableEnhancedFramePending_Input_struct_t data; +} gpMacCore_EnableEnhancedFramePending_Input_marshall_struct_t; + + +typedef struct { + UInt32 dutyCycleOnTime; + UInt32 dutyCyclePeriod; + UInt16 recurrenceAmount; + UInt32 startTime; + gpMacCore_StackId_t stackId; +} gpMacCore_EnableRxWindows_Input_struct_t; + +typedef struct { + gpMacCore_EnableRxWindows_Input_struct_t data; +} gpMacCore_EnableRxWindows_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_DisableRxWindows_Input_struct_t; + +typedef struct { + gpMacCore_DisableRxWindows_Input_struct_t data; +} gpMacCore_DisableRxWindows_Input_marshall_struct_t; + + +typedef struct { + UInt16 dutyCyclePeriod; + gpMacCore_StackId_t stackId; +} gpMacCore_EnableCsl_Input_struct_t; + +typedef struct { + gpMacCore_EnableCsl_Input_struct_t data; +} gpMacCore_EnableCsl_Input_marshall_struct_t; + + +typedef struct { + UInt32 nextCslSampleTime; + gpMacCore_StackId_t stackId; +} gpMacCore_UpdateCslSampleTime_Input_struct_t; + +typedef struct { + gpMacCore_UpdateCslSampleTime_Input_struct_t data; +} gpMacCore_UpdateCslSampleTime_Input_marshall_struct_t; + + +typedef struct { + UInt32 currentTime; +} gpMacCore_GetCurrentTimeUs_Output_struct_t; + +typedef struct { + gpMacCore_GetCurrentTimeUs_Output_struct_t data; +} gpMacCore_GetCurrentTimeUs_Output_marshall_struct_t; + + +typedef struct { + UInt8 linkMetrics; + MACAddress_t* pExtendedAddress; + UInt16 shortAddress; + gpMacCore_StackId_t stackId; +} gpMacCore_ConfigureEnhAckProbing_Input_struct_t; + +typedef struct { + gpMacCore_ConfigureEnhAckProbing_Input_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacCore_ConfigureEnhAckProbing_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacCore_ConfigureEnhAckProbing_Output_struct_t; + +typedef struct { + gpMacCore_ConfigureEnhAckProbing_Output_struct_t data; +} gpMacCore_ConfigureEnhAckProbing_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacCore_SetRetransmitOnCcaFail_Input_struct_t; + +typedef struct { + gpMacCore_SetRetransmitOnCcaFail_Input_struct_t data; +} gpMacCore_SetRetransmitOnCcaFail_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetRetransmitOnCcaFail_Input_struct_t; + +typedef struct { + gpMacCore_GetRetransmitOnCcaFail_Input_struct_t data; +} gpMacCore_GetRetransmitOnCcaFail_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacCore_GetRetransmitOnCcaFail_Output_struct_t; + +typedef struct { + gpMacCore_GetRetransmitOnCcaFail_Output_struct_t data; +} gpMacCore_GetRetransmitOnCcaFail_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacCore_SetRetransmitRandomBackoff_Input_struct_t; + +typedef struct { + gpMacCore_SetRetransmitRandomBackoff_Input_struct_t data; +} gpMacCore_SetRetransmitRandomBackoff_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetRetransmitRandomBackoff_Input_struct_t; + +typedef struct { + gpMacCore_GetRetransmitRandomBackoff_Input_struct_t data; +} gpMacCore_GetRetransmitRandomBackoff_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacCore_GetRetransmitRandomBackoff_Output_struct_t; + +typedef struct { + gpMacCore_GetRetransmitRandomBackoff_Output_struct_t data; +} gpMacCore_GetRetransmitRandomBackoff_Output_marshall_struct_t; + + +typedef struct { + UInt8 minBERetransmit; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMinBeRetransmit_Input_struct_t; + +typedef struct { + gpMacCore_SetMinBeRetransmit_Input_struct_t data; +} gpMacCore_SetMinBeRetransmit_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMinBeRetransmit_Input_struct_t; + +typedef struct { + gpMacCore_GetMinBeRetransmit_Input_struct_t data; +} gpMacCore_GetMinBeRetransmit_Input_marshall_struct_t; + +typedef struct { + UInt8 minBERetransmit; +} gpMacCore_GetMinBeRetransmit_Output_struct_t; + +typedef struct { + gpMacCore_GetMinBeRetransmit_Output_struct_t data; +} gpMacCore_GetMinBeRetransmit_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxBERetransmit; + gpMacCore_StackId_t stackId; +} gpMacCore_SetMaxBeRetransmit_Input_struct_t; + +typedef struct { + gpMacCore_SetMaxBeRetransmit_Input_struct_t data; +} gpMacCore_SetMaxBeRetransmit_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_GetMaxBeRetransmit_Input_struct_t; + +typedef struct { + gpMacCore_GetMaxBeRetransmit_Input_struct_t data; +} gpMacCore_GetMaxBeRetransmit_Input_marshall_struct_t; + +typedef struct { + UInt8 maxBERetransmit; +} gpMacCore_GetMaxBeRetransmit_Output_struct_t; + +typedef struct { + gpMacCore_GetMaxBeRetransmit_Output_struct_t data; +} gpMacCore_GetMaxBeRetransmit_Output_marshall_struct_t; + + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Result_t status; + gpPd_Handle_t pdHandle; +} gpMacCore_cbDataConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbDataConfirm_Input_struct_t data; +} gpMacCore_cbDataConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + UInt8 dsn; + gpMacCore_Security_t* pSecOptions; + gpPd_Loh_t pdLoh; + gpMacCore_StackId_t stackId; +} gpMacCore_cbDataIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbDataIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; + gpPd_Loh_t_l1_pointer_marshall_t pdLoh; +} gpMacCore_cbDataIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Result_t status; + gpMacCore_ScanType_t scanType; + UInt32 unscannedChannels; + UInt8 resultListSize; + UInt8* pEdScanResultList; +} gpMacCore_cbScanConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbScanConfirm_Input_struct_t data; + UInt8 pEdScanResultList[27]; +} gpMacCore_cbScanConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + UInt8 bsn; + gpMacCore_PanDescriptor_t* pPanDescriptor; + gpMacCore_StackId_t stackId; + UInt8 beaconPayloadLength; + UInt8* pBeaconPayload; +} gpMacCore_cbBeaconNotifyIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbBeaconNotifyIndication_Input_struct_t data; + gpMacCore_PanDescriptor_t_l1_pointer_marshall_t pPanDescriptor; + UInt8 pBeaconPayload[52]; +} gpMacCore_cbBeaconNotifyIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + MACAddress_t* pOrphanAddress; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t rxTime; +} gpMacCore_cbOrphanIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbOrphanIndication_Input_struct_t data; + MACAddress_t pOrphanAddress[1]; +} gpMacCore_cbOrphanIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddressInfo; + gpMacCore_AddressInfo_t* pDstAddressInfo; + gpMacCore_Result_t status; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbSecurityFailureCommStatusIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbSecurityFailureCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddressInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; +} gpMacCore_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Result_t status; + gpMacCore_AddressInfo_t* coordAddrInfo; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbPollConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbPollConfirm_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; +} gpMacCore_cbPollConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* addressInfo; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t rxTime; +} gpMacCore_cbPollIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbPollIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t addressInfo; +} gpMacCore_cbPollIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + UInt16 assocShortAddress; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbAssociateConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbAssociateConfirm_Input_struct_t data; +} gpMacCore_cbAssociateConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Address_t* pDeviceAddress; + UInt8 capabilityInformation; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t rxTime; +} gpMacCore_cbAssociateIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbAssociateIndication_Input_struct_t data; + gpMacCore_Address_t_l1_pointer_marshall_t pDeviceAddress; +} gpMacCore_cbAssociateIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddressInfo; + gpMacCore_AddressInfo_t* pDstAddressInfo; + gpMacCore_Result_t status; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbAssociateCommStatusIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbAssociateCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddressInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; +} gpMacCore_cbAssociateCommStatusIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddressInfo; + gpMacCore_AddressInfo_t* pDstAddressInfo; + gpMacCore_Result_t status; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t txTime; +} gpMacCore_cbOrphanCommStatusIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbOrphanCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddressInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; +} gpMacCore_cbOrphanCommStatusIndication_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_SCAN_ORPHAN_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacCore_cbValidStack_Input_struct_t; + +typedef struct { + gpMacCore_cbValidStack_Input_struct_t data; +} gpMacCore_cbValidStack_Input_marshall_struct_t; + +typedef struct { + Bool valid; +} gpMacCore_cbValidStack_Output_struct_t; + +typedef struct { + gpMacCore_cbValidStack_Output_struct_t data; +} gpMacCore_cbValidStack_Output_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_Result_t status; + gpPd_Handle_t pdHandle; +} gpMacCore_cbPurgeConfirm_Input_struct_t; + +typedef struct { + gpMacCore_cbPurgeConfirm_Input_struct_t data; +} gpMacCore_cbPurgeConfirm_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + +#if !defined(GP_COMP_MACDISPATCHER) +typedef struct { + gpMacCore_AddressInfo_t* addressInfo; + gpMacCore_StackId_t stackId; + gpPd_TimeStamp_t rxTime; + gpPd_Handle_t pdHandle; + Bool fromNeighbour; +} gpMacCore_cbPollNotify_Input_struct_t; + +typedef struct { + gpMacCore_cbPollNotify_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t addressInfo; +} gpMacCore_cbPollNotify_Input_marshall_struct_t; + +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ + +#if !(defined(GP_COMP_MACDISPATCHER)) +typedef struct { + UInt32 frameCounter; + gpMacCore_StackId_t stackId; +} gpMacCore_cbSecurityFrameCounterIndication_Input_struct_t; + +typedef struct { + gpMacCore_cbSecurityFrameCounterIndication_Input_struct_t data; +} gpMacCore_cbSecurityFrameCounterIndication_Input_marshall_struct_t; + +#endif /* !(defined(GP_COMP_MACDISPATCHER)) */ + +typedef union { + gpMacCore_Reset_Input_marshall_struct_t gpMacCore_Reset; + gpMacCore_DataRequest_Input_marshall_struct_t gpMacCore_DataRequest; + gpMacCore_ScanRequest_Input_marshall_struct_t gpMacCore_ScanRequest; + gpMacCore_AssociateRequest_Input_marshall_struct_t gpMacCore_AssociateRequest; + gpMacCore_AssociateResponse_Input_marshall_struct_t gpMacCore_AssociateResponse; + gpMacCore_PollRequest_Input_marshall_struct_t gpMacCore_PollRequest; + gpMacCore_Start_Input_marshall_struct_t gpMacCore_Start; + gpMacCore_SetSecurityEnabled_Input_marshall_struct_t gpMacCore_SetSecurityEnabled; + gpMacCore_SetDeviceDescriptor_Input_marshall_struct_t gpMacCore_SetDeviceDescriptor; + gpMacCore_GetDeviceDescriptor_Input_marshall_struct_t gpMacCore_GetDeviceDescriptor; + gpMacCore_SetDeviceTableEntries_Input_marshall_struct_t gpMacCore_SetDeviceTableEntries; + gpMacCore_SetKeyDescriptor_Input_marshall_struct_t gpMacCore_SetKeyDescriptor; + gpMacCore_GetKeyDescriptor_Input_marshall_struct_t gpMacCore_GetKeyDescriptor; + gpMacCore_SetKeyTableEntries_Input_marshall_struct_t gpMacCore_SetKeyTableEntries; + gpMacCore_SetSecurityLevelDescriptor_Input_marshall_struct_t gpMacCore_SetSecurityLevelDescriptor; + gpMacCore_GetSecurityLevelDescriptor_Input_marshall_struct_t gpMacCore_GetSecurityLevelDescriptor; + gpMacCore_SetSecurityLevelTableEntries_Input_marshall_struct_t gpMacCore_SetSecurityLevelTableEntries; + gpMacCore_SetDefaultKeySource_Input_marshall_struct_t gpMacCore_SetDefaultKeySource; + gpMacCore_SetShortAddress_Input_marshall_struct_t gpMacCore_SetShortAddress; + gpMacCore_SetExtendedAddress_Input_marshall_struct_t gpMacCore_SetExtendedAddress; + gpMacCore_SetPanId_Input_marshall_struct_t gpMacCore_SetPanId; + gpMacCore_GetPanId_Input_marshall_struct_t gpMacCore_GetPanId; + gpMacCore_SetFrameCounter_Input_marshall_struct_t gpMacCore_SetFrameCounter; + gpMacCore_SetDsn_Input_marshall_struct_t gpMacCore_SetDsn; + gpMacCore_SetCurrentChannel_Input_marshall_struct_t gpMacCore_SetCurrentChannel; + gpMacCore_SetBeaconPayload_Input_marshall_struct_t gpMacCore_SetBeaconPayload; + gpMacCore_SetBeaconPayloadLength_Input_marshall_struct_t gpMacCore_SetBeaconPayloadLength; + gpMacCore_SetRxOnWhenIdle_Input_marshall_struct_t gpMacCore_SetRxOnWhenIdle; + gpMacCore_GetExtendedAddress_Input_marshall_struct_t gpMacCore_GetExtendedAddress; + gpMacCore_SetMaxCsmaBackoffs_Input_marshall_struct_t gpMacCore_SetMaxCsmaBackoffs; + gpMacCore_GetMaxCsmaBackoffs_Input_marshall_struct_t gpMacCore_GetMaxCsmaBackoffs; + gpMacCore_GetDsn_Input_marshall_struct_t gpMacCore_GetDsn; + gpMacCore_GetCurrentChannel_Input_marshall_struct_t gpMacCore_GetCurrentChannel; + gpMacCore_SetNumberOfRetries_Input_marshall_struct_t gpMacCore_SetNumberOfRetries; + gpMacCore_GetNumberOfRetries_Input_marshall_struct_t gpMacCore_GetNumberOfRetries; + gpMacCore_GetFrameCounter_Input_marshall_struct_t gpMacCore_GetFrameCounter; + gpMacCore_GetRxOnWhenIdle_Input_marshall_struct_t gpMacCore_GetRxOnWhenIdle; + gpMacCore_GetShortAddress_Input_marshall_struct_t gpMacCore_GetShortAddress; + gpMacCore_SetPanCoordShortAddress_Input_marshall_struct_t gpMacCore_SetPanCoordShortAddress; + gpMacCore_SetPanCoordExtendedAddress_Input_marshall_struct_t gpMacCore_SetPanCoordExtendedAddress; + gpMacCore_SetAssociationPermit_Input_marshall_struct_t gpMacCore_SetAssociationPermit; + gpMacCore_SetDefaultTransmitPowers_Input_marshall_struct_t gpMacCore_SetDefaultTransmitPowers; + gpMacCore_SetTransmitPower_Input_marshall_struct_t gpMacCore_SetTransmitPower; + gpMacCore_GetTransmitPower_Input_marshall_struct_t gpMacCore_GetTransmitPower; + gpMacCore_SetPanCoordinator_Input_marshall_struct_t gpMacCore_SetPanCoordinator; + gpMacCore_GetPanCoordinator_Input_marshall_struct_t gpMacCore_GetPanCoordinator; + gpMacCore_OrphanResponse_Input_marshall_struct_t gpMacCore_OrphanResponse; + gpMacCore_GetSecurityEnabled_Input_marshall_struct_t gpMacCore_GetSecurityEnabled; + gpMacCore_GetTransactionPersistenceTime_Input_marshall_struct_t gpMacCore_GetTransactionPersistenceTime; + gpMacCore_SetTransactionPersistenceTime_Input_marshall_struct_t gpMacCore_SetTransactionPersistenceTime; + gpMacCore_SetBeaconStarted_Input_marshall_struct_t gpMacCore_SetBeaconStarted; + gpMacCore_GetBeaconStarted_Input_marshall_struct_t gpMacCore_GetBeaconStarted; + gpMacCore_SetCoordExtendedAddress_Input_marshall_struct_t gpMacCore_SetCoordExtendedAddress; + gpMacCore_GetCoordExtendedAddress_Input_marshall_struct_t gpMacCore_GetCoordExtendedAddress; + gpMacCore_SetCoordShortAddress_Input_marshall_struct_t gpMacCore_SetCoordShortAddress; + gpMacCore_GetCoordShortAddress_Input_marshall_struct_t gpMacCore_GetCoordShortAddress; + gpMacCore_GetAssociationPermit_Input_marshall_struct_t gpMacCore_GetAssociationPermit; + gpMacCore_GetBeaconPayload_Input_marshall_struct_t gpMacCore_GetBeaconPayload; + gpMacCore_GetBeaconPayloadLength_Input_marshall_struct_t gpMacCore_GetBeaconPayloadLength; + gpMacCore_SetIndicateBeaconNotifications_Input_marshall_struct_t gpMacCore_SetIndicateBeaconNotifications; + gpMacCore_SetPromiscuousMode_Input_marshall_struct_t gpMacCore_SetPromiscuousMode; + gpMacCore_SetMacVersion_Input_marshall_struct_t gpMacCore_SetMacVersion; + gpMacCore_GetMacVersion_Input_marshall_struct_t gpMacCore_GetMacVersion; + gpMacCore_StackAdded_Input_marshall_struct_t gpMacCore_StackAdded; + gpMacCore_StackRemoved_Input_marshall_struct_t gpMacCore_StackRemoved; + gpMacCore_GetIndicateBeaconNotifications_Input_marshall_struct_t gpMacCore_GetIndicateBeaconNotifications; + gpMacCore_SetCCAMode_Input_marshall_struct_t gpMacCore_SetCCAMode; + gpMacCore_GetCCAMode_Input_marshall_struct_t gpMacCore_GetCCAMode; + gpMacCore_SetMinBE_Input_marshall_struct_t gpMacCore_SetMinBE; + gpMacCore_GetMinBE_Input_marshall_struct_t gpMacCore_GetMinBE; + gpMacCore_GetPromiscuousMode_Input_marshall_struct_t gpMacCore_GetPromiscuousMode; + gpMacCore_PurgeRequest_Input_marshall_struct_t gpMacCore_PurgeRequest; + gpMacCore_SetForwardPollIndications_Input_marshall_struct_t gpMacCore_SetForwardPollIndications; + gpMacCore_GetForwardPollIndications_Input_marshall_struct_t gpMacCore_GetForwardPollIndications; + gpMacCore_SetMaxBE_Input_marshall_struct_t gpMacCore_SetMaxBE; + gpMacCore_GetMaxBE_Input_marshall_struct_t gpMacCore_GetMaxBE; + gpMacCore_AddNeighbour_Input_marshall_struct_t gpMacCore_AddNeighbour; + gpMacCore_RemoveNeighbour_Input_marshall_struct_t gpMacCore_RemoveNeighbour; + gpMacCore_SetDataPendingMode_Input_marshall_struct_t gpMacCore_SetDataPendingMode; + gpMacCore_SetAddressModeOverrideForBeacons_Input_marshall_struct_t gpMacCore_SetAddressModeOverrideForBeacons; + gpMacCore_ClearNeighbours_Input_marshall_struct_t gpMacCore_ClearNeighbours; + gpMacCore_SetCsmaMode_Input_marshall_struct_t gpMacCore_SetCsmaMode; + gpMacCore_GetCsmaMode_Input_marshall_struct_t gpMacCore_GetCsmaMode; + gpMacCore_ScheduleTimedTx_Input_marshall_struct_t gpMacCore_ScheduleTimedTx; + gpMacCore_DataPending_QueueAdd_Input_marshall_struct_t gpMacCore_DataPending_QueueAdd; + gpMacCore_DataPending_QueueRemove_Input_marshall_struct_t gpMacCore_DataPending_QueueRemove; + gpMacCore_SetMinInterferenceLevels_Input_marshall_struct_t gpMacCore_SetMinInterferenceLevels; + gpMacCore_DataPending_QueueClear_Input_marshall_struct_t gpMacCore_DataPending_QueueClear; + gpMacCore_SetStackInRawMode_Input_marshall_struct_t gpMacCore_SetStackInRawMode; + gpMacCore_GetStackInRawMode_Input_marshall_struct_t gpMacCore_GetStackInRawMode; + gpMacCore_EnableEnhancedFramePending_Input_marshall_struct_t gpMacCore_EnableEnhancedFramePending; + gpMacCore_EnableRxWindows_Input_marshall_struct_t gpMacCore_EnableRxWindows; + gpMacCore_DisableRxWindows_Input_marshall_struct_t gpMacCore_DisableRxWindows; + gpMacCore_EnableCsl_Input_marshall_struct_t gpMacCore_EnableCsl; + gpMacCore_UpdateCslSampleTime_Input_marshall_struct_t gpMacCore_UpdateCslSampleTime; + gpMacCore_ConfigureEnhAckProbing_Input_marshall_struct_t gpMacCore_ConfigureEnhAckProbing; + gpMacCore_SetRetransmitOnCcaFail_Input_marshall_struct_t gpMacCore_SetRetransmitOnCcaFail; + gpMacCore_GetRetransmitOnCcaFail_Input_marshall_struct_t gpMacCore_GetRetransmitOnCcaFail; + gpMacCore_SetRetransmitRandomBackoff_Input_marshall_struct_t gpMacCore_SetRetransmitRandomBackoff; + gpMacCore_GetRetransmitRandomBackoff_Input_marshall_struct_t gpMacCore_GetRetransmitRandomBackoff; + gpMacCore_SetMinBeRetransmit_Input_marshall_struct_t gpMacCore_SetMinBeRetransmit; + gpMacCore_GetMinBeRetransmit_Input_marshall_struct_t gpMacCore_GetMinBeRetransmit; + gpMacCore_SetMaxBeRetransmit_Input_marshall_struct_t gpMacCore_SetMaxBeRetransmit; + gpMacCore_GetMaxBeRetransmit_Input_marshall_struct_t gpMacCore_GetMaxBeRetransmit; + UInt8 dummy; //ensure none empty union definition +} gpMacCore_Server_Input_union_t; + +typedef union { + gpMacCore_Reset_Output_marshall_struct_t gpMacCore_Reset; + gpMacCore_Start_Output_marshall_struct_t gpMacCore_Start; + gpMacCore_SetDeviceDescriptor_Output_marshall_struct_t gpMacCore_SetDeviceDescriptor; + gpMacCore_GetDeviceDescriptor_Output_marshall_struct_t gpMacCore_GetDeviceDescriptor; + gpMacCore_GetDeviceTableEntries_Output_marshall_struct_t gpMacCore_GetDeviceTableEntries; + gpMacCore_SetKeyDescriptor_Output_marshall_struct_t gpMacCore_SetKeyDescriptor; + gpMacCore_GetKeyDescriptor_Output_marshall_struct_t gpMacCore_GetKeyDescriptor; + gpMacCore_SetSecurityLevelDescriptor_Output_marshall_struct_t gpMacCore_SetSecurityLevelDescriptor; + gpMacCore_GetSecurityLevelDescriptor_Output_marshall_struct_t gpMacCore_GetSecurityLevelDescriptor; + gpMacCore_GetSecurityLevelTableEntries_Output_marshall_struct_t gpMacCore_GetSecurityLevelTableEntries; + gpMacCore_GetPanId_Output_marshall_struct_t gpMacCore_GetPanId; + gpMacCore_GetExtendedAddress_Output_marshall_struct_t gpMacCore_GetExtendedAddress; + gpMacCore_GetMaxCsmaBackoffs_Output_marshall_struct_t gpMacCore_GetMaxCsmaBackoffs; + gpMacCore_GetDsn_Output_marshall_struct_t gpMacCore_GetDsn; + gpMacCore_GetCurrentChannel_Output_marshall_struct_t gpMacCore_GetCurrentChannel; + gpMacCore_GetNumberOfRetries_Output_marshall_struct_t gpMacCore_GetNumberOfRetries; + gpMacCore_GetFrameCounter_Output_marshall_struct_t gpMacCore_GetFrameCounter; + gpMacCore_GetRxOnWhenIdle_Output_marshall_struct_t gpMacCore_GetRxOnWhenIdle; + gpMacCore_GetShortAddress_Output_marshall_struct_t gpMacCore_GetShortAddress; + gpMacCore_GetTransmitPower_Output_marshall_struct_t gpMacCore_GetTransmitPower; + gpMacCore_GetPanCoordinator_Output_marshall_struct_t gpMacCore_GetPanCoordinator; + gpMacCore_GetSecurityEnabled_Output_marshall_struct_t gpMacCore_GetSecurityEnabled; + gpMacCore_GetTransactionPersistenceTime_Output_marshall_struct_t gpMacCore_GetTransactionPersistenceTime; + gpMacCore_GetBeaconStarted_Output_marshall_struct_t gpMacCore_GetBeaconStarted; + gpMacCore_GetPanCoordExtendedAddress_Output_marshall_struct_t gpMacCore_GetPanCoordExtendedAddress; + gpMacCore_GetCoordExtendedAddress_Output_marshall_struct_t gpMacCore_GetCoordExtendedAddress; + gpMacCore_GetCoordShortAddress_Output_marshall_struct_t gpMacCore_GetCoordShortAddress; + gpMacCore_GetAssociationPermit_Output_marshall_struct_t gpMacCore_GetAssociationPermit; + gpMacCore_GetBeaconPayload_Output_marshall_struct_t gpMacCore_GetBeaconPayload; + gpMacCore_GetBeaconPayloadLength_Output_marshall_struct_t gpMacCore_GetBeaconPayloadLength; + gpMacCore_GetMacVersion_Output_marshall_struct_t gpMacCore_GetMacVersion; + gpMacCore_GetIndicateBeaconNotifications_Output_marshall_struct_t gpMacCore_GetIndicateBeaconNotifications; + gpMacCore_GetCCAMode_Output_marshall_struct_t gpMacCore_GetCCAMode; + gpMacCore_GetMinBE_Output_marshall_struct_t gpMacCore_GetMinBE; + gpMacCore_GetPromiscuousMode_Output_marshall_struct_t gpMacCore_GetPromiscuousMode; + gpMacCore_GetForwardPollIndications_Output_marshall_struct_t gpMacCore_GetForwardPollIndications; + gpMacCore_GetMaxBE_Output_marshall_struct_t gpMacCore_GetMaxBE; + gpMacCore_AddNeighbour_Output_marshall_struct_t gpMacCore_AddNeighbour; + gpMacCore_RemoveNeighbour_Output_marshall_struct_t gpMacCore_RemoveNeighbour; + gpMacCore_SetDataPendingMode_Output_marshall_struct_t gpMacCore_SetDataPendingMode; + gpMacCore_GetCsmaMode_Output_marshall_struct_t gpMacCore_GetCsmaMode; + gpMacCore_ScheduleTimedTx_Output_marshall_struct_t gpMacCore_ScheduleTimedTx; + gpMacCore_DataPending_QueueAdd_Output_marshall_struct_t gpMacCore_DataPending_QueueAdd; + gpMacCore_DataPending_QueueRemove_Output_marshall_struct_t gpMacCore_DataPending_QueueRemove; + gpMacCore_SetMinInterferenceLevels_Output_marshall_struct_t gpMacCore_SetMinInterferenceLevels; + gpMacCore_DataPending_QueueClear_Output_marshall_struct_t gpMacCore_DataPending_QueueClear; + gpMacCore_DataPendingGetAckDataPending_Output_marshall_struct_t gpMacCore_DataPendingGetAckDataPending; + gpMacCore_GetStackInRawMode_Output_marshall_struct_t gpMacCore_GetStackInRawMode; + gpMacCore_GetCurrentTimeUs_Output_marshall_struct_t gpMacCore_GetCurrentTimeUs; + gpMacCore_ConfigureEnhAckProbing_Output_marshall_struct_t gpMacCore_ConfigureEnhAckProbing; + gpMacCore_GetRetransmitOnCcaFail_Output_marshall_struct_t gpMacCore_GetRetransmitOnCcaFail; + gpMacCore_GetRetransmitRandomBackoff_Output_marshall_struct_t gpMacCore_GetRetransmitRandomBackoff; + gpMacCore_GetMinBeRetransmit_Output_marshall_struct_t gpMacCore_GetMinBeRetransmit; + gpMacCore_GetMaxBeRetransmit_Output_marshall_struct_t gpMacCore_GetMaxBeRetransmit; + UInt8 dummy; //ensure none empty union definition +} gpMacCore_Server_Output_union_t; + +typedef union { +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbDataConfirm_Input_marshall_struct_t gpMacCore_cbDataConfirm; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbDataIndication_Input_marshall_struct_t gpMacCore_cbDataIndication; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbScanConfirm_Input_marshall_struct_t gpMacCore_cbScanConfirm; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbBeaconNotifyIndication_Input_marshall_struct_t gpMacCore_cbBeaconNotifyIndication; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbOrphanIndication_Input_marshall_struct_t gpMacCore_cbOrphanIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t gpMacCore_cbSecurityFailureCommStatusIndication; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbPollConfirm_Input_marshall_struct_t gpMacCore_cbPollConfirm; +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbPollIndication_Input_marshall_struct_t gpMacCore_cbPollIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbAssociateConfirm_Input_marshall_struct_t gpMacCore_cbAssociateConfirm; +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbAssociateIndication_Input_marshall_struct_t gpMacCore_cbAssociateIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbAssociateCommStatusIndication_Input_marshall_struct_t gpMacCore_cbAssociateCommStatusIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbOrphanCommStatusIndication_Input_marshall_struct_t gpMacCore_cbOrphanCommStatusIndication; +#endif /* defined(GP_MACCORE_DIVERSITY_SCAN_ORPHAN_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbValidStack_Input_marshall_struct_t gpMacCore_cbValidStack; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbPurgeConfirm_Input_marshall_struct_t gpMacCore_cbPurgeConfirm; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbPollNotify_Input_marshall_struct_t gpMacCore_cbPollNotify; +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !(defined(GP_COMP_MACDISPATCHER)) + gpMacCore_cbSecurityFrameCounterIndication_Input_marshall_struct_t gpMacCore_cbSecurityFrameCounterIndication; +#endif /* !(defined(GP_COMP_MACDISPATCHER)) */ + UInt8 dummy; //ensure none empty union definition +} gpMacCore_Client_Input_union_t; + + +typedef union { +#if !defined(GP_COMP_MACDISPATCHER) + gpMacCore_cbValidStack_Output_marshall_struct_t gpMacCore_cbValidStack; +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ + UInt8 dummy; //ensure none empty union definition +} gpMacCore_Client_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpMacCore_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_FrameType_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_FrameType_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_FrameType_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_FrameType_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_Command_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_Command_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_Command_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_Command_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_AddressMode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_AddressMode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_AddressMode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_AddressMode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIdLookupListEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIdLookupListEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIdLookupListEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIdLookupListEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyDeviceListEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyDeviceListEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyDeviceListEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyDeviceListEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyUsageListEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyUsageListEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyUsageListEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyUsageListEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyTablesEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyTablesEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyTablesEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyTablesEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_SecurityLevelTableEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_SecurityLevelTableEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_SecurityLevelTableEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_SecurityLevelTableEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIndex_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIndex_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIndex_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIndex_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIdMode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIdMode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_KeyIdMode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_KeyIdMode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_ScanType_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_ScanType_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_ScanType_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_ScanType_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_Attribute_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_Attribute_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_Attribute_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_Attribute_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_Index_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_Index_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_Index_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_Index_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_DeviceTablesEntries_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_DeviceTablesEntries_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_DeviceTablesEntries_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_DeviceTablesEntries_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_StackId_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_StackId_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_StackId_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_StackId_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_PanId_t_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_PanId_t_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_PanId_t_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_PanId_t_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_SuperFrameSpec_t_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_SuperFrameSpec_t_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_SuperFrameSpec_t_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_SuperFrameSpec_t_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_MacVersion_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_MacVersion_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_MacVersion_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_MacVersion_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_DataPendingMode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_DataPendingMode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_DataPendingMode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_DataPendingMode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacCore_TxPower_t_buf2api(pDest, pSource, length, pIndex) Int8_buf2api(pDest, pSource, length, pIndex) +#define gpMacCore_TxPower_t_api2buf(pDest, pSource, length, pIndex) Int8_api2buf(pDest, pSource, length, pIndex) +#define gpMacCore_TxPower_t_buf2api_1(pDest, pSource, pIndex) Int8_buf2api_1(pDest, pSource, pIndex) +#define gpMacCore_TxPower_t_api2buf_1(pDest, pSource, pIndex) Int8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +gpMarshall_AckStatus_t gpMacCore_DeviceDescriptor_t_buf2api(gpMacCore_DeviceDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_DeviceDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DeviceDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeyUsageDescriptor_t_buf2api(gpMacCore_KeyUsageDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_KeyUsageDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyUsageDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeyDeviceDescriptor_t_buf2api(gpMacCore_KeyDeviceDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_KeyDeviceDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyDeviceDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_Security_t_buf2api(gpMacCore_Security_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_Security_t_api2buf(UInt8Buffer* pDest , const gpMacCore_Security_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_AddressInfo_t_buf2api(gpMacCore_AddressInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_AddressInfo_t_api2buf(UInt8Buffer* pDest , const gpMacCore_AddressInfo_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_PanDescriptor_t_buf2api(gpMacCore_PanDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_PanDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_PanDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeyIdLookupDescriptor_t_buf2api(gpMacCore_KeyIdLookupDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_KeyIdLookupDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyIdLookupDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeyDescriptor_t_buf2api(gpMacCore_KeyDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_KeyDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SecurityLevelDescriptor_t_buf2api(gpMacCore_SecurityLevelDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_SecurityLevelDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_SecurityLevelDescriptor_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_MultiChannelOptions_t_buf2api(gpMacCore_MultiChannelOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_MultiChannelOptions_t_api2buf(UInt8Buffer* pDest , const gpMacCore_MultiChannelOptions_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_TxTimingOptions_t_buf2api(gpMacCore_TxTimingOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_TxTimingOptions_t_api2buf(UInt8Buffer* pDest , const gpMacCore_TxTimingOptions_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DiagRxCntr_t_buf2api(gpMacCore_DiagRxCntr_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_DiagRxCntr_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DiagRxCntr_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DiagTxCntr_t_buf2api(gpMacCore_DiagTxCntr_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacCore_DiagTxCntr_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DiagTxCntr_t* pSource , UInt16 length , UInt16* pIndex); + +// Union copy functions +gpMarshall_AckStatus_t gpMacCore_Address_t_buf2api(UInt8 unionid , gpMacCore_Address_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex); +void gpMacCore_Address_t_api2buf(UInt8 unionid , UInt8Buffer* pDest , const gpMacCore_Address_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_KeySource_t_buf2api(UInt8 unionid , gpMacCore_KeySource_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex); +void gpMacCore_KeySource_t_api2buf(UInt8 unionid , UInt8Buffer* pDest , const gpMacCore_KeySource_t* pSource , UInt16 length , UInt16* pIndex); + +// Server functions +gpMarshall_AckStatus_t gpMacCore_Reset_Input_buf2api(gpMacCore_Reset_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_Reset_Output_api2buf(UInt8Buffer* pDest , gpMacCore_Reset_Output_marshall_struct_t* pSourceoutput , gpMacCore_Reset_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DataRequest_Input_buf2api(gpMacCore_DataRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_ScanRequest_Input_buf2api(gpMacCore_ScanRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_AssociateRequest_Input_buf2api(gpMacCore_AssociateRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_AssociateResponse_Input_buf2api(gpMacCore_AssociateResponse_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_PollRequest_Input_buf2api(gpMacCore_PollRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_Start_Input_buf2api(gpMacCore_Start_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_Start_Output_api2buf(UInt8Buffer* pDest , gpMacCore_Start_Output_marshall_struct_t* pSourceoutput , gpMacCore_Start_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetSecurityEnabled_Input_buf2api(gpMacCore_SetSecurityEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDeviceDescriptor_Input_buf2api(gpMacCore_SetDeviceDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDeviceDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetDeviceDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetDeviceDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetDeviceDescriptor_Input_buf2api(gpMacCore_GetDeviceDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDeviceDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetDeviceDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetDeviceDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDeviceTableEntries_Input_buf2api(gpMacCore_SetDeviceTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDeviceTableEntries_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetDeviceTableEntries_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetKeyDescriptor_Input_buf2api(gpMacCore_SetKeyDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetKeyDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetKeyDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetKeyDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetKeyDescriptor_Input_buf2api(gpMacCore_GetKeyDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetKeyDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetKeyDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetKeyDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetKeyTableEntries_Input_buf2api(gpMacCore_SetKeyTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetSecurityLevelDescriptor_Input_buf2api(gpMacCore_SetSecurityLevelDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetSecurityLevelDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetSecurityLevelDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetSecurityLevelDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetSecurityLevelDescriptor_Input_buf2api(gpMacCore_GetSecurityLevelDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetSecurityLevelDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetSecurityLevelDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetSecurityLevelDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetSecurityLevelTableEntries_Input_buf2api(gpMacCore_SetSecurityLevelTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetSecurityLevelTableEntries_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetSecurityLevelTableEntries_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDefaultKeySource_Input_buf2api(gpMacCore_SetDefaultKeySource_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetShortAddress_Input_buf2api(gpMacCore_SetShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetExtendedAddress_Input_buf2api(gpMacCore_SetExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPanId_Input_buf2api(gpMacCore_SetPanId_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetPanId_Input_buf2api(gpMacCore_GetPanId_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPanId_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetPanId_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetPanId_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetFrameCounter_Input_buf2api(gpMacCore_SetFrameCounter_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDsn_Input_buf2api(gpMacCore_SetDsn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCurrentChannel_Input_buf2api(gpMacCore_SetCurrentChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetBeaconPayload_Input_buf2api(gpMacCore_SetBeaconPayload_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetBeaconPayloadLength_Input_buf2api(gpMacCore_SetBeaconPayloadLength_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetRxOnWhenIdle_Input_buf2api(gpMacCore_SetRxOnWhenIdle_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetExtendedAddress_Input_buf2api(gpMacCore_GetExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMaxCsmaBackoffs_Input_buf2api(gpMacCore_SetMaxCsmaBackoffs_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMaxCsmaBackoffs_Input_buf2api(gpMacCore_GetMaxCsmaBackoffs_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMaxCsmaBackoffs_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMaxCsmaBackoffs_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMaxCsmaBackoffs_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetDsn_Input_buf2api(gpMacCore_GetDsn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDsn_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetDsn_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetDsn_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCurrentChannel_Input_buf2api(gpMacCore_GetCurrentChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCurrentChannel_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCurrentChannel_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCurrentChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetNumberOfRetries_Input_buf2api(gpMacCore_SetNumberOfRetries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetNumberOfRetries_Input_buf2api(gpMacCore_GetNumberOfRetries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetNumberOfRetries_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetNumberOfRetries_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetNumberOfRetries_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetFrameCounter_Input_buf2api(gpMacCore_GetFrameCounter_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetFrameCounter_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetFrameCounter_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetFrameCounter_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetRxOnWhenIdle_Input_buf2api(gpMacCore_GetRxOnWhenIdle_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetRxOnWhenIdle_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetRxOnWhenIdle_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetRxOnWhenIdle_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetShortAddress_Input_buf2api(gpMacCore_GetShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetShortAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetShortAddress_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetShortAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPanCoordShortAddress_Input_buf2api(gpMacCore_SetPanCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPanCoordExtendedAddress_Input_buf2api(gpMacCore_SetPanCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetAssociationPermit_Input_buf2api(gpMacCore_SetAssociationPermit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDefaultTransmitPowers_Input_buf2api(gpMacCore_SetDefaultTransmitPowers_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetTransmitPower_Input_buf2api(gpMacCore_SetTransmitPower_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetTransmitPower_Input_buf2api(gpMacCore_GetTransmitPower_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetTransmitPower_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetTransmitPower_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetTransmitPower_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPanCoordinator_Input_buf2api(gpMacCore_SetPanCoordinator_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetPanCoordinator_Input_buf2api(gpMacCore_GetPanCoordinator_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPanCoordinator_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetPanCoordinator_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetPanCoordinator_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_OrphanResponse_Input_buf2api(gpMacCore_OrphanResponse_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetSecurityEnabled_Input_buf2api(gpMacCore_GetSecurityEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetSecurityEnabled_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetSecurityEnabled_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetSecurityEnabled_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetTransactionPersistenceTime_Input_buf2api(gpMacCore_GetTransactionPersistenceTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetTransactionPersistenceTime_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetTransactionPersistenceTime_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetTransactionPersistenceTime_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetTransactionPersistenceTime_Input_buf2api(gpMacCore_SetTransactionPersistenceTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetBeaconStarted_Input_buf2api(gpMacCore_SetBeaconStarted_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetBeaconStarted_Input_buf2api(gpMacCore_GetBeaconStarted_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconStarted_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetBeaconStarted_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetBeaconStarted_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpMacCore_GetPanCoordExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetPanCoordExtendedAddress_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCoordExtendedAddress_Input_buf2api(gpMacCore_SetCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCoordExtendedAddress_Input_buf2api(gpMacCore_GetCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCoordExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCoordExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCoordExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCoordShortAddress_Input_buf2api(gpMacCore_SetCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCoordShortAddress_Input_buf2api(gpMacCore_GetCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCoordShortAddress_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCoordShortAddress_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCoordShortAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetAssociationPermit_Input_buf2api(gpMacCore_GetAssociationPermit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetAssociationPermit_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetAssociationPermit_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetAssociationPermit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetBeaconPayload_Input_buf2api(gpMacCore_GetBeaconPayload_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconPayload_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetBeaconPayload_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetBeaconPayload_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetBeaconPayloadLength_Input_buf2api(gpMacCore_GetBeaconPayloadLength_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconPayloadLength_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetBeaconPayloadLength_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetBeaconPayloadLength_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetIndicateBeaconNotifications_Input_buf2api(gpMacCore_SetIndicateBeaconNotifications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetPromiscuousMode_Input_buf2api(gpMacCore_SetPromiscuousMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMacVersion_Input_buf2api(gpMacCore_SetMacVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMacVersion_Input_buf2api(gpMacCore_GetMacVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMacVersion_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMacVersion_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMacVersion_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_StackAdded_Input_buf2api(gpMacCore_StackAdded_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_StackRemoved_Input_buf2api(gpMacCore_StackRemoved_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetIndicateBeaconNotifications_Input_buf2api(gpMacCore_GetIndicateBeaconNotifications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetIndicateBeaconNotifications_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetIndicateBeaconNotifications_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetIndicateBeaconNotifications_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCCAMode_Input_buf2api(gpMacCore_SetCCAMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCCAMode_Input_buf2api(gpMacCore_GetCCAMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCCAMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCCAMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCCAMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMinBE_Input_buf2api(gpMacCore_SetMinBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMinBE_Input_buf2api(gpMacCore_GetMinBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMinBE_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMinBE_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMinBE_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetPromiscuousMode_Input_buf2api(gpMacCore_GetPromiscuousMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPromiscuousMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetPromiscuousMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetPromiscuousMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_PurgeRequest_Input_buf2api(gpMacCore_PurgeRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetForwardPollIndications_Input_buf2api(gpMacCore_SetForwardPollIndications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetForwardPollIndications_Input_buf2api(gpMacCore_GetForwardPollIndications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetForwardPollIndications_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetForwardPollIndications_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetForwardPollIndications_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMaxBE_Input_buf2api(gpMacCore_SetMaxBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMaxBE_Input_buf2api(gpMacCore_GetMaxBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMaxBE_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMaxBE_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMaxBE_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_AddNeighbour_Input_buf2api(gpMacCore_AddNeighbour_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_AddNeighbour_Output_api2buf(UInt8Buffer* pDest , gpMacCore_AddNeighbour_Output_marshall_struct_t* pSourceoutput , gpMacCore_AddNeighbour_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_RemoveNeighbour_Input_buf2api(gpMacCore_RemoveNeighbour_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_RemoveNeighbour_Output_api2buf(UInt8Buffer* pDest , gpMacCore_RemoveNeighbour_Output_marshall_struct_t* pSourceoutput , gpMacCore_RemoveNeighbour_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetDataPendingMode_Input_buf2api(gpMacCore_SetDataPendingMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDataPendingMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetDataPendingMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetDataPendingMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetAddressModeOverrideForBeacons_Input_buf2api(gpMacCore_SetAddressModeOverrideForBeacons_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_ClearNeighbours_Input_buf2api(gpMacCore_ClearNeighbours_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetCsmaMode_Input_buf2api(gpMacCore_SetCsmaMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetCsmaMode_Input_buf2api(gpMacCore_GetCsmaMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCsmaMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCsmaMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetCsmaMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_ScheduleTimedTx_Input_buf2api(gpMacCore_ScheduleTimedTx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_ScheduleTimedTx_Output_api2buf(UInt8Buffer* pDest , gpMacCore_ScheduleTimedTx_Output_marshall_struct_t* pSourceoutput , gpMacCore_ScheduleTimedTx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DataPending_QueueAdd_Input_buf2api(gpMacCore_DataPending_QueueAdd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueAdd_Output_api2buf(UInt8Buffer* pDest , gpMacCore_DataPending_QueueAdd_Output_marshall_struct_t* pSourceoutput , gpMacCore_DataPending_QueueAdd_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DataPending_QueueRemove_Input_buf2api(gpMacCore_DataPending_QueueRemove_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueRemove_Output_api2buf(UInt8Buffer* pDest , gpMacCore_DataPending_QueueRemove_Output_marshall_struct_t* pSourceoutput , gpMacCore_DataPending_QueueRemove_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMinInterferenceLevels_Input_buf2api(gpMacCore_SetMinInterferenceLevels_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMinInterferenceLevels_Output_api2buf(UInt8Buffer* pDest , gpMacCore_SetMinInterferenceLevels_Output_marshall_struct_t* pSourceoutput , gpMacCore_SetMinInterferenceLevels_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DataPending_QueueClear_Input_buf2api(gpMacCore_DataPending_QueueClear_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueClear_Output_api2buf(UInt8Buffer* pDest , gpMacCore_DataPending_QueueClear_Output_marshall_struct_t* pSourceoutput , gpMacCore_DataPending_QueueClear_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpMacCore_DataPendingGetAckDataPending_Output_api2buf(UInt8Buffer* pDest , gpMacCore_DataPendingGetAckDataPending_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetStackInRawMode_Input_buf2api(gpMacCore_SetStackInRawMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetStackInRawMode_Input_buf2api(gpMacCore_GetStackInRawMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetStackInRawMode_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetStackInRawMode_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetStackInRawMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_EnableEnhancedFramePending_Input_buf2api(gpMacCore_EnableEnhancedFramePending_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_EnableRxWindows_Input_buf2api(gpMacCore_EnableRxWindows_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_DisableRxWindows_Input_buf2api(gpMacCore_DisableRxWindows_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_EnableCsl_Input_buf2api(gpMacCore_EnableCsl_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_UpdateCslSampleTime_Input_buf2api(gpMacCore_UpdateCslSampleTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCurrentTimeUs_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetCurrentTimeUs_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_ConfigureEnhAckProbing_Input_buf2api(gpMacCore_ConfigureEnhAckProbing_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_ConfigureEnhAckProbing_Output_api2buf(UInt8Buffer* pDest , gpMacCore_ConfigureEnhAckProbing_Output_marshall_struct_t* pSourceoutput , gpMacCore_ConfigureEnhAckProbing_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetRetransmitOnCcaFail_Input_buf2api(gpMacCore_SetRetransmitOnCcaFail_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetRetransmitOnCcaFail_Input_buf2api(gpMacCore_GetRetransmitOnCcaFail_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetRetransmitOnCcaFail_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetRetransmitOnCcaFail_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetRetransmitOnCcaFail_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetRetransmitRandomBackoff_Input_buf2api(gpMacCore_SetRetransmitRandomBackoff_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetRetransmitRandomBackoff_Input_buf2api(gpMacCore_GetRetransmitRandomBackoff_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetRetransmitRandomBackoff_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetRetransmitRandomBackoff_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetRetransmitRandomBackoff_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMinBeRetransmit_Input_buf2api(gpMacCore_SetMinBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMinBeRetransmit_Input_buf2api(gpMacCore_GetMinBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMinBeRetransmit_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMinBeRetransmit_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMinBeRetransmit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_SetMaxBeRetransmit_Input_buf2api(gpMacCore_SetMaxBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacCore_GetMaxBeRetransmit_Input_buf2api(gpMacCore_GetMaxBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetMaxBeRetransmit_Output_api2buf(UInt8Buffer* pDest , gpMacCore_GetMaxBeRetransmit_Output_marshall_struct_t* pSourceoutput , gpMacCore_GetMaxBeRetransmit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbDataConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpPd_Handle_t pdHandle , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbDataIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddrInfo , gpMacCore_AddressInfo_t* pDstAddrInfo , UInt8 dsn , gpMacCore_Security_t* pSecOptions , gpPd_Loh_t pdLoh , gpMacCore_StackId_t stackId , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbScanConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpMacCore_ScanType_t scanType , UInt32 unscannedChannels , UInt8 resultListSize , UInt8* pEdScanResultList , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbBeaconNotifyIndication_Input_par2api(UInt8Buffer* pDest , UInt8 bsn , gpMacCore_PanDescriptor_t* pPanDescriptor , gpMacCore_StackId_t stackId , UInt8 beaconPayloadLength , UInt8* pBeaconPayload , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbOrphanIndication_Input_par2api(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t rxTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbSecurityFailureCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddressInfo , gpMacCore_AddressInfo_t* pDstAddressInfo , gpMacCore_Result_t status , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbPollConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpMacCore_AddressInfo_t* coordAddrInfo , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbPollIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* addressInfo , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t rxTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbAssociateConfirm_Input_par2api(UInt8Buffer* pDest , UInt16 assocShortAddress , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbAssociateIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_Address_t* pDeviceAddress , UInt8 capabilityInformation , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t rxTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbAssociateCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddressInfo , gpMacCore_AddressInfo_t* pDstAddressInfo , gpMacCore_Result_t status , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbOrphanCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddressInfo , gpMacCore_AddressInfo_t* pDstAddressInfo , gpMacCore_Result_t status , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t txTime , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_SCAN_ORPHAN_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbValidStack_Input_par2api(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_cbValidStack_Output_buf2par(Bool* valid , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbPurgeConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpPd_Handle_t pdHandle , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +void gpMacCore_cbPollNotify_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* addressInfo , gpMacCore_StackId_t stackId , gpPd_TimeStamp_t rxTime , gpPd_Handle_t pdHandle , Bool fromNeighbour , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !(defined(GP_COMP_MACDISPATCHER)) +void gpMacCore_cbSecurityFrameCounterIndication_Input_par2api(UInt8Buffer* pDest , UInt32 frameCounter , gpMacCore_StackId_t stackId , UInt16* pIndex); +#endif /* !(defined(GP_COMP_MACDISPATCHER)) */ + +// Client functions +void gpMacCore_Reset_Input_par2buf(UInt8Buffer* pDest , Bool setDefaultPib , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_Reset_Output_buf2par(gpMacCore_Result_t* result , Bool setDefaultPib , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressMode_t srcAddrMode , gpMacCore_AddressInfo_t* pDstAddressInfo , UInt8 txOptions , gpMacCore_Security_t* pSecOptions , gpMacCore_MultiChannelOptions_t multiChannelOptions , gpPd_Loh_t pdLoh , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_ScanRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_ScanType_t scanType , UInt32 scanChannels , UInt8 scanDuration , UInt8 resultListSize , UInt8* pEdScanResultList , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_AssociateRequest_Input_par2buf(UInt8Buffer* pDest , UInt8 logicalChannel , gpMacCore_AddressInfo_t* coordAddrInfo , UInt8 capabilityInformation , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_AssociateResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pDeviceAddress , UInt16 associateShortAddress , gpMacCore_Result_t status , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_PollRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* coordAddrInfo , gpMacCore_Security_t* pSecOptions , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_Start_Input_par2buf(UInt8Buffer* pDest , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_Start_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , Bool securityEnabled , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_SetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_GetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceTablesEntries_t deviceTableEntries , UInt16* pIndex); +void gpMacCore_GetDeviceTableEntries_Output_buf2par(gpMacCore_DeviceTablesEntries_t* deviceTableEntries , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_SetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_GetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetKeyTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyTablesEntries_t keyTableEntries , UInt16* pIndex); +void gpMacCore_SetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_SetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , UInt16* pIndex); +void gpMacCore_GetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries , UInt16* pIndex); +void gpMacCore_GetSecurityLevelTableEntries_Output_buf2par(gpMacCore_SecurityLevelTableEntries_t* securityLevelTableEntries , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDefaultKeySource_Input_par2buf(UInt8Buffer* pDest , UInt8* pDefaultKeySource , UInt16* pIndex); +void gpMacCore_SetShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 shortAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pExtendedAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetPanId_Input_par2buf(UInt8Buffer* pDest , UInt16 panId , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPanId_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPanId_Output_buf2par(gpMacCore_PanId_t* panId , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetFrameCounter_Input_par2buf(UInt8Buffer* pDest , UInt32 frameCounter , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetDsn_Input_par2buf(UInt8Buffer* pDest , UInt8 dsn , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , UInt8* pBeaconPayload , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , UInt8 beaconPayloadLength , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , Bool rxOnWhenIdle , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetExtendedAddress_Output_buf2par(MACAddress_t* pExtendedAddress , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , UInt8 maxCsmaBackoffs , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxCsmaBackoffs_Output_buf2par(UInt8* maxCsmaBackoffs , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetDsn_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetDsn_Output_buf2par(UInt8* dsn , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCurrentChannel_Output_buf2par(UInt8* channel , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , UInt8 numberOfRetries , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetNumberOfRetries_Output_buf2par(UInt8* numberOfRetries , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetFrameCounter_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetFrameCounter_Output_buf2par(UInt32* frameCounter , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRxOnWhenIdle_Output_buf2par(Bool* rxOnWhenIdle , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetShortAddress_Output_buf2par(UInt16* address , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetPanCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 panCoordShortAddress , UInt16* pIndex); +void gpMacCore_SetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pPanCoordExtendedAddress , UInt16* pIndex); +void gpMacCore_SetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , Bool associationPermit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetDefaultTransmitPowers_Input_par2buf(UInt8Buffer* pDest , Int8* pDefaultTransmitPowerTable , UInt16* pIndex); +void gpMacCore_SetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacCore_TxPower_t transmitPower , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetTransmitPower_Output_buf2par(Int8* transmitPower , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , Bool panCoordinator , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPanCoordinator_Output_buf2par(Bool* panCoordinator , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_OrphanResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , UInt16 shortAddress , Bool associatedMember , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetSecurityEnabled_Output_buf2par(Bool* securityEnabled , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetTransactionPersistenceTime_Output_buf2par(UInt16* time , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , UInt16 time , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , Bool BeaconStarted , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetBeaconStarted_Output_buf2par(Bool* BeaconStarted , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPanCoordExtendedAddress_Output_buf2par(MACAddress_t* pPanCoordExtendedAddress , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pPanCoordExtendedAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCoordExtendedAddress_Output_buf2par(MACAddress_t* pPanCoordExtendedAddress , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 panCoordShortAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCoordShortAddress_Output_buf2par(UInt16* panCoordShortAddress , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetAssociationPermit_Output_buf2par(Bool* associationPermit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetBeaconPayload_Output_buf2par(UInt8* pBeaconPayload , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetBeaconPayloadLength_Output_buf2par(UInt8* beaconPayloadLength , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , UInt8 promiscuousMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacCore_MacVersion_t macVersion , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMacVersion_Output_buf2par(gpMacCore_MacVersion_t* macVersion , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_StackAdded_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_StackRemoved_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetIndicateBeaconNotifications_Output_buf2par(Bool* enabled , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetCCAMode_Input_par2buf(UInt8Buffer* pDest , UInt8 cCAMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCCAMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCCAMode_Output_buf2par(UInt8* cCAMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMinBE_Input_par2buf(UInt8Buffer* pDest , UInt8 minBE , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMinBE_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMinBE_Output_buf2par(UInt8* minBE , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_GetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetPromiscuousMode_Output_buf2par(Bool* promiscuousMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_PurgeRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetForwardPollIndications_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMaxBE_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBE , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxBE_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxBE_Output_buf2par(UInt8* maxBE , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_AddNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_AddNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_RemoveNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_RemoveNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetDataPendingMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetDataPendingMode_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetAddressModeOverrideForBeacons_Input_par2buf(UInt8Buffer* pDest , UInt8 addressMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_ClearNeighbours_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_SetCsmaMode_Input_par2buf(UInt8Buffer* pDest , UInt8 csmaMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCsmaMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCsmaMode_Output_buf2par(UInt8* csmaMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_ScheduleTimedTx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacCore_TxTimingOptions_t timingOptions , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_ScheduleTimedTx_Output_buf2par(gpMacCore_Result_t* result , gpPd_Handle_t pdHandle , gpMacCore_TxTimingOptions_t timingOptions , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueAdd_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_DataPending_QueueAdd_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueRemove_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_DataPending_QueueRemove_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMinInterferenceLevels_Input_par2buf(UInt8Buffer* pDest , Int8* pInterferenceLevels , UInt16* pIndex); +void gpMacCore_SetMinInterferenceLevels_Output_buf2par(gpMacCore_Result_t* result , Int8* pInterferenceLevels , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPending_QueueClear_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_DataPending_QueueClear_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_DataPendingGetAckDataPending_Output_buf2par(Bool* pending , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , Bool rawModeEnabled , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetStackInRawMode_Output_buf2par(Bool* rawModeEnabled , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_EnableEnhancedFramePending_Input_par2buf(UInt8Buffer* pDest , Bool enableEnhancedFramePending , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_EnableRxWindows_Input_par2buf(UInt8Buffer* pDest , UInt32 dutyCycleOnTime , UInt32 dutyCyclePeriod , UInt16 recurrenceAmount , UInt32 startTime , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_DisableRxWindows_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_EnableCsl_Input_par2buf(UInt8Buffer* pDest , UInt16 dutyCyclePeriod , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_UpdateCslSampleTime_Input_par2buf(UInt8Buffer* pDest , UInt32 nextCslSampleTime , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetCurrentTimeUs_Output_buf2par(UInt32* currentTime , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_ConfigureEnhAckProbing_Input_par2buf(UInt8Buffer* pDest , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_ConfigureEnhAckProbing_Output_buf2par(gpMacCore_Result_t* result , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRetransmitOnCcaFail_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetRetransmitRandomBackoff_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 minBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMinBeRetransmit_Output_buf2par(UInt8* minBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_SetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacCore_GetMaxBeRetransmit_Output_buf2par(UInt8* maxBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbDataConfirm_Input_buf2api(gpMacCore_cbDataConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbDataIndication_Input_buf2api(gpMacCore_cbDataIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbScanConfirm_Input_buf2api(gpMacCore_cbScanConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbBeaconNotifyIndication_Input_buf2api(gpMacCore_cbBeaconNotifyIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbOrphanIndication_Input_buf2api(gpMacCore_cbOrphanIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbSecurityFailureCommStatusIndication_Input_buf2api(gpMacCore_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbPollConfirm_Input_buf2api(gpMacCore_cbPollConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbPollIndication_Input_buf2api(gpMacCore_cbPollIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbAssociateConfirm_Input_buf2api(gpMacCore_cbAssociateConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_ORIGINATOR) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbAssociateIndication_Input_buf2api(gpMacCore_cbAssociateIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbAssociateCommStatusIndication_Input_buf2api(gpMacCore_cbAssociateCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_ASSOCIATION_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbOrphanCommStatusIndication_Input_buf2api(gpMacCore_cbOrphanCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_SCAN_ORPHAN_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbValidStack_Input_buf2api(gpMacCore_cbValidStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacCore_cbValidStack_Output_api2buf(UInt8Buffer* pDest , gpMacCore_cbValidStack_Output_marshall_struct_t* pSourceoutput , gpMacCore_cbValidStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbPurgeConfirm_Input_buf2api(gpMacCore_cbPurgeConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER) */ +#if !defined(GP_COMP_MACDISPATCHER) +gpMarshall_AckStatus_t gpMacCore_cbPollNotify_Input_buf2api(gpMacCore_cbPollNotify_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* defined(GP_MACCORE_DIVERSITY_POLL_RECIPIENT) && (defined(GP_MACCORE_FORCE_INDICATION_DEFINITION)||!defined(GP_COMP_MACDISPATCHER)) */ +#if !(defined(GP_COMP_MACDISPATCHER)) +gpMarshall_AckStatus_t gpMacCore_cbSecurityFrameCounterIndication_Input_buf2api(gpMacCore_cbSecurityFrameCounterIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* !(defined(GP_COMP_MACDISPATCHER)) */ + +void gpMacCore_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPMACCORE_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/inc/gpMacCore.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/inc/gpMacCore.h new file mode 100644 index 0000000..91696de --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/inc/gpMacCore.h @@ -0,0 +1,1769 @@ +/* + * Copyright (c) 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2022, Qorvo Inc + * + * gpMacCore.h + * This file contains the definitions of the public functions and enumerations of the gpMacCore.(based on IEEE802.15.4-2006) + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GP_MACCORE_H_ +#define _GP_MACCORE_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpEncryption.h" +/** + * @file gpMacCore.h + * + * The Core functionality of the Mac layer is implemented in these functions. + * + * @defgroup INIT Initialization + * This module groups the primitives for the Initialization procedure. + * + * @defgroup MLME_DATA MLME-DATA primitives + * This module groups the primitives for data transmission. + * + * To transmit a data package the origniator needs to: + * - use gpPd_GetPd() to claim memory that will be used to write the data payload into the radio chip + * - trigger gpMacCore_DataRequest() with the claimed memory handle + * - wait until the gpMacCore_cbDataConfirm() callback has been called + * - use gpPd_FreePd(pdHandle) to free the claimed memory + * + * The receiving device should handle an incomming packet as follows: + * - gpMacCore_cbDataIndication() callback indicating the data was received + * - after reading the data from the radio chip with the gpPd_ReadByteStream((pdHandle, nsduOffset) function, + * use gpPd_FreePd(pdHandle) to free the memory + * + * @defgroup MLME_SAP MLME-SAP primitives + * This module groups the primitives for management commands. + * + * - gpMacCore_AssociateRequest() to initiate the association procedure + * - gpMacCore_AssociateResponse() the response + * - gpMacCore_cbBeaconNotifyIndication() + * - gpMacCore_PollRequest() + * - gpMacCore_Reset() + * - gpMacCore_ScanRequest() to initiate a scan process + * +*/ + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_DIVERSITY_NR_OF_STACKS +#define GP_DIVERSITY_NR_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS + +#define GP_MACCORE_PANID_BROADCAST 0xFFFF +#define GP_MACCORE_SHORT_ADDR_BROADCAST 0xFFFF +#define GP_MACCORE_SHORT_ADDR_UNALLOCATED 0xFFFE + +#define GP_MACCORE_MULTICHANNEL_MAX_CHANNELS 3 +#define GP_MACCORE_INVALID_CHANNEL 0xFF + +// phy definitions +/** @brief The minimal value that the header overhead can be in a frame (2 bytes framecontrol + 1 byte sequence number + 2 bytes FCS), as specified in the IEEE802.15.4-2006 spec.*/ +#define GP_MACCORE_MIN_FRAME_OVERHEAD 5 /* 2 framecontrol + 1 sequence number + 2 FCS */ +/** @brief The maximal number of bytes the header overhead can be in a beacon, as specified in the IEEE802.15.4-2006 spec.*/ +#define GP_MACCORE_MAX_BEACON_OVERHEAD 75 +/** @brief The maximal PHY length of a packet (in bytes), as specified in the IEEE802.15.4-2006 spec.*/ +#define GP_MACCORE_MAX_PHY_PACKET_SIZE 127 +/** @brief The maximal PHY length of a packet (in bytes), as specified in the IEEE802.15.4-2006 spec without the CRC bytes.*/ +#define GP_MACCORE_MAX_PHY_PACKET_SIZE_NO_FCS 125 +/** @brief The maximal length of the MAC payload (in bytes), as specified in the IEEE802.15.4-2006 spec.*/ +#define GP_MACCORE_MAX_MAC_FRAME_SIZE (GP_MACCORE_MAX_PHY_PACKET_SIZE - GP_MACCORE_MIN_FRAME_OVERHEAD) +/** @brief The maximal length of the beacon payload (in bytes), as specified in the IEEE802.15.4-2006 spec*/ +#define GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH GP_MACCORE_MAX_PHY_PACKET_SIZE - GP_MACCORE_MAX_BEACON_OVERHEAD +/** @brief The maximum number of octets added by the MAC sublayer to the PSDU without security, as specified in the IEEE 802.15.4 spec*/ +#define GP_MACCORE_MAX_MPDU_UNSECURED_OVERHEAD 25 // 23 bytes MAC Header + 2 bytes MAC footer +/** @brief The maximum number of octets that can be transmitted in the MAC Payload field of an unsecured MAC frame that will be guaranteed not to exceed aMaxPHYPacketSize., as specified in the IEEE 802.15.4 spec*/ +#define GP_MACCORE_MAX_MAC_SAVE_PAYLOAD_SIZE (GP_MACCORE_MAX_PHY_PACKET_SIZE - GP_MACCORE_MAX_MPDU_UNSECURED_OVERHEAD) + +/** @brief The number of symbols forming a superframe slot when the superframe order is equal to 0. */ +#define GP_MACCORE_BASE_SLOT_DURATION 60 +/** @brief The number of slots contained in any superframe. */ +#define GP_MACCORE_NUM_SUPERFRAME_SLOTS 16 +/** @brief The number of symbols forming a superframe when the superframe order is equal to 0. + * As it's defined in symbols, 960 needs to be multipled by 16us to get time in us = 15360us */ +#define GP_MACCORE_BASE_SUPERFRAME_DURATION GP_MACCORE_BASE_SLOT_DURATION*GP_MACCORE_NUM_SUPERFRAME_SLOTS +/** @brief Maximum scan duration that can be given to a San Request primitive. + * Actual scan window time is calculated with 'aBaseSuperframeDuration * (2^n + 1)' = 960 * 16 * (2^n + 1). + * A scanduration of 4 will give +- 260ms. */ +#define GP_MACCORE_MAX_SCAN_DURATION 14 + +/** @brief Maximum header byte size without security fields (23 bytes) */ +#define GP_MACCORE_MAX_MAC_HEADER_SIZE 23 +/** @brief Maximum security header byte size, consisting of security control (1), frame contorl (4) and keyIdentifier (0/1/5/9). */ +#define GP_MAC_MAX_MACCORE_SECURITY_PART_HEADER_SIZE 14 +/** @brief Maximum header byte size including security fields (23+14 = 37 bytes) */ +#define GP_MACCORE_MAX_MAC_SECURED_HEADER_SIZE (GP_MACCORE_MAX_MAC_HEADER_SIZE + GP_MAC_MAX_MACCORE_SECURITY_PART_HEADER_SIZE) + +// MAC constants +/** @brief The symbol duration in microseconds. Two symbols correspond to 1 transmitted byte. */ +#define GP_MACCORE_SYMBOL_DURATION 16 //us/symbool + +/** @brief RX-to-TX or TX-to-RX maximum turnaround time (in symbol periods). + * As specified in IEEE802.15.4-2006 paragraph 6.4.1. + */ +#define GP_MACCORE_TX_TO_RX_TURNAROUNDTIME 12 /* symbols */ +#define GP_MACCORE_RX_TO_TX_TURNAROUNDTIME 12 /* symbols */ +/** @brief The PHY header size in octets. + * As specified in IEEE802.15.4-2006 paragraph 6.3 PPDU format. + */ +#define GP_MACCORE_PHYHEADER_OCTETS (4 + 1 + 1) /* actual preamble + sdf + len field */ + +/** @brief The number of bits per modulation symbol. + * As specified in IEEE802.15.4-2006 paragraph 6.5 2450 MHz PHY specifications. + */ +#define GP_MACCORE_PHY_BITS_PER_SYMBOL 4 + +/** @brief The size of an ACK frame PDU without an encryption header in octets. + * As specified in IEEE802.15.4-2006 paragraph 7.2.2.3 Acknowledgment frame format. + */ +#define GP_MACCORE_MAX_PHY_ACK_PACKET_SIZE 5 + +/** @brief The size of an Enhanced ACK frame PDU with an encryption header in octets. + * As specified in IEEE802.15.4-2015 paragraph 7.3.3 Acknowledgment frame format. + * The current max value is the value with: + * Short Source addressing, Source Dest addressing, PanID compression, Aux header, + * One Thread CSL IE, and HT2 header termination. + */ +#define GP_MACCORE_MAX_PHY_ENHACK_PACKET_SIZE 29 + +/** @brief Max duration in us for transmitting a frame and receiving the corresponding ACK, without the CSMA time + */ +#define GP_MACCORE_MAX_TXFRAME_PLUS_RXACK_TIME(ack_size) ( (GP_MACCORE_RX_TO_TX_TURNAROUNDTIME * GP_MACCORE_SYMBOL_DURATION) + \ + ( ( GP_MACCORE_PHYHEADER_OCTETS + GP_MACCORE_MAX_PHY_PACKET_SIZE ) * \ + 8 / GP_MACCORE_PHY_BITS_PER_SYMBOL * GP_MACCORE_SYMBOL_DURATION) + \ + (GP_MACCORE_TX_TO_RX_TURNAROUNDTIME * GP_MACCORE_SYMBOL_DURATION) + \ + ( ( GP_MACCORE_PHYHEADER_OCTETS + ack_size ) * \ + 8 / GP_MACCORE_PHY_BITS_PER_SYMBOL * GP_MACCORE_SYMBOL_DURATION) \ + ) + +#define GP_MACCORE_MAX_TXFRAME_PLUS_RXNORMALACK_TIME GP_MACCORE_MAX_TXFRAME_PLUS_RXACK_TIME(GP_MACCORE_MAX_PHY_ACK_PACKET_SIZE) +#define GP_MACCORE_MAX_TXFRAME_PLUS_RXENHACK_TIME GP_MACCORE_MAX_TXFRAME_PLUS_RXACK_TIME(GP_MACCORE_MAX_PHY_ENHACK_PACKET_SIZE) + + +/** @brief The acknowledge duration time is used to define the time that the receiver stays + * enable waiting for an acknowledge frame after a transmitted packet that requires + * an acknowledge frame. + */ +#define GP_MACCORE_ACK_WAIT_DURATION 54 +/** @brief The channel mask of the supported channels. Bit 0 correspond to channel 0, bit 1 to channel 1,.... */ +#define GP_MACCORE_CHANNELS_SUPPORTED 0x3FF800 + +/** Scan duration for ScanTypeEDWifiBeacon in microseconds (typical Wifi beacon interval is 100 ms) */ +#define GP_MACCORE_WIFI_BEACON_SCAN_DURATION MS_TO_US(103) + +/** @brief The maximum number of octets that can be transmitted in the MAC Payload field.*/ +#define GP_MACCORE_MAX_MAC_SAFE_PAYLOAD_SIZE (GP_MACCORE_MAX_PHY_PACKET_SIZE - GP_MACCORE_MAX_MPDU_UNSECURED_OVERHEAD) + +// Scan related defines +#ifndef GP_MACCORE_SCAN_RXOFFWINDOW_TIME_US +#define GP_MACCORE_SCAN_RXOFFWINDOW_TIME_US 0 +#endif //GP_MACCORE_SCAN_RXOFFWINDOW_TIME_US + +// Security related defines +#ifndef GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS 5 +#endif //GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS + +#ifndef GP_MACCORE_NUMBER_OF_DEVICE_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_DEVICE_DESCRIPTORS 5 +#endif //GP_MACCORE_NUMBER_OF_DEVICE_DESCRIPTORS + +#ifndef GP_MACCORE_NUMBER_OF_KEY_DESCRIPTOR_ENTRIES +#define GP_MACCORE_NUMBER_OF_KEY_DESCRIPTOR_ENTRIES 5 +#endif //GP_MACCORE_NUMBER_OF_KEY_DESCRIPTOR_ENTRIES + +#ifndef GP_MACCORE_NUMBER_OF_SECURITY_LEVEL_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_SECURITY_LEVEL_DESCRIPTORS 1 +#endif //GP_MACCORE_NUMBER_OF_SECURITY_LEVEL_DESCRIPTORS + +#ifndef GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS 3 +#endif //GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS + +#ifndef GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS +#define GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS 2 +#endif //GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS + +/** @brief Return stack identifier when no stack is found */ +#define GP_MACCORE_STACK_UNDEFINED 0xff + +// Compile time definitions to optimize single stack code size +#if (GP_DIVERSITY_NR_OF_STACKS > 1) || (defined(GP_DIVERSITY_JUMPTABLES)) +#define MACCORE_STACKID_REF stackId +#define MACCORE_STACKID_ARG_1 gpMacCore_StackId_t MACCORE_STACKID_REF +#define MACCORE_STACKID_ARG_2 ,gpMacCore_StackId_t MACCORE_STACKID_REF +#define MACCORE_STACKID_MAP_1(stackId) stackId +#define MACCORE_STACKID_MAP_2(a,stackId) a,stackId +#define MACCORE_STACKID_MAP_4(a,b,c,stackId) a,b,c,stackId +#else //(GP_DIVERSITY_NR_OF_STACKS > 1) || (defined(GP_DIVERSITY_JUMPTABLES)) +#define MACCORE_STACKID_REF 0 +#define MACCORE_STACKID_ARG_1 void +#define MACCORE_STACKID_ARG_2 +#define MACCORE_STACKID_MAP_1(stackId) +#define MACCORE_STACKID_MAP_2(a,stackId) a +#define MACCORE_STACKID_MAP_4(a,b,c,stackId) a,b,c +#endif //(GP_DIVERSITY_NR_OF_STACKS > 1) || (defined(GP_DIVERSITY_JUMPTABLES)) + +// Different Tx option settings +#define GP_MACCORE_TX_OPT_NONE 0x00 +/** @brief Enable ACK request for this packet Data Request */ +#define GP_MACCORE_TX_OPT_ACK_REQ 0x01 +/** @brief Enable GTS transmission for this packet Data Request */ +#define GP_MACCORE_TX_OPT_GTS 0x02 +/** @brief Send packet as an indirect transmission. Packet will be buffered untill polled successfully or expired. */ +#define GP_MACCORE_TX_OPT_INDIRECT 0x04 +/** @brief Keep the framecounter value as specified by the higher layers in the frame during the raw encryption. */ +#define GP_MACCORE_TX_OPT_RAW_KEEP_FRAMECOUNTER 0x08 +//Following options are not defined in spec - added for DataRequest API purposes +/** @brief Enable Transmission via scheduled HW TX queue. */ +#define GP_MACCORE_TX_OPT_TIMEDTX 0x10 +/** @brief Use a raw transmission of the payload. No MAC header is added or security applied. + * To be used when above layer handles the full packet formatting.*/ +#define GP_MACCORE_TX_OPT_RAW 0x20 +/** @brief Perform a direct transmission, but as a response to a previous poll/datarequest. */ +#define GP_MACCORE_TX_OPT_INJECT 0x40 +/** @brief Set the data pending bit in the Packet header. + This is handled automatically for indirect queued packets according to the queue contents. */ +#define GP_MACCORE_TX_OPT_MORE_DATA_PENDING 0x80 + +#define GP_MACCORE_INDIRECT_TRANSMISSION_ENABLED(txOptions) (txOptions & GP_MACCORE_TX_OPT_INDIRECT) +#define GP_MACCORE_INDIRECT_TRANSMISSION_CLEAR(txOptions) (txOptions&=~GP_MACCORE_TX_OPT_INDIRECT) + +#define GP_MACCORE_INJECT_ENABLED(txOptions) (txOptions & GP_MACCORE_TX_OPT_INJECT) +#define GP_MACCORE_INJECT_CLEAR(txOptions) (txOptions&=~GP_MACCORE_TX_OPT_INJECT) + +#define GP_MACCORE_TIMEDTX_ENABLED(txOptions) (txOptions & GP_MACCORE_TX_OPT_TIMEDTX) + +#define GP_MACCORE_ADDRESSMODE_NONE(mode) (mode == gpMacCore_AddressModeNoAddress) +#define GP_MACCORE_ADDRESSMODE_RESERVED(mode) (mode == gpMacCore_AddressModeReserved) +#define GP_MACCORE_ADDRESSMODE_SHORT(mode) (mode == gpMacCore_AddressModeShortAddress) +#define GP_MACCORE_ADDRESSMODE_EXTENDED(mode) (mode == gpMacCore_AddressModeExtendedAddress) + +#define GP_MACCORE_IS_SHORT_ADDR_BROADCAST(addr) (addr == GP_MACCORE_SHORT_ADDR_BROADCAST) +#define GP_MACCORE_IS_SHORT_ADDR_UNALLOCATED(addr) (addr == GP_MACCORE_SHORT_ADDR_UNALLOCATED) + +#define GP_MACCORE_NO_SECURITY_SPECIFIED(pSecOptions) (pSecOptions == NULL || pSecOptions->securityLevel == gpEncryption_SecLevelNothing) + +#define GP_MACCORE_CHECK_CHANNEL_VALID(channel) (((channel) >= 11) && ((channel) <= 26)) + +// shortcut to use checks in if statement (that can be omitted when assert level does not match) +#define GP_MACCORE_CHECK_IF(check) (GP_ASSERT_IF(GP_DIVERSITY_ASSERT_LEVEL_DEV_EXT, check)) + +// regular check macro's (to be used anywhere, cannot be ommitted during compilation) +#define GP_MACCORE_CHECK_ADDRESSMODE_NONE(mode) (mode != gpMacCore_AddressModeNoAddress) +#define GP_MACCORE_CHECK_ADDRESSMODE_VALID(mode) (mode != gpMacCore_AddressModeReserved && mode <= gpMacCore_AddressModeExtendedAddress) +#define GP_MACCORE_CHECK_ADDRESSINFO_VALID(info) (info != NULL && GP_MACCORE_CHECK_ADDRESSMODE_VALID(info->addressMode)) +#define GP_MACCORE_CHECK_ADDRESSMODE_PRESENT(mode) (mode == gpMacCore_AddressModeShortAddress || mode == gpMacCore_AddressModeExtendedAddress) +#define GP_MACCORE_CHECK_SCANTYPE_VALID(type) ((type != gpMacCore_ScanTypePassive && type <= gpMacCore_ScanTypeOrphan) || (type >= gpMacCore_ScanTypeRSSI && type <= gpMacCore_ScanTypeAIMasked) ) +#define GP_MACCORE_CHECK_SCANDURATION_VALID(duration) (duration <= GP_MACCORE_MAX_SCAN_DURATION || duration == 0xFF) +#define GP_MACCORE_CHECK_TXOPTIONS_VALID(options) (!GP_MACCORE_INDIRECT_TRANSMISSION_ENABLED(options)) + +// special check-if macro's that return true when check is false (to be used inside if statement, can be ommited when assert level does not match) +#define GP_MACCORE_CHECK_IF_ADDRESSMODE_NOT_NONE(mode) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_ADDRESSMODE_NONE(mode))) +#define GP_MACCORE_CHECK_IF_ADDRESSMODE_INVALID(mode) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_ADDRESSMODE_VALID(mode))) +#define GP_MACCORE_CHECK_IF_ADDRESSINFO_INVALID(info) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_ADDRESSINFO_VALID(info))) +#define GP_MACCORE_CHECK_IF_ADDRESSMODE_NOT_PRESENT(mode) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_ADDRESSMODE_PRESENT(mode))) +#define GP_MACCORE_CHECK_IF_SCANTYPE_INVALID(type) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_SCANTYPE_VALID(type))) +#define GP_MACCORE_CHECK_IF_SCANDURATION_INVALID(duration) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_SCANDURATION_VALID(duration))) +#define GP_MACCORE_CHECK_IF_TXOPTIONS_INVALID(options) (GP_MACCORE_CHECK_IF(GP_MACCORE_CHECK_TXOPTIONS_VALID(options))) + +#define GP_MACCORE_DEFAULT_TRANSACTION_PERSISTENCE_TIME 0x01F4 + +#define GP_MACCORE_STATISTICS_ALL_DEVICES 0xFFFF + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt8 gpMacCore_StackId_t; + +/** @name gpMacCore_Result_t */ +//@{ +//PHY results +/** @brief The requested operation was completed successfully. For instance if a transmission was requested, this value indicates a successful transmission.*/ +#define gpMacCore_ResultSuccess 0x0 +//MAC results +/** @brief The frame counter purportedly applied by the originator of the received frame is invalid. */ +#define gpMacCore_ResultCounterError 0xdb +/** @brief The key purportedly applied by the originator of the received frame is not allowed to be used with that frame type according to the key usage policy of the recipient.*/ +#define gpMacCore_ResultImproperKeyType 0xdc +/** @brief The security level purportedly applied by the originator of the received frame does not meet the minimum security level required/expected by the recipient for that frame type.*/ +#define gpMacCore_ResultImproperSecurityLevel 0xdd +/** @brief The received frame was purportedly secured using security based on IEEE Std 802.15.4-2003, and such security is not supported by this standard. */ +#define gpMacCore_ResultUnsupportedLegacy 0xde +/** @brief The security purportedly applied by the originator of the received frame is not supported. */ +#define gpMacCore_ResultUnsupportedSecurity 0xdf +/** @brief The beacon was lost following a synchronization request. */ +#define gpMacCore_ResultBeaconLoss 0xe0 +/** @brief A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed. */ +#define gpMacCore_ResultChannelAccessFailure 0xe1 +/** @brief The GTS request has been denied by the PAN coordinator. */ +#define gpMacCore_ResultDenied 0xe2 +/** @brief The attempt to disable the transceiver has failed. */ +#define gpMacCore_ResultDisableTrxFailure 0xe3 +/** @brief The received frame induces a failed security check according to the security suite. */ +#define gpMacCore_ResultSecurityError 0xe4 +/** @brief The frame resulting from secure processing has a length that is greater than aMACMaxFrameSize. */ +#define gpMacCore_ResultFrameTooLong 0xe5 +/** @brief The requested GTS transmission failed because the specified GTS either did not have a transmit GTS direction or was not defined. */ +#define gpMacCore_ResultInvalidGTS 0xe6 +/** @brief A request to purge an MSDU from the transaction queue wasmade using an MSDU handle that was not found in the transaction table. */ +#define gpMacCore_ResultInvalidHandle 0xe7 +/** @brief A parameter in the primitive is out of the valid range. */ +#define gpMacCore_ResultInvalidParameter 0xe8 +/** @brief No acknowledgment was received after aMaxFrameRetries. */ +#define gpMacCore_ResultNoAck 0xe9 +/** @brief A scan operation failed to find any network beacons. */ +#define gpMacCore_ResultNoBeacon 0xea +/** @brief No response data was available following a request. */ +#define gpMacCore_ResultNoData 0xeb +/** @brief The operation failed because a short address was not allocated. */ +#define gpMacCore_ResultNoShortAddress 0xec +/** @brief A request to enable the receiver was unsuccessful because it could not be completed within the CAP. */ +#define gpMacCore_ResultOutOfCAP 0xed +/** @brief A PAN identifier conflict has been detected and communicated to the PAN coordinator. */ +#define gpMacCore_ResultPanIdConflict 0xee +/** @brief A coordinator realignment command has been received. */ +#define gpMacCore_ResultRealignment 0xef +/** @brief The transaction has expired and its information is discarded. */ +#define gpMacCore_ResultTransactionExpired 0xf0 +/** @brief There is no capacity to store the transaction. */ +#define gpMacCore_ResultTransactionOverflow 0xf1 +/** @brief The transceiver was transmitting when the receiver was requested to be enabled. */ +#define gpMacCore_ResultTxActive 0xf2 +/** @brief The appropriate key is not available in the ACL. */ +#define gpMacCore_ResultUnavailableKey 0xf3 +/** @brief A SET/GET request was issued with the identifier of a PIBattribute that is not supported. */ +#define gpMacCore_ResultUnsupportedAttribute 0xf4 +/** @brief A request to send data was unsuccessful because neither the source address parameters nor the destination address parameters were present.*/ +#define gpMacCore_ResultInvalidAddress 0xf5 +/** @brief A receiver enable request was unsuccessful because it specified a number of symbols that was longer than the beacon interval. */ +#define gpMacCore_ResultOnTimeTooLong 0xf6 +/** @brief A receiver enable request was unsuccessful because it could not be completed within the current superframe and was not permitted to be deferred until the next superframe. */ +#define gpMacCore_ResultPastTime 0xf7 +/** @brief The device was instructed to start sending beacons based on the timing of the beacon transmissions of its coordinator, but the device is not currently tracking the beacon of its coordinator.*/ +#define gpMacCore_ResultTrackingOff 0xf8 +/** @brief An attempt to write to a MAC PIB attribute that is in a table failed because the specified table index was out of range.*/ +#define gpMacCore_ResultInvalidIndex 0xf9 +/** @brief A scan operation terminated prematurely because the number of PAN descriptors stored reached an implementation specified maximum.*/ +#define gpMacCore_ResultLimitReached 0xfa +/** @brief A SET/GET request was issued with the identifier of an attribute that is read only. */ +#define gpMacCore_ResultReadOnly 0xfb +/** @brief A request to perform a scan operation failed because the MLME was in the process of performing a previously initiated scan operation. */ +#define gpMacCore_ResultScanInProgress 0xfc +/** @brief The device was instructed to start sending beacons based on the timing of the beacon transmissions of its coordinator, but the instructed start time overlapped the transmission time of the beacon of its coordinator. */ +#define gpMacCore_ResultSuperframeOverlap 0xfd +/** @typedef gpMacCore_Result_t + * @brief The gpMacCore_Result_t type defines the result as defined by the IEEE802.15.4 MAC. Not all the possible values are used by the non-beaconed MAC. +*/ +typedef UInt8 gpMacCore_Result_t; +//@} + +/** @name gpMacCore_Attribute_t */ +//@{ +// phy attr +/** @brief The IEEE802.15.4-2006 channel to use for all following transmissions and receptions.*/ +#define gpMacCore_AttributeCurrentChannel 0x0 /* The RF channel to be used for all following transmissions and receptions */ +/** @brief The 5 most significant bits (MSBs) (b27,... ,b31) of ChannelsSupported shall be reserved and set to 0, and the 27 LSBs (b0,b1, ... b26) shall indicate the status(1=available, 0=unavailable) for each of the 27 valid channels. */ +#define gpMacCore_AttributeChannelsSupported 0x1 /* Supported channel mask from bit 0 to bit 27 */ +/** @brief The 2 MSBs represent the tolerance on the transmit power: 00 = +- 1 dB 01 = +- 3 dB 10 = +- 6 dB The 6 LSBs represent a signed integer in twos-complement format, corresponding to the nominal transmit power of the device in decibels relative to 1 mW. The lowest value of phyTransmitPower shall be interpreted as less than or equal to +-32 dBm. */ +#define gpMacCore_AttributeTransmitPower 0x2 /* Transmit pozer in mdB */ +/** @brief The CCA mode to use. Three CCA modes (1-3) are defined as specified in the IEEE802.15.4-2006 standard. */ +#define gpMacCore_AttributeCCAMode 0x3 /* CCA mode */ +// mac attr +/** @brief The maximum number of symbols to wait for an acknowledgment frame to arrive following a transmitted data frame. */ +#define gpMacCore_AttributeAckWaitDuration 0x40 +//#define gpMacCore_AttributeMacBattLifeExt 0x43 +//#define gpMacCore_AttributeBattLifeExtPeriods 0x44 +/** @brief The extended 64 bit IEEE802.15.4-2006 MAC address of the coordinator of the network the device has joined. */ +#define gpMacCore_AttributeCoordExtendedAddress 0x4A +/** @brief The 16 bit short address assigned to the coordinator with which the device is associated. A value of 0xfffe indicates that the coordinator is only using its 64 bit extended address. A value of 0xffff indicates that this value is unknown. */ +#define gpMacCore_AttributeCoordShortAddress 0x4B +/** @brief The sequence number added to the data or MAC command frames to be transmitted. */ +#define gpMacCore_AttributeDSN 0x4C +/** @brief The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access failure. */ +#define gpMacCore_AttributeMaxCsmaBackoffs 0x4E +/** @brief The minimum value of the backoff exponent in the CSMA-CA algorithm. Note that if this value is set to 0, collision avoidance is disabled during the first iteration of the algorithm. Also note that for the slotted version of the CSMA-CA algorithm with batterylife extension enabled, the minimum value of the backoff exponent will be the lesser of 2 and the value of macMinBE. */ +#define gpMacCore_AttributeMinBE 0x4F +/** @brief The 16 bit identifier of the PAN (Personal Area Network) on which the device is operating. If this value is 0xffff, the device is not associated to a network. */ +#define gpMacCore_AttributePANId 0x50 +/** @brief This attribute indicates whether the MAC sublayer is to enable its receiver during idle periods. */ +#define gpMacCore_AttributeRxOnWhenIdle 0x52 +/** @brief The 16 bit address that the device uses to communicate in the PAN. If the device is a PAN coordinator, this value shall be chosen before a PAN is started. Otherwise, the address is allocated by a coordinator during association. A value of 0xfffe indicates that the device has associated but has not been allocated a short address. A value of 0xffff indicates that the device is not associated to a network. */ +#define gpMacCore_AttributeShortAddress 0x53 +//#define gpMacCore_AttributeACLEntryDescriptorSet 0x70 +//#define gpMacCore_AttributeACLEntryDescriptorSetSize 0x71 +/** @brief Indication of whether a coordinator is currently allowing association. A value of TRUE indicates that association is permitted. */ +#define gpMacCore_AttributeAssociationPermit 0x41 +/** @brief The contents of the beacon payload. The length of the beacon payload is specified through the 'beacon payload length' attribute.*/ +#define gpMacCore_AttributeBeaconPayload 0x45 +/** @brief The length, in octets, of the beacon payload. */ +#define gpMacCore_AttributeBeaconPayloadLength 0x46 +/** @brief Specification of how often the coordinator transmits a beacon. The macBeaconOrder, BO, and the beacon interval, BI, are related as follows: for 0 <= BO <= 14, BI = aBaseSuperframeDuration * 2BO symbols. If BO = 15, the coordinator will not transmit a beacon. */ +#define gpMacCore_AttributeBeaconOrder 0x47 +//#define gpMacCore_AttributeBeaconTxTime 0x48 +//#define gpMacCore_AttributeBSN 0x49 +/** @brief TRUE if the PAN coordinator is to accept GTS requests. FALSE otherwise. */ +#define gpMacCore_AttributeGTSPermit 0x4D +/** @brief This indicates whether the MAC sublayer is in a promiscuous (receive all) mode. A value of TRUE indicates that the MAC sublayer accepts all frames received from the PHY, regardless of the source/destination address fields. */ +#define gpMacCore_AttributePromiscuousMode 0x51 +/** @brief This specifies the length of the active portion of the superframe, including the beacon frame. The superframe order, SO, and the superframe duration, SD, are related as follows: for 0 <= SO <= BO <= 14, SD = aBaseSuperframeDuration*2SO symbols. If SO = 15, the superframe will not be active after the beacon.*/ +#define gpMacCore_AttributeSuperFrameOrder 0x54 +/** @brief The maximum time (in superframe periods) that a transaction is stored by a coordinator and it is indicated in the beacon that data is pending. */ +#define gpMacCore_AttributeTransactionPersistenceTime 0x55 +/** @brief Indication of whether the device is associated to the PAN through the PAN coordinator. +* A value of TRUE indicates the device has associated through the PAN coordinator. Otherwise, the value is set to FALSE. */ +#define gpMacCore_AttributeAssociatedPANCoord 0x56 +/** @brief The maximum value of the backoff exponent, BE, in the CSMA-CA algorithm */ +#define gpMacCore_AttributeMaxBE 0x57 +/** @brief The maximum time to wait either for a frame intended as a response to a data +* request frame or for a broadcast frame following a beacon with the Frame Pending +* field set to one. */ +#define gpMacCore_AttributeMaxFrameTotalWaitTime 0x58 +/** @brief The maximum number of retries allowed after a transmission failure. */ +#define gpMacCore_AttributeNumberOfRetries 0x59 +/** @brief The maximum time, in multiples of aBaseSuperframeDuration, a device shall wait +* for a response command frame to be available following a request command frame. */ +#define gpMacCore_AttributeResponseWaitTime 0x5a +/** @brief Indication of whether the MAC sublayer has security enabled. */ +#define gpMacCore_AttributeSecurityEnabled 0x5d +/** @brief Defines the Tx antenna, only used with antenna diversity. */ +#define gpMacCore_AttributeTxAntenna 0x5e + +/** @brief The extended 64 bit address of the device. */ +#define gpMacCore_AttributeExtendedAddress 0xFF + +// Attributes for security +/** @brief KeyDescriptor entries, each containing keys and security related information. */ +#define gpMacCore_AttributeKeyTable 0x71 +/** @brief Number of key tables */ +#define gpMacCore_AttributeKeyTableEntries 0x72 +/** @brief DeviceDescriptors for each remote device with which this device securely communicates. */ +#define gpMacCore_AttributeDeviceTable 0x73 +/** @brief Number of device tables */ +#define gpMacCore_AttributeDeviceTableEntries 0x74 +/** @brief Provides information about the security level required for each MAC frame type and subtype. */ +#define gpMacCore_AttributeSecurityLevelTable 0x75 +/** @brief Number of security level tables. */ +#define gpMacCore_AttributeSecurityLevelTableEntries 0x76 +/** @brief The outgoing frame counter for this device. */ +#define gpMacCore_AttributeFrameCounter 0x77 +/** @brief The security level used for automatic data requests. */ +#define gpMacCore_AttributeAutoRequestSecurityLevel 0x78 +/** @brief The key identifier mode used for automatic data requests. This attribute is invalid +* if the macAutoRequestSecurityLevel attribute is set to 0x00.*/ +#define gpMacCore_AttributeAutoRequestKeyIdMode 0x79 +/** @brief The originator of the key used for automatic data requests. This attribute is invalid +* if the macAutoRequestKeyIdMode element is invalid or set to 0x00. */ +#define gpMacCore_AttributeAutoRequestKeySource 0x7A +/** @brief The index of the key used for automatic data requests. This attribute is invalid +* if the macAutoRequestKeyIdMode attribute is invalid or set to 0x00 */ +#define gpMacCore_AttributeAutoRequestKeyIndex 0x7B +/** @brief The originator of the default key used for key identifier mode 0x01. */ +#define gpMacCore_AttributeDefaultKeySource 0x7C +/** @brief The extended address of the PAN coordinator. */ +#define gpMacCore_AttributePANCoordExtendedAddress 0x7D +/** @brief The short address assigned to the PAN coordinator. +* A value of 0xfffe indicates that the PAN coordinator is only using its extended address. +* A value of 0xffff indicates that this value is unknown. */ +#define gpMacCore_AttributePANCoordShortAddress 0x7E +/** @typedef gpMacCore_Attribute_t + * @brief The gpMacCore_Attribute_t type defines the attribute type. The value could be an IEEE802.15.4 MAC attribute or a non-standard attributes that was added for flexibility. Only the PIB attributes that are used in this mac could be used, the non-used PIB attributes are not implemented to save memory. +*/ +typedef UInt8 gpMacCore_Attribute_t; + +/** @enum gpMacCore_ScanType_t */ +//@{ +/** @brief The energy detect scan, can be used to detect the amount of energy in the air. It is only used on FFD's (Full Functional Devices).*/ +#define gpMacCore_ScanTypeED 0 +/** @brief The Active Scan will send out a beacon request. FFDs in the POS (Personal Operating Space) of the device will respond by sending out a beacon.*/ +#define gpMacCore_ScanTypeActive 1 +/** @brief The passive scan is not implemented. */ +#define gpMacCore_ScanTypePassive 2 +/** @brief The orphan scan is used when a node lost his coordinator (i.e. when it has changed panId or channel). Using the orphan scan the device can locate his coordinator. */ +#define gpMacCore_ScanTypeOrphan 3 +/** @brief (Wifi Aware) RSSI as a measure of the energy. */ +#define gpMacCore_ScanTypeRSSI 0x80 +/** @brief (Wifi Aware) RSSI as a measure of the energy masked with Min Interference Level. */ +#define gpMacCore_ScanTypeRSSIMasked 0x81 +/** @brief (Wifi Aware) Absolute Interference as a measure of the energy (0 = -95dBm, 254 = -45dBm, 255 = RDS Blocked Channel). */ +#define gpMacCore_ScanTypeAI 0x82 +/** @brief (Wifi Aware) Absolute Interference Masked as a measure of the energy masked with Min Interference Level (0 = -95dBm, 254 = -45dBm, 255 = RDS Blocked Channel). */ +#define gpMacCore_ScanTypeAIMasked 0x83 +/** @brief Stop an ongoing scan. The confirm for the scan in progress will be triggered with the results up to that point. */ +#define gpMacCore_ScanTypeStop 0xFF +/** @typedef gpMacCore_ScanType_t + * @brief The gpMacCore_ScanType_t type defines the scanType as described in the IEEE802.15.4 MAC. Since this is a non-beaconed MAC, the passive scan is not a valid value. +*/ +typedef UInt8 gpMacCore_ScanType_t; +//@} + +/** @enum gpMacCore_AddressMode_t */ +//@{ +/** @brief Values of the address mode field */ +#define gpMacCore_AddressModeNoAddress 0 +#define gpMacCore_AddressModeReserved 1 +#define gpMacCore_AddressModeShortAddress 2 +#define gpMacCore_AddressModeExtendedAddress 3 +typedef UInt8 gpMacCore_AddressMode_t; +//@} + +/** @enum gpMacCore_FrameType_t */ +//@{ +/** @brief Values of the frame type field */ +#define gpMacCore_FrameTypeBeacon 0 +#define gpMacCore_FrameTypeData 1 +#define gpMacCore_FrameTypeAcknowledge 2 +#define gpMacCore_FrameTypeCommand 3 +typedef UInt8 gpMacCore_FrameType_t; +//@} + +/** @enum gpMacCore_Command_t */ +//@{ +/** @brief Values of the command type field */ +#define gpMacCore_CommandAssociationRequest 0x1 +#define gpMacCore_CommandAssociationResponse 0x2 +#define gpMacCore_CommandDataRequest 0x4 +#define gpMacCore_CommandOrphanNotification 0x6 +#define gpMacCore_CommandBeaconRequest 0x7 +#define gpMacCore_CommandCoordinatorRealignment 0x8 +typedef UInt8 gpMacCore_Command_t; +//@} +//@{ +/** @brief Values of the mac version field */ +#define gpMacCore_MacVersion2003 0 +#define gpMacCore_MacVersion2006 1 +#define gpMacCore_MacVersion2015 2 +typedef UInt8 gpMacCore_MacVersion_t; +//@} + +/** @typedef gpMacCore_PanId_t + * @brief The gpMacCore_PanId_t type specifies a panId (Personal Area Network Identifier). The panId is a unique identifier of the network. The length of the panId is 2 bytes. +*/ +typedef UInt16 gpMacCore_PanId_t; + +/** @typedef gpMacCore_SuperFrameSpec_t + * @brief The gpMacCore_SuperFrameSpec_t type definition based on the structure gpMacCore_SuperFrameSpec. +*/ +typedef UInt16 gpMacCore_SuperFrameSpec_t; + +typedef UInt8 gpMacCore_KeyIdLookupListEntries_t; +typedef UInt8 gpMacCore_KeyDeviceListEntries_t; +typedef UInt8 gpMacCore_KeyUsageListEntries_t; +typedef UInt8 gpMacCore_KeyTablesEntries_t; +typedef UInt8 gpMacCore_DeviceTablesEntries_t; +typedef UInt8 gpMacCore_Index_t; +typedef UInt8 gpMacCore_SecurityLevelTableEntries_t; + +/** @enum gpMacCore_KeyIdMode_t */ +//@{ +/** @brief Values of the KeyId Mode field */ +#define gpMacCore_KeyIdModeImplicit 0 +#define gpMacCore_KeyIdModeExplicit1Octet 1 +#define gpMacCore_KeyIdModeExplicit4Octet 2 +#define gpMacCore_KeyIdModeExplicit8Octet 3 +typedef UInt8 gpMacCore_KeyIdMode_t; +//@} + +typedef UInt8 gpMacCore_KeyIndex_t; + +/** @union gpMacCore_Address_t + * @brief The gpMacCore_Address_t union either contains a short or an extended address. +*/ +typedef union { +/** The short address (2 bytes).*/ + UInt16 Short; +/** The extended address(MAC address), 8 bytes.*/ + MACAddress_t Extended; +} gpMacCore_Address_t; + +typedef union{ + UInt8 pKeySource4[4]; + UInt8 pKeySource8[8]; +}gpMacCore_KeySource_t; + +typedef struct { + UInt8 payloadStart; + UInt8 headerStart; + UInt8 payloadLength; + UInt8 headerLength; +} gpMacCore_EncryptionLengthInfo_t; + +/** @struct gpMacCore_Security_t + * @brief The gpMacCore_Security_t struct contains security related parameters. + * @param securityLevel The security level to be used (see IEEE802.15.4-2006). + * @param keyIdMode The mode used to identify the key to be used (see IEEE802.15.4-2006). + * @param pKeySource A pointer to the originator of the key to be used (see IEEE802.15.4-2006). + * @param keyIndex The index of the key to be used (see IEEE802.15.4-2006). +*/ +typedef struct gpMacCore_Security_s{ + gpEncryption_SecLevel_t securityLevel; + gpMacCore_KeyIdMode_t keyIdMode; + gpMacCore_KeySource_t pKeySource; + gpMacCore_KeyIndex_t keyIndex; +} gpMacCore_Security_t; + +/** @struct gpMacCore_AddressInfo_t + * @brief The gpMacCore_AddressInfo_t struct contains all address related information. (addressmode, address and panId) +*/ +typedef struct { + gpMacCore_Address_t address; + gpMacCore_PanId_t panId; + gpMacCore_AddressMode_t addressMode; +} gpMacCore_AddressInfo_t; + +/** @struct gpMacCore_PanDescriptor + * @brief The gpMacCore_PanDescriptor structure specifies the parameters of the PanDescriptor as is defined in the IEEE802.15.4-2006 spec. + * @typedef gpMacCore_PanDescriptor_t + * @brief The gpMacCore_PanDescriptor_t type definition based on the structure gpMacCore_PanDescriptor. +*/ +typedef struct gpMacCore_PanDescriptor { +/** A timestamp indicating at which time the beacon frame was received.*/ + UInt32 timeStamp; // Attention!!! Timestamp from beginning of subinterval (within beacon or IWU slot) +/** The superframe specification as specified in the IEEE802.15.4-2006 specification. */ + gpMacCore_SuperFrameSpec_t superFrame; +/** The channel the network is currently operating on. */ + UInt8 logicalChannel; +/** The quality of the link. This is an unsigned integer, ranging from 0 to 255. Lower values represent lower link quality.*/ + UInt8 linkQuality; +/** The address information of the pan coordinator (addressmode, address and panId) */ + gpMacCore_AddressInfo_t coordAddressInfo; +} gpMacCore_PanDescriptor_t; + +typedef struct gpMacCore_KeyIdLookupDescriptor{ + UInt8 lookupData[9]; + UInt8 lookupDataSize; +}gpMacCore_KeyIdLookupDescriptor_t; + +typedef struct gpMacCore_DeviceDescriptor{ + gpMacCore_PanId_t panId; + UInt16 shortAddr; + MACAddress_t extAddress; + UInt32 frameCounter; + Bool exempt; +}gpMacCore_DeviceDescriptor_t; + +typedef struct gpMacCore_KeyDeviceDescriptor{ + gpMacCore_DeviceDescriptor_t deviceDescriptor; + Bool uniqueDevice; + Bool blackListed; +}gpMacCore_KeyDeviceDescriptor_t; + +typedef struct gpMacCore_KeyUsageDescriptor{ + gpMacCore_FrameType_t frameType; + gpMacCore_Command_t commandFrameIdentifier; +}gpMacCore_KeyUsageDescriptor_t; + +typedef struct gpMacCore_KeyDescriptor{ + gpMacCore_KeyIdLookupDescriptor_t keyIdLookupDescriptors[ GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS ]; + gpMacCore_KeyIdLookupListEntries_t keyIdLookupListEntries; + gpMacCore_KeyDeviceDescriptor_t keyDeviceDescriptorList[ GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS ]; + gpMacCore_KeyDeviceListEntries_t keyDeviceListEntries; + gpMacCore_KeyUsageDescriptor_t keyUsageDescriptorList[ GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS ]; + gpMacCore_KeyUsageListEntries_t keyUsageListEntries; + UInt8 key[16]; +}gpMacCore_KeyDescriptor_t; + +typedef struct gpMacCore_SecurityLevelDescriptor{ + gpMacCore_FrameType_t frameType; + gpMacCore_Command_t commandFrameIdentifier; + gpEncryption_SecLevel_t securityMinimum; + Bool deviceOverrideSecurityMinimum; +}gpMacCore_SecurityLevelDescriptor_t; + +typedef struct gpMacCore_ShortAndPanID{ + gpMacCore_PanId_t panId; + UInt16 shortAddress; +}gpMacCore_ShortAndPanID_t; + +typedef struct gpMacCore_DeviceLookupDescriptor{ + union{ + gpMacCore_ShortAndPanID_t shortAndPanId; + MACAddress_t extendedAddress; + }DeviceLookup; + UInt8 lookupSize; +}gpMacCore_DeviceLookupDescriptor_t; + +typedef struct { + gpPd_Lqi_t lqi; + gpPd_Rssi_t rssi; +} gpMacCore_DiagRxCntr_t; + +typedef struct { + UInt32 avgRetryCntr; + UInt32 txCntr; +} gpMacCore_DiagTxCntr_t; + +/** @typedef gpMacCore_AssocStatus_t + * @brief See table 83 - Valid values of the Association Status field - IEEE 802.14.5 + * 0x0: Association successful. + * 0x1: PAN at capacity. + * 0x2: PAN access denied. +*/ +#define gpMacCore_AssocSuccess 0 +#define gpMacCore_AssocFullPan 1 +#define gpMacCore_AssocDenied 2 +typedef UInt8 gpMacCore_AssocStatus_t; + +typedef struct { + UInt8 channel[GP_MACCORE_MULTICHANNEL_MAX_CHANNELS]; +} gpMacCore_MultiChannelOptions_t; +#define GP_MACCORE_SET_DEFAULT_MULTICHANNELOPTIONS(multiChannelOptions) \ +multiChannelOptions.channel[0] = GP_MACCORE_INVALID_CHANNEL; \ +multiChannelOptions.channel[1] = GP_MACCORE_INVALID_CHANNEL; \ +multiChannelOptions.channel[2] = GP_MACCORE_INVALID_CHANNEL; + +/** @struct gpMacCore_TxTimingOptions_t + * @brief Options to specify transmission via timed TX queue. + */ +typedef struct { + /** Absolute timestamp for scheduled TX (based on chip time in microseconds as returned by gpHal_GetTime()). */ + UInt32 txTimestamp; +} gpMacCore_TxTimingOptions_t; + +typedef void (*gpMacCore_TransmissionCallback_t)(void); + +/** @enum gpMacCore_DataPendingMode_t */ +//@{ +/** @brief Values of the DataPendingMode field */ +#define gpMacCore_DataPendingModeMac802154 0 /* normal mode */ +#define gpMacCore_DataPendingModeForNonNeighbourDevices 1 /* for use with indirect transmit to unknown devices e.g. needed by Zigbee 3.0 */ +typedef UInt8 gpMacCore_DataPendingMode_t; +//@} + +/** @name gpMacCore_TxPower_t*/ +//@{ +#define gpMacCore_TxPowerMin 0x7d +#define gpMacCore_TxPowerMax 0x7e +/** @brief Default transmit powers are configured per channel through gpMacCore_SetDefaultTransmitPowers */ +#define gpMacCore_TxPowerDefault 0x7f +/** @typedef gpMacCore_TxPower_t + * @brief The gpMacCore_TxPower_t type defines the transmit power in dBm or the default, min or max define. +*/ +typedef Int8 gpMacCore_TxPower_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpJumpTables_DataTable.h" +#include "gpMacCore_CodeJumpTableFlash_Defs.h" +#include "gpMacCore_CodeJumpTableRom_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + +/** @ingroup INIT + * + * This function initializes the MacCore layer. It should be called before calling any other request function. + * +*/ +GP_API void gpMacCore_Init(void); +GP_API void gpMacCore_DeInit(void); + +/** @ingroup INIT + * @brief This function resets the MAC layer. If 'setDefaultPib' is true, the PIB attributes will be set to their default value. + * + * This function resets the MAC layer. If 'setDefaultPib' is set to true, it also resets the PIB variables, including the IEEE802.15.4-2006 standard values. + * The tranceiver will be switched off. + * All the buffered packets will be removed. + * The callback functions (specified using the gpMacCore_RegisterCallbackFunctions function) are registered. + * The interrupts are enabled. + * A list to find catching train messages is created (a method to filter out duplicate packets). + * + * @param setDefaultPib If true the PIB values are reset to their default value (as specified in the IEEE802.15.4-2006 specification). + * @param stackId The identifier of the stack +*/ +GP_API gpMacCore_Result_t gpMacCore_Reset(Bool setDefaultPib, gpMacCore_StackId_t stackId); + +/** @brief This function is used to send a data packet to another device. + * + * This function is used to send a data packet conform the IEEE802.15.4-2006 MAC specification. + * + * + * @param srcAddrMode The address modes to be used for source address. This parameter is used as in the Frame Control Field of an IEEE802.15.4-2006 packet. We refer to the define GP_IEEEMAC_SRC_ADDR_(EXT/SHORT). + * @param pDstAddrInfo All the information about the destination (address mode, address and panId). + * @param txOptions Tx Options byte (see IEEE802.15.4-2006). + * @param pSecOptions The security options - maybe NULL to be used (see IEEE802.15.4-2006). + * @param pdLoh The PD Length/Offset/Handle of the data payload . + * @param stackId The identifier of the stack doing this request +*/ +GP_API void gpMacCore_DataRequest(gpMacCore_AddressMode_t srcAddrMode, gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 txOptions, gpMacCore_Security_t *pSecOptions, gpMacCore_MultiChannelOptions_t multiChannelOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId); + +/** @brief Schedule a packet for timed transmission. + * + * To send a packet via timed transmission, perform two steps: + * - Call gpMacCore_DataRequest() with option GP_MACCORE_TX_OPT_TIMEDTX + * to queue the packet; + - Call gpMacCore_ScheduleTimedTx() to schedule transmission of the queued packet. + * + * This function is only available on hardware that supports a timed transmission queue. + * + * @param pdHandle Handle of TX packet to schedule for TX; must have been previously submitted via gpMacCore_DataRequest(). + * @param timingOptions Specification of scheduled transmit time. + * @param stackId The identifier of the stack doing this request + */ +GP_API gpMacCore_Result_t gpMacCore_ScheduleTimedTx(gpPd_Handle_t pdHandle, gpMacCore_TxTimingOptions_t timingOptions, gpMacCore_StackId_t stackId); + +/** @brief This function is used to purge a packet from the indirect transmission list + * + * @param handle The handle to be purged + * @param stackId The identifier of the stack doing this request +*/ +GP_API void gpMacCore_PurgeRequest(gpPd_Handle_t pdHandle, gpMacCore_StackId_t stackId); + +/** @ingroup MLME_SAP + * + * @brief This function is used to start a scan. + * + * This function starts a scan conform the IEEE802.15.4-2006 spec. A scan can be issued to detect a channel with the least amount of interference, to find networks, etc. + * + * @param scanType This parameter defines which of the 3 implemented scans needs to be performed: ED, active or orphan scan. + * @param scanChannels This parameter defines which channels need to be scanned. It is a bitmask where bit 0 must be '1' to select channel 0, bit 26 '1' to select channel 26, etc. Since the chip works in the 2.4GHz band, only channels 11 till 26 can be selected. If other channels are selected, they are ignored and only the selected channels between channel 11 and channel 26 are scanned. + * @param scanDuration This parameter specifies how long a channel will be scanned. The scantime equals [GP_IEEEMAC_BASE_SUPERFRAME_DURATION * (2^scanduration + 1)]symbols, where 1 symbol is 16us. + * @param resultListSize The length of the resultList (in bytes). If an ED scan is done, this should equal the amount of channels. + * For an active scan, resultListSize is 0. Received Beacons are returned through gpMacCore_cbBeaconNotifyIndication() calls during the scan. + * If it is an orphan scan, resultListSize is 0. + * @param pResultList This is a pointer to an array where the result of the scan can be saved. If an ED scan is done, the size is 'resultListSize' bytes. + Note the list is not used by the active scan for memory optimizations. The results are conveyed through separate BeaconNotify callbacks. + * @param stackId The identifier of the stack doing this request +*/ +GP_API void gpMacCore_ScanRequest(gpMacCore_ScanType_t scanType, UInt32 scanChannels, UInt8 scanDuration , UInt8 resultListSize, UInt8* pEdScanResultList, gpMacCore_StackId_t stackId); + +/** @ingroup MLME_SAP + * + * @brief This function is issued by a device who wishes to join a network. + * + * This function starts the associate procedure. It is used to join a network. When called, the AssociateRequest function will construct an associate request command packet, and send it to the coordinator. + * + * @param logicalChannel The channel that will be used to do the association attempt + * @param coordAddrMode The address mode to be used for the coordinator address. Possible values are: 2 = 16 bit short address, 3 = 64 bit extended address. + * @param coordPanId The panId of the coordinator. + * @param pCoordAddress A pointer to the address of the coordinator. + * @param capabilityInformation Specifies the operational capabilities of the associating device. +*/ +GP_API void gpMacCore_AssociateRequest(UInt8 logicalChannel, gpMacCore_AddressInfo_t* pCoordAddrInfo, UInt8 capabilityInformation, gpMacCore_StackId_t stackId); + +/** @ingroup MLME_SAP + * + * @brief This function is used to send an associate response command packet to a device that is trying to join. The associate response command packet contains the results of the join procedure. + * + * This function is used to respond to a previously received associate request command packet. Upon reception of an associate request command packet, the AssociateIndication function is called to inform the higher layer. The next higher layer then decides to allow the joining device in the network or not. Its decision is sent back to the joining device through the associate response packet. + * + * @param pDeviceAddress A pointer to the address of the device that is trying to join. + * @param associateShortAddress If the joining device is allowed (successful association), this parameter contains the short address that was allocated for the device. If the association was unsuccessful, this parameter is set to 0xffff. + * @param status This parameter contains the result of the association attempt. Possible values are: + * 0x0: Association successful. + * 0x1: PAN at capacity. + * 0x2: PAN access denied. + * @param stackId The identifier of the stack doing this response +*/ +GP_API void gpMacCore_AssociateResponse(MACAddress_t *pDeviceAddress, UInt16 associateShortAddress, gpMacCore_Result_t status, gpMacCore_StackId_t stackId); + +/** @ingroup MLME_SAP + * + * @brief This function is used to poll a coordinator for data by sending a data request command. If the coordinator has data pending for the device that issued the poll request, it will forward the data. + * + * This function starts a poll. This function is used to request packets that are pending on his coordinator (by sending a data request command to the coordinator). + * If the coordinator has data pending for the device that issued the poll request, it will forward the data. + * If a short address is allocated to the device, and it was written into the gpMacCore_AttributeShortAddress PIB attribute, + * the short address will be used as source address of the data request command. + * If the gpMacCore_AttributeShortAddress PIB attribute is set to 0xffff or 0xfffe, the device will use its extended address as source address in the data request command packet. + * + * @param coordAddrInfo All the details of the coordinator address + * @param stackId The identifier of the stack doing this request +*/ +GP_API void gpMacCore_PollRequest(gpMacCore_AddressInfo_t* coordAddrInfo, gpMacCore_Security_t *pSecOptions, gpMacCore_StackId_t stackId); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ +/** @brief Calls the PollConfirm function. The PollConfirm inform the next higher layer about a previously issued PollRequest. + * + * This function returns the status of a previously issued PollRequest. + * + * @param status The status of the pollrequest. If success, the received data will be returned using the DataIndication function. + * @param coordAddrInfo All the details of the coordinator address +*/ +void gpMacCore_cbPollConfirm( gpMacCore_Result_t status, gpMacCore_AddressInfo_t* coordAddrInfo, gpPd_TimeStamp_t txTime ); + +/** @brief This function is used to start a new superframe specification. As this is a non-beacon enabled MAC, it is mostly used when starting a coordinator. + * + * This function is used to start a new superframe specification. As this is a non-beacon enabled MAC, it is mostly used when starting a coordinator. It will set the values for the superframe. + * + * @param panId Sets the panId that will be used. + * @param logicalChannel Sets the logicalChannel (the channel the network will operate on). + * @param panCoordinator Sets panCoordinator TRUE or FALSE. If the device is a PAN coordinator, this parameter must be set to TRUE. + * @param stackId The identifier of the stack doing this request +*/ +GP_API gpMacCore_Result_t gpMacCore_Start(gpMacCore_PanId_t panId, UInt8 logicalChannel, Bool panCoordinator, gpMacCore_StackId_t stackId); + +/** @brief This function set the current channel. + * @param channel The channel to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetCurrentChannel(channel, stackId) gpMacCore_SetCurrentChannel_STACKID(MACCORE_STACKID_MAP_2(channel,stackId)) +GP_API void gpMacCore_SetCurrentChannel_STACKID(UInt8 channel MACCORE_STACKID_ARG_2); + +/** @brief This function set the 3 Rx channels. + * @param pChannel The pointer of channel list. +*/ +#define gpMacCore_SetMultipleChannelTable(pChannel, stackId) gpMacCore_SetMultipleChannelTable_STACKID(MACCORE_STACKID_MAP_2(pChannel,stackId)) +GP_API void gpMacCore_SetMultipleChannelTable_STACKID(UInt8* pChannel MACCORE_STACKID_ARG_2); + +/** @brief This function returns the current channel. +*/ +#define gpMacCore_GetCurrentChannel(stackId) gpMacCore_GetCurrentChannel_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetCurrentChannel_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This functions set the default transmit power for each channel + * + * @param Pointer to 16 byte array with default transmit power (in dBm) for each IEEE channel (11..26). + * +*/ +GP_API void gpMacCore_SetDefaultTransmitPowers(Int8* pDefaultTransmitPowerTable); + +/** @brief This function set the transmission power. + * @param transmitPower The transmission power to set in dBm, or one of gpMacCore_TxPowerMin, TxPowerMax, TxPowerDefault. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetTransmitPower(transmitPower, stackId) gpMacCore_SetTransmitPower_STACKID(MACCORE_STACKID_MAP_2(transmitPower,stackId)) +GP_API void gpMacCore_SetTransmitPower_STACKID(gpMacCore_TxPower_t transmitPower MACCORE_STACKID_ARG_2); + +/** @brief This function returns the transmission power. +*/ +#define gpMacCore_GetTransmitPower(stackId) gpMacCore_GetTransmitPower_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Int8 gpMacCore_GetTransmitPower_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function set the CCA mode. + * @param cCAMode The CCA mode to set. + * @param stackId The identifier of the stack doing this request +*/ +#define gpMacCore_SetCCAMode(cCAMode, stackId) gpMacCore_SetCCAMode_STACKID(MACCORE_STACKID_MAP_2(cCAMode,stackId)) +GP_API void gpMacCore_SetCCAMode_STACKID(UInt8 cCAMode MACCORE_STACKID_ARG_2); + +/** @brief This function returns the CCA mode. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetCCAMode(stackId) gpMacCore_GetCCAMode_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetCCAMode_STACKID(MACCORE_STACKID_ARG_1); +/** @brief This function sets the coordinator's extended MAC address. + * @param pCoordExtendedAddress A pointer to the address to set. + * @param stackId The identifier of the stack doing this request +*/ +#define gpMacCore_SetCoordExtendedAddress(pCoordExtendedAddress, stackId) gpMacCore_SetCoordExtendedAddress_STACKID(MACCORE_STACKID_MAP_2(pCoordExtendedAddress ,stackId)) +GP_API void gpMacCore_SetCoordExtendedAddress_STACKID( MACAddress_t* pCoordExtendedAddress MACCORE_STACKID_ARG_2); +/** @brief This function returns the coordinator's extended MAC address. + * @param pCoordExtendedAddress A pointer to the address to read. + * @param stackId The identifier of the stack doing this request +*/ +#define gpMacCore_GetCoordExtendedAddress(pCoordExtendedAddress , stackId) gpMacCore_GetCoordExtendedAddress_STACKID(MACCORE_STACKID_MAP_2(pCoordExtendedAddress ,stackId)) +GP_API void gpMacCore_GetCoordExtendedAddress_STACKID( MACAddress_t* pCoordExtendedAddress MACCORE_STACKID_ARG_2); + +/** @brief This function sets the coordinator's short MAC address. + * @param coordShortAddress A pointer to the address to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetCoordShortAddress(coordShortAddress, stackId) gpMacCore_SetCoordShortAddress_STACKID(MACCORE_STACKID_MAP_2(coordShortAddress,stackId)) +GP_API void gpMacCore_SetCoordShortAddress_STACKID(UInt16 coordShortAddress MACCORE_STACKID_ARG_2); + +/** @brief This function returns the coordinator's short MAC address. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetCoordShortAddress(stackId) gpMacCore_GetCoordShortAddress_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt16 gpMacCore_GetCoordShortAddress_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the panCoordinator property for a stack. + * @param panCoordinator True or false, if the stack is pan coordinator or not. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetPanCoordinator(panCoordinator, stackId) gpMacCore_SetPanCoordinator_STACKID(MACCORE_STACKID_MAP_2(panCoordinator,stackId)) +GP_API void gpMacCore_SetPanCoordinator_STACKID(Bool panCoordinator MACCORE_STACKID_ARG_2); +/** @brief This function returns the panCoordinator property of a stack. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetPanCoordinator(stackId) gpMacCore_GetPanCoordinator_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetPanCoordinator_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the MAC DSN. + * @param DSN The DSN walue to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetDsn(dsn, stackId) gpMacCore_SetDsn_STACKID(MACCORE_STACKID_MAP_2(dsn,stackId)) +GP_API void gpMacCore_SetDsn_STACKID(UInt8 dsn MACCORE_STACKID_ARG_2); +/** @brief This function returns the MAC DSN. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetDsn(stackId) gpMacCore_GetDsn_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetDsn_STACKID(MACCORE_STACKID_ARG_1); +/** @brief This function sets the maximum CSMA backoffs. + * @param maxCsmaBackoffs The maximum CSMA backoffs to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetMaxCsmaBackoffs(maxCsmaBackoffs, stackId) gpMacCore_SetMaxCsmaBackoffs_STACKID(MACCORE_STACKID_MAP_2(maxCsmaBackoffs,stackId)) +GP_API void gpMacCore_SetMaxCsmaBackoffs_STACKID(UInt8 maxCsmaBackoffs MACCORE_STACKID_ARG_2); + +/** @brief This function returns the maximum CSMA backoffs. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetMaxCsmaBackoffs(stackId) gpMacCore_GetMaxCsmaBackoffs_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetMaxCsmaBackoffs_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the minimun BE. + * @param minBE The minimum BE to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetMinBE(minBE, stackId) gpMacCore_SetMinBE_STACKID(MACCORE_STACKID_MAP_2(minBE,stackId)) +GP_API void gpMacCore_SetMinBE_STACKID(UInt8 minBE MACCORE_STACKID_ARG_2); + +/** @brief This function returns the minimun BE. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetMinBE(stackId) gpMacCore_GetMinBE_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetMinBE_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the minimun BE. + * @param minBE The minimum BE to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetMaxBE(maxBE, stackId) gpMacCore_SetMaxBE_STACKID(MACCORE_STACKID_MAP_2(maxBE,stackId)) +GP_API void gpMacCore_SetMaxBE_STACKID(UInt8 maxBE MACCORE_STACKID_ARG_2); + +/** @brief This function returns the minimun BE. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetMaxBE(stackId) gpMacCore_GetMaxBE_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetMaxBE_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the CSMA mode used when transmitting + * @param csmaMode The CSMA mode to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetCsmaMode(csmaMode, stackId) gpMacCore_SetCsmaMode_STACKID(MACCORE_STACKID_MAP_2(csmaMode,stackId)) +GP_API void gpMacCore_SetCsmaMode_STACKID(UInt8 csmaMode MACCORE_STACKID_ARG_2); + +/** @brief This function returns the CSMA mode. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetCsmaMode(stackId) gpMacCore_GetCsmaMode_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetCsmaMode_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the PANID. + * @param panId The PANID to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetPanId(panId, stackId) gpMacCore_SetPanId_STACKID(MACCORE_STACKID_MAP_2(panId,stackId)) +GP_API void gpMacCore_SetPanId_STACKID(UInt16 panId MACCORE_STACKID_ARG_2); + +/** @brief This function returns the PANID. +*/ +#define gpMacCore_GetPanId(stackId) gpMacCore_GetPanId_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt16 gpMacCore_GetPanId_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the RxOnWhenIdle attribute. + * @param rxOnWhenIdle The RxOnWhenIdle attribute to set. + * @param stackId The identifier of the stack doing this +*/ + +#define gpMacCore_SetRxOnWhenIdle(rxOnWhenIdle, stackId) gpMacCore_SetRxOnWhenIdle_STACKID(MACCORE_STACKID_MAP_2(rxOnWhenIdle,stackId)) +GP_API void gpMacCore_SetRxOnWhenIdle_STACKID(Bool rxOnWhenIdle MACCORE_STACKID_ARG_2); + +/** @brief This function returns the RxOnWhenIdle attribute. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetRxOnWhenIdle(stackId) gpMacCore_GetRxOnWhenIdle_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetRxOnWhenIdle_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the short MAC address of the device. + * @param shortAddress The address to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetShortAddress(shortAddress, stackId) gpMacCore_SetShortAddress_STACKID(MACCORE_STACKID_MAP_2(shortAddress,stackId)) +GP_API void gpMacCore_SetShortAddress_STACKID(UInt16 shortAddress MACCORE_STACKID_ARG_2); + +/** @brief This function returns the short MAC address of the device. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetShortAddress(stackId) gpMacCore_GetShortAddress_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt16 gpMacCore_GetShortAddress_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the association permit attribute. + * @param associationPermit The association permit value to set. +*/ +#define gpMacCore_SetAssociationPermit(associationPermit, stackId) gpMacCore_SetAssociationPermit_STACKID(MACCORE_STACKID_MAP_2(associationPermit,stackId)) +GP_API void gpMacCore_SetAssociationPermit_STACKID(Bool associationPermit MACCORE_STACKID_ARG_2); + +/** @brief This function returns the association permit attribute. +*/ +#define gpMacCore_GetAssociationPermit(stackId) gpMacCore_GetAssociationPermit_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetAssociationPermit_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the beacon payload pointer. + * @param pBeaconPayload The beacon payload pointer to set. +*/ +#define gpMacCore_SetBeaconPayload( pBeaconPayload, stackId) gpMacCore_SetBeaconPayload_STACKID(MACCORE_STACKID_MAP_2(pBeaconPayload,stackId)) +GP_API void gpMacCore_SetBeaconPayload_STACKID(UInt8* pBeaconPayload MACCORE_STACKID_ARG_2); + +/** @brief This function returns the beacon payload pointer. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetBeaconPayload(pBeaconPayload, stackId) gpMacCore_GetBeaconPayload_STACKID(MACCORE_STACKID_MAP_2(pBeaconPayload,stackId)) +GP_API void gpMacCore_GetBeaconPayload_STACKID(UInt8* pBeaconPayload MACCORE_STACKID_ARG_2); + +/** @brief This function sets the beacon payload length. + * @param beaconPayloadLength The beacon payload length to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetBeaconPayloadLength(beaconPayloadLength, stackId) gpMacCore_SetBeaconPayloadLength_STACKID(MACCORE_STACKID_MAP_2(beaconPayloadLength,stackId)) +GP_API void gpMacCore_SetBeaconPayloadLength_STACKID(UInt8 beaconPayloadLength MACCORE_STACKID_ARG_2); + +/** @brief This function returns the beacon payload length. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetBeaconPayloadLength(stackId) gpMacCore_GetBeaconPayloadLength_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetBeaconPayloadLength_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the promiscuous mode. + * @param promiscuousMode The promiscuous mode value to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetPromiscuousMode(promiscuousMode, stackId) gpMacCore_SetPromiscuousMode_STACKID(MACCORE_STACKID_MAP_2(promiscuousMode,stackId)) +GP_API void gpMacCore_SetPromiscuousMode_STACKID(UInt8 promiscuousMode MACCORE_STACKID_ARG_2); + +/** @brief This function returns the promiscuous mode. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetPromiscuousMode(stackId) gpMacCore_GetPromiscuousMode_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetPromiscuousMode_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the transaction persistence time. + * @param transactionPersistentTime The transaction persistence time to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetTransactionPersistenceTime(transactionPersistentTime, stackId) gpMacCore_SetTransactionPersistenceTime_STACKID(MACCORE_STACKID_MAP_2(transactionPersistentTime,stackId)) +GP_API void gpMacCore_SetTransactionPersistenceTime_STACKID(UInt16 transactionPersistentTime MACCORE_STACKID_ARG_2); + +/** @brief This function returns the transaction persistence time. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetTransactionPersistenceTime(stackId) gpMacCore_GetTransactionPersistenceTime_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt16 gpMacCore_GetTransactionPersistenceTime_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function sets the extended MAC address of the device. + * @param pExtendedAddress The pointer to the address to set. +*/ +#define gpMacCore_SetExtendedAddress(pExtendedAddress, stackId) gpMacCore_SetExtendedAddress_STACKID(MACCORE_STACKID_MAP_2(pExtendedAddress,stackId)) +GP_API void gpMacCore_SetExtendedAddress_STACKID(MACAddress_t* pExtendedAddress MACCORE_STACKID_ARG_2); + +/** @brief This function returns the extended MAC address of the device. + * @param pExtendedAddress The pointer to the address to read. +*/ +#define gpMacCore_GetExtendedAddress(pExtendedAddress, stackId) gpMacCore_GetExtendedAddress_STACKID(MACCORE_STACKID_MAP_2(pExtendedAddress,stackId)) +GP_API void gpMacCore_GetExtendedAddress_STACKID(MACAddress_t* pExtendedAddress MACCORE_STACKID_ARG_2); + +/** @brief This function sets the number of transmission retries. + * @param numberOfRetries The number of transmission retries to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetNumberOfRetries(numberOfRetries, stackId) gpMacCore_SetNumberOfRetries_STACKID(MACCORE_STACKID_MAP_2(numberOfRetries,stackId)) +GP_API void gpMacCore_SetNumberOfRetries_STACKID(UInt8 numberOfRetries MACCORE_STACKID_ARG_2); + +/** @brief This function sets the number of transmission retries. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetNumberOfRetries(stackId) gpMacCore_GetNumberOfRetries_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetNumberOfRetries_STACKID(MACCORE_STACKID_ARG_1); + +// THDP ?? add to the setget struct +#define gpMacCore_SetSecurityEnabled(securityEnabled, stackId) gpMacCore_SetSecurityEnabled_STACKID(MACCORE_STACKID_MAP_2(securityEnabled,stackId)) +GP_API void gpMacCore_SetSecurityEnabled_STACKID(Bool securityEnabled MACCORE_STACKID_ARG_2); + +#define gpMacCore_GetSecurityEnabled(stackId) gpMacCore_GetSecurityEnabled_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetSecurityEnabled_STACKID(MACCORE_STACKID_ARG_1); + + +/** @brief This function sets the BeaconStarted attribute. + * @param BeaconStarted The BeaconStarted attribute value to set. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetBeaconStarted(BeaconStarted, stackId) gpMacCore_SetBeaconStarted_STACKID(MACCORE_STACKID_MAP_2(BeaconStarted, stackId)) +void gpMacCore_SetBeaconStarted_STACKID(Bool BeaconStarted MACCORE_STACKID_ARG_2); +/** @brief This function returns the BeaconStarted attribute. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetBeaconStarted(stackId) gpMacCore_GetBeaconStarted_STACKID(MACCORE_STACKID_MAP_1(stackId)) +Bool gpMacCore_GetBeaconStarted_STACKID(MACCORE_STACKID_ARG_1); +/** @brief This function sets the tx antenna. + * @param txAntenna The tx antenna to be used. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetTxAntenna(txAntenna, stackId) gpMacCore_SetTxAntenna_STACKID(MACCORE_STACKID_MAP_2(txAntenna,stackId)) +GP_API void gpMacCore_SetTxAntenna_STACKID(UInt8 txAntenna MACCORE_STACKID_ARG_2); +/** @brief This function gets the tx antenna. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetTxAntenna(stackId) gpMacCore_GetTxAntenna_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetTxAntenna_STACKID(MACCORE_STACKID_ARG_1); +/** @brief This function sets the mac version. + * @param MacVersion The mac version of the stack. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetMacVersion(macVersion, stackId) gpMacCore_SetMacVersion_STACKID(MACCORE_STACKID_MAP_2(macVersion,stackId)) +GP_API void gpMacCore_SetMacVersion_STACKID(gpMacCore_MacVersion_t macVersion MACCORE_STACKID_ARG_2); +/** @brief This function gets the mac version. + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_GetMacVersion(stackId) gpMacCore_GetMacVersion_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API gpMacCore_MacVersion_t gpMacCore_GetMacVersion_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief gpMacCore_SetIndicateBeaconNotifications. + * + * This function manipulates the indication of beacons by the MAC + * + * @param enable + * @note When enable is true, beacons will be indicated by the MAC to the specific stack + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_SetIndicateBeaconNotifications(enable, stackId) gpMacCore_SetIndicateBeaconNotifications_STACKID(MACCORE_STACKID_MAP_2(enable,stackId)) +GP_API void gpMacCore_SetIndicateBeaconNotifications_STACKID(Bool enable MACCORE_STACKID_ARG_2); + +/** @brief gpMacCore_GetIndicateBeaconNotifications. + * + * This function returns IndicateBeaconNotifications + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_GetIndicateBeaconNotifications(stackId) gpMacCore_GetIndicateBeaconNotifications_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetIndicateBeaconNotifications_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief gpMacCore_SetForwardPollIndication. + * + * This function manipulates the poll indication by the MAC + * + * @param enable + * @note When enable is true, poll indication will be forwarded by the MAC to the specific stack + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_SetForwardPollIndications(enable, stackId) gpMacCore_SetForwardPollIndications_STACKID(MACCORE_STACKID_MAP_2(enable,stackId)) +GP_API void gpMacCore_SetForwardPollIndications_STACKID(Bool enable MACCORE_STACKID_ARG_2); + +/** @brief gpMacCore_GetForwardPollIndications. + * + * This function returns the parameter ForwardPollIndications + * @param stackId The identifier of the stack doing this. +*/ +#define gpMacCore_GetForwardPollIndications(stackId) gpMacCore_GetForwardPollIndications_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetForwardPollIndications_STACKID(MACCORE_STACKID_ARG_1); + + + +#define gpMacCore_SetLqiThresholdForTest(lqiThreshold, stackId) gpMacCore_SetLqiThresholdForTest_STACKID(MACCORE_STACKID_MAP_2(lqiThreshold, stackId)) +GP_API void gpMacCore_SetLqiThresholdForTest_STACKID(UInt8 lqiThreshold MACCORE_STACKID_ARG_2); + +#define gpMacCore_GetLqiThresholdForTest(stackId) gpMacCore_GetLqiThresholdForTest_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetLqiThresholdForTest_STACKID(MACCORE_STACKID_ARG_1); + +#define gpMacCore_SetAddressModeOverrideForBeacons(addressMode, stackId) gpMacCore_SetAddressModeOverrideForBeacons_STACKID(MACCORE_STACKID_MAP_2(addressMode, stackId)) +GP_API void gpMacCore_SetAddressModeOverrideForBeacons_STACKID(UInt8 addressMode MACCORE_STACKID_ARG_2); + +#define gpMacCore_GetAddressModeOverrideForBeacons(stackId) gpMacCore_GetAddressModeOverrideForBeacons_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API UInt8 gpMacCore_GetAddressModeOverrideForBeacons_STACKID(MACCORE_STACKID_ARG_1); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +GP_API void gpMacCore_SetFrameCounter(UInt32 frameCounter, gpMacCore_StackId_t stackId); +GP_API UInt32 gpMacCore_GetFrameCounter(gpMacCore_StackId_t stackId); +GP_API gpMacCore_Result_t gpMacCore_SetKeyDescriptor(gpMacCore_KeyDescriptor_t *pKeyDescriptor, gpMacCore_Index_t index); +GP_API gpMacCore_Result_t gpMacCore_GetKeyDescriptor(gpMacCore_KeyDescriptor_t *pKeyDescriptor, gpMacCore_Index_t index); +GP_API void gpMacCore_SetKeyTableEntries(gpMacCore_KeyTablesEntries_t keyTableEntries); +GP_API gpMacCore_KeyTablesEntries_t gpMacCore_GetKeyTableEntries(void); +GP_API gpMacCore_Result_t gpMacCore_SetDeviceDescriptor(gpMacCore_DeviceDescriptor_t *pDeviceDescriptor, gpMacCore_Index_t index); +GP_API gpMacCore_Result_t gpMacCore_GetDeviceDescriptor(gpMacCore_DeviceDescriptor_t * pDeviceDescriptor , gpMacCore_Index_t index); +GP_API void gpMacCore_SetDeviceTableEntries(gpMacCore_DeviceTablesEntries_t deviceTableEntries); +GP_API gpMacCore_DeviceTablesEntries_t gpMacCore_GetDeviceTableEntries(void); +GP_API gpMacCore_Result_t gpMacCore_SetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index); +GP_API gpMacCore_Result_t gpMacCore_GetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t *pSecurityLevelDescriptor , gpMacCore_Index_t index); +GP_API gpMacCore_SecurityLevelTableEntries_t gpMacCore_GetSecurityLevelTableEntries(void); +GP_API void gpMacCore_SetSecurityLevelTableEntries(gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries); +//GP_API gpMacCore_SecurityLevelTableEntries_t gpMacCore_GetDeviceTableEntries(void); +GP_API void gpMacCore_SetDefaultKeySource(UInt8 *pDefaultKeySource); +GP_API void gpMacCore_GetDefaultKeySource(UInt8 *pDefaultKeySource); +GP_API void gpMacCore_SetPanCoordExtendedAddress(MACAddress_t *pPanCoordExtendedAddress); +GP_API void gpMacCore_GetPanCoordExtendedAddress(MACAddress_t *pPanCoordExtendedAddress); +GP_API void gpMacCore_SetPanCoordShortAddress(UInt16 PanCoordShortAddress); +GP_API UInt16 gpMacCore_GetPanCoordShortAddress(void); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ +/** @brief Calls the DataConfirm callback function. It is used to indicate the result of a data transmission to the next higher layer. + * + * This function is the Confirm of a data Request. It gives info of the success or failure of the dataRequest. + * + * @param status Status of the DataTransmission. + * @param pdHandle The msduHandle that was given with the dataRequest is returned with the dataConfirm. This way, the next higher layer knows which packet generated the confirm. +*/ +void gpMacCore_cbDataConfirm(gpMacCore_Result_t status, gpPd_Handle_t pdHandle); + +/** @brief Calls the DataIndication callback function. It is used to inform the next higher layer a data packet is received. + * + * This function indicates (to the next higher layer) that a data packet is received. + * + * It has more or less the same parameters than the type gpMacCore_cbCPSDataIndication_t, + * except that is has one additional parameter handle and that the parameter pMsdu contains the address + * in the PBM memory where the data payload is located. + * + * This function is only used, when the PBM version of the MAC is used. + * + * @param pSrcAddrInfo All the information about the source (address mode, address and panId). + * @param pDstAddrInfo All the information about the destination (address mode, address and panId). + * @param DSN The data sequence number of the received data frame. + * @param *pSecOptions The security options purportedly used by the received frame (see IEEE802.15.4-2006). + * @param p_PdLoh The PD Length/Offset/Handle of the mpdu. + * @param stackId The stack Id this indication is ment for + * +*/ +void gpMacCore_cbDataIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 dsn, gpMacCore_Security_t *pSecOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId ); + + + /** @brief This function allows the MAC sublayer to notify the next higher layer of the + * success of its request to purge a packet from the transaction queue. + * + * @param status Status of the PurgeRequest. + * @param pdHandle The msduHandle that was given with the dataRequest. +*/ +void gpMacCore_cbPurgeConfirm(gpMacCore_Result_t status, gpPd_Handle_t pdHandle); + +/** @ingroup MLME_SAP + * @brief Calls the AssociateIndication function to indicate a node is trying to join. + * + * This function informs the next higher layer that an associate request command was received, indicating a device wishes to associate. + * + * @param pDeviceAddress A pointer to the address of the device that requested the association. This will always be an extended (64 bit) address. + * @param capabilityInformation The operational capabilities of the device requesting association as specified in the IEEE802.15.4-2006 specification. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbAssociateIndication(gpMacCore_Address_t* pDeviceAddress, UInt8 capabilityInformation, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t rxTime); + +/** @ingroup MLME_SAP + * @brief Calls the AssociateConfirm function, indicating the result of a previous issued AssociateRequest. + * + * This function is used to inform a device of its attempt to join a network. It indicates the results (joined or not) of a previous issued AssociateRequest. + * + * @param assocShortAddress The short address the device may use if the association was successful. + * @param status The status of the association attempt. If this indicates a success, the assocShortAddress field contains the short address the device may use. + * @param txTime transmission time of this message +*/ +void gpMacCore_cbAssociateConfirm(UInt16 assocShortAddress, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime); + +/** @ingroup MLME_SAP + * @brief Indicates a associate response communication status to the next higher layer. + * + * This function indication primitive allows the MLME to indicate a communications status. + * + * @param pSrcAddrInfo The src address information of the device. + * @param pDstAddrInfo The intended recipient of the message + * @param status The communications status. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbAssociateCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t txTime); + +/** @ingroup MLME_SAP + * @brief Indicates a communications status to the next higher layer. + * + * This function indication primitive allows the MLME to indicate a communications status. + * + * @param pSrcAddrInfo The src address information of the device. + * @param pDstAddrInfo The intended recipient of the message + * @param status The communications status. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbOrphanCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t txTime); + +/** @ingroup MLME_SAP + * @brief Indicates a security failure communication status to the next higher layer. + * + * This function indication primitive allows the MLME to indicate a communications status. + * + * @param pSrcAddrInfo The src address information of the device. + * @param pDstAddrInfo The intended recipient of the message + * @param status The communications status. + * @param stackId The stack Id this indication is ment for + * @param [t|r]xTime transmission/reception time of this message +*/ +void gpMacCore_cbSecurityFailureCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t txTime); + + +/** @ingroup MLME_SAP + * @brief Calls the BeaconNotifyIndication function. Informs the next higher layer a beacon packet containing a payload has been received. + * + * This function indicates a beacon with payload is received. + * + * @param bsn The sequence number of the beacon. + * @param pPanDescriptor A pointer to the PANDescriptor of the beacon, the values of this pointer should not be changed. + * @param stackId The stack Id this indication is ment for + * @param beaconPayloadLength The length of the beacon payload + * @param pBeaconPayload A pointer to the beacon payload, the values of this pointer should not be changed. +*/ +void gpMacCore_cbBeaconNotifyIndication( UInt8 bsn, gpMacCore_PanDescriptor_t* pPanDescriptor, gpMacCore_StackId_t stackId , UInt8 beaconPayloadLength , UInt8 *pBeaconPayload ); + +/** @brief Calls the ScanConfirm function, indicating the result of a previously issued ScanRequest to the next higher layer. + * + * This function indicates the result of a previously issued scan to the next higher layer. + * + * @param status The result of the scan. + * @param scanType The scanType that was performed. + * @param unscannedChannels A bitmask of the channels that were not scanned. + * @param resultListSize The size of the result list (For additional info see the ScanRequest function). + * @param resultList A pointer to the result List. +*/ +void gpMacCore_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, UInt32 unscannedChannels, UInt8 resultListSize, UInt8* pEdScanResultList); + +/** @brief Calls the OrphanIndication function. It is issued on a coordinator on receipt of an orphan notification command. + * + * This function indicates a device is orphanned. It is issued on a coordinator on receipt of an orphan notification command. + * + * @param pOrphanAddress A pointer to the extended address of the orphaned device. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbOrphanIndication(MACAddress_t* pOrphanAddress, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t rxTime); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + +/** @brief Calls the OrphanResponse function. + * +*/ +void gpMacCore_OrphanResponse(MACAddress_t* pOrphanAddress, UInt16 shortAddress, Bool associatedMember, gpMacCore_StackId_t stackId); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + +/** @brief Calls the PollIndication function. It is only invoked when the gpMacCore_SetForwardPollIndications() is enabled. + * + * This callback is only used when the upper layer implemnents its own data pending mechanism. + * All handling to send out the packet must be done by the higher layer upon receiving this callback. + * + * @param addressMode The address info used by the originator. + * @param stackId The stack Id this indication is ment for + * @param rxTime reception time of this message +*/ +void gpMacCore_cbPollIndication(gpMacCore_AddressInfo_t *addressInfo, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t rxTime); + +/** @brief Calls the PollNotify function. It is invoked when a data poll was received. + * + * All data Tx is handled automatically by the MAC stack using the queued packets. + * This notification serves as bookkeepping information for the higher layer. + * + * @param addressInfo The address info used by the originator + * @param rxTime Time at which the packet was received (in us) + * @param pdHandle Handle of the queued packet that will be transmitted in response to this response. If no data was pending, 0xFF is returned here. + * @param fromNeighbour True if the poll came from a device specified in the Neighbour table list - see the gpMacCore_AddNeighbour() API calls. + * @param stackId The stack Id this indication is ment for +*/ +void gpMacCore_cbPollNotify(gpMacCore_AddressInfo_t *addressInfo, gpMacCore_StackId_t stackId, gpPd_TimeStamp_t rxTime, gpPd_Handle_t pdHandle, Bool fromNeighbour); + +/** @brief Calls the SecurityFrameCounterIndication function. It is invoked when the security framecounter window exceeds the previous value with GP_MACCORE_FRAMECOUNTER_WINDOW. + * + * @param frameCounter New frame counter value + * @param stackId The stack Id this indication is ment for +*/ +void gpMacCore_cbSecurityFrameCounterIndication(UInt32 frameCounter, gpMacCore_StackId_t stackId); + + +/** @brief Calls the stackIdValid callback function. + * + * @param stackId The stackId to check for validity + */ + +GP_API Bool gpMacCore_cbValidStack(gpMacCore_StackId_t stackId); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +/** @brief Indicates stack adding or removal to the gpMacCore component + * + * @param stackId The stackId that was added or removed + */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ +GP_API void gpMacCore_StackAdded(gpMacCore_StackId_t stackId); +GP_API void gpMacCore_StackRemoved(gpMacCore_StackId_t stackId); +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + + +/** @brief This function Adds element to DataPending Queue + * + * @param element +*/ +GP_API gpMacCore_Result_t gpMacCore_DataPending_QueueAdd( gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); + + +/** @brief This function Removes element to DataPending Queue + * + * @param element +*/ +GP_API gpMacCore_Result_t gpMacCore_DataPending_QueueRemove( gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); + +/** @brief This function Removes all elements from the DataPending Queue + * + * @param stackId The stackId for which the dataPending queue needs to be cleared. +*/ +GP_API gpMacCore_Result_t gpMacCore_DataPending_QueueClear(gpMacCore_StackId_t stackId); + +/** @brief This function returns if the Data pending bit will be set in the next ACK + * + * @return dataPending +*/ +GP_API Bool gpMacCore_DataPendingGetAckDataPending(void); + +/** @brief This function sets interference level masks to allow operation alongside WiFi networks + * + * @return void +*/ +gpMacCore_Result_t gpMacCore_SetMinInterferenceLevels(Int8* pInterferenceLevels); + +/** @brief This function adds an address to the neighbour list (determines how to handle a poll request). + * + * @return Bool indicating success or fail +*/ +GP_API Bool gpMacCore_AddNeighbour (gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); + +/** @brief This function removes an address to the neighbour list (determines how to handle a poll request). + * + * @return Bool indicating success or fail +*/ +GP_API Bool gpMacCore_RemoveNeighbour(gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); + +/** @brief This function sets the mode to be used for datapending. + * + * @param dataPendingMode mode from gpMacCore_DataPendingMode_t enumeration to set. + * +*/ +GP_API gpMacCore_Result_t gpMacCore_SetDataPendingMode(gpMacCore_DataPendingMode_t dataPendingMode, gpMacCore_StackId_t stackId); + +/** @brief This function removes all neighbours from neighbour list. + * +*/ +GP_API void gpMacCore_ClearNeighbours(gpMacCore_StackId_t stackId); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + + + +/** @brief This function enables the raw mode of the stack. + * + * This mode allows the upper stack to create the MAC header while transmitting a packets, + * and to stop the MacCore from processing MAC headers, and instead passing them to the upper stack. + * + * @param rawModeEnabled Enables or disables the raw mode for a specific stack. +*/ +#define gpMacCore_SetStackInRawMode(rawModeEnabled, stackId) gpMacCore_SetStackInRawMode_STACKID(MACCORE_STACKID_MAP_2(rawModeEnabled, stackId)) +GP_API void gpMacCore_SetStackInRawMode_STACKID(Bool rawModeEnabled MACCORE_STACKID_ARG_2); + +/** @brief This function returns if the raw mode is enabled for a specific stack. + * + * @return rawModeEnabled Indicates if raw mode is enabled or disabled for a specific stack. +*/ +#define gpMacCore_GetStackInRawMode(stackId) gpMacCore_GetStackInRawMode_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetStackInRawMode_STACKID(MACCORE_STACKID_ARG_1); + +#define gpMacCore_SetRawModeEncryptionKeys(encryptionKeyIdMode, encryptionKeyId, pCurrKey, stackId) gpMacCore_SetRawModeEncryptionKeys_STACKID(MACCORE_STACKID_MAP_4(encryptionKeyIdMode, encryptionKeyId, pCurrKey, stackId)) +GP_API void gpMacCore_SetRawModeEncryptionKeys_STACKID(gpMacCore_KeyIdMode_t encryptionKeyIdMode, gpMacCore_KeyIndex_t encryptionKeyId, UInt8* pCurrKey MACCORE_STACKID_ARG_2); + +#define gpMacCore_SetRawModeNonceFields(frameCounter, pExtendedAddress, seclevel, stackId) gpMacCore_SetRawModeNonceFields_STACKID(MACCORE_STACKID_MAP_4(frameCounter, pExtendedAddress, seclevel, stackId)) +GP_API void gpMacCore_SetRawModeNonceFields_STACKID(UInt32 frameCounter, MACAddress_t* pExtendedAddress, UInt8 seclevel MACCORE_STACKID_ARG_2); + +/** @brief This function configures the insertion of a VS IE header in the Enh Ack frames containing probing data. + * + * @param linkMetrics Bitmask of link metrics which should be reported. + * @param pExtendedAddress The extended address of the probing initiator. + * @param shortAddress The short address of the probing initiator. + * @param stackId The stack id. +*/ +#define gpMacCore_ConfigureEnhAckProbing(linkMetrics, pExtendedAddress, shortAddress, stackId) gpMacCore_ConfigureEnhAckProbing_STACKID(MACCORE_STACKID_MAP_4(linkMetrics, pExtendedAddress, shortAddress, stackId)) +GP_API gpMacCore_Result_t gpMacCore_ConfigureEnhAckProbing_STACKID(UInt8 linkMetrics, MACAddress_t* pExtendedAddress, UInt16 shortAddress MACCORE_STACKID_ARG_2); + + +/** @brief This function enables the Enhanced FramePending behavior for a specific stack. + * + * @param enableEnhancedFramePending Enables or disables the Enhanced FramePending behavior for a specific stack. +*/ +#define gpMacCore_EnableEnhancedFramePending(enableEnhancedFramePending, stackId) gpMacCore_EnableEnhancedFramePending_STACKID(MACCORE_STACKID_MAP_2(enableEnhancedFramePending, stackId)) +GP_API void gpMacCore_EnableEnhancedFramePending(Bool enableEnhancedFramePending, gpMacCore_StackId_t stackId); + +/** @brief Enables Duty Cycled Rx window + * + * Enable a duty cycled Rx window + * + * @param dutyCycleOnTime The amount of time the radio will be on and in receive mode (in us) + * @param dutyCyclePeriod Period of the Rx Window (in us) + * @param recurrenceAmount Number of occurances that needs to be scheduled + * @param startTime Absolute start time (in us) of the rx windows + * @param stackId Stack id. +*/ +GP_API void gpMacCore_EnableRxWindows(UInt32 dutyCycleOnTime, UInt32 dutyCyclePeriod, UInt16 recurrenceAmount, UInt32 startTime, gpMacCore_StackId_t stackId); + +/** @brief Disables Duty Cycled Rx Windows + * + * Disable a periodic Rx window + * + * @param stackId The stack id for which the rx windows will be disabled. +*/ +GP_API void gpMacCore_DisableRxWindows(gpMacCore_StackId_t stackId); + +/** @brief Enables CSL IE insertion in Enhanced Acks + * + * Enables CSL IE insertion in Enhanced Acks + * + * @param dutyCyclePeriod The period in multiples of 160us that needs to be inserted in the CSL IE. + * @param stackId The stackId +*/ +GP_API void gpMacCore_EnableCsl(UInt16 dutyCyclePeriod, gpMacCore_StackId_t stackId); + +/** @brief Update the CSL samples time + * + * Update the CSL samples time at which the next Rx window should occur. + * This will be used in the phase calculation for the CSL IE. + * + * @param nextCslSampleTime The next CSL sample time in us (the rx window start without extra margin) + * @param stackId The stackId +*/ +GP_API void gpMacCore_UpdateCslSampleTime(UInt32 nextCslSampleTime, gpMacCore_StackId_t stackId); + +/** @brief Get the current time + * + * Retrieves the current local time on the chip. + * + * @return time the current local time on chip in us. +*/ +GP_API UInt32 gpMacCore_GetCurrentTimeUs(void); + +/** @brief This function enables or disables the Retransmits on CCA failures. + * + * This function enables or disables the Retransmits on CCA failures. The actual amount of retransmits + * is set through gpMacDispatcher_SetNumberOfRetries. As such this function only changes the + * default MAC 802.15.4-2015 behavior to also retransmit on a CCA fail. + * + * @param enable Enables or disables the Retransmits. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetRetransmitOnCcaFail(enable, stackId) gpMacCore_SetRetransmitOnCcaFail_STACKID(MACCORE_STACKID_MAP_2(enable,stackId)) +GP_API void gpMacCore_SetRetransmitOnCcaFail_STACKID(Bool enable MACCORE_STACKID_ARG_2); +/** @brief This function returns if the feature "Retransmits on CCA fail" is enabled for a stackId. + * + * This function returns if the feature "Retransmits on CCA fail" is enabled for a stackId. + * + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetRetransmitOnCcaFail(stackId) gpMacCore_GetRetransmitOnCcaFail_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetRetransmitOnCcaFail_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function enables or disables the random delays between subsequent retransmits. + * + * This function enables or disables the random delays between subsequent retransmits. + * The actual amount of retransmits is set through gpMacDispatcher_SetNumberOfRetries. As such this + * function only changes the default MAC 802.15.4-2015 behavior to add random delays between retransmits. + * + * @param enable Enables or disables the random delays between subsequent retransmits. + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_SetRetransmitRandomBackoff(enable, stackId) gpMacCore_SetRetransmitRandomBackoff_STACKID(MACCORE_STACKID_MAP_2(enable,stackId)) +GP_API void gpMacCore_SetRetransmitRandomBackoff_STACKID(Bool enable MACCORE_STACKID_ARG_2); +/** @brief This function returns if the feature "random delays between subsequent retransmits" is enabled for a stackId. + * + * This function returns if the feature "random delays between subsequent retransmits" is enabled for a stackId. + * + * @param stackId The identifier of the stack doing this +*/ +#define gpMacCore_GetRetransmitRandomBackoff(stackId) gpMacCore_GetRetransmitRandomBackoff_STACKID(MACCORE_STACKID_MAP_1(stackId)) +GP_API Bool gpMacCore_GetRetransmitRandomBackoff_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function configures the minimum backoff exponent for random delays between retransmits. + * + * This function configures the minimum backoff exponent for random delays between retransmits due to NoAck failures. + * See Thread v1.2.1 paragraph 3.2.7.4: Mac layer retries. + * Not to be confused with the backoff exponent for random delays between CCA failures! + * + * @param minBERetransmit The minimum backoff exponent. + * @param stackId The identifier of the stack +*/ +#define gpMacCore_SetMinBeRetransmit(minBERetransmit, stackId) gpMacCore_SetMinBeRetransmit_STACKID(MACCORE_STACKID_MAP_2(minBERetransmit,stackId)) +void gpMacCore_SetMinBeRetransmit_STACKID(UInt8 minBERetransmit MACCORE_STACKID_ARG_2); + +/** @brief This function returns the minimum backoff exponent for random delays between retransmits. + * + * This function returns the minimum backoff exponent for random delays between retransmits. + * + * @param stackId The identifier of the stack +*/ +#define gpMacCore_GetMinBeRetransmit(stackId) gpMacCore_GetMinBeRetransmit_STACKID(MACCORE_STACKID_MAP_1(stackId)) +UInt8 gpMacCore_GetMinBeRetransmit_STACKID(MACCORE_STACKID_ARG_1); + +/** @brief This function configures the maximum backoff exponent for random delays between retransmits. + * + * This function configures the maximum backoff exponent for random delays between retransmits due to NoAck failures. + * See Thread v1.2.1 paragraph 3.2.7.4: Mac layer retries. + * Not to be confused with the backoff exponent for random delays between CCA failures! + * + * @param maxBERetransmit The maximum backoff exponent. + * @param stackId The identifier of the stack +*/ +#define gpMacCore_SetMaxBeRetransmit(maxBERetransmit, stackId) gpMacCore_SetMaxBeRetransmit_STACKID(MACCORE_STACKID_MAP_2(maxBERetransmit,stackId)) +void gpMacCore_SetMaxBeRetransmit_STACKID(UInt8 maxBERetransmit MACCORE_STACKID_ARG_2); + +/** @brief This function returns the maximum backoff exponent for random delays between retransmits. + * + * This function returns the maximum backoff exponent for random delays between retransmits. + * + * @param stackId The identifier of the stack +*/ +#define gpMacCore_GetMaxBeRetransmit(stackId) gpMacCore_GetMaxBeRetransmit_STACKID(MACCORE_STACKID_MAP_1(stackId)) +UInt8 gpMacCore_GetMaxBeRetransmit_STACKID(MACCORE_STACKID_ARG_1); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif // _GP_MACCORE_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c new file mode 100644 index 0000000..26e9fb0 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/src/gen/gpMacCore_marshalling.c @@ -0,0 +1,529 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacCore_marshalling.c" + * + * MACCore + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpMacCore.h" +#include "gpMacCore_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif +/* AdditionalIncludes */ +#include "gpEncryption_marshalling.h" +#include "gpMacCore_marshalling.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACCORE + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpMacCore_DeviceDescriptor_t_buf2api(gpMacCore_DeviceDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_PanId_t_buf2api_1(&(pDest->panId), pSource, pIndex); + UInt16_buf2api_1(&(pDest->shortAddr), pSource, pIndex); + MACAddress_t_buf2api_1(&(pDest->extAddress), pSource, pIndex); + UInt32_buf2api_1(&(pDest->frameCounter), pSource, pIndex); + Bool_buf2api_1(&(pDest->exempt), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_DeviceDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DeviceDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_PanId_t_api2buf_1(pDest , &(pSource->panId), pIndex); + UInt16_api2buf_1(pDest , &(pSource->shortAddr), pIndex); + MACAddress_t_api2buf_1(pDest , &(pSource->extAddress), pIndex); + UInt32_api2buf_1(pDest , &(pSource->frameCounter), pIndex); + Bool_api2buf_1(pDest , &(pSource->exempt), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_KeyUsageDescriptor_t_buf2api(gpMacCore_KeyUsageDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_FrameType_t_buf2api_1(&(pDest->frameType), pSource, pIndex); + gpMacCore_Command_t_buf2api_1(&(pDest->commandFrameIdentifier), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeyUsageDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyUsageDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_FrameType_t_api2buf_1(pDest , &(pSource->frameType), pIndex); + gpMacCore_Command_t_api2buf_1(pDest , &(pSource->commandFrameIdentifier), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_KeyDeviceDescriptor_t_buf2api(gpMacCore_KeyDeviceDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_DeviceDescriptor_t_buf2api(&(pDest->deviceDescriptor), pSource, 1, pIndex); + Bool_buf2api_1(&(pDest->uniqueDevice), pSource, pIndex); + Bool_buf2api_1(&(pDest->blackListed), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeyDeviceDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyDeviceDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_DeviceDescriptor_t_api2buf(pDest , &(pSource->deviceDescriptor), 1, pIndex); + Bool_api2buf_1(pDest , &(pSource->uniqueDevice), pIndex); + Bool_api2buf_1(pDest , &(pSource->blackListed), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_Security_t_buf2api(gpMacCore_Security_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpEncryption_SecLevel_t_buf2api_1(&(pDest->securityLevel), pSource, pIndex); + gpMacCore_KeyIdMode_t_buf2api_1(&(pDest->keyIdMode), pSource, pIndex); + gpMacCore_KeySource_t_buf2api(gpMacCore_KeyIdModeExplicit8Octet , &(pDest->pKeySource), pSource, 1, pIndex); + gpMacCore_KeyIndex_t_buf2api_1(&(pDest->keyIndex), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_Security_t_api2buf(UInt8Buffer* pDest , const gpMacCore_Security_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpEncryption_SecLevel_t_api2buf_1(pDest , &(pSource->securityLevel), pIndex); + gpMacCore_KeyIdMode_t_api2buf_1(pDest , &(pSource->keyIdMode), pIndex); + gpMacCore_KeySource_t_api2buf(gpMacCore_KeyIdModeExplicit8Octet , pDest , &(pSource->pKeySource), 1, pIndex); + gpMacCore_KeyIndex_t_api2buf_1(pDest , &(pSource->keyIndex), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_AddressInfo_t_buf2api(gpMacCore_AddressInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_Address_t_buf2api(gpMacCore_AddressModeExtendedAddress , &(pDest->address), pSource, 1, pIndex); + gpMacCore_PanId_t_buf2api_1(&(pDest->panId), pSource, pIndex); + gpMacCore_AddressMode_t_buf2api_1(&(pDest->addressMode), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_AddressInfo_t_api2buf(UInt8Buffer* pDest , const gpMacCore_AddressInfo_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_Address_t_api2buf(gpMacCore_AddressModeExtendedAddress , pDest , &(pSource->address), 1, pIndex); + gpMacCore_PanId_t_api2buf_1(pDest , &(pSource->panId), pIndex); + gpMacCore_AddressMode_t_api2buf_1(pDest , &(pSource->addressMode), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_PanDescriptor_t_buf2api(gpMacCore_PanDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_buf2api_1(&(pDest->timeStamp), pSource, pIndex); + gpMacCore_SuperFrameSpec_t_buf2api_1(&(pDest->superFrame), pSource, pIndex); + UInt8_buf2api_1(&(pDest->logicalChannel), pSource, pIndex); + UInt8_buf2api_1(&(pDest->linkQuality), pSource, pIndex); + gpMacCore_AddressInfo_t_buf2api(&(pDest->coordAddressInfo), pSource, 1, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_PanDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_PanDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_api2buf_1(pDest , &(pSource->timeStamp), pIndex); + gpMacCore_SuperFrameSpec_t_api2buf_1(pDest , &(pSource->superFrame), pIndex); + UInt8_api2buf_1(pDest , &(pSource->logicalChannel), pIndex); + UInt8_api2buf_1(pDest , &(pSource->linkQuality), pIndex); + gpMacCore_AddressInfo_t_api2buf(pDest , &(pSource->coordAddressInfo), 1, pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_KeyIdLookupDescriptor_t_buf2api(gpMacCore_KeyIdLookupDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_buf2api((pDest->lookupData), pSource, 9, pIndex); + UInt8_buf2api_1(&(pDest->lookupDataSize), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeyIdLookupDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyIdLookupDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_api2buf(pDest , (pSource->lookupData), 9, pIndex); + UInt8_api2buf_1(pDest , &(pSource->lookupDataSize), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_KeyDescriptor_t_buf2api(gpMacCore_KeyDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_KeyIdLookupDescriptor_t_buf2api((pDest->keyIdLookupDescriptors), pSource, GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS, pIndex); + gpMacCore_KeyIdLookupListEntries_t_buf2api_1(&(pDest->keyIdLookupListEntries), pSource, pIndex); + gpMacCore_KeyDeviceDescriptor_t_buf2api((pDest->keyDeviceDescriptorList), pSource, GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS, pIndex); + gpMacCore_KeyDeviceListEntries_t_buf2api_1(&(pDest->keyDeviceListEntries), pSource, pIndex); + gpMacCore_KeyUsageDescriptor_t_buf2api((pDest->keyUsageDescriptorList), pSource, GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS, pIndex); + gpMacCore_KeyUsageListEntries_t_buf2api_1(&(pDest->keyUsageListEntries), pSource, pIndex); + UInt8_buf2api((pDest->key), pSource, 16, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeyDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_KeyDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_KeyIdLookupDescriptor_t_api2buf(pDest , (pSource->keyIdLookupDescriptors), GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS, pIndex); + gpMacCore_KeyIdLookupListEntries_t_api2buf_1(pDest , &(pSource->keyIdLookupListEntries), pIndex); + gpMacCore_KeyDeviceDescriptor_t_api2buf(pDest , (pSource->keyDeviceDescriptorList), GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS, pIndex); + gpMacCore_KeyDeviceListEntries_t_api2buf_1(pDest , &(pSource->keyDeviceListEntries), pIndex); + gpMacCore_KeyUsageDescriptor_t_api2buf(pDest , (pSource->keyUsageDescriptorList), GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS, pIndex); + gpMacCore_KeyUsageListEntries_t_api2buf_1(pDest , &(pSource->keyUsageListEntries), pIndex); + UInt8_api2buf(pDest , (pSource->key), 16, pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_SecurityLevelDescriptor_t_buf2api(gpMacCore_SecurityLevelDescriptor_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_FrameType_t_buf2api_1(&(pDest->frameType), pSource, pIndex); + gpMacCore_Command_t_buf2api_1(&(pDest->commandFrameIdentifier), pSource, pIndex); + gpEncryption_SecLevel_t_buf2api_1(&(pDest->securityMinimum), pSource, pIndex); + Bool_buf2api_1(&(pDest->deviceOverrideSecurityMinimum), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_SecurityLevelDescriptor_t_api2buf(UInt8Buffer* pDest , const gpMacCore_SecurityLevelDescriptor_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacCore_FrameType_t_api2buf_1(pDest , &(pSource->frameType), pIndex); + gpMacCore_Command_t_api2buf_1(pDest , &(pSource->commandFrameIdentifier), pIndex); + gpEncryption_SecLevel_t_api2buf_1(pDest , &(pSource->securityMinimum), pIndex); + Bool_api2buf_1(pDest , &(pSource->deviceOverrideSecurityMinimum), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_MultiChannelOptions_t_buf2api(gpMacCore_MultiChannelOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_buf2api((pDest->channel), pSource, 3, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_MultiChannelOptions_t_api2buf(UInt8Buffer* pDest , const gpMacCore_MultiChannelOptions_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_api2buf(pDest , (pSource->channel), 3, pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_TxTimingOptions_t_buf2api(gpMacCore_TxTimingOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_buf2api_1(&(pDest->txTimestamp), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_TxTimingOptions_t_api2buf(UInt8Buffer* pDest , const gpMacCore_TxTimingOptions_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_api2buf_1(pDest , &(pSource->txTimestamp), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_DiagRxCntr_t_buf2api(gpMacCore_DiagRxCntr_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_buf2api_1(&(pDest->lqi), pSource, pIndex); + gpPd_Rssi_t_buf2api_1(&(pDest->rssi), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_DiagRxCntr_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DiagRxCntr_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_api2buf_1(pDest , &(pSource->lqi), pIndex); + gpPd_Rssi_t_api2buf_1(pDest , &(pSource->rssi), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacCore_DiagTxCntr_t_buf2api(gpMacCore_DiagTxCntr_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_buf2api_1(&(pDest->avgRetryCntr), pSource, pIndex); + UInt32_buf2api_1(&(pDest->txCntr), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_DiagTxCntr_t_api2buf(UInt8Buffer* pDest , const gpMacCore_DiagTxCntr_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt32_api2buf_1(pDest , &(pSource->avgRetryCntr), pIndex); + UInt32_api2buf_1(pDest , &(pSource->txCntr), pIndex); + pSource++; + } +} + +// Union copy functions +gpMarshall_AckStatus_t gpMacCore_Address_t_buf2api(UInt8 unionid , gpMacCore_Address_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + switch (unionid) + { + case gpMacCore_AddressModeShortAddress: + { + UInt16_buf2api(&(pDest->Short), pSource, 1, pIndex); + break; + } + case gpMacCore_AddressModeExtendedAddress: + { + MACAddress_t_buf2api(&(pDest->Extended), pSource, 1, pIndex); + break; + } + default: + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF(" Extended (MACAddress_t): Unknown unionid %i",2,unionid); +#endif + break; + } + } + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_Address_t_api2buf(UInt8 unionid , UInt8Buffer* pDest , const gpMacCore_Address_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + switch (unionid) + { + case gpMacCore_AddressModeShortAddress: + { + UInt16_api2buf_1(pDest , &(pSource->Short), pIndex); + break; + } + case gpMacCore_AddressModeExtendedAddress: + { + MACAddress_t_api2buf_1(pDest , &(pSource->Extended), pIndex); + break; + } + default: + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF(" Extended (MACAddress_t): Unknown unionid %i",2,unionid); +#endif + break; + } + } + pSource++; + } +} +gpMarshall_AckStatus_t gpMacCore_KeySource_t_buf2api(UInt8 unionid , gpMacCore_KeySource_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + switch (unionid) + { + case gpMacCore_KeyIdModeExplicit4Octet: + { + UInt8_buf2api((pDest->pKeySource4), pSource, 4, pIndex); + break; + } + case gpMacCore_KeyIdModeExplicit8Octet: + { + UInt8_buf2api((pDest->pKeySource8), pSource, 8, pIndex); + break; + } + default: + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF(" pKeySource8 (UInt8): Unknown unionid %i",2,unionid); +#endif + break; + } + } + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacCore_KeySource_t_api2buf(UInt8 unionid , UInt8Buffer* pDest , const gpMacCore_KeySource_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + switch (unionid) + { + case gpMacCore_KeyIdModeExplicit4Octet: + { + UInt8_api2buf(pDest , (pSource->pKeySource4), 4, pIndex); + break; + } + case gpMacCore_KeyIdModeExplicit8Octet: + { + UInt8_api2buf(pDest , (pSource->pKeySource8), 8, pIndex); + break; + } + default: + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF(" pKeySource8 (UInt8): Unknown unionid %i",2,unionid); +#endif + break; + } + } + pSource++; + } +} + + +void gpMacCore_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/src/gpMacCore_defsDefines.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/src/gpMacCore_defsDefines.h new file mode 100644 index 0000000..639b8dd --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacCore/src/gpMacCore_defsDefines.h @@ -0,0 +1,336 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPMAC_CORE_DEFS_DEFINES_H_ +#define _GPMAC_CORE_DEFS_DEFINES_H_ +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpUtils.h" +#include "gpMacCore.h" +#include "gpRxArbiter.h" +#include "gpHal.h" +#include "gpEncryption.h" +#include "gpStat.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_MACCORE_SHORT_ADDR_SIZE 2 +#define GP_MACCORE_EXT_ADDR_SIZE 8 +#define GP_MACCORE_PANID_SIZE 2 +#define GP_MACCORE_FC_SIZE 2 +#define GP_MACCORE_SN_SIZE 1 +#define GP_MACCORE_IE_HEADER_SIZE 2 + +// Indexes for fields in framecontrol +#define GP_MACCORE_FRAME_TYPE_IDX 0 +#define GP_MACCORE_SECURITY_ENABLED_IDX 3 +#define GP_MACCORE_FRAME_PENDING_IDX 4 +#define GP_MACCORE_ACK_REQ_IDX 5 +#define GP_MACCORE_INTRA_PAN_IDX 6 +#define GP_MACCORE_SEQ_NO_SUPPRESSION_IDX 8 +#define GP_MACCORE_IE_PRESENT_IDX 9 +#define GP_MACCORE_DEST_ADDR_MODE_IDX 10 +#define GP_MACCORE_FRAME_VERSION_IDX 12 +#define GP_MACCORE_SRC_ADDR_MODE_IDX 14 + +// Bit masks for fields in framecontrol +#define GP_MACCORE_FRAME_TYPE_BM 0x0007 +#define GP_MACCORE_SECURITY_ENABLED_BM 0x0008 +#define GP_MACCORE_FRAME_PENDING_BM 0x0010 +#define GP_MACCORE_ACK_REQ_BM 0x0020 +#define GP_MACCORE_INTRA_PAN_BM 0x0040 +#define GP_MACCORE_SEQ_NO_SUPPRESSION_BM 0x0100 +#define GP_MACCORE_IE_PRESENT_BM 0x0200 +#define GP_MACCORE_DEST_ADDR_MODE_BM 0x0C00 +#define GP_MACCORE_FRAME_VERSION_BM 0x3000 +#define GP_MACCORE_SRC_ADDR_MODE_BM 0xC000 + +// Indexes for fields in superframe specification +#define MACCORE_SFS_BEACON_ORDER_IDX 0 +#define MACCORE_SFS_SUPERFRAME_ORDER_IDX 4 +#define MACCORE_SFS_FINAL_CAP_SLOT_IDX 8 +#define MACCORE_SFS_BATTERY_LIFE_EXT_IDX 12 +#define MACCORE_SFS_PAN_COORDINATOR_IDX 14 +#define MACCORE_SFS_ASSOCIATION_PERMIT_IDX 15 + +// Bit masks for fields in superframe specification +#define MACCORE_SFS_BEACON_ORDER_BM 0x000F +#define MACCORE_SFS_SUPERFRAME_ORDER_BM 0x00F0 +#define MACCORE_SFS_FINAL_CAP_SLOT_BM 0x0F00 +#define MACCORE_SFS_BATTERY_LIFE_EXT_BM 0x1000 +#define MACCORE_SFS_PAN_COORDINATOR_BM 0x4000 +#define MACCORE_SFS_ASSOCIATION_PERMIT_BM 0x8000 + +//Bit masks for pending address specification in a beacon (5.2.2.1.6) +#define GP_MACCORE_BCN_SHORT_ADDRS_SPEC_BM 0x0007 +#define GP_MACCORE_BCN_EXT_ADDRS_SPEC_BM 0x0070 +#define GP_MACCORE_BCN_SHORT_ADDRS_SPEC_IDX 0 +#define GP_MACCORE_BCN_EXT_ADDRS_SPEC_IDX 4 + +// Indexes for fields in security control +#define GP_MACCORE_SEC_LEVEL_IDX 0 +#define GP_MACCORE_KEY_ID_MODE_IDX 3 + +// Bit masks for fields in security control +#define GP_MACCORE_SEC_LEVEL_BM 0x07 +#define GP_MACCORE_KEY_ID_MODE_BM 0x18 + +// Bit masks for fields in IEs +#define GP_MACCORE_IE_LENGTH_IDX 0 +#define GP_MACCORE_IE_ELEMENTID_IDX 7 +#define GP_MACCORE_IE_TYPE_IDX 15 + +// Bit masks for fields in IEs +#define GP_MACCORE_IE_LENGTH_BM 0x3F +#define GP_MACCORE_IE_ELEMENTID_BM 0x7F80 +#define GP_MACCORE_IE_TYPE_BM 0x8000 + +#define GP_MACCORE_TRANSACTION_PERSISTENCE_TIME_TO_US(time) ((UInt32)time*(GP_MACCORE_BASE_SUPERFRAME_DURATION*GP_MACCORE_SYMBOL_DURATION)) + +// mac constants +#define GP_MACCORE_UNIT_BACKOFF_PERIOD 20 + +#define GP_MACCORE_ASSOCIATION_REQUEST_CMD_LEN 2 +#define GP_MACCORE_ASSOCIATION_RESPONSE_CMD_LEN 4 +#define GP_MACCORE_DATA_REQUEST_CMD_LEN 1 +#define GP_MACCORE_ORPHAN_NOTIFICATION_CMD_LEN 1 +#define GP_MACCORE_BEACON_REQUEST_CMD_LEN 1 +#define GP_MACCORE_COORDINATOR_REALIGNMENT_CMD_LEN 8 + +#define GP_MACCORE_GTS_FIELDS 0 +#define GP_MACCORE_PENDING_ADDRESS_FIELDS 0 + +// mac constants +#define GP_MACCORE_NUMBER_OF_RETRIES 3 +#define GP_MACCORE_RESPONSE_WAIT_TIME 32*GP_MACCORE_BASE_SUPERFRAME_DURATION //in symbols so *16 for in us +#define GP_MACCORE_WORST_CCA_RETRIES_TIME 53 // 2^3 - 1 + 2^4 - 1 + 2^5 - 1 // in backofPeriods + + +#define GP_MACCORE_WORST_CASE_CCA_RETRY_TIME (UInt32)(GP_MACCORE_NUMBER_OF_RETRIES+1)*(GP_MACCORE_WORST_CCA_RETRIES_TIME * GP_MACCORE_UNIT_BACKOFF_PERIOD +(GP_MACCORE_MAX_PHY_PACKET_SIZE+GP_MACCORE_MIN_FRAME_OVERHEAD)*2 + GP_MACCORE_ACK_WAIT_DURATION) * GP_MACCORE_SYMBOL_DURATION /* in us */ + +#define GP_MACCORE_MAX_FRAME_RESPONSE_TIME 1220 // symbols +#define GP_MACCORE_MAX_NUMBER_OF_RETRANSMITTED_MESSAGES_FILTER_EVENTS GP_MEMORY_ALLOCATOR_NUMBER_MAC_SEQUENCENUMBER_FILTER_EVENT + +#define GP_MACCORE_INDIRECT_PACKET_SIZE_QUEUE 2 + +#define GP_MACCORE_NUMBER_OF_CHANNELS 16 + +// definitions used for the hardware scheduler, values from 0 till 0xF are available for use +#define GP_MACCORE_ES_SCHED_ISR 0xA +#define GP_MACCORE_ACL_ENTRY 0x8 + +#define GP_MACCORE_FRAME_COUNTER_MAXIMUM 0xFFFFFFFF +#define GP_MACCORE_IE_HEADER_TERMINATION 0x3F80 + +/** This function sets bits in the frame control field of the MAC header. + * + * @param bf The buffer that contains the frame control byte. + * @param bm The shifted bit mask of the bits to set. + * @param idx The bit index of the bits to set. + * @param v The value to set. + */ +#define MACCORE_BM_SET(bf,bm,idx,v) bf &= ~bm; bf |= (((UInt16)v) << idx) +#define MACCORE_BM_GET(header, mask, idx) ((header & mask) >> idx) + +#define MACCORE_FRAMECONTROL_FRAMETYPE_SET(header, type) MACCORE_BM_SET(header, GP_MACCORE_FRAME_TYPE_BM, GP_MACCORE_FRAME_TYPE_IDX, type) +#define MACCORE_FRAMECONTROL_SECURITY_SET(header, security) MACCORE_BM_SET(header, GP_MACCORE_SECURITY_ENABLED_BM, GP_MACCORE_SECURITY_ENABLED_IDX, security) +#define MACCORE_FRAMECONTROL_ACKREQUEST_SET(header, ackreq) MACCORE_BM_SET(header, GP_MACCORE_ACK_REQ_BM, GP_MACCORE_ACK_REQ_IDX, ackreq) +#define MACCORE_FRAMECONTROL_FRAMEPENDING_SET(header, fpPending) MACCORE_BM_SET(header, GP_MACCORE_FRAME_PENDING_BM, GP_MACCORE_FRAME_PENDING_IDX, fpPending) +#define MACCORE_FRAMECONTROL_PANCOMPRESSION_SET(header, panComp) MACCORE_BM_SET(header, GP_MACCORE_INTRA_PAN_BM, GP_MACCORE_INTRA_PAN_IDX, panComp) +#define MACCORE_FRAMECONTROL_SEQNOSUPPRESSION_SET(header, version) MACCORE_BM_SET(header, GP_MACCORE_SEQ_NO_SUPPRESSION_BM, GP_MACCORE_SEQ_NO_SUPPRESSION_IDX, version) +#define MACCORE_FRAMECONTROL_IE_PRESENT_SET(header, iePresent) MACCORE_BM_SET(header, GP_MACCORE_IE_PRESENT_BM, GP_MACCORE_IE_PRESENT_IDX, panComp) +#define MACCORE_FRAMECONTROL_FRAMEVERSION_SET(header, version) MACCORE_BM_SET(header, GP_MACCORE_FRAME_VERSION_BM, GP_MACCORE_FRAME_VERSION_IDX, version) +#define MACCORE_FRAMECONTROL_DSTADDRMODE_SET(header, mode) MACCORE_BM_SET(header, GP_MACCORE_DEST_ADDR_MODE_BM, GP_MACCORE_DEST_ADDR_MODE_IDX, mode) +#define MACCORE_FRAMECONTROL_SRCADDRMODE_SET(header, mode) MACCORE_BM_SET(header, GP_MACCORE_SRC_ADDR_MODE_BM, GP_MACCORE_SRC_ADDR_MODE_IDX, mode) + +#define MACCORE_FRAMECONTROL_FRAMETYPE_GET(header) MACCORE_BM_GET(header, GP_MACCORE_FRAME_TYPE_BM, GP_MACCORE_FRAME_TYPE_IDX) +#define MACCORE_FRAMECONTROL_SECURITY_GET(header) MACCORE_BM_GET(header, GP_MACCORE_SECURITY_ENABLED_BM, GP_MACCORE_SECURITY_ENABLED_IDX) +#define MACCORE_FRAMECONTROL_FRAMEPENDING_GET(header) MACCORE_BM_GET(header, GP_MACCORE_FRAME_PENDING_BM,GP_MACCORE_FRAME_PENDING_IDX) +#define MACCORE_FRAMECONTROL_PANCOMPRESSION_GET(header) MACCORE_BM_GET(header, GP_MACCORE_INTRA_PAN_BM,GP_MACCORE_INTRA_PAN_IDX) +#define MACCORE_FRAMECONTROL_IE_PRESENT_GET(header) MACCORE_BM_GET(header, GP_MACCORE_IE_PRESENT_BM,GP_MACCORE_IE_PRESENT_IDX) +#define MACCORE_FRAMECONTROL_FRAMEVERSION_GET(header) MACCORE_BM_GET(header, GP_MACCORE_FRAME_VERSION_BM, GP_MACCORE_FRAME_VERSION_IDX) +#define MACCORE_FRAMECONTROL_SEQNOSUPPRESSION_GET(header) MACCORE_BM_GET(header, GP_MACCORE_SEQ_NO_SUPPRESSION_BM, GP_MACCORE_SEQ_NO_SUPPRESSION_IDX) +#define MACCORE_FRAMECONTROL_HASIEELEMENTS_GET(header) MACCORE_BM_GET(header, GP_MACCORE_HAS_IE_ELEMENTS_BM, GP_MACCORE_HAS_IE_ELEMENTS_IDX) +#define MACCORE_FRAMECONTROL_DSTADDRMODE_GET(header) MACCORE_BM_GET(header, GP_MACCORE_DEST_ADDR_MODE_BM,GP_MACCORE_DEST_ADDR_MODE_IDX) +#define MACCORE_FRAMECONTROL_SRCADDRMODE_GET(header) MACCORE_BM_GET(header, GP_MACCORE_SRC_ADDR_MODE_BM,GP_MACCORE_SRC_ADDR_MODE_IDX) + +#define MACCORE_SECCONTROL_SECLEVEL_SET(secControl, secLevel) MACCORE_BM_SET(secControl, GP_MACCORE_SEC_LEVEL_BM, GP_MACCORE_SEC_LEVEL_IDX, secLevel) +#define MACCORE_SECCONTROL_KEYIDMODE_SET(secControl, mode) MACCORE_BM_SET(secControl, GP_MACCORE_KEY_ID_MODE_BM, GP_MACCORE_KEY_ID_MODE_IDX, mode) + +#define MACCORE_SECCONTROL_SECLEVEL_GET(secControl) (secControl & 0x07) +#define MACCORE_SECCONTROL_KEYIDMODE_GET(secControl) MACCORE_BM_GET(secControl, GP_MACCORE_KEY_ID_MODE_BM,GP_MACCORE_KEY_ID_MODE_IDX) + +#define MACCORE_SFS_BEACON_ORDER_SET(superframeSpec, bo) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_BEACON_ORDER_BM, MACCORE_SFS_BEACON_ORDER_IDX, bo) +#define MACCORE_SFS_SUPERFRAME_ORDER_SET(superframeSpec, so) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_SUPERFRAME_ORDER_BM, MACCORE_SFS_SUPERFRAME_ORDER_IDX, so) +#define MACCORE_SFS_FINAL_CAP_SLOT_SET(superframeSpec, fcs) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_FINAL_CAP_SLOT_BM, MACCORE_SFS_FINAL_CAP_SLOT_IDX, fcs) +#define MACCORE_SFS_BATTERY_LIFE_EXTENSION_SET(superframeSpec, ble) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_BATTERY_LIFE_EXT_BM, MACCORE_SFS_BATTERY_LIFE_EXT_IDX, ble) +#define MACCORE_SFS_PAN_COORDINATOR_SET(superframeSpec, pc) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_PAN_COORDINATOR_BM, MACCORE_SFS_PAN_COORDINATOR_IDX, pc) +#define MACCORE_SFS_ASSOCIATION_PERMIT_SET(superframeSpec, ap) MACCORE_BM_SET(superframeSpec, MACCORE_SFS_ASSOCIATION_PERMIT_BM, MACCORE_SFS_ASSOCIATION_PERMIT_IDX, ap) + + +#define MACCORE_ADRR_PENDING_SHORT_GET(addrPendingSpec) MACCORE_BM_GET(addrPendingSpec, GP_MACCORE_BCN_SHORT_ADDRS_SPEC_BM, GP_MACCORE_BCN_SHORT_ADDRS_SPEC_IDX) +#define MACCORE_ADRR_PENDING_EXT_GET(addrPendingSpec) MACCORE_BM_GET(addrPendingSpec, GP_MACCORE_BCN_EXT_ADDRS_SPEC_BM, GP_MACCORE_BCN_EXT_ADDRS_SPEC_IDX) + +/* Macros for parsing through the IE header elements: */ +#define MACCORE_IE_TYPE_HEADER 0 +#define MACCORE_IE_TYPE_PAYLOAD 1 + +#define MACCORE_IE_ID_CSL 0x1A +#define MACCORE_IE_ID_HT1 0x7E +#define MACCORE_IE_ID_HT2 0x7F + +// Indexes for fields in information element headers +#define GP_MACCORE_IEHEADER_LENGTH_IDX 0 +#define GP_MACCORE_IEHEADER_ELEMENTID_IDX 7 +#define GP_MACCORE_IEHEADER_TYPE_IDX 15 + +// Bit masks for fields in information element headers +#define GP_MACCORE_IEHEADER_LENGTH_BM 0x007F +#define GP_MACCORE_IEHEADER_ELEMENTID_BM 0x7F80 +#define GP_MACCORE_IEHEADER_TYPE_BM 0x8000 + +#define MACCORE_IEHEADER_LENGTH_GET(header) MACCORE_BM_GET(header, GP_MACCORE_IEHEADER_LENGTH_BM,GP_MACCORE_IEHEADER_LENGTH_IDX) +#define MACCORE_IEHEADER_ELEMENTID_GET(header) MACCORE_BM_GET(header, GP_MACCORE_IEHEADER_ELEMENTID_BM,GP_MACCORE_IEHEADER_ELEMENTID_IDX) +#define MACCORE_IEHEADER_TYPE_GET(header) MACCORE_BM_GET(header, GP_MACCORE_IEHEADER_TYPE_BM,GP_MACCORE_IEHEADER_TYPE_IDX) + + +// defines to access different fields within nonce +#define GP_MACCORE_NONCE_LENGTHOF_ADDRESS sizeof(MACAddress_t) +#define GP_MACCORE_NONCE_LENGTHOF_FRAME_COUNTER sizeof(UInt32) +#define GP_MACCORE_NONCE_LENGTHOF_SEC_LEVEL sizeof(UInt8) + +#define GP_MACCORE_NONCE_STARTOF_ADDRESS 0 +#define GP_MACCORE_NONCE_STARTOF_FRAME_COUNTER GP_MACCORE_NONCE_LENGTHOF_ADDRESS +#define GP_MACCORE_NONCE_STARTOF_SEC_LEVEL (GP_MACCORE_NONCE_LENGTHOF_ADDRESS + GP_MACCORE_NONCE_LENGTHOF_FRAME_COUNTER) + + +#ifndef GP_MACCORE_MEMORY_ALLOCATOR_CATCHING_TRAIN_LIST_SIZE +#define GP_MACCORE_MEMORY_ALLOCATOR_CATCHING_TRAIN_LIST_SIZE 8 +#endif //GP_MACCORE_MEMORY_ALLOCATOR_CATCHING_TRAIN_LIST_SIZE + +#define GP_MACCORE_INVALID_KEY_TABLE_ENTRY 0xFF +#define GP_MACCORE_INVALID_KEY_DEVICE_LIST_ENTRY 0xFF +#define GP_MACCORE_INVALID_HEADER_LENGTH 0 + +#define GP_MACCORE_FRAME_TYPE_FILTER_MASK_DEFAULT (GPHAL_ENUM_FRAME_TYPE_FILTER_BCN_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_RSV_MASK) + +#define GP_MACCORE_FRAME_TYPE_FILTER_MASK_ONLY_CMD (GPHAL_ENUM_FRAME_TYPE_FILTER_BCN_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_DATA_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_ACK_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_RSV_MASK) + +#define GP_MACCORE_FRAME_TYPE_FILTER_MASK_ONLY_BCN (GPHAL_ENUM_FRAME_TYPE_FILTER_CMD_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_DATA_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_ACK_MASK | \ + GPHAL_ENUM_FRAME_TYPE_FILTER_RSV_MASK) + +#define GP_MACCORE_ADDRESS_MODE_NOOVERRIDE 0xFF + +#ifndef GP_MACCORE_MAX_NEIGHBOURS +#define GP_MACCORE_MAX_NEIGHBOURS 16 +#endif //GP_MACCORE_MAX_NEIGHBOURS + +#ifndef GP_MACCORE_INDTX_ENTRIES +#define GP_MACCORE_INDTX_ENTRIES GP_PD_NR_OF_HANDLES +#endif // GP_MACCORE_INDTX_ENTRIES + +#ifndef GP_MACCORE_MAX_ASSOC_RESP +#define GP_MACCORE_MAX_ASSOC_RESP 10 +#endif // GP_MACCORE_MAX_ASSOC_RESP + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpMacCore_AddressInfo_t coordAddrInfo; + gpMacCore_StackId_t stackId; + gpMacCore_Result_t result; + UInt16 responseShortAddr; + UInt32 txTimestamp; + Bool assoc; + gpPd_Handle_t pdHandle; +}MacCore_PollReqArgs_t; + +#define MacCore_SecurityLevelPassedFalse 0 +#define MacCore_SecurityLevelPassedConditionallyPassed 1 +#define MacCore_SecurityLevelPassedTrue 2 +typedef UInt8 MacCore_SecurityLevelPassed_t; + +typedef struct { + gpMacCore_ScanType_t currentScanType; + UInt16 requestChannels; + UInt16 scanChannels; + UInt32 scanDurationUc; + UInt8 resultListSize; + UInt8 resultListSizeMax; + UInt8 origPhyChannel; + UInt16 unscannedChannels; + union un{ + UInt8 origFilterMask; + }un_t; + UInt8* pEnergyDetectList; + gpMacCore_StackId_t stackId; + UInt8 scannedChannelCounter; + UInt32 scanDurationRemaining; + Int16 cummulatedRssi; +} gpMacCore_ScanState_t; + +typedef struct { + UInt16 frameControl; + gpMacCore_FrameType_t frameType; + UInt8 sequenceNumber; + gpMacCore_AddressInfo_t srcAddrInfo; + gpMacCore_AddressInfo_t dstAddrInfo; + UInt32 frameCounter; + gpMacCore_Security_t secOptions; + gpMacCore_StackId_t stackId; +} MacCore_HeaderDescriptor_t; + +typedef struct { + UInt16 assocShortAddr; + gpMacCore_Result_t assocStatus; + gpMacCore_StackId_t stackId; + MACAddress_t deviceAddress; + Bool inFlight; +} MacCore_AssocRsp_t; + +#endif //_GPMAC_CORE_DEFS_DEFINES_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_clientServerCmdId.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_clientServerCmdId.h new file mode 100644 index 0000000..2afa937 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_clientServerCmdId.h @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacDispatcher_clientServerCmdId.h" + * + * MAC Dispatcher + * + * Client Server Link Command IDs +*/ + +#ifndef _GPMACDISPATCHER_CLIENTSERVERCMDID_H_ +#define _GPMACDISPATCHER_CLIENTSERVERCMDID_H_ + +/***************************************************************************** + * Common timeout + *****************************************************************************/ + +#ifndef GPMACDISPATCHER_GPCOMTIMEOUT_US +#define GPMACDISPATCHER_GPCOMTIMEOUT_US 10000000UL //10s +#endif //GPMACDISPATCHER_GPCOMTIMEOUT_US + +/***************************************************************************** + * Component Specific Command IDs + *****************************************************************************/ + +#define gpMacDispatcher_Init_CmdId 0x01 /*01*/ +#define gpMacDispatcher_RegisterNetworkStack_CmdId 0x02 /*02*/ +#define gpMacDispatcher_UnRegisterNetworkStack_CmdId 0x03 /*03*/ +#define gpMacDispatcher_LockClaim_CmdId 0x05 /*05*/ +#define gpMacDispatcher_LockRelease_CmdId 0x06 /*06*/ +#define gpMacDispatcher_LockedByThisStack_CmdId 0x07 /*07*/ +#define gpMacDispatcher_Locked_CmdId 0x08 /*08*/ +#define gpMacDispatcher_Reset_CmdId 0x09 /*09*/ +#define gpMacDispatcher_DataRequest_CmdId 0x0c /*12*/ +#define gpMacDispatcher_ScanRequest_CmdId 0x11 /*17*/ +#define gpMacDispatcher_AssociateRequest_CmdId 0x14 /*20*/ +#define gpMacDispatcher_AssociateResponse_CmdId 0x17 /*23*/ +#define gpMacDispatcher_PollRequest_CmdId 0x1c /*28*/ +#define gpMacDispatcher_PurgeRequest_CmdId 0x21 /*33*/ +#define gpMacDispatcher_Start_CmdId 0x24 /*36*/ +#define gpMacDispatcher_OrphanResponse_CmdId 0x2b /*43*/ +#define gpMacDispatcher_SetPanId_CmdId 0x2e /*46*/ +#define gpMacDispatcher_GetPanId_CmdId 0x2f /*47*/ +#define gpMacDispatcher_SetShortAddress_CmdId 0x30 /*48*/ +#define gpMacDispatcher_GetShortAddress_CmdId 0x31 /*49*/ +#define gpMacDispatcher_SetExtendedAddress_CmdId 0x32 /*50*/ +#define gpMacDispatcher_GetExtendedAddress_CmdId 0x33 /*51*/ +#define gpMacDispatcher_SetDsn_CmdId 0x34 /*52*/ +#define gpMacDispatcher_GetDsn_CmdId 0x35 /*53*/ +#define gpMacDispatcher_SetCurrentChannel_CmdId 0x36 /*54*/ +#define gpMacDispatcher_GetCurrentChannel_CmdId 0x37 /*55*/ +#define gpMacDispatcher_SetBeaconPayload_CmdId 0x38 /*56*/ +#define gpMacDispatcher_GetBeaconPayload_CmdId 0x39 /*57*/ +#define gpMacDispatcher_SetBeaconPayloadLength_CmdId 0x3a /*58*/ +#define gpMacDispatcher_GetBeaconPayloadLength_CmdId 0x3b /*59*/ +#define gpMacDispatcher_SetTxAntenna_CmdId 0x3c /*60*/ +#define gpMacDispatcher_GetTxAntenna_CmdId 0x3d /*61*/ +#define gpMacDispatcher_SetRxOnWhenIdle_CmdId 0x3e /*62*/ +#define gpMacDispatcher_GetRxOnWhenIdle_CmdId 0x3f /*63*/ +#define gpMacDispatcher_GetTransactionPersistenceTime_CmdId 0x40 /*64*/ +#define gpMacDispatcher_SetTransactionPersistenceTime_CmdId 0x41 /*65*/ +#define gpMacDispatcher_SetBeaconStarted_CmdId 0x42 /*66*/ +#define gpMacDispatcher_GetBeaconStarted_CmdId 0x43 /*67*/ +#define gpMacDispatcher_SetCoordShortAddress_CmdId 0x44 /*68*/ +#define gpMacDispatcher_GetCoordShortAddress_CmdId 0x45 /*69*/ +#define gpMacDispatcher_SetCoordExtendedAddress_CmdId 0x46 /*70*/ +#define gpMacDispatcher_GetCoordExtendedAddress_CmdId 0x47 /*71*/ +#define gpMacDispatcher_SetPromiscuousMode_CmdId 0x48 /*72*/ +#define gpMacDispatcher_GetPromiscuousMode_CmdId 0x49 /*73*/ +#define gpMacDispatcher_SetAssociationPermit_CmdId 0x4a /*74*/ +#define gpMacDispatcher_GetAssociationPermit_CmdId 0x4b /*75*/ +#define gpMacDispatcher_SetSecurityEnabled_CmdId 0x4c /*76*/ +#define gpMacDispatcher_GetSecurityEnabled_CmdId 0x4d /*77*/ +#define gpMacDispatcher_SetNumberOfRetries_CmdId 0x4f /*79*/ +#define gpMacDispatcher_GetNumberOfRetries_CmdId 0x50 /*80*/ +#define gpMacDispatcher_SetMaxCsmaBackoffs_CmdId 0x51 /*81*/ +#define gpMacDispatcher_GetMaxCsmaBackoffs_CmdId 0x52 /*82*/ +#define gpMacDispatcher_SetDefaultTransmitPowers_CmdId 0x53 /*83*/ +#define gpMacDispatcher_SetTransmitPower_CmdId 0x54 /*84*/ +#define gpMacDispatcher_GetTransmitPower_CmdId 0x55 /*85*/ +#define gpMacDispatcher_SetCCAMode_CmdId 0x56 /*86*/ +#define gpMacDispatcher_GetCCAMode_CmdId 0x57 /*87*/ +#define gpMacDispatcher_SetPanCoordinator_CmdId 0x58 /*88*/ +#define gpMacDispatcher_GetPanCoordinator_CmdId 0x59 /*89*/ +#define gpMacDispatcher_SetMinBE_CmdId 0x5a /*90*/ +#define gpMacDispatcher_GetMinBE_CmdId 0x5b /*91*/ +#define gpMacDispatcher_SetIndicateBeaconNotifications_CmdId 0x5c /*92*/ +#define gpMacDispatcher_GetIndicateBeaconNotifications_CmdId 0x5d /*93*/ +#define gpMacDispatcher_SetMacVersion_CmdId 0x60 /*96*/ +#define gpMacDispatcher_GetMacVersion_CmdId 0x61 /*97*/ +#define gpMacDispatcher_SetForwardPollIndications_CmdId 0x64 /*100*/ +#define gpMacDispatcher_GetForwardPollIndications_CmdId 0x65 /*101*/ +#define gpMacDispatcher_DataPending_QueueAdd_CmdId 0x66 /*102*/ +#define gpMacDispatcher_DataPending_QueueRemove_CmdId 0x67 /*103*/ +#define gpMacDispatcher_SetMinInterferenceLevels_CmdId 0x68 /*104*/ +#define gpMacDispatcher_SetMaxBE_CmdId 0x69 /*105*/ +#define gpMacDispatcher_GetMaxBE_CmdId 0x6a /*106*/ +#define gpMacDispatcher_SetDeviceDescriptor_CmdId 0x6e /*110*/ +#define gpMacDispatcher_GetDeviceDescriptor_CmdId 0x6f /*111*/ +#define gpMacDispatcher_SetDeviceTableEntries_CmdId 0x70 /*112*/ +#define gpMacDispatcher_GetDeviceTableEntries_CmdId 0x71 /*113*/ +#define gpMacDispatcher_SetKeyDescriptor_CmdId 0x72 /*114*/ +#define gpMacDispatcher_GetKeyDescriptor_CmdId 0x73 /*115*/ +#define gpMacDispatcher_SetKeyTableEntries_CmdId 0x74 /*116*/ +#define gpMacDispatcher_SetSecurityLevelDescriptor_CmdId 0x75 /*117*/ +#define gpMacDispatcher_GetSecurityLevelDescriptor_CmdId 0x76 /*118*/ +#define gpMacDispatcher_SetSecurityLevelTableEntries_CmdId 0x77 /*119*/ +#define gpMacDispatcher_GetSecurityLevelTableEntries_CmdId 0x78 /*120*/ +#define gpMacDispatcher_SetDefaultKeySource_CmdId 0x79 /*121*/ +#define gpMacDispatcher_SetFrameCounter_CmdId 0x7a /*122*/ +#define gpMacDispatcher_GetFrameCounter_CmdId 0x7b /*123*/ +#define gpMacDispatcher_SetPanCoordShortAddress_CmdId 0x7c /*124*/ +#define gpMacDispatcher_SetPanCoordExtendedAddress_CmdId 0x7d /*125*/ +#define gpMacDispatcher_GetPanCoordExtendedAddress_CmdId 0x7e /*126*/ +#define gpMacDispatcher_AddNeighbour_CmdId 0x81 /*129*/ +#define gpMacDispatcher_RemoveNeighbour_CmdId 0x82 /*130*/ +#define gpMacDispatcher_SetDataPendingMode_CmdId 0x83 /*131*/ +#define gpMacDispatcher_SetLqiThresholdForTest_CmdId 0x84 /*132*/ +#define gpMacDispatcher_SetAddressModeOverrideForBeacons_CmdId 0x85 /*133*/ +#define gpMacDispatcher_ClearNeighbours_CmdId 0x86 /*134*/ +#define gpMacDispatcher_SetCsmaMode_CmdId 0x8b /*139*/ +#define gpMacDispatcher_GetCsmaMode_CmdId 0x8c /*140*/ +#define gpMacDispatcher_DataPending_QueueClear_CmdId 0x8d /*141*/ +#define gpMacDispatcher_ScheduleTimedTx_CmdId 0x8e /*142*/ +#define gpMacDispatcher_SetRegionalDomainSettings_CmdId 0x8f /*143*/ +#define gpMacDispatcher_GetRegionalDomainSettings_CmdId 0x90 /*144*/ +#define gpMacDispatcher_SetAutoTxAntennaToggling_CmdId 0x91 /*145*/ +#define gpMacDispatcher_GetAutoTxAntennaToggling_CmdId 0x92 /*146*/ +#define gpMacDispatcher_SetMultipleChannelTable_CmdId 0x93 /*147*/ +#define gpMacDispatcher_SetStackInRawMode_CmdId 0x94 /*148*/ +#define gpMacDispatcher_GetStackInRawMode_CmdId 0x95 /*149*/ +#define gpMacDispatcher_SetRawModeEncryptionKeys_CmdId 0x96 /*150*/ +#define gpMacDispatcher_SetRawModeNonceFields_CmdId 0x97 /*151*/ +#define gpMacDispatcher_EnableEnhancedFramePending_CmdId 0x98 /*152*/ +#define gpMacDispatcher_EnableRxWindows_CmdId 0x99 /*153*/ +#define gpMacDispatcher_DisableRxWindows_CmdId 0x9a /*154*/ +#define gpMacDispatcher_EnableCsl_CmdId 0x9b /*155*/ +#define gpMacDispatcher_UpdateCslSampleTime_CmdId 0x9c /*156*/ +#define gpMacDispatcher_GetCurrentTimeUs_CmdId 0x9d /*157*/ +#define gpMacDispatcher_ConfigureEnhAckProbing_CmdId 0x9e /*158*/ +#define gpMacDispatcher_SetRetransmitOnCcaFail_CmdId 0x9f /*159*/ +#define gpMacDispatcher_GetRetransmitOnCcaFail_CmdId 0xa0 /*160*/ +#define gpMacDispatcher_SetRetransmitRandomBackoff_CmdId 0xa1 /*161*/ +#define gpMacDispatcher_GetRetransmitRandomBackoff_CmdId 0xa2 /*162*/ +#define gpMacDispatcher_SetMinBeRetransmit_CmdId 0xa3 /*163*/ +#define gpMacDispatcher_GetMinBeRetransmit_CmdId 0xa4 /*164*/ +#define gpMacDispatcher_SetMaxBeRetransmit_CmdId 0xa5 /*165*/ +#define gpMacDispatcher_GetMaxBeRetransmit_CmdId 0xa6 /*166*/ +#define MacDispatcher_cbDataConfirm_CmdId 0x0d /*13*/ +#define MacDispatcher_cbDataIndication_CmdId 0x0f /*15*/ +#define MacDispatcher_cbScanConfirm_CmdId 0x12 /*18*/ +#define MacDispatcher_cbAssociateIndication_CmdId 0x15 /*21*/ +#define MacDispatcher_cbAssociateConfirm_CmdId 0x18 /*24*/ +#define MacDispatcher_cbAssociateCommStatusIndication_CmdId 0x1a /*26*/ +#define MacDispatcher_cbPollConfirm_CmdId 0x1d /*29*/ +#define MacDispatcher_cbPollIndication_CmdId 0x1f /*31*/ +#define MacDispatcher_cbPurgeConfirm_CmdId 0x22 /*34*/ +#define MacDispatcher_cbBeaconNotifyIndication_CmdId 0x25 /*37*/ +#define MacDispatcher_cbOrphanIndication_CmdId 0x27 /*39*/ +#define MacDispatcher_cbOrphanCommStatusIndication_CmdId 0x29 /*41*/ +#define MacDispatcher_cbSecurityFailureCommStatusIndication_CmdId 0x2c /*44*/ +#define MacDispatcher_cbDriverResetIndication_CmdId 0x62 /*98*/ +#define MacDispatcher_cbPollNotify_CmdId 0x7f /*127*/ +#define MacDispatcher_cbSecurityFrameCounterIndication_CmdId 0x89 /*137*/ + +/***************************************************************************** + * Fixed Command IDs + *****************************************************************************/ + +#define gpMacDispatcher_Acknowledge_CmdId 0xfe /*254*/ +#define gpMacDispatcher_GetServerCompatibilityNumber_CmdId 0xfd /*253*/ + +#endif //_GPMACDISPATCHER_CLIENTSERVERCMDID_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_marshalling.h new file mode 100644 index 0000000..a4a31a6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen/gpMacDispatcher_marshalling.h @@ -0,0 +1,2613 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPMACDISPATCHER_MARSHALLING_H_ +#define _GPMACDISPATCHER_MARSHALLING_H_ + +//DOCUMENTATION MACDISPATCHER: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpMacDispatcher.h" +/* AdditionalIncludes */ +#include "gpPd_marshalling.h" +#include "gpMacCore_marshalling.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpMacDispatcher_StringIdentifier_t data[1]; +} gpMacDispatcher_StringIdentifier_t_l1_pointer_marshall_t; + + +typedef struct { + gpMacDispatcher_Callbacks_t data[1]; +} gpMacDispatcher_Callbacks_t_l1_pointer_marshall_t; + + + +typedef struct { + gpMacDispatcher_StringIdentifier_t* stringIdentifier; +} gpMacDispatcher_RegisterNetworkStack_Input_struct_t; + +typedef struct { + gpMacDispatcher_RegisterNetworkStack_Input_struct_t data; + gpMacDispatcher_StringIdentifier_t_l1_pointer_marshall_t stringIdentifier; +} gpMacDispatcher_RegisterNetworkStack_Input_marshall_struct_t; + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_RegisterNetworkStack_Output_struct_t; + +typedef struct { + gpMacDispatcher_RegisterNetworkStack_Output_struct_t data; +} gpMacDispatcher_RegisterNetworkStack_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_UnRegisterNetworkStack_Input_struct_t; + +typedef struct { + gpMacDispatcher_UnRegisterNetworkStack_Input_struct_t data; +} gpMacDispatcher_UnRegisterNetworkStack_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_UnRegisterNetworkStack_Output_struct_t; + +typedef struct { + gpMacDispatcher_UnRegisterNetworkStack_Output_struct_t data; +} gpMacDispatcher_UnRegisterNetworkStack_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; + gpMacDispatcher_Callbacks_t* callbacks; +} gpMacDispatcher_RegisterCallbacks_Input_struct_t; + +typedef struct { + gpMacDispatcher_RegisterCallbacks_Input_struct_t data; + gpMacDispatcher_Callbacks_t_l1_pointer_marshall_t callbacks; +} gpMacDispatcher_RegisterCallbacks_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_LockClaim_Input_struct_t; + +typedef struct { + gpMacDispatcher_LockClaim_Input_struct_t data; +} gpMacDispatcher_LockClaim_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacDispatcher_LockClaim_Output_struct_t; + +typedef struct { + gpMacDispatcher_LockClaim_Output_struct_t data; +} gpMacDispatcher_LockClaim_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_LockRelease_Input_struct_t; + +typedef struct { + gpMacDispatcher_LockRelease_Input_struct_t data; +} gpMacDispatcher_LockRelease_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_LockedByThisStack_Input_struct_t; + +typedef struct { + gpMacDispatcher_LockedByThisStack_Input_struct_t data; +} gpMacDispatcher_LockedByThisStack_Input_marshall_struct_t; + +typedef struct { + Bool locked; +} gpMacDispatcher_LockedByThisStack_Output_struct_t; + +typedef struct { + gpMacDispatcher_LockedByThisStack_Output_struct_t data; +} gpMacDispatcher_LockedByThisStack_Output_marshall_struct_t; + + +typedef struct { + Bool locked; +} gpMacDispatcher_Locked_Output_struct_t; + +typedef struct { + gpMacDispatcher_Locked_Output_struct_t data; +} gpMacDispatcher_Locked_Output_marshall_struct_t; + + +typedef struct { + Bool setDefaultPib; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_Reset_Input_struct_t; + +typedef struct { + gpMacDispatcher_Reset_Input_struct_t data; +} gpMacDispatcher_Reset_Input_marshall_struct_t; + +typedef struct { + gpMacDispatcher_Result_t result; +} gpMacDispatcher_Reset_Output_struct_t; + +typedef struct { + gpMacDispatcher_Reset_Output_struct_t data; +} gpMacDispatcher_Reset_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressMode_t srcAddrMode; + gpMacCore_AddressInfo_t* pDstAddressInfo; + UInt8 txOptions; + gpMacCore_Security_t* pSecOptions; + gpMacCore_MultiChannelOptions_t multiChannelOptions; + gpPd_Loh_t pdLoh; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_DataRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_DataRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddressInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; + gpMacCore_MultiChannelOptions_t_l1_pointer_marshall_t multiChannelOptions; + gpPd_Loh_t_l1_pointer_marshall_t pdLoh; +} gpMacDispatcher_DataRequest_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_ScanType_t scanType; + UInt32 scanChannels; + UInt8 scanDuration; + UInt8 resultListSize; + UInt8* pResultList; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_ScanRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_ScanRequest_Input_struct_t data; +} gpMacDispatcher_ScanRequest_Input_marshall_struct_t; + + +typedef struct { + UInt8 logicalChannel; + gpMacCore_AddressInfo_t* coordAddrInfo; + UInt8 capabilityInformation; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_AssociateRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_AssociateRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; +} gpMacDispatcher_AssociateRequest_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pDeviceAddress; + UInt16 associateShortAddress; + gpMacCore_Result_t status; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_AssociateResponse_Input_struct_t; + +typedef struct { + gpMacDispatcher_AssociateResponse_Input_struct_t data; + MACAddress_t pDeviceAddress[1]; +} gpMacDispatcher_AssociateResponse_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* coordAddrInfo; + gpMacCore_Security_t* pSecOptions; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_PollRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_PollRequest_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; +} gpMacDispatcher_PollRequest_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_PurgeRequest_Input_struct_t; + +typedef struct { + gpMacDispatcher_PurgeRequest_Input_struct_t data; +} gpMacDispatcher_PurgeRequest_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_PanId_t panId; + UInt8 logicalChannel; + Bool panCoordinator; + UInt8 stackId; +} gpMacDispatcher_Start_Input_struct_t; + +typedef struct { + gpMacDispatcher_Start_Input_struct_t data; +} gpMacDispatcher_Start_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t returnValue; +} gpMacDispatcher_Start_Output_struct_t; + +typedef struct { + gpMacDispatcher_Start_Output_struct_t data; +} gpMacDispatcher_Start_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pOrphanAddress; + UInt16 shortAddress; + Bool associatedMember; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_OrphanResponse_Input_struct_t; + +typedef struct { + gpMacDispatcher_OrphanResponse_Input_struct_t data; + MACAddress_t pOrphanAddress[1]; +} gpMacDispatcher_OrphanResponse_Input_marshall_struct_t; + + +typedef struct { + UInt16 panId; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPanId_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPanId_Input_struct_t data; +} gpMacDispatcher_SetPanId_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetPanId_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetPanId_Input_struct_t data; +} gpMacDispatcher_GetPanId_Input_marshall_struct_t; + +typedef struct { + gpMacCore_PanId_t panId; +} gpMacDispatcher_GetPanId_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetPanId_Output_struct_t data; +} gpMacDispatcher_GetPanId_Output_marshall_struct_t; + + +typedef struct { + UInt16 shortAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetShortAddress_Input_struct_t data; +} gpMacDispatcher_SetShortAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetShortAddress_Input_struct_t data; +} gpMacDispatcher_GetShortAddress_Input_marshall_struct_t; + +typedef struct { + UInt16 address; +} gpMacDispatcher_GetShortAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetShortAddress_Output_struct_t data; +} gpMacDispatcher_GetShortAddress_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pExtendedAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetExtendedAddress_Input_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacDispatcher_SetExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetExtendedAddress_Input_struct_t data; +} gpMacDispatcher_GetExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pExtendedAddress; +} gpMacDispatcher_GetExtendedAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetExtendedAddress_Output_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacDispatcher_GetExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + UInt8 dsn; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetDsn_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDsn_Input_struct_t data; +} gpMacDispatcher_SetDsn_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetDsn_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetDsn_Input_struct_t data; +} gpMacDispatcher_GetDsn_Input_marshall_struct_t; + +typedef struct { + UInt8 dsn; +} gpMacDispatcher_GetDsn_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetDsn_Output_struct_t data; +} gpMacDispatcher_GetDsn_Output_marshall_struct_t; + + +typedef struct { + UInt8 channel; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCurrentChannel_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCurrentChannel_Input_struct_t data; +} gpMacDispatcher_SetCurrentChannel_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCurrentChannel_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCurrentChannel_Input_struct_t data; +} gpMacDispatcher_GetCurrentChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 channel; +} gpMacDispatcher_GetCurrentChannel_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCurrentChannel_Output_struct_t data; +} gpMacDispatcher_GetCurrentChannel_Output_marshall_struct_t; + + +typedef struct { + UInt8* pBeaconPayload; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetBeaconPayload_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetBeaconPayload_Input_struct_t data; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} gpMacDispatcher_SetBeaconPayload_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetBeaconPayload_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconPayload_Input_struct_t data; +} gpMacDispatcher_GetBeaconPayload_Input_marshall_struct_t; + +typedef struct { + UInt8* pBeaconPayload; +} gpMacDispatcher_GetBeaconPayload_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconPayload_Output_struct_t data; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} gpMacDispatcher_GetBeaconPayload_Output_marshall_struct_t; + + +typedef struct { + UInt8 beaconPayloadLength; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetBeaconPayloadLength_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetBeaconPayloadLength_Input_struct_t data; +} gpMacDispatcher_SetBeaconPayloadLength_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetBeaconPayloadLength_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconPayloadLength_Input_struct_t data; +} gpMacDispatcher_GetBeaconPayloadLength_Input_marshall_struct_t; + +typedef struct { + UInt8 beaconPayloadLength; +} gpMacDispatcher_GetBeaconPayloadLength_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconPayloadLength_Output_struct_t data; +} gpMacDispatcher_GetBeaconPayloadLength_Output_marshall_struct_t; + + + + +typedef struct { + Bool rxOnWhenIdle; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetRxOnWhenIdle_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetRxOnWhenIdle_Input_struct_t data; +} gpMacDispatcher_SetRxOnWhenIdle_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetRxOnWhenIdle_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetRxOnWhenIdle_Input_struct_t data; +} gpMacDispatcher_GetRxOnWhenIdle_Input_marshall_struct_t; + +typedef struct { + Bool rxOnWhenIdle; +} gpMacDispatcher_GetRxOnWhenIdle_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetRxOnWhenIdle_Output_struct_t data; +} gpMacDispatcher_GetRxOnWhenIdle_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetTransactionPersistenceTime_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetTransactionPersistenceTime_Input_struct_t data; +} gpMacDispatcher_GetTransactionPersistenceTime_Input_marshall_struct_t; + +typedef struct { + UInt16 time; +} gpMacDispatcher_GetTransactionPersistenceTime_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetTransactionPersistenceTime_Output_struct_t data; +} gpMacDispatcher_GetTransactionPersistenceTime_Output_marshall_struct_t; + + +typedef struct { + UInt16 time; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetTransactionPersistenceTime_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetTransactionPersistenceTime_Input_struct_t data; +} gpMacDispatcher_SetTransactionPersistenceTime_Input_marshall_struct_t; + + +typedef struct { + Bool beaconStarted; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetBeaconStarted_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetBeaconStarted_Input_struct_t data; +} gpMacDispatcher_SetBeaconStarted_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetBeaconStarted_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconStarted_Input_struct_t data; +} gpMacDispatcher_GetBeaconStarted_Input_marshall_struct_t; + +typedef struct { + Bool beaconStarted; +} gpMacDispatcher_GetBeaconStarted_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetBeaconStarted_Output_struct_t data; +} gpMacDispatcher_GetBeaconStarted_Output_marshall_struct_t; + + +typedef struct { + UInt16 coordShortAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCoordShortAddress_Input_struct_t data; +} gpMacDispatcher_SetCoordShortAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCoordShortAddress_Input_struct_t data; +} gpMacDispatcher_GetCoordShortAddress_Input_marshall_struct_t; + +typedef struct { + UInt16 coordShortAddress; +} gpMacDispatcher_GetCoordShortAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCoordShortAddress_Output_struct_t data; +} gpMacDispatcher_GetCoordShortAddress_Output_marshall_struct_t; + + +typedef struct { + MACAddress_t* pCoordExtendedAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCoordExtendedAddress_Input_struct_t data; + MACAddress_t pCoordExtendedAddress[1]; +} gpMacDispatcher_SetCoordExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCoordExtendedAddress_Input_struct_t data; +} gpMacDispatcher_GetCoordExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pCoordExtendedAddress; +} gpMacDispatcher_GetCoordExtendedAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCoordExtendedAddress_Output_struct_t data; + MACAddress_t pCoordExtendedAddress[1]; +} gpMacDispatcher_GetCoordExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + UInt8 promiscuousMode; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPromiscuousMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPromiscuousMode_Input_struct_t data; +} gpMacDispatcher_SetPromiscuousMode_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetPromiscuousMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetPromiscuousMode_Input_struct_t data; +} gpMacDispatcher_GetPromiscuousMode_Input_marshall_struct_t; + +typedef struct { + Bool promiscuousMode; +} gpMacDispatcher_GetPromiscuousMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetPromiscuousMode_Output_struct_t data; +} gpMacDispatcher_GetPromiscuousMode_Output_marshall_struct_t; + + +typedef struct { + Bool associationPermit; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetAssociationPermit_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetAssociationPermit_Input_struct_t data; +} gpMacDispatcher_SetAssociationPermit_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetAssociationPermit_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetAssociationPermit_Input_struct_t data; +} gpMacDispatcher_GetAssociationPermit_Input_marshall_struct_t; + +typedef struct { + Bool associationPermit; +} gpMacDispatcher_GetAssociationPermit_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetAssociationPermit_Output_struct_t data; +} gpMacDispatcher_GetAssociationPermit_Output_marshall_struct_t; + + +typedef struct { + Bool securityEnabled; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetSecurityEnabled_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetSecurityEnabled_Input_struct_t data; +} gpMacDispatcher_SetSecurityEnabled_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetSecurityEnabled_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityEnabled_Input_struct_t data; +} gpMacDispatcher_GetSecurityEnabled_Input_marshall_struct_t; + +typedef struct { + Bool securityEnabled; +} gpMacDispatcher_GetSecurityEnabled_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityEnabled_Output_struct_t data; +} gpMacDispatcher_GetSecurityEnabled_Output_marshall_struct_t; + + +typedef struct { + UInt8 numberOfRetries; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetNumberOfRetries_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetNumberOfRetries_Input_struct_t data; +} gpMacDispatcher_SetNumberOfRetries_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetNumberOfRetries_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetNumberOfRetries_Input_struct_t data; +} gpMacDispatcher_GetNumberOfRetries_Input_marshall_struct_t; + +typedef struct { + UInt8 numberOfRetries; +} gpMacDispatcher_GetNumberOfRetries_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetNumberOfRetries_Output_struct_t data; +} gpMacDispatcher_GetNumberOfRetries_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxCsmaBackoffs; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetMaxCsmaBackoffs_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMaxCsmaBackoffs_Input_struct_t data; +} gpMacDispatcher_SetMaxCsmaBackoffs_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetMaxCsmaBackoffs_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxCsmaBackoffs_Input_struct_t data; +} gpMacDispatcher_GetMaxCsmaBackoffs_Input_marshall_struct_t; + +typedef struct { + UInt8 maxCsmaBackoffs; +} gpMacDispatcher_GetMaxCsmaBackoffs_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxCsmaBackoffs_Output_struct_t data; +} gpMacDispatcher_GetMaxCsmaBackoffs_Output_marshall_struct_t; + + +typedef struct { + Int8* pDefaultTransmitPowerTable; +} gpMacDispatcher_SetDefaultTransmitPowers_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDefaultTransmitPowers_Input_struct_t data; + Int8 pDefaultTransmitPowerTable[16]; +} gpMacDispatcher_SetDefaultTransmitPowers_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_TxPower_t transmitPower; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetTransmitPower_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetTransmitPower_Input_struct_t data; +} gpMacDispatcher_SetTransmitPower_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetTransmitPower_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetTransmitPower_Input_struct_t data; +} gpMacDispatcher_GetTransmitPower_Input_marshall_struct_t; + +typedef struct { + Int8 transmitPower; +} gpMacDispatcher_GetTransmitPower_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetTransmitPower_Output_struct_t data; +} gpMacDispatcher_GetTransmitPower_Output_marshall_struct_t; + + +typedef struct { + UInt8 cCAMode; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCCAMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCCAMode_Input_struct_t data; +} gpMacDispatcher_SetCCAMode_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCCAMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCCAMode_Input_struct_t data; +} gpMacDispatcher_GetCCAMode_Input_marshall_struct_t; + +typedef struct { + UInt8 cCAMode; +} gpMacDispatcher_GetCCAMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCCAMode_Output_struct_t data; +} gpMacDispatcher_GetCCAMode_Output_marshall_struct_t; + + +typedef struct { + Bool panCoordinator; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPanCoordinator_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPanCoordinator_Input_struct_t data; +} gpMacDispatcher_SetPanCoordinator_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetPanCoordinator_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetPanCoordinator_Input_struct_t data; +} gpMacDispatcher_GetPanCoordinator_Input_marshall_struct_t; + +typedef struct { + Bool panCoordinator; +} gpMacDispatcher_GetPanCoordinator_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetPanCoordinator_Output_struct_t data; +} gpMacDispatcher_GetPanCoordinator_Output_marshall_struct_t; + + +typedef struct { + UInt8 minBE; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetMinBE_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMinBE_Input_struct_t data; +} gpMacDispatcher_SetMinBE_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetMinBE_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMinBE_Input_struct_t data; +} gpMacDispatcher_GetMinBE_Input_marshall_struct_t; + +typedef struct { + UInt8 minBE; +} gpMacDispatcher_GetMinBE_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMinBE_Output_struct_t data; +} gpMacDispatcher_GetMinBE_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetIndicateBeaconNotifications_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetIndicateBeaconNotifications_Input_struct_t data; +} gpMacDispatcher_SetIndicateBeaconNotifications_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetIndicateBeaconNotifications_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetIndicateBeaconNotifications_Input_struct_t data; +} gpMacDispatcher_GetIndicateBeaconNotifications_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacDispatcher_GetIndicateBeaconNotifications_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetIndicateBeaconNotifications_Output_struct_t data; +} gpMacDispatcher_GetIndicateBeaconNotifications_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_MacVersion_t macVersion; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetMacVersion_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMacVersion_Input_struct_t data; +} gpMacDispatcher_SetMacVersion_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetMacVersion_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMacVersion_Input_struct_t data; +} gpMacDispatcher_GetMacVersion_Input_marshall_struct_t; + +typedef struct { + gpMacCore_MacVersion_t macVersion; +} gpMacDispatcher_GetMacVersion_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMacVersion_Output_struct_t data; +} gpMacDispatcher_GetMacVersion_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetForwardPollIndications_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetForwardPollIndications_Input_struct_t data; +} gpMacDispatcher_SetForwardPollIndications_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetForwardPollIndications_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetForwardPollIndications_Input_struct_t data; +} gpMacDispatcher_GetForwardPollIndications_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacDispatcher_GetForwardPollIndications_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetForwardPollIndications_Output_struct_t data; +} gpMacDispatcher_GetForwardPollIndications_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_DataPending_QueueAdd_Input_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueAdd_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacDispatcher_DataPending_QueueAdd_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_DataPending_QueueAdd_Output_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueAdd_Output_struct_t data; +} gpMacDispatcher_DataPending_QueueAdd_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_DataPending_QueueRemove_Input_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueRemove_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacDispatcher_DataPending_QueueRemove_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_DataPending_QueueRemove_Output_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueRemove_Output_struct_t data; +} gpMacDispatcher_DataPending_QueueRemove_Output_marshall_struct_t; + + +typedef struct { + Int8* pInterferenceLevels; +} gpMacDispatcher_SetMinInterferenceLevels_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMinInterferenceLevels_Input_struct_t data; + Int8 pInterferenceLevels[1]; +} gpMacDispatcher_SetMinInterferenceLevels_Input_marshall_struct_t; + + +typedef struct { + UInt8 maxBE; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetMaxBE_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMaxBE_Input_struct_t data; +} gpMacDispatcher_SetMaxBE_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetMaxBE_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxBE_Input_struct_t data; +} gpMacDispatcher_GetMaxBE_Input_marshall_struct_t; + +typedef struct { + UInt8 maxBE; +} gpMacDispatcher_GetMaxBE_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxBE_Output_struct_t data; +} gpMacDispatcher_GetMaxBE_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceDescriptor_t* pDeviceDescriptor; + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetDeviceDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDeviceDescriptor_Input_struct_t data; + gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t pDeviceDescriptor; +} gpMacDispatcher_SetDeviceDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_SetDeviceDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_SetDeviceDescriptor_Output_struct_t data; +} gpMacDispatcher_SetDeviceDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetDeviceDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetDeviceDescriptor_Input_struct_t data; +} gpMacDispatcher_GetDeviceDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_DeviceDescriptor_t* pDeviceDescriptor; +} gpMacDispatcher_GetDeviceDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetDeviceDescriptor_Output_struct_t data; + gpMacCore_DeviceDescriptor_t_l1_pointer_marshall_t pDeviceDescriptor; +} gpMacDispatcher_GetDeviceDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DeviceTablesEntries_t deviceTableEntries; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetDeviceTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDeviceTableEntries_Input_struct_t data; +} gpMacDispatcher_SetDeviceTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetDeviceTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetDeviceTableEntries_Input_struct_t data; +} gpMacDispatcher_GetDeviceTableEntries_Input_marshall_struct_t; + +typedef struct { + gpMacCore_DeviceTablesEntries_t deviceTableEntries; +} gpMacDispatcher_GetDeviceTableEntries_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetDeviceTableEntries_Output_struct_t data; +} gpMacDispatcher_GetDeviceTableEntries_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_KeyDescriptor_t* pKeyDescriptor; + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetKeyDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetKeyDescriptor_Input_struct_t data; + gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t pKeyDescriptor; +} gpMacDispatcher_SetKeyDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_SetKeyDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_SetKeyDescriptor_Output_struct_t data; +} gpMacDispatcher_SetKeyDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetKeyDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetKeyDescriptor_Input_struct_t data; +} gpMacDispatcher_GetKeyDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_KeyDescriptor_t* pKeyDescriptor; +} gpMacDispatcher_GetKeyDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetKeyDescriptor_Output_struct_t data; + gpMacCore_KeyDescriptor_t_l1_pointer_marshall_t pKeyDescriptor; +} gpMacDispatcher_GetKeyDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_KeyTablesEntries_t keyTableEntries; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetKeyTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetKeyTableEntries_Input_struct_t data; +} gpMacDispatcher_SetKeyTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor; + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetSecurityLevelDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetSecurityLevelDescriptor_Input_struct_t data; + gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t pSecurityLevelDescriptor; +} gpMacDispatcher_SetSecurityLevelDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_SetSecurityLevelDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_SetSecurityLevelDescriptor_Output_struct_t data; +} gpMacDispatcher_SetSecurityLevelDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Index_t index; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetSecurityLevelDescriptor_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityLevelDescriptor_Input_struct_t data; +} gpMacDispatcher_GetSecurityLevelDescriptor_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; + gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor; +} gpMacDispatcher_GetSecurityLevelDescriptor_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityLevelDescriptor_Output_struct_t data; + gpMacCore_SecurityLevelDescriptor_t_l1_pointer_marshall_t pSecurityLevelDescriptor; +} gpMacDispatcher_GetSecurityLevelDescriptor_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetSecurityLevelTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetSecurityLevelTableEntries_Input_struct_t data; +} gpMacDispatcher_SetSecurityLevelTableEntries_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetSecurityLevelTableEntries_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityLevelTableEntries_Input_struct_t data; +} gpMacDispatcher_GetSecurityLevelTableEntries_Input_marshall_struct_t; + +typedef struct { + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; +} gpMacDispatcher_GetSecurityLevelTableEntries_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetSecurityLevelTableEntries_Output_struct_t data; +} gpMacDispatcher_GetSecurityLevelTableEntries_Output_marshall_struct_t; + + +typedef struct { + UInt8* pDefaultKeySource; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetDefaultKeySource_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDefaultKeySource_Input_struct_t data; + UInt8 pDefaultKeySource[8]; +} gpMacDispatcher_SetDefaultKeySource_Input_marshall_struct_t; + + +typedef struct { + UInt32 frameCounter; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetFrameCounter_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetFrameCounter_Input_struct_t data; +} gpMacDispatcher_SetFrameCounter_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetFrameCounter_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetFrameCounter_Input_struct_t data; +} gpMacDispatcher_GetFrameCounter_Input_marshall_struct_t; + +typedef struct { + UInt32 frameCounter; +} gpMacDispatcher_GetFrameCounter_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetFrameCounter_Output_struct_t data; +} gpMacDispatcher_GetFrameCounter_Output_marshall_struct_t; + + +typedef struct { + UInt16 panCoordShortAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPanCoordShortAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPanCoordShortAddress_Input_struct_t data; +} gpMacDispatcher_SetPanCoordShortAddress_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetPanCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetPanCoordExtendedAddress_Input_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacDispatcher_SetPanCoordExtendedAddress_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetPanCoordExtendedAddress_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetPanCoordExtendedAddress_Input_struct_t data; +} gpMacDispatcher_GetPanCoordExtendedAddress_Input_marshall_struct_t; + +typedef struct { + MACAddress_t* pPanCoordExtendedAddress; +} gpMacDispatcher_GetPanCoordExtendedAddress_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetPanCoordExtendedAddress_Output_struct_t data; + MACAddress_t pPanCoordExtendedAddress[1]; +} gpMacDispatcher_GetPanCoordExtendedAddress_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_AddNeighbour_Input_struct_t; + +typedef struct { + gpMacDispatcher_AddNeighbour_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacDispatcher_AddNeighbour_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacDispatcher_AddNeighbour_Output_struct_t; + +typedef struct { + gpMacDispatcher_AddNeighbour_Output_struct_t data; +} gpMacDispatcher_AddNeighbour_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pAddrInfo; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_RemoveNeighbour_Input_struct_t; + +typedef struct { + gpMacDispatcher_RemoveNeighbour_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pAddrInfo; +} gpMacDispatcher_RemoveNeighbour_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpMacDispatcher_RemoveNeighbour_Output_struct_t; + +typedef struct { + gpMacDispatcher_RemoveNeighbour_Output_struct_t data; +} gpMacDispatcher_RemoveNeighbour_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_DataPendingMode_t dataPendingMode; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetDataPendingMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetDataPendingMode_Input_struct_t data; +} gpMacDispatcher_SetDataPendingMode_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_SetDataPendingMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_SetDataPendingMode_Output_struct_t data; +} gpMacDispatcher_SetDataPendingMode_Output_marshall_struct_t; + + + +typedef struct { + UInt8 addressMode; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_struct_t data; +} gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_ClearNeighbours_Input_struct_t; + +typedef struct { + gpMacDispatcher_ClearNeighbours_Input_struct_t data; +} gpMacDispatcher_ClearNeighbours_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCallbacks_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCallbacks_Input_struct_t data; +} gpMacDispatcher_GetCallbacks_Input_marshall_struct_t; + +typedef struct { + gpMacDispatcher_Callbacks_t* callbacks; +} gpMacDispatcher_GetCallbacks_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCallbacks_Output_struct_t data; + gpMacDispatcher_Callbacks_t_l1_pointer_marshall_t callbacks; +} gpMacDispatcher_GetCallbacks_Output_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_IsValidStack_Input_struct_t; + +typedef struct { + gpMacDispatcher_IsValidStack_Input_struct_t data; +} gpMacDispatcher_IsValidStack_Input_marshall_struct_t; + +typedef struct { + Bool valid; +} gpMacDispatcher_IsValidStack_Output_struct_t; + +typedef struct { + gpMacDispatcher_IsValidStack_Output_struct_t data; +} gpMacDispatcher_IsValidStack_Output_marshall_struct_t; + + +typedef struct { + UInt8 csmaMode; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetCsmaMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetCsmaMode_Input_struct_t data; +} gpMacDispatcher_SetCsmaMode_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetCsmaMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetCsmaMode_Input_struct_t data; +} gpMacDispatcher_GetCsmaMode_Input_marshall_struct_t; + +typedef struct { + UInt8 csmaMode; +} gpMacDispatcher_GetCsmaMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCsmaMode_Output_struct_t data; +} gpMacDispatcher_GetCsmaMode_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_DataPending_QueueClear_Input_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueClear_Input_struct_t data; +} gpMacDispatcher_DataPending_QueueClear_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_DataPending_QueueClear_Output_struct_t; + +typedef struct { + gpMacDispatcher_DataPending_QueueClear_Output_struct_t data; +} gpMacDispatcher_DataPending_QueueClear_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpMacCore_TxTimingOptions_t timingOptions; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_ScheduleTimedTx_Input_struct_t; + +typedef struct { + gpMacDispatcher_ScheduleTimedTx_Input_struct_t data; + gpMacCore_TxTimingOptions_t_l1_pointer_marshall_t timingOptions; +} gpMacDispatcher_ScheduleTimedTx_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_ScheduleTimedTx_Output_struct_t; + +typedef struct { + gpMacDispatcher_ScheduleTimedTx_Output_struct_t data; +} gpMacDispatcher_ScheduleTimedTx_Output_marshall_struct_t; + + + + + + + +typedef struct { + Bool rawModeEnabled; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetStackInRawMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetStackInRawMode_Input_struct_t data; +} gpMacDispatcher_SetStackInRawMode_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_GetStackInRawMode_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetStackInRawMode_Input_struct_t data; +} gpMacDispatcher_GetStackInRawMode_Input_marshall_struct_t; + +typedef struct { + Bool rawModeEnabled; +} gpMacDispatcher_GetStackInRawMode_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetStackInRawMode_Output_struct_t data; +} gpMacDispatcher_GetStackInRawMode_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_KeyIdMode_t encryptionKeyIdMode; + gpMacCore_KeyIndex_t encryptionKeyId; + UInt8* pCurrKey; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetRawModeEncryptionKeys_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetRawModeEncryptionKeys_Input_struct_t data; + UInt8 pCurrKey[16]; +} gpMacDispatcher_SetRawModeEncryptionKeys_Input_marshall_struct_t; + + +typedef struct { + UInt32 frameCounter; + MACAddress_t* pExtendedAddress; + UInt8 seclevel; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_SetRawModeNonceFields_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetRawModeNonceFields_Input_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacDispatcher_SetRawModeNonceFields_Input_marshall_struct_t; + + +typedef struct { + Bool enableEnhancedFramePending; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_EnableEnhancedFramePending_Input_struct_t; + +typedef struct { + gpMacDispatcher_EnableEnhancedFramePending_Input_struct_t data; +} gpMacDispatcher_EnableEnhancedFramePending_Input_marshall_struct_t; + + +typedef struct { + UInt32 dutyCycleOnTime; + UInt32 dutyCyclePeriod; + UInt16 recurrenceAmount; + UInt32 startTime; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_EnableRxWindows_Input_struct_t; + +typedef struct { + gpMacDispatcher_EnableRxWindows_Input_struct_t data; +} gpMacDispatcher_EnableRxWindows_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_DisableRxWindows_Input_struct_t; + +typedef struct { + gpMacDispatcher_DisableRxWindows_Input_struct_t data; +} gpMacDispatcher_DisableRxWindows_Input_marshall_struct_t; + + +typedef struct { + UInt16 dutyCyclePeriod; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_EnableCsl_Input_struct_t; + +typedef struct { + gpMacDispatcher_EnableCsl_Input_struct_t data; +} gpMacDispatcher_EnableCsl_Input_marshall_struct_t; + + +typedef struct { + UInt32 nextCslSampleTime; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_UpdateCslSampleTime_Input_struct_t; + +typedef struct { + gpMacDispatcher_UpdateCslSampleTime_Input_struct_t data; +} gpMacDispatcher_UpdateCslSampleTime_Input_marshall_struct_t; + + +typedef struct { + UInt32 currentTime; +} gpMacDispatcher_GetCurrentTimeUs_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetCurrentTimeUs_Output_struct_t data; +} gpMacDispatcher_GetCurrentTimeUs_Output_marshall_struct_t; + + +typedef struct { + UInt8 linkMetrics; + MACAddress_t* pExtendedAddress; + UInt16 shortAddress; + gpMacDispatcher_StackId_t stackId; +} gpMacDispatcher_ConfigureEnhAckProbing_Input_struct_t; + +typedef struct { + gpMacDispatcher_ConfigureEnhAckProbing_Input_struct_t data; + MACAddress_t pExtendedAddress[1]; +} gpMacDispatcher_ConfigureEnhAckProbing_Input_marshall_struct_t; + +typedef struct { + gpMacCore_Result_t result; +} gpMacDispatcher_ConfigureEnhAckProbing_Output_struct_t; + +typedef struct { + gpMacDispatcher_ConfigureEnhAckProbing_Output_struct_t data; +} gpMacDispatcher_ConfigureEnhAckProbing_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetRetransmitOnCcaFail_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetRetransmitOnCcaFail_Input_struct_t data; +} gpMacDispatcher_SetRetransmitOnCcaFail_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_GetRetransmitOnCcaFail_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetRetransmitOnCcaFail_Input_struct_t data; +} gpMacDispatcher_GetRetransmitOnCcaFail_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacDispatcher_GetRetransmitOnCcaFail_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetRetransmitOnCcaFail_Output_struct_t data; +} gpMacDispatcher_GetRetransmitOnCcaFail_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetRetransmitRandomBackoff_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetRetransmitRandomBackoff_Input_struct_t data; +} gpMacDispatcher_SetRetransmitRandomBackoff_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_GetRetransmitRandomBackoff_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetRetransmitRandomBackoff_Input_struct_t data; +} gpMacDispatcher_GetRetransmitRandomBackoff_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpMacDispatcher_GetRetransmitRandomBackoff_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetRetransmitRandomBackoff_Output_struct_t data; +} gpMacDispatcher_GetRetransmitRandomBackoff_Output_marshall_struct_t; + + +typedef struct { + UInt8 minBERetransmit; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetMinBeRetransmit_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMinBeRetransmit_Input_struct_t data; +} gpMacDispatcher_SetMinBeRetransmit_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_GetMinBeRetransmit_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMinBeRetransmit_Input_struct_t data; +} gpMacDispatcher_GetMinBeRetransmit_Input_marshall_struct_t; + +typedef struct { + UInt8 minBERetransmit; +} gpMacDispatcher_GetMinBeRetransmit_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMinBeRetransmit_Output_struct_t data; +} gpMacDispatcher_GetMinBeRetransmit_Output_marshall_struct_t; + + +typedef struct { + UInt8 maxBERetransmit; + gpMacCore_StackId_t stackId; +} gpMacDispatcher_SetMaxBeRetransmit_Input_struct_t; + +typedef struct { + gpMacDispatcher_SetMaxBeRetransmit_Input_struct_t data; +} gpMacDispatcher_SetMaxBeRetransmit_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_StackId_t stackId; +} gpMacDispatcher_GetMaxBeRetransmit_Input_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxBeRetransmit_Input_struct_t data; +} gpMacDispatcher_GetMaxBeRetransmit_Input_marshall_struct_t; + +typedef struct { + UInt8 maxBERetransmit; +} gpMacDispatcher_GetMaxBeRetransmit_Output_struct_t; + +typedef struct { + gpMacDispatcher_GetMaxBeRetransmit_Output_struct_t data; +} gpMacDispatcher_GetMaxBeRetransmit_Output_marshall_struct_t; + + +typedef struct { + gpMacCore_Result_t status; + gpPd_Handle_t pdHandle; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbDataConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbDataConfirm_Input_struct_t data; +} MacDispatcher_cbDataConfirm_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + UInt8 dsn; + gpMacCore_Security_t* pSecOptions; + gpPd_Loh_t pdLoh; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbDataIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbDataIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; + gpMacCore_Security_t_l1_pointer_marshall_t pSecOptions; + gpPd_Loh_t_l1_pointer_marshall_t pdLoh; +} MacDispatcher_cbDataIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_Result_t status; + gpMacCore_ScanType_t scanType; + UInt32 unscannedChannels; + UInt8 resultListSize; + UInt8* pEdScanResultList; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbScanConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbScanConfirm_Input_struct_t data; +} MacDispatcher_cbScanConfirm_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_Address_t* pDeviceAddress; + UInt8 capabilityInformation; + gpPd_TimeStamp_t rxTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbAssociateIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbAssociateIndication_Input_struct_t data; + gpMacCore_Address_t_l1_pointer_marshall_t pDeviceAddress; +} MacDispatcher_cbAssociateIndication_Input_marshall_struct_t; + + +typedef struct { + UInt16 assocShortAddress; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbAssociateConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbAssociateConfirm_Input_struct_t data; +} MacDispatcher_cbAssociateConfirm_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbAssociateCommStatusIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbAssociateCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; +} MacDispatcher_cbAssociateCommStatusIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_Result_t status; + gpMacCore_AddressInfo_t* coordAddrInfo; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbPollConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbPollConfirm_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t coordAddrInfo; +} MacDispatcher_cbPollConfirm_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* addressInfo; + gpPd_TimeStamp_t rxTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbPollIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbPollIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t addressInfo; +} MacDispatcher_cbPollIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_Result_t status; + gpPd_Handle_t pdHandle; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbPurgeConfirm_Input_struct_t; + +typedef struct { + MacDispatcher_cbPurgeConfirm_Input_struct_t data; +} MacDispatcher_cbPurgeConfirm_Input_marshall_struct_t; + + +typedef struct { + UInt8 bsn; + gpMacCore_PanDescriptor_t* pPanDescriptor; + UInt8 beaconPayloadLength; + UInt8* pBeaconPayload; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbBeaconNotifyIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbBeaconNotifyIndication_Input_struct_t data; + gpMacCore_PanDescriptor_t_l1_pointer_marshall_t pPanDescriptor; + UInt8 pBeaconPayload[GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; +} MacDispatcher_cbBeaconNotifyIndication_Input_marshall_struct_t; + + +typedef struct { + MACAddress_t* pOrphanAddress; + gpPd_TimeStamp_t rxTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbOrphanIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbOrphanIndication_Input_struct_t data; + MACAddress_t pOrphanAddress[1]; +} MacDispatcher_cbOrphanIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbOrphanCommStatusIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbOrphanCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; +} MacDispatcher_cbOrphanCommStatusIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* pSrcAddrInfo; + gpMacCore_AddressInfo_t* pDstAddrInfo; + gpMacCore_Result_t status; + gpPd_TimeStamp_t txTime; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbSecurityFailureCommStatusIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbSecurityFailureCommStatusIndication_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pSrcAddrInfo; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t pDstAddrInfo; +} MacDispatcher_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacDispatcher_Result_t status; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbDriverResetIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbDriverResetIndication_Input_struct_t data; +} MacDispatcher_cbDriverResetIndication_Input_marshall_struct_t; + + +typedef struct { + gpMacCore_AddressInfo_t* addressInfo; + gpPd_TimeStamp_t rxTime; + gpPd_Handle_t pdHandle; + Bool fromNeighbour; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbPollNotify_Input_struct_t; + +typedef struct { + MacDispatcher_cbPollNotify_Input_struct_t data; + gpMacCore_AddressInfo_t_l1_pointer_marshall_t addressInfo; +} MacDispatcher_cbPollNotify_Input_marshall_struct_t; + + +typedef struct { + UInt32 frameCounter; + gpMacDispatcher_StackId_t stackId; +} MacDispatcher_cbSecurityFrameCounterIndication_Input_struct_t; + +typedef struct { + MacDispatcher_cbSecurityFrameCounterIndication_Input_struct_t data; +} MacDispatcher_cbSecurityFrameCounterIndication_Input_marshall_struct_t; + + +typedef union { + gpMacDispatcher_RegisterNetworkStack_Input_marshall_struct_t gpMacDispatcher_RegisterNetworkStack; + gpMacDispatcher_UnRegisterNetworkStack_Input_marshall_struct_t gpMacDispatcher_UnRegisterNetworkStack; + gpMacDispatcher_RegisterCallbacks_Input_marshall_struct_t gpMacDispatcher_RegisterCallbacks; + gpMacDispatcher_LockClaim_Input_marshall_struct_t gpMacDispatcher_LockClaim; + gpMacDispatcher_LockRelease_Input_marshall_struct_t gpMacDispatcher_LockRelease; + gpMacDispatcher_LockedByThisStack_Input_marshall_struct_t gpMacDispatcher_LockedByThisStack; + gpMacDispatcher_Reset_Input_marshall_struct_t gpMacDispatcher_Reset; + gpMacDispatcher_DataRequest_Input_marshall_struct_t gpMacDispatcher_DataRequest; + gpMacDispatcher_ScanRequest_Input_marshall_struct_t gpMacDispatcher_ScanRequest; + gpMacDispatcher_AssociateRequest_Input_marshall_struct_t gpMacDispatcher_AssociateRequest; + gpMacDispatcher_AssociateResponse_Input_marshall_struct_t gpMacDispatcher_AssociateResponse; + gpMacDispatcher_PollRequest_Input_marshall_struct_t gpMacDispatcher_PollRequest; + gpMacDispatcher_PurgeRequest_Input_marshall_struct_t gpMacDispatcher_PurgeRequest; + gpMacDispatcher_Start_Input_marshall_struct_t gpMacDispatcher_Start; + gpMacDispatcher_OrphanResponse_Input_marshall_struct_t gpMacDispatcher_OrphanResponse; + gpMacDispatcher_SetPanId_Input_marshall_struct_t gpMacDispatcher_SetPanId; + gpMacDispatcher_GetPanId_Input_marshall_struct_t gpMacDispatcher_GetPanId; + gpMacDispatcher_SetShortAddress_Input_marshall_struct_t gpMacDispatcher_SetShortAddress; + gpMacDispatcher_GetShortAddress_Input_marshall_struct_t gpMacDispatcher_GetShortAddress; + gpMacDispatcher_SetExtendedAddress_Input_marshall_struct_t gpMacDispatcher_SetExtendedAddress; + gpMacDispatcher_GetExtendedAddress_Input_marshall_struct_t gpMacDispatcher_GetExtendedAddress; + gpMacDispatcher_SetDsn_Input_marshall_struct_t gpMacDispatcher_SetDsn; + gpMacDispatcher_GetDsn_Input_marshall_struct_t gpMacDispatcher_GetDsn; + gpMacDispatcher_SetCurrentChannel_Input_marshall_struct_t gpMacDispatcher_SetCurrentChannel; + gpMacDispatcher_GetCurrentChannel_Input_marshall_struct_t gpMacDispatcher_GetCurrentChannel; + gpMacDispatcher_SetBeaconPayload_Input_marshall_struct_t gpMacDispatcher_SetBeaconPayload; + gpMacDispatcher_GetBeaconPayload_Input_marshall_struct_t gpMacDispatcher_GetBeaconPayload; + gpMacDispatcher_SetBeaconPayloadLength_Input_marshall_struct_t gpMacDispatcher_SetBeaconPayloadLength; + gpMacDispatcher_GetBeaconPayloadLength_Input_marshall_struct_t gpMacDispatcher_GetBeaconPayloadLength; + gpMacDispatcher_SetRxOnWhenIdle_Input_marshall_struct_t gpMacDispatcher_SetRxOnWhenIdle; + gpMacDispatcher_GetRxOnWhenIdle_Input_marshall_struct_t gpMacDispatcher_GetRxOnWhenIdle; + gpMacDispatcher_GetTransactionPersistenceTime_Input_marshall_struct_t gpMacDispatcher_GetTransactionPersistenceTime; + gpMacDispatcher_SetTransactionPersistenceTime_Input_marshall_struct_t gpMacDispatcher_SetTransactionPersistenceTime; + gpMacDispatcher_SetBeaconStarted_Input_marshall_struct_t gpMacDispatcher_SetBeaconStarted; + gpMacDispatcher_GetBeaconStarted_Input_marshall_struct_t gpMacDispatcher_GetBeaconStarted; + gpMacDispatcher_SetCoordShortAddress_Input_marshall_struct_t gpMacDispatcher_SetCoordShortAddress; + gpMacDispatcher_GetCoordShortAddress_Input_marshall_struct_t gpMacDispatcher_GetCoordShortAddress; + gpMacDispatcher_SetCoordExtendedAddress_Input_marshall_struct_t gpMacDispatcher_SetCoordExtendedAddress; + gpMacDispatcher_GetCoordExtendedAddress_Input_marshall_struct_t gpMacDispatcher_GetCoordExtendedAddress; + gpMacDispatcher_SetPromiscuousMode_Input_marshall_struct_t gpMacDispatcher_SetPromiscuousMode; + gpMacDispatcher_GetPromiscuousMode_Input_marshall_struct_t gpMacDispatcher_GetPromiscuousMode; + gpMacDispatcher_SetAssociationPermit_Input_marshall_struct_t gpMacDispatcher_SetAssociationPermit; + gpMacDispatcher_GetAssociationPermit_Input_marshall_struct_t gpMacDispatcher_GetAssociationPermit; + gpMacDispatcher_SetSecurityEnabled_Input_marshall_struct_t gpMacDispatcher_SetSecurityEnabled; + gpMacDispatcher_GetSecurityEnabled_Input_marshall_struct_t gpMacDispatcher_GetSecurityEnabled; + gpMacDispatcher_SetNumberOfRetries_Input_marshall_struct_t gpMacDispatcher_SetNumberOfRetries; + gpMacDispatcher_GetNumberOfRetries_Input_marshall_struct_t gpMacDispatcher_GetNumberOfRetries; + gpMacDispatcher_SetMaxCsmaBackoffs_Input_marshall_struct_t gpMacDispatcher_SetMaxCsmaBackoffs; + gpMacDispatcher_GetMaxCsmaBackoffs_Input_marshall_struct_t gpMacDispatcher_GetMaxCsmaBackoffs; + gpMacDispatcher_SetDefaultTransmitPowers_Input_marshall_struct_t gpMacDispatcher_SetDefaultTransmitPowers; + gpMacDispatcher_SetTransmitPower_Input_marshall_struct_t gpMacDispatcher_SetTransmitPower; + gpMacDispatcher_GetTransmitPower_Input_marshall_struct_t gpMacDispatcher_GetTransmitPower; + gpMacDispatcher_SetCCAMode_Input_marshall_struct_t gpMacDispatcher_SetCCAMode; + gpMacDispatcher_GetCCAMode_Input_marshall_struct_t gpMacDispatcher_GetCCAMode; + gpMacDispatcher_SetPanCoordinator_Input_marshall_struct_t gpMacDispatcher_SetPanCoordinator; + gpMacDispatcher_GetPanCoordinator_Input_marshall_struct_t gpMacDispatcher_GetPanCoordinator; + gpMacDispatcher_SetMinBE_Input_marshall_struct_t gpMacDispatcher_SetMinBE; + gpMacDispatcher_GetMinBE_Input_marshall_struct_t gpMacDispatcher_GetMinBE; + gpMacDispatcher_SetIndicateBeaconNotifications_Input_marshall_struct_t gpMacDispatcher_SetIndicateBeaconNotifications; + gpMacDispatcher_GetIndicateBeaconNotifications_Input_marshall_struct_t gpMacDispatcher_GetIndicateBeaconNotifications; + gpMacDispatcher_SetMacVersion_Input_marshall_struct_t gpMacDispatcher_SetMacVersion; + gpMacDispatcher_GetMacVersion_Input_marshall_struct_t gpMacDispatcher_GetMacVersion; + gpMacDispatcher_SetForwardPollIndications_Input_marshall_struct_t gpMacDispatcher_SetForwardPollIndications; + gpMacDispatcher_GetForwardPollIndications_Input_marshall_struct_t gpMacDispatcher_GetForwardPollIndications; + gpMacDispatcher_DataPending_QueueAdd_Input_marshall_struct_t gpMacDispatcher_DataPending_QueueAdd; + gpMacDispatcher_DataPending_QueueRemove_Input_marshall_struct_t gpMacDispatcher_DataPending_QueueRemove; + gpMacDispatcher_SetMinInterferenceLevels_Input_marshall_struct_t gpMacDispatcher_SetMinInterferenceLevels; + gpMacDispatcher_SetMaxBE_Input_marshall_struct_t gpMacDispatcher_SetMaxBE; + gpMacDispatcher_GetMaxBE_Input_marshall_struct_t gpMacDispatcher_GetMaxBE; + gpMacDispatcher_SetDeviceDescriptor_Input_marshall_struct_t gpMacDispatcher_SetDeviceDescriptor; + gpMacDispatcher_GetDeviceDescriptor_Input_marshall_struct_t gpMacDispatcher_GetDeviceDescriptor; + gpMacDispatcher_SetDeviceTableEntries_Input_marshall_struct_t gpMacDispatcher_SetDeviceTableEntries; + gpMacDispatcher_GetDeviceTableEntries_Input_marshall_struct_t gpMacDispatcher_GetDeviceTableEntries; + gpMacDispatcher_SetKeyDescriptor_Input_marshall_struct_t gpMacDispatcher_SetKeyDescriptor; + gpMacDispatcher_GetKeyDescriptor_Input_marshall_struct_t gpMacDispatcher_GetKeyDescriptor; + gpMacDispatcher_SetKeyTableEntries_Input_marshall_struct_t gpMacDispatcher_SetKeyTableEntries; + gpMacDispatcher_SetSecurityLevelDescriptor_Input_marshall_struct_t gpMacDispatcher_SetSecurityLevelDescriptor; + gpMacDispatcher_GetSecurityLevelDescriptor_Input_marshall_struct_t gpMacDispatcher_GetSecurityLevelDescriptor; + gpMacDispatcher_SetSecurityLevelTableEntries_Input_marshall_struct_t gpMacDispatcher_SetSecurityLevelTableEntries; + gpMacDispatcher_GetSecurityLevelTableEntries_Input_marshall_struct_t gpMacDispatcher_GetSecurityLevelTableEntries; + gpMacDispatcher_SetDefaultKeySource_Input_marshall_struct_t gpMacDispatcher_SetDefaultKeySource; + gpMacDispatcher_SetFrameCounter_Input_marshall_struct_t gpMacDispatcher_SetFrameCounter; + gpMacDispatcher_GetFrameCounter_Input_marshall_struct_t gpMacDispatcher_GetFrameCounter; + gpMacDispatcher_SetPanCoordShortAddress_Input_marshall_struct_t gpMacDispatcher_SetPanCoordShortAddress; + gpMacDispatcher_SetPanCoordExtendedAddress_Input_marshall_struct_t gpMacDispatcher_SetPanCoordExtendedAddress; + gpMacDispatcher_GetPanCoordExtendedAddress_Input_marshall_struct_t gpMacDispatcher_GetPanCoordExtendedAddress; + gpMacDispatcher_AddNeighbour_Input_marshall_struct_t gpMacDispatcher_AddNeighbour; + gpMacDispatcher_RemoveNeighbour_Input_marshall_struct_t gpMacDispatcher_RemoveNeighbour; + gpMacDispatcher_SetDataPendingMode_Input_marshall_struct_t gpMacDispatcher_SetDataPendingMode; + gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_marshall_struct_t gpMacDispatcher_SetAddressModeOverrideForBeacons; + gpMacDispatcher_ClearNeighbours_Input_marshall_struct_t gpMacDispatcher_ClearNeighbours; + gpMacDispatcher_GetCallbacks_Input_marshall_struct_t gpMacDispatcher_GetCallbacks; + gpMacDispatcher_IsValidStack_Input_marshall_struct_t gpMacDispatcher_IsValidStack; + gpMacDispatcher_SetCsmaMode_Input_marshall_struct_t gpMacDispatcher_SetCsmaMode; + gpMacDispatcher_GetCsmaMode_Input_marshall_struct_t gpMacDispatcher_GetCsmaMode; + gpMacDispatcher_DataPending_QueueClear_Input_marshall_struct_t gpMacDispatcher_DataPending_QueueClear; + gpMacDispatcher_ScheduleTimedTx_Input_marshall_struct_t gpMacDispatcher_ScheduleTimedTx; + gpMacDispatcher_SetStackInRawMode_Input_marshall_struct_t gpMacDispatcher_SetStackInRawMode; + gpMacDispatcher_GetStackInRawMode_Input_marshall_struct_t gpMacDispatcher_GetStackInRawMode; + gpMacDispatcher_SetRawModeEncryptionKeys_Input_marshall_struct_t gpMacDispatcher_SetRawModeEncryptionKeys; + gpMacDispatcher_SetRawModeNonceFields_Input_marshall_struct_t gpMacDispatcher_SetRawModeNonceFields; + gpMacDispatcher_EnableEnhancedFramePending_Input_marshall_struct_t gpMacDispatcher_EnableEnhancedFramePending; + gpMacDispatcher_EnableRxWindows_Input_marshall_struct_t gpMacDispatcher_EnableRxWindows; + gpMacDispatcher_DisableRxWindows_Input_marshall_struct_t gpMacDispatcher_DisableRxWindows; + gpMacDispatcher_EnableCsl_Input_marshall_struct_t gpMacDispatcher_EnableCsl; + gpMacDispatcher_UpdateCslSampleTime_Input_marshall_struct_t gpMacDispatcher_UpdateCslSampleTime; + gpMacDispatcher_ConfigureEnhAckProbing_Input_marshall_struct_t gpMacDispatcher_ConfigureEnhAckProbing; + gpMacDispatcher_SetRetransmitOnCcaFail_Input_marshall_struct_t gpMacDispatcher_SetRetransmitOnCcaFail; + gpMacDispatcher_GetRetransmitOnCcaFail_Input_marshall_struct_t gpMacDispatcher_GetRetransmitOnCcaFail; + gpMacDispatcher_SetRetransmitRandomBackoff_Input_marshall_struct_t gpMacDispatcher_SetRetransmitRandomBackoff; + gpMacDispatcher_GetRetransmitRandomBackoff_Input_marshall_struct_t gpMacDispatcher_GetRetransmitRandomBackoff; + gpMacDispatcher_SetMinBeRetransmit_Input_marshall_struct_t gpMacDispatcher_SetMinBeRetransmit; + gpMacDispatcher_GetMinBeRetransmit_Input_marshall_struct_t gpMacDispatcher_GetMinBeRetransmit; + gpMacDispatcher_SetMaxBeRetransmit_Input_marshall_struct_t gpMacDispatcher_SetMaxBeRetransmit; + gpMacDispatcher_GetMaxBeRetransmit_Input_marshall_struct_t gpMacDispatcher_GetMaxBeRetransmit; + UInt8 dummy; //ensure none empty union definition +} gpMacDispatcher_Server_Input_union_t; + +typedef union { + gpMacDispatcher_RegisterNetworkStack_Output_marshall_struct_t gpMacDispatcher_RegisterNetworkStack; + gpMacDispatcher_UnRegisterNetworkStack_Output_marshall_struct_t gpMacDispatcher_UnRegisterNetworkStack; + gpMacDispatcher_LockClaim_Output_marshall_struct_t gpMacDispatcher_LockClaim; + gpMacDispatcher_LockedByThisStack_Output_marshall_struct_t gpMacDispatcher_LockedByThisStack; + gpMacDispatcher_Locked_Output_marshall_struct_t gpMacDispatcher_Locked; + gpMacDispatcher_Reset_Output_marshall_struct_t gpMacDispatcher_Reset; + gpMacDispatcher_Start_Output_marshall_struct_t gpMacDispatcher_Start; + gpMacDispatcher_GetPanId_Output_marshall_struct_t gpMacDispatcher_GetPanId; + gpMacDispatcher_GetShortAddress_Output_marshall_struct_t gpMacDispatcher_GetShortAddress; + gpMacDispatcher_GetExtendedAddress_Output_marshall_struct_t gpMacDispatcher_GetExtendedAddress; + gpMacDispatcher_GetDsn_Output_marshall_struct_t gpMacDispatcher_GetDsn; + gpMacDispatcher_GetCurrentChannel_Output_marshall_struct_t gpMacDispatcher_GetCurrentChannel; + gpMacDispatcher_GetBeaconPayload_Output_marshall_struct_t gpMacDispatcher_GetBeaconPayload; + gpMacDispatcher_GetBeaconPayloadLength_Output_marshall_struct_t gpMacDispatcher_GetBeaconPayloadLength; + gpMacDispatcher_GetRxOnWhenIdle_Output_marshall_struct_t gpMacDispatcher_GetRxOnWhenIdle; + gpMacDispatcher_GetTransactionPersistenceTime_Output_marshall_struct_t gpMacDispatcher_GetTransactionPersistenceTime; + gpMacDispatcher_GetBeaconStarted_Output_marshall_struct_t gpMacDispatcher_GetBeaconStarted; + gpMacDispatcher_GetCoordShortAddress_Output_marshall_struct_t gpMacDispatcher_GetCoordShortAddress; + gpMacDispatcher_GetCoordExtendedAddress_Output_marshall_struct_t gpMacDispatcher_GetCoordExtendedAddress; + gpMacDispatcher_GetPromiscuousMode_Output_marshall_struct_t gpMacDispatcher_GetPromiscuousMode; + gpMacDispatcher_GetAssociationPermit_Output_marshall_struct_t gpMacDispatcher_GetAssociationPermit; + gpMacDispatcher_GetSecurityEnabled_Output_marshall_struct_t gpMacDispatcher_GetSecurityEnabled; + gpMacDispatcher_GetNumberOfRetries_Output_marshall_struct_t gpMacDispatcher_GetNumberOfRetries; + gpMacDispatcher_GetMaxCsmaBackoffs_Output_marshall_struct_t gpMacDispatcher_GetMaxCsmaBackoffs; + gpMacDispatcher_GetTransmitPower_Output_marshall_struct_t gpMacDispatcher_GetTransmitPower; + gpMacDispatcher_GetCCAMode_Output_marshall_struct_t gpMacDispatcher_GetCCAMode; + gpMacDispatcher_GetPanCoordinator_Output_marshall_struct_t gpMacDispatcher_GetPanCoordinator; + gpMacDispatcher_GetMinBE_Output_marshall_struct_t gpMacDispatcher_GetMinBE; + gpMacDispatcher_GetIndicateBeaconNotifications_Output_marshall_struct_t gpMacDispatcher_GetIndicateBeaconNotifications; + gpMacDispatcher_GetMacVersion_Output_marshall_struct_t gpMacDispatcher_GetMacVersion; + gpMacDispatcher_GetForwardPollIndications_Output_marshall_struct_t gpMacDispatcher_GetForwardPollIndications; + gpMacDispatcher_DataPending_QueueAdd_Output_marshall_struct_t gpMacDispatcher_DataPending_QueueAdd; + gpMacDispatcher_DataPending_QueueRemove_Output_marshall_struct_t gpMacDispatcher_DataPending_QueueRemove; + gpMacDispatcher_GetMaxBE_Output_marshall_struct_t gpMacDispatcher_GetMaxBE; + gpMacDispatcher_SetDeviceDescriptor_Output_marshall_struct_t gpMacDispatcher_SetDeviceDescriptor; + gpMacDispatcher_GetDeviceDescriptor_Output_marshall_struct_t gpMacDispatcher_GetDeviceDescriptor; + gpMacDispatcher_GetDeviceTableEntries_Output_marshall_struct_t gpMacDispatcher_GetDeviceTableEntries; + gpMacDispatcher_SetKeyDescriptor_Output_marshall_struct_t gpMacDispatcher_SetKeyDescriptor; + gpMacDispatcher_GetKeyDescriptor_Output_marshall_struct_t gpMacDispatcher_GetKeyDescriptor; + gpMacDispatcher_SetSecurityLevelDescriptor_Output_marshall_struct_t gpMacDispatcher_SetSecurityLevelDescriptor; + gpMacDispatcher_GetSecurityLevelDescriptor_Output_marshall_struct_t gpMacDispatcher_GetSecurityLevelDescriptor; + gpMacDispatcher_GetSecurityLevelTableEntries_Output_marshall_struct_t gpMacDispatcher_GetSecurityLevelTableEntries; + gpMacDispatcher_GetFrameCounter_Output_marshall_struct_t gpMacDispatcher_GetFrameCounter; + gpMacDispatcher_GetPanCoordExtendedAddress_Output_marshall_struct_t gpMacDispatcher_GetPanCoordExtendedAddress; + gpMacDispatcher_AddNeighbour_Output_marshall_struct_t gpMacDispatcher_AddNeighbour; + gpMacDispatcher_RemoveNeighbour_Output_marshall_struct_t gpMacDispatcher_RemoveNeighbour; + gpMacDispatcher_SetDataPendingMode_Output_marshall_struct_t gpMacDispatcher_SetDataPendingMode; + gpMacDispatcher_GetCallbacks_Output_marshall_struct_t gpMacDispatcher_GetCallbacks; + gpMacDispatcher_IsValidStack_Output_marshall_struct_t gpMacDispatcher_IsValidStack; + gpMacDispatcher_GetCsmaMode_Output_marshall_struct_t gpMacDispatcher_GetCsmaMode; + gpMacDispatcher_DataPending_QueueClear_Output_marshall_struct_t gpMacDispatcher_DataPending_QueueClear; + gpMacDispatcher_ScheduleTimedTx_Output_marshall_struct_t gpMacDispatcher_ScheduleTimedTx; + gpMacDispatcher_GetStackInRawMode_Output_marshall_struct_t gpMacDispatcher_GetStackInRawMode; + gpMacDispatcher_GetCurrentTimeUs_Output_marshall_struct_t gpMacDispatcher_GetCurrentTimeUs; + gpMacDispatcher_ConfigureEnhAckProbing_Output_marshall_struct_t gpMacDispatcher_ConfigureEnhAckProbing; + gpMacDispatcher_GetRetransmitOnCcaFail_Output_marshall_struct_t gpMacDispatcher_GetRetransmitOnCcaFail; + gpMacDispatcher_GetRetransmitRandomBackoff_Output_marshall_struct_t gpMacDispatcher_GetRetransmitRandomBackoff; + gpMacDispatcher_GetMinBeRetransmit_Output_marshall_struct_t gpMacDispatcher_GetMinBeRetransmit; + gpMacDispatcher_GetMaxBeRetransmit_Output_marshall_struct_t gpMacDispatcher_GetMaxBeRetransmit; + UInt8 dummy; //ensure none empty union definition +} gpMacDispatcher_Server_Output_union_t; + +typedef union { + MacDispatcher_cbDataConfirm_Input_marshall_struct_t MacDispatcher_cbDataConfirm; + MacDispatcher_cbDataIndication_Input_marshall_struct_t MacDispatcher_cbDataIndication; + MacDispatcher_cbScanConfirm_Input_marshall_struct_t MacDispatcher_cbScanConfirm; + MacDispatcher_cbAssociateIndication_Input_marshall_struct_t MacDispatcher_cbAssociateIndication; + MacDispatcher_cbAssociateConfirm_Input_marshall_struct_t MacDispatcher_cbAssociateConfirm; + MacDispatcher_cbAssociateCommStatusIndication_Input_marshall_struct_t MacDispatcher_cbAssociateCommStatusIndication; + MacDispatcher_cbPollConfirm_Input_marshall_struct_t MacDispatcher_cbPollConfirm; + MacDispatcher_cbPollIndication_Input_marshall_struct_t MacDispatcher_cbPollIndication; + MacDispatcher_cbPurgeConfirm_Input_marshall_struct_t MacDispatcher_cbPurgeConfirm; + MacDispatcher_cbBeaconNotifyIndication_Input_marshall_struct_t MacDispatcher_cbBeaconNotifyIndication; + MacDispatcher_cbOrphanIndication_Input_marshall_struct_t MacDispatcher_cbOrphanIndication; + MacDispatcher_cbOrphanCommStatusIndication_Input_marshall_struct_t MacDispatcher_cbOrphanCommStatusIndication; + MacDispatcher_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t MacDispatcher_cbSecurityFailureCommStatusIndication; + MacDispatcher_cbDriverResetIndication_Input_marshall_struct_t MacDispatcher_cbDriverResetIndication; + MacDispatcher_cbPollNotify_Input_marshall_struct_t MacDispatcher_cbPollNotify; + MacDispatcher_cbSecurityFrameCounterIndication_Input_marshall_struct_t MacDispatcher_cbSecurityFrameCounterIndication; + UInt8 dummy; //ensure none empty union definition +} gpMacDispatcher_Client_Input_union_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpMacDispatcher_StackId_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpMacDispatcher_StackId_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpMacDispatcher_StackId_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpMacDispatcher_StackId_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpMacDispatcher_Result_t_buf2api(pDest, pSource, length, pIndex) gpMacCore_Result_t_buf2api(pDest, pSource, length, pIndex) +#define gpMacDispatcher_Result_t_api2buf(pDest, pSource, length, pIndex) gpMacCore_Result_t_api2buf(pDest, pSource, length, pIndex) +#define gpMacDispatcher_Result_t_buf2api_1(pDest, pSource, pIndex) gpMacCore_Result_t_buf2api_1(pDest, pSource, pIndex) +#define gpMacDispatcher_Result_t_api2buf_1(pDest, pSource, pIndex) gpMacCore_Result_t_api2buf_1(pDest, pSource, pIndex) +#define gpMacDispatcher_cbDataIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDataConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPurgeConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPurgeConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPurgeConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPurgeConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbBeaconNotifyIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbBeaconNotifyIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbBeaconNotifyIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbBeaconNotifyIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbScanConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbScanConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbScanConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbScanConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssocConfirm_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssocConfirm_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssocConfirm_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssocConfirm_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateCommStatusIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateCommStatusIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateCommStatusIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbAssociateCommStatusIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanCommStatusIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanCommStatusIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanCommStatusIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbOrphanCommStatusIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDriverResetIndication_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDriverResetIndication_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDriverResetIndication_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbDriverResetIndication_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollNotify_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollNotify_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollNotify_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex,sizeof(void (*)(void))) +#define gpMacDispatcher_cbPollNotify_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex,sizeof(void (*)(void))) + +// Structure copy functions +gpMarshall_AckStatus_t gpMacDispatcher_StringIdentifier_t_buf2api(gpMacDispatcher_StringIdentifier_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacDispatcher_StringIdentifier_t_api2buf(UInt8Buffer* pDest , const gpMacDispatcher_StringIdentifier_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_Callbacks_t_buf2api(gpMacDispatcher_Callbacks_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpMacDispatcher_Callbacks_t_api2buf(UInt8Buffer* pDest , const gpMacDispatcher_Callbacks_t* pSource , UInt16 length , UInt16* pIndex); +// Server functions +gpMarshall_AckStatus_t gpMacDispatcher_RegisterNetworkStack_Input_buf2api(gpMacDispatcher_RegisterNetworkStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_RegisterNetworkStack_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_RegisterNetworkStack_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_RegisterNetworkStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_UnRegisterNetworkStack_Input_buf2api(gpMacDispatcher_UnRegisterNetworkStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_UnRegisterNetworkStack_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_UnRegisterNetworkStack_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_UnRegisterNetworkStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_RegisterCallbacks_Input_buf2api(gpMacDispatcher_RegisterCallbacks_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_LockClaim_Input_buf2api(gpMacDispatcher_LockClaim_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_LockClaim_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_LockClaim_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_LockClaim_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_LockRelease_Input_buf2api(gpMacDispatcher_LockRelease_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_LockedByThisStack_Input_buf2api(gpMacDispatcher_LockedByThisStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_LockedByThisStack_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_LockedByThisStack_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_LockedByThisStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpMacDispatcher_Locked_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_Locked_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_Reset_Input_buf2api(gpMacDispatcher_Reset_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_Reset_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_Reset_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_Reset_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_DataRequest_Input_buf2api(gpMacDispatcher_DataRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_ScanRequest_Input_buf2api(gpMacDispatcher_ScanRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_AssociateRequest_Input_buf2api(gpMacDispatcher_AssociateRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_AssociateResponse_Input_buf2api(gpMacDispatcher_AssociateResponse_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_PollRequest_Input_buf2api(gpMacDispatcher_PollRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_PurgeRequest_Input_buf2api(gpMacDispatcher_PurgeRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_Start_Input_buf2api(gpMacDispatcher_Start_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_Start_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_Start_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_Start_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_OrphanResponse_Input_buf2api(gpMacDispatcher_OrphanResponse_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPanId_Input_buf2api(gpMacDispatcher_SetPanId_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetPanId_Input_buf2api(gpMacDispatcher_GetPanId_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetPanId_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetPanId_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetPanId_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetShortAddress_Input_buf2api(gpMacDispatcher_SetShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetShortAddress_Input_buf2api(gpMacDispatcher_GetShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetShortAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetShortAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetShortAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetExtendedAddress_Input_buf2api(gpMacDispatcher_SetExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetExtendedAddress_Input_buf2api(gpMacDispatcher_GetExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDsn_Input_buf2api(gpMacDispatcher_SetDsn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetDsn_Input_buf2api(gpMacDispatcher_GetDsn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetDsn_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetDsn_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetDsn_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCurrentChannel_Input_buf2api(gpMacDispatcher_SetCurrentChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCurrentChannel_Input_buf2api(gpMacDispatcher_GetCurrentChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCurrentChannel_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCurrentChannel_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCurrentChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetBeaconPayload_Input_buf2api(gpMacDispatcher_SetBeaconPayload_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetBeaconPayload_Input_buf2api(gpMacDispatcher_GetBeaconPayload_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayload_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetBeaconPayload_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetBeaconPayload_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetBeaconPayloadLength_Input_buf2api(gpMacDispatcher_SetBeaconPayloadLength_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetBeaconPayloadLength_Input_buf2api(gpMacDispatcher_GetBeaconPayloadLength_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayloadLength_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetBeaconPayloadLength_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetBeaconPayloadLength_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetRxOnWhenIdle_Input_buf2api(gpMacDispatcher_SetRxOnWhenIdle_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetRxOnWhenIdle_Input_buf2api(gpMacDispatcher_GetRxOnWhenIdle_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetRxOnWhenIdle_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetRxOnWhenIdle_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetRxOnWhenIdle_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetTransactionPersistenceTime_Input_buf2api(gpMacDispatcher_GetTransactionPersistenceTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetTransactionPersistenceTime_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetTransactionPersistenceTime_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetTransactionPersistenceTime_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetTransactionPersistenceTime_Input_buf2api(gpMacDispatcher_SetTransactionPersistenceTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetBeaconStarted_Input_buf2api(gpMacDispatcher_SetBeaconStarted_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetBeaconStarted_Input_buf2api(gpMacDispatcher_GetBeaconStarted_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetBeaconStarted_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetBeaconStarted_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetBeaconStarted_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCoordShortAddress_Input_buf2api(gpMacDispatcher_SetCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCoordShortAddress_Input_buf2api(gpMacDispatcher_GetCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCoordShortAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCoordShortAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCoordShortAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCoordExtendedAddress_Input_buf2api(gpMacDispatcher_SetCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCoordExtendedAddress_Input_buf2api(gpMacDispatcher_GetCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCoordExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCoordExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCoordExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPromiscuousMode_Input_buf2api(gpMacDispatcher_SetPromiscuousMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetPromiscuousMode_Input_buf2api(gpMacDispatcher_GetPromiscuousMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetPromiscuousMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetPromiscuousMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetPromiscuousMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetAssociationPermit_Input_buf2api(gpMacDispatcher_SetAssociationPermit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetAssociationPermit_Input_buf2api(gpMacDispatcher_GetAssociationPermit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetAssociationPermit_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetAssociationPermit_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetAssociationPermit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetSecurityEnabled_Input_buf2api(gpMacDispatcher_SetSecurityEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetSecurityEnabled_Input_buf2api(gpMacDispatcher_GetSecurityEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetSecurityEnabled_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetSecurityEnabled_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetSecurityEnabled_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetNumberOfRetries_Input_buf2api(gpMacDispatcher_SetNumberOfRetries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetNumberOfRetries_Input_buf2api(gpMacDispatcher_GetNumberOfRetries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetNumberOfRetries_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetNumberOfRetries_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetNumberOfRetries_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMaxCsmaBackoffs_Input_buf2api(gpMacDispatcher_SetMaxCsmaBackoffs_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMaxCsmaBackoffs_Input_buf2api(gpMacDispatcher_GetMaxCsmaBackoffs_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMaxCsmaBackoffs_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMaxCsmaBackoffs_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMaxCsmaBackoffs_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDefaultTransmitPowers_Input_buf2api(gpMacDispatcher_SetDefaultTransmitPowers_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetTransmitPower_Input_buf2api(gpMacDispatcher_SetTransmitPower_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetTransmitPower_Input_buf2api(gpMacDispatcher_GetTransmitPower_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetTransmitPower_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetTransmitPower_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetTransmitPower_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCCAMode_Input_buf2api(gpMacDispatcher_SetCCAMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCCAMode_Input_buf2api(gpMacDispatcher_GetCCAMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCCAMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCCAMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCCAMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPanCoordinator_Input_buf2api(gpMacDispatcher_SetPanCoordinator_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetPanCoordinator_Input_buf2api(gpMacDispatcher_GetPanCoordinator_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordinator_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetPanCoordinator_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetPanCoordinator_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMinBE_Input_buf2api(gpMacDispatcher_SetMinBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMinBE_Input_buf2api(gpMacDispatcher_GetMinBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMinBE_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMinBE_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMinBE_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetIndicateBeaconNotifications_Input_buf2api(gpMacDispatcher_SetIndicateBeaconNotifications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetIndicateBeaconNotifications_Input_buf2api(gpMacDispatcher_GetIndicateBeaconNotifications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetIndicateBeaconNotifications_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetIndicateBeaconNotifications_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetIndicateBeaconNotifications_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMacVersion_Input_buf2api(gpMacDispatcher_SetMacVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMacVersion_Input_buf2api(gpMacDispatcher_GetMacVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMacVersion_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMacVersion_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMacVersion_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetForwardPollIndications_Input_buf2api(gpMacDispatcher_SetForwardPollIndications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetForwardPollIndications_Input_buf2api(gpMacDispatcher_GetForwardPollIndications_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetForwardPollIndications_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetForwardPollIndications_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetForwardPollIndications_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_DataPending_QueueAdd_Input_buf2api(gpMacDispatcher_DataPending_QueueAdd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueAdd_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_DataPending_QueueAdd_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_DataPending_QueueAdd_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_DataPending_QueueRemove_Input_buf2api(gpMacDispatcher_DataPending_QueueRemove_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueRemove_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_DataPending_QueueRemove_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_DataPending_QueueRemove_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMinInterferenceLevels_Input_buf2api(gpMacDispatcher_SetMinInterferenceLevels_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMaxBE_Input_buf2api(gpMacDispatcher_SetMaxBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMaxBE_Input_buf2api(gpMacDispatcher_GetMaxBE_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMaxBE_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMaxBE_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMaxBE_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDeviceDescriptor_Input_buf2api(gpMacDispatcher_SetDeviceDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDeviceDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_SetDeviceDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_SetDeviceDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetDeviceDescriptor_Input_buf2api(gpMacDispatcher_GetDeviceDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetDeviceDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetDeviceDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetDeviceDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDeviceTableEntries_Input_buf2api(gpMacDispatcher_SetDeviceTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetDeviceTableEntries_Input_buf2api(gpMacDispatcher_GetDeviceTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetDeviceTableEntries_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetDeviceTableEntries_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetDeviceTableEntries_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetKeyDescriptor_Input_buf2api(gpMacDispatcher_SetKeyDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetKeyDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_SetKeyDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_SetKeyDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetKeyDescriptor_Input_buf2api(gpMacDispatcher_GetKeyDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetKeyDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetKeyDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetKeyDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetKeyTableEntries_Input_buf2api(gpMacDispatcher_SetKeyTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetSecurityLevelDescriptor_Input_buf2api(gpMacDispatcher_SetSecurityLevelDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetSecurityLevelDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_SetSecurityLevelDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_SetSecurityLevelDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetSecurityLevelDescriptor_Input_buf2api(gpMacDispatcher_GetSecurityLevelDescriptor_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelDescriptor_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetSecurityLevelDescriptor_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetSecurityLevelDescriptor_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetSecurityLevelTableEntries_Input_buf2api(gpMacDispatcher_SetSecurityLevelTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetSecurityLevelTableEntries_Input_buf2api(gpMacDispatcher_GetSecurityLevelTableEntries_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelTableEntries_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetSecurityLevelTableEntries_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetSecurityLevelTableEntries_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDefaultKeySource_Input_buf2api(gpMacDispatcher_SetDefaultKeySource_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetFrameCounter_Input_buf2api(gpMacDispatcher_SetFrameCounter_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetFrameCounter_Input_buf2api(gpMacDispatcher_GetFrameCounter_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetFrameCounter_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetFrameCounter_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetFrameCounter_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPanCoordShortAddress_Input_buf2api(gpMacDispatcher_SetPanCoordShortAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetPanCoordExtendedAddress_Input_buf2api(gpMacDispatcher_SetPanCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetPanCoordExtendedAddress_Input_buf2api(gpMacDispatcher_GetPanCoordExtendedAddress_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordExtendedAddress_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetPanCoordExtendedAddress_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetPanCoordExtendedAddress_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_AddNeighbour_Input_buf2api(gpMacDispatcher_AddNeighbour_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_AddNeighbour_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_AddNeighbour_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_AddNeighbour_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_RemoveNeighbour_Input_buf2api(gpMacDispatcher_RemoveNeighbour_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_RemoveNeighbour_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_RemoveNeighbour_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_RemoveNeighbour_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetDataPendingMode_Input_buf2api(gpMacDispatcher_SetDataPendingMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDataPendingMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_SetDataPendingMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_SetDataPendingMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_buf2api(gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_ClearNeighbours_Input_buf2api(gpMacDispatcher_ClearNeighbours_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCallbacks_Input_buf2api(gpMacDispatcher_GetCallbacks_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCallbacks_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCallbacks_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCallbacks_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_IsValidStack_Input_buf2api(gpMacDispatcher_IsValidStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_IsValidStack_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_IsValidStack_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_IsValidStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetCsmaMode_Input_buf2api(gpMacDispatcher_SetCsmaMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetCsmaMode_Input_buf2api(gpMacDispatcher_GetCsmaMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCsmaMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCsmaMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetCsmaMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_DataPending_QueueClear_Input_buf2api(gpMacDispatcher_DataPending_QueueClear_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueClear_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_DataPending_QueueClear_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_DataPending_QueueClear_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_ScheduleTimedTx_Input_buf2api(gpMacDispatcher_ScheduleTimedTx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_ScheduleTimedTx_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_ScheduleTimedTx_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_ScheduleTimedTx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetStackInRawMode_Input_buf2api(gpMacDispatcher_SetStackInRawMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetStackInRawMode_Input_buf2api(gpMacDispatcher_GetStackInRawMode_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetStackInRawMode_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetStackInRawMode_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetStackInRawMode_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetRawModeEncryptionKeys_Input_buf2api(gpMacDispatcher_SetRawModeEncryptionKeys_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetRawModeNonceFields_Input_buf2api(gpMacDispatcher_SetRawModeNonceFields_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_EnableEnhancedFramePending_Input_buf2api(gpMacDispatcher_EnableEnhancedFramePending_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_EnableRxWindows_Input_buf2api(gpMacDispatcher_EnableRxWindows_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_DisableRxWindows_Input_buf2api(gpMacDispatcher_DisableRxWindows_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_EnableCsl_Input_buf2api(gpMacDispatcher_EnableCsl_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_UpdateCslSampleTime_Input_buf2api(gpMacDispatcher_UpdateCslSampleTime_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetCurrentTimeUs_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetCurrentTimeUs_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_ConfigureEnhAckProbing_Input_buf2api(gpMacDispatcher_ConfigureEnhAckProbing_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_ConfigureEnhAckProbing_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_ConfigureEnhAckProbing_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_ConfigureEnhAckProbing_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetRetransmitOnCcaFail_Input_buf2api(gpMacDispatcher_SetRetransmitOnCcaFail_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetRetransmitOnCcaFail_Input_buf2api(gpMacDispatcher_GetRetransmitOnCcaFail_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitOnCcaFail_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetRetransmitOnCcaFail_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetRetransmitOnCcaFail_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetRetransmitRandomBackoff_Input_buf2api(gpMacDispatcher_SetRetransmitRandomBackoff_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetRetransmitRandomBackoff_Input_buf2api(gpMacDispatcher_GetRetransmitRandomBackoff_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitRandomBackoff_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetRetransmitRandomBackoff_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetRetransmitRandomBackoff_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMinBeRetransmit_Input_buf2api(gpMacDispatcher_SetMinBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMinBeRetransmit_Input_buf2api(gpMacDispatcher_GetMinBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMinBeRetransmit_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMinBeRetransmit_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMinBeRetransmit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_SetMaxBeRetransmit_Input_buf2api(gpMacDispatcher_SetMaxBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpMacDispatcher_GetMaxBeRetransmit_Input_buf2api(gpMacDispatcher_GetMaxBeRetransmit_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetMaxBeRetransmit_Output_api2buf(UInt8Buffer* pDest , gpMacDispatcher_GetMaxBeRetransmit_Output_marshall_struct_t* pSourceoutput , gpMacDispatcher_GetMaxBeRetransmit_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void MacDispatcher_cbDataConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpPd_Handle_t pdHandle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbDataIndication_Input_par2api(UInt8Buffer* pDest , const gpMacCore_AddressInfo_t* pSrcAddrInfo , const gpMacCore_AddressInfo_t* pDstAddrInfo , UInt8 dsn , gpMacCore_Security_t* pSecOptions , gpPd_Loh_t pdLoh , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbScanConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpMacCore_ScanType_t scanType , UInt32 unscannedChannels , UInt8 resultListSize , UInt8* pEdScanResultList , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbAssociateIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_Address_t* pDeviceAddress , UInt8 capabilityInformation , gpPd_TimeStamp_t rxTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbAssociateConfirm_Input_par2api(UInt8Buffer* pDest , UInt16 assocShortAddress , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbAssociateCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddrInfo , gpMacCore_AddressInfo_t* pDstAddrInfo , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbPollConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpMacCore_AddressInfo_t* coordAddrInfo , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbPollIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* addressInfo , gpPd_TimeStamp_t rxTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbPurgeConfirm_Input_par2api(UInt8Buffer* pDest , gpMacCore_Result_t status , gpPd_Handle_t pdHandle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbBeaconNotifyIndication_Input_par2api(UInt8Buffer* pDest , UInt8 bsn , gpMacCore_PanDescriptor_t* pPanDescriptor , UInt8 beaconPayloadLength , UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbOrphanIndication_Input_par2api(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , gpPd_TimeStamp_t rxTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbOrphanCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddrInfo , gpMacCore_AddressInfo_t* pDstAddrInfo , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbSecurityFailureCommStatusIndication_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pSrcAddrInfo , gpMacCore_AddressInfo_t* pDstAddrInfo , gpMacCore_Result_t status , gpPd_TimeStamp_t txTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbDriverResetIndication_Input_par2api(UInt8Buffer* pDest , gpMacDispatcher_Result_t status , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbPollNotify_Input_par2api(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* addressInfo , gpPd_TimeStamp_t rxTime , gpPd_Handle_t pdHandle , Bool fromNeighbour , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void MacDispatcher_cbSecurityFrameCounterIndication_Input_par2api(UInt8Buffer* pDest , UInt32 frameCounter , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); + +// Client functions +void gpMacDispatcher_RegisterNetworkStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StringIdentifier_t* stringIdentifier , UInt16* pIndex); +void gpMacDispatcher_RegisterNetworkStack_Output_buf2par(gpMacDispatcher_StackId_t* stackId , gpMacDispatcher_StringIdentifier_t* stringIdentifier , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_UnRegisterNetworkStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_UnRegisterNetworkStack_Output_buf2par(gpMacCore_Result_t* result , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_RegisterCallbacks_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , gpMacDispatcher_Callbacks_t* callbacks , UInt16* pIndex); +void gpMacDispatcher_LockClaim_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_LockClaim_Output_buf2par(Bool* result , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_LockRelease_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_LockedByThisStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_LockedByThisStack_Output_buf2par(Bool* locked , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_Locked_Output_buf2par(Bool* locked , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_Reset_Input_par2buf(UInt8Buffer* pDest , Bool setDefaultPib , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_Reset_Output_buf2par(gpMacDispatcher_Result_t* result , Bool setDefaultPib , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressMode_t srcAddrMode , gpMacCore_AddressInfo_t* pDstAddressInfo , UInt8 txOptions , gpMacCore_Security_t* pSecOptions , gpMacCore_MultiChannelOptions_t multiChannelOptions , gpPd_Loh_t pdLoh , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_ScanRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_ScanType_t scanType , UInt32 scanChannels , UInt8 scanDuration , UInt8 resultListSize , UInt8* pResultList , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_AssociateRequest_Input_par2buf(UInt8Buffer* pDest , UInt8 logicalChannel , gpMacCore_AddressInfo_t* coordAddrInfo , UInt8 capabilityInformation , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_AssociateResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pDeviceAddress , UInt16 associateShortAddress , gpMacCore_Result_t status , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_PollRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* coordAddrInfo , gpMacCore_Security_t* pSecOptions , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_PurgeRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_Start_Input_par2buf(UInt8Buffer* pDest , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , UInt8 stackId , UInt16* pIndex); +void gpMacDispatcher_Start_Output_buf2par(gpMacCore_Result_t* returnValue , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , UInt8 stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_OrphanResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , UInt16 shortAddress , Bool associatedMember , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetPanId_Input_par2buf(UInt8Buffer* pDest , UInt16 panId , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanId_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanId_Output_buf2par(gpMacCore_PanId_t* panId , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetShortAddress_Output_buf2par(UInt16* address , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetExtendedAddress_Output_buf2par(MACAddress_t* pExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDsn_Input_par2buf(UInt8Buffer* pDest , UInt8 dsn , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDsn_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDsn_Output_buf2par(UInt8* dsn , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCurrentChannel_Output_buf2par(UInt8* channel , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayload_Output_buf2par(UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , UInt8 beaconPayloadLength , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconPayloadLength_Output_buf2par(UInt8* beaconPayloadLength , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , Bool rxOnWhenIdle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRxOnWhenIdle_Output_buf2par(Bool* rxOnWhenIdle , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetTransactionPersistenceTime_Output_buf2par(UInt16* time , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , UInt16 time , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , Bool beaconStarted , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetBeaconStarted_Output_buf2par(Bool* beaconStarted , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 coordShortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCoordShortAddress_Output_buf2par(UInt16* coordShortAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCoordExtendedAddress_Output_buf2par(MACAddress_t* pCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , UInt8 promiscuousMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPromiscuousMode_Output_buf2par(Bool* promiscuousMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , Bool associationPermit , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetAssociationPermit_Output_buf2par(Bool* associationPermit , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , Bool securityEnabled , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityEnabled_Output_buf2par(Bool* securityEnabled , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , UInt8 numberOfRetries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetNumberOfRetries_Output_buf2par(UInt8* numberOfRetries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , UInt8 maxCsmaBackoffs , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxCsmaBackoffs_Output_buf2par(UInt8* maxCsmaBackoffs , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDefaultTransmitPowers_Input_par2buf(UInt8Buffer* pDest , Int8* pDefaultTransmitPowerTable , UInt16* pIndex); +void gpMacDispatcher_SetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacCore_TxPower_t transmitPower , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetTransmitPower_Output_buf2par(Int8* transmitPower , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCCAMode_Input_par2buf(UInt8Buffer* pDest , UInt8 cCAMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCCAMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCCAMode_Output_buf2par(UInt8* cCAMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , Bool panCoordinator , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordinator_Output_buf2par(Bool* panCoordinator , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMinBE_Input_par2buf(UInt8Buffer* pDest , UInt8 minBE , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMinBE_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMinBE_Output_buf2par(UInt8* minBE , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetIndicateBeaconNotifications_Output_buf2par(Bool* enable , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacCore_MacVersion_t macVersion , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMacVersion_Output_buf2par(gpMacCore_MacVersion_t* macVersion , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetForwardPollIndications_Output_buf2par(Bool* enable , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueAdd_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueAdd_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueRemove_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueRemove_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMinInterferenceLevels_Input_par2buf(UInt8Buffer* pDest , Int8* pInterferenceLevels , UInt16* pIndex); +void gpMacDispatcher_SetMaxBE_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBE , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxBE_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxBE_Output_buf2par(UInt8* maxBE , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceTablesEntries_t deviceTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetDeviceTableEntries_Output_buf2par(gpMacCore_DeviceTablesEntries_t* deviceTableEntries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetKeyTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyTablesEntries_t keyTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetSecurityLevelTableEntries_Output_buf2par(gpMacCore_SecurityLevelTableEntries_t* securityLevelTableEntries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDefaultKeySource_Input_par2buf(UInt8Buffer* pDest , UInt8* pDefaultKeySource , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetFrameCounter_Input_par2buf(UInt8Buffer* pDest , UInt32 frameCounter , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetFrameCounter_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetFrameCounter_Output_buf2par(UInt32* frameCounter , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetPanCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 panCoordShortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pPanCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetPanCoordExtendedAddress_Output_buf2par(MACAddress_t* pPanCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_AddNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_AddNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_RemoveNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_RemoveNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetDataPendingMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetDataPendingMode_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_par2buf(UInt8Buffer* pDest , UInt8 addressMode , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_ClearNeighbours_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCallbacks_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCallbacks_Output_buf2par(gpMacDispatcher_StackId_t stackId , gpMacDispatcher_Callbacks_t* callbacks , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_IsValidStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_IsValidStack_Output_buf2par(Bool* valid , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetCsmaMode_Input_par2buf(UInt8Buffer* pDest , UInt8 csmaMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCsmaMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCsmaMode_Output_buf2par(UInt8* csmaMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueClear_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_DataPending_QueueClear_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_ScheduleTimedTx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacCore_TxTimingOptions_t timingOptions , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_ScheduleTimedTx_Output_buf2par(gpMacCore_Result_t* result , gpPd_Handle_t pdHandle , gpMacCore_TxTimingOptions_t timingOptions , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , Bool rawModeEnabled , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetStackInRawMode_Output_buf2par(Bool* rawModeEnabled , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetRawModeEncryptionKeys_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyIdMode_t encryptionKeyIdMode , gpMacCore_KeyIndex_t encryptionKeyId , UInt8* pCurrKey , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_SetRawModeNonceFields_Input_par2buf(UInt8Buffer* pDest , UInt32 frameCounter , MACAddress_t* pExtendedAddress , UInt8 seclevel , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_EnableEnhancedFramePending_Input_par2buf(UInt8Buffer* pDest , Bool enableEnhancedFramePending , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_EnableRxWindows_Input_par2buf(UInt8Buffer* pDest , UInt32 dutyCycleOnTime , UInt32 dutyCyclePeriod , UInt16 recurrenceAmount , UInt32 startTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_DisableRxWindows_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_EnableCsl_Input_par2buf(UInt8Buffer* pDest , UInt16 dutyCyclePeriod , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_UpdateCslSampleTime_Input_par2buf(UInt8Buffer* pDest , UInt32 nextCslSampleTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetCurrentTimeUs_Output_buf2par(UInt32* currentTime , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_ConfigureEnhAckProbing_Input_par2buf(UInt8Buffer* pDest , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_ConfigureEnhAckProbing_Output_buf2par(gpMacCore_Result_t* result , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitOnCcaFail_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetRetransmitRandomBackoff_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 minBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMinBeRetransmit_Output_buf2par(UInt8* minBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpMacDispatcher_SetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex); +void gpMacDispatcher_GetMaxBeRetransmit_Output_buf2par(UInt8* maxBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbDataConfirm_Input_buf2api(MacDispatcher_cbDataConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbDataIndication_Input_buf2api(MacDispatcher_cbDataIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbScanConfirm_Input_buf2api(MacDispatcher_cbScanConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbAssociateIndication_Input_buf2api(MacDispatcher_cbAssociateIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbAssociateConfirm_Input_buf2api(MacDispatcher_cbAssociateConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbAssociateCommStatusIndication_Input_buf2api(MacDispatcher_cbAssociateCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbPollConfirm_Input_buf2api(MacDispatcher_cbPollConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbPollIndication_Input_buf2api(MacDispatcher_cbPollIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbPurgeConfirm_Input_buf2api(MacDispatcher_cbPurgeConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbBeaconNotifyIndication_Input_buf2api(MacDispatcher_cbBeaconNotifyIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbOrphanIndication_Input_buf2api(MacDispatcher_cbOrphanIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbOrphanCommStatusIndication_Input_buf2api(MacDispatcher_cbOrphanCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbSecurityFailureCommStatusIndication_Input_buf2api(MacDispatcher_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbDriverResetIndication_Input_buf2api(MacDispatcher_cbDriverResetIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbPollNotify_Input_buf2api(MacDispatcher_cbPollNotify_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t MacDispatcher_cbSecurityFrameCounterIndication_Input_buf2api(MacDispatcher_cbSecurityFrameCounterIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); + +void gpMacDispatcher_InitMarshalling(void); + +#define gpMacDispatcher_SetDummyDataInsertion(enable) +#define gpMacDispatcher_GetDummyDataInsertion() false + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPMACDISPATCHER_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher.h new file mode 100644 index 0000000..18a0604 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher.h @@ -0,0 +1,292 @@ +/* + * Copyright (c) 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpMacDispatcher.h + * This file contains the definitions of the public functions and enumerations of the gpMacDispatcher.(based on IEEE802.15.4-2006) + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GP_MACDISPATCHER_H_ +#define _GP_MACDISPATCHER_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpMacCore.h" + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/** @brief The invalid stack ID. */ +#define GP_MAC_DISPATCHER_INVALID_STACK_ID (GP_MACCORE_STACK_UNDEFINED) +#define GP_MAC_DISPATCHER_STRING_ID_LENGTH 5 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @name gpMacDispatcher_Result_t */ +//@{ +//PHY results +/** @brief The requested operation was completed successfully. For instance if a transmission was requested, this value indicates a successful transmission.*/ +#define gpMacDispatcher_ResultSuccess gpMacCore_ResultSuccess +//MAC results +/** @brief The frame counter purportedly applied by the originator of the received frame is invalid. */ +#define gpMacDispatcher_ResultCounterError gpMacCore_ResultCounterError +/** @brief The key purportedly applied by the originator of the received frame is not allowed to be used with that frame type according to the key usage policy of the recipient.*/ +#define gpMacDispatcher_ResultImproperKeyType gpMacCore_ResultImproperKeyType +/** @brief The security level purportedly applied by the originator of the received frame does not meet the minimum security level required/expected by the recipient for that frame type.*/ +#define gpMacDispatcher_ResultImproperSecurityLevel gpMacCore_ResultImproperSecurityLevel +/** @brief The received frame was purportedly secured using security based on IEEE Std 802.15.4-2003, and such security is not supported by this standard. */ +#define gpMacDispatcher_ResultUnsupportedLegacy gpMacCore_ResultUnsupportedLegacy +/** @brief The security purportedly applied by the originator of the received frame is not supported. */ +#define gpMacDispatcher_ResultUnsupportedSecurity gpMacCore_ResultUnsupportedSecurity +/** @brief The beacon was lost following a synchronization request. */ +#define gpMacDispatcher_ResultBeaconLoss gpMacCore_ResultBeaconLoss +/** @brief A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed. */ +#define gpMacDispatcher_ResultChannelAccessFailure gpMacCore_ResultChannelAccessFailure +/** @brief The GTS request has been denied by the PAN coordinator. */ +#define gpMacDispatcher_ResultDenied gpMacCore_ResultDenied +/** @brief The attempt to disable the transceiver has failed. */ +#define gpMacDispatcher_ResultDisableTrxFailure gpMacCore_ResultDisableTrxFailure +/** @brief The received frame induces a failed security check according to the security suite. */ +#define gpMacDispatcher_ResultSecurityError gpMacCore_ResultSecurityError +/** @brief The frame resulting from secure processing has a length that is greater than aMACMaxFrameSize. */ +#define gpMacDispatcher_ResultFrameTooLong gpMacCore_ResultFrameTooLong +/** @brief The requested GTS transmission failed because the specified GTS either did not have a transmit GTS direction or was not defined. */ +#define gpMacDispatcher_ResultInvalidGTS gpMacCore_ResultInvalidGTS +/** @brief A request to purge an MSDU from the transaction queue wasmade using an MSDU handle that was not found in the transaction table. */ +#define gpMacDispatcher_ResultInvalidHandle gpMacCore_ResultInvalidHandle +/** @brief A parameter in the primitive is out of the valid range. */ +#define gpMacDispatcher_ResultInvalidParameter gpMacCore_ResultInvalidParameter +/** @brief No acknowledgment was received after aMaxFrameRetries. */ +#define gpMacDispatcher_ResultNoAck gpMacCore_ResultNoAck +/** @brief A scan operation failed to find any network beacons. */ +#define gpMacDispatcher_ResultNoBeacon gpMacCore_ResultNoBeacon +/** @brief No response data was available following a request. */ +#define gpMacDispatcher_ResultNoData gpMacCore_ResultNoData +/** @brief The operation failed because a short address was not allocated. */ +#define gpMacDispatcher_ResultNoShortAddress gpMacCore_ResultNoShortAddress +/** @brief A request to enable the receiver was unsuccessful because it could not be completed within the CAP. */ +#define gpMacDispatcher_ResultOutOfCAP gpMacCore_ResultOutOfCAP +/** @brief A PAN identifier conflict has been detected and communicated to the PAN coordinator. */ +#define gpMacDispatcher_ResultPanIdConflict gpMacCore_ResultPanIdConflict +/** @brief A coordinator realignment command has been received. */ +#define gpMacDispatcher_ResultRealignment gpMacCore_ResultRealignment +/** @brief The transaction has expired and its information is discarded. */ +#define gpMacDispatcher_ResultTransactionExpired gpMacCore_ResultTransactionExpired +/** @brief There is no capacity to store the transaction. */ +#define gpMacDispatcher_ResultTransactionOverflow gpMacCore_ResultTransactionOverflow +/** @brief The transceiver was transmitting when the receiver was requested to be enabled. */ +#define gpMacDispatcher_ResultTxActive gpMacCore_ResultTxActive +/** @brief The appropriate key is not available in the ACL. */ +#define gpMacDispatcher_ResultUnavailableKey gpMacCore_ResultUnavailableKey +/** @brief A SET/GET request was issued with the identifier of a PIBattribute that is not supported. */ +#define gpMacDispatcher_ResultUnsupportedAttribute gpMacCore_ResultUnsupportedAttribute +/** @brief A request to send data was unsuccessful because neither the source address parameters nor the destination address parameters were present.*/ +#define gpMacDispatcher_ResultInvalidAddress gpMacCore_ResultInvalidAddress +/** @brief A receiver enable request was unsuccessful because it specified a number of symbols that was longer than the beacon interval. */ +#define gpMacDispatcher_ResultOnTimeTooLong gpMacCore_ResultOnTimeTooLong +/** @brief A receiver enable request was unsuccessful because it could not be completed within the current superframe and was not permitted to be deferred until the next superframe. */ +#define gpMacDispatcher_ResultPastTime gpMacCore_ResultPastTime +/** @brief The device was instructed to start sending beacons based on the timing of the beacon transmissions of its coordinator, but the device is not currently tracking the beacon of its coordinator.*/ +#define gpMacDispatcher_ResultTrackingOff gpMacCore_ResultTrackingOff +/** @brief An attempt to write to a MAC PIB attribute that is in a table failed because the specified table index was out of range.*/ +#define gpMacDispatcher_ResultInvalidIndex gpMacCore_ResultInvalidIndex +/** @brief A scan operation terminated prematurely because the number of PAN descriptors stored reached an implementationspecified maximum.*/ +#define gpMacDispatcher_ResultLimitedReached gpMacCore_ResultLimitedReached +/** @brief A SET/GET request was issued with the identifier of an attribute that is read only. */ +#define gpMacDispatcher_ResultReadOnly gpMacCore_ResultReadOnly +/** @brief A request to perform a scan operation failed because the MLME was in the process of performing a previously initiated scan operation. */ +#define gpMacDispatcher_ResultScanInProgress gpMacCore_ResultScanInProgress +/** @brief The device was instructed to start sending beacons based on the timing of the beacon transmissions of its coordinator, but the instructed start time overlapped the transmission time of the beacon of its coordinator. */ +#define gpMacDispatcher_ResultSuperframeOverlap gpMacCore_ResultSuperframeOverlap +/** @brief Status send on driver reset indication to indicate that a second stack with the same ID has been registered */ +#define gpMacDispatcher_ResultSecondStackRegistered 0xFE +/** @brief Status send on driver reset indication to indicate that a reset has finished - used for server/client only */ +#define gpMacDispatcher_ResultResetFinished 0xFF + +typedef gpMacCore_Result_t gpMacDispatcher_Result_t; + +typedef UInt8 gpMacDispatcher_StackId_t; + +typedef struct { + char str[GP_MAC_DISPATCHER_STRING_ID_LENGTH]; +} gpMacDispatcher_StringIdentifier_t; + +#if GP_DIVERSITY_NR_OF_STACKS > 1 \ + \ + || defined(GP_DIVERSITY_JUMPTABLES) +#include "gpMacDispatcher_MultiStack.h" +#else +#include "gpMacDispatcher_SingleStack.h" +#endif //(GP_DIVERSITY_NR_OF_STACKS == 1) + + +/** @ingroup DATA + * @typedef gpMacDispatcher_cbDataIndication_t + * @brief Calls the DataIndication callback function. It is used to inform the next higher layer a data packet is received. + */ +typedef void (*gpMacDispatcher_cbDataIndication_t)(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 dsn, gpMacCore_Security_t *pSecOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId); +/** @ingroup DATA + * @typedef gpMacDispatcher_cbDataConfirm_t + * @brief Calls the DataConfirm callback function. It is used to inform the next higher layer a data packet is sent. + */ +typedef void (*gpMacDispatcher_cbDataConfirm_t)(gpMacDispatcher_Result_t status, gpPd_Handle_t pdHandle, gpMacCore_StackId_t stackId); +/** @ingroup DATA + * @typedef gpMacDispatcher_cbPollIndication_t + * @brief Calls the PollIndication callback function. It is used to inform the next higher layer a Cmd DataRequest is received. + */ +typedef void (*gpMacDispatcher_cbPollIndication_t)(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpMacCore_StackId_t stackId); +/** @ingroup DATA + * @typedef gpMacDispatcher_cbPollConfirm_t + * @brief Calls the PollConfirm callback function. It is used to inform the next higher layer a poll request was sent (status). + */ +typedef void (*gpMacDispatcher_cbPollConfirm_t)(gpMacDispatcher_Result_t status, gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); + +/** @ingroup DATA + * @typedef gpMacDispatcher_cbPurgeConfirm_t + * @brief Calls the PurgeConfirm callback function. It is used to inform the next higher layer a purge request was performed (status). + */ +typedef void (*gpMacDispatcher_cbPurgeConfirm_t)(gpMacDispatcher_Result_t status, gpPd_Handle_t pdHandle, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbBeaconNotifyIndication_t + * @brief Calls the BeaconIndication callback function. It is used to inform the next higher layer a beacon was received. + */ +typedef void (*gpMacDispatcher_cbBeaconNotifyIndication_t)(UInt8 bsn, gpMacCore_PanDescriptor_t* pPanDescriptor, UInt8 beaconPayloadLength, UInt8 *pBeaconPayload, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbScanConfirm_t + * @brief Calls the ScanConfirm callback function. It is used to indicate the scan process was finished. + */ +typedef void (*gpMacDispatcher_cbScanConfirm_t)(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, UInt32 unscannedChannels, UInt8 resultListSize, UInt8* pResultList, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbAssocConfirm_t + * @brief Calls the AssocConfirm callback function. It is used to indicate the association process was finished. + */ +typedef void (*gpMacDispatcher_cbAssocConfirm_t)(UInt16 assocShortAddress, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbAssociateIndication_t + * @brief Calls the AssocIndication callback function. It is used to indicate the association request was received. + */ +typedef void (*gpMacDispatcher_cbAssociateIndication_t)(gpMacCore_Address_t* pDeviceAddress, UInt8 capabilityInformation, gpPd_TimeStamp_t rxTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbOrphanIndication_t + * @brief Calls the Orphan Indication callback function. + */ +typedef void (*gpMacDispatcher_cbOrphanIndication_t)(MACAddress_t* pOrphanAddress, gpPd_TimeStamp_t rxTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbSecurityFailureCommStatusIndication_t + * @brief Indicates a security failure communication status to the next higher layer. + */ +typedef void (*gpMacDispatcher_cbSecurityFailureCommStatusIndication_t)(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbAssociateCommStatusIndication_t + * @brief Indicates a associate response communication status to the next higher layer. + */ +typedef void (*gpMacDispatcher_cbAssociateCommStatusIndication_t)(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbOrphanCommStatusIndication_t + * @brief Indicates an orphan communication status to the next higher layer. + */ +typedef void (*gpMacDispatcher_cbOrphanCommStatusIndication_t) (gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacCore_StackId_t stackId); + +/** @ingroup DATA + * @typedef gpMacDispatcher_cbPollNotify_t + * @brief Calls the PollIndication callback function. It is used to inform the next higher layer a Cmd DataRequest is received. + @param pAddrInfo The addressMode and address of PollRequest transmitter. + @param rxTime The timestamp for the reception of the frame. + * @param pdHandle The pd Handle which will be transmitted as a response to the PollRequest. 0xFF indicates that no data is ready. + * @param fromNeighbour Boolean value, which indicates if the source address is present in our Neighbour list. + */ +typedef void (*gpMacDispatcher_cbPollNotify_t)(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpPd_Handle_t pdHandle, Bool fromNeighbour, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbOrphanCommStatusIndication_t + * @brief Indicates an unexpected driver reset to network stacks. + */ +typedef void (*gpMacDispatcher_cbDriverResetIndication_t) (gpMacCore_Result_t status, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @typedef gpMacDispatcher_cbSecurityFrameCounterIndication_t + * @brief Indicates that the frame counter has receached a value that needs to be stored in NVM. The value should be restored by the stack upon restart by using the function gpMacDispatcher_SetFrameCounter(); + */ +typedef void (*gpMacDispatcher_cbSecurityFrameCounterIndication_t)(UInt32 frameCounter, gpMacCore_StackId_t stackId); + +typedef struct gpMacDispatcher_Callbacks_s { + gpMacDispatcher_cbDataIndication_t dataIndicationCallback; + gpMacDispatcher_cbDataConfirm_t dataConfirmCallback; + gpMacDispatcher_cbPollIndication_t pollIndicationCallback; + gpMacDispatcher_cbPollConfirm_t pollConfirmCallback; + gpMacDispatcher_cbPurgeConfirm_t purgeConfirmCallback; + gpMacDispatcher_cbBeaconNotifyIndication_t beaconNotifyIndicationCallback; + gpMacDispatcher_cbScanConfirm_t scanConfirmCallback; + gpMacDispatcher_cbAssociateIndication_t assocIndicationCallback; + gpMacDispatcher_cbAssocConfirm_t assocConfirmCallback; + gpMacDispatcher_cbOrphanIndication_t orphanIndicationCallback; + gpMacDispatcher_cbSecurityFailureCommStatusIndication_t securityFailureCommStatusIndicationCallback; + gpMacDispatcher_cbAssociateCommStatusIndication_t associateCommStatusIndicationCallback; + gpMacDispatcher_cbOrphanCommStatusIndication_t orphanCommStatusIndicationCallback; + gpMacDispatcher_cbDriverResetIndication_t driverResetIndicationCallback; + gpMacDispatcher_cbPollNotify_t pollNotifyCallback; + gpMacDispatcher_cbSecurityFrameCounterIndication_t securityFrameCounterIndicationCallback; +}gpMacDispatcher_Callbacks_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpMacDispatcher_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** @brief This function is used to set the callbacks for a specific stack +*/ +void gpMacDispatcher_RegisterCallbacks(gpMacDispatcher_StackId_t stackId, gpMacDispatcher_Callbacks_t* pCallbacks); +void gpMacDispatcher_GetCallbacks(gpMacDispatcher_StackId_t stackId, gpMacDispatcher_Callbacks_t* pCallbacks); + +void gpMacDispatcher_SetMinInterferenceLevels(Int8* pInterferenceLevels) ; + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif // _GP_MACDISPATCHER_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher_MultiStack.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher_MultiStack.h new file mode 100644 index 0000000..c4872e9 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gpMacDispatcher_MultiStack.h @@ -0,0 +1,830 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_MACDISPATCHER_MULTISTACK_H_ +#define _GP_MACDISPATCHER_MULTISTACK_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpMacCore.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Single/Dual Stack common definitions + *****************************************************************************/ + +/** + * @file gpMacDispatcher.h + * @brief The MacDispatcher locks the lower layer before processing any request, after the cbConfirm the lock is released. + * + * @defgroup INIT INIT primitives + * This module groups the initialization routines. + * + * @defgroup DATA DATA primitives + * This module groups the primitives for data transmission. + * - gpMacDispatcher_DataRequest + cbConfirm, cbIndication + * - gpMacDispatcher_PollRequest + cbConfirm, cbIndication + * + * @defgroup MANAGEMENT MANAGEMENT primitives + * - gpMacDispatcher_ScanRequest + * - gpMacDispatcher_AssociateRequest + * - gpMacDispatcher_AssociateResponse + * + * @defgroup ATTRIBUTE ATTRIBUTE primitives + * - gpMacDispatcher_ScanRequest + * - gpMacDispatcher_AssociateRequest + * - gpMacDispatcher_AssociateResponse + */ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpMacDispatcher_CodeJumpTableFlash_Defs_MultiStack.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** @ingroup INIT + * + * @brief This function initializes the MacCore layer. It should be called before calling any other request function. + * +*/ +GP_API void gpMacDispatcher_Init(void); +GP_API void gpMacDispatcher_DeInit(void); + +/** @ingroup INIT + * + * @brief This function resets the MACDispatcher + Core layer. + * + * @param setDefaultPib If true the PIB values are reset to their default value (as specified in the IEEE802.15.4-2006 specification). + * @param stackId The PIB values are reset to their default value (as specified in the IEEE802.15.4-2006 specification). + * + * @note A prerequisite; the invoker of this function should first aqcuire the Mac Dispatcher lock before a reset is allowed + * @return Whether this stack has successfully issued a reset command on the MAC network layer access (true) or not (false). +*/ +GP_API gpMacDispatcher_Result_t gpMacDispatcher_Reset( Bool setDefaultPib, UInt8 stackId ); + +/** @ingroup LOCK + * This function is used to request the lock for the MAC network layer access. This lock must be acquired by a stack before it may access the MAC network layer. + * + * @param stackId The identifier of the stack that requests the lock. + * + * @return Whether this stack has successfully acquired the lock on the MAC network layer access (true) or not (false). +*/ +GP_API Bool gpMacDispatcher_LockClaim( UInt8 stackId ); + +/** @ingroup LOCK + * This function is used to release the lock for the MAC network layer access. + * + * @param stackId The identifier of the stack. +*/ +GP_API void gpMacDispatcher_LockRelease( UInt8 stackId ); + +/** @ingroup LOCK + * This function can be used to check whether the stack id already has the lock on the MAC network layer access. + * + * @param stackId The identifier of the stack + * + * @return Whether this stack has the lock on the MAC network layer access (true) or not (false). +*/ +GP_API Bool gpMacDispatcher_LockedByThisStack( UInt8 stackId ); + +/** @ingroup LOCK + * This function can be used to check whether any stack has the lock on the MAC network layer access. + * + * @return Whether a stack has the lock on the MAC network layer access (true) or not (false). +*/ +GP_API Bool gpMacDispatcher_Locked( void ); + + +/** @ingroup INIT + * @brief This function is used to register a network stack to the dispatcher. + * + * @return The id that is allocated by the MacCore for this stack +*/ +GP_API gpMacDispatcher_StackId_t gpMacDispatcher_RegisterNetworkStack(gpMacDispatcher_StringIdentifier_t* stringIdentifier); + +/** @brief Unregisters a network stack to the MAC layer. + * + * @param stackId the stack ID of the stack that needs to be removed from the MAC layer + * @return result Result of the unregistering + * Possible results: + * - gpMacCore_ResultSuccess + * - gpMacCore_ResultInvalidParameter - stackId is not registered or not in supported range +*/ +GP_API gpMacCore_Result_t gpMacDispatcher_UnRegisterNetworkStack(gpMacDispatcher_StackId_t stackId); + +/** @brief Returns if a stackId is in range and registered + * + * @param stackId the stack ID to check + * @return result Possible results: + * - true - stack is registered and in range + * - false - stackId is not registered or not in supported range +*/ +GP_API Bool gpMacDispatcher_IsValidStack(gpMacDispatcher_StackId_t stackId); + +/** @ingroup DATA + * @brief This function is used to send a data packet to another device. + * + * This function is used to send a data packet conform the IEEE802.15.4-2006 MAC specification. + * + * @param srcAddrMode The address modes to be used for source address. This parameter is used as in the Frame Control Field of an IEEE802.15.4-2006 packet. We refer to the define GP_IEEEMAC_SRC_ADDR_(EXT/SHORT). + * @param pDstAddrInfo All the information about the destination (address mode, address and panId). + * @param txOptions Tx Options byte (see IEEE802.15.4-2006). + * @param pSecOptions The security options - maybe NULL to be used (see IEEE802.15.4-2006). + * @param p_PdLoh The PD Length/Offset/Handle of the data payload. + * @param stackId The stack doing this data request +*/ +GP_API void gpMacDispatcher_DataRequest(gpMacCore_AddressMode_t srcAddrMode, gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 txOptions, gpMacCore_Security_t *pSecOptions, gpMacCore_MultiChannelOptions_t multiChannelOptions, gpPd_Loh_t pdLoh, gpMacCore_StackId_t stackId); + +/** @brief Schedule a packet for timed transmission. + * + * To send a packet via timed transmission, perform two steps: + * - Call gpMacDispatcher_DataRequest() with option GP_MACCORE_TX_OPT_TIMEDTX + * to queue the packet; + - Call gpMacDispatcher_ScheduleTimedTx() to schedule transmission of the queued packet. + * + * This function is only available on hardware that supports a timed transmission queue. + * + * @param pdHandle Handle of TX packet to schedule for TX; must have been previously submitted via gpMacDispatcher_DataRequest(). + * @param timingOptions Specification of scheduled transmit time. + * @param stackId The identifier of the stack doing this request + */ +GP_API gpMacCore_Result_t gpMacDispatcher_ScheduleTimedTx(gpPd_Handle_t pdHandle, gpMacCore_TxTimingOptions_t timingOptions, gpMacDispatcher_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @brief This function is used to start a scan. + * + * This function starts a scan conform the IEEE802.15.4-2006 spec. A scan can be issued to detect a channel with the least amount of interference, to find networks, etc. + * + * @param scanType This parameter defines which of the 3 implemented scans needs to be performed: ED, active or orphan scan. + * @param scanChannels This parameter defines which channels need to be scanned. It is a bitmask where bit 0 must be '1' to select channel 0, bit 26 '1' to select channel 26, etc. Since the chip works in the 2.4GHz band, only channels 11 till 26 can be selected. If other channels are selected, they are ignored and only the selected channels between channel 11 and channel 26 are scanned. + * @param scanDuration This parameter specifies how long a channel will be scanned. The scantime equals [GP_IEEEMAC_BASE_SUPERFRAME_DURATION * (2^scanduration + 1)]symbols, where 1 symbol is 16us. + * @param resultListSize The length of the resultList (in bytes). If an ED scan is done, this should equal the amount of channels. If resultListSize is higher than the amount of channels that needs to be scanned there is no problem. If the value is lower, the scan is terminated when the list is full. + * If an active scan is selected, resultListSize is the amount of PANDescriptors that can be saved. + * If it is an orphan scan, resultListSize is 0. + * @param pResultList This is a pointer to an array where the result of the scan can be saved. If an ED scan is done, the size is resultListSize. If an active scan is issued the size is resultListSize*sizeof(gpMacCore_PanDescriptor_t). + * @param stackId The stack doing this scan request +*/ +GP_API void gpMacDispatcher_ScanRequest(gpMacCore_ScanType_t scanType, UInt32 scanChannels, UInt8 scanDuration , UInt8 resultListSize, UInt8* pResultList, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @brief This function is issued by a device who wishes to join a network. + * + * This function starts the associate procedure. It is used to join a network. When called, the AssociateRequest function will construct an associate request command packet, and send it to the coordinator. + * + * @param logicalChannel The channel that will be used to do the association attempt + * @param pCoordAddrInfo The coordinator addressing info (address mode, panId, address) + * @param capabilityInformation Specifies the operational capabilities of the associating device. + * @param stackId The stack doing this associate request +*/ +GP_API void gpMacDispatcher_AssociateRequest(UInt8 logicalChannel, gpMacCore_AddressInfo_t* pCoordAddrInfo, UInt8 capabilityInformation, gpMacCore_StackId_t stackId); +/** @ingroup MANAGEMENT + * @brief This function is used to send an associate response command packet to a device that is trying to join. The associate response command packet contains the results of the join procedure. + * + * This function is used to respond to a previously received associate request command packet. Upon reception of an associate request command packet, the AssociateIndication function is called to inform the higher layer. The next higher layer then decides to allow the joining device in the network or not. Its decision is sent back to the joining device through the associate response packet. + * + * @param pDeviceAddress A pointer to the address of the device that is trying to join. + * @param associateShortAddress If the joining device is allowed (successful association), this parameter contains the short address that was allocated for the device. If the association was unsuccessful, this parameter is set to 0xffff. + * @param status This parameter contains the result of the association attempt. Possible values are: + * 0x0: Association successful. + * 0x1: PAN at capacity. + * 0x2: PAN access denied. + * @param stackId The stack doing this associate response +*/ +GP_API void gpMacDispatcher_AssociateResponse(MACAddress_t *pDeviceAddress, UInt16 associateShortAddress, gpMacCore_Result_t status, gpMacCore_StackId_t stackId); + +/** @ingroup DATA + * @brief This function is used to poll a coordinator for data by sending a data request command. If the coordinator has data pending for the device that issued the poll request, it will forward the data. + * + * This function starts a poll. This function is used to request packets that are pending at the coordinator (by sending a data request command to the coordinator). + * If the coordinator has data pending for the device that issued the poll request, it will forward the data. + * If a short address is allocated to the device, and it was written into the gpMacCore_AttributeShortAddress PIB attribute, + * the short address will be used as source address of the data request command. + * If the gpMacCore_AttributeShortAddress PIB attribute is set to 0xffff or 0xfffe, the device will use its extended address as source address in the data request command packet. + * + * @param pCoordAddrInfo All the details regarding the coordinator + * @param pSecOptions structure with security options, if NULL no security is used. + * @param stackId The stack doing this poll request +*/ +GP_API void gpMacDispatcher_PollRequest( gpMacCore_AddressInfo_t* pCoordAddrInfo, gpMacCore_Security_t *pSecOptions, gpMacCore_StackId_t stackId); + +/** @ingroup DATA + * @brief This function will remove the specified transmit request form the indirect transmission queue + */ +GP_API void gpMacDispatcher_PurgeRequest(gpPd_Handle_t pdHandle, gpMacCore_StackId_t stackId); + +/** @ingroup MANAGEMENT + * @brief This function is used to send an orphan response command packet. + */ +GP_API void gpMacDispatcher_OrphanResponse(MACAddress_t* pOrphanAddress, UInt16 shortAddress, Bool associatedMember, gpMacCore_StackId_t stackId); + +/** @brief This function is used to enable beacon transmission +*/ +GP_API gpMacCore_Result_t gpMacDispatcher_Start(gpMacCore_PanId_t panId, UInt8 logicalChannel, Bool panCoordinator, UInt8 stackId); + +// getters and setters +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCurrentChannel(UInt8 channel, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMultipleChannelTable(UInt8* pChannel, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetCurrentChannel(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetDefaultTransmitPowers(Int8* pDefaultTransmitPowerTable); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetTransmitPower(gpMacCore_TxPower_t transmitPower, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Int8 gpMacDispatcher_GetTransmitPower(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCCAMode(UInt8 cCAMode, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetCCAMode(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress , gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCoordShortAddress(UInt16 addr, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetCoordShortAddress(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPanCoordinator(Bool panCoordinator, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetPanCoordinator(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetDsn(UInt8 dsn, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetDsn(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMaxCsmaBackoffs(UInt8 maxCsmaBackoffs, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetMaxCsmaBackoffs(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMinBE(UInt8 minBE, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetMinBE(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMaxBE(UInt8 maxBE, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetMaxBE(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetCsmaMode(UInt8 csmaMode, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetCsmaMode(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPanId(UInt16 panId, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetPanId(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetRxOnWhenIdle(Bool rxOnWhenIdle, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetRxOnWhenIdle(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetShortAddress(UInt16 shortAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetShortAddress(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetAssociationPermit(Bool associationPermit, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetAssociationPermit(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetBeaconPayload(UInt8* pBeaconPayload, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetBeaconPayload(UInt8* pBeaconPayload, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetBeaconPayloadLength(UInt8 length, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetBeaconPayloadLength(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPromiscuousMode(UInt8 promiscuousMode, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetPromiscuousMode(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetTransactionPersistenceTime(UInt16 time, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetTransactionPersistenceTime(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetExtendedAddress(MACAddress_t* pExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetExtendedAddress(MACAddress_t* pExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetNumberOfRetries(UInt8 numberOfRetries, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetNumberOfRetries(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetSecurityEnabled(Bool securityEnabled, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetSecurityEnabled(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetBeaconStarted(Bool BeaconStarted, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetBeaconStarted(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetTxAntenna(UInt8 txAntenna, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt8 gpMacDispatcher_GetTxAntenna(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetIndicateBeaconNotifications(Bool enable, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetIndicateBeaconNotifications(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetForwardPollIndications(Bool enable, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_GetForwardPollIndications(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetLqiThresholdForTest(UInt8 lqiThreshold, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetAddressModeOverrideForBeacons(UInt8 addressMode, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetMacVersion(gpMacCore_MacVersion_t macVersion , gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_MacVersion_t gpMacDispatcher_GetMacVersion(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_DataPending_QueueAdd(gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId) ; +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_DataPending_QueueRemove(gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId) ; +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_DataPending_QueueClear(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_AddNeighbour (gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API Bool gpMacDispatcher_RemoveNeighbour(gpMacCore_AddressInfo_t *pAddrInfo, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_ClearNeighbours(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_SetDataPendingMode(gpMacCore_DataPendingMode_t dataPendingMode, gpMacCore_StackId_t stackId); + +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetFrameCounter(UInt32 frameCounter, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt32 gpMacDispatcher_GetFrameCounter(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_SetKeyDescriptor(gpMacCore_KeyDescriptor_t *pKeyDescriptor, gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_GetKeyDescriptor(gpMacCore_KeyDescriptor_t *pKeyDescriptor, gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetKeyTableEntries(gpMacCore_KeyTablesEntries_t keyTableEntries, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_KeyTablesEntries_t gpMacDispatcher_GetKeyTableEntries(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_SetDeviceDescriptor(gpMacCore_DeviceDescriptor_t *pDeviceDescriptor, gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_GetDeviceDescriptor(gpMacCore_DeviceDescriptor_t * pDeviceDescriptor , gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetDeviceTableEntries(gpMacCore_DeviceTablesEntries_t deviceTableEntries, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_DeviceTablesEntries_t gpMacDispatcher_GetDeviceTableEntries(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_SetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_Result_t gpMacDispatcher_GetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t *pSecurityLevelDescriptor , gpMacCore_Index_t index, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API gpMacCore_SecurityLevelTableEntries_t gpMacDispatcher_GetSecurityLevelTableEntries(gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetSecurityLevelTableEntries(gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetDefaultKeySource(UInt8 *pDefaultKeySource, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetDefaultKeySource(UInt8 *pDefaultKeySource, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPanCoordExtendedAddress(MACAddress_t *pPanCoordExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_GetPanCoordExtendedAddress(MACAddress_t *pPanCoordExtendedAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API void gpMacDispatcher_SetPanCoordShortAddress(UInt16 PanCoordShortAddress, gpMacCore_StackId_t stackId); +/** @ingroup ATTRIBUTE + * @brief Access method for the corresponding PIB attribute + */ +GP_API UInt16 gpMacDispatcher_GetPanCoordShortAddress(gpMacCore_StackId_t stackId); + +/** @brief Set Regional Domain Settings (RDS) for the specified stack. + * + * The RDS values consist of a list of blocked channels and a table of maximum power levels for non-blocked channels. + * Any attempt to transmit/listen on a blocked channel will fail with gpMacCore_ResultInvalidParameter. + * Transmit power levels above maximum will be clipped to the maximum level. + * + * @param blockedChannelMask Bitmask of blocked channels (IEEE numbers). E.g. set bit 11 to block channel 11. + * @param pMaxTransmitPowerTable Pointer to 16-byte table of maximum power levels for channels 11 .. 26. + * @param stackId Apply RDS values to the specified stack. Each stack maintains separate RDS values. + */ +GP_API void gpMacDispatcher_SetRegionalDomainSettings(UInt32 blockedChannelMask, gpMacCore_TxPower_t* pMaxTransmitPowerTable, gpMacDispatcher_StackId_t stackId); + +/** @brief Get Regional Domain Settings (RDS) for the specified stack. + * + * The RDS values consist of a list of blocked channels and a table of maximum power levels for non-blocked channels. + * + * @param pBlockedChannelMask Bitmask of blocked channels (IEEE numbers). E.g. set bit 11 to block channel 11. + * @param pMaxTransmitPowerTable Pointer to 16-byte table of maximum power levels for channels 11 .. 26. + * @param stackId Get RDS values from the specified stack. Each stack maintains separate RDS values. + */ +GP_API void gpMacDispatcher_GetRegionalDomainSettings(UInt32* pBlockedChannelMask, gpMacCore_TxPower_t* pMaxTransmitPowerTable, gpMacDispatcher_StackId_t stackId); + +/** @ingroup ATTRIBUTE + * + * @brief Enable or disable automatic toggling of TX antenna after transmission failure. + * + * @param enable True to enable auto-toggling, false to disable. + * @param stackId Stack identifier. + */ + +/** @brief This function enables the Enhanced FramePending behavior for a specific stack. + * + * @param enableEnhancedFramePending Enables or disables the Enhanced FramePending behavior for a specific stack. +*/ +void gpMacDispatcher_EnableEnhancedFramePending(Bool enableEnhancedFramePending, gpMacCore_StackId_t stackId); + +/** @brief This function enables the raw mode of the stack. + * + * This mode allows the upper stack to create the MAC header while transmitting a packets, + * and to stop the MacCore from processing MAC headers, and instead passing them to the upper stack. + * + * @param rawModeEnabled Enables or disables the raw mode for a specific stack. +*/ +void gpMacDispatcher_SetStackInRawMode(Bool rawModeEnabled, gpMacCore_StackId_t stackId); + +/** @brief This function returns if the raw mode is enabled for a specific stack. + * + * @return rawModeEnabled Indicates if raw mode is enabled or disabled for a specific stack. +*/ +Bool gpMacDispatcher_GetStackInRawMode(gpMacCore_StackId_t stackId); + +/** @brief This function sets the encryption key and keyIndex to be used for the Tread raw encryption. + * + * @param encryptionKeyIdMode Key ID mode. Only mode '1' is supported for Thread raw encryption. + * @param encryptionKeyId Current key index. + * @param pCurrKey Current key. + * @param stackId Stack identifier. +*/ +void gpMacDispatcher_SetRawModeEncryptionKeys(gpMacCore_KeyIdMode_t encryptionKeyIdMode, gpMacCore_KeyIndex_t encryptionKeyId, UInt8* pCurrKey, gpMacCore_StackId_t stackId); + + +/** @brief This function sets the fields used in the Nonce for the Thread raw encryption. + * + * @param frameCounter Initial value of the frame pointer. Will be auto-incremented by the lower layers. + * @param pExtendedAddress Pointer to the local(source) extended address. + * @param seclevel Security Level. Needs to be '5' for Thread raw encryption. + * @param stackId Stack identifier. +*/ +void gpMacDispatcher_SetRawModeNonceFields(UInt32 frameCounter, MACAddress_t* pExtendedAddress , UInt8 seclevel, gpMacCore_StackId_t stackId); + +/** @brief This function configures the insertion of a VS IE header in the Enh Ack frames containing probing data. + * + * @param linkMetrics Bitmask of link metrics which should be reported. + * @param pExtendedAddress The extended address of the probing initiator. + * @param shortAddress The short address of the probing initiator. + * @param stackId The stack id. + * @return result Success if the parameter are accepted, InvalidParameters otherwise. +*/ +gpMacCore_Result_t gpMacDispatcher_ConfigureEnhAckProbing(UInt8 linkMetrics, MACAddress_t* pExtendedAddress , UInt16 shortAddress, gpMacCore_StackId_t stackId); + + +#define gpMacDispatcher_SetAutoTxAntennaToggling(Bool, gpMacDispatcher_StackId_t) +/** @ingroup ATTRIBUTE + * + * @brief Return the current state of automatic toggling of TX antenna. + * + * @param stackId Stack identifier. + * @return true when enabled, false when disabled. + */ +GP_API Bool gpMacDispatcher_GetAutoTxAntennaToggling(gpMacDispatcher_StackId_t stackId); + +/** @brief Enables Duty Cycled Rx window + * + * Enable a duty cycled Rx window + * + * @param dutyCycleOnTime The amount of time the radio will be on and in receive mode (in us) + * @param dutyCyclePeriod Period of the Rx Window (in us) + * @param recurrenceAmount Number of occurances that needs to be scheduled + * @param startTime Absolute start time (in us) of the rx windows + * @param stackId Stack id. +*/ +GP_API void gpMacDispatcher_EnableRxWindows(UInt32 dutyCycleOnTime, UInt32 dutyCyclePeriod, UInt16 recurrenceAmount, UInt32 startTime, gpMacDispatcher_StackId_t stackId); + +/** @brief Disables Duty Cycled Rx Windows + * + * Disable a periodic Rx window + * + * @param stackId The stack id for which the rx windows will be disabled. +*/ +GP_API void gpMacDispatcher_DisableRxWindows(gpMacDispatcher_StackId_t stackId); + +/** @brief Enables CSL IE insertion in Enhanced Acks + * + * Enables CSL IE insertion in Enhanced Acks + * + * @param dutyCyclePeriod The period in multiples of 160us that needs to be inserterd in the CSL IE. + * @param stackId The stackId +*/ +GP_API void gpMacDispatcher_EnableCsl(UInt16 dutyCyclePeriod, gpMacCore_StackId_t stackId); + +/** @brief Update the CSL samples time + * + * Update the CSL samples time at which the next Rx window should occur. + * This will be used in the phase calculation for the CSL IE. + * + * @param nextCslSampleTime The next CSL sample time in us (the rx window start without extra margin) + * @param stackId The stackId +*/ +GP_API void gpMacDispatcher_UpdateCslSampleTime(UInt32 nextCslSampleTime, gpMacCore_StackId_t stackId); + +/** @brief Get the current time + * + * Retrieves the current local time on the chip. + * + * @return time the current local time on chip in us. +*/ +GP_API UInt32 gpMacDispatcher_GetCurrentTimeUs(void); + +/** @brief Enables or disables the Retransmits on CCA failures. + * + * This function enables or disables the Retransmits on CCA failures. The actual amount of retransmits + * is set through gpMacDispatcher_SetNumberOfRetries. As such this function only changes the + * default MAC 802.15.4-2015 behavior to also retransmit on a CCA fail. + * + * @param enable Enables or disables the Retransmits. + * @param stackId The identifier of the stack doing this +*/ +GP_API void gpMacDispatcher_SetRetransmitOnCcaFail(Bool enable, gpMacCore_StackId_t stackId); + +/** @brief returns if the feature "Retransmits on CCA fail" is enabled for a stackId. + * + * This function returns if the feature "Retransmits on CCA fail" is enabled for a stackId. + * + * @param stackId The identifier of the stack doing this +*/ +GP_API Bool gpMacDispatcher_GetRetransmitOnCcaFail(gpMacCore_StackId_t stackId); + +/** @brief Enables or disables the random delays between subsequent retransmits. + * + * This function enables or disables the random delays between subsequent retransmits. + * The actual amount of retransmits is set through gpMacDispatcher_SetNumberOfRetries. As such this + * function only changes the default MAC 802.15.4-2015 behavior to add random delays between retransmits. + * + * @param enable Enables or disables the random delays between subsequent retransmits. + * @param stackId The identifier of the stack doing this +*/ +GP_API void gpMacDispatcher_SetRetransmitRandomBackoff(Bool enable, gpMacCore_StackId_t stackId); + +/** @brief returns if the feature "random delays between subsequent retransmits" is enabled for a stackId. + * + * This function returns if the feature "random delays between subsequent retransmits" is enabled for a stackId. + * + * @param stackId The identifier of the stack doing this +*/ +GP_API Bool gpMacDispatcher_GetRetransmitRandomBackoff(gpMacCore_StackId_t stackId); + +/** @brief This function configures the minimum backoff exponent for random delays between retransmits. + * + * This function configures the minimum backoff exponent for random delays between retransmits. + * Not to be confused with the backoff exponent for random delays between CCA failures! + * + * @param minBERetransmit The minimum backoff exponent. + * @param stackId The identifier of the stack +*/ +GP_API void gpMacDispatcher_SetMinBeRetransmit(UInt8 minBERetransmit, gpMacCore_StackId_t stackId); + +/** @brief This function returns the minimum backoff exponent for random delays between retransmits. + * + * This function returns the minimum backoff exponent for random delays between retransmits. + * + * @param stackId The identifier of the stack +*/ +GP_API UInt8 gpMacDispatcher_GetMinBeRetransmit(gpMacCore_StackId_t stackId); + +/** @brief This function configures the maximum backoff exponent for random delays between retransmits. + * + * This function configures the maximum backoff exponent for random delays between retransmits. + * Not to be confused with the backoff exponent for random delays between CCA failures! + * + * @param maxBERetransmit The maximum backoff exponent. + * @param stackId The identifier of the stack +*/ +GP_API void gpMacDispatcher_SetMaxBeRetransmit(UInt8 maxBERetransmit, gpMacCore_StackId_t stackId); + +/** @brief This function returns the maximum backoff exponent for random delays between retransmits. + * + * This function returns the maximum backoff exponent for random delays between retransmits. + * + * @param stackId The identifier of the stack +*/ +GP_API UInt8 gpMacDispatcher_GetMaxBeRetransmit(gpMacCore_StackId_t stackId); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif // _GP_MACDISPATCHER_MULTISTACK_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c new file mode 100644 index 0000000..7f2d820 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling.c @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacDispatcher_marshalling.c" + * + * MAC Dispatcher + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpMacDispatcher.h" +#include "gpMacDispatcher_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACDISPATCHER + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpMacDispatcher_StringIdentifier_t_buf2api(gpMacDispatcher_StringIdentifier_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_buf2api((pDest->str), pSource, 5, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacDispatcher_StringIdentifier_t_api2buf(UInt8Buffer* pDest , const gpMacDispatcher_StringIdentifier_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + UInt8_api2buf(pDest , (pSource->str), 5, pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpMacDispatcher_Callbacks_t_buf2api(gpMacDispatcher_Callbacks_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacDispatcher_cbDataIndication_t_buf2api_1(&(pDest->dataIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbDataConfirm_t_buf2api_1(&(pDest->dataConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbPollIndication_t_buf2api_1(&(pDest->pollIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbPollConfirm_t_buf2api_1(&(pDest->pollConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbPurgeConfirm_t_buf2api_1(&(pDest->purgeConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbBeaconNotifyIndication_t_buf2api_1(&(pDest->beaconNotifyIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbScanConfirm_t_buf2api_1(&(pDest->scanConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbAssociateIndication_t_buf2api_1(&(pDest->assocIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbAssocConfirm_t_buf2api_1(&(pDest->assocConfirmCallback), pSource, pIndex); + gpMacDispatcher_cbOrphanIndication_t_buf2api_1(&(pDest->orphanIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_buf2api_1(&(pDest->securityFailureCommStatusIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbAssociateCommStatusIndication_t_buf2api_1(&(pDest->associateCommStatusIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbOrphanCommStatusIndication_t_buf2api_1(&(pDest->orphanCommStatusIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbDriverResetIndication_t_buf2api_1(&(pDest->driverResetIndicationCallback), pSource, pIndex); + gpMacDispatcher_cbPollNotify_t_buf2api_1(&(pDest->pollNotifyCallback), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpMacDispatcher_Callbacks_t_api2buf(UInt8Buffer* pDest , const gpMacDispatcher_Callbacks_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpMacDispatcher_cbDataIndication_t_api2buf_1(pDest , &(pSource->dataIndicationCallback), pIndex); + gpMacDispatcher_cbDataConfirm_t_api2buf_1(pDest , &(pSource->dataConfirmCallback), pIndex); + gpMacDispatcher_cbPollIndication_t_api2buf_1(pDest , &(pSource->pollIndicationCallback), pIndex); + gpMacDispatcher_cbPollConfirm_t_api2buf_1(pDest , &(pSource->pollConfirmCallback), pIndex); + gpMacDispatcher_cbPurgeConfirm_t_api2buf_1(pDest , &(pSource->purgeConfirmCallback), pIndex); + gpMacDispatcher_cbBeaconNotifyIndication_t_api2buf_1(pDest , &(pSource->beaconNotifyIndicationCallback), pIndex); + gpMacDispatcher_cbScanConfirm_t_api2buf_1(pDest , &(pSource->scanConfirmCallback), pIndex); + gpMacDispatcher_cbAssociateIndication_t_api2buf_1(pDest , &(pSource->assocIndicationCallback), pIndex); + gpMacDispatcher_cbAssocConfirm_t_api2buf_1(pDest , &(pSource->assocConfirmCallback), pIndex); + gpMacDispatcher_cbOrphanIndication_t_api2buf_1(pDest , &(pSource->orphanIndicationCallback), pIndex); + gpMacDispatcher_cbSecurityFailureCommStatusIndication_t_api2buf_1(pDest , &(pSource->securityFailureCommStatusIndicationCallback), pIndex); + gpMacDispatcher_cbAssociateCommStatusIndication_t_api2buf_1(pDest , &(pSource->associateCommStatusIndicationCallback), pIndex); + gpMacDispatcher_cbOrphanCommStatusIndication_t_api2buf_1(pDest , &(pSource->orphanCommStatusIndicationCallback), pIndex); + gpMacDispatcher_cbDriverResetIndication_t_api2buf_1(pDest , &(pSource->driverResetIndicationCallback), pIndex); + gpMacDispatcher_cbPollNotify_t_api2buf_1(pDest , &(pSource->pollNotifyCallback), pIndex); + pSource++; + } +} + + +void gpMacDispatcher_InitMarshalling(void) +{ +} + + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c new file mode 100644 index 0000000..437341e --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_marshalling_client.c @@ -0,0 +1,1902 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacDispatcher_marshalling_client.c" + * + * MAC Dispatcher + * + * Marshalling structures and functions +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpMacDispatcher.h" +#include "gpMacDispatcher_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACDISPATCHER + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpMacDispatcher_RegisterNetworkStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StringIdentifier_t* stringIdentifier , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == stringIdentifier); + if (NULL != stringIdentifier) + { + gpMacDispatcher_StringIdentifier_t_api2buf(pDest, stringIdentifier, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (5)); + (*pIndex) += (5); + } + } +} + +void gpMacDispatcher_RegisterNetworkStack_Output_buf2par(gpMacDispatcher_StackId_t* stackId , gpMacDispatcher_StringIdentifier_t* stringIdentifier , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_buf2api(stackId, pSource, 1, pIndex); + NOT_USED(stringIdentifier); +} + +void gpMacDispatcher_UnRegisterNetworkStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_UnRegisterNetworkStack_Output_buf2par(gpMacCore_Result_t* result , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_LockClaim_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_LockClaim_Output_buf2par(Bool* result , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_LockRelease_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_LockedByThisStack_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_LockedByThisStack_Output_buf2par(Bool* locked , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(locked, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_Locked_Output_buf2par(Bool* locked , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(locked, pSource, 1, pIndex); +} + +void gpMacDispatcher_Reset_Input_par2buf(UInt8Buffer* pDest , Bool setDefaultPib , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(setDefaultPib), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_Reset_Output_buf2par(gpMacDispatcher_Result_t* result , Bool setDefaultPib , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacDispatcher_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(setDefaultPib); + NOT_USED(stackId); +} + +void gpMacDispatcher_DataRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressMode_t srcAddrMode , gpMacCore_AddressInfo_t* pDstAddressInfo , UInt8 txOptions , gpMacCore_Security_t* pSecOptions , gpMacCore_MultiChannelOptions_t multiChannelOptions , gpPd_Loh_t pdLoh , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_AddressMode_t_api2buf_1(pDest, &(srcAddrMode), pIndex); + pDest[(*pIndex)++] = (NULL == pDstAddressInfo); + if (NULL != pDstAddressInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pDstAddressInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + UInt8_api2buf_1(pDest, &(txOptions), pIndex); + pDest[(*pIndex)++] = (NULL == pSecOptions); + if (NULL != pSecOptions) + { + gpMacCore_Security_t_api2buf(pDest, pSecOptions, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (1 + 1 + max(4,8) + 1)); + (*pIndex) += (1 + 1 + max(4,8) + 1); + } + } + gpMacCore_MultiChannelOptions_t_api2buf(pDest, &(multiChannelOptions), 1, pIndex); + gpPd_Loh_t_api2buf(pDest, &(pdLoh), 1, pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_ScanRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_ScanType_t scanType , UInt32 scanChannels , UInt8 scanDuration , UInt8 resultListSize , UInt8* pResultList , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_ScanType_t_api2buf_1(pDest, &(scanType), pIndex); + UInt32_api2buf_1(pDest, &(scanChannels), pIndex); + UInt8_api2buf_1(pDest, &(scanDuration), pIndex); + UInt8_api2buf_1(pDest, &(resultListSize), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_AssociateRequest_Input_par2buf(UInt8Buffer* pDest , UInt8 logicalChannel , gpMacCore_AddressInfo_t* coordAddrInfo , UInt8 capabilityInformation , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(logicalChannel), pIndex); + pDest[(*pIndex)++] = (NULL == coordAddrInfo); + if (NULL != coordAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, coordAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + UInt8_api2buf_1(pDest, &(capabilityInformation), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_AssociateResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pDeviceAddress , UInt16 associateShortAddress , gpMacCore_Result_t status , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pDeviceAddress); + if (NULL != pDeviceAddress) + { + MACAddress_t_api2buf_1(pDest, pDeviceAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + UInt16_api2buf_1(pDest, &(associateShortAddress), pIndex); + gpMacCore_Result_t_api2buf_1(pDest, &(status), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_PollRequest_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* coordAddrInfo , gpMacCore_Security_t* pSecOptions , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == coordAddrInfo); + if (NULL != coordAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, coordAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } +/* SpecialInputpar2bufParameterHandling_gpMacDispatcher_PollRequest_pSecOptions */ + pDest[(*pIndex)++] = (NULL == pSecOptions); + + if (NULL != pSecOptions) + { + gpMacCore_Security_t_api2buf(pDest, pSecOptions, 1, pIndex); + } + else + { + gpMacCore_Security_t dummy = {0}; + gpMacCore_Security_t_api2buf(pDest, &dummy, 1, pIndex); + } +/* SpecialInputpar2bufParameterHandling_gpMacDispatcher_PollRequest_pSecOptions */ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_PurgeRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ +#ifdef GP_COMP_UNIT_TEST + pDest[(*pIndex)++] = gpPd_GetUtPd(pdHandle); +#else + pDest[(*pIndex)++] = pdHandle; +#endif + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_Start_Input_par2buf(UInt8Buffer* pDest , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , UInt8 stackId , UInt16* pIndex) +{ + gpMacCore_PanId_t_api2buf_1(pDest, &(panId), pIndex); + UInt8_api2buf_1(pDest, &(logicalChannel), pIndex); + Bool_api2buf_1(pDest, &(panCoordinator), pIndex); + UInt8_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_Start_Output_buf2par(gpMacCore_Result_t* returnValue , gpMacCore_PanId_t panId , UInt8 logicalChannel , Bool panCoordinator , UInt8 stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(returnValue, pSource, 1, pIndex); + NOT_USED(panId); + NOT_USED(logicalChannel); + NOT_USED(panCoordinator); + NOT_USED(stackId); +} + +void gpMacDispatcher_OrphanResponse_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pOrphanAddress , UInt16 shortAddress , Bool associatedMember , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pOrphanAddress); + if (NULL != pOrphanAddress) + { + MACAddress_t_api2buf_1(pDest, pOrphanAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + UInt16_api2buf_1(pDest, &(shortAddress), pIndex); + Bool_api2buf_1(pDest, &(associatedMember), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetPanId_Input_par2buf(UInt8Buffer* pDest , UInt16 panId , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(panId), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanId_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanId_Output_buf2par(gpMacCore_PanId_t* panId , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_PanId_t_buf2api(panId, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(shortAddress), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetShortAddress_Output_buf2par(UInt16* address , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt16_buf2api(address, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pExtendedAddress); + if (NULL != pExtendedAddress) + { + MACAddress_t_api2buf_1(pDest, pExtendedAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetExtendedAddress_Output_buf2par(MACAddress_t* pExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + MACAddress_t_buf2api(pExtendedAddress, pSource, 1, pIndex); + } + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDsn_Input_par2buf(UInt8Buffer* pDest , UInt8 dsn , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(dsn), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDsn_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDsn_Output_buf2par(UInt8* dsn , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(dsn, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(channel), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCurrentChannel_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCurrentChannel_Output_buf2par(UInt8* channel , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(channel, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pBeaconPayload); + if (NULL != pBeaconPayload) + { + UInt8_api2buf(pDest, pBeaconPayload, GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH); + (*pIndex) += GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconPayload_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconPayload_Output_buf2par(UInt8* pBeaconPayload , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ +/* SpecialOutputbuf2parParameterHandling_gpMacDispatcher_GetBeaconPayload_pBeaconPayload */ + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + // Needs a variable because otherwise gpMacDispatcher_GetBeaconPayloadLength() gets called twice (see definition of UInt8_buf2api()) + UInt8 length = gpMacDispatcher_GetBeaconPayloadLength(stackId); + UInt8_buf2api( pBeaconPayload, pSource, length, pIndex); + } +/* SpecialOutputbuf2parParameterHandling_gpMacDispatcher_GetBeaconPayload_pBeaconPayload */ + NOT_USED(stackId); +} + +void gpMacDispatcher_SetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , UInt8 beaconPayloadLength , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(beaconPayloadLength), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconPayloadLength_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconPayloadLength_Output_buf2par(UInt8* beaconPayloadLength , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(beaconPayloadLength, pSource, 1, pIndex); + NOT_USED(stackId); +} + + + + +void gpMacDispatcher_SetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , Bool rxOnWhenIdle , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(rxOnWhenIdle), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRxOnWhenIdle_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRxOnWhenIdle_Output_buf2par(Bool* rxOnWhenIdle , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(rxOnWhenIdle, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_GetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetTransactionPersistenceTime_Output_buf2par(UInt16* time , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt16_buf2api(time, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetTransactionPersistenceTime_Input_par2buf(UInt8Buffer* pDest , UInt16 time , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(time), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , Bool beaconStarted , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(beaconStarted), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconStarted_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetBeaconStarted_Output_buf2par(Bool* beaconStarted , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(beaconStarted, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 coordShortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(coordShortAddress), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCoordShortAddress_Output_buf2par(UInt16* coordShortAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt16_buf2api(coordShortAddress, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pCoordExtendedAddress); + if (NULL != pCoordExtendedAddress) + { + MACAddress_t_api2buf_1(pDest, pCoordExtendedAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCoordExtendedAddress_Output_buf2par(MACAddress_t* pCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + MACAddress_t_buf2api(pCoordExtendedAddress, pSource, 1, pIndex); + } + NOT_USED(stackId); +} + +void gpMacDispatcher_SetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , UInt8 promiscuousMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(promiscuousMode), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPromiscuousMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPromiscuousMode_Output_buf2par(Bool* promiscuousMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(promiscuousMode, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , Bool associationPermit , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(associationPermit), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetAssociationPermit_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetAssociationPermit_Output_buf2par(Bool* associationPermit , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(associationPermit, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , Bool securityEnabled , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(securityEnabled), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityEnabled_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityEnabled_Output_buf2par(Bool* securityEnabled , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(securityEnabled, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , UInt8 numberOfRetries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(numberOfRetries), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetNumberOfRetries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetNumberOfRetries_Output_buf2par(UInt8* numberOfRetries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(numberOfRetries, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , UInt8 maxCsmaBackoffs , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(maxCsmaBackoffs), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxCsmaBackoffs_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxCsmaBackoffs_Output_buf2par(UInt8* maxCsmaBackoffs , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(maxCsmaBackoffs, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDefaultTransmitPowers_Input_par2buf(UInt8Buffer* pDest , Int8* pDefaultTransmitPowerTable , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pDefaultTransmitPowerTable); + if (NULL != pDefaultTransmitPowerTable) + { + Int8_api2buf(pDest, pDefaultTransmitPowerTable, 16, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 16); + (*pIndex) += 16; + } + } +} + +void gpMacDispatcher_SetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacCore_TxPower_t transmitPower , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_TxPower_t_api2buf_1(pDest, &(transmitPower), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetTransmitPower_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetTransmitPower_Output_buf2par(Int8* transmitPower , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Int8_buf2api(transmitPower, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetCCAMode_Input_par2buf(UInt8Buffer* pDest , UInt8 cCAMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(cCAMode), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCCAMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCCAMode_Output_buf2par(UInt8* cCAMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(cCAMode, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , Bool panCoordinator , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(panCoordinator), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanCoordinator_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanCoordinator_Output_buf2par(Bool* panCoordinator , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(panCoordinator, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMinBE_Input_par2buf(UInt8Buffer* pDest , UInt8 minBE , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(minBE), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMinBE_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMinBE_Output_buf2par(UInt8* minBE , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(minBE, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetIndicateBeaconNotifications_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetIndicateBeaconNotifications_Output_buf2par(Bool* enable , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacCore_MacVersion_t macVersion , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_MacVersion_t_api2buf_1(pDest, &(macVersion), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMacVersion_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMacVersion_Output_buf2par(gpMacCore_MacVersion_t* macVersion , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_MacVersion_t_buf2api(macVersion, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetForwardPollIndications_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetForwardPollIndications_Output_buf2par(Bool* enable , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_DataPending_QueueAdd_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pAddrInfo); + if (NULL != pAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_DataPending_QueueAdd_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pAddrInfo); + NOT_USED(stackId); +} + +void gpMacDispatcher_DataPending_QueueRemove_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pAddrInfo); + if (NULL != pAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_DataPending_QueueRemove_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pAddrInfo); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMinInterferenceLevels_Input_par2buf(UInt8Buffer* pDest , Int8* pInterferenceLevels , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pInterferenceLevels); + if (NULL != pInterferenceLevels) + { + Int8_api2buf_1(pDest, pInterferenceLevels, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 1); + (*pIndex) += 1; + } + } +} + +void gpMacDispatcher_SetMaxBE_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBE , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(maxBE), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxBE_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxBE_Output_buf2par(UInt8* maxBE , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(maxBE, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pDeviceDescriptor); + if (NULL != pDeviceDescriptor) + { + gpMacCore_DeviceDescriptor_t_api2buf(pDest, pDeviceDescriptor, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (2*1 + 2*1 + 8*1 + 4*1 + 1)); + (*pIndex) += (2*1 + 2*1 + 8*1 + 4*1 + 1); + } + } + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pDeviceDescriptor); + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_GetDeviceDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDeviceDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DeviceDescriptor_t* pDeviceDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_DeviceDescriptor_t_buf2api(pDeviceDescriptor , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DeviceTablesEntries_t deviceTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_DeviceTablesEntries_t_api2buf_1(pDest, &(deviceTableEntries), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDeviceTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetDeviceTableEntries_Output_buf2par(gpMacCore_DeviceTablesEntries_t* deviceTableEntries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_DeviceTablesEntries_t_buf2api(deviceTableEntries, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pKeyDescriptor); + if (NULL != pKeyDescriptor) + { + gpMacCore_KeyDescriptor_t_api2buf(pDest, pKeyDescriptor, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS*(9 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS*((2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS*(1 + 1) + 1 + 16)); + (*pIndex) += (GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS*(9 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS*((2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS*(1 + 1) + 1 + 16); + } + } + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pKeyDescriptor); + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_GetKeyDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetKeyDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_KeyDescriptor_t* pKeyDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_KeyDescriptor_t_buf2api(pKeyDescriptor , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetKeyTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyTablesEntries_t keyTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_KeyTablesEntries_t_api2buf_1(pDest, &(keyTableEntries), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pSecurityLevelDescriptor); + if (NULL != pSecurityLevelDescriptor) + { + gpMacCore_SecurityLevelDescriptor_t_api2buf(pDest, pSecurityLevelDescriptor, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (1 + 1 + 1 + 1)); + (*pIndex) += (1 + 1 + 1 + 1); + } + } + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pSecurityLevelDescriptor); + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_GetSecurityLevelDescriptor_Input_par2buf(UInt8Buffer* pDest , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_Index_t_api2buf_1(pDest, &(index), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityLevelDescriptor_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor , gpMacCore_Index_t index , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_SecurityLevelDescriptor_t_buf2api(pSecurityLevelDescriptor , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } + NOT_USED(index); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_SecurityLevelTableEntries_t_api2buf_1(pDest, &(securityLevelTableEntries), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityLevelTableEntries_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetSecurityLevelTableEntries_Output_buf2par(gpMacCore_SecurityLevelTableEntries_t* securityLevelTableEntries , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_SecurityLevelTableEntries_t_buf2api(securityLevelTableEntries, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDefaultKeySource_Input_par2buf(UInt8Buffer* pDest , UInt8* pDefaultKeySource , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pDefaultKeySource); + if (NULL != pDefaultKeySource) + { + UInt8_api2buf(pDest, pDefaultKeySource, 8, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8); + (*pIndex) += 8; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetFrameCounter_Input_par2buf(UInt8Buffer* pDest , UInt32 frameCounter , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt32_api2buf_1(pDest, &(frameCounter), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetFrameCounter_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetFrameCounter_Output_buf2par(UInt32* frameCounter , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt32_buf2api(frameCounter, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetPanCoordShortAddress_Input_par2buf(UInt8Buffer* pDest , UInt16 panCoordShortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(panCoordShortAddress), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , MACAddress_t* pPanCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pPanCoordExtendedAddress); + if (NULL != pPanCoordExtendedAddress) + { + MACAddress_t_api2buf_1(pDest, pPanCoordExtendedAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanCoordExtendedAddress_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetPanCoordExtendedAddress_Output_buf2par(MACAddress_t* pPanCoordExtendedAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + MACAddress_t_buf2api(pPanCoordExtendedAddress, pSource, 1, pIndex); + } + NOT_USED(stackId); +} + +void gpMacDispatcher_AddNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pAddrInfo); + if (NULL != pAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_AddNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(pAddrInfo); + NOT_USED(stackId); +} + +void gpMacDispatcher_RemoveNeighbour_Input_par2buf(UInt8Buffer* pDest , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + pDest[(*pIndex)++] = (NULL == pAddrInfo); + if (NULL != pAddrInfo) + { + gpMacCore_AddressInfo_t_api2buf(pDest, pAddrInfo, 1, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , (max(2*1,8*1) + 2*1 + 1)); + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_RemoveNeighbour_Output_buf2par(Bool* result , gpMacCore_AddressInfo_t* pAddrInfo , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(pAddrInfo); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetDataPendingMode_Input_par2buf(UInt8Buffer* pDest , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_DataPendingMode_t_api2buf_1(pDest, &(dataPendingMode), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetDataPendingMode_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_DataPendingMode_t dataPendingMode , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(dataPendingMode); + NOT_USED(stackId); +} + + +void gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_par2buf(UInt8Buffer* pDest , UInt8 addressMode , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(addressMode), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_ClearNeighbours_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetCsmaMode_Input_par2buf(UInt8Buffer* pDest , UInt8 csmaMode , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(csmaMode), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCsmaMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCsmaMode_Output_buf2par(UInt8* csmaMode , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(csmaMode, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_DataPending_QueueClear_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_DataPending_QueueClear_Output_buf2par(gpMacCore_Result_t* result , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_ScheduleTimedTx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpMacCore_TxTimingOptions_t timingOptions , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ +#ifdef GP_COMP_UNIT_TEST + pDest[(*pIndex)++] = gpPd_GetUtPd(pdHandle); +#else + pDest[(*pIndex)++] = pdHandle; +#endif + gpMacCore_TxTimingOptions_t_api2buf(pDest, &(timingOptions), 1, pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_ScheduleTimedTx_Output_buf2par(gpMacCore_Result_t* result , gpPd_Handle_t pdHandle , gpMacCore_TxTimingOptions_t timingOptions , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(pdHandle); + NOT_USED(timingOptions); + NOT_USED(stackId); +} + + + + + + + + +void gpMacDispatcher_SetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , Bool rawModeEnabled , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(rawModeEnabled), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetStackInRawMode_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetStackInRawMode_Output_buf2par(Bool* rawModeEnabled , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(rawModeEnabled, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetRawModeEncryptionKeys_Input_par2buf(UInt8Buffer* pDest , gpMacCore_KeyIdMode_t encryptionKeyIdMode , gpMacCore_KeyIndex_t encryptionKeyId , UInt8* pCurrKey , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_KeyIdMode_t_api2buf_1(pDest, &(encryptionKeyIdMode), pIndex); + gpMacCore_KeyIndex_t_api2buf_1(pDest, &(encryptionKeyId), pIndex); + pDest[(*pIndex)++] = (NULL == pCurrKey); + if (NULL != pCurrKey) + { + UInt8_api2buf(pDest, pCurrKey, 16, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 16); + (*pIndex) += 16; + } + } + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_SetRawModeNonceFields_Input_par2buf(UInt8Buffer* pDest , UInt32 frameCounter , MACAddress_t* pExtendedAddress , UInt8 seclevel , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt32_api2buf_1(pDest, &(frameCounter), pIndex); + pDest[(*pIndex)++] = (NULL == pExtendedAddress); + if (NULL != pExtendedAddress) + { + MACAddress_t_api2buf_1(pDest, pExtendedAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + UInt8_api2buf_1(pDest, &(seclevel), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_EnableEnhancedFramePending_Input_par2buf(UInt8Buffer* pDest , Bool enableEnhancedFramePending , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enableEnhancedFramePending), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_EnableRxWindows_Input_par2buf(UInt8Buffer* pDest , UInt32 dutyCycleOnTime , UInt32 dutyCyclePeriod , UInt16 recurrenceAmount , UInt32 startTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt32_api2buf_1(pDest, &(dutyCycleOnTime), pIndex); + UInt32_api2buf_1(pDest, &(dutyCyclePeriod), pIndex); + UInt16_api2buf_1(pDest, &(recurrenceAmount), pIndex); + UInt32_api2buf_1(pDest, &(startTime), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_DisableRxWindows_Input_par2buf(UInt8Buffer* pDest , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_EnableCsl_Input_par2buf(UInt8Buffer* pDest , UInt16 dutyCyclePeriod , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt16_api2buf_1(pDest, &(dutyCyclePeriod), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_UpdateCslSampleTime_Input_par2buf(UInt8Buffer* pDest , UInt32 nextCslSampleTime , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt32_api2buf_1(pDest, &(nextCslSampleTime), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetCurrentTimeUs_Output_buf2par(UInt32* currentTime , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt32_buf2api(currentTime, pSource, 1, pIndex); +} + +void gpMacDispatcher_ConfigureEnhAckProbing_Input_par2buf(UInt8Buffer* pDest , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(linkMetrics), pIndex); + pDest[(*pIndex)++] = (NULL == pExtendedAddress); + if (NULL != pExtendedAddress) + { + MACAddress_t_api2buf_1(pDest, pExtendedAddress, pIndex); + } + else + { + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + MEMSET(&(pDest[(*pIndex)]) , 0x00 , 8*1); + (*pIndex) += 8*1; + } + } + UInt16_api2buf_1(pDest, &(shortAddress), pIndex); + gpMacDispatcher_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_ConfigureEnhAckProbing_Output_buf2par(gpMacCore_Result_t* result , UInt8 linkMetrics , MACAddress_t* pExtendedAddress , UInt16 shortAddress , gpMacDispatcher_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(linkMetrics); + NOT_USED(pExtendedAddress); + NOT_USED(shortAddress); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRetransmitOnCcaFail_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRetransmitOnCcaFail_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRetransmitRandomBackoff_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetRetransmitRandomBackoff_Output_buf2par(Bool* enable , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 minBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(minBERetransmit), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMinBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMinBeRetransmit_Output_buf2par(UInt8* minBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(minBERetransmit, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpMacDispatcher_SetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , UInt8 maxBERetransmit , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(maxBERetransmit), pIndex); + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxBeRetransmit_Input_par2buf(UInt8Buffer* pDest , gpMacCore_StackId_t stackId , UInt16* pIndex) +{ + gpMacCore_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpMacDispatcher_GetMaxBeRetransmit_Output_buf2par(UInt8* maxBERetransmit , gpMacCore_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(maxBERetransmit, pSource, 1, pIndex); + NOT_USED(stackId); +} + +gpMarshall_AckStatus_t MacDispatcher_cbDataConfirm_Input_buf2api(MacDispatcher_cbDataConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + + /* server had pdHandle stored */ +#ifdef GP_COMP_UNIT_TEST + pDest->data.pdHandle = gpPd_GetRealPd(pSource[(*pIndex)++]); +#else + pDest->data.pdHandle = pSource[(*pIndex)++]; +#endif + { + gpPd_TimeStamp_t pdtimestamp; + gpPd_TimeStamp_t_buf2api(&pdtimestamp , pSource, 1, pIndex ); + gpPd_SetTxTimestamp(pDest->data.pdHandle , pdtimestamp); + } + { + UInt8 txr; + UInt8_buf2api(&txr , pSource, 1, pIndex ); + gpPd_SetTxRetryCntr(pDest->data.pdHandle , txr); + } + { + UInt8 framepending; + UInt8_buf2api(&framepending , pSource, 1, pIndex ); + gpPd_SetFramePendingAfterTx(pDest->data.pdHandle , framepending); + } + { + Bool enhancedAck; + Bool_buf2api(&enhancedAck , pSource, 1, pIndex ); + gpPd_SetRxEnhancedAckFromTxPbm(pDest->data.pdHandle , enhancedAck); + } + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbDataIndication_Input_buf2api(MacDispatcher_cbDataIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSrcAddrInfo = pDest->pSrcAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pSrcAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSrcAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDstAddrInfo = pDest->pDstAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pDstAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDstAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + UInt8_buf2api(&(pDest->data.dsn), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSecOptions = pDest->pSecOptions.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_Security_t_buf2api(pDest->data.pSecOptions , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSecOptions = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (1 + 1 + max(4,8) + 1); + } + } + { + gpMarshall_AckStatus_t marshall_result = gpPd_Loh_t_buf2api(&(pDest->data.pdLoh), pSource, 1, pIndex , false ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + gpPd_SetLqi(pDest->data.pdLoh.handle , pSource[(*pIndex)++]); + gpPd_SetRssi(pDest->data.pdLoh.handle , pSource[(*pIndex)++]); + { + gpPd_TimeStamp_t pdtimestamp; + gpPd_TimeStamp_t_buf2api(&pdtimestamp , pSource, 1, pIndex ); + gpPd_SetRxTimestamp(pDest->data.pdLoh.handle , pdtimestamp); + } + { + UInt8 rxchannel; + UInt8_buf2api(&rxchannel , pSource, 1, pIndex ); + gpPd_SetRxChannel(pDest->data.pdLoh.handle , rxchannel); + } + { + UInt16 framecontrol; + UInt16_buf2api(&framecontrol , pSource, 1, pIndex ); + gpPd_SetFrameControlFromTxAckAfterRx(pDest->data.pdLoh.handle , framecontrol); + } + + { + UInt32 framecounter; + UInt32_buf2api(&framecounter , pSource, 1, pIndex ); + gpPd_SetFrameCounterFromTxAckAfterRx(pDest->data.pdLoh.handle , framecounter); + } + { + UInt8 keyid; + UInt8_buf2api(&keyid , pSource, 1, pIndex ); + gpPd_SetKeyIdFromTxAckAfterRx(pDest->data.pdLoh.handle , keyid); + } + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbScanConfirm_Input_buf2api(MacDispatcher_cbScanConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpMacCore_ScanType_t_buf2api(&(pDest->data.scanType), pSource, 1, pIndex); + UInt32_buf2api(&(pDest->data.unscannedChannels), pSource, 1, pIndex); + UInt8_buf2api(&(pDest->data.resultListSize), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + // the pointer for the static parameter pEdScanResultList is already initialized + UInt8_buf2api(pDest->data.pEdScanResultList, pSource, pDest->data.resultListSize , pIndex ); + } + else + { + pDest->data.pEdScanResultList = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += 27; + } + } + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbAssociateIndication_Input_buf2api(MacDispatcher_cbAssociateIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDeviceAddress = pDest->pDeviceAddress.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_Address_t_buf2api(gpMacCore_AddressModeExtendedAddress , pDest->data.pDeviceAddress , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDeviceAddress = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += max(2*1,8*1); + } + } + UInt8_buf2api(&(pDest->data.capabilityInformation), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.rxTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbAssociateConfirm_Input_buf2api(MacDispatcher_cbAssociateConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt16_buf2api(&(pDest->data.assocShortAddress), pSource, 1, pIndex); + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbAssociateCommStatusIndication_Input_buf2api(MacDispatcher_cbAssociateCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSrcAddrInfo = pDest->pSrcAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pSrcAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSrcAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDstAddrInfo = pDest->pDstAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pDstAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDstAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbPollConfirm_Input_buf2api(MacDispatcher_cbPollConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.coordAddrInfo = pDest->coordAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.coordAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.coordAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbPollIndication_Input_buf2api(MacDispatcher_cbPollIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.addressInfo = pDest->addressInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.addressInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.addressInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpPd_TimeStamp_t_buf2api(&(pDest->data.rxTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbPurgeConfirm_Input_buf2api(MacDispatcher_cbPurgeConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + + /* server had pdHandle stored */ +#ifdef GP_COMP_UNIT_TEST + pDest->data.pdHandle = gpPd_GetRealPd(pSource[(*pIndex)++]); +#else + pDest->data.pdHandle = pSource[(*pIndex)++]; +#endif + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbBeaconNotifyIndication_Input_buf2api(MacDispatcher_cbBeaconNotifyIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(&(pDest->data.bsn), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pPanDescriptor = pDest->pPanDescriptor.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_PanDescriptor_t_buf2api(pDest->data.pPanDescriptor , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pPanDescriptor = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (4*1 + 2*1 + 1 + 1 + (max(2*1,8*1) + 2*1 + 1)); + } + } + UInt8_buf2api(&(pDest->data.beaconPayloadLength), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pBeaconPayload = pDest->pBeaconPayload; + UInt8_buf2api(pDest->data.pBeaconPayload, pSource, pDest->data.beaconPayloadLength , pIndex ); + } + else + { + pDest->data.pBeaconPayload = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH; + } + } + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbOrphanIndication_Input_buf2api(MacDispatcher_cbOrphanIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pOrphanAddress = pDest->pOrphanAddress; + MACAddress_t_buf2api(pDest->data.pOrphanAddress, pSource, 1 , pIndex ); + } + else + { + pDest->data.pOrphanAddress = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += 8*1; + } + } + gpPd_TimeStamp_t_buf2api(&(pDest->data.rxTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbOrphanCommStatusIndication_Input_buf2api(MacDispatcher_cbOrphanCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSrcAddrInfo = pDest->pSrcAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pSrcAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSrcAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDstAddrInfo = pDest->pDstAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pDstAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDstAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbSecurityFailureCommStatusIndication_Input_buf2api(MacDispatcher_cbSecurityFailureCommStatusIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pSrcAddrInfo = pDest->pSrcAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pSrcAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pSrcAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pDstAddrInfo = pDest->pDstAddrInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.pDstAddrInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.pDstAddrInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpMacCore_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpPd_TimeStamp_t_buf2api(&(pDest->data.txTime), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbDriverResetIndication_Input_buf2api(MacDispatcher_cbDriverResetIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpMacDispatcher_Result_t_buf2api(&(pDest->data.status), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbPollNotify_Input_buf2api(MacDispatcher_cbPollNotify_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.addressInfo = pDest->addressInfo.data; + { + gpMarshall_AckStatus_t marshall_result = gpMacCore_AddressInfo_t_buf2api(pDest->data.addressInfo , pSource , 1 , pIndex ); + if (gpMarshall_AckStatusSuccess != marshall_result) { return marshall_result; } + } + } + else + { + pDest->data.addressInfo = NULL; + if (true == gpMacDispatcher_GetDummyDataInsertion()) + { + (*pIndex) += (max(2*1,8*1) + 2*1 + 1); + } + } + gpPd_TimeStamp_t_buf2api(&(pDest->data.rxTime), pSource, 1, pIndex); + + /* server had pdHandle stored */ +#ifdef GP_COMP_UNIT_TEST + pDest->data.pdHandle = gpPd_GetRealPd(pSource[(*pIndex)++]); +#else + pDest->data.pdHandle = pSource[(*pIndex)++]; +#endif + Bool_buf2api(&(pDest->data.fromNeighbour), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t MacDispatcher_cbSecurityFrameCounterIndication_Input_buf2api(MacDispatcher_cbSecurityFrameCounterIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt32_buf2api(&(pDest->data.frameCounter), pSource, 1, pIndex); + gpMacDispatcher_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c new file mode 100644 index 0000000..3094e29 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gen/gpMacDispatcher_wrapper_client.c @@ -0,0 +1,4450 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpMacDispatcher_wrapper_client.c" + * + * MAC Dispatcher + * + * Wrapper implementation +*/ + +/***************************************************************************** + * Includes Definition + *****************************************************************************/ + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpCom.h" +#include "gpPd.h" +#include "gpModule.h" +#include "gpMacDispatcher_clientServerCmdId.h" +#include "gpMacDispatcher.h" +#include "gpMacDispatcher_marshalling.h" +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +#include "gpVersion.h" +#endif +/* AdditionalIncludes */ +#include "gpMacDispatcher_def.h" +#include "gpMacDispatcher_callbacks.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Functions Declaration + *****************************************************************************/ + +static void gpMacDispatcher_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId); +static void MacDispatcher_HandleConnectionClose(gpCom_CommunicationId_t communicationId); + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACDISPATCHER +#define GP_MODULE_ID GP_COMPONENT_ID + + +#ifndef GP_MACDISPATCHER_COMM_ID +#define GP_MACDISPATCHER_COMM_ID GP_COM_DEFAULT_COMMUNICATION_ID +#endif + +#define REGISTER_MODULE(handle) GP_COM_REGISTER_MODULE(handle) +#define DATA_REQUEST(len,buf,commId) GP_COM_DATA_REQUEST(len,buf,commId) +#define DATA_REQUEST_ACKED(len,buf,commId) gpCom_DataRequestAndWaitForAck(GP_MODULE_ID, len, buf, commId, &gpMacDispatcher_reqAcked, GPMACDISPATCHER_GPCOMTIMEOUT_US, gpMacDispatcher_Acknowledge_CmdId) + +/***************************************************************************** + * Static Data + *****************************************************************************/ + +typedef union ackDataNeeded { + UInt8 dataBuf0[1]; + UInt8 dataBuf1[(2) * 1]; + UInt8 dataBuf2[1+8*1]; + UInt8 dataBuf3[1+GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH]; + UInt8 dataBuf4[(2*1 + 2*1 + 8*1 + 4*1 + 1)+1]; + UInt8 dataBuf5[(GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS*(9 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS*((2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS*(1 + 1) + 1 + 16)+1]; + UInt8 dataBuf6[(1 + 1 + 1 + 1)+1]; + UInt8 dataBuf7[(4) * 1]; + UInt8 dataBuf8[8*1]; + UInt8 dataBuf9[1+4*1+1+16]; +} ackDataNeeded_t; +static UInt8 gpMacDispatcher_ackBuffer[1 + 1 + 1 + sizeof(ackDataNeeded_t)]; +static Bool gpMacDispatcher_reqAcked; +/* AdditionalStaticData */ +STATIC UInt8* gpMacDispatcher_pResultList = NULL; //Manual - EDScan list +STATIC UInt8 gpMacDispatcher_ClientLockedStack[GP_DIVERSITY_NR_OF_STACKS]; +/* AdditionalStaticData */ + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +static Bool MacDispatcher_clientApiVersionSelected = false; +#endif + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +/* AdditionalStaticFunctionDefinitions */ + +// Define static functions MacDispatcher_cbXXX() to call registered API callbacks. +#include "gpMacDispatcher_callbacks.c" + +/* AdditionalStaticFunctionDefinitions */ + +static void MacDispatcher_HandleConnectionClose(gpCom_CommunicationId_t communicationId) +{ +/* ConnectionCloseFunction */ + GP_LOG_PRINTF("%s on commId=%x vs macDispComm=%x",0, __FUNCTION__, communicationId, GP_MACDISPATCHER_COMM_ID); + if(GP_MACDISPATCHER_COMM_ID == communicationId) + { + //All stacks disconnected - only 1 server used + UInt8 stackId; + for (stackId = 0; stackId < GP_DIVERSITY_NR_OF_STACKS; ++stackId) + { + gpMacDispatcher_ClientLockedStack[stackId] = 0; + MacDispatcher_cbDriverResetIndication(0, stackId); + } + MacDispatcher_InitStackMapping(); + } +/* ConnectionCloseFunction */ +} + +static void gpMacDispatcher_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId) +{ +#define commandId pPayload[0] + gpMarshall_AckStatus_t marshall_result; + UInt16 _index = 1; + gpMacDispatcher_Client_Input_union_t input; + UInt8 ackBuffer[1 + 1 + 1]; + UInt8 ackBytes = 0; /*No ack's on indication - fill in length when needed - 3+x */ + + if(pPayload == NULL) + { + MacDispatcher_HandleConnectionClose(communicationId); + return; + } + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + + ackBuffer[0] = gpMacDispatcher_Acknowledge_CmdId; + ackBuffer[1] = gpMarshall_AckStatusSuccess; + ackBuffer[2] = commandId; + + switch(commandId) + { + + case MacDispatcher_cbDataConfirm_CmdId: + { + marshall_result = MacDispatcher_cbDataConfirm_Input_buf2api(&(input.MacDispatcher_cbDataConfirm) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbDataConfirm */ + if(input.MacDispatcher_cbDataConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbDataConfirm.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbDataConfirm */ + + MacDispatcher_cbDataConfirm( + input.MacDispatcher_cbDataConfirm.data.status + , input.MacDispatcher_cbDataConfirm.data.pdHandle + , input.MacDispatcher_cbDataConfirm.data.stackId + ); + + + break; + } + case MacDispatcher_cbDataIndication_CmdId: + { + marshall_result = MacDispatcher_cbDataIndication_Input_buf2api(&(input.MacDispatcher_cbDataIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbDataIndication */ + if(input.MacDispatcher_cbDataIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbDataIndication.data.stackId]) + { + //MacDispatcher_cbDataIndication_Input_buf2api claims a pd, we need to free here + gpPd_FreePd(input.MacDispatcher_cbDataIndication.data.pdLoh.handle); + break; + } + } +/* ResetCheck_MacDispatcher_cbDataIndication */ + + MacDispatcher_cbDataIndication( + input.MacDispatcher_cbDataIndication.data.pSrcAddrInfo + , input.MacDispatcher_cbDataIndication.data.pDstAddrInfo + , input.MacDispatcher_cbDataIndication.data.dsn + , input.MacDispatcher_cbDataIndication.data.pSecOptions + , input.MacDispatcher_cbDataIndication.data.pdLoh + , input.MacDispatcher_cbDataIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbScanConfirm_CmdId: + { +/* SpecialCall_MacDispatcher_cbScanConfirm */ + input.MacDispatcher_cbScanConfirm.data.pEdScanResultList = gpMacDispatcher_pResultList; + gpMacDispatcher_pResultList = NULL; + marshall_result = MacDispatcher_cbScanConfirm_Input_buf2api( &(input.MacDispatcher_cbScanConfirm) , pPayload , &_index ); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + + if(input.MacDispatcher_cbScanConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbScanConfirm.data.stackId]) + { + break; + } + } + + MacDispatcher_cbScanConfirm( + input.MacDispatcher_cbScanConfirm.data.status + , input.MacDispatcher_cbScanConfirm.data.scanType + , input.MacDispatcher_cbScanConfirm.data.unscannedChannels + , input.MacDispatcher_cbScanConfirm.data.resultListSize + , input.MacDispatcher_cbScanConfirm.data.pEdScanResultList + , input.MacDispatcher_cbScanConfirm.data.stackId + ); +/* SpecialCall_MacDispatcher_cbScanConfirm */ + + + break; + } + case MacDispatcher_cbAssociateIndication_CmdId: + { + marshall_result = MacDispatcher_cbAssociateIndication_Input_buf2api(&(input.MacDispatcher_cbAssociateIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbAssociateIndication */ + if(input.MacDispatcher_cbAssociateIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbAssociateIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbAssociateIndication */ + + MacDispatcher_cbAssociateIndication( + input.MacDispatcher_cbAssociateIndication.data.pDeviceAddress + , input.MacDispatcher_cbAssociateIndication.data.capabilityInformation + , input.MacDispatcher_cbAssociateIndication.data.rxTime + , input.MacDispatcher_cbAssociateIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbAssociateConfirm_CmdId: + { + marshall_result = MacDispatcher_cbAssociateConfirm_Input_buf2api(&(input.MacDispatcher_cbAssociateConfirm) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbAssociateConfirm */ + if(input.MacDispatcher_cbAssociateConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbAssociateConfirm.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbAssociateConfirm */ + + MacDispatcher_cbAssociateConfirm( + input.MacDispatcher_cbAssociateConfirm.data.assocShortAddress + , input.MacDispatcher_cbAssociateConfirm.data.status + , input.MacDispatcher_cbAssociateConfirm.data.txTime + , input.MacDispatcher_cbAssociateConfirm.data.stackId + ); + + + break; + } + case MacDispatcher_cbAssociateCommStatusIndication_CmdId: + { + marshall_result = MacDispatcher_cbAssociateCommStatusIndication_Input_buf2api(&(input.MacDispatcher_cbAssociateCommStatusIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbAssociateCommStatusIndication */ + if(input.MacDispatcher_cbAssociateCommStatusIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbAssociateCommStatusIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbAssociateCommStatusIndication */ + + MacDispatcher_cbAssociateCommStatusIndication( + input.MacDispatcher_cbAssociateCommStatusIndication.data.pSrcAddrInfo + , input.MacDispatcher_cbAssociateCommStatusIndication.data.pDstAddrInfo + , input.MacDispatcher_cbAssociateCommStatusIndication.data.status + , input.MacDispatcher_cbAssociateCommStatusIndication.data.txTime + , input.MacDispatcher_cbAssociateCommStatusIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbPollConfirm_CmdId: + { + marshall_result = MacDispatcher_cbPollConfirm_Input_buf2api(&(input.MacDispatcher_cbPollConfirm) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbPollConfirm */ + if(input.MacDispatcher_cbPollConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbPollConfirm.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbPollConfirm */ + + MacDispatcher_cbPollConfirm( + input.MacDispatcher_cbPollConfirm.data.status + , input.MacDispatcher_cbPollConfirm.data.coordAddrInfo + , input.MacDispatcher_cbPollConfirm.data.txTime + , input.MacDispatcher_cbPollConfirm.data.stackId + ); + + + break; + } + case MacDispatcher_cbPollIndication_CmdId: + { + marshall_result = MacDispatcher_cbPollIndication_Input_buf2api(&(input.MacDispatcher_cbPollIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbPollIndication */ + if(input.MacDispatcher_cbPollIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbPollIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbPollIndication */ + + MacDispatcher_cbPollIndication( + input.MacDispatcher_cbPollIndication.data.addressInfo + , input.MacDispatcher_cbPollIndication.data.rxTime + , input.MacDispatcher_cbPollIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbPurgeConfirm_CmdId: + { + marshall_result = MacDispatcher_cbPurgeConfirm_Input_buf2api(&(input.MacDispatcher_cbPurgeConfirm) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbPurgeConfirm */ + if(input.MacDispatcher_cbPurgeConfirm.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbPurgeConfirm.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbPurgeConfirm */ + + MacDispatcher_cbPurgeConfirm( + input.MacDispatcher_cbPurgeConfirm.data.status + , input.MacDispatcher_cbPurgeConfirm.data.pdHandle + , input.MacDispatcher_cbPurgeConfirm.data.stackId + ); + + + break; + } + case MacDispatcher_cbBeaconNotifyIndication_CmdId: + { + marshall_result = MacDispatcher_cbBeaconNotifyIndication_Input_buf2api(&(input.MacDispatcher_cbBeaconNotifyIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbBeaconNotifyIndication */ + if(input.MacDispatcher_cbBeaconNotifyIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbBeaconNotifyIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbBeaconNotifyIndication */ + + MacDispatcher_cbBeaconNotifyIndication( + input.MacDispatcher_cbBeaconNotifyIndication.data.bsn + , input.MacDispatcher_cbBeaconNotifyIndication.data.pPanDescriptor + , input.MacDispatcher_cbBeaconNotifyIndication.data.beaconPayloadLength + , input.MacDispatcher_cbBeaconNotifyIndication.data.pBeaconPayload + , input.MacDispatcher_cbBeaconNotifyIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbOrphanIndication_CmdId: + { + marshall_result = MacDispatcher_cbOrphanIndication_Input_buf2api(&(input.MacDispatcher_cbOrphanIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbOrphanIndication */ + if(input.MacDispatcher_cbOrphanIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbOrphanIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbOrphanIndication */ + + MacDispatcher_cbOrphanIndication( + input.MacDispatcher_cbOrphanIndication.data.pOrphanAddress + , input.MacDispatcher_cbOrphanIndication.data.rxTime + , input.MacDispatcher_cbOrphanIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbOrphanCommStatusIndication_CmdId: + { + marshall_result = MacDispatcher_cbOrphanCommStatusIndication_Input_buf2api(&(input.MacDispatcher_cbOrphanCommStatusIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbOrphanCommStatusIndication */ + if(input.MacDispatcher_cbOrphanCommStatusIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbOrphanCommStatusIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbOrphanCommStatusIndication */ + + MacDispatcher_cbOrphanCommStatusIndication( + input.MacDispatcher_cbOrphanCommStatusIndication.data.pSrcAddrInfo + , input.MacDispatcher_cbOrphanCommStatusIndication.data.pDstAddrInfo + , input.MacDispatcher_cbOrphanCommStatusIndication.data.status + , input.MacDispatcher_cbOrphanCommStatusIndication.data.txTime + , input.MacDispatcher_cbOrphanCommStatusIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbSecurityFailureCommStatusIndication_CmdId: + { + marshall_result = MacDispatcher_cbSecurityFailureCommStatusIndication_Input_buf2api(&(input.MacDispatcher_cbSecurityFailureCommStatusIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbSecurityFailureCommStatusIndication */ + if(input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbSecurityFailureCommStatusIndication */ + + MacDispatcher_cbSecurityFailureCommStatusIndication( + input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.pSrcAddrInfo + , input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.pDstAddrInfo + , input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.status + , input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.txTime + , input.MacDispatcher_cbSecurityFailureCommStatusIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbDriverResetIndication_CmdId: + { + marshall_result = MacDispatcher_cbDriverResetIndication_Input_buf2api(&(input.MacDispatcher_cbDriverResetIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbDriverResetIndication */ + if(input.MacDispatcher_cbDriverResetIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(input.MacDispatcher_cbDriverResetIndication.data.status == 0xFF) //indication was triggered in the end of a reset call to inform reset has finished + { + //Free up any callbacks to client - reset has completed + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbDriverResetIndication.data.stackId] > 0) + { + gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbDriverResetIndication.data.stackId]--; + } + break; + } + } +/* ResetCheck_MacDispatcher_cbDriverResetIndication */ + + MacDispatcher_cbDriverResetIndication( + input.MacDispatcher_cbDriverResetIndication.data.status + , input.MacDispatcher_cbDriverResetIndication.data.stackId + ); + + + break; + } + case MacDispatcher_cbPollNotify_CmdId: + { + marshall_result = MacDispatcher_cbPollNotify_Input_buf2api(&(input.MacDispatcher_cbPollNotify) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbPollNotify */ + if(input.MacDispatcher_cbPollNotify.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbPollNotify.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbPollNotify */ + + MacDispatcher_cbPollNotify( + input.MacDispatcher_cbPollNotify.data.addressInfo + , input.MacDispatcher_cbPollNotify.data.rxTime + , input.MacDispatcher_cbPollNotify.data.pdHandle + , input.MacDispatcher_cbPollNotify.data.fromNeighbour + , input.MacDispatcher_cbPollNotify.data.stackId + ); + + + break; + } + case MacDispatcher_cbSecurityFrameCounterIndication_CmdId: + { + marshall_result = MacDispatcher_cbSecurityFrameCounterIndication_Input_buf2api(&(input.MacDispatcher_cbSecurityFrameCounterIndication) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + +/* ResetCheck_MacDispatcher_cbSecurityFrameCounterIndication */ + if(input.MacDispatcher_cbSecurityFrameCounterIndication.data.stackId < GP_DIVERSITY_NR_OF_STACKS) + { + if(gpMacDispatcher_ClientLockedStack[input.MacDispatcher_cbSecurityFrameCounterIndication.data.stackId]) + { + break; + } + } +/* ResetCheck_MacDispatcher_cbSecurityFrameCounterIndication */ + + MacDispatcher_cbSecurityFrameCounterIndication( + input.MacDispatcher_cbSecurityFrameCounterIndication.data.frameCounter + , input.MacDispatcher_cbSecurityFrameCounterIndication.data.stackId + ); + + + break; + } + case gpMacDispatcher_Acknowledge_CmdId: + { + GP_ASSERT_SYSTEM(length <= sizeof(gpMacDispatcher_ackBuffer)); + MEMCPY(gpMacDispatcher_ackBuffer, pPayload, length); + gpMacDispatcher_reqAcked = true; + return; + } + default: + { + GP_ASSERT_DEV_INT(false); + break; + } + } +#undef commandId + if(0 < ackBytes) + { + DATA_REQUEST(ackBytes, ackBuffer, communicationId); + } +} +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +void gpMacDispatcher_SetDefaultApiVersion(gpVersion_ModuleVersionInfo_t* moduleVersionInfo) +{ + MacDispatcher_clientApiVersionSelected = true; + //TBD +} +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + + +void gpMacDispatcher_DeInit(void) +{ + gpCom_DeRegisterModule(GP_MODULE_ID); +} + +void gpMacDispatcher_Init(void) +{ +/* Init */ + MacDispatcher_InitStackMapping(); + + { + UInt8 i; + for(i=0; i < GP_DIVERSITY_NR_OF_STACKS; i++) + { + gpMacDispatcher_ClientLockedStack[i] = 0; + } + } +/* Init */ + + gpMacDispatcher_InitMarshalling(); + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + gpVersion_ReleaseInfo_t versions[1] = {{2,7,0,0}}; + MacDispatcher_clientApiVersionSelected = false; + gpVersion_RegisterModule(GP_MODULE_ID, versions,1,gpMacDispatcher_SetDefaultApiVersion); +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + REGISTER_MODULE(gpMacDispatcher_HandleIndicationClient); +} + +/***************************************************************************** + * gpMacDispatcher Require Functions + *****************************************************************************/ + +gpMacDispatcher_StackId_t gpMacDispatcher_RegisterNetworkStack(gpMacDispatcher_StringIdentifier_t* stringIdentifier) +{ + UInt16 _index = 1; + gpMacDispatcher_StackId_t stackId; + UInt8 dataBuf[1 + 1 + (5)]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_RegisterNetworkStack_CmdId; + + gpMacDispatcher_RegisterNetworkStack_Input_par2buf(dataBuf + , stringIdentifier + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_RegisterNetworkStack_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_RegisterNetworkStack_Output_buf2par( + &stackId + , stringIdentifier + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return stackId; +} + +gpMacCore_Result_t gpMacDispatcher_UnRegisterNetworkStack(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_UnRegisterNetworkStack_CmdId; + + gpMacDispatcher_UnRegisterNetworkStack_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_UnRegisterNetworkStack_CmdId == gpMacDispatcher_ackBuffer[2]); + +/* AdditionalBehavior_gpMacDispatcher_UnRegisterNetworkStack */ + MacDispatcher_UnRegisterCallbacks(stackId); + gpMacDispatcher_ClientLockedStack[stackId] = 0; +/* AdditionalBehavior_gpMacDispatcher_UnRegisterNetworkStack */ + + _index = 3; + gpMacDispatcher_UnRegisterNetworkStack_Output_buf2par( + &result + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +Bool gpMacDispatcher_LockClaim(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_LockClaim_CmdId; + + gpMacDispatcher_LockClaim_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_LockClaim_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_LockClaim_Output_buf2par( + &result + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_LockRelease(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_LockRelease_CmdId; + + gpMacDispatcher_LockRelease_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_LockRelease_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_LockedByThisStack(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool locked; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_LockedByThisStack_CmdId; + + gpMacDispatcher_LockedByThisStack_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_LockedByThisStack_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_LockedByThisStack_Output_buf2par( + &locked + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return locked; +} + +Bool gpMacDispatcher_Locked(void) +{ + UInt16 _index = 1; + Bool locked; + UInt8 dataBuf[1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_Locked_CmdId; + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_Locked_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_Locked_Output_buf2par( + &locked + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return locked; +} + +gpMacDispatcher_Result_t gpMacDispatcher_Reset(Bool setDefaultPib, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacDispatcher_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_Reset_CmdId; + + gpMacDispatcher_Reset_Input_par2buf(dataBuf + , setDefaultPib + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_Reset_CmdId == gpMacDispatcher_ackBuffer[2]); + +/* AdditionalBehavior_gpMacDispatcher_Reset */ + //Lock any callbacks for this stack until reset indication is received + if(stackId < GP_DIVERSITY_NR_OF_STACKS) + { + gpMacDispatcher_ClientLockedStack[stackId]++; + } +/* AdditionalBehavior_gpMacDispatcher_Reset */ + + _index = 3; + gpMacDispatcher_Reset_Output_buf2par( + &result + , setDefaultPib + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_DataRequest(gpMacCore_AddressMode_t srcAddrMode, gpMacCore_AddressInfo_t* pDstAddressInfo, UInt8 txOptions, gpMacCore_Security_t* pSecOptions, gpMacCore_MultiChannelOptions_t multiChannelOptions, gpPd_Loh_t pdLoh, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1 + 1 + (1 + 1 + max(4,8) + 1) + (3) + (2*1 + 2*0 + 128 + 1) + 128 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_DataRequest_CmdId; + + gpMacDispatcher_DataRequest_Input_par2buf(dataBuf + , srcAddrMode + , pDstAddressInfo + , txOptions + , pSecOptions + , multiChannelOptions + , pdLoh + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMacDispatcher_DataRequest_CmdId == gpMacDispatcher_ackBuffer[2]); +/* gpMacDispatcher_DataRequest_StatusCheck */ + /* Manual added begin:*/ + if(gpMarshall_AckStatusSuccess != gpMacDispatcher_ackBuffer[1]) + { + MacDispatcher_cbDataConfirm(gpMacCore_ResultTransactionOverflow, pdLoh.handle, stackId); + } + /* Manual added end*/ +/* gpMacDispatcher_DataRequest_StatusCheck */ + + +#undef commandId +} + +void gpMacDispatcher_ScanRequest(gpMacCore_ScanType_t scanType, UInt32 scanChannels, UInt8 scanDuration, UInt8 resultListSize, UInt8* pResultList, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 4*1 + 1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_ScanRequest_CmdId; + + gpMacDispatcher_ScanRequest_Input_par2buf(dataBuf + , scanType + , scanChannels + , scanDuration + , resultListSize + , pResultList + , stackId + , &_index); +/* SpecialOutputParameterHandling_gpMacDispatcher_ScanRequest_pResultList */ + if ((pResultList!= NULL) && (gpMacDispatcher_pResultList != NULL)) + { + MacDispatcher_cbScanConfirm(gpMacCore_ResultTransactionOverflow, scanType, scanChannels, 0, pResultList,stackId); + return; + } + else + { + //Do not assign result list on a Stop request + if (scanType != gpMacCore_ScanTypeStop) + { + gpMacDispatcher_pResultList = pResultList; + } + } +/* SpecialOutputParameterHandling_gpMacDispatcher_ScanRequest_pResultList */ + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_ScanRequest_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_AssociateRequest(UInt8 logicalChannel, gpMacCore_AddressInfo_t* coordAddrInfo, UInt8 capabilityInformation, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_AssociateRequest_CmdId; + + gpMacDispatcher_AssociateRequest_Input_par2buf(dataBuf + , logicalChannel + , coordAddrInfo + , capabilityInformation + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_AssociateRequest_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_AssociateResponse(MACAddress_t* pDeviceAddress, UInt16 associateShortAddress, gpMacCore_Result_t status, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 2*1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_AssociateResponse_CmdId; + + gpMacDispatcher_AssociateResponse_Input_par2buf(dataBuf + , pDeviceAddress + , associateShortAddress + , status + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_AssociateResponse_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_PollRequest(gpMacCore_AddressInfo_t* coordAddrInfo, gpMacCore_Security_t* pSecOptions, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1 + (1 + 1 + max(4,8) + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_PollRequest_CmdId; + + gpMacDispatcher_PollRequest_Input_par2buf(dataBuf + , coordAddrInfo + , pSecOptions + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_PollRequest_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_PurgeRequest(gpPd_Handle_t pdHandle, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_PurgeRequest_CmdId; + + gpMacDispatcher_PurgeRequest_Input_par2buf(dataBuf + , pdHandle + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_PurgeRequest_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_Result_t gpMacDispatcher_Start(gpMacCore_PanId_t panId, UInt8 logicalChannel, Bool panCoordinator, UInt8 stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t returnValue; + UInt8 dataBuf[1 + 2*1 + 1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_Start_CmdId; + + gpMacDispatcher_Start_Input_par2buf(dataBuf + , panId + , logicalChannel + , panCoordinator + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_Start_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_Start_Output_buf2par( + &returnValue + , panId + , logicalChannel + , panCoordinator + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return returnValue; +} + +void gpMacDispatcher_OrphanResponse(MACAddress_t* pOrphanAddress, UInt16 shortAddress, Bool associatedMember, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 2*1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_OrphanResponse_CmdId; + + gpMacDispatcher_OrphanResponse_Input_par2buf(dataBuf + , pOrphanAddress + , shortAddress + , associatedMember + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_OrphanResponse_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetPanId(UInt16 panId, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPanId_CmdId; + + gpMacDispatcher_SetPanId_Input_par2buf(dataBuf + , panId + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPanId_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_PanId_t gpMacDispatcher_GetPanId(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_PanId_t panId; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetPanId_CmdId; + + gpMacDispatcher_GetPanId_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetPanId_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetPanId_Output_buf2par( + &panId + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return panId; +} + +void gpMacDispatcher_SetShortAddress(UInt16 shortAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetShortAddress_CmdId; + + gpMacDispatcher_SetShortAddress_Input_par2buf(dataBuf + , shortAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt16 gpMacDispatcher_GetShortAddress(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt16 address; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetShortAddress_CmdId; + + gpMacDispatcher_GetShortAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetShortAddress_Output_buf2par( + &address + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return address; +} + +void gpMacDispatcher_SetExtendedAddress(MACAddress_t* pExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetExtendedAddress_CmdId; + + gpMacDispatcher_SetExtendedAddress_Input_par2buf(dataBuf + , pExtendedAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_GetExtendedAddress(MACAddress_t* pExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetExtendedAddress_CmdId; + + gpMacDispatcher_GetExtendedAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetExtendedAddress_Output_buf2par( + pExtendedAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId +} + +void gpMacDispatcher_SetDsn(UInt8 dsn, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDsn_CmdId; + + gpMacDispatcher_SetDsn_Input_par2buf(dataBuf + , dsn + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDsn_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetDsn(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dsn; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetDsn_CmdId; + + gpMacDispatcher_GetDsn_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetDsn_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetDsn_Output_buf2par( + &dsn + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return dsn; +} + +void gpMacDispatcher_SetCurrentChannel(UInt8 channel, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCurrentChannel_CmdId; + + gpMacDispatcher_SetCurrentChannel_Input_par2buf(dataBuf + , channel + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCurrentChannel_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetCurrentChannel(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 channel; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCurrentChannel_CmdId; + + gpMacDispatcher_GetCurrentChannel_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCurrentChannel_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCurrentChannel_Output_buf2par( + &channel + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return channel; +} + +void gpMacDispatcher_SetBeaconPayload(UInt8* pBeaconPayload, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + GP_MACCORE_MAX_BEACON_PAYLOAD_LENGTH + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetBeaconPayload_CmdId; + + gpMacDispatcher_SetBeaconPayload_Input_par2buf(dataBuf + , pBeaconPayload + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetBeaconPayload_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_GetBeaconPayload(UInt8* pBeaconPayload, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetBeaconPayload_CmdId; + + gpMacDispatcher_GetBeaconPayload_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetBeaconPayload_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetBeaconPayload_Output_buf2par( + pBeaconPayload + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId +} + +void gpMacDispatcher_SetBeaconPayloadLength(UInt8 beaconPayloadLength, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetBeaconPayloadLength_CmdId; + + gpMacDispatcher_SetBeaconPayloadLength_Input_par2buf(dataBuf + , beaconPayloadLength + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetBeaconPayloadLength_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetBeaconPayloadLength(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 beaconPayloadLength; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetBeaconPayloadLength_CmdId; + + gpMacDispatcher_GetBeaconPayloadLength_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetBeaconPayloadLength_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetBeaconPayloadLength_Output_buf2par( + &beaconPayloadLength + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return beaconPayloadLength; +} + + + +void gpMacDispatcher_SetRxOnWhenIdle(Bool rxOnWhenIdle, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetRxOnWhenIdle_CmdId; + + gpMacDispatcher_SetRxOnWhenIdle_Input_par2buf(dataBuf + , rxOnWhenIdle + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetRxOnWhenIdle_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetRxOnWhenIdle(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool rxOnWhenIdle; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetRxOnWhenIdle_CmdId; + + gpMacDispatcher_GetRxOnWhenIdle_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetRxOnWhenIdle_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetRxOnWhenIdle_Output_buf2par( + &rxOnWhenIdle + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return rxOnWhenIdle; +} + +UInt16 gpMacDispatcher_GetTransactionPersistenceTime(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt16 time; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetTransactionPersistenceTime_CmdId; + + gpMacDispatcher_GetTransactionPersistenceTime_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetTransactionPersistenceTime_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetTransactionPersistenceTime_Output_buf2par( + &time + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return time; +} + +void gpMacDispatcher_SetTransactionPersistenceTime(UInt16 time, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetTransactionPersistenceTime_CmdId; + + gpMacDispatcher_SetTransactionPersistenceTime_Input_par2buf(dataBuf + , time + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetTransactionPersistenceTime_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetBeaconStarted(Bool beaconStarted, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetBeaconStarted_CmdId; + + gpMacDispatcher_SetBeaconStarted_Input_par2buf(dataBuf + , beaconStarted + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetBeaconStarted_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetBeaconStarted(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool beaconStarted; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetBeaconStarted_CmdId; + + gpMacDispatcher_GetBeaconStarted_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetBeaconStarted_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetBeaconStarted_Output_buf2par( + &beaconStarted + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return beaconStarted; +} + +void gpMacDispatcher_SetCoordShortAddress(UInt16 coordShortAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCoordShortAddress_CmdId; + + gpMacDispatcher_SetCoordShortAddress_Input_par2buf(dataBuf + , coordShortAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCoordShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt16 gpMacDispatcher_GetCoordShortAddress(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt16 coordShortAddress; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCoordShortAddress_CmdId; + + gpMacDispatcher_GetCoordShortAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCoordShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCoordShortAddress_Output_buf2par( + &coordShortAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return coordShortAddress; +} + +void gpMacDispatcher_SetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCoordExtendedAddress_CmdId; + + gpMacDispatcher_SetCoordExtendedAddress_Input_par2buf(dataBuf + , pCoordExtendedAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCoordExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_GetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCoordExtendedAddress_CmdId; + + gpMacDispatcher_GetCoordExtendedAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCoordExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCoordExtendedAddress_Output_buf2par( + pCoordExtendedAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId +} + +void gpMacDispatcher_SetPromiscuousMode(UInt8 promiscuousMode, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPromiscuousMode_CmdId; + + gpMacDispatcher_SetPromiscuousMode_Input_par2buf(dataBuf + , promiscuousMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPromiscuousMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetPromiscuousMode(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool promiscuousMode; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetPromiscuousMode_CmdId; + + gpMacDispatcher_GetPromiscuousMode_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetPromiscuousMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetPromiscuousMode_Output_buf2par( + &promiscuousMode + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return promiscuousMode; +} + +void gpMacDispatcher_SetAssociationPermit(Bool associationPermit, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetAssociationPermit_CmdId; + + gpMacDispatcher_SetAssociationPermit_Input_par2buf(dataBuf + , associationPermit + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetAssociationPermit_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetAssociationPermit(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool associationPermit; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetAssociationPermit_CmdId; + + gpMacDispatcher_GetAssociationPermit_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetAssociationPermit_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetAssociationPermit_Output_buf2par( + &associationPermit + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return associationPermit; +} + +void gpMacDispatcher_SetSecurityEnabled(Bool securityEnabled, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetSecurityEnabled_CmdId; + + gpMacDispatcher_SetSecurityEnabled_Input_par2buf(dataBuf + , securityEnabled + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetSecurityEnabled_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetSecurityEnabled(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool securityEnabled; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetSecurityEnabled_CmdId; + + gpMacDispatcher_GetSecurityEnabled_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetSecurityEnabled_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetSecurityEnabled_Output_buf2par( + &securityEnabled + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return securityEnabled; +} + +void gpMacDispatcher_SetNumberOfRetries(UInt8 numberOfRetries, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetNumberOfRetries_CmdId; + + gpMacDispatcher_SetNumberOfRetries_Input_par2buf(dataBuf + , numberOfRetries + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetNumberOfRetries_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetNumberOfRetries(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 numberOfRetries; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetNumberOfRetries_CmdId; + + gpMacDispatcher_GetNumberOfRetries_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetNumberOfRetries_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetNumberOfRetries_Output_buf2par( + &numberOfRetries + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return numberOfRetries; +} + +void gpMacDispatcher_SetMaxCsmaBackoffs(UInt8 maxCsmaBackoffs, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMaxCsmaBackoffs_CmdId; + + gpMacDispatcher_SetMaxCsmaBackoffs_Input_par2buf(dataBuf + , maxCsmaBackoffs + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMaxCsmaBackoffs_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMaxCsmaBackoffs(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 maxCsmaBackoffs; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMaxCsmaBackoffs_CmdId; + + gpMacDispatcher_GetMaxCsmaBackoffs_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMaxCsmaBackoffs_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMaxCsmaBackoffs_Output_buf2par( + &maxCsmaBackoffs + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return maxCsmaBackoffs; +} + +void gpMacDispatcher_SetDefaultTransmitPowers(Int8* pDefaultTransmitPowerTable) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 16]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDefaultTransmitPowers_CmdId; + + gpMacDispatcher_SetDefaultTransmitPowers_Input_par2buf(dataBuf + , pDefaultTransmitPowerTable + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDefaultTransmitPowers_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetTransmitPower(gpMacCore_TxPower_t transmitPower, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetTransmitPower_CmdId; + + gpMacDispatcher_SetTransmitPower_Input_par2buf(dataBuf + , transmitPower + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetTransmitPower_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Int8 gpMacDispatcher_GetTransmitPower(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Int8 transmitPower; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetTransmitPower_CmdId; + + gpMacDispatcher_GetTransmitPower_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetTransmitPower_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetTransmitPower_Output_buf2par( + &transmitPower + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return transmitPower; +} + +void gpMacDispatcher_SetCCAMode(UInt8 cCAMode, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCCAMode_CmdId; + + gpMacDispatcher_SetCCAMode_Input_par2buf(dataBuf + , cCAMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCCAMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetCCAMode(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 cCAMode; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCCAMode_CmdId; + + gpMacDispatcher_GetCCAMode_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCCAMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCCAMode_Output_buf2par( + &cCAMode + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return cCAMode; +} + +void gpMacDispatcher_SetPanCoordinator(Bool panCoordinator, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPanCoordinator_CmdId; + + gpMacDispatcher_SetPanCoordinator_Input_par2buf(dataBuf + , panCoordinator + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPanCoordinator_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetPanCoordinator(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool panCoordinator; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetPanCoordinator_CmdId; + + gpMacDispatcher_GetPanCoordinator_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetPanCoordinator_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetPanCoordinator_Output_buf2par( + &panCoordinator + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return panCoordinator; +} + +void gpMacDispatcher_SetMinBE(UInt8 minBE, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMinBE_CmdId; + + gpMacDispatcher_SetMinBE_Input_par2buf(dataBuf + , minBE + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMinBE_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMinBE(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 minBE; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMinBE_CmdId; + + gpMacDispatcher_GetMinBE_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMinBE_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMinBE_Output_buf2par( + &minBE + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return minBE; +} + +void gpMacDispatcher_SetIndicateBeaconNotifications(Bool enable, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetIndicateBeaconNotifications_CmdId; + + gpMacDispatcher_SetIndicateBeaconNotifications_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetIndicateBeaconNotifications_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetIndicateBeaconNotifications(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetIndicateBeaconNotifications_CmdId; + + gpMacDispatcher_GetIndicateBeaconNotifications_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetIndicateBeaconNotifications_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetIndicateBeaconNotifications_Output_buf2par( + &enable + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return enable; +} + +void gpMacDispatcher_SetMacVersion(gpMacCore_MacVersion_t macVersion, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMacVersion_CmdId; + + gpMacDispatcher_SetMacVersion_Input_par2buf(dataBuf + , macVersion + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMacVersion_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_MacVersion_t gpMacDispatcher_GetMacVersion(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_MacVersion_t macVersion; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMacVersion_CmdId; + + gpMacDispatcher_GetMacVersion_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMacVersion_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMacVersion_Output_buf2par( + &macVersion + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return macVersion; +} + +void gpMacDispatcher_SetForwardPollIndications(Bool enable, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetForwardPollIndications_CmdId; + + gpMacDispatcher_SetForwardPollIndications_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetForwardPollIndications_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetForwardPollIndications(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetForwardPollIndications_CmdId; + + gpMacDispatcher_GetForwardPollIndications_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetForwardPollIndications_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetForwardPollIndications_Output_buf2par( + &enable + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return enable; +} + +gpMacCore_Result_t gpMacDispatcher_DataPending_QueueAdd(gpMacCore_AddressInfo_t* pAddrInfo, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_DataPending_QueueAdd_CmdId; + + gpMacDispatcher_DataPending_QueueAdd_Input_par2buf(dataBuf + , pAddrInfo + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_DataPending_QueueAdd_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_DataPending_QueueAdd_Output_buf2par( + &result + , pAddrInfo + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_DataPending_QueueRemove(gpMacCore_AddressInfo_t* pAddrInfo, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_DataPending_QueueRemove_CmdId; + + gpMacDispatcher_DataPending_QueueRemove_Input_par2buf(dataBuf + , pAddrInfo + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_DataPending_QueueRemove_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_DataPending_QueueRemove_Output_buf2par( + &result + , pAddrInfo + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetMinInterferenceLevels(Int8* pInterferenceLevels) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMinInterferenceLevels_CmdId; + + gpMacDispatcher_SetMinInterferenceLevels_Input_par2buf(dataBuf + , pInterferenceLevels + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMinInterferenceLevels_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetMaxBE(UInt8 maxBE, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMaxBE_CmdId; + + gpMacDispatcher_SetMaxBE_Input_par2buf(dataBuf + , maxBE + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMaxBE_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMaxBE(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 maxBE; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMaxBE_CmdId; + + gpMacDispatcher_GetMaxBE_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMaxBE_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMaxBE_Output_buf2par( + &maxBE + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return maxBE; +} + +gpMacCore_Result_t gpMacDispatcher_SetDeviceDescriptor(gpMacCore_DeviceDescriptor_t* pDeviceDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDeviceDescriptor_CmdId; + + gpMacDispatcher_SetDeviceDescriptor_Input_par2buf(dataBuf + , pDeviceDescriptor + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDeviceDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_SetDeviceDescriptor_Output_buf2par( + &result + , pDeviceDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_GetDeviceDescriptor(gpMacCore_DeviceDescriptor_t* pDeviceDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetDeviceDescriptor_CmdId; + + gpMacDispatcher_GetDeviceDescriptor_Input_par2buf(dataBuf + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetDeviceDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetDeviceDescriptor_Output_buf2par( + &result + , pDeviceDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetDeviceTableEntries(gpMacCore_DeviceTablesEntries_t deviceTableEntries, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDeviceTableEntries_CmdId; + + gpMacDispatcher_SetDeviceTableEntries_Input_par2buf(dataBuf + , deviceTableEntries + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDeviceTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_DeviceTablesEntries_t gpMacDispatcher_GetDeviceTableEntries(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_DeviceTablesEntries_t deviceTableEntries; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetDeviceTableEntries_CmdId; + + gpMacDispatcher_GetDeviceTableEntries_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetDeviceTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetDeviceTableEntries_Output_buf2par( + &deviceTableEntries + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return deviceTableEntries; +} + +gpMacCore_Result_t gpMacDispatcher_SetKeyDescriptor(gpMacCore_KeyDescriptor_t* pKeyDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (GP_MACCORE_NUMBER_OF_KEY_ID_LOOKUP_DESCRIPTORS*(9 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_DEVICE_DESCRIPTORS*((2*1 + 2*1 + 8*1 + 4*1 + 1) + 1 + 1) + 1 + GP_MACCORE_NUMBER_OF_KEY_USAGE_DESCRIPTORS*(1 + 1) + 1 + 16) + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetKeyDescriptor_CmdId; + + gpMacDispatcher_SetKeyDescriptor_Input_par2buf(dataBuf + , pKeyDescriptor + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetKeyDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_SetKeyDescriptor_Output_buf2par( + &result + , pKeyDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_GetKeyDescriptor(gpMacCore_KeyDescriptor_t* pKeyDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetKeyDescriptor_CmdId; + + gpMacDispatcher_GetKeyDescriptor_Input_par2buf(dataBuf + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetKeyDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetKeyDescriptor_Output_buf2par( + &result + , pKeyDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetKeyTableEntries(gpMacCore_KeyTablesEntries_t keyTableEntries, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetKeyTableEntries_CmdId; + + gpMacDispatcher_SetKeyTableEntries_Input_par2buf(dataBuf + , keyTableEntries + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetKeyTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_Result_t gpMacDispatcher_SetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (1 + 1 + 1 + 1) + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetSecurityLevelDescriptor_CmdId; + + gpMacDispatcher_SetSecurityLevelDescriptor_Input_par2buf(dataBuf + , pSecurityLevelDescriptor + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetSecurityLevelDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_SetSecurityLevelDescriptor_Output_buf2par( + &result + , pSecurityLevelDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_GetSecurityLevelDescriptor(gpMacCore_SecurityLevelDescriptor_t* pSecurityLevelDescriptor, gpMacCore_Index_t index, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetSecurityLevelDescriptor_CmdId; + + gpMacDispatcher_GetSecurityLevelDescriptor_Input_par2buf(dataBuf + , index + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetSecurityLevelDescriptor_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetSecurityLevelDescriptor_Output_buf2par( + &result + , pSecurityLevelDescriptor + , index + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetSecurityLevelTableEntries(gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetSecurityLevelTableEntries_CmdId; + + gpMacDispatcher_SetSecurityLevelTableEntries_Input_par2buf(dataBuf + , securityLevelTableEntries + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetSecurityLevelTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +gpMacCore_SecurityLevelTableEntries_t gpMacDispatcher_GetSecurityLevelTableEntries(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_SecurityLevelTableEntries_t securityLevelTableEntries; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetSecurityLevelTableEntries_CmdId; + + gpMacDispatcher_GetSecurityLevelTableEntries_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetSecurityLevelTableEntries_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetSecurityLevelTableEntries_Output_buf2par( + &securityLevelTableEntries + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return securityLevelTableEntries; +} + +void gpMacDispatcher_SetDefaultKeySource(UInt8* pDefaultKeySource, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDefaultKeySource_CmdId; + + gpMacDispatcher_SetDefaultKeySource_Input_par2buf(dataBuf + , pDefaultKeySource + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDefaultKeySource_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetFrameCounter(UInt32 frameCounter, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 4*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetFrameCounter_CmdId; + + gpMacDispatcher_SetFrameCounter_Input_par2buf(dataBuf + , frameCounter + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetFrameCounter_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt32 gpMacDispatcher_GetFrameCounter(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt32 frameCounter; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetFrameCounter_CmdId; + + gpMacDispatcher_GetFrameCounter_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetFrameCounter_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetFrameCounter_Output_buf2par( + &frameCounter + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return frameCounter; +} + +void gpMacDispatcher_SetPanCoordShortAddress(UInt16 panCoordShortAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPanCoordShortAddress_CmdId; + + gpMacDispatcher_SetPanCoordShortAddress_Input_par2buf(dataBuf + , panCoordShortAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPanCoordShortAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetPanCoordExtendedAddress(MACAddress_t* pPanCoordExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 8*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetPanCoordExtendedAddress_CmdId; + + gpMacDispatcher_SetPanCoordExtendedAddress_Input_par2buf(dataBuf + , pPanCoordExtendedAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetPanCoordExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_GetPanCoordExtendedAddress(MACAddress_t* pPanCoordExtendedAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetPanCoordExtendedAddress_CmdId; + + gpMacDispatcher_GetPanCoordExtendedAddress_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetPanCoordExtendedAddress_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetPanCoordExtendedAddress_Output_buf2par( + pPanCoordExtendedAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId +} + +Bool gpMacDispatcher_AddNeighbour(gpMacCore_AddressInfo_t* pAddrInfo, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_AddNeighbour_CmdId; + + gpMacDispatcher_AddNeighbour_Input_par2buf(dataBuf + , pAddrInfo + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_AddNeighbour_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_AddNeighbour_Output_buf2par( + &result + , pAddrInfo + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +Bool gpMacDispatcher_RemoveNeighbour(gpMacCore_AddressInfo_t* pAddrInfo, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1 + (max(2*1,8*1) + 2*1 + 1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_RemoveNeighbour_CmdId; + + gpMacDispatcher_RemoveNeighbour_Input_par2buf(dataBuf + , pAddrInfo + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_RemoveNeighbour_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_RemoveNeighbour_Output_buf2par( + &result + , pAddrInfo + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_SetDataPendingMode(gpMacCore_DataPendingMode_t dataPendingMode, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetDataPendingMode_CmdId; + + gpMacDispatcher_SetDataPendingMode_Input_par2buf(dataBuf + , dataPendingMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetDataPendingMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_SetDataPendingMode_Output_buf2par( + &result + , dataPendingMode + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + + +void gpMacDispatcher_SetAddressModeOverrideForBeacons(UInt8 addressMode, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetAddressModeOverrideForBeacons_CmdId; + + gpMacDispatcher_SetAddressModeOverrideForBeacons_Input_par2buf(dataBuf + , addressMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetAddressModeOverrideForBeacons_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_ClearNeighbours(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_ClearNeighbours_CmdId; + + gpMacDispatcher_ClearNeighbours_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_ClearNeighbours_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetCsmaMode(UInt8 csmaMode, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetCsmaMode_CmdId; + + gpMacDispatcher_SetCsmaMode_Input_par2buf(dataBuf + , csmaMode + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetCsmaMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetCsmaMode(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 csmaMode; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCsmaMode_CmdId; + + gpMacDispatcher_GetCsmaMode_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCsmaMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCsmaMode_Output_buf2par( + &csmaMode + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return csmaMode; +} + +gpMacCore_Result_t gpMacDispatcher_DataPending_QueueClear(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_DataPending_QueueClear_CmdId; + + gpMacDispatcher_DataPending_QueueClear_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_DataPending_QueueClear_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_DataPending_QueueClear_Output_buf2par( + &result + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +gpMacCore_Result_t gpMacDispatcher_ScheduleTimedTx(gpPd_Handle_t pdHandle, gpMacCore_TxTimingOptions_t timingOptions, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + (4*1) + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_ScheduleTimedTx_CmdId; + + gpMacDispatcher_ScheduleTimedTx_Input_par2buf(dataBuf + , pdHandle + , timingOptions + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_ScheduleTimedTx_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_ScheduleTimedTx_Output_buf2par( + &result + , pdHandle + , timingOptions + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + + + + + + +void gpMacDispatcher_SetStackInRawMode(Bool rawModeEnabled, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetStackInRawMode_CmdId; + + gpMacDispatcher_SetStackInRawMode_Input_par2buf(dataBuf + , rawModeEnabled + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetStackInRawMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetStackInRawMode(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + Bool rawModeEnabled; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetStackInRawMode_CmdId; + + gpMacDispatcher_GetStackInRawMode_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetStackInRawMode_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetStackInRawMode_Output_buf2par( + &rawModeEnabled + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return rawModeEnabled; +} + +void gpMacDispatcher_SetRawModeEncryptionKeys(gpMacCore_KeyIdMode_t encryptionKeyIdMode, gpMacCore_KeyIndex_t encryptionKeyId, UInt8* pCurrKey, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1 + 1 + 16 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetRawModeEncryptionKeys_CmdId; + + gpMacDispatcher_SetRawModeEncryptionKeys_Input_par2buf(dataBuf + , encryptionKeyIdMode + , encryptionKeyId + , pCurrKey + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetRawModeEncryptionKeys_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_SetRawModeNonceFields(UInt32 frameCounter, MACAddress_t* pExtendedAddress, UInt8 seclevel, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 4*1 + 1 + 8*1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetRawModeNonceFields_CmdId; + + gpMacDispatcher_SetRawModeNonceFields_Input_par2buf(dataBuf + , frameCounter + , pExtendedAddress + , seclevel + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetRawModeNonceFields_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_EnableEnhancedFramePending(Bool enableEnhancedFramePending, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_EnableEnhancedFramePending_CmdId; + + gpMacDispatcher_EnableEnhancedFramePending_Input_par2buf(dataBuf + , enableEnhancedFramePending + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_EnableEnhancedFramePending_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_EnableRxWindows(UInt32 dutyCycleOnTime, UInt32 dutyCyclePeriod, UInt16 recurrenceAmount, UInt32 startTime, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 4*1 + 4*1 + 2*1 + 4*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_EnableRxWindows_CmdId; + + gpMacDispatcher_EnableRxWindows_Input_par2buf(dataBuf + , dutyCycleOnTime + , dutyCyclePeriod + , recurrenceAmount + , startTime + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_EnableRxWindows_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_DisableRxWindows(gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_DisableRxWindows_CmdId; + + gpMacDispatcher_DisableRxWindows_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_DisableRxWindows_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_EnableCsl(UInt16 dutyCyclePeriod, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_EnableCsl_CmdId; + + gpMacDispatcher_EnableCsl_Input_par2buf(dataBuf + , dutyCyclePeriod + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_EnableCsl_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +void gpMacDispatcher_UpdateCslSampleTime(UInt32 nextCslSampleTime, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 4*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_UpdateCslSampleTime_CmdId; + + gpMacDispatcher_UpdateCslSampleTime_Input_par2buf(dataBuf + , nextCslSampleTime + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_UpdateCslSampleTime_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt32 gpMacDispatcher_GetCurrentTimeUs(void) +{ + UInt16 _index = 1; + UInt32 currentTime; + UInt8 dataBuf[1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetCurrentTimeUs_CmdId; + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetCurrentTimeUs_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetCurrentTimeUs_Output_buf2par( + ¤tTime + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return currentTime; +} + +gpMacCore_Result_t gpMacDispatcher_ConfigureEnhAckProbing(UInt8 linkMetrics, MACAddress_t* pExtendedAddress, UInt16 shortAddress, gpMacDispatcher_StackId_t stackId) +{ + UInt16 _index = 1; + gpMacCore_Result_t result; + UInt8 dataBuf[1 + 1 + 1 + 8*1 + 2*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_ConfigureEnhAckProbing_CmdId; + + gpMacDispatcher_ConfigureEnhAckProbing_Input_par2buf(dataBuf + , linkMetrics + , pExtendedAddress + , shortAddress + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_ConfigureEnhAckProbing_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_ConfigureEnhAckProbing_Output_buf2par( + &result + , linkMetrics + , pExtendedAddress + , shortAddress + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return result; +} + +void gpMacDispatcher_SetRetransmitOnCcaFail(Bool enable, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetRetransmitOnCcaFail_CmdId; + + gpMacDispatcher_SetRetransmitOnCcaFail_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetRetransmitOnCcaFail_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetRetransmitOnCcaFail(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetRetransmitOnCcaFail_CmdId; + + gpMacDispatcher_GetRetransmitOnCcaFail_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetRetransmitOnCcaFail_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetRetransmitOnCcaFail_Output_buf2par( + &enable + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return enable; +} + +void gpMacDispatcher_SetRetransmitRandomBackoff(Bool enable, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetRetransmitRandomBackoff_CmdId; + + gpMacDispatcher_SetRetransmitRandomBackoff_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetRetransmitRandomBackoff_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +Bool gpMacDispatcher_GetRetransmitRandomBackoff(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetRetransmitRandomBackoff_CmdId; + + gpMacDispatcher_GetRetransmitRandomBackoff_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetRetransmitRandomBackoff_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetRetransmitRandomBackoff_Output_buf2par( + &enable + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return enable; +} + +void gpMacDispatcher_SetMinBeRetransmit(UInt8 minBERetransmit, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMinBeRetransmit_CmdId; + + gpMacDispatcher_SetMinBeRetransmit_Input_par2buf(dataBuf + , minBERetransmit + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMinBeRetransmit_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMinBeRetransmit(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 minBERetransmit; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMinBeRetransmit_CmdId; + + gpMacDispatcher_GetMinBeRetransmit_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMinBeRetransmit_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMinBeRetransmit_Output_buf2par( + &minBERetransmit + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return minBERetransmit; +} + +void gpMacDispatcher_SetMaxBeRetransmit(UInt8 maxBERetransmit, gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_SetMaxBeRetransmit_CmdId; + + gpMacDispatcher_SetMaxBeRetransmit_Input_par2buf(dataBuf + , maxBERetransmit + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_SetMaxBeRetransmit_CmdId == gpMacDispatcher_ackBuffer[2]); + + +#undef commandId +} + +UInt8 gpMacDispatcher_GetMaxBeRetransmit(gpMacCore_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 maxBERetransmit; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(MacDispatcher_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpMacDispatcher_GetMaxBeRetransmit_CmdId; + + gpMacDispatcher_GetMaxBeRetransmit_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_MACDISPATCHER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpMacDispatcher_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpMacDispatcher_GetMaxBeRetransmit_CmdId == gpMacDispatcher_ackBuffer[2]); + + _index = 3; + gpMacDispatcher_GetMaxBeRetransmit_Output_buf2par( + &maxBERetransmit + , stackId + , gpMacDispatcher_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpMacDispatcher_ackBuffer)); + +#undef commandId + return maxBERetransmit; +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.c new file mode 100644 index 0000000..51397e3 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.c @@ -0,0 +1,283 @@ +/* + * Copyright (c) 2013-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +// +// Functions for invocation of MacDispatcher callbacks +// +// This file is included in gpMacDispatcher.c (normal stack or server side) +// and in gpMacDispatcher_clientWrapper.c (client side) +// and in utTbc_gpMacDispatcher.c (unit test) +// +// These functions forward the callback event via the public callback registration API. +// + +static void MacDispatcher_cbDataIndication(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 dsn, + gpMacCore_Security_t *pSecOptions, gpPd_Loh_t pdLoh, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->dataIndicationCallback) + { + pCallbacks->dataIndicationCallback(pSrcAddrInfo, pDstAddrInfo, dsn, pSecOptions, pdLoh, stackId); + } + else + { + // Callback is responsible for freeing pdHandle. + GP_LOG_PRINTF("WARNING: MacDispatcher_cbDataIndication has no handler registered", 0); + gpPd_FreePd(pdLoh.handle); + } +} + +static void MacDispatcher_cbDataConfirm(gpMacCore_Result_t status, UInt8 pdHandle, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + // get data related callback. + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->dataConfirmCallback) + { + pCallbacks->dataConfirmCallback(status, pdHandle, stackId); + } + else + { + // Callback is responsible for freeing pdHandle. + if (pdHandle != GP_PD_INVALID_HANDLE) + { + gpPd_FreePd(pdHandle); + } + } +} +static void MacDispatcher_cbPollIndication(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->pollIndicationCallback) + { + pCallbacks->pollIndicationCallback(pAddrInfo, rxTime, stackId); + } +} + +static void MacDispatcher_cbPollNotify(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpPd_Handle_t pdHandle, Bool fromNeighbour, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->pollNotifyCallback) + { + pCallbacks->pollNotifyCallback(pAddrInfo, rxTime, pdHandle, fromNeighbour, stackId); + } +} +static void MacDispatcher_cbPollConfirm(gpMacCore_Result_t status, gpMacCore_AddressInfo_t* pCoordAddrInfo, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->pollConfirmCallback) + { + pCallbacks->pollConfirmCallback(status, pCoordAddrInfo, txTime, stackId); + } +} +static void MacDispatcher_cbPurgeConfirm(gpMacCore_Result_t status, gpPd_Handle_t pdHandle, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->purgeConfirmCallback) + { + pCallbacks->purgeConfirmCallback(status, pdHandle, stackId); + } + else + { + if (status == gpMacCore_ResultSuccess) + { + // Callback is responsible for freeing pdHandle after succesful purge. + GP_ASSERT_DEV_INT(false); + if (pdHandle != GP_PD_INVALID_HANDLE) + { + gpPd_FreePd(pdHandle); + } + } + } +} +static void MacDispatcher_cbBeaconNotifyIndication(UInt8 bsn, gpMacCore_PanDescriptor_t* pPanDescriptor, UInt8 beaconPayloadLength , UInt8 *pBeaconPayload, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->beaconNotifyIndicationCallback) + { + pCallbacks->beaconNotifyIndicationCallback(bsn, pPanDescriptor, beaconPayloadLength , pBeaconPayload, stackId); + } +} +static void MacDispatcher_cbAssociateIndication(gpMacCore_Address_t* pDeviceAddress, UInt8 capabilityInformation, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->assocIndicationCallback) + { + pCallbacks->assocIndicationCallback(pDeviceAddress, capabilityInformation, rxTime, stackId); + } +} +static void MacDispatcher_cbAssociateConfirm(UInt16 assocShortAddress, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->assocConfirmCallback) + { + pCallbacks->assocConfirmCallback(assocShortAddress, status, txTime, stackId); + } +} + +static void MacDispatcher_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, UInt32 unscannedChannels, UInt8 resultListSize, UInt8* pEdScanResultList, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->scanConfirmCallback) + { + pCallbacks->scanConfirmCallback(status, scanType, unscannedChannels, resultListSize, pEdScanResultList, stackId); + } +} + +static void MacDispatcher_cbOrphanIndication(MACAddress_t* pOrphanAddress, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->orphanIndicationCallback) + { + pCallbacks->orphanIndicationCallback(pOrphanAddress, rxTime, stackId); + } +} + +static void MacDispatcher_cbSecurityFailureCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->securityFailureCommStatusIndicationCallback) + { + pCallbacks->securityFailureCommStatusIndicationCallback(pSrcAddrInfo, pDstAddrInfo, status, txTime, stackId); + } +} + +static void MacDispatcher_cbSecurityFrameCounterIndication(UInt32 frameCounter, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->securityFrameCounterIndicationCallback) + { + pCallbacks->securityFrameCounterIndicationCallback(frameCounter, stackId); + } +} +static void MacDispatcher_cbAssociateCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->associateCommStatusIndicationCallback) + { + pCallbacks->associateCommStatusIndicationCallback(pSrcAddrInfo, pDstAddrInfo, status, txTime, stackId); + } +} +static void MacDispatcher_cbOrphanCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->orphanCommStatusIndicationCallback) + { + pCallbacks->orphanCommStatusIndicationCallback(pSrcAddrInfo, pDstAddrInfo, status, txTime, stackId); + } +} +void MacDispatcher_cbDriverResetIndication(gpMacDispatcher_Result_t status, gpMacDispatcher_StackId_t stackId) +{ + gpMacDispatcher_Callbacks_t* pCallbacks; + + GP_LOG_PRINTF("%s called stack %u", 0, __FUNCTION__, stackId); + + pCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pCallbacks != NULL && pCallbacks->driverResetIndicationCallback) + { + if(status == gpMacDispatcher_ResultSecondStackRegistered) + { + GP_LOG_SYSTEM_PRINTF("ERROR: Second stack with same ID was registered",0); + } + else + { + GP_LOG_SYSTEM_PRINTF("Driver reset Ind %u %x",0, stackId, status); + } + pCallbacks->driverResetIndicationCallback(status, stackId); + } +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.h new file mode 100644 index 0000000..f4d861e --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_callbacks.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#ifndef _GP_MACDISPATCHERCALLBACKS_H_ +#define _GP_MACDISPATCHERCALLBACKS_H_ + +#include "global.h" +#include "gpMacCore.h" +#include "gpMacDispatcher.h" + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +//Data callbacks + +static void MacDispatcher_cbDataIndication(const gpMacCore_AddressInfo_t* pSrcAddrInfo, const gpMacCore_AddressInfo_t* pDstAddrInfo, UInt8 dsn, + gpMacCore_Security_t *pSecOptions, gpPd_Loh_t pdLoh, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbDataConfirm(gpMacCore_Result_t status, UInt8 pdHandle, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbPurgeConfirm(gpMacCore_Result_t status, gpPd_Handle_t pdHandle, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbPollNotify(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpPd_Handle_t pdHandle, Bool fromNeighbour, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbPollIndication(gpMacCore_AddressInfo_t* pAddrInfo, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbPollConfirm(gpMacCore_Result_t status, gpMacCore_AddressInfo_t* pCoordAddrInfo, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); + +//Misc callbacks +static void MacDispatcher_cbBeaconNotifyIndication(UInt8 bsn, gpMacCore_PanDescriptor_t* pPanDescriptor, UInt8 beaconPayloadLength , UInt8 *pBeaconPayload, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbAssociateIndication(gpMacCore_Address_t* pDeviceAddress, UInt8 capabilityInformation, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbAssociateCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbOrphanIndication(MACAddress_t* pOrphanAddress, gpPd_TimeStamp_t rxTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbAssociateConfirm(UInt16 assocShortAddress, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbOrphanCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbScanConfirm(gpMacCore_Result_t status, gpMacCore_ScanType_t scanType, UInt32 unscannedChannels, UInt8 resultListSize, UInt8* pEdScanResultList, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbSecurityFailureCommStatusIndication(gpMacCore_AddressInfo_t* pSrcAddrInfo, gpMacCore_AddressInfo_t* pDstAddrInfo, gpMacCore_Result_t status, gpPd_TimeStamp_t txTime, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbSecurityFrameCounterIndication(UInt32 frameCounter, gpMacDispatcher_StackId_t stackId); +static void MacDispatcher_cbDriverResetIndication(gpMacDispatcher_Result_t status, gpMacDispatcher_StackId_t stackId); + +#endif //_GP_MACDISPATCHERCALLBACKS_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_def.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_def.h new file mode 100644 index 0000000..de16064 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_def.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#ifndef _GP_MACDISPATCHERDEF_H_ +#define _GP_MACDISPATCHERDEF_H_ + +#include "global.h" +#include "gpMacCore.h" +#include "gpMacDispatcher.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct gpMacDispatcher_StackMapping_s { + gpMacDispatcher_StringIdentifier_t stringId; + gpMacDispatcher_StackId_t numericId; + gpMacDispatcher_Callbacks_t callbacks; +} gpMacDispatcher_StackMapping_t; + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Internal non-static declarations + *****************************************************************************/ +extern gpMacDispatcher_StackMapping_t gpMacDispatcher_StackMapping[GP_DIVERSITY_NR_OF_STACKS]; + +#if GP_DIVERSITY_NR_OF_STACKS > 1 +gpMacDispatcher_Callbacks_t* MacDispatcher_GetCallbacks(UInt8 stackId); +#else +#define MacDispatcher_GetCallbacks(stackId) (&gpMacDispatcher_StackMapping[0].callbacks) +#endif //GP_DIVERSITY_NR_OF_STACKS > 1 + +void MacDispatcher_InitStackMapping(void); +void MacDispatcher_UnRegisterCallbacks(UInt8 stackId); + +#define MacDispatcher_InitAutoTxAntennaToggling(stackId) ((void)0) +#define MacDispatcher_HandleAutoTxAntennaToggling(status, stackId) ((void)0) + +#endif //_GP_MACDISPATCHERDEF_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c new file mode 100644 index 0000000..88516ae --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpMacDispatcher/src/gpMacDispatcher_stackMapping.c @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_MACDISPATCHER + +//Show all calls for debugging +//#define GP_LOCAL_LOG + +#include "gpMacCore.h" +#include "gpMacDispatcher.h" +#include "gpMacDispatcher_def.h" +#include "gpLog.h" +#include "gpAssert.h" + +#ifndef GP_DIVERSITY_NR_OF_STACKS +#warning You did not provide a number of stacks. Taking 1 as default + +#define GP_DIVERSITY_NR_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +gpMacDispatcher_StackMapping_t gpMacDispatcher_StackMapping[GP_DIVERSITY_NR_OF_STACKS]; + +void MacDispatcher_InitStackMapping(void) +{ + UIntLoop stackMapIndex; + for(stackMapIndex = 0; stackMapIndex < GP_DIVERSITY_NR_OF_STACKS; stackMapIndex++) + { + // code shared with unregisterNetworkStack + gpMacDispatcher_StackMapping[stackMapIndex].numericId = GP_MAC_DISPATCHER_INVALID_STACK_ID; + MEMSET(gpMacDispatcher_StackMapping[stackMapIndex].stringId.str, -1, sizeof(gpMacDispatcher_StringIdentifier_t)); + } +} + +void gpMacDispatcher_RegisterCallbacks(gpMacDispatcher_StackId_t stackId, gpMacDispatcher_Callbacks_t* pCallbacks) +{ + UIntLoop stackMapIndex; + + GP_ASSERT_DEV_EXT(pCallbacks); + for(stackMapIndex = 0; stackMapIndex < GP_DIVERSITY_NR_OF_STACKS; stackMapIndex++) + { + // find entry previously used by the same stackId. + if(gpMacDispatcher_StackMapping[stackMapIndex].numericId == stackId) + { + MEMCPY(&gpMacDispatcher_StackMapping[stackMapIndex].callbacks,pCallbacks,sizeof(gpMacDispatcher_Callbacks_t)); + return; + } + } + for(stackMapIndex = 0; stackMapIndex < GP_DIVERSITY_NR_OF_STACKS; stackMapIndex++) + { + // find empty entry. + if(gpMacDispatcher_StackMapping[stackMapIndex].numericId == GP_MAC_DISPATCHER_INVALID_STACK_ID) + { + gpMacDispatcher_StackMapping[stackMapIndex].numericId = stackId; + MEMCPY(&gpMacDispatcher_StackMapping[stackMapIndex].callbacks,pCallbacks,sizeof(gpMacDispatcher_Callbacks_t)); + return; + } + } + GP_ASSERT_DEV_INT(false); + return; +} + +void gpMacDispatcher_GetCallbacks(gpMacDispatcher_StackId_t stackId, gpMacDispatcher_Callbacks_t* pCallbacks) +{ + gpMacDispatcher_Callbacks_t* pLookupCallbacks; + + if(pCallbacks == NULL) + { + GP_ASSERT_DEV_EXT(false); + return; + } + + pLookupCallbacks = MacDispatcher_GetCallbacks(stackId); + if(pLookupCallbacks == NULL) + { + GP_ASSERT_DEV_INT(false); + return; + } + + MEMCPY(pCallbacks, pLookupCallbacks, sizeof(gpMacDispatcher_Callbacks_t)); +} + +void MacDispatcher_UnRegisterCallbacks(UInt8 stackId) +{ + UIntLoop i; + + for(i = 0; i < GP_DIVERSITY_NR_OF_STACKS; i++) + { + if(gpMacDispatcher_StackMapping[i].numericId == stackId) + { + gpMacDispatcher_StackMapping[i].numericId = GP_MAC_DISPATCHER_INVALID_STACK_ID; + MEMSET(gpMacDispatcher_StackMapping[i].stringId.str, -1, sizeof(gpMacDispatcher_StringIdentifier_t)); + return; + } + } + GP_ASSERT_DEV_INT(false); +} + +#if GP_DIVERSITY_NR_OF_STACKS > 1 +gpMacDispatcher_Callbacks_t* MacDispatcher_GetCallbacks(UInt8 stackId) +{ + UIntLoop stackMapIndex; + for(stackMapIndex = 0; stackMapIndex < GP_DIVERSITY_NR_OF_STACKS; stackMapIndex++) + { + // find entry previously used by the same stackId. + if(gpMacDispatcher_StackMapping[stackMapIndex].numericId == stackId) + { + return &(gpMacDispatcher_StackMapping[stackMapIndex].callbacks); + } + } + // no entry found. + return NULL; +} +#endif //GP_DIVERSITY_NR_OF_STACKS > 1 diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_clientServerCmdId.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_clientServerCmdId.h new file mode 100644 index 0000000..365e424 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_clientServerCmdId.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRxArbiter_clientServerCmdId.h" + * + * RxArbiter + * + * Client Server Link Command IDs +*/ + +#ifndef _GPRXARBITER_CLIENTSERVERCMDID_H_ +#define _GPRXARBITER_CLIENTSERVERCMDID_H_ + +/***************************************************************************** + * Common timeout + *****************************************************************************/ + +#ifndef GPRXARBITER_GPCOMTIMEOUT_US +#define GPRXARBITER_GPCOMTIMEOUT_US 10000000UL //10s +#endif //GPRXARBITER_GPCOMTIMEOUT_US + +/***************************************************************************** + * Component Specific Command IDs + *****************************************************************************/ + +#define gpRxArbiter_ResetStack_CmdId 0x02 /*02*/ +#define gpRxArbiter_SetStackChannel_CmdId 0x03 /*03*/ +#define gpRxArbiter_GetStackChannel_CmdId 0x04 /*04*/ +#define gpRxArbiter_GetCurrentRxOnState_CmdId 0x05 /*05*/ +#define gpRxArbiter_GetCurrentRxChannel_CmdId 0x06 /*06*/ +#define gpRxArbiter_SetStackRxOn_CmdId 0x07 /*07*/ +#define gpRxArbiter_GetStackRxOn_CmdId 0x08 /*08*/ +#define gpRxArbiter_SetDutyCycleOnOffTimes_CmdId 0x09 /*09*/ +#define gpRxArbiter_EnableDutyCycling_CmdId 0x0a /*10*/ +#define gpRxArbiter_GetDutyCycleEnabled_CmdId 0x0b /*11*/ +#define gpRxArbiter_SetStackPriority_CmdId 0x0c /*12*/ +#define gpRxArbiter_IsAnActiveChannel_CmdId 0x11 /*17*/ +#define gpRxArbiter_EnableRxWindows_CmdId 0x12 /*18*/ +#define gpRxArbiter_DisableRxWindows_CmdId 0x13 /*19*/ +#define gpRxArbiter_cbSetFaModeNotification_CmdId 0x0e /*14*/ +#define gpRxArbiter_cbChannelUpdateNotification_CmdId 0x10 /*16*/ + +/***************************************************************************** + * Fixed Command IDs + *****************************************************************************/ + +#define gpRxArbiter_Acknowledge_CmdId 0xfe /*254*/ +#define gpRxArbiter_GetServerCompatibilityNumber_CmdId 0xfd /*253*/ + +#endif //_GPRXARBITER_CLIENTSERVERCMDID_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_marshalling.h new file mode 100644 index 0000000..f0a19c7 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen/gpRxArbiter_marshalling.h @@ -0,0 +1,524 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPRXARBITER_MARSHALLING_H_ +#define _GPRXARBITER_MARSHALLING_H_ + +//DOCUMENTATION RXARBITER: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpRxArbiter.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +typedef struct { + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_ResetStack_Input_struct_t; + +typedef struct { + gpRxArbiter_ResetStack_Input_struct_t data; +} gpRxArbiter_ResetStack_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_ResetStack_Output_struct_t; + +typedef struct { + gpRxArbiter_ResetStack_Output_struct_t data; +} gpRxArbiter_ResetStack_Output_marshall_struct_t; + + +typedef struct { + UInt8 channel; + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_SetStackChannel_Input_struct_t; + +typedef struct { + gpRxArbiter_SetStackChannel_Input_struct_t data; +} gpRxArbiter_SetStackChannel_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_SetStackChannel_Output_struct_t; + +typedef struct { + gpRxArbiter_SetStackChannel_Output_struct_t data; +} gpRxArbiter_SetStackChannel_Output_marshall_struct_t; + + +typedef struct { + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_GetStackChannel_Input_struct_t; + +typedef struct { + gpRxArbiter_GetStackChannel_Input_struct_t data; +} gpRxArbiter_GetStackChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 channel; +} gpRxArbiter_GetStackChannel_Output_struct_t; + +typedef struct { + gpRxArbiter_GetStackChannel_Output_struct_t data; +} gpRxArbiter_GetStackChannel_Output_marshall_struct_t; + + +typedef struct { + Bool rxon; +} gpRxArbiter_GetCurrentRxOnState_Output_struct_t; + +typedef struct { + gpRxArbiter_GetCurrentRxOnState_Output_struct_t data; +} gpRxArbiter_GetCurrentRxOnState_Output_marshall_struct_t; + + +typedef struct { + UInt8 currentChannel; +} gpRxArbiter_GetCurrentRxChannel_Output_struct_t; + +typedef struct { + gpRxArbiter_GetCurrentRxChannel_Output_struct_t data; +} gpRxArbiter_GetCurrentRxChannel_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_SetStackRxOn_Input_struct_t; + +typedef struct { + gpRxArbiter_SetStackRxOn_Input_struct_t data; +} gpRxArbiter_SetStackRxOn_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_SetStackRxOn_Output_struct_t; + +typedef struct { + gpRxArbiter_SetStackRxOn_Output_struct_t data; +} gpRxArbiter_SetStackRxOn_Output_marshall_struct_t; + + +typedef struct { + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_GetStackRxOn_Input_struct_t; + +typedef struct { + gpRxArbiter_GetStackRxOn_Input_struct_t data; +} gpRxArbiter_GetStackRxOn_Input_marshall_struct_t; + +typedef struct { + Bool enable; +} gpRxArbiter_GetStackRxOn_Output_struct_t; + +typedef struct { + gpRxArbiter_GetStackRxOn_Output_struct_t data; +} gpRxArbiter_GetStackRxOn_Output_marshall_struct_t; + + +typedef struct { + UInt32 onTimeUs; + UInt32 offTimeUs; + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_SetDutyCycleOnOffTimes_Input_struct_t; + +typedef struct { + gpRxArbiter_SetDutyCycleOnOffTimes_Input_struct_t data; +} gpRxArbiter_SetDutyCycleOnOffTimes_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_SetDutyCycleOnOffTimes_Output_struct_t; + +typedef struct { + gpRxArbiter_SetDutyCycleOnOffTimes_Output_struct_t data; +} gpRxArbiter_SetDutyCycleOnOffTimes_Output_marshall_struct_t; + + +typedef struct { + Bool enable; + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_EnableDutyCycling_Input_struct_t; + +typedef struct { + gpRxArbiter_EnableDutyCycling_Input_struct_t data; +} gpRxArbiter_EnableDutyCycling_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_EnableDutyCycling_Output_struct_t; + +typedef struct { + gpRxArbiter_EnableDutyCycling_Output_struct_t data; +} gpRxArbiter_EnableDutyCycling_Output_marshall_struct_t; + + +typedef struct { + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_GetDutyCycleEnabled_Input_struct_t; + +typedef struct { + gpRxArbiter_GetDutyCycleEnabled_Input_struct_t data; +} gpRxArbiter_GetDutyCycleEnabled_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpRxArbiter_GetDutyCycleEnabled_Output_struct_t; + +typedef struct { + gpRxArbiter_GetDutyCycleEnabled_Output_struct_t data; +} gpRxArbiter_GetDutyCycleEnabled_Output_marshall_struct_t; + + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +typedef struct { + UInt8 priority; + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_SetStackPriority_Input_struct_t; + +typedef struct { + gpRxArbiter_SetStackPriority_Input_struct_t data; +} gpRxArbiter_SetStackPriority_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_SetStackPriority_Output_struct_t; + +typedef struct { + gpRxArbiter_SetStackPriority_Output_struct_t data; +} gpRxArbiter_SetStackPriority_Output_marshall_struct_t; + +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +typedef struct { + gpRxArbiter_StackId_t stackId; + gpRxArbiter_cbSetFaMode_t callback; +} gpRxArbiter_RegisterSetFaModeCallback_Input_struct_t; + +typedef struct { + gpRxArbiter_RegisterSetFaModeCallback_Input_struct_t data; +} gpRxArbiter_RegisterSetFaModeCallback_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_RegisterSetFaModeCallback_Output_struct_t; + +typedef struct { + gpRxArbiter_RegisterSetFaModeCallback_Output_struct_t data; +} gpRxArbiter_RegisterSetFaModeCallback_Output_marshall_struct_t; + +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +typedef struct { + gpRxArbiter_StackId_t stackId; + gpRxArbiter_cbChannelUpdate_t callback; +} gpRxArbiter_RegisterChannelUpdateCallback_Input_struct_t; + +typedef struct { + gpRxArbiter_RegisterChannelUpdateCallback_Input_struct_t data; +} gpRxArbiter_RegisterChannelUpdateCallback_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_RegisterChannelUpdateCallback_Output_struct_t; + +typedef struct { + gpRxArbiter_RegisterChannelUpdateCallback_Output_struct_t data; +} gpRxArbiter_RegisterChannelUpdateCallback_Output_marshall_struct_t; + +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +typedef struct { + gpRxArbiter_StackId_t stackId; + UInt8 channel; +} gpRxArbiter_IsAnActiveChannel_Input_struct_t; + +typedef struct { + gpRxArbiter_IsAnActiveChannel_Input_struct_t data; +} gpRxArbiter_IsAnActiveChannel_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpRxArbiter_IsAnActiveChannel_Output_struct_t; + +typedef struct { + gpRxArbiter_IsAnActiveChannel_Output_struct_t data; +} gpRxArbiter_IsAnActiveChannel_Output_marshall_struct_t; + + +typedef struct { + UInt8 channel; + UInt32 dutyCycleOnTime; + UInt32 dutyCyclePeriod; + UInt16 recurrenceAmount; + UInt32 startTime; + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_EnableRxWindows_Input_struct_t; + +typedef struct { + gpRxArbiter_EnableRxWindows_Input_struct_t data; +} gpRxArbiter_EnableRxWindows_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_EnableRxWindows_Output_struct_t; + +typedef struct { + gpRxArbiter_EnableRxWindows_Output_struct_t data; +} gpRxArbiter_EnableRxWindows_Output_marshall_struct_t; + + +typedef struct { + gpRxArbiter_StackId_t stackId; +} gpRxArbiter_DisableRxWindows_Input_struct_t; + +typedef struct { + gpRxArbiter_DisableRxWindows_Input_struct_t data; +} gpRxArbiter_DisableRxWindows_Input_marshall_struct_t; + +typedef struct { + gpRxArbiter_Result_t result; +} gpRxArbiter_DisableRxWindows_Output_struct_t; + +typedef struct { + gpRxArbiter_DisableRxWindows_Output_struct_t data; +} gpRxArbiter_DisableRxWindows_Output_marshall_struct_t; + + +typedef struct { + gpRxArbiter_StackId_t stackId; + gpRxArbiter_FaMode_t mode; +} gpRxArbiter_cbSetFaModeNotification_Input_struct_t; + +typedef struct { + gpRxArbiter_cbSetFaModeNotification_Input_struct_t data; +} gpRxArbiter_cbSetFaModeNotification_Input_marshall_struct_t; + + +typedef struct { + gpRxArbiter_StackId_t stackId; + UInt8 channel; +} gpRxArbiter_cbChannelUpdateNotification_Input_struct_t; + +typedef struct { + gpRxArbiter_cbChannelUpdateNotification_Input_struct_t data; +} gpRxArbiter_cbChannelUpdateNotification_Input_marshall_struct_t; + + +typedef union { + gpRxArbiter_ResetStack_Input_marshall_struct_t gpRxArbiter_ResetStack; + gpRxArbiter_SetStackChannel_Input_marshall_struct_t gpRxArbiter_SetStackChannel; + gpRxArbiter_GetStackChannel_Input_marshall_struct_t gpRxArbiter_GetStackChannel; + gpRxArbiter_SetStackRxOn_Input_marshall_struct_t gpRxArbiter_SetStackRxOn; + gpRxArbiter_GetStackRxOn_Input_marshall_struct_t gpRxArbiter_GetStackRxOn; + gpRxArbiter_SetDutyCycleOnOffTimes_Input_marshall_struct_t gpRxArbiter_SetDutyCycleOnOffTimes; + gpRxArbiter_EnableDutyCycling_Input_marshall_struct_t gpRxArbiter_EnableDutyCycling; + gpRxArbiter_GetDutyCycleEnabled_Input_marshall_struct_t gpRxArbiter_GetDutyCycleEnabled; +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_SetStackPriority_Input_marshall_struct_t gpRxArbiter_SetStackPriority; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_RegisterSetFaModeCallback_Input_marshall_struct_t gpRxArbiter_RegisterSetFaModeCallback; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_RegisterChannelUpdateCallback_Input_marshall_struct_t gpRxArbiter_RegisterChannelUpdateCallback; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + gpRxArbiter_IsAnActiveChannel_Input_marshall_struct_t gpRxArbiter_IsAnActiveChannel; + gpRxArbiter_EnableRxWindows_Input_marshall_struct_t gpRxArbiter_EnableRxWindows; + gpRxArbiter_DisableRxWindows_Input_marshall_struct_t gpRxArbiter_DisableRxWindows; + UInt8 dummy; //ensure none empty union definition +} gpRxArbiter_Server_Input_union_t; + +typedef union { + gpRxArbiter_ResetStack_Output_marshall_struct_t gpRxArbiter_ResetStack; + gpRxArbiter_SetStackChannel_Output_marshall_struct_t gpRxArbiter_SetStackChannel; + gpRxArbiter_GetStackChannel_Output_marshall_struct_t gpRxArbiter_GetStackChannel; + gpRxArbiter_GetCurrentRxOnState_Output_marshall_struct_t gpRxArbiter_GetCurrentRxOnState; + gpRxArbiter_GetCurrentRxChannel_Output_marshall_struct_t gpRxArbiter_GetCurrentRxChannel; + gpRxArbiter_SetStackRxOn_Output_marshall_struct_t gpRxArbiter_SetStackRxOn; + gpRxArbiter_GetStackRxOn_Output_marshall_struct_t gpRxArbiter_GetStackRxOn; + gpRxArbiter_SetDutyCycleOnOffTimes_Output_marshall_struct_t gpRxArbiter_SetDutyCycleOnOffTimes; + gpRxArbiter_EnableDutyCycling_Output_marshall_struct_t gpRxArbiter_EnableDutyCycling; + gpRxArbiter_GetDutyCycleEnabled_Output_marshall_struct_t gpRxArbiter_GetDutyCycleEnabled; +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_SetStackPriority_Output_marshall_struct_t gpRxArbiter_SetStackPriority; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_RegisterSetFaModeCallback_Output_marshall_struct_t gpRxArbiter_RegisterSetFaModeCallback; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) + gpRxArbiter_RegisterChannelUpdateCallback_Output_marshall_struct_t gpRxArbiter_RegisterChannelUpdateCallback; +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + gpRxArbiter_IsAnActiveChannel_Output_marshall_struct_t gpRxArbiter_IsAnActiveChannel; + gpRxArbiter_EnableRxWindows_Output_marshall_struct_t gpRxArbiter_EnableRxWindows; + gpRxArbiter_DisableRxWindows_Output_marshall_struct_t gpRxArbiter_DisableRxWindows; + UInt8 dummy; //ensure none empty union definition +} gpRxArbiter_Server_Output_union_t; + +typedef union { + gpRxArbiter_cbSetFaModeNotification_Input_marshall_struct_t gpRxArbiter_cbSetFaModeNotification; + gpRxArbiter_cbChannelUpdateNotification_Input_marshall_struct_t gpRxArbiter_cbChannelUpdateNotification; + UInt8 dummy; //ensure none empty union definition +} gpRxArbiter_Client_Input_union_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpRxArbiter_StackId_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_StackId_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_StackId_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_StackId_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpRxArbiter_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpRxArbiter_FaMode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_FaMode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_FaMode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_FaMode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpRxArbiter_cbChannelUpdate_t_buf2api(pDest, pSource, length, pIndex) void_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_cbChannelUpdate_t_api2buf(pDest, pSource, length, pIndex) void_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_cbChannelUpdate_t_buf2api_1(pDest, pSource, pIndex) void_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_cbChannelUpdate_t_api2buf_1(pDest, pSource, pIndex) void_api2buf_1(pDest, pSource, pIndex) +#define gpRxArbiter_cbSetFaMode_t_buf2api(pDest, pSource, length, pIndex) void_buf2api(pDest, pSource, length, pIndex) +#define gpRxArbiter_cbSetFaMode_t_api2buf(pDest, pSource, length, pIndex) void_api2buf(pDest, pSource, length, pIndex) +#define gpRxArbiter_cbSetFaMode_t_buf2api_1(pDest, pSource, pIndex) void_buf2api_1(pDest, pSource, pIndex) +#define gpRxArbiter_cbSetFaMode_t_api2buf_1(pDest, pSource, pIndex) void_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +// Server functions +gpMarshall_AckStatus_t gpRxArbiter_ResetStack_Input_buf2api(gpRxArbiter_ResetStack_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_ResetStack_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_ResetStack_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_ResetStack_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_SetStackChannel_Input_buf2api(gpRxArbiter_SetStackChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackChannel_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_SetStackChannel_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_SetStackChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_GetStackChannel_Input_buf2api(gpRxArbiter_GetStackChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetStackChannel_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetStackChannel_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_GetStackChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpRxArbiter_GetCurrentRxOnState_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetCurrentRxOnState_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +void gpRxArbiter_GetCurrentRxChannel_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetCurrentRxChannel_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_SetStackRxOn_Input_buf2api(gpRxArbiter_SetStackRxOn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackRxOn_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_SetStackRxOn_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_SetStackRxOn_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_GetStackRxOn_Input_buf2api(gpRxArbiter_GetStackRxOn_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetStackRxOn_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetStackRxOn_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_GetStackRxOn_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_SetDutyCycleOnOffTimes_Input_buf2api(gpRxArbiter_SetDutyCycleOnOffTimes_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetDutyCycleOnOffTimes_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_SetDutyCycleOnOffTimes_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_SetDutyCycleOnOffTimes_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_EnableDutyCycling_Input_buf2api(gpRxArbiter_EnableDutyCycling_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_EnableDutyCycling_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_EnableDutyCycling_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_EnableDutyCycling_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_GetDutyCycleEnabled_Input_buf2api(gpRxArbiter_GetDutyCycleEnabled_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetDutyCycleEnabled_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_GetDutyCycleEnabled_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_GetDutyCycleEnabled_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +gpMarshall_AckStatus_t gpRxArbiter_SetStackPriority_Input_buf2api(gpRxArbiter_SetStackPriority_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackPriority_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_SetStackPriority_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_SetStackPriority_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +gpMarshall_AckStatus_t gpRxArbiter_RegisterSetFaModeCallback_Input_buf2api(gpRxArbiter_RegisterSetFaModeCallback_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_RegisterSetFaModeCallback_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_RegisterSetFaModeCallback_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_RegisterSetFaModeCallback_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +gpMarshall_AckStatus_t gpRxArbiter_RegisterChannelUpdateCallback_Input_buf2api(gpRxArbiter_RegisterChannelUpdateCallback_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_RegisterChannelUpdateCallback_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_RegisterChannelUpdateCallback_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_RegisterChannelUpdateCallback_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +gpMarshall_AckStatus_t gpRxArbiter_IsAnActiveChannel_Input_buf2api(gpRxArbiter_IsAnActiveChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_IsAnActiveChannel_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_IsAnActiveChannel_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_IsAnActiveChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_EnableRxWindows_Input_buf2api(gpRxArbiter_EnableRxWindows_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_EnableRxWindows_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_EnableRxWindows_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_EnableRxWindows_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_DisableRxWindows_Input_buf2api(gpRxArbiter_DisableRxWindows_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_DisableRxWindows_Output_api2buf(UInt8Buffer* pDest , gpRxArbiter_DisableRxWindows_Output_marshall_struct_t* pSourceoutput , gpRxArbiter_DisableRxWindows_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpRxArbiter_cbSetFaModeNotification_Input_par2api(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , gpRxArbiter_FaMode_t mode , UInt16* pIndex); +void gpRxArbiter_cbChannelUpdateNotification_Input_par2api(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt16* pIndex); + +// Client functions +void gpRxArbiter_ResetStack_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_ResetStack_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_SetStackChannel_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 channel , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetStackChannel_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_GetStackChannel_Output_buf2par(UInt8* channel , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetCurrentRxOnState_Output_buf2par(Bool* rxon , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetCurrentRxChannel_Output_buf2par(UInt8* currentChannel , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetStackRxOn_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_SetStackRxOn_Output_buf2par(gpRxArbiter_Result_t* result , Bool enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetStackRxOn_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_GetStackRxOn_Output_buf2par(Bool* enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_SetDutyCycleOnOffTimes_Input_par2buf(UInt8Buffer* pDest , UInt32 onTimeUs , UInt32 offTimeUs , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_SetDutyCycleOnOffTimes_Output_buf2par(gpRxArbiter_Result_t* result , UInt32 onTimeUs , UInt32 offTimeUs , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_EnableDutyCycling_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_EnableDutyCycling_Output_buf2par(gpRxArbiter_Result_t* result , Bool enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_GetDutyCycleEnabled_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_GetDutyCycleEnabled_Output_buf2par(Bool* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_SetStackPriority_Input_par2buf(UInt8Buffer* pDest , UInt8 priority , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_SetStackPriority_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 priority , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_RegisterSetFaModeCallback_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , gpRxArbiter_cbSetFaMode_t callback , UInt16* pIndex); +void gpRxArbiter_RegisterSetFaModeCallback_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , gpRxArbiter_cbSetFaMode_t callback , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_RegisterChannelUpdateCallback_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , gpRxArbiter_cbChannelUpdate_t callback , UInt16* pIndex); +void gpRxArbiter_RegisterChannelUpdateCallback_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , gpRxArbiter_cbChannelUpdate_t callback , UInt8Buffer* pSource , UInt16* pIndex); +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ +void gpRxArbiter_IsAnActiveChannel_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt16* pIndex); +void gpRxArbiter_IsAnActiveChannel_Output_buf2par(Bool* result , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_EnableRxWindows_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , UInt32 dutyCycleOnTime , UInt32 dutyCyclePeriod , UInt16 recurrenceAmount , UInt32 startTime , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_EnableRxWindows_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 channel , UInt32 dutyCycleOnTime , UInt32 dutyCyclePeriod , UInt16 recurrenceAmount , UInt32 startTime , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +void gpRxArbiter_DisableRxWindows_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex); +void gpRxArbiter_DisableRxWindows_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_cbSetFaModeNotification_Input_buf2api(gpRxArbiter_cbSetFaModeNotification_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpRxArbiter_cbChannelUpdateNotification_Input_buf2api(gpRxArbiter_cbChannelUpdateNotification_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); + +void gpRxArbiter_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPRXARBITER_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gpRxArbiter.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gpRxArbiter.h new file mode 100644 index 0000000..fd216cb --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gpRxArbiter.h @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpRxArbiter.h + * This file contains the definitions of the public functions and enumerations of the gpRxArbiter. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GP_RX_ARBITER_H_ +#define _GP_RX_ARBITER_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "global.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifdef GP_DIVERSITY_NR_OF_STACKS +#define GP_RX_ARBITER_NUMBER_OF_STACKS GP_DIVERSITY_NR_OF_STACKS +#else//GP_DIVERSITY_NR_OF_STACKS +#define GP_RX_ARBITER_NUMBER_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS + +#define GP_RX_ARBITER_INVALID_CHANNEL 0xFF + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +#define GP_RXARBITER_CHECK_CHANNEL_VALID(channel) (((channel) >= 11) && ((channel) <= 26)) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @name gpRxArbiter_FaMode_t*/ +//@{ +/** @ingroup GEN_FA + * @brief The frequency agility is disabled. +*/ +#define gpRxArbiter_FaModeDisabled 0x00 +/** @ingroup GEN_FA + * @brief The frequency agility is enabled. +*/ +#define gpRxArbiter_FaModeEnabled 0x01 +/** @ingroup GEN_FA + * @brief The frequency agility is running in power save mode. +*/ +typedef UInt8 gpRxArbiter_FaMode_t ; +//@} + +typedef UInt8 gpRxArbiter_StackId_t; +#define gpRxArbiter_StackIdRf4ce 0x0 +#define gpRxArbiter_StackIdZigBeePro 0x1 +#define gpRxArbiter_StackIdZigBeeIp 0x2 +#define gpRxArbiter_StackIdInvalid 0xFF + +typedef UInt8 gpRxArbiter_Result_t; +#define gpRxArbiter_ResultSuccess 0x0 +#define gpRxArbiter_ResultInvalidArgument 0x1 + +typedef UInt8 gpRxArbiter_RadioState_t; +#define gpRxArbiter_RadioStateOff 0 +#define gpRxArbiter_RadioStateOn 1 +#define gpRxArbiter_RadioStateDutyCycle 2 +#define gpRxArbiter_RadioStateInvalid 0xff +#define gpRxArbiter_RadioStateActive(state) (state==gpRxArbiter_RadioStateOn || state==gpRxArbiter_RadioStateDutyCycle) + +typedef void (* gpRxArbiter_cbSetFaMode_t)(gpRxArbiter_StackId_t stackId, gpRxArbiter_FaMode_t mode) ; +typedef void (* gpRxArbiter_cbChannelUpdate_t)(gpRxArbiter_StackId_t stackId, UInt8 channel) ; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpRxArbiter_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +void gpRxArbiter_Init( void ); +void gpRxArbiter_DeInit( void ); + +//Added for enabling 3 Rx channels for multichannel listen over MAC +gpRxArbiter_Result_t gpRxArbiter_SetMultipleChannelTable(UInt8* pChannel , gpRxArbiter_StackId_t stackId); +UInt8 gpRxArbiter_GetStackSlotChannel(UInt8 slotnumber , gpRxArbiter_StackId_t stackId); + +gpRxArbiter_Result_t gpRxArbiter_ResetStack( gpRxArbiter_StackId_t stackId ); +gpRxArbiter_Result_t gpRxArbiter_SetStackChannel( UInt8 channel , gpRxArbiter_StackId_t stackId ); +UInt8 gpRxArbiter_GetStackChannel( gpRxArbiter_StackId_t stackId ); +UInt8 gpRxArbiter_GetCurrentRxChannel( void ); + +gpRxArbiter_Result_t gpRxArbiter_SetStackRxOn( Bool enable , gpRxArbiter_StackId_t stackId ); +Bool gpRxArbiter_GetStackRxOn( gpRxArbiter_StackId_t stackId ); +gpRxArbiter_RadioState_t gpRxArbiter_GetCurrentRxOnState( void ); + +gpRxArbiter_Result_t gpRxArbiter_SetDutyCycleOnOffTimes(UInt32 onTimeUs , UInt32 offTimeUs , gpRxArbiter_StackId_t stackId ); +gpRxArbiter_Result_t gpRxArbiter_EnableDutyCycling( Bool enable , gpRxArbiter_StackId_t stackId ); +Bool gpRxArbiter_GetDutyCycleEnabled( gpRxArbiter_StackId_t stackId ); + + + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS == 1) && (!(defined(GP_DIVERSITY_JUMPTABLES))) +#define gpRxArbiter_SetStackPriority( priority , stackId ) (gpRxArbiter_ResultSuccess) + +#define gpRxArbiter_RegisterSetFaModeCallback( stackId, cb) (gpRxArbiter_ResultSuccess) +#define gpRxArbiter_RegisterChannelUpdateCallback( stackId, cb) (gpRxArbiter_ResultSuccess) +#define gpRxArbiter_DeRegisterChannelUpdateCallback( stackId ) (gpRxArbiter_ResultSuccess) + +#else + +gpRxArbiter_Result_t gpRxArbiter_SetStackPriority( UInt8 priority , gpRxArbiter_StackId_t stackId ); + +// register for notifications from gpRxArbiter +gpRxArbiter_Result_t gpRxArbiter_RegisterSetFaModeCallback(gpRxArbiter_StackId_t stackId, gpRxArbiter_cbSetFaMode_t cb) ; +gpRxArbiter_Result_t gpRxArbiter_RegisterChannelUpdateCallback(gpRxArbiter_StackId_t stackId, gpRxArbiter_cbChannelUpdate_t cb) ; +gpRxArbiter_Result_t gpRxArbiter_DeRegisterChannelUpdateCallback(gpRxArbiter_StackId_t stackId); + +#endif // #if GP_RX_ARBITER_NUMBER_OF_STACKS == 1 + +Bool gpRxArbiter_IsAnActiveChannel(gpRxArbiter_StackId_t stackId, UInt8 channel); + + +/** @brief Enables Duty Cycled Rx window + * + * Enable a duty cycled Rx window + * + * @param channel Channel to perform duty cycling on + * @param dutyCycleOnTime Time to put radio on (in us) + * @param dutyCyclePeriod Period of the Rx Window (in us) + * @param recurrenceAmount Number of occurances that needs to be scheduled + * @param startTime Absolute start time (in us) of the rx windows + * @param stackId Stack id. +*/ +gpRxArbiter_Result_t gpRxArbiter_EnableRxWindows(UInt8 channel, UInt32 dutyCycleOnTime, UInt32 dutyCyclePeriod, UInt16 recurrenceAmount, UInt32 startTime, gpRxArbiter_StackId_t stackId); + +/** @brief Disables Duty Cycled Rx Windows + * + * Disabley a periodic Rx window + * + * @param stackId The stack id for which the rx windows will be disabled. +*/ +gpRxArbiter_Result_t gpRxArbiter_DisableRxWindows(gpRxArbiter_StackId_t stackId); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //_GP_RX_ARBITER_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c new file mode 100644 index 0000000..808ac9d --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRxArbiter_marshalling.c" + * + * RxArbiter + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpRxArbiter.h" +#include "gpRxArbiter_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_RXARBITER + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +void gpRxArbiter_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c new file mode 100644 index 0000000..feaa522 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_marshalling_client.c @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRxArbiter_marshalling_client.c" + * + * RxArbiter + * + * Marshalling structures and functions +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpRxArbiter.h" +#include "gpRxArbiter_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_RXARBITER + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpRxArbiter_ResetStack_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_ResetStack_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpRxArbiter_SetStackChannel_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(channel), pIndex); + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_SetStackChannel_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 channel , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(channel); + NOT_USED(stackId); +} + +void gpRxArbiter_GetStackChannel_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_GetStackChannel_Output_buf2par(UInt8* channel , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(channel, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpRxArbiter_GetCurrentRxOnState_Output_buf2par(Bool* rxon , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(rxon, pSource, 1, pIndex); +} + +void gpRxArbiter_GetCurrentRxChannel_Output_buf2par(UInt8* currentChannel , UInt8Buffer* pSource , UInt16* pIndex) +{ + UInt8_buf2api(currentChannel, pSource, 1, pIndex); +} + +void gpRxArbiter_SetStackRxOn_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_SetStackRxOn_Output_buf2par(gpRxArbiter_Result_t* result , Bool enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(enable); + NOT_USED(stackId); +} + +void gpRxArbiter_GetStackRxOn_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_GetStackRxOn_Output_buf2par(Bool* enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(enable, pSource, 1, pIndex); + NOT_USED(stackId); +} + +void gpRxArbiter_SetDutyCycleOnOffTimes_Input_par2buf(UInt8Buffer* pDest , UInt32 onTimeUs , UInt32 offTimeUs , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + UInt32_api2buf_1(pDest, &(onTimeUs), pIndex); + UInt32_api2buf_1(pDest, &(offTimeUs), pIndex); + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_SetDutyCycleOnOffTimes_Output_buf2par(gpRxArbiter_Result_t* result , UInt32 onTimeUs , UInt32 offTimeUs , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(onTimeUs); + NOT_USED(offTimeUs); + NOT_USED(stackId); +} + +void gpRxArbiter_EnableDutyCycling_Input_par2buf(UInt8Buffer* pDest , Bool enable , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + Bool_api2buf_1(pDest, &(enable), pIndex); + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_EnableDutyCycling_Output_buf2par(gpRxArbiter_Result_t* result , Bool enable , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(enable); + NOT_USED(stackId); +} + +void gpRxArbiter_GetDutyCycleEnabled_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_GetDutyCycleEnabled_Output_buf2par(Bool* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_SetStackPriority_Input_par2buf(UInt8Buffer* pDest , UInt8 priority , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(priority), pIndex); + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +void gpRxArbiter_SetStackPriority_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 priority , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(priority); + NOT_USED(stackId); +} +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +void gpRxArbiter_IsAnActiveChannel_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); + UInt8_api2buf_1(pDest, &(channel), pIndex); +} + +void gpRxArbiter_IsAnActiveChannel_Output_buf2par(Bool* result , gpRxArbiter_StackId_t stackId , UInt8 channel , UInt8Buffer* pSource , UInt16* pIndex) +{ + Bool_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); + NOT_USED(channel); +} + +void gpRxArbiter_EnableRxWindows_Input_par2buf(UInt8Buffer* pDest , UInt8 channel , UInt32 dutyCycleOnTime , UInt32 dutyCyclePeriod , UInt16 recurrenceAmount , UInt32 startTime , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(channel), pIndex); + UInt32_api2buf_1(pDest, &(dutyCycleOnTime), pIndex); + UInt32_api2buf_1(pDest, &(dutyCyclePeriod), pIndex); + UInt16_api2buf_1(pDest, &(recurrenceAmount), pIndex); + UInt32_api2buf_1(pDest, &(startTime), pIndex); + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_EnableRxWindows_Output_buf2par(gpRxArbiter_Result_t* result , UInt8 channel , UInt32 dutyCycleOnTime , UInt32 dutyCyclePeriod , UInt16 recurrenceAmount , UInt32 startTime , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(channel); + NOT_USED(dutyCycleOnTime); + NOT_USED(dutyCyclePeriod); + NOT_USED(recurrenceAmount); + NOT_USED(startTime); + NOT_USED(stackId); +} + +void gpRxArbiter_DisableRxWindows_Input_par2buf(UInt8Buffer* pDest , gpRxArbiter_StackId_t stackId , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_api2buf_1(pDest, &(stackId), pIndex); +} + +void gpRxArbiter_DisableRxWindows_Output_buf2par(gpRxArbiter_Result_t* result , gpRxArbiter_StackId_t stackId , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_Result_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(stackId); +} + +gpMarshall_AckStatus_t gpRxArbiter_cbSetFaModeNotification_Input_buf2api(gpRxArbiter_cbSetFaModeNotification_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + gpRxArbiter_FaMode_t_buf2api(&(pDest->data.mode), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +gpMarshall_AckStatus_t gpRxArbiter_cbChannelUpdateNotification_Input_buf2api(gpRxArbiter_cbChannelUpdateNotification_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpRxArbiter_StackId_t_buf2api(&(pDest->data.stackId), pSource, 1, pIndex); + UInt8_buf2api(&(pDest->data.channel), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c new file mode 100644 index 0000000..4626792 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/802_15_4/gpRxArbiter/src/gen/gpRxArbiter_wrapper_client.c @@ -0,0 +1,810 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRxArbiter_wrapper_client.c" + * + * RxArbiter + * + * Wrapper implementation +*/ + +/***************************************************************************** + * Includes Definition + *****************************************************************************/ + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpCom.h" +#include "gpModule.h" +#include "gpRxArbiter_clientServerCmdId.h" +#include "gpRxArbiter.h" +#include "gpRxArbiter_marshalling.h" +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +#include "gpVersion.h" +#endif + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Functions Declaration + *****************************************************************************/ + +static void gpRxArbiter_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId); +static void RxArbiter_HandleConnectionClose(gpCom_CommunicationId_t communicationId); + +/* AdditionalStaticFunctions */ +static void gpRxArbiter_cbSetFaModeNotification(gpRxArbiter_StackId_t stackId, gpRxArbiter_FaMode_t mode); +static void gpRxArbiter_cbChannelUpdateNotification(gpRxArbiter_StackId_t stackId, UInt8 channel); +/* AdditionalStaticFunctions */ +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_RXARBITER +#define GP_MODULE_ID GP_COMPONENT_ID + + +#ifndef GP_RXARBITER_COMM_ID +#define GP_RXARBITER_COMM_ID GP_COM_DEFAULT_COMMUNICATION_ID +#endif + +#define REGISTER_MODULE(handle) GP_COM_REGISTER_MODULE(handle) +#define DATA_REQUEST(len,buf,commId) GP_COM_DATA_REQUEST(len,buf,commId) +#define DATA_REQUEST_ACKED(len,buf,commId) gpCom_DataRequestAndWaitForAck(GP_MODULE_ID, len, buf, commId, &gpRxArbiter_reqAcked, GPRXARBITER_GPCOMTIMEOUT_US, gpRxArbiter_Acknowledge_CmdId) + +/***************************************************************************** + * Static Data + *****************************************************************************/ + +typedef union ackDataNeeded { + UInt8 dataBuf0[1]; +} ackDataNeeded_t; +static UInt8 gpRxArbiter_ackBuffer[1 + 1 + 1 + sizeof(ackDataNeeded_t)]; +static Bool gpRxArbiter_reqAcked; +/* AdditionalStaticData */ +static gpRxArbiter_cbSetFaMode_t gpRxArbiter_SetFaModeCallback ; +static gpRxArbiter_cbChannelUpdate_t gpRxArbiter_ChannelUpdateCallback ; +/* AdditionalStaticData */ + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +static Bool RxArbiter_clientApiVersionSelected = false; +#endif + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +/* AdditionalStaticFunctionDefinitions */ +void gpRxArbiter_cbSetFaModeNotification(gpRxArbiter_StackId_t stackId, gpRxArbiter_FaMode_t mode) +{ + if (gpRxArbiter_SetFaModeCallback) + { + gpRxArbiter_SetFaModeCallback(stackId, mode) ; + } +} + +void gpRxArbiter_cbChannelUpdateNotification(gpRxArbiter_StackId_t stackId, UInt8 channel) +{ + if (gpRxArbiter_ChannelUpdateCallback) + { + gpRxArbiter_ChannelUpdateCallback(stackId, channel) ; + } +} +/* AdditionalStaticFunctionDefinitions */ + +static void RxArbiter_HandleConnectionClose(gpCom_CommunicationId_t communicationId) +{ +/* ConnectionCloseFunction */ + /* Manual update */ + NOT_USED(communicationId); +/* ConnectionCloseFunction */ +} + +static void gpRxArbiter_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId) +{ +#define commandId pPayload[0] + gpMarshall_AckStatus_t marshall_result; + UInt16 _index = 1; + gpRxArbiter_Client_Input_union_t input; + UInt8 ackBuffer[1 + 1 + 1]; + UInt8 ackBytes = 0; /*No ack's on indication - fill in length when needed - 3+x */ + + if(pPayload == NULL) + { + RxArbiter_HandleConnectionClose(communicationId); + return; + } + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + + ackBuffer[0] = gpRxArbiter_Acknowledge_CmdId; + ackBuffer[1] = gpMarshall_AckStatusSuccess; + ackBuffer[2] = commandId; + + switch(commandId) + { + + case gpRxArbiter_cbSetFaModeNotification_CmdId: + { + marshall_result = gpRxArbiter_cbSetFaModeNotification_Input_buf2api(&(input.gpRxArbiter_cbSetFaModeNotification) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + + gpRxArbiter_cbSetFaModeNotification( + input.gpRxArbiter_cbSetFaModeNotification.data.stackId + , input.gpRxArbiter_cbSetFaModeNotification.data.mode + ); + + + break; + } + case gpRxArbiter_cbChannelUpdateNotification_CmdId: + { + marshall_result = gpRxArbiter_cbChannelUpdateNotification_Input_buf2api(&(input.gpRxArbiter_cbChannelUpdateNotification) , pPayload , &_index); + if (gpMarshall_AckStatusSuccess != marshall_result) + { + ackBuffer[1] = marshall_result; + break; + } + + gpRxArbiter_cbChannelUpdateNotification( + input.gpRxArbiter_cbChannelUpdateNotification.data.stackId + , input.gpRxArbiter_cbChannelUpdateNotification.data.channel + ); + + + break; + } + case gpRxArbiter_Acknowledge_CmdId: + { + GP_ASSERT_SYSTEM(length <= sizeof(gpRxArbiter_ackBuffer)); + MEMCPY(gpRxArbiter_ackBuffer, pPayload, length); + gpRxArbiter_reqAcked = true; + return; + } + default: + { + GP_ASSERT_DEV_INT(false); + break; + } + } +#undef commandId + if(0 < ackBytes) + { + DATA_REQUEST(ackBytes, ackBuffer, communicationId); + } +} +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +/* AdditionalPublicFunctionDefinitions */ +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) // manual +gpRxArbiter_Result_t gpRxArbiter_RegisterSetFaModeCallback(gpRxArbiter_StackId_t stackId, gpRxArbiter_cbSetFaMode_t cb) +{ + /* Manual update */ + NOT_USED(stackId); + gpRxArbiter_Result_t result ; + + if (cb) + { + gpRxArbiter_SetFaModeCallback = cb ; + + result = gpRxArbiter_ResultSuccess ; + } + else + { + result = gpRxArbiter_ResultInvalidArgument ; + } + + return result ; +} + +gpRxArbiter_Result_t gpRxArbiter_RegisterChannelUpdateCallback(gpRxArbiter_StackId_t stackId, gpRxArbiter_cbChannelUpdate_t cb) +{ + /* Manual update */ + NOT_USED(stackId); + gpRxArbiter_Result_t result ; + + if (cb) + { + gpRxArbiter_ChannelUpdateCallback = cb ; + + result = gpRxArbiter_ResultSuccess ; + } + else + { + result = gpRxArbiter_ResultInvalidArgument ; + } + + return result ; +} +#endif // (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) // manual +/* AdditionalPublicFunctionDefinitions */ + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +void gpRxArbiter_SetDefaultApiVersion(gpVersion_ModuleVersionInfo_t* moduleVersionInfo) +{ + RxArbiter_clientApiVersionSelected = true; + //TBD +} +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + + +void gpRxArbiter_DeInit(void) +{ + gpCom_DeRegisterModule(GP_MODULE_ID); +} + +void gpRxArbiter_Init(void) +{ +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + gpVersion_ReleaseInfo_t versions[1] = {{2,0,0,0}}; + RxArbiter_clientApiVersionSelected = false; + gpVersion_RegisterModule(GP_MODULE_ID, versions,1,gpRxArbiter_SetDefaultApiVersion); +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + REGISTER_MODULE(gpRxArbiter_HandleIndicationClient); +} + +/***************************************************************************** + * gpRxArbiter Require Functions + *****************************************************************************/ + +gpRxArbiter_Result_t gpRxArbiter_ResetStack(gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_ResetStack_CmdId; + + gpRxArbiter_ResetStack_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_ResetStack_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_ResetStack_Output_buf2par( + &result + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +gpRxArbiter_Result_t gpRxArbiter_SetStackChannel(UInt8 channel, gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_SetStackChannel_CmdId; + + gpRxArbiter_SetStackChannel_Input_par2buf(dataBuf + , channel + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_SetStackChannel_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_SetStackChannel_Output_buf2par( + &result + , channel + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +UInt8 gpRxArbiter_GetStackChannel(gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + UInt8 channel; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetStackChannel_CmdId; + + gpRxArbiter_GetStackChannel_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetStackChannel_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetStackChannel_Output_buf2par( + &channel + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return channel; +} + +Bool gpRxArbiter_GetCurrentRxOnState(void) +{ + UInt16 _index = 1; + Bool rxon; + UInt8 dataBuf[1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetCurrentRxOnState_CmdId; + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetCurrentRxOnState_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetCurrentRxOnState_Output_buf2par( + &rxon + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return rxon; +} + +UInt8 gpRxArbiter_GetCurrentRxChannel(void) +{ + UInt16 _index = 1; + UInt8 currentChannel; + UInt8 dataBuf[1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetCurrentRxChannel_CmdId; + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetCurrentRxChannel_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetCurrentRxChannel_Output_buf2par( + ¤tChannel + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return currentChannel; +} + +gpRxArbiter_Result_t gpRxArbiter_SetStackRxOn(Bool enable, gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_SetStackRxOn_CmdId; + + gpRxArbiter_SetStackRxOn_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_SetStackRxOn_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_SetStackRxOn_Output_buf2par( + &result + , enable + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +Bool gpRxArbiter_GetStackRxOn(gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + Bool enable; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetStackRxOn_CmdId; + + gpRxArbiter_GetStackRxOn_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetStackRxOn_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetStackRxOn_Output_buf2par( + &enable + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return enable; +} + +gpRxArbiter_Result_t gpRxArbiter_SetDutyCycleOnOffTimes(UInt32 onTimeUs, UInt32 offTimeUs, gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 4*1 + 4*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_SetDutyCycleOnOffTimes_CmdId; + + gpRxArbiter_SetDutyCycleOnOffTimes_Input_par2buf(dataBuf + , onTimeUs + , offTimeUs + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_SetDutyCycleOnOffTimes_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_SetDutyCycleOnOffTimes_Output_buf2par( + &result + , onTimeUs + , offTimeUs + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +gpRxArbiter_Result_t gpRxArbiter_EnableDutyCycling(Bool enable, gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_EnableDutyCycling_CmdId; + + gpRxArbiter_EnableDutyCycling_Input_par2buf(dataBuf + , enable + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_EnableDutyCycling_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_EnableDutyCycling_Output_buf2par( + &result + , enable + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +Bool gpRxArbiter_GetDutyCycleEnabled(gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_GetDutyCycleEnabled_CmdId; + + gpRxArbiter_GetDutyCycleEnabled_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_GetDutyCycleEnabled_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_GetDutyCycleEnabled_Output_buf2par( + &result + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +#if (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) +gpRxArbiter_Result_t gpRxArbiter_SetStackPriority(UInt8 priority, gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_SetStackPriority_CmdId; + + gpRxArbiter_SetStackPriority_Input_par2buf(dataBuf + , priority + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_SetStackPriority_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_SetStackPriority_Output_buf2par( + &result + , priority + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} +#endif /* (GP_RX_ARBITER_NUMBER_OF_STACKS > 1) */ + +Bool gpRxArbiter_IsAnActiveChannel(gpRxArbiter_StackId_t stackId, UInt8 channel) +{ + UInt16 _index = 1; + Bool result; + UInt8 dataBuf[1 + 1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_IsAnActiveChannel_CmdId; + + gpRxArbiter_IsAnActiveChannel_Input_par2buf(dataBuf + , stackId + , channel + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_IsAnActiveChannel_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_IsAnActiveChannel_Output_buf2par( + &result + , stackId + , channel + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +gpRxArbiter_Result_t gpRxArbiter_EnableRxWindows(UInt8 channel, UInt32 dutyCycleOnTime, UInt32 dutyCyclePeriod, UInt16 recurrenceAmount, UInt32 startTime, gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1 + 4*1 + 4*1 + 2*1 + 4*1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_EnableRxWindows_CmdId; + + gpRxArbiter_EnableRxWindows_Input_par2buf(dataBuf + , channel + , dutyCycleOnTime + , dutyCyclePeriod + , recurrenceAmount + , startTime + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_EnableRxWindows_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_EnableRxWindows_Output_buf2par( + &result + , channel + , dutyCycleOnTime + , dutyCyclePeriod + , recurrenceAmount + , startTime + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + +gpRxArbiter_Result_t gpRxArbiter_DisableRxWindows(gpRxArbiter_StackId_t stackId) +{ + UInt16 _index = 1; + gpRxArbiter_Result_t result; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(RxArbiter_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRxArbiter_DisableRxWindows_CmdId; + + gpRxArbiter_DisableRxWindows_Input_par2buf(dataBuf + , stackId + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RXARBITER_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRxArbiter_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRxArbiter_DisableRxWindows_CmdId == gpRxArbiter_ackBuffer[2]); + + _index = 3; + gpRxArbiter_DisableRxWindows_Output_buf2par( + &result + , stackId + , gpRxArbiter_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRxArbiter_ackBuffer)); + +#undef commandId + return result; +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp.h new file mode 100644 index 0000000..be425fc --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpBsp.h + * This file manages how the BSP header file is included + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _BSP_H_ +#define _BSP_H_ + +#include "global.h" + + +#if defined(GP_COMP_CHIPEMU) +// Chip emulation definitions +#error Unsupported chip for chip emulation + +#endif //GP_COMP_EXTSTORAGE + +#if defined(__SDCC) +/* the "#include GP_BSP_FILENAME" construction doesn't seem to */ +/* work for the SDCC compiler. In this case we fall back to the old bsp selection */ +#else + +#if defined(GP_BSP_FILENAME) +/* Include BSP Header */ +#include GP_BSP_FILENAME +#endif +#endif //defined(__SDCC) +#endif // _BSP_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp_linux_user.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp_linux_user.h new file mode 100644 index 0000000..c3179d7 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BSP/gpBsp/inc/gpBsp_linux_user.h @@ -0,0 +1,51 @@ + +#ifndef _GPBSP_LINUX_USER_H_ +#define _GPBSP_LINUX_USER_H_ + +/* + * Copyright (c) 2012-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpBsp_linux_user.h + * This file stubs gpBsp macro's for Pc unit tests + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * BSP configuration interface + *****************************************************************************/ + +#define GP_BSP_32KHZ_CRYSTAL_AVAILABLE() (0) +#define BSP_INIT() +#define GP_INT_IS_1 (0) +#define CONFIG_INTERRUPT_LINE() + +void gpBsp_init(void); + + +#endif //_GPBSP_LINUX_USER_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c new file mode 100644 index 0000000..8ee0df8 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BSP/gpBsp/src/gpBsp.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2009-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpBsp.c + * Board support package functions + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_BSP + +#include "global.h" +#include "gpBsp.h" + +#if !defined(GP_DIVERSITY_WINDOWS) +void gpBsp_init(void) +{ + BSP_INIT(); +} +#endif diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/inc/gen/ComIoctlInterface_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/inc/gen/ComIoctlInterface_marshalling.h new file mode 100644 index 0000000..9879689 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/inc/gen/ComIoctlInterface_marshalling.h @@ -0,0 +1,135 @@ + +/* + * Copyright (c) 2017, Qorvo Inc + * + * This file contains the implementation of the ComIoctlInterface API protocol. + * + * + * Marshalling structures and functions + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _COMIOCTLINTERFACE_MARSHALLING_H_ +#define _COMIOCTLINTERFACE_MARSHALLING_H_ + +//DOCUMENTATION COMIOCTLINTERFACE: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "ComIoctlInterface.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + + + +typedef struct { + UInt8 moduleID; + UInt32 commId; + UInt16 length; + UInt8* pIoctlPayload; +} writeMsg_Input_struct_t; + +typedef struct { + writeMsg_Input_struct_t data; + UInt8 pIoctlPayload[GP_COM_MAX_PACKET_PAYLOAD_SIZE]; +} writeMsg_Input_marshall_struct_t; + +typedef struct { + UInt16 maxLength; +} readMsg_Input_struct_t; + +typedef struct { + readMsg_Input_struct_t data; +} readMsg_Input_marshall_struct_t; + +typedef struct { + UInt8* moduleID; + UInt32* commId; + UInt16* length; + UInt8* pIoctlPayload; +} readMsg_Output_struct_t; + +typedef struct { + readMsg_Output_struct_t data; + UInt8 moduleID[1]; + UInt32 commId[1]; + UInt16 length[1]; + UInt8 pIoctlPayload[GP_COM_MAX_PACKET_PAYLOAD_SIZE]; +} readMsg_Output_marshall_struct_t; + + +typedef union { + writeMsg_Input_marshall_struct_t writeMsg; + readMsg_Input_marshall_struct_t readMsg; +} ComIoctlInterface_Server_Input_union_t; + +typedef union { + readMsg_Output_marshall_struct_t readMsg; +} ComIoctlInterface_Server_Output_union_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's + +// Structure copy functions + +// Server functions +gpMarshall_AckStatus_t writeMsg_Input_buf2api( writeMsg_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t readMsg_Input_buf2api( readMsg_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +void readMsg_Output_api2buf( UInt8Buffer* pDest , readMsg_Output_marshall_struct_t* pSourceoutput , readMsg_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); + +// Client functions +void writeMsg_Input_par2buf( UInt8Buffer* pDest , UInt8 moduleID , UInt32 commId , UInt16 length , UInt8* pIoctlPayload , UInt16* pIndex ); +void readMsg_Input_par2buf( UInt8Buffer* pDest , UInt16 maxLength , UInt16* pIndex ); +void readMsg_Output_buf2par( UInt16 maxLength , UInt8* moduleID , UInt32* commId , UInt16* length , UInt8* pIoctlPayload , UInt8Buffer* pSource , UInt16* pIndex ); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _COMIOCTLINTERFACE_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/inc/gpCom.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/inc/gpCom.h new file mode 100644 index 0000000..d8158f2 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/inc/gpCom.h @@ -0,0 +1,283 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpCom.h + * + * This file contains the API definition of the serial communication module. + * It implements the GreenPeak serial protocol. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPCOM_H_ +#define _GPCOM_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpCom_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +//Check for multiple com usage +#ifdef GP_DIVERSITY_COM_UART +#ifndef GP_COM_DIVERSITY_MULTIPLE_COM +#define GP_COM_DIVERSITY_MULTIPLE_COM +#endif //ifndef GP_COM_DIVERSITY_MULTIPLE_COM +#else +#endif + +#define GP_COM_COMM_ID_HW (0x80000000) +#define GP_COM_COMM_ID_HW_1 (0x10000) +#define GP_COM_COMM_ID_HW_2 (0x20000) +#define GP_COM_COMM_ID_HW_3 (0x40000) +#define GP_COM_COMM_ID_HW_4 (0x80000) +#define GP_COM_COMM_ID_BLE_COMMAND GP_COM_COMM_ID_HW_1 +#define GP_COM_COMM_ID_BLE_DATA GP_COM_COMM_ID_HW_2 +#define GP_COM_COMM_ID_BLE_ISODATA GP_COM_COMM_ID_HW_3 +#define GP_COM_COMM_ID_BLE_EVENT GP_COM_COMM_ID_HW_4 +#define GP_COM_COMM_ID_USB (GP_COM_COMM_ID_HW | 0x4000) + +#define GP_COM_COMM_ID_UART1_PROPER (GP_COM_COMM_ID_HW | 0x01) +#define GP_COM_COMM_ID_UART1 GP_COM_COMM_ID_UART1_PROPER +#define GP_COM_COMM_ID_UART2 (GP_COM_COMM_ID_HW | 0x02) +#define GP_COM_COMM_ID_UART3 (GP_COM_COMM_ID_HW | 0x04) +#define GP_COM_COMM_ID_BLE (GP_COM_COMM_ID_HW_1 | GP_COM_COMM_ID_HW_2 | GP_COM_COMM_ID_HW_3 | GP_COM_COMM_ID_HW_4) +#define GP_COM_COMM_ID_STMUSB (GP_COM_COMM_ID_UART1) +#define GP_COM_COMM_ID_SHMEM (0x40000000) +#define GP_COM_COMM_ID_IOCTL_USER1 (GP_COM_COMM_ID_HW | 0x0040) +#define GP_COM_COMM_ID_IOCTL_USER2 (GP_COM_COMM_ID_HW | 0x0080) +#define GP_COM_COMM_ID_IOCTL_USER3 (GP_COM_COMM_ID_HW | 0x0010) +#define GP_COM_COMM_ID_IOCTL_USER4 (GP_COM_COMM_ID_HW | 0x0020) +#define GP_COM_COMM_ID_IOCTL_USER_MASK (GP_COM_COMM_ID_IOCTL_USER1 | GP_COM_COMM_ID_IOCTL_USER2 | GP_COM_COMM_ID_IOCTL_USER3 | GP_COM_COMM_ID_IOCTL_USER4) +#define GP_COM_COMM_ID_IOCTL_KERN1 (GP_COM_COMM_ID_HW | 0x0100) +#define GP_COM_COMM_ID_IOCTL_KERN2 (GP_COM_COMM_ID_HW | 0x0200) +#ifndef GP_COM_COMM_ID_IOCTL_USER +#define GP_COM_COMM_ID_IOCTL_USER GP_COM_COMM_ID_IOCTL_USER1 +#endif +#ifndef GP_COM_COMM_ID_IOCTL_KERN +#define GP_COM_COMM_ID_IOCTL_KERN GP_COM_COMM_ID_IOCTL_KERN1 +#endif +#define GP_COM_COMM_ID_SOCKET 0xFFFFFFFF /* used for the server (local client) conection if it exists; else the first client (local server) connection */ +#define GP_COM_COMM_ID_SOCKET2 0xFFFFFFFE /* for the next client (local server) connection */ +#define GP_COM_COMM_ID_RF (GP_COM_COMM_ID_HW | 0x1000) + +#define GP_COM_COMM_ID_SPI (GP_COM_COMM_ID_HW | 0x2000) + +#define GP_COM_COMM_ID_DIGSIM (GP_COM_COMM_ID_HW | 0x5555) + +#define GP_COMM_ID_CARRIED_BY(system,id) ((system & id) == id) + +//Define default COM ID + +#ifdef GP_COM_DIVERSITY_MULTIPLE_COM +#ifndef GP_COM_DEFAULT_COMMUNICATION_ID +#if defined(GP_DIVERSITY_JUMPTABLES) +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_UART1 +#else +#error supply default comm ID +#endif // defined(GP_DIVERSITY_JUMPTABLES) +#endif // GP_COM_DEFAULT_COMMUNICATION_ID +#else +#ifndef GP_COM_DEFAULT_COMMUNICATION_ID +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_IOCTL_USER1 +#endif //GP_COM_DEFAULT_COMMUNICATION_ID +#endif //GP_COM_DIVERSITY_MULTIPLE_COM + + +#if defined(GP_COMP_COM) +#define GP_COM_DATA_REQUEST(length,pData, commId) gpCom_DataRequest(GP_MODULE_ID, (length), (pData), commId) +#if defined(GP_DIVERSITY_COM_UART) +#define GP_COM_GET_FREE_BUFFER_SPACE(commId) gpCom_GetFreeBufferSpace(GP_MODULE_ID, commId) +#endif +#define GP_COM_REGISTER_MODULE(handleCallback) gpCom_RegisterModule(GP_MODULE_ID, (handleCallback)) +#define GP_COM_REGISTER_ACTIVATE_TX_CB(activateCallback) gpCom_RegisterActivateTxCb(GP_MODULE_ID, activateCallback) +#else +#define GP_COM_DATA_REQUEST(length,pData, commId) do {} while (false) +#define GP_COM_REGISTER_MODULE(handleCallback) do {} while (false) +#define GP_COM_REGISTER_ACTIVATE_TX_CB(activateCallback) do {} while (false) +#endif + +#ifndef GP_COM_MAX_PACKET_PAYLOAD_SIZE +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE 127 +#endif //GP_COM_MAX_PACKET_PAYLOAD_SIZE + +//Length expressed in 12-bits - maximum 4096-1 bytes available +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE_PROTOCOL 4095 +#if GP_COM_MAX_PACKET_PAYLOAD_SIZE > GP_COM_MAX_PACKET_PAYLOAD_SIZE_PROTOCOL +#error Length maximum 12-bits = 4096-1 bytes +#endif + +#define GP_COM_IOCTL_KERNEL_NR_OF_CLIENTS (4) + +#ifndef GP_COM_NR_OF_ACTIVATETXCB +#define GP_COM_NR_OF_ACTIVATETXCB (2) +#endif + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +#ifndef GP_COM_FILTER_CNT +#define GP_COM_FILTER_CNT 8 +#endif + +#ifndef GP_COM_FILTER_PATTERN_MAX_CNT +#define GP_COM_FILTER_PATTERN_MAX_CNT 2 +#endif + +#ifndef GP_COM_FILTER_PATTERN_MAX_LEN +#define GP_COM_FILTER_PATTERN_MAX_LEN 8 +#endif +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + +#ifndef GP_COM_TXBUFFER_ALMOST_FULL_TRESHOLD_PERCENT +#define GP_COM_TXBUFFER_ALMOST_FULL_TRESHOLD_PERCENT 80 +#endif + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt32 gpCom_CommunicationId_t; + +typedef void (*gpCom_HandleCallback_t) ( UInt16 length , UInt8* pData, gpCom_CommunicationId_t commId); +typedef UInt16 (*gpCom_cbActivateTx_t) ( UInt16 overFlowCounter, gpCom_CommunicationId_t commId); + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +typedef void (*gpCom_cbTxBufferAlmostFull_t)(gpCom_CommunicationId_t id, Bool almostFull); +#endif + +#define gpCom_ProtocolSyn 1 +#define gpCom_ProtocolBle 2 +#define gpCom_ProtocolNoSynNoCrc 3 +#define gpCom_ProtocolInvalid 0xff +typedef UInt8 gpCom_Protocol_t; +/***************************************************************************** + * External Function Definitions + *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpCom_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpCom_Init(void); + +/** +* @brief Send data over a specified communication channel +* +* @param moduleID SW component ID that will handle the data +* @param length Length of the data +* @param pData Pointer to the data to send +* @param commId Communication channel to use for transmission (if available). Can be UART/USB/... +* @return status Returns True if request was executed. +*/ +Bool gpCom_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId); + +/** +* @brief Send data over a specified communication channel and wait for a specific ACK packet +* +* @param moduleID SW component ID that will handle the data +* @param length Length of the data +* @param pData Pointer to the data to send +* @param commId Communication channel to use for transmission (if available). Can be UART/USB/... +* @param reqAcked Return pointer in whick ack state is returned. +* @param timeout Time to wait for ack (in us) +* @param ackId Specific command ID to wait for in ACK packet. Tied to API serialization. +* @return status Returns True if request was executed. +*/ +Bool gpCom_DataRequestAndWaitForAck(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId, Bool *reqAcked, UInt32 timeout, UInt8 ackId); +UInt16 gpCom_GetFreeBufferSpace(UInt8 moduleID, gpCom_CommunicationId_t commId); +Bool gpCom_RegisterModule(UInt8 moduleID, gpCom_HandleCallback_t handleCallback); +Bool gpCom_DeRegisterModule(UInt8 moduleID); +Bool gpCom_RegisterActivateTxCb(UInt8 moduleID, gpCom_cbActivateTx_t cb); +Bool gpCom_IsReceivedPacketPending(void); +void gpCom_HandleRx(void); +void gpCom_HandleRxBlocking(Bool blockingWait, UInt8 cmdId); + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +gpCom_cbTxBufferAlmostFull_t gpCom_RegisterTxBufferAlmostFull(gpCom_cbTxBufferAlmostFull_t cb); +#endif + +// Common functions +Bool gpCom_GetTXEnable(void); +void gpCom_HandleTx(void); +void gpCom_Flush(void); +void gpCom_DeInit(void); +Bool gpCom_TXDataPending(void); +gpCom_CommunicationId_t gpCom_cbSelectCommId(void); +gpCom_CommunicationId_t gpCom_cbSelectBleCommId(void); + + + + + + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + + + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING + +typedef struct +{ + UInt8 data[GP_COM_FILTER_PATTERN_MAX_LEN]; + UInt16 len; + UInt16 offset; +} gpCom_FilterPattern_t; + +Bool gpCom_AddFilter(UInt8 moduleId, UInt8 bufferUsageThresh, UInt8 patternsCnt, const gpCom_FilterPattern_t* patterns); +Bool gpCom_RemoveFilter(UInt8 moduleId, UInt8 bufferUsageThresh, UInt8 patternsCnt, const gpCom_FilterPattern_t* patterns); +#endif + +#endif // _GPCOM_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface.h new file mode 100644 index 0000000..620a05b --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#include "global.h" +#include "gpCom.h" +#include "gpAssert.h" diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c new file mode 100644 index 0000000..a51e3c8 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_client.c @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * This file contains the implementation of the ComIoctlInterface API protocol. + * + * + * Marshalling structures and functions + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "ComIoctlInterface.h" +#include "ComIoctlInterface_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_COMIOCTLINTERFACE + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void writeMsg_Input_par2buf( UInt8Buffer* pDest , UInt8 moduleID , UInt32 commId , UInt16 length , UInt8* pIoctlPayload , UInt16* pIndex ) +{ + UInt8_api2buf(pDest, &(moduleID), 1, pIndex); + UInt32_api2buf(pDest, &(commId), 1, pIndex); + UInt16_api2buf(pDest, &(length), 1, pIndex); + pDest[(*pIndex)++] = (NULL == pIoctlPayload); + if (NULL != pIoctlPayload) + { + UInt8_api2buf(pDest, pIoctlPayload, length, pIndex); + } +} + +void readMsg_Input_par2buf( UInt8Buffer* pDest , UInt16 maxLength , UInt16* pIndex ) +{ + UInt16_api2buf(pDest, &(maxLength), 1, pIndex); +} + +void readMsg_Output_buf2par( UInt16 maxLength , UInt8* moduleID , UInt32* commId , UInt16* length , UInt8* pIoctlPayload , UInt8Buffer* pSource , UInt16* pIndex ) +{ + NOT_USED(maxLength); + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt8_buf2api( moduleID, pSource, 1, pIndex); + } + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt32_buf2api( commId, pSource, 1, pIndex); + } + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt16_buf2api( length, pSource, 1, pIndex); + } + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt8_buf2api( pIoctlPayload, pSource, (*length), pIndex); + } +} + + + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c new file mode 100644 index 0000000..f363012 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gen/ComIoctlInterface_marshalling_server.c @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * This file contains the implementation of the ComIoctlInterface API protocol. + * + * + * Marshalling structures and functions + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "ComIoctlInterface.h" +#include "ComIoctlInterface_marshalling.h" + +#include "gpLog.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_COMIOCTLINTERFACE + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t writeMsg_Input_buf2api( writeMsg_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ) +{ + UInt8_buf2api(&(pDest->data.moduleID), pSource, 1, pIndex); + UInt32_buf2api(&(pDest->data.commId), pSource, 1, pIndex); + UInt16_buf2api(&(pDest->data.length), pSource, 1, pIndex); + if (pSource[(*pIndex)++] == 0x0) // Check IsNull byte + { + pDest->data.pIoctlPayload = pDest->pIoctlPayload; + UInt8_buf2api( pDest->data.pIoctlPayload, pSource, pDest->data.length, pIndex ); + } + else + { + pDest->data.pIoctlPayload = NULL; + } + return gpMarshall_AckStatusSuccess; +} + + +gpMarshall_AckStatus_t readMsg_Input_buf2api( readMsg_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ) +{ + UInt16_buf2api(&(pDest->data.maxLength), pSource, 1, pIndex); + return gpMarshall_AckStatusSuccess; +} + +void readMsg_Output_api2buf( UInt8Buffer* pDest , readMsg_Output_marshall_struct_t* pSourceoutput , readMsg_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ) +{ + pDest[(*pIndex)++] = (pSourceoutput->data.moduleID == NULL); // Add IsNull byte for output pointer + if (pSourceoutput->data.moduleID != NULL) + { + UInt8_api2buf(pDest, pSourceoutput->data.moduleID,1, pIndex); + } + pDest[(*pIndex)++] = (pSourceoutput->data.commId == NULL); // Add IsNull byte for output pointer + if (pSourceoutput->data.commId != NULL) + { + UInt32_api2buf(pDest, pSourceoutput->data.commId,1, pIndex); + } + pDest[(*pIndex)++] = (pSourceoutput->data.length == NULL); // Add IsNull byte for output pointer + if (pSourceoutput->data.length != NULL) + { + UInt16_api2buf(pDest, pSourceoutput->data.length,1, pIndex); + } + pDest[(*pIndex)++] = (pSourceoutput->data.pIoctlPayload == NULL); // Add IsNull byte for output pointer + if (pSourceoutput->data.pIoctlPayload != NULL) + { + UInt8_api2buf(pDest, pSourceoutput->data.pIoctlPayload,(*pSourceoutput->data.length), pIndex); + } +} + + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c new file mode 100644 index 0000000..acb7d1a --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom.c @@ -0,0 +1,392 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpCom.c + * + * This file contains the implementation of the serial communication module. + * It implements the GreenPeak serial protocol. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_COM + +#include "gpCom.h" +#include "gpCom_defs.h" + +#include "gpLog.h" +#include "gpAssert.h" + +#include "gpSched.h" + +#include "hal.h" + +extern HAL_CRITICAL_SECTION_DEF(Com_MultiThreadingMutex) + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +#ifndef GP_COM_MAX_TX_BUFFER_SIZE +#define GP_COM_MAX_TX_BUFFER_SIZE 1536 +#endif +#define TX_BUFFER_CALCULATE_USAGE_PERCENTAGE(val) (UInt16)((100 - val * 100 / GP_COM_MAX_TX_BUFFER_SIZE)) +#define COMM_ID_SLOT_NB (4) /* currently tx buffer almost full indication is supported for max 4 interfaces: UART1, UART2, SPI, SHMEM */ +#define EMPTY_COMM_ID_SLOT (0x00000000) +#define EMPTY_COMM_ID_SLOT_BITFLAG (0x80) +#endif +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +Bool gpCom_Initialized = false; + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +static gpCom_cbTxBufferAlmostFull_t gpCom_TxBufferAlmostFullCb = NULL; +#endif +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) +Bool gpCom_TxLocked; +#endif + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +#error "Defined protocols cannot be used in this configuration together with GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK" +#endif +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ +#if defined(GP_COM_DIVERSITY_PACKET_FILTERING) && !defined(GP_COM_COMM_ID_IOCTL_KERN) +UInt8 gpCom_TxBufferUsagePercent(void); +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING && !GP_COM_COMM_ID_IOCTL_KERN + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +static void Com_CheckTxBufferOverTreshhold(gpCom_CommunicationId_t commId); +static void Com_CheckTxBufferBelowTreshold(void); +#endif +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +static UInt8 Com_FindConnIdInTxBufferAlmostFull(gpCom_CommunicationId_t commId) +{ + UInt8 tmpIdx = 0x7F; + for(UInt8 index = 0; index < COMM_ID_SLOT_NB; index++) + { + if(Com_TxBufferAlmostFullCommIds[index] == commId) + { + tmpIdx = index; + break; + } + else if(Com_TxBufferAlmostFullCommIds[index] == EMPTY_COMM_ID_SLOT) + { + if(!(tmpIdx & EMPTY_COMM_ID_SLOT_BITFLAG)) + { + /* first empty slot was found, store it and iterate over rest of the array*/ + tmpIdx = EMPTY_COMM_ID_SLOT_BITFLAG | index; + } + } + } + return tmpIdx; +} + +static void Com_CheckTxBufferOverTreshhold(gpCom_CommunicationId_t commId) +{ + UInt16 usagePerc = 0; + + if(!gpCom_TxBufferAlmostFullCb) + { + return; + } + + usagePerc = TX_BUFFER_CALCULATE_USAGE_PERCENTAGE(gpCom_GetFreeBufferSpace(0, commId)); + + if(usagePerc > GP_COM_TXBUFFER_ALMOST_FULL_TRESHOLD_PERCENT) + { + UInt8 index = Com_FindConnIdInTxBufferAlmostFull(commId); + GP_ASSERT_SYSTEM(index != 0x7F); + + if(index & EMPTY_COMM_ID_SLOT_BITFLAG) /* current connId is not stored in Com_TxBufferAlmostFull array - call cb and store it there */ + { + index &= ~(EMPTY_COMM_ID_SLOT_BITFLAG); + Com_TxBufferAlmostFullCommIds[index] = commId; + gpCom_TxBufferAlmostFullCb(Com_TxBufferAlmostFullCommIds[index], true); + } + else + { + /* connId already present in Com_TxBufferAlmostFull - do nothing */ + } + } +} + +static void Com_CheckTxBufferBelowTreshold(void) +{ + if(!gpCom_TxBufferAlmostFullCb) + { + return; + } + + for(UInt8 index = 0; index < COMM_ID_SLOT_NB; index++) + { + if((Com_TxBufferAlmostFullCommIds[index] != EMPTY_COMM_ID_SLOT)) + { + UInt16 usagePerc = TX_BUFFER_CALCULATE_USAGE_PERCENTAGE(gpCom_GetFreeBufferSpace(0, Com_TxBufferAlmostFullCommIds[index])); + if(usagePerc < GP_COM_TXBUFFER_ALMOST_FULL_TRESHOLD_PERCENT) + { + gpCom_TxBufferAlmostFullCb(Com_TxBufferAlmostFullCommIds[index], false); + Com_TxBufferAlmostFullCommIds[index] = EMPTY_COMM_ID_SLOT; + } + } + } +} +#endif +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpCom_Init(void) +{ + + Com_InitRx(); + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + gpComSerial_Init(); +#endif //GP_DIVERSITY_COM_UART + { + gpComIoctl_Init(); + } + + + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK + gpCom_TxBufferAlmostFullCb = NULL; +#endif +} + +Bool gpCom_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId) +{ + Bool ret = false; + +#if defined(GP_COM_DIVERSITY_PACKET_FILTERING) && !defined(GP_COM_COMM_ID_IOCTL_KERN) + // Check if the packet should be dropped: + if(gpCom_FilterIsPacketDataToReject(gpCom_TxBufferUsagePercent(), moduleID, length, pData, commId)) + { + return true; + } +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + + //GP_LOG_SYSTEM_PRINTF("TX m=%02x l=%d d=%02x...",0,moduleID, length, pData[0]); +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + if(GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_UART1) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_UART2) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_STMUSB) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_SPI) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_USB)) + { + ret = gpComSerial_DataRequest(moduleID, length, pData, commId); + } + else +#endif + if(GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_KERN1) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_KERN2) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_USER1) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_USER2) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_USER3) + || GP_COMM_ID_CARRIED_BY(commId, GP_COM_COMM_ID_IOCTL_USER4) + ) + { + ret = gpComIoctl_DataRequest(moduleID, length, pData, commId); + } + else + { + ret = false; + } + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK + if(ret == true) + { + Com_CheckTxBufferOverTreshhold(commId); + } +#endif + + if (ret == false + && !(moduleID == GP_COMPONENT_ID_COM && pData[0] == 0xfe && pData[2] == 0x08 /*gpComLinkEvent_Ping_CmdId*/ ) + ) + { + GP_ASSERT_SYSTEM(ret); + } + return ret; + +} + +UInt16 gpCom_GetFreeBufferSpace(UInt8 moduleID, gpCom_CommunicationId_t commId) +{ + NOT_USED(moduleID); +#if ! defined(GP_DIVERSITY_COM_UART) + NOT_USED(commId); +#endif //not defined GP_DIVERSITY_COM_UART +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + if(GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_UART1) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_UART2) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_STMUSB) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_SPI) + || GP_COMM_ID_CARRIED_BY(commId,GP_COM_COMM_ID_USB)) + { + return gpComSerial_GetFreeSpace(commId); + } + else +#endif + GP_ASSERT_DEV_EXT(false); + { + return 0; + } +} + +//Redirection functions +Bool gpCom_GetTXEnable(void) +{ + Bool enabled = false; + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + enabled |= gpComSerial_GetTXEnable(); +#endif + enabled |= gpComIoctl_GetTXEnable(); + + return enabled; +} + +Bool gpCom_TXDataPending(void) +{ + + Bool pending = false; + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + pending |= gpComSerial_TXDataPending(); +#endif + pending |= gpComIoctl_TXDataPending(); + + return pending; +} + + +void gpCom_Flush(void) +{ + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + gpComSerial_Flush(); +#endif + gpComIoctl_Flush(); +} + +void gpCom_DeInit(void) +{ + Com_DeInitRx(); + +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + gpComSerial_DeInit(); +#endif + gpComIoctl_DeInit(); +} + +void gpCom_HandleTx(void) +{ +#if defined(GP_DIVERSITY_COM_UART) || defined(GP_COM_DIVERSITY_SERIAL_SPI) + gpComSerial_HandleTx(); +#endif + gpComIoctl_HandleTx(); +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK + Com_CheckTxBufferBelowTreshold(); +#endif +} + +Bool gpCom_DataRequestAndWaitForAck(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId, Bool *reqAcked, UInt32 timeout, UInt8 ackId) +{ + Bool ret; + Bool timedOut = false; + + HAL_ACQUIRE_MUTEX(Com_MultiThreadingMutex); + *reqAcked = false; + ret = gpCom_DataRequest(moduleID, length, pData, commId); + + //Just wait for ACK if data request was a success + if(ret) + { + UInt32 endPollTime = timeout + gpSched_GetCurrentTime(); + + while(!timedOut) + { + gpCom_HandleTx(); + gpCom_HandleRxBlocking(true, ackId); + if(!(*reqAcked)) + { + if(!gpSched_TimeCompareLower(gpSched_GetCurrentTime(), endPollTime)) + { + timedOut = true; + } + } + else + { + break; + } + } + } + HAL_RELEASE_MUTEX(Com_MultiThreadingMutex); + + if(timedOut) + { + GP_LOG_SYSTEM_PRINTF("WFack fail m:%x l:%u [%x Id:%lx",0, moduleID, length, pData[0], (long unsigned int)commId); + GP_ASSERT_SYSTEM(false); + } + + return ret; +} + + + + +#ifdef GP_COM_DIVERSITY_TXBUFFER_ALMOST_FULL_CALLBACK +gpCom_cbTxBufferAlmostFull_t gpCom_RegisterTxBufferAlmostFull(gpCom_cbTxBufferAlmostFull_t cb) +{ + gpCom_cbTxBufferAlmostFull_t oldCb = gpCom_TxBufferAlmostFullCb; + + gpCom_TxBufferAlmostFullCb = cb; + return oldCb; +} +#endif diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c new file mode 100644 index 0000000..39bcc82 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_IoctlUser.c @@ -0,0 +1,317 @@ +/** + * This file contains a the implementation of the gpCom over a UNIX socket + * + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_COM + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include +#include + +#include "hal.h" +#include "gpUtils.h" +#include "gpCom.h" +#include "gpCom_defs.h" + +#include "ComIoctlInterface_marshalling.h" +#include "gpLog.h" +#include "gpAssert.h" + +#include "gpSched.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#ifdef GP_COM_DEVICE_FILE_NAME +#define COM_DEVICE_FILE_NAME XSTRINGIFY(GP_COM_DEVICE_FILE_NAME) +#else +#define COM_DEVICE_FILE_NAME "/dev/gp" +#endif //def COM_DEVICE_FILE_NAME +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +//State variables +int Com_IoctlFd = -1; + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +void ComIoctl_FlushRx(void); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +void ComIoctl_ConnectionClose(void) +{ + GP_LOG_SYSTEM_PRINTF("Closing connections",0); + Com_ConnectionClose(GP_COM_COMM_ID_IOCTL_USER); + gpComIoctl_DeInit(); + gpComIoctl_Init(); + + GP_ASSERT_SYSTEM(false); +} + +Bool ComIoctl_PollFunction(void) +{ + UInt8 UserspaceBuffer[32+GP_COM_MAX_PACKET_PAYLOAD_SIZE]; + UInt16 Index = 0; + gpCom_Packet_t* pPacket; + int ret; + + MEMSET(&UserspaceBuffer, 0, sizeof(UserspaceBuffer)); + if(Com_IoctlFd < 0) + { + GP_LOG_SYSTEM_PRINTF("Driver not opened? fd:%d",0,Com_IoctlFd); + goto ComIoctl_PollFunction_NoFd; + } + + pPacket = Com_GetFreePacket(); + if (!pPacket) { + GP_LOG_PRINTF("No gpCom_PacketBuffer available",0); + goto ComIoctl_PollFunction_NoPacketBuffer; + } + + readMsg_Input_par2buf( (UInt8Buffer*)UserspaceBuffer, GP_COM_MAX_PACKET_PAYLOAD_SIZE, &Index ); + + ret = ioctl(Com_IoctlFd, GP_IOCTL_READ_STREAM_MSG, UserspaceBuffer); + Index = 0; + readMsg_Output_buf2par(GP_COM_MAX_PACKET_PAYLOAD_SIZE, &pPacket->moduleID, &pPacket->commId, &pPacket->length , pPacket->packet, (UInt8Buffer*)UserspaceBuffer , &Index); + if (ret<0) + { + switch (errno) + { + case ENOMEM: + GP_LOG_SYSTEM_PRINTF("%s: gpOsal_ErrorNoMemory, Userspace allocation too small for packet in kernel: %u < %u",0, __FUNCTION__, GP_COM_MAX_PACKET_PAYLOAD_SIZE, pPacket->length); + GP_ASSERT_SYSTEM(false); + break; + + case ENOTTY: + GP_LOG_SYSTEM_PRINTF("gpOsal_ErrorInvalidIoctl",0); + break; + + case ENODATA: + //No data available + break; + + case ENODEV: + //Device not available during recover, avoid flood of prints + break; + + default: + GP_LOG_SYSTEM_PRINTF("Errornumber: %d",0,errno); + break; + } + goto ComIoctl_PollFunction_IoctlFail; + } + GP_LOG_PRINTF("got msg mid=0x%02X len=%d commid=%lx [ %02x %02x %02x %02x %02x %02x %02x %02x ]", 0, + pPacket->moduleID, pPacket->length, (long unsigned int)pPacket->commId, + pPacket->packet[0], + pPacket->packet[1], + pPacket->packet[2], + pPacket->packet[3], + pPacket->packet[4], + pPacket->packet[5], + pPacket->packet[6], + pPacket->packet[7] + ); + + + //gpLog_PrintBuffer(pPacket->length, pPacket->packet); + + if(!Com_AddPendingPacket(pPacket)) + { + Com_FreePacket(pPacket); + GP_LOG_SYSTEM_PRINTF("No space for handling",0); + } + + return true; + +ComIoctl_PollFunction_IoctlFail: + Com_FreePacket(pPacket); +ComIoctl_PollFunction_NoPacketBuffer: +ComIoctl_PollFunction_NoFd: + return false; +} + +void ComIoctl_PollHandler(UInt8 fd) +{ + NOT_USED(fd); + ComIoctl_PollFunction(); +} + +void ComIoctl_FlushRx(void) +{ + while(ComIoctl_PollFunction()); +} + +void ComIoctl_SignalIOHandler(int sig, siginfo_t *siginfo, void* context) +{ + NOT_USED(sig); + NOT_USED(siginfo); + NOT_USED(context); + GP_LOG_SYSTEM_PRINTF("Driver reset detected",0); + gpSched_ScheduleEvent(0, ComIoctl_ConnectionClose); +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +void gpComIoctl_Init (void) +{ + int oldFlags; + struct sigaction act; + + Com_IoctlFd = open(COM_DEVICE_FILE_NAME, O_RDWR|O_CLOEXEC); + if (Com_IoctlFd < 0) + { + GP_LOG_SYSTEM_PRINTF("Can't open device file: %s", 0, COM_DEVICE_FILE_NAME); + GP_ASSERT_SYSTEM(false); + return; + } + + memset(&act, 0, sizeof(act)); + act.sa_sigaction = &ComIoctl_SignalIOHandler; + act.sa_flags = SA_SIGINFO; + if(sigaction(SIGIO, &act, NULL) < 0) + { + GP_LOG_SYSTEM_PRINTF("Can't assign SIGIO",0); + GP_ASSERT_SYSTEM(false); + return; + } + + fcntl(Com_IoctlFd, F_SETOWN, getpid()); + //FASYNC needs to be set through fcntl + oldFlags = fcntl(Com_IoctlFd, F_GETFL); + fcntl(Com_IoctlFd, F_SETFL, oldFlags | FASYNC); + + hal_RegisterPollFunction(Com_IoctlFd, ComIoctl_PollHandler); +} + +Bool gpComIoctl_GetTXEnable(void) +{ + return (Com_IoctlFd >= 0); +} + +void gpComIoctl_DeInit(void) +{ + if(Com_IoctlFd >= 0) + { + hal_UnRegisterPollFunction(Com_IoctlFd); + close(Com_IoctlFd); + Com_IoctlFd = -1; + } +} + +Bool gpComIoctl_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId) +{ + UInt8 UserspaceBuffer[32+GP_COM_MAX_PACKET_PAYLOAD_SIZE]; + UInt16 Index = 0; + int ret; + + if (Com_IoctlFd < 0) { + return false; + } + + MEMSET(&UserspaceBuffer, 0, sizeof(UserspaceBuffer)); + + GP_ASSERT_DEV_INT(GP_COM_COMM_ID_IOCTL_USER & commId); // return path hardcodes this value + + writeMsg_Input_par2buf( (UInt8Buffer*)UserspaceBuffer , moduleID , commId , length , pData , &Index); + GP_ASSERT_SYSTEM(Index < sizeof(UserspaceBuffer)); + + ret = ioctl(Com_IoctlFd, GP_IOCTL_WRITE_STREAM_MSG, UserspaceBuffer); + if(ret < 0) + { + switch (errno) + { + case ENOMEM: + GP_LOG_SYSTEM_PRINTF("%s: gpOsal_ErrorNoMemory, Userspace allocation too small for packet in kernel: %u < %u",0, __FUNCTION__, GP_COM_MAX_PACKET_PAYLOAD_SIZE, length); + GP_ASSERT_SYSTEM(false); + break; + case ENOTTY: + GP_LOG_SYSTEM_PRINTF("gpOsal_ErrorInvalidIoctl",0); + break; + case ENODATA: + //No data available + break; + case ENODEV: + //Device not available during recover, avoid flood of prints + break; + default: + GP_LOG_SYSTEM_PRINTF("Errornumber: %d",0,errno); + break; + } + return false; + } + else + { + return true; + } +} + +void gpComIoctl_HandleTx(void) +{ + +} + +void gpComIoctl_Flush(void) +{ + //No Tx side flush needed +} + +Bool gpComIoctl_TXDataPending(void) +{ +/* A datarequest will handover any tx data directly to the ioctl fd, so at no point will + there be any tx data pending */ + return false; +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c new file mode 100644 index 0000000..57ce4b5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c @@ -0,0 +1,783 @@ +/* + * Copyright (c) 2014-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +//#define GP_LOCAL_LOG +#define GP_COMPONENT_ID GP_COMPONENT_ID_COM + +#include "hal.h" +#include "gpCom.h" +#include "gpCom_defs.h" + +#include "gpLog.h" +#include "gpAssert.h" + +#ifdef GP_FREERTOS_DIVERSITY_NO_GPSCHED +#include "hal_SchedFreeRTOS.h" +#endif //GP_FREERTOS_DIVERSITY_NO_GPSCHED +#include "gpSched.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_COM_RX_PACKET_BUFFERS +#if !defined(GP_COM_DIVERSITY_MULTIPLE_COM) +#define GP_COM_RX_PACKET_BUFFERS 1 +#else +//Reserve minimum space for possible simultaneous indication and ack +#define GP_COM_RX_PACKET_BUFFERS 2 +#endif //GP_DIVERSITY_COM_SHMEM && !defined(GP_COM_DIVERSITY_MULTIPLE_COM) +#endif //GP_COM_RX_PACKET_BUFFERS + +#define GP_COM_UNKNOWN_MODULE_ID 0 +#ifndef GP_COM_MAX_NUMBER_OF_MODULE_IDS +#define GP_COM_MAX_NUMBER_OF_MODULE_IDS 2 //16 +#endif //GP_COM_MAX_NUMBER_OF_MODULE_IDS + +#define BITS_IN_BYTE 8 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct gpCom_ModuleIDCallbackEntry { + UInt8 moduleID; + gpCom_HandleCallback_t handleCallback; +} gpCom_ModuleIDCallbackEntry_t; + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +typedef struct +{ + UInt8 bufferUsageThresh; // A threshold of RX queue usage in percents + UInt8 moduleId; + UInt8 patternsCnt; + gpCom_FilterPattern_t patterns[GP_COM_FILTER_PATTERN_MAX_CNT]; + Bool enabled; +} gpCom_FilterData_t; +#endif //GP_COM_DIVERSITY_PACKET_FILTERING + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static gpCom_Packet_t* gpCom_PacketHandlingQueue[GP_COM_RX_PACKET_BUFFERS]; +static gpCom_Packet_t gpCom_PacketBuffer[GP_COM_RX_PACKET_BUFFERS] GP_EXTRAM_SECTION_ATTR; +static UInt8 gpCom_PacketBufferClaimed[(GP_COM_RX_PACKET_BUFFERS-1)/8+1]; + +static gpCom_ModuleIDCallbackEntry_t gpCom_ModuleIDCallbackTable[GP_COM_MAX_NUMBER_OF_MODULE_IDS]; + +HAL_CRITICAL_SECTION_DEF(Com_RxMutex) +HAL_CRITICAL_SECTION_DEF(Com_MultiThreadingMutex) +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) +Bool gpCom_TxLocked; +#endif + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +static gpCom_FilterData_t filters[GP_COM_FILTER_CNT]; +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Internal Function Prototypes + *****************************************************************************/ + +//Packet memory handlers +gpCom_Packet_t* Com_GetFreePacket(void); +void Com_FreePacket(gpCom_Packet_t* pPacket); +//Queue handler +Bool Com_AddPendingPacket(gpCom_Packet_t* pPacket); + +void Com_InitRx(void); +void Com_ConnectionClose(gpCom_CommunicationId_t commId); + +void Com_Execute(gpCom_Packet_t * pPacket); + +void gpCom_HandleRxNonBlocking(void); +void Com_ExecuteAndFreePacket(gpCom_Packet_t* pPacket, Bool blockingWait, UInt8 cmdId); + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ +static void Com_ShiftHandlingQueue(UInt8 startIndex); +static gpCom_Packet_t* Com_GetPendingPacketWithCmdId(UInt8 cmdId); +static gpCom_Packet_t* Com_GetPendingPacket(void); + + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +static Bool isFilterPatternInPacket(gpCom_FilterPattern_t* pPattern, UInt16 length, UInt8* pData); +static Bool isPatternEqual(const gpCom_FilterPattern_t* pInPattern, const gpCom_FilterPattern_t* pOutPattern, UInt8 patternsCnt); +static UInt8 getFilterIdx(UInt8 threshold); +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +#ifdef GP_LOCAL_LOG +void Com_DumpRxBuffers(void) +{ + UIntLoop i; + for (i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + gpCom_Packet_t* pPacket = &gpCom_PacketBuffer[i]; + GP_LOG_SYSTEM_PRINTF("mem- %i:%i id:%x l:%i comm:%lu [%x",0,i, BIT_TST(gpCom_PacketBufferClaimed[i/8],i%8), + pPacket->moduleID, + pPacket->length, + (unsigned long)pPacket->commId, + pPacket->packet[0]); + gpLog_Flush(); + } + for (i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(gpCom_PacketHandlingQueue[i]) + { + gpCom_Packet_t* pPacket = gpCom_PacketHandlingQueue[i]; + + GP_LOG_SYSTEM_PRINTF("que- %i:id:%x l:%i comm:%lu [%x",0,i, pPacket->moduleID, + pPacket->length, + (unsigned long)pPacket->commId, + pPacket->packet[0]); + gpLog_Flush(); + } + } +} +#endif + +//Memory Claim/Free +gpCom_Packet_t* Com_GetFreePacket(void) +{ + UIntLoop i; + gpCom_Packet_t *pPacket = NULL; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return NULL; + } + + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(!BIT_TST(gpCom_PacketBufferClaimed[i/8], i%8)) + { + GP_LOG_PRINTF("G %i",0,i); + BIT_SET(gpCom_PacketBufferClaimed[i/8], i%8); + pPacket = &(gpCom_PacketBuffer[i]); + break; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + if(NULL == pPacket) + { + GP_LOG_PRINTF("No Rx buf",0); +#ifdef GP_LOCAL_LOG + Com_DumpRxBuffers(); +#endif //GP_LOCAL_LOG + } + return pPacket; +} + +void Com_FreePacket(gpCom_Packet_t* pPacket) +{ + UIntLoop i; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return; + } + + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(pPacket == &(gpCom_PacketBuffer[i])) + { + GP_LOG_PRINTF("Fr %i",0,i); + BIT_CLR(gpCom_PacketBufferClaimed[i/8], i%8); + break; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + if(i == GP_COM_RX_PACKET_BUFFERS) + { + GP_LOG_PRINTF("F: packet not found: id:%x l:%i comm:%lu",0,pPacket->moduleID, + pPacket->length, + (unsigned long)pPacket->commId); + GP_ASSERT_DEV_EXT(false); + } +} + +//Handling queue - preserve in order execution +static void Com_ShiftHandlingQueue(UInt8 startIndex) +{ + // always called from inside mutex, so no mutex here ! +#if GP_COM_RX_PACKET_BUFFERS > 1 + UIntLoop i; + GP_ASSERT_DEV_INT(startIndex < GP_COM_RX_PACKET_BUFFERS); + //Shift to front and add NULL at the end + for(i = startIndex; i < GP_COM_RX_PACKET_BUFFERS-1; i++) + { + gpCom_PacketHandlingQueue[i] = gpCom_PacketHandlingQueue[i+1]; + } +#endif //GP_COM_RX_PACKET_BUFFERS > 1 + gpCom_PacketHandlingQueue[GP_COM_RX_PACKET_BUFFERS-1] = NULL; +} + +Bool Com_AddPendingPacket(gpCom_Packet_t* pPacket) +{ + UIntLoop i; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return false; + } + + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(gpCom_PacketHandlingQueue[i] == NULL) + { + GP_LOG_PRINTF("Add %i",0, i); + gpCom_PacketHandlingQueue[i] = pPacket; + break; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + return i != GP_COM_RX_PACKET_BUFFERS; +} + +static gpCom_Packet_t* Com_GetPendingPacket(void) +{ + gpCom_Packet_t *pPacket = NULL; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return NULL; + } + + Com_FlushRx(); + HAL_ACQUIRE_MUTEX(Com_RxMutex); + pPacket = gpCom_PacketHandlingQueue[0]; + if(pPacket != NULL) + { + Com_ShiftHandlingQueue(0); + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + return pPacket; +} + +static gpCom_Packet_t* Com_GetPendingPacketWithCmdId(UInt8 cmdId) +{ + UIntLoop i; + gpCom_Packet_t *pPacket = NULL; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return NULL; + } + + Com_FlushRx(); + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if((gpCom_PacketHandlingQueue[i] != NULL) + && (gpCom_PacketHandlingQueue[i]->packet[0] == cmdId)) + { + pPacket = gpCom_PacketHandlingQueue[i]; + Com_ShiftHandlingQueue(i); + break; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + return pPacket; +} + +void Com_InitRx(void) +{ + UIntLoop i; + for (i=0;i < GP_COM_MAX_NUMBER_OF_MODULE_IDS;i++) + { + gpCom_ModuleIDCallbackTable[i].moduleID = GP_COM_UNKNOWN_MODULE_ID; + gpCom_ModuleIDCallbackTable[i].handleCallback = NULL; + } + for (i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + gpCom_PacketHandlingQueue[i] = NULL; + } +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING + for(i = 0; i < GP_COM_FILTER_CNT; i++) + { + filters[i].enabled = false; + } +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + MEMSET(gpCom_PacketBufferClaimed, 0x0, sizeof(gpCom_PacketBufferClaimed)); + HAL_CREATE_MUTEX(&Com_RxMutex); + HAL_CREATE_MUTEX(&Com_MultiThreadingMutex); +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) + gpCom_TxLocked = true; +#endif +} + +void Com_DeInitRx(void) +{ + if(HAL_VALID_MUTEX(Com_RxMutex)) + { + HAL_DESTROY_MUTEX(&Com_RxMutex); + } + if(HAL_VALID_MUTEX(Com_MultiThreadingMutex)) + { + HAL_DESTROY_MUTEX(&Com_MultiThreadingMutex); + } +} + +void Com_Execute(gpCom_Packet_t* pPacket) +{ + UIntLoop i; + //GP_LOG_SYSTEM_PRINTF("Ex:%x %i %lx [%x",0, pPacket->moduleID, pPacket->length, (unsigned long int)pPacket->commId, pPacket->packet[0]); + +#if defined(GP_COM_COMM_ID_BRIDGE_1) && defined(GP_COM_COMM_ID_BRIDGE_2) + gpCom_DataRequest(pPacket->moduleID, pPacket->length, pPacket->packet, (pPacket->commId == GP_COM_COMM_ID_BRIDGE_1) ? \ + GP_COM_COMM_ID_BRIDGE_2 : \ + GP_COM_COMM_ID_BRIDGE_1); +#endif /* GP_COM_COMM_ID_BRIDGE_1/GP_COM_COMM_ID_BRIDGE_2 */ + + + for (i=0;i < GP_COM_MAX_NUMBER_OF_MODULE_IDS;i++) + { + if (gpCom_ModuleIDCallbackTable[i].moduleID == pPacket->moduleID) + { + if (gpCom_ModuleIDCallbackTable[i].handleCallback != NULL) + { + gpCom_ModuleIDCallbackTable[i].handleCallback(pPacket->length, pPacket->packet, pPacket->commId); + break; + } + } + else + { + GP_LOG_PRINTF("No %x-%x",2,(UInt16)pPacket->moduleID,(UInt16)gpCom_ModuleIDCallbackTable[i].moduleID); + } + } +} + +void Com_ConnectionClose(gpCom_CommunicationId_t commId) +{ + UIntLoop i; + + GP_LOG_PRINTF("Close %lx",2, (long unsigned int)commId); + for (i=0;i < GP_COM_MAX_NUMBER_OF_MODULE_IDS;i++) + { + //Notify all modules of connection loss + if (gpCom_ModuleIDCallbackTable[i].handleCallback != NULL) + { + gpCom_ModuleIDCallbackTable[i].handleCallback(0, NULL, commId); + } + } +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +Bool gpCom_RegisterModule(UInt8 moduleID, gpCom_HandleCallback_t handleCallback) +{ + UIntLoop i; + //check for unknown module id + if (moduleID == GP_COM_UNKNOWN_MODULE_ID) + { + GP_ASSERT_DEV_EXT(false); // proper handling provided (might be omitted) + return false; + } + + //search for entry matching module id in binding table + //search for free entry in binding table + for (i =0;imoduleID, pPacket->length, pPacket->packet[0]); + + //Execute packet content + Com_Execute(pPacket); + + //Free handled packet memory + Com_FreePacket(pPacket); + } +} + +void Com_cbPacketReceived(gpCom_Packet_t* pPacket) +{ +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) + if (gpCom_TxLocked) + { + { + gpCom_TxLocked = false; + Com_TriggerTx(pPacket->commId); + } + } +#endif + + +#if defined(GP_COM_DIVERSITY_PACKET_FILTERING) && defined(GP_COM_COMM_ID_IOCTL_KERN) + // Check if the packet should be dropped: + UInt8 queueUsagePer = gpCom_RxBufferUsagePercent(); + if(gpCom_FilterIsPacketToReject(queueUsagePer, pPacket)) + { + Com_FreePacket(pPacket); + return; + } +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + + //GP_LOG_SYSTEM_PRINTF("Add:%x l:%u %lx [%x", 0, state->moduleID, state->length, (unsigned long)state->commId, state->pPacket->packet[0]); + if(!Com_AddPendingPacket(pPacket)) + { + Com_FreePacket(pPacket); + GP_LOG_SYSTEM_PRINTF("No space to handle",0); + GP_ASSERT_SYSTEM(false); + return; + } +#ifdef GP_FREERTOS_DIVERSITY_NO_GPSCHED + hal_FreeRTOSSchedTaskNotify(); +#endif //GP_FREERTOS_DIVERSITY_NO_GPSCHED + + gpSched_Trigger(); +} + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +UInt16 gpCom_ClaimedBuffersCnt(void) +{ + UInt8 i; + UInt16 bufClaimed = 0; + + if(!HAL_VALID_MUTEX(Com_RxMutex)) + { + //Rx not initialized yet + return 0; + } + + HAL_ACQUIRE_MUTEX(Com_RxMutex); + for(i=0; i < GP_COM_RX_PACKET_BUFFERS; i++) + { + if(BIT_TST(gpCom_PacketBufferClaimed[i / BITS_IN_BYTE], i % BITS_IN_BYTE)) + { + bufClaimed++; + } + } + HAL_RELEASE_MUTEX(Com_RxMutex); + + return bufClaimed; +} + +UInt8 gpCom_RxBufferUsagePercent(void) +{ + return ((gpCom_ClaimedBuffersCnt() * 100) / GP_COM_RX_PACKET_BUFFERS); +} + +Bool gpCom_AddFilter(UInt8 moduleId, UInt8 bufferUsageThresh, UInt8 patternsCnt, const gpCom_FilterPattern_t* patterns) +{ + UInt8 i; + UInt8 idx; + + if(!patterns || (patternsCnt > GP_COM_FILTER_PATTERN_MAX_CNT) || (bufferUsageThresh >= 100) || (filters[GP_COM_FILTER_CNT - 1].enabled)) + { + return false; + } + + for(i = 0; i < patternsCnt; i++) + { + if(!patterns[i].len || (patterns[i].len > GP_COM_FILTER_PATTERN_MAX_LEN)) + { + return false; + } + } + + idx = getFilterIdx(bufferUsageThresh); + + if (idx >= GP_COM_FILTER_CNT) + { + return false; + } + + filters[idx].enabled = true; + filters[idx].moduleId = moduleId; + filters[idx].bufferUsageThresh = bufferUsageThresh; + filters[idx].patternsCnt = patternsCnt; + + for(i = 0; i < patternsCnt; i++) + { + memcpy(filters[idx].patterns[i].data, patterns[i].data, patterns[i].len); + + filters[idx].patterns[i].len = patterns[i].len; + filters[idx].patterns[i].offset = patterns[i].offset; + } + + return true; +} + +Bool gpCom_RemoveFilter(UInt8 moduleId, UInt8 bufferUsageThresh, UInt8 patternsCnt, const gpCom_FilterPattern_t* patterns) +{ + UInt8 i, j; + + if(!patterns) + { + return false; + } + + // Find the position of the filter to be removed + for(i = 0; i < GP_COM_FILTER_CNT; i++) + { + if(filters[i].enabled && filters[i].moduleId == moduleId + && filters[i].bufferUsageThresh == bufferUsageThresh + && patternsCnt == filters[i].patternsCnt + && isPatternEqual(patterns, filters[i].patterns, filters[i].patternsCnt)) + { + break; + } + } + + // If the filter was found, remove it and shift elements + if(i < GP_COM_FILTER_CNT - 1) + { + for(j = i; j < GP_COM_FILTER_CNT - 1; j++) + { + filters[j] = filters[j + 1]; + if(j == GP_COM_FILTER_CNT - 2) + { + filters[GP_COM_FILTER_CNT - 1].enabled = false; + } + } + } + else + { + if(i == GP_COM_FILTER_CNT - 1) + { + filters[i].enabled = false; + return true; + } + return false; + } + + return true; +} + +Bool gpCom_FilterIsPacketToReject(UInt8 queueUsagePer, gpCom_Packet_t* pPacket) +{ + return gpCom_FilterIsPacketDataToReject(queueUsagePer, pPacket->moduleID, pPacket->length, pPacket->packet, pPacket->commId); +} + +Bool gpCom_FilterIsPacketDataToReject(UInt8 queueUsagePer, UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId) +{ + UInt8 filterIdx; + UInt8 patternIdx; + Bool patternFound = false; + + for(filterIdx = 0; (filterIdx < GP_COM_FILTER_CNT) && !patternFound; filterIdx++) + { + patternFound = false; + // Check if filter is enabled and the moduleId is match: + if(!filters[filterIdx].enabled || (filters[filterIdx].moduleId != moduleID)) + { + continue; + } + + // Check the queue usage threshold (if set to 0, ignore the usage and go to the next step): + if(filters[filterIdx].bufferUsageThresh && (queueUsagePer <= filters[filterIdx].bufferUsageThresh)) + { + continue; + } + + // Check if all of the patterns are found in the packet data: + for(patternIdx = 0; patternIdx < filters[filterIdx].patternsCnt; patternIdx++) + { + patternFound = isFilterPatternInPacket(&filters[filterIdx].patterns[patternIdx], length, pData); + + if(!patternFound) + { + break; // Pattern not found, break the loop and skip to the next filter + } + } + } + + return patternFound; +} + +static Bool isFilterPatternInPacket(gpCom_FilterPattern_t* pPattern, UInt16 length, UInt8* pData) +{ + // Check if the packet is long enough to apply this filtering pattern: + if((pPattern->offset + pPattern->len) > length) + { + return false; + } + + // Compare pattern data with the packet data on given offset: + if(!memcmp(&pData[pPattern->offset], pPattern->data, pPattern->len)) + { + return true; + } + + return false; +} + +static UInt8 getFilterIdx(UInt8 threshold) +{ + UInt8 i; + int j; + + for(i = 0; i < GP_COM_FILTER_CNT; i++) + { + if(!filters[i].enabled || (filters[i].bufferUsageThresh > threshold)) + { + break; + } + } + for(j = GP_COM_FILTER_CNT - 1; j >= i; j--) + { + if(filters[i].enabled) + { + filters[j + 1] = filters[j]; + } + } + return i; +} + +static Bool isPatternEqual(const gpCom_FilterPattern_t* pInPattern, const gpCom_FilterPattern_t* pOutPattern, UInt8 patternsCnt) +{ + int i; + for(i = 0; i < patternsCnt; i++) + { + if(pInPattern[i].len == pOutPattern[i].len && pInPattern[i].offset == pOutPattern[i].offset) + { + if(memcmp(pInPattern[i].data, pOutPattern[i].data, pOutPattern[i].len)) + { + return false; + } + } + else + { + return false; + } + } + return true; +} + +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_defs.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_defs.h new file mode 100644 index 0000000..33969e7 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpCom/src/gpCom_defs.h @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPCOM_DEFS_H_ +#define _GPCOM_DEFS_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "gpCom.h" +#include "linux/ioctl.h" +/**************************************************************************** + * Macro Definitions + *****************************************************************************/ + + + +#define GP_COM_BLE_HEADER_LENGTH 1 + +//Shared for UART and USB +#define GP_COM_PACKET_HEADER_LENGTH 6 +#define GP_COM_PACKET_FOOTER_LENGTH 2 +#define GP_COM_PACKET_COMMID_LENGTH 4 + +#define GP_COM_MAXIMAL_COMMAND_PARAMETERS (GP_COM_MAX_PACKET_PAYLOAD_SIZE - sizeof(gpCom_CommandID_t)) + +#define GP_IOC_MAGIC 'G' + +#define GP_IOCTL_WRITE_MSG _IOW(GP_IOC_MAGIC, 1, int) +#define GP_IOCTL_READ_MSG _IOR(GP_IOC_MAGIC, 2, int) +#define GP_IOCTL_WRITE_STREAM_MSG _IOW(GP_IOC_MAGIC, 3, int) +#define GP_IOCTL_READ_STREAM_MSG _IOR(GP_IOC_MAGIC, 4, int) + +#define GP_SHMEM_MAX_PAYLOAD_LENGTH (GP_SHMEM_MSG_HEADER_LENGTHFIELD_MAX-GP_SHMEM_MSG_HEADER_LEN) + +//#ifdef GP_BSP_USB_COM +/* USB uses the buffer from uart1 */ +//#define GP_COM_NUM_UART 1 +//#endif + +#ifndef GP_BSP_UART_COM1 +//Dummy define for flush function +#define GP_BSP_UART_COM1 +#endif //GP_BSP_UART_COM1 + +#ifndef GP_BSP_UART_COM2 +#define GP_COM_NUM_UART 1 +#else +#define GP_COM_NUM_UART 2 +#endif + +#define gpCom_SynProtocol_FrameControl_CommIdIsEmbedded 0x80 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +#define gpCom_CommandIDTxOverflowIndication 0x02 +typedef UInt8 gpCom_CommandID_t; + +typedef struct gpCom_SerialPacket +{ + gpCom_CommandID_t commandID; + UInt8 commandParameters[GP_COM_MAXIMAL_COMMAND_PARAMETERS]; +} gpCom_SerialPacket_t; + +////////////////// +// TxOverflowIndication +////////////////// + +typedef struct gpCom_TxOverflowIndicationCommandParameters +{ + UInt16 numberOfMissedMessages; +}gpCom_TxOverflowIndicationCommandParameters_t; + +#define gpCom_ProtocolPacketHeader 0 +#define gpCom_ProtocolPacketCommId 1 +#define gpCom_ProtocolPacketData 2 +#define gpCom_ProtocolPacketFooter 3 +typedef UInt8 gpCom_ProtocolPacket_t; + +typedef struct gpCom_PacketHeader_s { + UInt8 length; + UInt8 moduleID; + UInt16 crc; +} gpCom_PacketHeader_t; + +typedef struct gpCom_Packet_s { + gpCom_CommunicationId_t commId; + UInt16 length; + UInt8 moduleID; + UInt8 packet[GP_COM_MAX_PACKET_PAYLOAD_SIZE]; +} gpCom_Packet_t; + +typedef struct { + gpCom_Packet_t* pPacket; + UInt16 crc; + gpCom_ProtocolPacket_t partOfPacket; //Header/data/footer + UInt16 counter; + UInt16 length; + UInt8 moduleID; + gpCom_CommunicationId_t commId; + gpCom_Protocol_t Com_protocol; +} gpCom_ProtocolState_t; + +typedef struct gpComIoctl_Buffer_s { + /* WARNING: do not change this struct. It is a binary interface between + * kernel- and usercode */ + UInt8 moduleID; + UInt16 length; + gpCom_CommunicationId_t commId; + UInt8 *pData; +} gpComIoctl_Buffer_t; + + +extern gpCom_cbActivateTx_t gpCom_ActivateTxCb[]; +extern UInt8 nbrOfgpCom_ActivateTxCbs; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +//Packet memory handlers +gpCom_Packet_t* Com_GetFreePacket(void); +void Com_FreePacket(gpCom_Packet_t* pPacket); +//Queue handler +Bool Com_AddPendingPacket(gpCom_Packet_t* pPacket); +void Com_Execute(gpCom_Packet_t * pPacket); + +void Com_InitRx(void); +void Com_ConnectionClose(gpCom_CommunicationId_t commId); +void Com_DeInitRx(void); + +//Specific parsing +#define gpCom_ProtocolDone 0 +#define gpCom_ProtocolContinue 1 +#define gpCom_ProtocolError 2 +typedef UInt8 gpCom_ProtocolStatus_t; + +//Specific parsing +gpCom_ProtocolStatus_t ComSynProtocol_ParseBuffer(UInt8 *rxbuf, UInt16 size, gpCom_ProtocolState_t* state); +gpCom_ProtocolStatus_t ComSynProtocol_ParseByte(UInt8 rxbyte, gpCom_ProtocolState_t* state); + +extern gpCom_ProtocolState_t gpComUart_RxState[]; + +void Com_ParseProtocol(Int16 rxbyte, gpCom_CommunicationId_t comm_id); +void ComSerial_ParseBuffer(UInt8 *buffer, UInt16 size, gpCom_CommunicationId_t comm_id); + +#if defined(GP_DIVERSITY_COM_UART) +#define Com_FlushRxSerial() ComSerial_FlushRx(); +#else +#define Com_FlushRxSerial() +#endif + +#define Com_FlushRxIoctl() ComIoctl_FlushRx(); + +#define Com_FlushRx() do { Com_FlushRxSerial() Com_FlushRxIoctl() } while(false) + +#if defined( GP_DIVERSITY_COM_UART ) || defined(GP_COM_DIVERSITY_SERIAL_SPI) +//UART functions +extern UInt16 gpComSerial_GetPacketSize(gpCom_CommunicationId_t commId, UInt16 payloadSize); +extern void gpComSerial_Init(void); +extern Bool gpComSerial_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId); +extern UInt16 gpComSerial_GetFreeSpace(gpCom_CommunicationId_t commId); +extern Bool gpComSerial_GetTXEnable(void); +extern void gpComSerial_HandleTx(void); +extern void gpComSerial_Flush(void); +extern void gpComSerial_DeInit(void); +extern Bool gpComSerial_TXDataPending(void); +extern void ComSerial_FlushRx(void); +Bool Com_IsDataWaiting(gpCom_CommunicationId_t commId); +UInt8 Com_GetData(gpCom_CommunicationId_t commId); +#endif //defined( GP_DIVERSITY_COM_UART ) || defined( GP_DIVERSITY_COM_USB) + +#if defined( GP_DIVERSITY_COM_UART ) +void gpComUart_Init(void); +void gpComUart_DeInit(void); +void gpComUart_Flush(void); +void ComUart_FlushRx(void); +void ComUart_TriggerTx(UInt8 uart); +#endif //defined( GP_DIVERSITY_COM_UART ) + +UInt16 Com_CalculateSizeOfNewData(gpCom_CommunicationId_t commId, UInt16* sizeContinuous); + +void Com_SetDataReadPointer(gpCom_CommunicationId_t commId, UInt16 readPtr); + + + + +extern void gpComIoctl_Init(void); +extern Bool gpComIoctl_DataRequest(UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId); +extern Bool gpComIoctl_GetTXEnable(void); +extern void gpComIoctl_HandleTx(void); +extern void gpComIoctl_Flush(void); +extern void ComIoctl_FlushRx(void); +extern void gpComIoctl_DeInit(void); +extern Bool gpComIoctl_TXDataPending(void); + + +UInt16 Com_Call_ActivateTxCb(UInt16 overFlowCounter, gpCom_CommunicationId_t commId); + +void Com_cbPacketReceived(gpCom_Packet_t* pPacket); + +#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) +extern Bool gpCom_TxLocked; +#endif //#if defined(GP_COM_DIVERSITY_UNLOCK_TX_AFTER_RX) + +void Com_TriggerTx(gpCom_CommunicationId_t commId); + + +extern Bool gpCom_Initialized; +#ifdef GP_COM_DIVERSITY_SERIAL +extern Bool gpComSerial_Initialized; +#endif + +#ifdef GP_COM_DIVERSITY_PACKET_FILTERING +UInt16 gpCom_ClaimedBuffersCnt(void); +UInt8 gpCom_RxBufferUsagePercent(void); +Bool gpCom_FilterIsPacketToReject(UInt8 queueUsagePer, gpCom_Packet_t* pPacket); +Bool gpCom_FilterIsPacketDataToReject(UInt8 queueUsagePer, UInt8 moduleID, UInt16 length, UInt8* pData, gpCom_CommunicationId_t commId); +#endif //def GP_COM_DIVERSITY_PACKET_FILTERING + +#endif // _GPCOM_DEFS_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen/gpEncryption_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen/gpEncryption_marshalling.h new file mode 100644 index 0000000..1234389 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen/gpEncryption_marshalling.h @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPENCRYPTION_MARSHALLING_H_ +#define _GPENCRYPTION_MARSHALLING_H_ + +//DOCUMENTATION ENCRYPTION: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpEncryption.h" +/* AdditionalIncludes */ +#include "gpPd_marshalling.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + UInt8 pKey[16]; + UInt8 pNonce[13]; +} gpEncryption_CCMOptions_t_pointer_marshall_t; + +typedef struct { + gpEncryption_CCMOptions_t data[1]; + gpEncryption_CCMOptions_t_pointer_marshall_t memberpointers[1]; +} gpEncryption_CCMOptions_t_l1_pointer_marshall_t; + + +typedef struct { + gpEncryption_AESOptions_t data[1]; +} gpEncryption_AESOptions_t_l1_pointer_marshall_t; + + +typedef struct { + gpEncryption_CCMOptions_t* pCCMOptions; +} gpEncryption_CCMEncrypt_Input_struct_t; + +typedef struct { + gpEncryption_CCMEncrypt_Input_struct_t data; + gpEncryption_CCMOptions_t_l1_pointer_marshall_t pCCMOptions; +} gpEncryption_CCMEncrypt_Input_marshall_struct_t; + +typedef struct { + gpEncryption_Result_t result; + UInt8* pDataOut; +} gpEncryption_CCMEncrypt_Output_struct_t; + +typedef struct { + gpEncryption_CCMEncrypt_Output_struct_t data; + UInt8 pDataOut[128]; +} gpEncryption_CCMEncrypt_Output_marshall_struct_t; + + +typedef struct { + gpEncryption_CCMOptions_t* pCCMOptions; +} gpEncryption_CCMDecrypt_Input_struct_t; + +typedef struct { + gpEncryption_CCMDecrypt_Input_struct_t data; + gpEncryption_CCMOptions_t_l1_pointer_marshall_t pCCMOptions; +} gpEncryption_CCMDecrypt_Input_marshall_struct_t; + +typedef struct { + gpEncryption_Result_t result; + UInt8* pDataOut; +} gpEncryption_CCMDecrypt_Output_struct_t; + +typedef struct { + gpEncryption_CCMDecrypt_Output_struct_t data; + UInt8 pDataOut[128]; +} gpEncryption_CCMDecrypt_Output_marshall_struct_t; + + +typedef struct { + UInt8* pInplaceBuffer; + UInt8* pAesKey; + gpEncryption_AESOptions_t AESOptions; +} gpEncryption_AESEncrypt_Input_struct_t; + +typedef struct { + gpEncryption_AESEncrypt_Input_struct_t data; + UInt8 pInplaceBuffer[16]; + UInt8 pAesKey[32]; + gpEncryption_AESOptions_t_l1_pointer_marshall_t AESOptions; +} gpEncryption_AESEncrypt_Input_marshall_struct_t; + +typedef struct { + gpEncryption_Result_t result; + // pInplaceBuffer used from input structure because it is an inout parameter +} gpEncryption_AESEncrypt_Output_struct_t; + +typedef struct { + gpEncryption_AESEncrypt_Output_struct_t data; + // pInplaceBuffer used from input structure because it is an inout parameter +} gpEncryption_AESEncrypt_Output_marshall_struct_t; + + + +typedef union { + gpEncryption_CCMEncrypt_Input_marshall_struct_t gpEncryption_CCMEncrypt; + gpEncryption_CCMDecrypt_Input_marshall_struct_t gpEncryption_CCMDecrypt; + gpEncryption_AESEncrypt_Input_marshall_struct_t gpEncryption_AESEncrypt; + UInt8 dummy; //ensure none empty union definition +} gpEncryption_Server_Input_union_t; + +typedef union { + gpEncryption_CCMEncrypt_Output_marshall_struct_t gpEncryption_CCMEncrypt; + gpEncryption_CCMDecrypt_Output_marshall_struct_t gpEncryption_CCMDecrypt; + gpEncryption_AESEncrypt_Output_marshall_struct_t gpEncryption_AESEncrypt; + UInt8 dummy; //ensure none empty union definition +} gpEncryption_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpEncryption_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpEncryption_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpEncryption_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpEncryption_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpEncryption_SecLevel_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpEncryption_SecLevel_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpEncryption_SecLevel_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpEncryption_SecLevel_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpEncryption_KeyId_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpEncryption_KeyId_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpEncryption_KeyId_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpEncryption_KeyId_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpEncryption_AESKeyLen_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpEncryption_AESKeyLen_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpEncryption_AESKeyLen_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpEncryption_AESKeyLen_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +gpMarshall_AckStatus_t gpEncryption_CCMOptions_t_buf2api(gpEncryption_CCMOptions_t* pDest ,gpEncryption_CCMOptions_t_pointer_marshall_t* pDestPointers , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex , Bool storePdHandle ); +void gpEncryption_CCMOptions_t_api2buf(UInt8Buffer* pDest , const gpEncryption_CCMOptions_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpEncryption_AESOptions_t_buf2api(gpEncryption_AESOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpEncryption_AESOptions_t_api2buf(UInt8Buffer* pDest , const gpEncryption_AESOptions_t* pSource , UInt16 length , UInt16* pIndex); +// Server functions +gpMarshall_AckStatus_t gpEncryption_CCMEncrypt_Input_buf2api(gpEncryption_CCMEncrypt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_CCMEncrypt_Output_api2buf(UInt8Buffer* pDest , gpEncryption_CCMEncrypt_Output_marshall_struct_t* pSourceoutput , gpEncryption_CCMEncrypt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpEncryption_CCMDecrypt_Input_buf2api(gpEncryption_CCMDecrypt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_CCMDecrypt_Output_api2buf(UInt8Buffer* pDest , gpEncryption_CCMDecrypt_Output_marshall_struct_t* pSourceoutput , gpEncryption_CCMDecrypt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpEncryption_AESEncrypt_Input_buf2api(gpEncryption_AESEncrypt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_AESEncrypt_Output_api2buf(UInt8Buffer* pDest , gpEncryption_AESEncrypt_Output_marshall_struct_t* pSourceoutput , gpEncryption_AESEncrypt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); + +// Client functions +void gpEncryption_CCMEncrypt_Input_par2buf(UInt8Buffer* pDest , gpEncryption_CCMOptions_t* pCCMOptions , UInt16* pIndex); +void gpEncryption_CCMEncrypt_Output_buf2par(gpEncryption_Result_t* result , gpEncryption_CCMOptions_t* pCCMOptions , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_CCMDecrypt_Input_par2buf(UInt8Buffer* pDest , gpEncryption_CCMOptions_t* pCCMOptions , UInt16* pIndex); +void gpEncryption_CCMDecrypt_Output_buf2par(gpEncryption_Result_t* result , gpEncryption_CCMOptions_t* pCCMOptions , UInt8Buffer* pSource , UInt16* pIndex); +void gpEncryption_AESEncrypt_Input_par2buf(UInt8Buffer* pDest , UInt8* pInplaceBuffer , UInt8* pAesKey , gpEncryption_AESOptions_t AESOptions , UInt16* pIndex); +void gpEncryption_AESEncrypt_Output_buf2par(gpEncryption_Result_t* result , UInt8* pInplaceBuffer , UInt8* pAesKey , gpEncryption_AESOptions_t AESOptions , UInt8Buffer* pSource , UInt16* pIndex); + +void gpEncryption_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPENCRYPTION_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gpEncryption.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gpEncryption.h new file mode 100644 index 0000000..bd1b70e --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gpEncryption.h @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * The file gpEncryption.h contains the encryption API definitions. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _ENCRYPTION_GP_H_ +#define _ENCRYPTION_GP_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpEncryption_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/** + * @file gpEncryption.h + * + * @defgroup AES AES Encryption + * @defgroup CCM CCM Encryption and Decryption + * @defgroup INIT Initialization +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + + + /** @name gpEncryption_AESKeyLen_t */ +//@{ +/** @brief 128 bits key len */ +#define gpEncryption_AESKeyLen128 (128>>3) +/** @brief 192 bits key len */ +#define gpEncryption_AESKeyLen192 (192>>3) +/** @brief 256 bits key len */ +#define gpEncryption_AESKeyLen256 (256>>3) +/** @brief Identifier for invalid value */ +#define gpEncryption_AESKeyLenInv 0xFF +/** @typedef gpEncryption_AESKeyLen_t + * @brief gpEncryption_AESKeyLen_t possible values are: 16, 24 or 32 bytes. + * + */ +typedef UInt8 gpEncryption_AESKeyLen_t; + + +/** @struct gpEncryption_AESOptions_t + * @param gpEncryption_AESKeyLen_t + * @param This parameter is an 8bit bitmask specifying the options: bits[6:0] specify the keyid to be used (see gpEncryption_API_Manual); bit[7] indicates additional hardening +*/ +typedef struct{ + gpEncryption_AESKeyLen_t keylen; + UInt8 options; +} gpEncryption_AESOptions_t; + + +#define GP_ENCRYPTION_OPTIONS_IS_HARDENED(id) (((id) & gpEncryption_Hardened) != 0) +#define GP_ENCRYPTION_OPTIONS_GET_KEYID(id) (id & ~gpEncryption_Hardened) + +#define GP_ENCRYPTION_KEYID_IS_USER(id) (id <= gpEncryption_KeyIdUserKey7) +#define GP_ENCRYPTION_KEYID_IS_PRODUCT(id) (id == gpEncryption_KeyIdProductKey0 || id == gpEncryption_KeyIdProductKey1) +#define GP_ENCRYPTION_KEYID_IS_KEYPTR(id) (id == gpEncryption_KeyIdKeyPtr) + +/** @name gpEncryption_SecLevel_t */ +//@{ +/** @brief Mode 0 No encryption, no MIC added. */ +#define gpEncryption_SecLevelNothing 0 +/** @brief Mode 1 No encryption, 32 bit MIC added. */ +#define gpEncryption_SecLevelMIC32 1 +/** @brief Mode 2 No encryption, 64 bit MIC added. */ +#define gpEncryption_SecLevelMIC64 2 +/** @brief Mode 3 No encryption, 128 bit MIC added. */ +#define gpEncryption_SecLevelMIC128 3 +/** @brief Mode 4 Encryption of payload, no MIC added. */ +#define gpEncryption_SecLevelENC 4 +/** @brief Mode 5 Encryption of payload, 32 bit MIC added. */ +#define gpEncryption_SecLevelENC_MIC32 5 +/** @brief Mode 6 Encryption of payload, 64 bit MIC added. */ +#define gpEncryption_SecLevelENC_MIC64 6 +/** @brief Mode 7 Encryption of payload, 128 bit MIC added. */ +#define gpEncryption_SecLevelENC_MIC128 7 +/** @brief The gpEncryption_SecLevel_t type defines the IEEE Std 802.15.4 (2006) security level. +*/ +typedef UInt8 gpEncryption_SecLevel_t; + +/** @brief Convert security level into mic length */ +#define GP_ENCRYPTION_SECLEVEL2MICLENGTH(secLevel) (((secLevel&0x03)*4)==12?16:((secLevel&0x03)*4)) + +//@} + +/** @name gpEncryption_CCMOptions_t */ +//@{ +/** @brief The gpEncryption_CCMOptions structure contains all the parameters for the CCM operations. +*/ +typedef struct gpEncryption_CCMOptions { +/** @brief This field contains the pd (packet descriptor) identifier where the encryption/decryption will take place */ + gpPd_Handle_t pdHandle; +/** @brief This field contains the offset in the pd indicating the start of the data (m-data in CCM*). */ + gpPd_Offset_t dataOffset; +/** @brief This field contains the data length. This is the length of the data where the security operation will be performed (m-data in CCM*).*/ + UInt8 dataLength; +/** @brief This field contains the offset in the pd indicating the start of the auxiliary data (a-data in CCM*). */ + gpPd_Offset_t auxOffset; +/** @brief This field contains the length of the auxiliary data (a-data in CCM*). */ + UInt8 auxLength; +/** @brief This field contains the expected MIC length. */ + UInt8 micLength; +/** @brief This field contains the pointer to the encryption key. The key size is fixed to 16 bytes. */ + UInt8* pKey; +/** @brief This field contains the pointer to the nonce used for operation. The nonce length is fixed to 13 bytes. */ + UInt8* pNonce; +} gpEncryption_CCMOptions_t; +//@} + +/** @name gpEncryption_Result_t */ +//@{ +/** @brief The function returned successful. */ +#define gpEncryption_ResultSuccess 0x0 +/** @brief An invalid parameter was given as a parameter to this function. */ +#define gpEncryption_ResultInvalidParameter 0x5 +/** @brief The GP chip is busy. */ +#define gpEncryption_ResultBusy 0x7 +/** @typedef gpEncryption_Result_t + * @brief The gpEncryption_Result_t type defines the result of various encryption functions. +*/ +typedef UInt8 gpEncryption_Result_t; +//@} + +/** @name gpEncryption_Result_t */ +//@{ +/** @brief User key identifiers */ +#define gpEncryption_KeyIdUserKey0 0x00 +#define gpEncryption_KeyIdUserKey1 0x01 +#define gpEncryption_KeyIdUserKey2 0x02 +#define gpEncryption_KeyIdUserKey3 0x03 +#define gpEncryption_KeyIdUserKey4 0x04 +#define gpEncryption_KeyIdUserKey5 0x05 +#define gpEncryption_KeyIdUserKey6 0x06 +#define gpEncryption_KeyIdUserKey7 0x07 +/** @brief Product key identifiers */ +#define gpEncryption_KeyIdProductKey0 0x50 +#define gpEncryption_KeyIdProductKey1 0x51 +/** @brief Unspecified key identifier */ +#define gpEncryption_KeyIdKeyPtr 0x7E +/** @brief Unspecified key identifier */ +#define gpEncryption_KeyIdUnspecified 0x7F +typedef UInt8 gpEncryption_KeyId_t; +//@} + +/** @brief Enable additional security hardening */ +#define gpEncryption_Hardened 0x80 + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpEncryption_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + +/** + * @ingroup AES + * @brief Performs a synchronous AES Encryption. + * + * The function will encrypt 16 bytes with the AES algorithm and return the result in place. + * + * @param pInplaceBuffer Pointer to the buffer of the 16 to be encrypted bytes. The encrypted result will be returned in the same buffer. + * @param pAesKey Pointer to the 16-byte key. + * This parameter is only used when gpEncryption_KeyIdKeyPtr is specified in the options parameter. When NULL is specified in combination with gpEncryption_KeyIdKeyPtr, 0 will be used as key value. + * @param options This parameter is an 8bit bitmask specifying the options: bits[6:0] specify a keyid defined by gpEncryption_KeyId_t; bit[7] indicates additional hardening. + * @return + * - gpEncryption_ResultSuccess + * - gpEncryption_ResultBusy +*/ +GP_API gpEncryption_Result_t gpEncryption_AESEncrypt(UInt8* pInplaceBuffer, UInt8* pAesKey, gpEncryption_AESOptions_t AESoptions); + +/** + * @ingroup CCM + * @brief Performs a synchronous CCM Encryption. + * + * The function will encrypt the bytes with the CCM algorithm according to the specified options + * in the gpEncryption_CCMOptions structure. + * + * @param pCCMOptions Pointer to the gpEncryption_CCMOptions structure. + * + * @return + * - gpEncryption_ResultSuccess + * - gpEncryption_ResultBusy +*/ +GP_API gpEncryption_Result_t gpEncryption_CCMEncrypt(gpEncryption_CCMOptions_t * pCCMOptions); + +/** + * @ingroup CCM + * @brief Performs a synchronous CCM Decryption. + * + * The function will decrypt the bytes with the CCM algorithm according to the specified options + * in the gpEncryption_CCMOptions structure. + * + * @param pCCMOptions Pointer to the gpEncryption_CCMOptions structure. + * + * @return + * - gpEncryption_ResultSuccess + * - gpEncryption_ResultBusy + * - gpEncryption_ResultInvalidParameter +*/ +GP_API gpEncryption_Result_t gpEncryption_CCMDecrypt(gpEncryption_CCMOptions_t* pCCMOptions); + +/** + * @ingroup INIT + * @brief Initializes the gpEncryption component. + * + * This function initializes the gpEncryption component. It should be called before calling any other function. + * + * This primitive is typically called via the gpBaseComps_StackInit() method of the gpBaseComps component. +*/ +GP_API void gpEncryption_Init(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif //_ENCRYPTION_GP_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c new file mode 100644 index 0000000..b55f2bc --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpEncryption/src/gen/gpEncryption_marshalling.c @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpEncryption_marshalling.c" + * + * GPENCRYPTION + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpEncryption.h" +#include "gpEncryption_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_ENCRYPTION + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpEncryption_CCMOptions_t_buf2api(gpEncryption_CCMOptions_t* pDest ,gpEncryption_CCMOptions_t_pointer_marshall_t* pDestPointers , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex , Bool storePdHandle ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + pDest->pdHandle = gpPd_GetPd(); + if(gpPd_ResultValidHandle != gpPd_CheckPdValid(pDest->pdHandle)) + { + return gpMarshall_AckStatusExecutionFailed;/* Failure to allocate handle. */ + } + if(storePdHandle && !gpPd_StorePdHandle(pDest->pdHandle,pSource[*pIndex]))/* sticky client side handle p_PdLoh has to be aasciated with server side handle. */ + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF("handle assoc failed",0); +#endif + /* Failure to associate client and server side handles causes freeing of server side handle... */ +#ifdef GP_COMP_UNIT_TEST + gpPd_FreeRealPd(pDest->pdHandle); +#else + gpPd_FreePd(pDest->pdHandle); +#endif //GP_COMP_UNIT_TEST + /* ...and causes server to indicate failure in acknowledge to client. */ + return gpMarshall_AckStatusExecutionFailed; + } + *pIndex += 1; + gpPd_Offset_t_buf2api_1(&(pDest->dataOffset), pSource, pIndex); + UInt8_buf2api_1(&(pDest->dataLength), pSource, pIndex); + gpPd_Offset_t_buf2api_1(&(pDest->auxOffset), pSource, pIndex); + UInt8_buf2api_1(&(pDest->auxLength), pSource, pIndex); + UInt8_buf2api_1(&(pDest->micLength), pSource, pIndex); + if (NULL != pDestPointers) // No IsNull byte check + { + pDest->pKey = pDestPointers->pKey; + UInt8_buf2api(pDest->pKey, pSource, 16, pIndex); + } + else + { + pDest->pKey = NULL; + } + if (NULL != pDestPointers) // No IsNull byte check + { + pDest->pNonce = pDestPointers->pNonce; + UInt8_buf2api(pDest->pNonce, pSource, 13, pIndex); + } + else + { + pDest->pNonce = NULL; + } + pDest++; + if (NULL != pDestPointers) { + pDestPointers++; + } + } + return gpMarshall_AckStatusSuccess; +} + +void gpEncryption_CCMOptions_t_api2buf(UInt8Buffer* pDest , const gpEncryption_CCMOptions_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { +#ifdef GP_COMP_UNIT_TEST + { + gpPd_Handle_t uthandle = gpPd_GetUtPd(pSource->pdHandle); + gpPd_Handle_t_api2buf_1(pDest, &uthandle, pIndex); + } +#else + gpPd_Handle_t_api2buf_1(pDest, &pSource->pdHandle, pIndex); +#endif //GP_COMP_UNIT_TEST + gpPd_Offset_t_api2buf_1(pDest , &(pSource->dataOffset), pIndex); + UInt8_api2buf_1(pDest , &(pSource->dataLength), pIndex); + gpPd_Offset_t_api2buf_1(pDest , &(pSource->auxOffset), pIndex); + UInt8_api2buf_1(pDest , &(pSource->auxLength), pIndex); + UInt8_api2buf_1(pDest , &(pSource->micLength), pIndex); + // No IsNull byte check + if (NULL != pSource->pKey) + { + UInt8_api2buf(pDest , pSource->pKey , 16, pIndex); + } + // No IsNull byte check + if (NULL != pSource->pNonce) + { + UInt8_api2buf(pDest , pSource->pNonce , 13, pIndex); + } + pSource++; + } +} + +gpMarshall_AckStatus_t gpEncryption_AESOptions_t_buf2api(gpEncryption_AESOptions_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpEncryption_AESKeyLen_t_buf2api_1(&(pDest->keylen), pSource, pIndex); + UInt8_buf2api_1(&(pDest->options), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpEncryption_AESOptions_t_api2buf(UInt8Buffer* pDest , const gpEncryption_AESOptions_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpEncryption_AESKeyLen_t_api2buf_1(pDest , &(pSource->keylen), pIndex); + UInt8_api2buf_1(pDest , &(pSource->options), pIndex); + pSource++; + } +} + + +void gpEncryption_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_clientServerCmdId.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_clientServerCmdId.h new file mode 100644 index 0000000..d0f7c5c --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_clientServerCmdId.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRandom_clientServerCmdId.h" + * + * Random generator component + * + * Client Server Link Command IDs +*/ + +#ifndef _GPRANDOM_CLIENTSERVERCMDID_H_ +#define _GPRANDOM_CLIENTSERVERCMDID_H_ + +/***************************************************************************** + * Common timeout + *****************************************************************************/ + +#ifndef GPRANDOM_GPCOMTIMEOUT_US +#define GPRANDOM_GPCOMTIMEOUT_US 10000000UL //10s +#endif //GPRANDOM_GPCOMTIMEOUT_US + +/***************************************************************************** + * Component Specific Command IDs + *****************************************************************************/ + +#define gpRandom_GetNewSequence_CmdId 0x02 /*02*/ +#define gpRandom_CTR_DRBG_Init_CmdId 0x04 /*04*/ +#define gpRandom_CTR_DRBG_Reseed_CmdId 0x05 /*05*/ +#define gpRandom_CTR_DRBG_Generate_CmdId 0x06 /*06*/ +#define gpRandom_GetFromDRBG_CmdId 0x08 /*08*/ + +/***************************************************************************** + * Fixed Command IDs + *****************************************************************************/ + +#define gpRandom_Acknowledge_CmdId 0xfe /*254*/ +#define gpRandom_GetServerCompatibilityNumber_CmdId 0xfd /*253*/ + +#endif //_GPRANDOM_CLIENTSERVERCMDID_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_marshalling.h new file mode 100644 index 0000000..2513ddd --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen/gpRandom_marshalling.h @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPRANDOM_MARSHALLING_H_ +#define _GPRANDOM_MARSHALLING_H_ + +//DOCUMENTATION RANDOM: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpRandom.h" +/* AdditionalIncludes */ +// manual +#include "gpRandom_CTR_DRBG.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +typedef struct { + UInt8 nmbrRandomBytes; +} gpRandom_GetNewSequence_Input_struct_t; + +typedef struct { + gpRandom_GetNewSequence_Input_struct_t data; +} gpRandom_GetNewSequence_Input_marshall_struct_t; + +typedef struct { + UInt8* pBuffer; +} gpRandom_GetNewSequence_Output_struct_t; + +typedef struct { + gpRandom_GetNewSequence_Output_struct_t data; + UInt8 pBuffer[25]; +} gpRandom_GetNewSequence_Output_marshall_struct_t; + + + + + + + +typedef struct { + UInt8 nmbrRandomBytes; +} gpRandom_GetFromDRBG_Input_struct_t; + +typedef struct { + gpRandom_GetFromDRBG_Input_struct_t data; +} gpRandom_GetFromDRBG_Input_marshall_struct_t; + +typedef struct { + UInt8* pBuffer; +} gpRandom_GetFromDRBG_Output_struct_t; + +typedef struct { + gpRandom_GetFromDRBG_Output_struct_t data; + UInt8 pBuffer[255]; +} gpRandom_GetFromDRBG_Output_marshall_struct_t; + + +typedef union { + gpRandom_GetNewSequence_Input_marshall_struct_t gpRandom_GetNewSequence; + gpRandom_GetFromDRBG_Input_marshall_struct_t gpRandom_GetFromDRBG; + UInt8 dummy; //ensure none empty union definition +} gpRandom_Server_Input_union_t; + +typedef union { + gpRandom_GetNewSequence_Output_marshall_struct_t gpRandom_GetNewSequence; + gpRandom_GetFromDRBG_Output_marshall_struct_t gpRandom_GetFromDRBG; + UInt8 dummy; //ensure none empty union definition +} gpRandom_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpRandom_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpRandom_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpRandom_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpRandom_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +// Server functions +gpMarshall_AckStatus_t gpRandom_GetNewSequence_Input_buf2api(gpRandom_GetNewSequence_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRandom_GetNewSequence_Output_api2buf(UInt8Buffer* pDest , gpRandom_GetNewSequence_Output_marshall_struct_t* pSourceoutput , gpRandom_GetNewSequence_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpRandom_GetFromDRBG_Input_buf2api(gpRandom_GetFromDRBG_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpRandom_GetFromDRBG_Output_api2buf(UInt8Buffer* pDest , gpRandom_GetFromDRBG_Output_marshall_struct_t* pSourceoutput , gpRandom_GetFromDRBG_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); + +// Client functions +void gpRandom_GetNewSequence_Input_par2buf(UInt8Buffer* pDest , UInt8 nmbrRandomBytes , UInt16* pIndex); +void gpRandom_GetNewSequence_Output_buf2par(UInt8 nmbrRandomBytes , UInt8* pBuffer , UInt8Buffer* pSource , UInt16* pIndex); +void gpRandom_GetFromDRBG_Input_par2buf(UInt8Buffer* pDest , UInt8 nmbrRandomBytes , UInt16* pIndex); +void gpRandom_GetFromDRBG_Output_buf2par(UInt8 nmbrRandomBytes , UInt8* pBuffer , UInt8Buffer* pSource , UInt16* pIndex); + +void gpRandom_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPRANDOM_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom.h new file mode 100644 index 0000000..b2c9394 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom.h @@ -0,0 +1,131 @@ + +/* + * Copyright (c) 2012-2013, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPRANDOM_H_ +#define _GPRANDOM_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpRandom_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +//DOCUMENTATION GENERATION: no @file required as all documented items are refered to a group + +/** + *@defgroup DEF_RANDOM General Random Definitions + * @brief The general Random Definitions + * + * The gpRandom component is intended for generation of the random number sequences. The randomness of + * the internal random number generator is configurable at compile time and if not changed, the default + * randomness is 128bits. The randomness is introduced via the call to randomize the generator and the + * consequent random numbers are produced by mashing up the random seed with 32bit based pseudo random + * generator. Unless disabled in compile time, the mashing process is modulated with time based low + * strength random generator. + * + * Note: Randomize function is lengthy and should be avoided to call it from points in code executing + * under tight timeout. + * Note: The driver is not made thread safe so care must be taken to avoid reentrancy. The consequence + * might be that two callers getting random sequences end up with highly correlated random sequences. + * + *@defgroup GEN_RANDOM General Random Public Functions + * @brief The general public Random functionality is implemented in these functions + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + /** @typedef gpRandom_Result_t + * @brief The gpRandom_Result_t type defines the result of various gpRandom functions. +*/ +typedef UInt8 gpRandom_Result_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpRandom_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + + +/**@ingroup GEN_RANDOM + * @brief This function generates new random number sequence + * + * @param pBuffer is reference to memory location where new random number sequence is to be stored + * @param nmbrRandomBytes is number of random bytes in sequence to be stored + */ +void gpRandom_GetNewSequence(UInt8 nmbrRandomBytes, UInt8* pBuffer); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +/**@ingroup GEN_RANDOM + * @brief This function seeds the generator with truly random numbers + * + * Calling this function costs a lot of time being blocked in its execution. + */ +void gpRandom_RandomizeSeed(void); + +void gpRandom_Init(void); + +void gpRandom_Reset(void); + +void gpRandom_GetFromDRBG(UInt8 nmbrRandomBytes, UInt8* pBuffer); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPRANDOM_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom_CTR_DRBG.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom_CTR_DRBG.h new file mode 100644 index 0000000..ebb3d0f --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/inc/gpRandom_CTR_DRBG.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2017, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/** + *@defgroup DEF_RANDOM_CTR_DRBG General Random CTR DRBG Definitions + * @brief The general Random CTR DRBG (Deterministic Random Bit Generator) Definitions + * + * The gpRandom_CTR_DRBG component is intended for generation of the random number sequences as specified in SP 800 90 $10.2. + * using AES256 + * + *@defgroup DEF_RANDOM_CTR_DRBG General Random Public Functions + * @brief The general Random CTR DRBG functionality is implemented in these functions + */ + + +#ifndef _GPRANDOM_CTR_DRBG_H_ +#define _GPRANDOM_CTR_DRBG_H_ + +/** @name gpRandom_Result_t */ +//@{ +/** @brief The function returned successful. */ +#define gpRandom_ResultSuccess gpHal_ResultSuccess +/** @brief An invalid parameter was given as a parameter to this function. */ +#define gpRandom_ResultInvalidParameter gpHal_ResultInvalidParameter +/** @brief The GP chip is busy. */ +#define gpRandom_ResultBusy gpHal_ResultBusy + +#ifdef __cplusplus +extern "C" { +#endif + + + /**@ingroup DEF_RANDOM_CTR_DRBG + * @brief This function Initializes the entropy + * + * @return + * - gpRandom_ResultSuccess + * - gpRandom_ResultBusy + */ +gpRandom_Result_t gpRandom_CTR_DRBG_Init(void); +/**@ingroup DEF_RANDOM_CTR_DRBG + * @brief This function implements the reseed procedure + * @return + * - gpRandom_ResultSuccess + * - gpRandom_ResultBusy + */ +gpRandom_Result_t gpRandom_CTR_DRBG_Reseed(void); +/**@ingroup DEF_RANDOM_CTR_DRBG + * @brief gpRandom_CTR_DRBG_Generate + * @param nmbrRandomBytes number of buffer in bytes + * @param pBuffer is reference to memory location where new random number sequence is to be stored + * @return + * - gpRandom_ResultSuccess + * - gpRandom_ResultBusy + * - gpRandom_ReseedRequest + */ +gpRandom_Result_t gpRandom_CTR_DRBG_Generate( UInt32 nmbrRandomBytes, UInt8 *pBuffer ); + +#ifdef __cplusplus +} +#endif + +#endif // _GPRANDOM_CTR_DRBG_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c new file mode 100644 index 0000000..dcc11a6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRandom_marshalling.c" + * + * Random generator component + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpRandom.h" +#include "gpRandom_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_RANDOM + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +void gpRandom_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c new file mode 100644 index 0000000..3dc4b06 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_marshalling_client.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRandom_marshalling_client.c" + * + * Random generator component + * + * Marshalling structures and functions +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpRandom.h" +#include "gpRandom_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_RANDOM + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpRandom_GetNewSequence_Input_par2buf(UInt8Buffer* pDest , UInt8 nmbrRandomBytes , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(nmbrRandomBytes), pIndex); +} + +void gpRandom_GetNewSequence_Output_buf2par(UInt8 nmbrRandomBytes , UInt8* pBuffer , UInt8Buffer* pSource , UInt16* pIndex) +{ + NOT_USED(nmbrRandomBytes); + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt8_buf2api(pBuffer, pSource, nmbrRandomBytes, pIndex); + } +} + + + + + +void gpRandom_GetFromDRBG_Input_par2buf(UInt8Buffer* pDest , UInt8 nmbrRandomBytes , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(nmbrRandomBytes), pIndex); +} + +void gpRandom_GetFromDRBG_Output_buf2par(UInt8 nmbrRandomBytes , UInt8* pBuffer , UInt8Buffer* pSource , UInt16* pIndex) +{ + NOT_USED(nmbrRandomBytes); + if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + UInt8_buf2api(pBuffer, pSource, nmbrRandomBytes, pIndex); + } +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c new file mode 100644 index 0000000..65b07b6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpRandom/src/gen/gpRandom_wrapper_client.c @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpRandom_wrapper_client.c" + * + * Random generator component + * + * Wrapper implementation +*/ + +/***************************************************************************** + * Includes Definition + *****************************************************************************/ + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpCom.h" +#include "gpModule.h" +#include "gpRandom_clientServerCmdId.h" +#include "gpRandom.h" +#include "gpRandom_marshalling.h" +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +#include "gpVersion.h" +#endif + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Functions Declaration + *****************************************************************************/ + +static void gpRandom_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId); +static void Random_HandleConnectionClose(gpCom_CommunicationId_t communicationId); + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_RANDOM +#define GP_MODULE_ID GP_COMPONENT_ID + + +#ifndef GP_RANDOM_COMM_ID +#define GP_RANDOM_COMM_ID GP_COM_DEFAULT_COMMUNICATION_ID +#endif + +#define REGISTER_MODULE(handle) GP_COM_REGISTER_MODULE(handle) +#define DATA_REQUEST(len,buf,commId) GP_COM_DATA_REQUEST(len,buf,commId) +#define DATA_REQUEST_ACKED(len,buf,commId) gpCom_DataRequestAndWaitForAck(GP_MODULE_ID, len, buf, commId, &gpRandom_reqAcked, GPRANDOM_GPCOMTIMEOUT_US, gpRandom_Acknowledge_CmdId) + +/***************************************************************************** + * Static Data + *****************************************************************************/ + +typedef union ackDataNeeded { + UInt8 dataBuf0[1+25]; + UInt8 dataBuf1[1]; + UInt8 dataBuf2[1+25+1]; + UInt8 dataBuf3[1+255]; +} ackDataNeeded_t; +static UInt8 gpRandom_ackBuffer[1 + 1 + 1 + sizeof(ackDataNeeded_t)]; +static Bool gpRandom_reqAcked; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +static Bool Random_clientApiVersionSelected = false; +#endif + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +static void Random_HandleConnectionClose(gpCom_CommunicationId_t communicationId) +{ +} + +static void gpRandom_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId) +{ +#define commandId pPayload[0] + UInt8 ackBuffer[1 + 1 + 1]; + UInt8 ackBytes = 0; /*No ack's on indication - fill in length when needed - 3+x */ + + if(pPayload == NULL) + { + Random_HandleConnectionClose(communicationId); + return; + } + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Random_clientApiVersionSelected); +#endif + + ackBuffer[0] = gpRandom_Acknowledge_CmdId; + ackBuffer[1] = gpMarshall_AckStatusSuccess; + ackBuffer[2] = commandId; + + switch(commandId) + { + + case gpRandom_Acknowledge_CmdId: + { + GP_ASSERT_SYSTEM(length <= sizeof(gpRandom_ackBuffer)); + MEMCPY(gpRandom_ackBuffer, pPayload, length); + gpRandom_reqAcked = true; + return; + } + default: + { + GP_ASSERT_DEV_INT(false); + break; + } + } +#undef commandId + if(0 < ackBytes) + { + DATA_REQUEST(ackBytes, ackBuffer, communicationId); + } +} +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +void gpRandom_SetDefaultApiVersion(gpVersion_ModuleVersionInfo_t* moduleVersionInfo) +{ + Random_clientApiVersionSelected = true; + //TBD +} +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + + +void gpRandom_DeInit(void) +{ + gpCom_DeRegisterModule(GP_MODULE_ID); +} + +void gpRandom_Init(void) +{ +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + gpVersion_ReleaseInfo_t versions[1] = {{2,0,0,0}}; + Random_clientApiVersionSelected = false; + gpVersion_RegisterModule(GP_MODULE_ID, versions,1,gpRandom_SetDefaultApiVersion); +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + REGISTER_MODULE(gpRandom_HandleIndicationClient); +} + +/***************************************************************************** + * gpRandom Require Functions + *****************************************************************************/ + +void gpRandom_GetNewSequence(UInt8 nmbrRandomBytes, UInt8* pBuffer) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Random_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRandom_GetNewSequence_CmdId; + + gpRandom_GetNewSequence_Input_par2buf(dataBuf + , nmbrRandomBytes + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RANDOM_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRandom_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRandom_GetNewSequence_CmdId == gpRandom_ackBuffer[2]); + + _index = 3; + gpRandom_GetNewSequence_Output_buf2par( + nmbrRandomBytes + , pBuffer + , gpRandom_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRandom_ackBuffer)); + +#undef commandId +} + + + + +void gpRandom_GetFromDRBG(UInt8 nmbrRandomBytes, UInt8* pBuffer) +{ + UInt16 _index = 1; + UInt8 dataBuf[1 + 1]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Random_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = gpRandom_GetFromDRBG_CmdId; + + gpRandom_GetFromDRBG_Input_par2buf(dataBuf + , nmbrRandomBytes + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_RANDOM_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpRandom_ackBuffer[1]); + GP_ASSERT_SYSTEM(gpRandom_GetFromDRBG_CmdId == gpRandom_ackBuffer[2]); + + _index = 3; + gpRandom_GetFromDRBG_Output_buf2par( + nmbrRandomBytes + , pBuffer + , gpRandom_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpRandom_ackBuffer)); + +#undef commandId +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpStat/inc/gpStat.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpStat/inc/gpStat.h new file mode 100644 index 0000000..a225547 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpStat/inc/gpStat.h @@ -0,0 +1,242 @@ + +/* + * Copyright (c) 2009-2010, 2012, 2014-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpStat.h + * + * This file defines the generic statistics component api + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPSTAT_H_ +#define _GPSTAT_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifdef GP_FILENAME +#if defined(GP_DIVERSITY_LOG) +//Define a FileName only once for use - name comes from make environment +static const char ROM gpStatFileName[] FLASH_PROGMEM = { XSTRINGIFY(GP_FILENAME) }; +#define GP_STAT_FILENAME gpStatFileName +#endif //GP_DIVERSITY_LOG || defined(GP_STAT_DIVERSITY_GPCOM_SERVER) +#else +#define GP_STAT_FILENAME __FILE__ +#endif //GP_FILENAME + +#ifndef GP_STAT_NUMBER_OF_COUNTERS +#define GP_STAT_NUMBER_OF_COUNTERS 5 +#endif + +#ifndef GP_STAT_NUMBER_OF_MINMAX +#define GP_STAT_NUMBER_OF_MINMAX 5 +#endif + +#ifndef GP_STAT_NUMBER_OF_STOPWATCHES +#define GP_STAT_NUMBER_OF_STOPWATCHES 5 +#endif +#ifndef GP_STAT_NUMBER_OF_SAMPLES +#define GP_STAT_NUMBER_OF_SAMPLES 10 +#endif +#ifndef GP_STAT_NUMBER_OF_HEAP_SAMPLES +#define GP_STAT_NUMBER_OF_HEAP_SAMPLES 1 +#endif + +#define GP_STAT_MAX_NAME_CHARS 20 +#define GP_STAT_MAX_NAME_LENGTH 10 + + +#define GP_STAT_INIT() gpStat_Init() +#define GP_STAT_CLEAR() gpStat_Clear() + +#define GP_STAT_RESET_COUNTER(id) gpStat_ResetCounter(id) +#define GP_STAT_REGISTER_COUNTER(id,name,incrementStep) do { id = gpStat_RegisterCounter((FLASH_STRING)GEN_STR2FLASH(name), incrementStep); } while(false) +#define GP_STAT_FREE_COUNTER(id) gpStat_FreeCounter(id) +#define GP_STAT_INCREASE_COUNTER(id, value) do { if(value) gpStat_IncreaseCounter((id), (value)); } while(false) +#define GP_STAT_INCREMENT_COUNTER(id) gpStat_IncrementCounter(id) +#define GP_STAT_GET_COUNTER(id) gpStat_GetCounter(id) + +#define GP_STAT_DECLARE_COUNTERID(name) gpStat_CounterID_t name + +#define GP_STAT_REGISTER_MINMAX(id , name) do { id = gpStat_RegisterMinMax((FLASH_STRING)GEN_STR2FLASH(name)); }while(false) +#define GP_STAT_FREE_MINMAX(id) gpStat_FreeMinMax( id ) +#define GP_STAT_SET_MINMAX( id , value) gpStat_SetMinMax( id , value) +#define GP_STAT_GET_COUNT( id ) gpStat_GetCount( id ) +#define GP_STAT_GET_MIN( id ) gpStat_GetMin( id ) +#define GP_STAT_GET_MAX( id ) gpStat_GetMax( id ) +#define GP_STAT_GET_SUM( id ) gpStat_GetSum( id ) +#define GP_STAT_GET_AVERAGE( id ) gpStat_GetAverage( id ) +#define GP_STAT_GET_VARIANCE( id ) gpStat_GetVariance( id ) +#define GP_STAT_RESET_MINMAX( id ) gpStat_ResetMinMax( id ) + +#define GP_STAT_DECLARE_MINMAXID(name) gpStat_MinMaxID_t name + + +#define GP_STAT_REGISTER_STOPWATCH(id , name) do { id = gpStat_RegisterStopwatch((FLASH_STRING)GEN_STR2FLASH(name)); }while(false) +#define GP_STAT_FREE_STOPWATCH(id) gpStat_FreeStopwatch(id) +#define GP_STAT_START_STOPWATCH(id) gpStat_StartStopwatch( id ) +#define GP_STAT_STOP_STOPWATCH(id) gpStat_StopStopwatch( id ) + +#define GP_STAT_DECLARE_STOPWATCHID(name) gpStat_StopwatchID_t name + +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +#define GP_STAT_SAMPLE_TIME() gpStat_SampleTime(GP_COMPONENT_ID, GP_STAT_FILENAME, __FUNCTION__, __LINE__) +#define GP_STAT_RETURN_SAMPLING() gpStat_ReturnSamples() +#else +#define GP_STAT_SAMPLE_TIME() +#define GP_STAT_RETURN_SAMPLING() +#endif + +#define GP_STAT_SAMPLE_HEAP(heapInUse) gpStat_SampleHeap(heapInUse) +#define GP_STAT_RETURN_SAMPLING_HEAP() gpStat_ReturnSamplesHeap() + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt8 gpStat_CounterID_t; +typedef UInt8 gpStat_MinMaxID_t; +typedef UInt8 gpStat_StopwatchID_t; + +// Main statistic counter type +typedef struct gpStat_StatisticsCounter { + UInt32 counter; + char name[GP_STAT_MAX_NAME_LENGTH]; + Int8 incrementStep; +} gpStat_StatisticsCounter_t; + +// Main statistic min max type +typedef struct gpStat_StatisticsMinMax { + UInt16 count; + UInt32 min; + UInt32 max; + UInt32 sum; + UInt32 sum2; //sum of square values + char name[GP_STAT_MAX_NAME_LENGTH]; +} gpStat_StatisticsMinMax_t; + +// Main statistic min max type +typedef struct gpStat_StatisticsStopwatch { + UInt32 time; + char name[GP_STAT_MAX_NAME_LENGTH]; +} gpStat_StatisticsStopwatch_t; + + +// Serial packet typedefs +#define gpStat_CommandIDGeneralStatisticsIndication 0x02 +typedef UInt8 gpStat_CommandID_t; + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +typedef struct gpStat_StatisticInformation { + /*All counters available in gpStat*/ + UInt32 counters[GP_STAT_NUMBER_OF_COUNTERS]; +} gpStat_StatisticInformation_t; + +typedef struct gpStat_StatisticInformationPacket{ + gpStat_CommandID_t commandID; + UInt16 appID; + gpStat_StatisticInformation_t statisticInformation; +}gpStat_StatisticInformationPacket_t; +#endif + +typedef struct { + UInt32 time; + UInt16 line; + UInt8 compId; + char funcName[GP_STAT_MAX_NAME_CHARS]; + char fileName[GP_STAT_MAX_NAME_CHARS]; +} gpStat_Sample_t; + +typedef struct { + UInt32 time; + UInt32 heapInUse; +} gpStat_HeapSample_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +void gpStat_Init(void); +void gpStat_Clear(void); + +gpStat_CounterID_t gpStat_RegisterCounter(FLASH_STRING name, Int8 incrementStep); +void gpStat_FreeCounter(gpStat_CounterID_t id); +void gpStat_IncreaseCounter(gpStat_CounterID_t id, Int32 value); +void gpStat_IncrementCounter(gpStat_CounterID_t id); +UInt32 gpStat_GetCounter(gpStat_CounterID_t id); +void gpStat_ResetCounter(gpStat_CounterID_t id); + + +gpStat_MinMaxID_t gpStat_RegisterMinMax(FLASH_STRING name); +void gpStat_FreeMinMax(gpStat_MinMaxID_t id); +Bool gpStat_SetMinMax(gpStat_MinMaxID_t id , UInt32 value); +UInt32 gpStat_GetCount(gpStat_MinMaxID_t id); +UInt32 gpStat_GetMin(gpStat_MinMaxID_t id); +UInt32 gpStat_GetMax(gpStat_MinMaxID_t id); +UInt32 gpStat_GetSum(gpStat_MinMaxID_t id); +UInt32 gpStat_GetAverage(gpStat_MinMaxID_t id); +UInt32 gpStat_GetVariance(gpStat_MinMaxID_t id); +void gpStat_ResetMinMax(gpStat_MinMaxID_t id); + +gpStat_StopwatchID_t gpStat_RegisterStopwatch(FLASH_STRING name); +void gpStat_FreeStopwatch(gpStat_StopwatchID_t id); +void gpStat_StartStopwatch(gpStat_StopwatchID_t id); +UInt32 gpStat_StopStopwatch(gpStat_StopwatchID_t id); + +void gpStat_SampleTime(UInt8 componentID, FLASH_STRING filename, FLASH_STRING funcName, UInt16 line); +void gpStat_ReturnSamples(void); +void gpStat_cbReturnSample(gpStat_Sample_t sample); + +void gpStat_SampleHeap(UInt32 heapInUse); +void gpStat_ReturnSamplesHeap(void); +void gpStat_cbReturnHeapSample(gpStat_HeapSample_t sample); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +#endif // _GPSTAT_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c new file mode 100644 index 0000000..25a808e --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpStat/src/gpStat.c @@ -0,0 +1,773 @@ + +/* + * Copyright (c) 2009-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpStat.c + * + * This file implements the generic statistics component + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +//#define GP_LOCAL_LOG + +// General includes +#include "gpStat.h" +#include "gpLog.h" +#include "gpAssert.h" + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_STAT + +#include "gpSched.h" +#define GP_STAT_GET_TIME() gpSched_GetCurrentTime() + +#define STAT_LOG_FORMAT_LENGTH 9 //"T:%lu l:%i!" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + UInt32 time; + UInt16 line; + UInt8 compId; + char funcName[GP_STAT_MAX_NAME_CHARS]; + FLASH_STRING pFileName; //Internally only storing pointer for RAM optimization +} Stat_Sample_t; + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +Bool gpStat_Initialized = false; +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +gpStat_StatisticsCounter_t gpStat_StatisticsCounters[GP_STAT_NUMBER_OF_COUNTERS]; +#endif +#if GP_STAT_NUMBER_OF_MINMAX > 0 +gpStat_StatisticsMinMax_t gpStat_StatisticsMinMax[GP_STAT_NUMBER_OF_MINMAX]; +#endif +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 +gpStat_StatisticsStopwatch_t gpStat_StatisticsStopwatches[GP_STAT_NUMBER_OF_STOPWATCHES]; +#endif +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +Stat_Sample_t gpStat_Samples[GP_STAT_NUMBER_OF_SAMPLES]; +UInt8 gpStat_SampleIndex = 0; +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 +gpStat_HeapSample_t gpStat_HeapSamples[GP_STAT_NUMBER_OF_HEAP_SAMPLES]; +UInt8 gpStat_HeapSampleIndex = 0; +#endif //GP_STAT_NUMBER_OF_HEAP_SAMPLES + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +static void Stat_DumpCounter(gpStat_StatisticsCounter_t* pCounter, Int32 increment); +static gpStat_StatisticsCounter_t* Stat_GetCounter(gpStat_CounterID_t id); +#endif +#if GP_STAT_NUMBER_OF_MINMAX > 0 +static gpStat_StatisticsMinMax_t* Stat_GetMinMax(gpStat_MinMaxID_t id); +#endif +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 +static gpStat_StatisticsStopwatch_t* Stat_GetStopwatch(gpStat_StopwatchID_t id); +#endif +#if (GP_STAT_NUMBER_OF_COUNTERS > 0) || (GP_STAT_NUMBER_OF_MINMAX > 0) || (GP_STAT_NUMBER_OF_STOPWATCHES > 0) +static void Stat_ErrorID(gpStat_CounterID_t id); +#endif +static void Stat_LogSample(Stat_Sample_t* sample); +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +static void Stat_InitSampling(void); +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 +static void Stat_InitHeapSampling(void); +#endif +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +void Stat_DumpCounter(gpStat_StatisticsCounter_t* pCounter, Int32 increment) +{ +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF("Inc cnt %s %lu (%li)",0, pCounter->name, (unsigned long int)pCounter->counter, (long int)increment); +#endif //GP_DIVERSITY_LOG +} + +gpStat_StatisticsCounter_t* Stat_GetCounter(gpStat_CounterID_t id) +{ + //Incrementstep == 0 - unused counter + if(id < GP_STAT_NUMBER_OF_COUNTERS && (gpStat_StatisticsCounters[id].incrementStep != 0)) + { + return &(gpStat_StatisticsCounters[id]); + } + else + { + return NULL; + } +} +#endif +#if GP_STAT_NUMBER_OF_MINMAX > 0 +gpStat_StatisticsMinMax_t* Stat_GetMinMax(gpStat_MinMaxID_t id) +{ + //' ' as first character in name - unused object + if(id < GP_STAT_NUMBER_OF_COUNTERS && (gpStat_StatisticsMinMax[id].name[0]!=' ')) + { + return &(gpStat_StatisticsMinMax[id]); + } + else + { + return NULL; + } +} +#endif +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 +gpStat_StatisticsStopwatch_t* Stat_GetStopwatch(gpStat_StopwatchID_t id) +{ + //' ' as first character in name - unused object + if(id < GP_STAT_NUMBER_OF_STOPWATCHES && (gpStat_StatisticsStopwatches[id].name[0]!=' ')) + { + return &(gpStat_StatisticsStopwatches[id]); + } + else + { + return NULL; + } +} +#endif +void Stat_LogSample(Stat_Sample_t* sample) +{ + //Copy filename after ':' + char buffer[STAT_LOG_FORMAT_LENGTH+GP_STAT_MAX_NAME_CHARS*2+1] = "T:%lu %i:"; + UInt8 fileNameLength= 0; + + STRNCPY_P(&buffer[STAT_LOG_FORMAT_LENGTH], sample->pFileName, GP_STAT_MAX_NAME_CHARS); + fileNameLength = min(STRLEN_P(sample->pFileName), GP_STAT_MAX_NAME_CHARS); + + buffer[STAT_LOG_FORMAT_LENGTH+fileNameLength] = ' '; + STRNCPY(&buffer[STAT_LOG_FORMAT_LENGTH+fileNameLength+1], sample->funcName, GP_STAT_MAX_NAME_CHARS); + + gpLog_Printf(sample->compId, false, (FLASH_STRING)buffer, 0, sample->time, sample->line); + gpLog_Flush(); +} +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +void Stat_InitSampling(void) +{ + //Clear samples + gpStat_SampleIndex = 0; + MEMSET((UInt8*)gpStat_Samples, 0, sizeof(Stat_Sample_t)*GP_STAT_NUMBER_OF_SAMPLES); +} +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 +void Stat_InitHeapSampling(void) +{ + gpStat_HeapSampleIndex = 0; + MEMSET((UInt8*)gpStat_HeapSamples, 0, sizeof(gpStat_HeapSamples)); +} +void Stat_LogHeapSample(gpStat_HeapSample_t* pSample) +{ + GP_LOG_SYSTEM_PRINTF("T:%lu %lu" ,0, (long unsigned int)pSample->time, (long unsigned int)pSample->heapInUse); +} +#endif +#if (GP_STAT_NUMBER_OF_COUNTERS > 0) || (GP_STAT_NUMBER_OF_MINMAX > 0) || (GP_STAT_NUMBER_OF_STOPWATCHES > 0) +void Stat_ErrorID(gpStat_CounterID_t id) +{ +#ifndef GP_LOCAL_LOG + NOT_USED(id); +#endif + GP_LOG_PRINTF("faulty ID %i",2,(UInt16)id); + GP_ASSERT_DEV_EXT(false); +} +#endif + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpStat_Init(void) +{ + if(!gpStat_Initialized) + { + gpStat_Clear(); + } + gpStat_Initialized = true; + + GP_LOG_PRINTF("Init",0); +} + +void gpStat_Clear(void) +{ + UIntLoop id = 0; + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 + for(id= 0; id < GP_STAT_NUMBER_OF_COUNTERS; id++) + { + MEMSET(gpStat_StatisticsCounters[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + gpStat_StatisticsCounters[id].incrementStep = 0; //no counting up or down + gpStat_StatisticsCounters[id].counter = 0; + } +#endif +#if GP_STAT_NUMBER_OF_MINMAX > 0 + for(id= 0; id < GP_STAT_NUMBER_OF_MINMAX; id++) + { + MEMSET(gpStat_StatisticsMinMax[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + gpStat_StatisticsMinMax[id].count = 0; + gpStat_StatisticsMinMax[id].max = 0; + gpStat_StatisticsMinMax[id].min = 0xFFFFFFFF; + gpStat_StatisticsMinMax[id].sum = 0; + gpStat_StatisticsMinMax[id].sum2 = 0; + } +#endif +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 + for(id= 0; id < GP_STAT_NUMBER_OF_STOPWATCHES; id++) + { + MEMSET(gpStat_StatisticsStopwatches[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + } +#endif +#if GP_STAT_NUMBER_OF_SAMPLES > 0 + Stat_InitSampling(); +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 + Stat_InitHeapSampling(); +#endif + NOT_USED(id); +} + +#if GP_STAT_NUMBER_OF_COUNTERS > 0 +//---------------------------------------- +// Counter +//---------------------------------------- + +gpStat_CounterID_t gpStat_RegisterCounter(FLASH_STRING name, Int8 incrementStep) +{ + gpStat_CounterID_t id; + + //Find free counter ID + for(id = 0; id < GP_STAT_NUMBER_OF_COUNTERS; id++) + { + if(gpStat_StatisticsCounters[id].incrementStep == 0) break; + } + //No free counter ID left + if(id == GP_STAT_NUMBER_OF_COUNTERS) + { + GP_LOG_PRINTF("Cnt full",0); + GP_ASSERT_DEV_EXT(false); + return 0xFF; + } + + //Copy name + //Copy untill we reach \0 character + STRNCPY_P(gpStat_StatisticsCounters[id].name, name, GP_STAT_MAX_NAME_LENGTH); + + //Set increment step + gpStat_StatisticsCounters[id].incrementStep = incrementStep; + + //Clear counter + gpStat_StatisticsCounters[id].counter = 0; + + GP_LOG_PRINTF("Cnt reg %i",2,(UInt16)id); + return id; +} + +void gpStat_FreeCounter(gpStat_CounterID_t id) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + if(pCounter) + { + GP_LOG_PRINTF("Cnt free %i",2,(UInt16)id); + pCounter->incrementStep = 0; + MEMSET(gpStat_StatisticsCounters[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + } + else + { + Stat_ErrorID(id); + } +} + +void gpStat_ResetCounter(gpStat_CounterID_t id) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + + if(pCounter) + { + GP_LOG_PRINTF("Cnt reset %i",2,(UInt16)id); + pCounter->counter = 0; + } + else + { + Stat_ErrorID(id); + } +} + +void gpStat_IncrementCounter(gpStat_CounterID_t id) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + + if(pCounter) + { + pCounter->counter += pCounter->incrementStep; + Stat_DumpCounter(pCounter, pCounter->incrementStep); + } + else + { + Stat_ErrorID(id); + } +} + +void gpStat_IncreaseCounter(gpStat_CounterID_t id, Int32 value) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + + if(pCounter) + { + pCounter->counter += value; + Stat_DumpCounter(pCounter, value); + } + else + { + Stat_ErrorID(id); + } +} + +UInt32 gpStat_GetCounter(gpStat_CounterID_t id) +{ + gpStat_StatisticsCounter_t* pCounter = Stat_GetCounter(id); + + if(pCounter) + { + return pCounter->counter; + } + else + { + Stat_ErrorID(id); + return 0xFFFFFFFF; + } +} +#endif + +#if GP_STAT_NUMBER_OF_MINMAX > 0 +//---------------------------------------- +// Min/Max +//---------------------------------------- + +gpStat_MinMaxID_t gpStat_RegisterMinMax(FLASH_STRING name) +{ + gpStat_MinMaxID_t id; + + //Find free counter ID + for(id = 0; id < GP_STAT_NUMBER_OF_COUNTERS; id++) + { + if(gpStat_StatisticsMinMax[id].name[0] == ' ') break; + } + //No free counter ID left + if(id == GP_STAT_NUMBER_OF_COUNTERS) + { + GP_LOG_PRINTF("MiMa full",0); + GP_ASSERT_DEV_EXT(false); + return 0xFF; + } + + //Copy name + //Copy untill we reach \0 character + STRNCPY_P(gpStat_StatisticsMinMax[id].name, name, GP_STAT_MAX_NAME_LENGTH); + + //Clear counter + gpStat_StatisticsMinMax[id].min = 0xffffffff; + gpStat_StatisticsMinMax[id].max = 0x0; + + GP_LOG_PRINTF("MiMa reg %i",2,(UInt16)id); + return id; +} + +void gpStat_FreeMinMax(gpStat_CounterID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + if(pMinMax) + { + GP_LOG_PRINTF("MinMax free %i",2,(UInt16)id); + MEMSET(gpStat_StatisticsMinMax[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + } + else + { + Stat_ErrorID(id); + } +} + +Bool gpStat_SetMinMax(gpStat_MinMaxID_t id , UInt32 value) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + Bool overflow = false; + + if(pMinMax) + { + //count overflow + if(pMinMax->count == 0xFFFF) + { + overflow = true; + } + pMinMax->count++; + + //sum overflow + if(0xFFFFFFFF-value <= pMinMax->sum) + { + overflow = true; + } + pMinMax->sum += value; + + //sum2 overflows + if((value >= 0xFFFF) || (0xFFFFFFFF-(value*value) <= pMinMax->sum2)) + { + overflow = true; + } + pMinMax->sum2 += (value*value) ; + + if(pMinMax->max < value ) + { + pMinMax->max = value; + } + + if(pMinMax->min > value ) + { + pMinMax->min = value; + } + //Stat_DumpCounter(pCounter, pCounter->incrementStep); + } + else + { + Stat_ErrorID(id); + } + + return overflow; +} + +UInt32 gpStat_GetCount(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + return pMinMax->count; + } + + Stat_ErrorID(id); + return 0; +} + +UInt32 gpStat_GetMin(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + return pMinMax->min; + } + + Stat_ErrorID(id); + return 0xFFFFFFFF; +} + +UInt32 gpStat_GetMax(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + return pMinMax->max; + } + + Stat_ErrorID(id); + return 0; +} + +UInt32 gpStat_GetSum(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + return pMinMax->sum; + } + + Stat_ErrorID(id); + return 0; +} + +UInt32 gpStat_GetAverage(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + if(pMinMax->count == 0) + { + return 0; + } + return (pMinMax->sum / pMinMax->count); + } + + Stat_ErrorID(id); + return 0; +} + +UInt32 gpStat_GetVariance(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + if(pMinMax->count == 0) + { + return 0; + } + return (pMinMax->sum2 / pMinMax->count) - ((pMinMax->sum / pMinMax->count)*(pMinMax->sum / pMinMax->count)); + } + else + { + Stat_ErrorID(id); + return 0; + } +} + +void gpStat_ResetMinMax(gpStat_MinMaxID_t id) +{ + gpStat_StatisticsMinMax_t* pMinMax = Stat_GetMinMax(id); + + if(pMinMax) + { + GP_LOG_PRINTF("MiMa reset %i",2,(UInt16)id); + pMinMax->count = 0; + pMinMax->min = 0xFFFFFFFF; + pMinMax->max = 0; + pMinMax->sum = 0; + pMinMax->sum2 = 0; + } + else + { + Stat_ErrorID(id); + } +} +#endif + +#if GP_STAT_NUMBER_OF_STOPWATCHES > 0 +//---------------------------------------- +// Stopwatches +//---------------------------------------- + +gpStat_StopwatchID_t gpStat_RegisterStopwatch(FLASH_STRING name) +{ + gpStat_StopwatchID_t id; + + //Find free counter ID + for(id = 0; id < GP_STAT_NUMBER_OF_STOPWATCHES; id++) + { + if(gpStat_StatisticsStopwatches[id].name[0] == ' ') break; + } + //No free counter ID left + if(id == GP_STAT_NUMBER_OF_STOPWATCHES) + { + GP_LOG_PRINTF("Stopwatch full",0); + GP_ASSERT_DEV_EXT(false); + return 0xFF; + } + + //Copy name + //Copy untill we reach \0 character + STRNCPY_P(gpStat_StatisticsStopwatches[id].name, name, GP_STAT_MAX_NAME_LENGTH); + + //Clear counter + gpStat_StatisticsStopwatches[id].time = 0; + + GP_LOG_PRINTF("Stopwatch reg %i",2,(UInt16)id); + return id; +} + +void gpStat_FreeStopwatch(gpStat_StopwatchID_t id) +{ + gpStat_StatisticsStopwatch_t* pStopwatch = Stat_GetStopwatch(id); + + if(pStopwatch) + { + GP_LOG_PRINTF("Stopwatch free %i",2,(UInt16)id); + MEMSET(gpStat_StatisticsStopwatches[id].name,' ' ,GP_STAT_MAX_NAME_LENGTH); + } + else + { + Stat_ErrorID(id); + } +} + +void gpStat_StartStopwatch(gpStat_StopwatchID_t id) +{ + gpStat_StatisticsStopwatch_t* pStopwatch = Stat_GetStopwatch(id); + + if(pStopwatch) + { + pStopwatch->time = GP_STAT_GET_TIME(); + } + else + { + Stat_ErrorID(id); + } +} + +UInt32 gpStat_StopStopwatch(gpStat_StopwatchID_t id) +{ + gpStat_StatisticsStopwatch_t* pStopwatch = Stat_GetStopwatch(id); + + if(pStopwatch) + { + UInt32 time = GP_STAT_GET_TIME(); + + if(time >= pStopwatch->time) //check if no overflow is triggered + { + return (time - pStopwatch->time); + } + } + else + { + Stat_ErrorID(id); + } + + return 0xFFFFFFFF; +} +#endif + +#if GP_STAT_NUMBER_OF_SAMPLES > 0 +//---------------------------------------- +// Sampling +//---------------------------------------- + +void gpStat_SampleTime(UInt8 compId, FLASH_STRING filename, FLASH_STRING funcName, UInt16 line) +{ + UInt32 currentTime; + Stat_Sample_t* pSample; + + currentTime = GP_STAT_GET_TIME(); + + //Circular buffer - not using modulo for speed + gpStat_SampleIndex = (gpStat_SampleIndex < (GP_STAT_NUMBER_OF_SAMPLES-1)) ? (gpStat_SampleIndex+1) : 0; + + //Store sample info + pSample = &gpStat_Samples[gpStat_SampleIndex]; + + pSample->compId = compId; + pSample->line = line; + pSample->pFileName = filename; + STRNCPY_P(pSample->funcName, funcName, GP_STAT_MAX_NAME_CHARS); + pSample->time = currentTime; + + //gpLog_Printf(compId, true, funcName, 0); + //GP_LOG_SYSTEM_PRINTF("Sample overhead:%lu %i",0,GP_STAT_GET_TIME()-currentTime, (UInt16)gpStat_SampleIndex); +} + +//API functions + +void gpStat_ReturnSamples(void) +{ + UIntLoop i; + for(i = 1; i < GP_STAT_NUMBER_OF_SAMPLES+1; i++) + { + //Start from oldest sample - current index refers to last filled in sample + Stat_Sample_t* pSample = &gpStat_Samples[(gpStat_SampleIndex+i) % GP_STAT_NUMBER_OF_SAMPLES]; + + if (pSample->compId != 0) + { +#ifdef GP_DIVERSITY_LOG + Stat_LogSample(pSample); +#endif //GP_DIVERSITY_LOG + } + } + Stat_InitSampling(); +} + +#endif +#if GP_STAT_NUMBER_OF_HEAP_SAMPLES > 0 +//Measuring general consumption - some filtering can be applied on short term changes and size jumps +#define GP_STAT_HEAP_SAMPLE_SIZE_RESOLUTION 0 //amount of bytes +#define GP_STAT_HEAP_SAMPLE_TIME_RESOLUTION 5000 //5ms + +void gpStat_SampleHeap(UInt32 heapInUse) +{ + UInt32 currentTime; + gpStat_HeapSample_t* pSample; + + currentTime = GP_STAT_GET_TIME(); + + if((dist(heapInUse, gpStat_HeapSamples[gpStat_HeapSampleIndex].heapInUse) <= GP_STAT_HEAP_SAMPLE_SIZE_RESOLUTION) || /*difference granularity*/ + (dist(currentTime, gpStat_HeapSamples[gpStat_HeapSampleIndex].time) < GP_STAT_HEAP_SAMPLE_TIME_RESOLUTION) /*time granularity */ + ) + { + //Don't sample if there is little change or it's a rapid fluctuation + return; + } + + //Circular buffer - not using modulo for speed + gpStat_HeapSampleIndex = (gpStat_HeapSampleIndex < (number_of_elements(gpStat_HeapSamples)-1)) ? (gpStat_HeapSampleIndex+1) : 0; + + //Store sample info + pSample = &gpStat_HeapSamples[gpStat_HeapSampleIndex]; + + pSample->time = currentTime; + pSample->heapInUse = heapInUse; +} + +void gpStat_ReturnSamplesHeap(void) +{ + UIntLoop i; + for(i = 1; i < number_of_elements(gpStat_HeapSamples)+1; i++) + { + //Start from oldest sample - current index refers to last filled in sample + gpStat_HeapSample_t* pSample = &gpStat_HeapSamples[(gpStat_HeapSampleIndex+i) % number_of_elements(gpStat_HeapSamples)]; + + if (pSample->time != 0) + { +#ifdef GP_DIVERSITY_LOG + Stat_LogHeapSample(pSample); + gpLog_Flush(); +#endif //GP_DIVERSITY_LOG + } + } + Stat_InitHeapSampling(); +} +#endif //GP_STAT_NUMBER_OF_HEAP_SAMPLES + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/inc/gpUtils.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/inc/gpUtils.h new file mode 100644 index 0000000..1010b43 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/inc/gpUtils.h @@ -0,0 +1,355 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpUtils.h + * + * This file contains the API of the Utils component. This component implements the + * following features: + * + * - Link Lists (LL) + * - Array Lists (AL) + * - Circular buffer (CircB) + * - Stack control (stack) + * - CRC calculation (crc) + * - CRC32 calculation (crc32) + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPUTILS_H_ +#define _GPUTILS_H_ + +#ifdef GP_DIVERSITY_ROM_CODE +#include "gpUtils_RomCode.h" +#else //def GP_DIVERSITY_ROM_CODE + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "hal.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/* NOTE: When using this macro, make sure a and be are no functions + * since this will result in double evaluations! */ +#define GP_UTILS_MAX(a,b) (((a)>(b))?(a):(b)) + +#define GP_UTILS_LL_MEMORY_DECLARATION(elemType, nrOfElements) \ + typedef struct { \ + gpUtils_Link_t link; \ + elemType elem; \ + }gpUtils_ll_sub_##elemType##_t; \ + \ + typedef struct { \ + gpUtils_ll_sub_##elemType##_t sub_##elemType##_array[nrOfElements]; \ + }gpUtils_ll_##elemType##_t + +#define GP_UTILS_LL_MEMORY_ALOCATION(elemType, memoryName) \ + gpUtils_ll_##elemType##_t memoryName[1] + + +#define GP_UTILS_AL_MEMORY_DECLARATION(elemType, nrOfElements) \ + typedef struct { \ + gpUtils_ArrayListHdr_t arrayListHdr; \ + elemType elem; \ + }gpUtils_al_sub_##elemType##_t; \ + \ + typedef struct { \ + gpUtils_ArrayInfo_t bufInfo; \ + gpUtils_al_sub_##elemType##_t sub_##elemType##_array[nrOfElements]; \ + }gpUtils_al_##elemType##_t + +#define GP_UTILS_AL_MEMORY_ALOCATION(elemType, memoryName) \ + gpUtils_al_##elemType##_t memoryName[1] + +#define GP_UTILS_LL_SIZE_OF(elem_type) ((UInt32)sizeof(gpUtils_ll_sub_##elem_type##_t)) +#define GP_UTILS_AL_SIZE_OF(elem_type) ((UInt32)sizeof(gpUtils_al_sub_##elem_type##_t)) +#define GP_UTILS_AL_SIZE_BUF_INFO ((UInt32)sizeof(gpUtils_ArrayInfo_t)) + +#define GP_UTILS_LL_GET_ELEM(plnk) (void*)((UIntPtr)plnk + sizeof(gpUtils_Link_t)) +#define GP_UTILS_LL_GET_LINK(pelem) (gpUtils_Link_t*)((UIntPtr)pelem - sizeof(gpUtils_Link_t)) + +#define GP_UTILS_AL_GET_ELEM(phdr) (void*)((UIntPtr)phdr + sizeof(gpUtils_ArrayListHdr_t)) +#define GP_UTILS_AL_GET_HDR(pelem) (gpUtils_ArrayListHdr_t*)((UIntPtr)pelem - sizeof(gpUtils_ArrayListHdr_t)) +#define GP_UTILS_AL_GET_NEXT_HDR(phdr, pfre) (gpUtils_ArrayListHdr_t *)((UIntPtr)phdr + (UInt16)pfre->pbuf_info->elem_size) +#define GP_UTILS_AL_GET_PREV_HDR(phdr, pfre) (gpUtils_ArrayListHdr_t *)((UIntPtr)phdr - (UInt16)pfre->pbuf_info->elem_size) + +#define GP_UTILS_LL_IS_LIST_EMPTY(plist) (plist->plnk_first == NULL) + +#define GP_UTILS_LL_ACQUIRE_LOCK(plist) HAL_ACQUIRE_MUTEX(plist->lock) +#define GP_UTILS_LL_RELEASE_LOCK(plist) HAL_RELEASE_MUTEX(plist->lock) +#define GP_UTILS_LL_FREE_ACQUIRE_LOCK(pfre) HAL_ACQUIRE_MUTEX(pfre->lock) +#define GP_UTILS_LL_FREE_RELEASE_LOCK(pfre) HAL_RELEASE_MUTEX(pfre->lock) + + +#define GP_UTILS_END_OF_STACK +#define GP_UTILS_STACK_PATTERN +#define GP_UTILS_END_OF_ISRAM +#define GP_UTILS_INIT_STACK() + +#define GP_UTILS_CHECK_STACK_PATTERN() +#define GP_UTILS_CHECK_STACK_POINTER() +#define GP_UTILS_CHECK_STACK_USAGE() +#define GP_UTILS_DUMP_STACK_POINTER() +#define GP_UTILS_DUMP_STACK_POINTER2(x) + +#define GP_UTILS_DUMP_STACK_TRACK() +#define GP_UTILS_RESET_STACK_TRACK() +#define GP_UTILS_STACK_TRACK() + + +#define GP_UTILS_AL_ELEM_FREE 0 +#define GP_UTILS_AL_ELEM_RESERVED 1 + +#define GP_UTILS_CRC32_INITIAL_REMAINDER (UInt32)(0xFFFFFFFF) +#define GP_UTILS_CRC32_FINAL_XOR_VALUE (UInt32)(0xFFFFFFFF) + +#define GP_UTILS_LOCK_CLAIM() true +#define GP_UTILS_LOCK_RELEASE() true +#define GP_UTILS_LOCK_CHECK_CLAIMED() false + +#define RADIO_INT +#define GPCOMTXRX +#define LWIP +#define SCHEDEVENT +#define POSTPROCESSING +#define HOSTPROCESSING + +#define GP_UTILS_CPUMON_INIT() +#define GP_UTILS_CPUMON_NEW_SCHEDULER_LOOP() +#define GP_UTILS_CPUMON_PROCDONE(x) + +#define GP_UTILS_CPUMON_IRQPROLOGUE() +#define GP_UTILS_CPUMON_IRQEPILOGUE() + +#define GP_UTILS_CPUMON_HOSTPROCESSING_START() +#define GP_UTILS_CPUMON_HOSTPROCESSING_DONE() + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct gpUtils_Link { + struct gpUtils_Link* plnk_nxt; + struct gpUtils_Link* plnk_prv; +} gpUtils_Link_t; + +typedef struct { + gpUtils_Link_t* plnk_free; // List of free cells + gpUtils_Link_t* plnk_free_last; // Pointer to the last free cell for circular cell usage + HAL_CRITICAL_SECTION_DEF(lock) +} gpUtils_LinkFree_t; + +typedef struct { + gpUtils_Link_t * plnk_first; // The first element in the list + gpUtils_Link_t * plnk_last; // The last element in the list + HAL_CRITICAL_SECTION_DEF(lock) +} gpUtils_LinkList_t; + +typedef struct { + void * pfirst; // The first pointer + void * psecond; // The second pointer + HAL_CRITICAL_SECTION_DEF(lock) // common lock +} gpUtils_LinkCommon_t; + +typedef union { + gpUtils_LinkFree_t free; + gpUtils_LinkList_t list; + gpUtils_LinkCommon_t common; +} gpUtils_Links_t; + +//Padding issues for arraylists +typedef UInt8 gpUtils_ArrayListHdr_t; //The header of an arrayelement indicating if the element is in use + +typedef struct { + UInt16 elem_size; //Array list element size including header + UInt16 elem_cnt; // Array list total number of elements +} gpUtils_ArrayInfo_t; + +typedef struct { + gpUtils_ArrayInfo_t * pbuf_info; // pointer to Array buffer info at start of buffer block + gpUtils_ArrayListHdr_t * pfree; // first known free element in array list + gpUtils_ArrayListHdr_t * plast; // Last element pointer of array list (kept for calculation ease) +} gpUtils_ArrayFree_t; + +//Simple array lists (not linked) +typedef struct { + gpUtils_ArrayListHdr_t type; // value indentifying a unique ID for the list + gpUtils_ArrayInfo_t * pbuf_info; // pointer to Array buffer info at start of free list buffer block + gpUtils_ArrayListHdr_t * pfirst; // Start ptr of Arraylist + gpUtils_ArrayListHdr_t * plast; // End ptr of Arraylist +} gpUtils_ArrayList_t; + +//Circular buffer +typedef struct { + UInt8* pBuffer; // Pointer to the memory block + UInt16 size; // Size of the memory block + UInt16 readIndex; // Read index + UInt16 writeIndex; // Write index + Bool full; // Flag indicating a full buffer +} gpUtils_CircularBuffer_t; + +typedef Bool (*gpUtils_ElemCompare_t)( void* , void* ); +typedef Bool (*gpUtils_ElemCompareDelete_t)( void* , void* , Bool* ); + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +void gpUtils_WmrkSubscribe(void); + +UInt32 gpUtil_encodeBase64(const UInt8 *in_buf, const UInt32 in_len, char *out_buf, const UInt32 out_len); + + +/**************************************************************************** + **************************************************************************** + ** Linked lists ** + **************************************************************************** + ****************************************************************************/ + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpUtils_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +GP_API void gpUtils_LLInit (void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLClear (gpUtils_LinkList_t * plst); +GP_API void* gpUtils_LLNew (gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLAdd (void * pelem, gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLInsert (void * pelem, void * pelem_cur, gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLInsertBefore (void * pelem, void * pelem_cur, gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLInsertSorted (void * pelem, gpUtils_LinkList_t * plst, gpUtils_ElemCompare_t callback); +GP_API void* gpUtils_LLNewSorted (void * pelem, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre, gpUtils_ElemCompareDelete_t callback); +GP_API void gpUtils_LLUnlink (void * pelem, gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLFree (void * pelem, gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLRelease (void * pelem, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLDump (gpUtils_LinkList_t * plst); +GP_API void gpUtils_LLDumpFree (gpUtils_LinkFree_t * pfree); +GP_API void gpUtils_LLDumpMemory (void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre); +GP_API Bool gpUtils_LLCheckConsistency(void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre); +GP_API void gpUtils_LLDeInit(gpUtils_LinkList_t* plst); +GP_API void gpUtils_LLDeInitFree(gpUtils_LinkFree_t* pfre); + +GP_API void* gpUtils_LLGetNext(void* pelem); +GP_API void* gpUtils_LLGetPrev(void* pelem); +GP_API gpUtils_Link_t* gpUtils_LLGetLink(void* pelem); +GP_API void* gpUtils_LLGetElem(gpUtils_Link_t* plnk); +GP_API void* gpUtils_LLGetFirstElem(gpUtils_LinkList_t* plst); +GP_API void* gpUtils_LLGetLastElem(gpUtils_LinkList_t* plst); + +//Array list basic operations +GP_API void gpUtils_ALInit (void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_ArrayFree_t * pfre); +GP_API void* gpUtils_ALNew (gpUtils_ArrayFree_t* pfre); +GP_API void gpUtils_ALFree (void * pelem, gpUtils_ArrayFree_t* pfre); +GP_API void gpUtils_ALDumpFree (gpUtils_ArrayFree_t* pfre); +GP_API void gpUtils_ALClear (gpUtils_ArrayList_t* plst, gpUtils_ArrayListHdr_t type, gpUtils_ArrayFree_t* pfre); +GP_API void gpUtils_ALAdd (void * pelem, gpUtils_ArrayList_t* plst); +GP_API void gpUtils_ALUnlink (void * pelem, gpUtils_ArrayList_t* plst); +GP_API void gpUtils_ALRelease (void * pelem, gpUtils_ArrayList_t * plst, gpUtils_ArrayFree_t * pfre); +GP_API void gpUtils_ALDump (gpUtils_ArrayList_t* plst); +//GP_API void gpUtils_ALDumpMemory (gpUtils_ArrayList_t* plst, gpUtils_ArrayFree_t* pfre); +//Array list functions +GP_API void* gpUtils_ALGetNext (gpUtils_ArrayList_t * plst, void* pelem); +GP_API void* gpUtils_ALGetPrev (gpUtils_ArrayList_t * plst, void* pelem); +GP_API void* gpUtils_ALGetElem (gpUtils_ArrayListHdr_t* phdr); +GP_API gpUtils_ArrayListHdr_t* gpUtils_ALGetHdr (void* pelem); +GP_API void* gpUtils_ALGetFirstElem (gpUtils_ArrayList_t * plst); +GP_API void* gpUtils_ALGetLastElem (gpUtils_ArrayList_t * plst); +//Circular buffer basic operations +GP_API void gpUtils_CircBInit (gpUtils_CircularBuffer_t* pCircularBuffer, void * pBuffer, UInt16 size); +GP_API void gpUtils_CircBClear (gpUtils_CircularBuffer_t* pCircularBuffer); +GP_API UInt16 gpUtils_CircBAvailableData (gpUtils_CircularBuffer_t* pCircularBuffer); +GP_API UInt16 gpUtils_CircBAvailableSpace (gpUtils_CircularBuffer_t* pCircularBuffer); +GP_API Bool gpUtils_CircBWriteData (gpUtils_CircularBuffer_t* pCircularBuffer, UInt8* pData, UInt16 length); +GP_API Bool gpUtils_CircBWriteByte (gpUtils_CircularBuffer_t* pCircularBuffer, UInt8 Data); +GP_API Bool gpUtils_CircBReadData (gpUtils_CircularBuffer_t* pCircularBuffer, UInt8* pData, UInt16 length); +GP_API Bool gpUtils_CircBReadByte (gpUtils_CircularBuffer_t* pCircularBuffer, UInt8* pData); +GP_API Bool gpUtils_CircBGetData (gpUtils_CircularBuffer_t* pCircularBuffer, UInt16 index, UInt8* pData, UInt16 length); +GP_API Bool gpUtils_CircBGetByte (gpUtils_CircularBuffer_t* pCircularBuffer, UInt16 index, UInt8* pData); + + +//Crc checking +GP_API UInt16 gpUtils_CalculateCrc(UInt8* pData , UInt16 length); +GP_API void gpUtils_UpdateCrc(UInt16* pCRCValue, UInt8 Data); +GP_API void gpUtils_CalculatePartialCrc(UInt16* pCrcValue, UInt8* pData, UInt16 length); + +//Crc CCITT-16 +GP_API UInt16 gpUtils_CalculateKermitCrc(UInt8 *pData, UInt16 length); + +//Crc32 checking +GP_API UInt32 gpUtils_CalculateCrc32(UInt8* pData , UInt32 length); +GP_API void gpUtils_UpdateCrc32(UInt32* pCRCValue, UInt8 Data); +GP_API void gpUtils_CalculatePartialCrc32(UInt32* pCrcValue, UInt8* pData, UInt32 length); + +//Global lock +GP_API Bool gpUtils_LockClaim(void); +GP_API Bool gpUtils_LockRelease(void); +GP_API Bool gpUtils_LockCheckClaimed(void); + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +void gpUtils_LLLockCreate(gpUtils_Links_t *plst); +void gpUtils_LLLockDestroy(gpUtils_Links_t * plst); +void gpUtils_LLLockAcquire(gpUtils_Links_t * plst); +void gpUtils_LLLockRelease(gpUtils_Links_t * plst); +Bool gpUtils_LLLockIsValid(gpUtils_Links_t * plst); +Bool gpUtils_LLLockIsAcquired(gpUtils_Links_t * plst); + +#ifdef __cplusplus +} +#endif + +#endif //def GP_DIVERSITY_ROM_CODE + +#endif // _GPUTILS_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c new file mode 100644 index 0000000..aa3b71f --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LL.c @@ -0,0 +1,355 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, 2021-2022, Qorvo Inc + * + * gpUtils_LL.c + * + * This file contains the link list features of the Utils component. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +void Utils_InsertBound(gpUtils_Link_t* plnk, gpUtils_LinkList_t* plst); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +void gpUtils_LLLockCreate(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + hal_MutexCreate(&plst->common.lock); +#endif +} + +void gpUtils_LLLockDestroy(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + hal_MutexDestroy(&plst->common.lock); +#endif +} + +void gpUtils_LLLockAcquire(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + hal_MutexAcquire(plst->common.lock); +#else + hal_MutexAcquire(NULL); +#endif +} + +void gpUtils_LLLockRelease(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + hal_MutexRelease(plst->common.lock); +#else + hal_MutexRelease(NULL); +#endif +} + +Bool gpUtils_LLLockIsValid(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + return hal_MutexIsValid(plst->common.lock); +#else + return hal_MutexIsValid(NULL); +#endif +} + +Bool gpUtils_LLLockIsAcquired(gpUtils_Links_t* plst) +{ +#if defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2) + return hal_MutexIsAcquired(plst->common.lock); +#else + return hal_MutexIsAcquired(NULL); +#endif +} + +void Utils_InsertBound(gpUtils_Link_t* plnk, gpUtils_LinkList_t* plst) +{ + // Insert the element that has its insertion point filled in + // To be executed atomically before specifying the insertion point! + + // If there is a next element, point it to me + // or adjust the last-pointer + if(plnk->plnk_nxt) + { + plnk->plnk_nxt->plnk_prv = plnk; + } + else + { + plst->plnk_last = plnk; + } + // If there is a previous element, point it to me + // or adjust the first-pointer + if(plnk->plnk_prv) + { + plnk->plnk_prv->plnk_nxt = plnk; + } + else + { + plst->plnk_first = plnk; + } +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpUtils_LLInit(void* buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkFree_t* pfre) +{ + void* plnk_org = buf; // Remember start of the list + UInt32 i; + gpUtils_Link_t* plnk = (gpUtils_Link_t*)buf; + + // Init linked list + // Point the next-pointer of every cell to the link struct of the next cell + // To initialize the private contents of every cell itself is up to the user + // Every cell may have a payload or a pointer to a payload embedded + for(i = 0; i < (n_nr_of_elements - 1); i++) + { + plnk->plnk_nxt = (gpUtils_Link_t*)((UIntPtr)plnk + (UInt16)n_size_cell /*+ (UInt16)sizeof(gpUtils_Link_t)*/); + plnk = plnk->plnk_nxt; + } + plnk->plnk_nxt = NULL; + // Assign the free-pointers + // Hook the last-pointer to the last cell to be able to have circular usage of the free-list + // Used cells will be returned to the end of the list + pfre->plnk_free_last = plnk; + pfre->plnk_free = plnk_org; + if(!gpUtils_LLLockIsValid((gpUtils_Links_t*)pfre)) + { + gpUtils_LLLockCreate((gpUtils_Links_t*)pfre); + } + GP_ASSERT_DEV_EXT(gpUtils_LLLockIsValid((gpUtils_Links_t*)pfre)); +} + +void gpUtils_LLClear(gpUtils_LinkList_t* plst) +{ + HAL_DISABLE_GLOBAL_INT(); + // Clear the list + plst->plnk_first = plst->plnk_last = NULL; + if(!gpUtils_LLLockIsValid((gpUtils_Links_t*)plst)) + { + gpUtils_LLLockCreate((gpUtils_Links_t*)plst); + } + GP_ASSERT_DEV_EXT(gpUtils_LLLockIsValid((gpUtils_Links_t*)plst)); + HAL_ENABLE_GLOBAL_INT(); +} + +void* gpUtils_LLNew(gpUtils_LinkFree_t* pfre) +{ + // Get a fresh element from the free-list + gpUtils_Link_t* p_cell; + + // Check if AtomicOn + GP_ASSERT_DEV_EXT(pfre && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)pfre)); + if(pfre) + { + // Get element from start of queue + if(!(p_cell = pfre->plnk_free)) + return NULL; // exit if no more element available + + // Move the free-pointer + pfre->plnk_free = pfre->plnk_free->plnk_nxt; + + // This might have been the last element in the list + if(!pfre->plnk_free) + { + pfre->plnk_free_last = pfre->plnk_free; + } + } + else + { + p_cell = NULL; + } + + if(p_cell) + { + return GP_UTILS_LL_GET_ELEM(p_cell); + } + else + { + return NULL; + } +} + +void gpUtils_LLAdd(void* pelem, gpUtils_LinkList_t* plst) +{ + gpUtils_Link_t* plnk; + // Add the element to the end of the list + // Check if AtomicOn + GP_ASSERT_DEV_EXT(plst && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)plst)); + GP_ASSERT_DEV_EXT(pelem); + plnk = GP_UTILS_LL_GET_LINK(pelem); + // Set the link pointers + plnk->plnk_prv = plst->plnk_last; + plnk->plnk_nxt = 0; + // Insert the element + Utils_InsertBound(plnk, plst); +} + +void gpUtils_LLInsertBefore(void* pelem, void* pelem_cur, gpUtils_LinkList_t* plst) +{ + gpUtils_Link_t* plnk; + gpUtils_Link_t* plnk_cur; + // Insert the element after the current position + // UNTESTED + // Check if AtomicOn + GP_ASSERT_DEV_EXT(plst && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)plst)); + + plnk = GP_UTILS_LL_GET_LINK(pelem); + plnk_cur = GP_UTILS_LL_GET_LINK(pelem_cur); + + // Set the link pointers + plnk->plnk_prv = plnk_cur->plnk_prv; + plnk->plnk_nxt = plnk_cur; + + // Insert the element + Utils_InsertBound(plnk, plst); +} + +void gpUtils_LLUnlink(void* pelem, gpUtils_LinkList_t* plst) +{ + gpUtils_Link_t* plnk; + // Remove the element from the list + // Check if AtomicOn + GP_ASSERT_DEV_EXT(plst && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)plst)); + + if(!pelem) + { + GP_ASSERT_DEV_EXT(false); + } + + plnk = GP_UTILS_LL_GET_LINK(pelem); + // If there is a previous element, point it to my next + // or adjust the first-pointer + if(plnk->plnk_prv) + { + plnk->plnk_prv->plnk_nxt = plnk->plnk_nxt; + } + else + { + plst->plnk_first = plnk->plnk_nxt; + } + // If there is a next element, point it to my previous + // or adjust the last-pointer + if(plnk->plnk_nxt) + { + plnk->plnk_nxt->plnk_prv = plnk->plnk_prv; + } + else + { + plst->plnk_last = plnk->plnk_prv; + } +} + +void gpUtils_LLFree(void* pelem, gpUtils_LinkFree_t* pfre) +{ + gpUtils_Link_t* plnk; + // Return the unlinked element to end of free-queue + + // Check if AtomicOn + GP_ASSERT_DEV_EXT(pfre && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)pfre)); + + if(!pelem) + { + GP_ASSERT_DEV_EXT(false); + } + + plnk = GP_UTILS_LL_GET_LINK(pelem); + // Link this element behind the last + if(pfre->plnk_free_last) + { + pfre->plnk_free_last->plnk_nxt = plnk; + } + // And move the last-pointer + pfre->plnk_free_last = plnk; + // This is the last element + plnk->plnk_nxt = 0; + // This might be the first element in the list + if(!pfre->plnk_free) + { + pfre->plnk_free = plnk; + } +} + +void* gpUtils_LLGetFirstElem(gpUtils_LinkList_t* plst) +{ + void* pelem = (void*)((UInt8*)plst->plnk_first + sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(plst && gpUtils_LLLockIsAcquired((gpUtils_Links_t*)plst)); + return plst->plnk_first ? pelem : NULL; +} + +void gpUtils_LLDeInit(gpUtils_LinkList_t* plst) +{ + if(gpUtils_LLLockIsValid((gpUtils_Links_t*)plst)) + { + gpUtils_LLLockDestroy((gpUtils_Links_t*)plst); + } +} + +void gpUtils_LLDeInitFree(gpUtils_LinkFree_t* pfre) +{ + if(gpUtils_LLLockIsValid((gpUtils_Links_t*)pfre)) + { + gpUtils_LLLockDestroy((gpUtils_Links_t*)pfre); + } +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c new file mode 100644 index 0000000..5205232 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_LLext.c @@ -0,0 +1,298 @@ +/* + * Copyright (c) 2008-2013, 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpUtils_LLext.c + * + * This file contains the less used functions of the Linked Lists + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +extern void Utils_InsertBound(gpUtils_Link_t * plnk, gpUtils_LinkList_t * plst); + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void +gpUtils_LLInsert (void * pelem, void * pelem_cur, gpUtils_LinkList_t * plst) { + gpUtils_Link_t* plnk; + gpUtils_Link_t* plnk_cur; + // Insert the element at the current position + // UNTESTED + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + //HAL_DISABLE_GLOBAL_INT(); + plnk = GP_UTILS_LL_GET_LINK(pelem); + plnk_cur = GP_UTILS_LL_GET_LINK(pelem_cur); + // Set the link pointers + plnk->plnk_prv = plnk_cur; + plnk->plnk_nxt = plnk_cur->plnk_nxt; + // Insert the element + Utils_InsertBound (plnk, plst); + //HAL_ENABLE_GLOBAL_INT(); +} + +void +gpUtils_LLInsertSorted (void * pelem, gpUtils_LinkList_t * plst, gpUtils_ElemCompare_t callback) +{ + gpUtils_Link_t* plnk; + void* pelemFound = NULL; + + GP_ASSERT_DEV_EXT(pelem); + + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + //HAL_DISABLE_GLOBAL_INT(); + + // Search position in the sorted list + for (plnk = plst->plnk_first; plnk; plnk = plnk->plnk_nxt) + { + pelemFound = GP_UTILS_LL_GET_ELEM(plnk); + if (callback(pelem,pelemFound)) + break; + } + if (plnk) + { + gpUtils_LLInsertBefore(pelem, pelemFound, plst); + } + else + { + gpUtils_LLAdd(pelem,plst); + } +} + +void* +gpUtils_LLNewSorted (void * pelem, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre, gpUtils_ElemCompareDelete_t callback) +{ + void* preturn = gpUtils_LLNew(pfre); + Bool betterElemThanLast = true; + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + //HAL_DISABLE_GLOBAL_INT(); + + // If last element is better than last, element can always be added (it can alays replace the last element) + // If it is not better, then it can only be added if a free element exists in the free list + if (!preturn) + { + gpUtils_Link_t* plnk; + void* pelem_last; + Bool canBeDeleted; + for (plnk = plst->plnk_last; plnk; plnk = plnk->plnk_prv) + { + pelem_last = GP_UTILS_LL_GET_ELEM(plnk); + + betterElemThanLast = callback(pelem,pelem_last,&canBeDeleted); + if (betterElemThanLast) + { + if (canBeDeleted) + { + // return last element + preturn = pelem_last; + gpUtils_LLUnlink(preturn, plst); + break; + } + } + else + break; + } + } + return preturn; +} + +void +gpUtils_LLRelease (void * pelem, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre) { + // Remove the element from the list and return to the free-list + gpUtils_LLUnlink (pelem, plst); + gpUtils_LLFree (pelem, pfre); +} + +void gpUtils_LLDump (gpUtils_LinkList_t * plst) +{ + gpUtils_Link_t* plnk; + HAL_DISABLE_GLOBAL_INT(); + GP_LOG_PRINTF("Dump LL:",0); + GP_LOG_PRINTF("First:%p, Last:%p",4,plst->plnk_first,plst->plnk_last); + for (plnk = plst->plnk_first;plnk;plnk = plnk->plnk_nxt) + { + GP_LOG_PRINTF("this:%p/%p,prev:%p,nxt:%p,data:%i",10,plnk,GP_UTILS_LL_GET_ELEM(plnk),plnk->plnk_prv,plnk->plnk_nxt,*(Char*)(GP_UTILS_LL_GET_ELEM(plnk))); + } + GP_LOG_PRINTF("End Dump LL:",0); + HAL_ENABLE_GLOBAL_INT(); +} + +void gpUtils_LLDumpFree (gpUtils_LinkFree_t * pfree) +{ + UInt8 Counter = 0; + gpUtils_Link_t* plnk; + HAL_DISABLE_GLOBAL_INT(); + GP_LOG_PRINTF("DumpFree LL:",0); + GP_LOG_PRINTF("First:%p, Last:%p",4,pfree->plnk_free,pfree->plnk_free_last); + for (plnk = pfree->plnk_free;plnk && Counter<10;plnk = plnk->plnk_nxt) + { + GP_LOG_PRINTF("this:%p/%p,prev:%p,nxt:%p,data:%i",10,plnk,GP_UTILS_LL_GET_ELEM(plnk),plnk->plnk_prv,plnk->plnk_nxt,*(Char*)(GP_UTILS_LL_GET_ELEM(plnk))); + Counter++; + } + GP_LOG_PRINTF("End Dump LL:",0); + HAL_ENABLE_GLOBAL_INT(); +} + +void +gpUtils_LLDumpMemory (void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre ) { + UInt32 i; + gpUtils_Link_t* plnk = (gpUtils_Link_t*)buf; + + NOT_USED(pfre); + NOT_USED(plst); + + GP_LOG_PRINTF("Lf%p Ll%p Ff%p Fl%p",8,plst->plnk_first,plst->plnk_last,pfre->plnk_free,pfre->plnk_free_last); + for (i = 0; i < n_nr_of_elements; i++) { + GP_LOG_PRINTF("@%p <%p %p>",6,plnk,plnk->plnk_prv, plnk->plnk_nxt); + //GP_LOG_PRINTF("d:%x %x %x %x %x",10, plnk->plnk_nxt[1], plnk->plnk_nxt[2], plnk->plnk_nxt[3], plnk->plnk_nxt[4], plnk->plnk_nxt[5]); + plnk = (gpUtils_Link_t *) ((UIntPtr) plnk + (UInt16)n_size_cell); + } +} + +Bool gpUtils_LLCheckConsistency(void * buf, UInt32 n_size_cell, UInt32 n_nr_of_elements, gpUtils_LinkList_t * plst, gpUtils_LinkFree_t * pfre) +{ + UInt32 ElementCounter = 0; + gpUtils_Link_t* plnk; + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + if (plst) + { + for (plnk = plst->plnk_first; plnk; plnk = plnk->plnk_nxt) + { + ElementCounter++; + if (ElementCounter > n_nr_of_elements) + { + GP_LOG_PRINTF("Err1 %"PRIu32" %"PRIu32,6, ElementCounter, n_nr_of_elements); + gpUtils_LLDumpMemory(buf, n_size_cell, n_nr_of_elements, plst, pfre); + return false; + } + } + } + if (pfre) + { + ElementCounter = 0; + for (plnk = pfre->plnk_free; plnk; plnk = plnk->plnk_nxt) + { + ElementCounter++; + if (ElementCounter > n_nr_of_elements) + { + GP_LOG_PRINTF("Err2 %"PRIu32" %"PRIu32,6, (long unsigned int)ElementCounter, (long unsigned int)n_nr_of_elements); + gpUtils_LLDumpMemory(buf, n_size_cell, n_nr_of_elements, plst, pfre); + return false; + } + } + } + return true; +} + +void* gpUtils_LLGetNext(void* pelem) +{ + gpUtils_Link_t* plnk = (gpUtils_Link_t*)((UIntPtr)pelem - sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + + return plnk->plnk_nxt?GP_UTILS_LL_GET_ELEM(plnk->plnk_nxt):NULL; +} + +void* gpUtils_LLGetPrev(void* pelem) +{ + gpUtils_Link_t* plnk = (gpUtils_Link_t*)((UIntPtr)pelem - sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + + return plnk->plnk_prv?GP_UTILS_LL_GET_ELEM(plnk->plnk_prv):NULL; +} + +gpUtils_Link_t* gpUtils_LLGetLink(void* pelem) +{ + gpUtils_Link_t* plnk = (gpUtils_Link_t*)((UIntPtr)pelem - sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + return pelem?plnk:NULL; +} + +void* gpUtils_LLGetElem(gpUtils_Link_t* plnk) +{ + void* pelem = (void*)((UIntPtr)plnk + sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + return plnk?pelem:NULL; +} + +void* gpUtils_LLGetLastElem(gpUtils_LinkList_t* plst) +{ + void* pelem = (void*)((UIntPtr)plst->plnk_last + sizeof(gpUtils_Link_t)); + // Check if AtomicOn + GP_ASSERT_DEV_EXT(!HAL_GLOBAL_INT_ENABLED()); + return plst->plnk_last?pelem:NULL; +} + + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c new file mode 100644 index 0000000..f03f1fb --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_base64.c @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2017, 2019, Qorvo Inc + * + * Helper functions to encode/decode Base64 + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "gpUtils.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +/*! + * \brief Encode binary data with the Base64 scheme + * + * \param in_buf Pointer to the input buffer + * \param in_len Length of the input buffer + * \param out_buf Pointer to the output buffer + * \param out_len Length of the output buffer + * + * \return 0, on success + * N, if out_len is less than N or any of the data pointers is NULL + * in_len, if N would overflow UInt32 + * + * \notes + * * N is the minimum size of the output buffer for the given input (string termination included) + * * the output buffer is to be allocated/freed by the caller + */ +UInt32 gpUtil_encodeBase64(const UInt8 *in_buf, const UInt32 in_len, char *out_buf, const UInt32 out_len) +{ + const char *encoding_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + const UInt8 pad_len[] = { 0, 2, 1 }; + + const UInt8 *in_end = in_buf + in_len; + const UInt8 *in_p = in_buf; + + const UInt32 out_min_len = 4 * ((in_len + 2) / 3) + 1; + const char *out_end = out_buf + out_min_len; + char *out_p = out_buf; + + /* validate parameters */ + if (in_buf == NULL || out_buf == NULL || out_len < out_min_len || out_min_len < in_len) + { + /* failure, return in_len or out_min_len (N), as needed */ + return out_min_len < in_len ? in_len : out_min_len; + } + + /* fill the whole output buffer with string terminators */ + MEMSET(out_buf, 0, out_len); + + /* data loop: consume three input bytes and produce 4 output bytes */ + while (in_p < in_end) + { + UInt32 n = ((UInt32) *in_p++) << 16; + + if (in_p < in_end) + { + n += ((UInt32) *in_p++) << 8; + } + + if (in_p < in_end) + { + n += ((UInt32) *in_p++); + } + + *out_p++ = encoding_table[(n >> 3 * 6) & 0x3f]; + *out_p++ = encoding_table[(n >> 2 * 6) & 0x3f]; + *out_p++ = encoding_table[(n >> 1 * 6) & 0x3f]; + *out_p++ = encoding_table[(n >> 0 * 6) & 0x3f]; + } + + /* fix-up padding if the input size is not 0 modulo 3 */ + out_p = out_buf + out_min_len - pad_len[in_len % 3] - 1; + while (out_p < out_end - 1) + { + *out_p++ = '='; + } + + /* success */ + return 0; +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c new file mode 100644 index 0000000..d51f48f --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc.c @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2008-2013, 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpUtils_crc.c + * + * This file contains the crc features of the Utils component. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +//CRC-16-IBM - x16 + x15 + x2 + 1 +//#define GP_UTILS_DIVERSITY_CRC_TABLE +static INLINE UInt16 _crc16_update(UInt16 crc, UInt8 a) +{ + int i; + + crc ^= a; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; + else + crc = (crc >> 1); + } + + return crc; +} + +static INLINE UInt16 _crc16_kermit_update(UInt16 crc, UInt8 a) +{ + UInt8 i; + UInt16 tmp; + UInt16 c; + + tmp = 0; + c = crc ^ a; + for (i = 0; i < 8; i++) + { + if ((tmp ^ c) & 0x0001) + { + tmp = (tmp >> 1) ^ 0x8408; + } + else + { + tmp = tmp >> 1; + } + + c = c >> 1; + } + crc = (crc >> 8) ^ tmp; + + return crc; +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpUtils_CalculatePartialCrc(UInt16* pCrcValue, UInt8* pData, UInt16 length) +{ + while(length--) + { + *pCrcValue = _crc16_update(*pCrcValue, *pData); + pData++; + } +} + +UInt16 gpUtils_CalculateCrc(UInt8* pData , UInt16 length) +{ + UInt16 crc_value = 0; + gpUtils_CalculatePartialCrc(&crc_value, pData, length); + + return crc_value; +} + +void gpUtils_UpdateCrc(UInt16* pCRCValue, UInt8 byte) +{ + gpUtils_CalculatePartialCrc(pCRCValue, &byte, 1); +} + +void gpUtils_CalculatePartialKermitCrc(UInt16* pCrcValue, UInt8* pData, UInt16 length) +{ + while (length--) + { + *pCrcValue = _crc16_kermit_update(*pCrcValue, *pData++); + } +} + +UInt16 gpUtils_CalculateKermitCrc(UInt8 *pData, UInt16 length) +{ + UInt16 crc_value = 0; + gpUtils_CalculatePartialKermitCrc(&crc_value, pData, length); + + return crc_value; +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c new file mode 100644 index 0000000..e2061a2 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpUtils/src/gpUtils_crc32.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2011, 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpUtils_crc.c + * + * This file contains the crc features of the Utils component. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_UTILS + +#include "gpUtils.h" +#include "gpLog.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +#define _crc32_init(crc) /*No init of crc HW */ +static INLINE UInt32 _crc32_update(UInt32 crc, UInt8 a) +{ + UIntLoop j; + + crc= crc ^ a; + for (j=0; j<8; j++) + { + if (crc & 1) + crc = (crc>>1) ^ 0xEDB88320 ; + else + crc = crc >>1 ; + } + + return crc; +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpUtils_CalculatePartialCrc32 (UInt32* pCrcValue, UInt8* pData, UInt32 length) +{ + _crc32_init(*pCrcValue); + while(length--) + { + *pCrcValue = _crc32_update(*pCrcValue, *pData); + pData++; + } +} + +UInt32 gpUtils_CalculateCrc32(UInt8* pData , UInt32 length) +{ + UInt32 crc_value = GP_UTILS_CRC32_INITIAL_REMAINDER; + gpUtils_CalculatePartialCrc32(&crc_value, pData, length); + + return (crc_value ^ GP_UTILS_CRC32_FINAL_XOR_VALUE); +} + +void gpUtils_UpdateCrc32(UInt32* pCRCValue, UInt8 byte) +{ + gpUtils_CalculatePartialCrc32(pCRCValue, &byte, 1); +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpWmrk/inc/gpWmrk.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpWmrk/inc/gpWmrk.h new file mode 100644 index 0000000..08e11e1 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/BaseUtils/gpWmrk/inc/gpWmrk.h @@ -0,0 +1,109 @@ + +/* + * Copyright (c) 2012, 2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpWmrk.h + * + * This file defines the watermarker component api + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPWMRK_H_ +#define _GPWMRK_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +/// @brief The maximum amount tallies to be monitored (can be overruled at compilation time). +#ifndef GP_WMRK_MAX_ENTRIES +#define GP_WMRK_MAX_ENTRIES 6 +#endif +/// @brief The interval to generate a log which shows all subscribed tallies (can be overruled at compilation time). +#ifndef GP_WMRK_INTERVAL +#define GP_WMRK_INTERVAL 60000000 +#endif +/// @brief The maximum # chars to define a unique id. +#define GP_WMRK_MAX_UID_LENGTH 3 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @typedef gpWmrk_Parameters_t + * @brief The gpWmrk_Parameters_t defines the parameters required for the watermarker +*/ +typedef struct gpWmrk_Parameters { + UIntPtr softLimit; + UIntPtr deadLimit; + UIntPtr value; + char uid[GP_WMRK_MAX_UID_LENGTH]; // unique id + Bool up; // up or down counter +} gpWmrk_Parameters_t; + +/** @typedef gmrk_Id_t + * @brief The gpWmrk_Id_t defines the id used by the Watermarker, FAILURE equals 0xFF + * When a counter needs to be manipulated, the very same Id needs to be passed as argument + * + +*/ +typedef UInt8 gpWmrk_Id_t; + +/// @brief Value returned in error situations. +#define GP_WMRK_FAILURE 0xFF + +/** + * @file gpWmrk.h + * + * + * @defgroup GEN_WMRK General Watermarker functions + * @brief The general Watermarker functionality is implemented in these functions + * + * @note When a counter needs to go towards its limit gpWmrk_CntrIncr should be used despite it's direction + */ + + +#define gpWmrk_Init() +#define gpWmrk_Subscribe(params) 0 +#define gpWmrk_CntrToLimit(id) +#define gpWmrk_CntrFromLimit(id) +#define gpWmrk_CntrSet(id, val) + + +#endif // _GPWMRK_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal.h new file mode 100644 index 0000000..f038224 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal.h @@ -0,0 +1,618 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2021, Qorvo Inc + * + * hal.h + * Hardware Abstraction Layer for linux based devices. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_H_ +#define _HAL_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "global.h" +#include "gpBsp.h" + +#ifdef GP_COMP_GPHAL +#include "gpHal_MSI.h" +#endif //GP_COMP_GPHAL + +#ifdef __cplusplus +extern "C" { +#endif + +#include "hal_Extension.h" + +#include +#include +#include + +/***************************************************************************** + * TIMER + *****************************************************************************/ + + +/* This implementation uses the time of the os to keep the time */ +UInt32 hal_GetCurrentTime(void); +UInt32 hal_GetCurrentTime_1us(void); +#define HAL_TIMER_START(initialisationTime) + +#define HAL_TIMER_STOP() + +#define HAL_TIMER_GET_CURRENT_TIME(time) time = hal_GetCurrentTime() + +#define HAL_TIMER_GET_CURRENT_TIME_1US(time) time = hal_GetCurrentTime_1us() + +/***************************************************************************** + * SPI + *****************************************************************************/ + +#ifdef GP_COMP_GPHAL +int hal_spi_readRegExternal(gpHal_Address_t Address, UInt8* pData); +int hal_spi_writeRegExternal(gpHal_Address_t Address, UInt8 Data); +int hal_spi_readByteStreamExternal(gpHal_Address_t Address, UInt8 Length, UInt8* pBuffer); +int hal_spi_writeByteStreamExternal(gpHal_Address_t Address, UInt8 Length, const UInt8* pBuffer); +int hal_spi_readModifyWriteRegExternal(gpHal_Address_t Address, UInt8 mask, UInt8 Data); +#endif //GP_COMP_GPHAL + +/** @ingroup SPI + * + * This macro initializes the SPI port used to communicate with the communication controller. + * + * Configuration: + * - Microcontroller is the master, the communication controller is the slave. + * - Chip select pin is output on the microcontroller and active Low, so when initialized the chip select pin needs to be high. + * - The maximum clock speed the microcontroller can use to communicate with the comunication controller is 16 Mhz. + * - The SPI mode used to communicate is mode 3. This means sample the bit on rising edge, change value on falling edge. + * - No interrupts are used, the SPI protocol is implemented in a polled way. +*/ +#define HAL_SPI_START() + +/** @ingroup SPI + * This macro sets the chip select pin low. +*/ +#define HAL_SPI_SSN_LOW() +/** @ingroup SPI + * This macro sets the chip select pin high. +*/ +#define HAL_SPI_SSN_HIGH() + +/** @ingroup SPI + * This macro transmits 1 byte: x. + * If the microcontroller has an SPI harware block: + * - write the byte x to the communication controller using the tx buffer of the SPI block. + * - wait until the tx buffer is empty. + * If the microcontroller has no SPI hardware block the SPI communication needs to be implemented in software: + * - at startup the clock signal is low. + * - Set the MSB bit on the MOSI pin and pull up the clock line. + * - Pull donw the clock line. + * - Transmit the next bit using the same procedure as described above, do this 8 times to transmit the full byte + * + * @param x The byte that is transmitted, x is an unsigned 8 bit integer. +*/ +#if !defined(GP_COMP_CHIPEMU) +#define HAL_SPI_TX(x) +#else +UInt8 hal_msiHandleTx(UInt8 byte); +#define HAL_SPI_TX(x) hal_msiHandleTx(x) +#endif + +/** @ingroup SPI + * This macro is used to receives a byte and save it to x. + * + * If the microcontroller has an SPI harware block: + * - write a 0 to the communication controller to generate a clock signal. + * - wait until the SPI block is idle and read out the byte in the receive buffer and save this byte to x. + * If the microcontroller has no SPI hardware block the SPI communication needs to be implemented in software: + * - generate a clock signal on the clk line by driving the clock line from low to high. + * - After the clock signal goes from low to high read out the value of the MISO pin. + * - Pull down the clock signal. + * - Repeat the previous steps 8 times. Now 1 byte is read out. + * - The first bit read out is the MSB bit, the last bit is the LSB bit. + * + * @param x This byte returns the received value, x is an unsigned 8 bit integer. +*/ +#if !defined(GP_COMP_CHIPEMU) +#define HAL_SPI_RX(x) +#else +UInt8 hal_msiHandleRx(UInt8 byte); +#define HAL_SPI_RX(x) (x = hal_msiHandleRx(x)) +#endif + +/** @ingroup SPI + * This macro is used to power down the SPI block. + * + * All pins used for SPI should be set low. Default the chip select pin should be set low. + * Other pins could also need to be set low depending on the SPI block behavior + * +*/ +#define HAL_SPI_POWERDOWN() + +/** @ingroup SPI + * This macro is used to power up the SPI block. + * + * All pins used for SPI should be set to an active state. Default the chip select pin should be set high. + * Other pins could also need to be set depending on the SPI block behavior. + * +*/ +#define HAL_SPI_POWERUP() +/***************************************************************************** + * RADIO INTERRUPT + *****************************************************************************/ + +Bool hal_HandleRadioInterrupt(Bool execute); + +/** @ingroup RadioInterrupt Radio Interrupt + * This macro configures the interrupt line connecting the radio with the microcontroller. + * If the interruptCallback parameter is not NULL, the communication controller's interrupt is used to trigger in interrupt in the software. Implementation needs to be as described below. + * - Sets the interrupt sense control to falling edge or low level. + * - Registers the interrupt service routine: save the function that need to be called in a local variable. + * - Clears the pending interrupt flag and enables the interrupt. + * - The interrupt pin needs to be pulled-up by the microcontroller or en external circuit. + * + * If the interruptCallback parameter is NULL: the application will check the communication controller's interrupt line to see if an interrupt occured. Implementation needs to be as described below. + * - Set the pin connected to the interrupt of the communication controller to input and pull up the line. + * @param interruptCallback The parameter interruptCallback is the function that needs to be called if an interrupt from the communication controller occurs. +*/ + +#define HAL_RADIO_INTERRUPT_START(interruptCallback) + +/** @ingroup RadioInterrupt Radio Interrupt + * This macro returnes if the radio interrupt is enabled. If the radio interrupts are not used this macro needs to return true. +*/ +//Execution of ISR is done in sleep code with select() function +#define HAL_RADIO_INT_CHECK_IF_OCCURED() hal_HandleRadioInterrupt(false) +#define HAL_RADIO_INT_EXEC_IF_OCCURED() hal_HandleRadioInterrupt(true) + +/***************************************************************************** + * WAIT LOOP + *****************************************************************************/ + +#ifdef GP_COMP_UNIT_TEST +#define HAL_WAIT_US(timeout) \ + do \ + { \ + hal_GoToSleep(timeout); \ + } while(false) + +#define HAL_WAIT_MS(timeout) \ + do \ + { \ + hal_GoToSleep(timeout * 1000); \ + } while(false) +#else +#define HAL_WAIT_US(timeout) \ + do \ + { \ + struct timespec sleepTime; \ + sleepTime.tv_sec = (timeout) / 1000000; \ + sleepTime.tv_nsec = ((timeout) % 1000000) * 1000; \ + nanosleep(&sleepTime, NULL); \ + } while(false) + +#define HAL_WAIT_MS(timeout) \ + do \ + { \ + struct timespec sleepTime; \ + sleepTime.tv_sec = (timeout) / 1000; \ + sleepTime.tv_nsec = ((timeout) % 1000) * 1000000; \ + nanosleep(&sleepTime, NULL); \ + } while(false) +#endif //GP_COMP_UNIT_TEST + +/***************************************************************************** + * WAKEUP Pin + *****************************************************************************/ +void hal_Trigger_Wakeup(void); +/** @ingroup WakeUp + * This macro configures the wakeup pin. Puts the pin on digital output. +*/ +#define HAL_WKUP_START() + +/** @ingroup WakeUp + * This macro drives the wake up pin high. +*/ +#define HAL_SET_WKUP_ACTIVE() hal_Trigger_Wakeup() + +/** @ingroup WakeUp + * This macro drives the wake up pin low. +*/ +#define HAL_SET_WKUP_INACTIVE() + +/***************************************************************************** + * RESET Pin + *****************************************************************************/ + +void hal_Trigger_Reset(void); + +/** @ingroup Reset + * This macro drives the reset pin to the specified logical level. +*/ +#ifndef GP_COMP_CHIPEMU +#define HAL_SET_RESET_ACTIVE(level) hal_Trigger_Reset() +#else +#define HAL_SET_RESET_ACTIVE(level) hal_msiInit(level) +#endif //GP_COMP_CHIPEMU + +/** @ingroup Reset + * This macro configures the reset pin. Puts the pin on digital input to not interfere with default state of the reset line. + */ +#ifndef GP_COMP_CHIPEMU +#define HAL_SET_RESET_INACTIVE() +#else +#define HAL_SET_RESET_INACTIVE() hal_msiInit(1) +#endif //GP_COMP_CHIPEMU + +/** @ingroup Reset + * This macro returns the logic level of the reset pin. It is used to select the correct reset method. + */ +#define HAL_GET_RESET_LEVEL() 0 + +/***************************************************************************** + * Init Function + *****************************************************************************/ +void hal_Init(void); +void hal_DeInit(void); + +#define HAL_INIT() hal_Init() + +/***************************************************************************** + * GLOBAL interrupt Function + *****************************************************************************/ + +//Nested interrupt disabling mechanism only kept to keep checks in order throughout the code. +extern UInt8 l_n_atomic; + +/** @ingroup globalInterrupts + * This macro enables the global interrupts without incrementing the l_n_atomic counter. + * +*/ +#define HAL_FORCE_ENABLE_GLOBAL_INT() + +/** @ingroup globalInterrupts + * This macro disables the global interrupts without decrementing the l_n_atomic counter. + * +*/ +#define HAL_FORCE_DISABLE_GLOBAL_INT() + +#define HAL_INITIALIZE_GLOBAL_INT() \ + { \ + l_n_atomic = 1; \ + } + +/** @ingroup globalInterrupts + * This macro decrements the counter l_n_atomic. If l_n_atomic is 0 after the decrement the interrupts are enabled. + * +*/ + +#define HAL_ENABLE_GLOBAL_INT() \ + do \ + { \ + l_n_atomic--; \ + } while(false) + +/** @ingroup globalInterrupts + * This macro increments the counter l_n_atomic. If l_n_atomic is 1 after the increment the interrupts are disabled. + * +*/ +#define HAL_DISABLE_GLOBAL_INT() \ + do \ + { \ + l_n_atomic++; \ + } while(false) + +#define HAL_GLOBAL_INT_ENABLED() (l_n_atomic == 0) + +/***************************************************************************** + * Buttons + *****************************************************************************/ + +/** @ingroup Buttons + * This macro initializes the buttons. The pin(s) connected to the button(s) are configured as digital input. + * +*/ +#define HAL_BTN_INIT() + +/** @ingroup Buttons + * This macro reads out the value of button btn, possible values for btn are 1 or 2. + * The value is returned by using the construction BUTTON_##btn and by defining BUTTON_1 and BUTTON_2 as the pin which is read out. Where the value 1 means button pressed and 0 means button not pressed. + * If a pull-down circuit is used and a 0 means button pressed, the value needs to be inverted. + * + * @param btn The parameter btn is a unsigned 8 bit integer. The number of the used button is 1 or 2. +*/ +#define HAL_BTN_PRESSED(btn) false + +/***************************************************************************** + * Leds + *****************************************************************************/ + +/** @ingroup LEDS + * This macro initializes the leds. + * Led RED and led GRN are initialized in this macro. Leds are turned of at initialisation and the pins connected to the leds are put as digital output. + * +*/ + +#define HAL_LED_INIT() + +/** @ingroup LEDS + * This macro clears a led. Possible values for led are RED or GRN. + * This can be implemented by using the structure HAL_LED_CLR_##led() and by defining and implementing HAL_LED_CLR_GRN() and HAL_LED_CLR_RED(). + * @param led The parameter is RED or GRN. +*/ +#define HAL_LED_CLR(led) + +/** @ingroup LEDS + * This macro sets a led. Possible values for led are RED or GRN. + * This can be implemented by using the structure HAL_LED_SET_##led() and by defining and implementing HAL_LED_SET_GRN() and HAL_LED_SET_RED(). + * @param led The parameter is RED or GRN. +*/ +#define HAL_LED_SET(led) + +/** @ingroup LEDS + * This macro reads out the value of a led. Possible values for led are RED or GRN. + * This can be implemented by using the structure HAL_LED_TST_##led() and by defining and implementing HAL_LED_TST_GRN() and HAL_LED_TST_RED(). + * @param led The parameter is RED or GRN. +*/ +#define HAL_LED_TST(led) + +/** @ingroup LEDS + * This macro reads out the value of a led and inverts it. Possible values for led are RED or GRN. + * This can be implemented by using the structure HAL_LED_TGL_##led() and by defining and implementing HAL_LED_TGL_GRN() and HAL_LED_TGL_RED(). + * @param led The parameter is RED or GRN. +*/ +#define HAL_LED_TGL(led) + +/** @ingroup LEDS + * This macro initializes the leds. + * Led RED and led GRN are initialized in this macro. + * +*/ + +#define HAL_USERLED_INIT() + +/** @ingroup LEDS + * This macro clears a userled. Possible values for led are YEL or BLU. + * This can be implemented by using the structure HAL_USERLED_CLR_##led() and by defining and implementing HAL_USERLED_CLR_YEL() and HAL_USERLED_CLR_BLU(). + * @param led The parameter is BLU or YEL. +*/ +#define HAL_USERLED_CLR(led) + +/** @ingroup LEDS + * This macro sets a userled. Possible values for led are YEL or BLU. + * This can be implemented by using the structure HAL_USERLED_SET_##led() and by defining and implementing HAL_USERLED_SET_YEL() and HAL_USERLED_SET_BLU(). + * @param led The parameter is BLU or YEL. +*/ +#define HAL_USERLED_SET(led) + +/** @ingroup LEDS + * This macro reads out the value of a userled. Possible values for led are YEL or BLU. + * This can be implemented by using the structure HAL_USERLED_TST_##led() and by defining and implementing HAL_USERLED_TST_YEL() and HAL_USERLED_TST_BLU(). + * @param led The parameter is BLU or YEL. +*/ +#define HAL_USERLED_TST(led) + +/** @ingroup LEDS + * This macro reads out the value of a userled and inverts it. Possible values for led are YEL or BLU. + * This can be implemented by using the structure HAL_USERLED_TGL_##led() and by defining and implementing HAL_USERLED_TGL_YEL() and HAL_LED_USERTGL_BLU(). + * @param led The parameter is BLU or YEL. +*/ +#define HAL_USERLED_TGL(led) + +/***************************************************************************** + * RESET REASON + *****************************************************************************/ + +#define hal_ResetReason_Unspecified 0x0 +typedef UInt8 hal_ResetReason_t; + +#define HAL_GET_RESET_REASON() (hal_ResetReason_Unspecified) + +/***************************************************************************** + * UART + *****************************************************************************/ + +void hal_InitUART(hal_cbUartRx_t RxISR, hal_cbUartGetTxData_t TxISR); +void hal_TxUART(void); +void hal_RxUART(UInt8 id); +/* This implementation uses stdin and stdout*/ +#define HAL_UART_COM_START(cbUartRx, cbUartGetTxData) hal_InitUART(cbUartRx, cbUartGetTxData) +#define HAL_UART_COM_STOP() + +#define HAL_UART_COM_POWERDOWN() \ + do \ + { \ + hal_UartRxEnabled = false; \ + hal_UartTxEnabled = false; \ + } while(false) + +#define HAL_UART_COM_POWERUP() \ + do \ + { \ + hal_UartRxEnabled = true; \ + hal_UartTxEnabled = true; \ + } while(false) + +#define HAL_UART_COM_TX_NEW_DATA() hal_TxUART() +#define HAL_UART_COM_TX_ENABLED() (hal_UartTxEnabled) + +#define hal_UartPollRx() hal_RxUART(0) + +#define hal_UartPollTx() HAL_UART_COM_TX_NEW_DATA() + +#define HAL_UART_SCOM_START(cbUartRx, cbUartGetTxData) hal_InitUART(cbUartRx, cbUartGetTxData) +#define HAL_UART_SCOM_STOP() \ + do \ + { \ + GP_ASSERT_SYSTEM(false); /* not supported */ \ + } while(0) + +#define HAL_UART_SCOM_POWERDOWN() \ + do \ + { \ + hal_UartRxEnabled = false; \ + hal_UartTxEnabled = false; \ + } while(false) + +#define HAL_UART_SCOM_POWERUP() \ + do \ + { \ + hal_UartRxEnabled = true; \ + hal_UartTxEnabled = true; \ + } while(false) + +#define HAL_UART_SCOM_TX_NEW_DATA() hal_TxUART() + +/***************************************************************************** + * RESET UC + *****************************************************************************/ + +/** @ingroup ResetUC + * This macro resets the application. + * +*/ +#define HAL_RESET_UC() abort() //Stop application and produce core dump (if system supports it) +/***************************************************************************** + * SLEEP UC + *****************************************************************************/ +GP_API void hal_GoToSleep(UInt32 time); + +#define HAL_SLEEP_INDEFINITE_SLEEP_TIME 0xFFFFFFFF +#define HAL_SLEEP_MAX_SLEEP_TIME 0xFFFFFFFE + +#define HAL_DISABLE_SLEEP_UC() +#define HAL_ENABLE_SLEEP_UC() +#define HAL_SLEEP_UC_1US(time) hal_GoToSleep(time) + +/***************************************************************************** + * WATCHDOG + *****************************************************************************/ + +#define HAL_WDT_ENABLE(timeout) \ + do \ + { \ + } while(false) +#define HAL_WDT_DISABLE() \ + do \ + { \ + } while(false) +#define HAL_WDT_RESET() \ + do \ + { \ + } while(false) +#define HAL_WDT_FORCE_TRIGGER() \ + do \ + { \ + } while(false) + +/***************************************************************************** + * BACKTRACE STACK DUMP + *****************************************************************************/ + +void hal_dump_backtrace(UInt8 maxlevel); +void hal_install_exception_handlers(void); + +/***************************************************************************** + * HEAP DEBUG + *****************************************************************************/ + +/** @brief Returns heap usage information + * + * @return pInUse Currently allocated bytes on heap + * @return pReserved Memory + * @return pMax Maximum used heap. Will grow during operation, but will stay at that number. +*/ +void hal_GetHeapInUse(UInt32* pInUse, UInt32* pReserved, UInt32* pMax); + +/***************************************************************************** + * File descriptor/pipe registration + *****************************************************************************/ + +#define HAL_NR_OF_PIPE_HANDLES 10 +#define HAL_PIPE_INVALID_HANDLE 0xFF + +typedef UInt8 hal_pipeHandle_t; + +hal_pipeHandle_t hal_GetPipeHandle(hal_PollFunction_t pollFunction); +void hal_ReadFromPipe(hal_pipeHandle_t handle, UInt8* pData, UInt32 length); +void hal_WriteToPipe(hal_pipeHandle_t handle, UInt8* pData, UInt32 length); + +void hal_RegisterPollFunction(int fd, hal_PollFunction_t pollFunction); +void hal_UnRegisterPollFunction(int fd); + +void hal_SetPollFunction_write(int fd, hal_PollFunction_t pollFunction); + +Bool hal_HandleFds(Bool execute); + +/***************************************************************************** + * MUTEX + *****************************************************************************/ + +#define HAL_CRITICAL_SECTION_TYPE pthread_mutex_t +#define HAL_CRITICAL_SECTION_DEF(pMutex) pthread_mutex_t* pMutex; +#define HAL_CREATE_MUTEX(pMutex) hal_MutexCreate(pMutex) +#define HAL_DESTROY_MUTEX(pMutex) hal_MutexDestroy(pMutex) +#define HAL_ACQUIRE_MUTEX(mutex) hal_MutexAcquire(mutex) +#define HAL_RELEASE_MUTEX(mutex) hal_MutexRelease(mutex) +#define HAL_VALID_MUTEX(mutex) hal_MutexIsValid(mutex) +#define HAL_IS_MUTEX_ACQUIRED(mutex) hal_MutexIsAcquired(mutex) + +void hal_MutexAcquire(pthread_mutex_t *pMutex); +void hal_MutexRelease(pthread_mutex_t *pMutex); +void hal_MutexCreate(pthread_mutex_t **pMutex); +void hal_MutexDestroy(pthread_mutex_t **pMutex); +Bool hal_MutexIsValid(pthread_mutex_t *pMutex); +Bool hal_MutexIsAcquired(pthread_mutex_t *pMutex); + + +/***************************************************************************** + * ChipEmu and Unit/Stack tests + *****************************************************************************/ + +#ifdef GP_COMP_CHIPEMU +void hal_update_interrupt(void); +#endif //GP_COMP_CHIPEMU + +Bool hal_Select(UInt32 time, Bool Execute); +void hal_WakeEventloop(void); +void hal_ClearWakeUpEvent(void); + +#if defined(GP_COMP_CHIPEMU) +typedef void (*hal_cbFastForwardSleep_t)(UInt32 requestedSleepTime, UInt64* clockCounter); +void hal_RegisterFastForwardSleepCallback(hal_cbFastForwardSleep_t cbFFSleep); +#endif //defined(HAL_FASTFORWARD_FOR_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + +/***************************************************************************** + * Random + *****************************************************************************/ +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //_HAL_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal_Extension.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal_Extension.h new file mode 100644 index 0000000..4fca34a --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc/hal_Extension.h @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal_Extension.h + * Hardware Abstraction Layer for linux based devices. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_EXTENSION_H_ +#define _HAL_EXTENSION_H_ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define HAVE_LOCALTIME + +//Chip access macro's +#define HAL_ACCESS_CHIP(command, pValue) ioctl(fdGP, command, pValue) + +#define HAL_TIMER_RESTART() + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef Int16 (* hal_cbUartGetTxData_t) (void); +#if defined(HAL_DIVERSITY_UART_RX_BUFFER_CALLBACK) +typedef void (* hal_cbUartRx_t)(UInt8 *buffer, UInt16 size); +#else +typedef void (* hal_cbUartRx_t) (Int16); +#endif +typedef void (* hal_cbUartTxReady_t) (void); +typedef Bool (* hal_cbUartTxPending_t) (void); + +typedef void (*hal_PollFunction_t)(UInt8); +typedef void (*hal_RadioFunction_t)(void); + +typedef void (*hal_cbSocketRx_t)(UInt16, const char*, UInt32 socketId); +typedef void (*hal_cbSocketClose_t)(UInt32 socketId); + +/***************************************************************************** + * Public Data Definitions + *****************************************************************************/ +extern Bool hal_UartRxEnabled; +extern Bool hal_UartTxEnabled; +extern int fdGP; +/***************************************************************************** + * Internal Function Definitions + *****************************************************************************/ + +void hal_InitSocket(hal_cbSocketRx_t RxISR, hal_cbSocketClose_t closeCb); +void hal_DeInitSocket(void); + +int hal_TxDataSocket(UInt16 length, UInt8 *pData, UInt32 socketId); + +void hal_RegisterGPPollFunction(hal_RadioFunction_t pollFunction); + + +#ifdef GP_COMP_CHIPEMU +void hal_msiInit(UInt8 not_in_reset); +UInt8 hal_msiHandleTx(UInt8 byte); +UInt8 hal_msiHandleRx(UInt8 byte); + +void hal_update_interrupt(void); +#endif //GP_COMP_CHIPEMU + +UInt32 hal_getSecondsSinceEpoch(void); + +/** @brief Return the current real time in microseconds since the Unix epoch. + * + * This function returns the real time as reported by the operating system. + * The time is represented as the number of microseconds elapsed + * since 1970-01-01 00:00:00 UTC (excluding leap seconds). + */ +UInt64 hal_GetMicrosecondsSinceEpoch(void); + +#define __DSB() +#endif //_HAL_EXTENSION_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c new file mode 100644 index 0000000..a0d6ed5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Heap.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/** @file "hal_Heap.c" + * + * Heap analysis functionality +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +//#define DEBUG + +#include "hal.h" +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +/***************************************************************************** + * Public Function Implementations + *****************************************************************************/ + +void hal_GetHeapInUse(UInt32* pInUse, UInt32* pReserved, UInt32* pMax) +{ + //No Heap + *pInUse = 0x0; + *pReserved = 0x0; + *pMax = 0x0; +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c new file mode 100644 index 0000000..ce1ac00 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_Sched.c @@ -0,0 +1,453 @@ +/* + * Copyright (c) 2010, 2012-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal_Sched.c + * Linux-specific implementation of event polling and event waiting. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +//#define GP_LOCAL_LOG +#include "hal.h" +#include "hal_defs.h" +#include "gpAssert.h" +#ifdef GP_COMP_CHIPEMU +#include "gpChipEmu.h" +#ifdef GP_COMP_GPHAL +#include "gpHal.h" +#endif //GP_COMP_GPHAL +#endif //GP_COMP_CHIPEMU + +#include +#include + +#include "gpLog.h" +#include +#include + +#include +#include +#include + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX +#define HAL_NUM_OF_FD 40 +#define HAL_INVALID_FD -1 +#define EVENTFD_INITIAL_VALUE_ZERO 0 +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct{ + Bool valid; + int fd; + hal_PollFunction_t pollFunction; + hal_PollFunction_t pollFunction_write; +} hal_PollFunctionInfo_t; + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static int hal_nfds = 0; +static hal_PollFunctionInfo_t hal_PollFunctionInfo[HAL_NUM_OF_FD]; +static int hal_EventFd = -1; + + +#if defined(GP_COMP_CHIPEMU) +static hal_cbFastForwardSleep_t hal_cbFastForwardSleep; +#endif //defined(HAL_FASTFORWARD_FOR_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + +/***************************************************************************** + * Static Function Declarations + *****************************************************************************/ + +#if defined(GP_COMP_CHIPEMU) +void hal_FastForwardSleep(UInt32 requestedSleepTime, UInt64* clockCounter); +#endif //defined(HAL_FASTFORWARD_FOR_UNIT_TEST) || defined(GP_COMP_CHIPEMU) +static void hal_EventFdInit(void); +static void hal_EventFdDeInit(void); +static void hal_EventFdHandler(UInt8 x); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void halSched_Init(void) +{ + UIntLoop i; + + if (hal_nfds != 0) + { + // Allow re-init of hal without resetting registered file descriptors. + return; + } + + + hal_nfds = 0; + MEMSET(hal_PollFunctionInfo, 0, sizeof(hal_PollFunctionInfo_t) * HAL_NUM_OF_FD); + for(i = 0; i < HAL_NUM_OF_FD; i++) + { + hal_PollFunctionInfo[i].valid = false; + hal_PollFunctionInfo[i].fd = HAL_INVALID_FD; + } + #if defined(GP_COMP_CHIPEMU) + hal_cbFastForwardSleep = hal_FastForwardSleep; + #endif //defined(HAL_FASTFORWARD_FOR_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + + hal_EventFdInit(); + +} + +void halSched_DeInit(void) +{ + hal_EventFdDeInit(); + + // Clear poll function table. + hal_nfds = 0; + memset(hal_PollFunctionInfo, 0, sizeof(hal_PollFunctionInfo_t) * HAL_NUM_OF_FD); +} + +void hal_RegisterPollFunction(int fd, hal_PollFunction_t pollFunction) +{ + UIntLoop i; + Bool added = false; + + //Check re-add first + for(i=0; i < HAL_NUM_OF_FD; i++) + { + if(hal_PollFunctionInfo[i].fd == fd && hal_PollFunctionInfo[i].valid) + { + hal_PollFunctionInfo[i].pollFunction = pollFunction; + added = true; + break; + } + } + + if(!added) + { + for(i=0; i < HAL_NUM_OF_FD; i++) + { + if(!hal_PollFunctionInfo[i].valid) + { + hal_PollFunctionInfo[i].valid = true; + hal_PollFunctionInfo[i].fd = fd; + hal_PollFunctionInfo[i].pollFunction = pollFunction; + if(fd >= hal_nfds) + { + hal_nfds = fd +1; + } + added = true; + break; + } + } + } + GP_ASSERT_SYSTEM(added); +} + +void hal_UnRegisterPollFunction(int fd) +{ + UIntLoop i; + int new_nfds = 0; + + for(i = 0; i < HAL_NUM_OF_FD; i++) + { + if(hal_PollFunctionInfo[i].valid) + { + if (hal_PollFunctionInfo[i].fd == fd) + { + //Invalidate all info for this fd + hal_PollFunctionInfo[i].valid = false; + hal_PollFunctionInfo[i].fd = HAL_INVALID_FD; + hal_PollFunctionInfo[i].pollFunction = NULL; + hal_PollFunctionInfo[i].pollFunction_write = NULL; + } + else + { + //Re-calculate nfds over remaining fds + new_nfds = max(new_nfds, hal_PollFunctionInfo[i].fd); + } + } + } + hal_nfds = new_nfds+1; +} + +Bool hal_Select(UInt32 time, Bool Execute) +{ + Bool ready = false; + UInt32 time_us = time; + + fd_set readfds, writefds; + UInt16 i; /* the number of nfds can be larger than + 255 in some linux based middleware applications */ + struct timeval tv; + int retval; + + FD_ZERO(&readfds); + FD_ZERO(&writefds); + for(i=0;i +#include + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +//Legacy system time resolution = 32 us +#define HAL_TIME_RES_ORDER 5 + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ +#if defined(GP_COMP_CHIPEMU) +UInt64 hal_ClockCounter; +#endif //GP_COMP_UNIT_TEST + +/** + * Return 1us resolution time in 64-bit +*/ +#if defined(GP_COMP_CHIPEMU) +UInt64 halTimer_GetCurrentTime_1us_64bit(void) +{ + return hal_ClockCounter; +} +#else +UInt64 halTimer_GetCurrentTime_1us_64bit(void) +{ + UInt64 timestampUs; + struct timespec tp; + + // use monotonic clock to be robust against system time changes + clock_gettime(CLOCK_MONOTONIC, &tp); + + timestampUs = (UInt64)tp.tv_nsec/1000 + ((UInt64)tp.tv_sec * 1000000); + + return timestampUs; +} +#endif //defined(GP_COMP_UNIT_TEST) && !defined(GP_HAL_DIVERSITY_USE_SELECT) && !defined(HAL_DIVERSITY_USE_LIBEV)&& !defined(GP_UNITTEST_DIVERSITY_NO_FASTFORWARD) + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +/* + * Timers + */ + +#if defined(GP_COMP_CHIPEMU) +void hal_StartTimer(void) +{ + hal_ClockCounter = 0; +} +#endif //GP_COMP_UNIT_TEST + +/** + * Return 32us resolution time in full 32-bit. +*/ +UInt32 hal_GetCurrentTime(void) +{ + return (UInt32)(halTimer_GetCurrentTime_1us_64bit() >> HAL_TIME_RES_ORDER); +} + +/** + * Return 1us resolution time in full 32-bit +*/ +UInt32 hal_GetCurrentTime_1us(void) +{ + return (UInt32)halTimer_GetCurrentTime_1us_64bit(); +} + +/** + * Return the current real time in seconds since the Unix epoch. +*/ +UInt32 hal_getSecondsSinceEpoch(void) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + return tv.tv_sec; +} + +/** + * Return the current real time in microseconds since the Unix epoch. +*/ +UInt64 hal_GetMicrosecondsSinceEpoch(void) +{ + struct timeval tv; + gettimeofday(&tv, NULL); + return ((UInt64)tv.tv_sec) * 1000000 + tv.tv_usec; +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c new file mode 100644 index 0000000..cc23b41 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_UART.c @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal_UART.c + * Hardware Abstraction Layer for stdin/stdout as UART on Linux. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "hal.h" +#include "hal_defs.h" +#include +#include "termios.h" + +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static hal_cbUartRx_t cbUartRx = NULL; +static hal_cbUartGetTxData_t cbUartGetTxData = NULL; +Bool hal_UartRxEnabled; +Bool hal_UartTxEnabled; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +void hal_InitUART( hal_cbUartRx_t RxISR, hal_cbUartGetTxData_t TxISR ) +{ + /* register RX and TX isr */ + cbUartRx = RxISR; + cbUartGetTxData = TxISR; + + hal_UartRxEnabled = false; + hal_UartTxEnabled = true; + + printf("_____%s",__FUNCTION__); + if(RxISR != NULL) + { + int res; + struct termios newT; + + res = tcgetattr(fileno(stdin), &newT); + if(res == 0) + { + hal_UartRxEnabled = true; + hal_RegisterPollFunction(fileno(stdin),hal_RxUART); + newT.c_lflag &= (~ICANON); //one char @ a time + newT.c_cc[VTIME] = 1; + newT.c_cc[VMIN] = 1; //generate interrupt when at least 1 char is received + + tcsetattr(fileno(stdin), TCSANOW, &newT); + } + } +} + +void hal_TxUART(void) +{ + if(hal_UartTxEnabled && cbUartGetTxData) + { + while(true) + { + Int16 sendData; + sendData = cbUartGetTxData(); + if(sendData != -1) + { + putchar((sendData)); + fflush(stdout); + } + else + { + break; + } + } + } +} +void hal_RxUART(UInt8 id) +{ + NOT_USED(id); + if(hal_UartRxEnabled) + { + int receiveData; + + receiveData = getchar(); + if(receiveData != EOF) + { + +#if defined(HAL_DIVERSITY_UART_RX_BUFFER_CALLBACK) + cbUartRx((UInt8*)&receiveData,1); +#else + cbUartRx(receiveData); +#endif + } + } +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c new file mode 100644 index 0000000..5dfede6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_backtrace.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal.c + * Hardware Abstraction Layer for linux based devices, in combination with gp kernel driver + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "hal.h" +#include "hal_defs.h" +#include "gpBsp.h" +#include "gpAssert.h" +#include "gpLog.h" + +#include // for getting the stack trace after assert +#include // signal handlers defs. +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void hal_dump_backtrace(UInt8 maxlevel) +{ + // + // use compiler options: + // OPT = -rdynamic -funwind-tables + // + #define MAX_STACK_TRACE 16 + void* stacktrace[MAX_STACK_TRACE]; + UInt8 stacksize; + char** stacknames; + NOT_USED(maxlevel); + + stacksize = backtrace(stacktrace, MAX_STACK_TRACE); + GP_LOG_SYSTEM_PRINTF("stacktrace size=%d",0,stacksize); + stacknames = backtrace_symbols(stacktrace, stacksize); + if(stacksize>1) + { + UInt8 stackindex; + for(stackindex=1; stackindexsi_addr); + GP_ASSERT_DEV_INT(false); +} + +void hal_install_exception_handlers(void) +{ + struct sigaction sa; + sa.sa_sigaction = handler; + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART | SA_SIGINFO; + + sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGFPE , &sa, NULL); + sigaction(SIGBUS , &sa, NULL); + sigaction(SIGILL , &sa, NULL); + sigaction(SIGABRT, &sa, NULL); +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_defs.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_defs.h new file mode 100644 index 0000000..6658a31 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_defs.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2010, 2013-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal_defs.h + * Hardware Abstraction Layer for linux based devices. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "hal.h" +#include + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ +typedef enum +{ + halSocket_state_idle, + halSocket_state_active, + halSocket_state_exited +} halSocket_state_t; + +typedef struct +{ + UInt32 socketId; + halSocket_state_t state; + Bool isClient; + struct sockaddr addr; + pthread_t rfReadThread; +} halSocket_t; + +/***************************************************************************** + * Public Data Declarations + *****************************************************************************/ +#if defined(GP_COMP_CHIPEMU) +extern UInt64 hal_ClockCounter; +#endif //GP_COMP_UNIT_TEST + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void halSched_Init(void); +void halSched_DeInit(void); + + void halSocket_RegisterPollFunction(int fd); + void* halSocket_readThread(void *pClientSocketId); + int hal_GetServerSocket(halSocket_t* socketInfo, char* host, int port); + int halSocket_ListenForClients(char *path, int port); + +int halUART_SetNonSpecialBaudRate(int fd, UInt32 baudrate); diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c new file mode 100644 index 0000000..8e35b4c --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/src/hal_noradio.c @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2010, 2012-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * hal.c + * Hardware Abstraction Layer for linux based devices. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "hal.h" +#include "hal_defs.h" +#include "gpBsp.h" +#include "gpAssert.h" +#ifdef GP_COMP_CHIPEMU +#include "gpChipEmu.h" +#ifdef GP_COMP_GPHAL +#include "gpHal.h" +#endif //GP_COMP_GPHAL +#endif //GP_COMP_CHIPEMU + +#include +#include +#include "gpLog.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_HALLINUX + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Data Definitions + *****************************************************************************/ +UInt8 l_n_atomic; + +#ifdef GP_COMP_CHIPEMU +Bool bsp_linux_int; +hal_RadioFunction_t gphal_cb; +#endif + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void hal_Init (void) +{ + setlinebuf(stdout); + setlinebuf(stderr); + + halSched_Init(); + + HAL_LED_INIT(); + HAL_BTN_INIT(); + gpBsp_init(); + hal_install_exception_handlers(); + +#if defined(GP_COMP_GPHAL) && defined(GP_COMP_CHIPEMU) +//For emulation testing + HAL_GP_HW_INIT(); +#ifdef GP_COMP_GPHAL + gpHal_Reset(); +#endif +#endif //defined(GP_COMP_GPHAL) && defined(GP_COMP_CHIPEMU) +} + +void hal_DeInit(void) +{ + halSched_DeInit(); +} + +void hal_Trigger_Wakeup(void) +{ +#ifdef GP_COMP_CHIPEMU + gpChipEmu_WakeUp_External(); +#endif //GP_COMP_CHIPEMU +} + +Bool hal_HandleRadioInterrupt(Bool execute) +{ +#ifdef GP_COMP_CHIPEMU + if (bsp_linux_int) + { + if(execute && (NULL != gphal_cb)) + { + gphal_cb(); + bsp_linux_int = false; + } + return true; + } +#else + NOT_USED(execute); +#endif + return false; +} + +#ifdef GP_COMP_CHIPEMU +void hal_RegisterGPPollFunction(hal_RadioFunction_t pollFunction) +{ + gphal_cb = pollFunction; +} + +void hal_update_interrupt(void) +{ + UInt8 interrupt = gpChipEmu_GetInterruptPin(); + bsp_linux_int = !!interrupt; +} +#endif //GP_COMP_CHIPEMU diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708/compiler.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708/compiler.h new file mode 100644 index 0000000..75d679c --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/inc/compiler/RPi_BCM2708/compiler.h @@ -0,0 +1,24 @@ +#ifndef _COMPILER_H_ +#define _COMPILER_H_ + +#include +#include +#include + +//compiler specific stuff +#define INLINE +#define PACKED_PRE +#define PACKED_POST __attribute__((packed)) +#define ALIGNMENT_NEEDED + +#define COMPILER_ALIGNED(a) __attribute__((__aligned__(a))) + +//#define HAVE_NO_64BIT + +#define NORETURN + +//Pointer type, use this type to perform pointer arithmetic +typedef uintptr_t UIntPtr; +typedef UIntPtr UIntPtr_P; + +#endif //_COMPILER_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/inc/global.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/inc/global.h new file mode 100644 index 0000000..bc3735e --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/inc/global.h @@ -0,0 +1,742 @@ +/* + * Copyright (c) 2005-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * global.h + * This file contains the global typedefs and defines. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * $Header$ + * $Change$ + * $DateTime$ + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + */ + +#ifndef _GLOBAL_H_ +#define _GLOBAL_H_ + +#include "compiler.h" + +/***************************************************************************** + * Compile time verification + *****************************************************************************/ + +/** Check a conditon at compile time. + * this macro will produce a compile error if the condition x is false + * the error might be strange however, + * the error will be that the size of the array is negative, which is illegal in C. + * You can use it both as a statement and an expression, but not at file level. + * if used with a condition that is not compile-time-constant, it will pass + */ +#ifndef COMPILE_TIME_ASSERT +#define COMPILE_TIME_ASSERT(x) ((void) sizeof(int[1-2*((x) ? 0 : 1)])) +#endif + +//auxiliary macro +#define GP_COMPILE_TIME_VERIFY_TRUE(R) (!!sizeof(struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) + +/** Check a conditon at compile time. + * this macro will produce a compile error if the condition x is false + * it is an alternative for COMPILE_TIME_ASSERT: + * it is usable at file level, whereas COMPILE_TIME_ASSERT is not + * COMPILE_TIME_ASSERT is usable as expression (inside macros that return a value), GP_COMPILE_TIME_VERIFY is not. + * if used with a condition that is not compile-time-constant, it will fail + */ +#ifndef __cplusplus +#define GP_COMPILE_TIME_VERIFY(R) extern int (* gp_verify_function__ (void)) [GP_COMPILE_TIME_VERIFY_TRUE (R)] +#else +#define GP_COMPILE_TIME_VERIFY(R) typedef char gp_verify_function__ [ (R) ? 1 : -1 ] +#endif + +/***************************************************************************** + * Common data types + *****************************************************************************/ + +typedef uint8_t Bool; +typedef char Char; + +typedef uint8_t UInt8; +typedef uint16_t UInt16; +typedef uint32_t UInt24; +typedef uint32_t UInt32; +typedef uint_fast8_t UIntLoop; +typedef uint8_t UInt8Buffer; + +typedef int8_t Int8; +typedef int16_t Int16; +typedef int32_t Int24; +typedef int32_t Int32; +typedef int_fast8_t IntLoop; + +typedef uint8_t Byte; + +typedef UInt8 UQ2_6; +typedef UInt16 UQ2_14; +typedef UInt16 UQ8_8; +typedef Int16 Q8_8; +typedef Int8 Q1_7; +typedef Int16 Q1_15; +typedef Int32 Q1_31; +typedef Int32 Q24_8; /* 8 decimal places */ +typedef Int32 Q8_24; /* 24 decimal places */ + +#define MILLIVOLT_TO_UQ2_14(mv) ( (UQ2_14) ((((UInt32)mv)<<14)/1000) ) + +#ifndef HAVE_NO_64BIT +typedef uint64_t UInt64; +typedef int64_t Int64; +#endif + +GP_COMPILE_TIME_VERIFY(sizeof(Char)==1); +GP_COMPILE_TIME_VERIFY(sizeof(UInt8)==1); +GP_COMPILE_TIME_VERIFY(sizeof(UInt16)==2); +GP_COMPILE_TIME_VERIFY(sizeof(UInt32)==4); + +//not all hosts have a UInt64, let's simulate one, including endianness +typedef struct UInt64Struct +{ +#ifndef GP_BIG_ENDIAN + //normal case, little endian + UInt32 LSB; + UInt32 MSB; +#else //GP_BIG_ENDIAN + UInt32 MSB; + UInt32 LSB; +#endif +} UInt64Struct_t; +typedef UInt64Struct_t MACAddress_t; + +#ifdef GP_BIG_ENDIAN +#define MACADDRESS_INITIALIZER(msb, lsb) { (msb), (lsb) } +#else +#define MACADDRESS_INITIALIZER(msb, lsb) { (lsb), (msb) } +#endif + +// Bluetooth device address (6 bytes) +typedef PACKED_PRE struct +{ + UInt8 addr[6]; +} PACKED_POST BtDeviceAddress_t; + +GP_COMPILE_TIME_VERIFY(sizeof(BtDeviceAddress_t) == 6); + + +//Define UIntPtr and UIntPtr_P in compiler.h + +#ifndef __cplusplus +#ifndef false +#define false ((Bool) 0) +#endif +#ifndef true +#define true ((Bool) !false) +#endif +#endif + +#include + +#define GP_API extern + +typedef void (* void_func) (void); + +/***************************************************************************** + * Helper macros + *****************************************************************************/ +#if !defined(__KERNEL__) && !defined(__cplusplus) +#ifndef min +#define min(a,b) ((b) < (a) ? (b) : (a)) +#endif +#ifndef max +#define max(a,b) ((a) < (b) ? (b) : (a)) +#endif +#ifndef clamp +#define clamp(val,a,b) (min(max(val, a), b)) +#endif +#endif // __KERNEL__ && !__cplusplus + +#ifndef dist +#define dist(a,b) ((a) < (b) ? ((b) - (a)) : ((a) - (b))) +#endif +#ifndef div_ceil +#define div_ceil(nr,div) ( nr>=0 ? (((nr)+((div)-1))/(div)) : (((nr)+(0 ))/(div)) ) +#endif +#ifndef div_round +#define div_round(nr,div) ( nr>=0 ? (((nr)+((div)/2))/(div)) : (((nr)-((div)/2))/(div)) ) +#endif +#ifndef div_floor +#define div_floor(nr,div) ( nr>=0 ? (((nr)+(0 ))/(div)) : (((nr)-((div)-1))/(div)) ) +#endif +#ifndef udiv_ceil +#define udiv_ceil(nr,div) (((nr)+((div)-1))/(div)) +#endif +#ifndef udiv_round +#define udiv_round(nr,div) (((nr)+((div)/2))/(div)) +#endif +#ifndef udiv_floor +#define udiv_floor(nr,div) (((nr)+(0 ))/(div)) +#endif + +// Useful stuff +#define BM(n) (1 << (n)) +#define BM64(n) (1ULL << (n)) +#define BF(x,b,s) (((x) & (b)) >> (s)) + +#define BIT_SET(p,b) do{ p|=BM(b); }while(false) +#define BIT_CLR(p,b) do{ p&=~BM(b); }while(false) +#define BIT_TST(p,b) (!!(p & BM(b))) +#define BIT_SET64(p,b) do{ p|=BM64(b); }while(false) +#define BIT_CLR64(p,b) do{ p&=~BM64(b); }while(false) +#define BIT_TST64(p,b) (!!(p & BM64(b))) + +#define number_of_elements(arr) (sizeof (arr) / sizeof (*(arr))) + +#define MS_TO_US(msec) ((UInt32)(msec)*1000UL) +#define US_TO_MS(usec) (UInt16)(usec/1000UL) +#define ABS(a) (((a) < 0) ? (-(a)) : (a)) +/***************************************************************************** + * Fixed point + * conversion macro's + *****************************************************************************/ + +#define UQ_PRECISION_DECR8(v) ((UInt8)(((v)+0x80)>>8)) +#define UQ_PRECISION_INCR8(v) (((UInt16)((v)))<<8) + +#define Q_PRECISION_DECR8(v) (((v) < 0) ? (Int8)(((v)-0x80)>>8) : (Int8)(((v)+0x80)>>8)) +#define Q_PRECISION_INCR8(v) (((Int16)(v))<<8) + +/***************************************************************************** + * Endianness + * you should define GP_BIG_ENDIAN in compiler.h if it's a big endian uc + * nothing to define for little endian + *****************************************************************************/ + +#ifndef GP_HAVE_SWAP_UINT16 +#define GP_SWAP_UINT16_CONVERSION(Data) ((Data) & 0xFF) << 8 | (((Data) >> 8) & 0xFF) +#endif +#ifndef GP_HAVE_SWAP_UINT32 +#define GP_SWAP_UINT32_CONVERSION(Data) ((Data) & 0xFF) << 24 | ((((Data) >> 8) & 0xFF) << 16) | ((((Data) >> 16) & 0xFF) << 8) | ((((Data) >> 24) & 0xFF)) +#endif +#ifndef GP_HAVE_SWAP_UINT16 +#define GP_SWAP_UINT16(pData) (*(UInt16*)pData) = GP_SWAP_UINT16_CONVERSION(*(UInt16*)(pData)) +#endif +#ifndef GP_HAVE_SWAP_UINT32 +#define GP_SWAP_UINT32(pData) (*(UInt32*)pData) = GP_SWAP_UINT32_CONVERSION(*(UInt32*)(pData)) +#endif +#ifndef GP_HAVE_SWAP_UINT64 +#define GP_SWAP_UINT64(pData) \ +do { \ + UInt8 tmp,i; \ + for (i=0; i < 4; i++) \ + { \ + tmp = ((UInt8*)(pData))[i]; \ + ((UInt8*)(pData))[i] = ((UInt8*)(pData))[7-i]; \ + ((UInt8*)(pData))[7-i] = tmp; \ + } \ + } while(false) + #endif + +#define HOST_TO_LITTLE_UINT8(pData) +#ifdef GP_BIG_ENDIAN +#define HOST_TO_LITTLE_UINT16_CONVERSION(Data) GP_SWAP_UINT16_CONVERSION(Data) +#define HOST_TO_LITTLE_UINT32_CONVERSION(Data) GP_SWAP_UINT32_CONVERSION(Data) +#define HOST_TO_LITTLE_UINT16(pData) GP_SWAP_UINT16(pData) +#define HOST_TO_LITTLE_UINT32(pData) GP_SWAP_UINT32(pData) +#define HOST_TO_LITTLE_UINT64(pData) GP_SWAP_UINT64(pData) +#define HOST_TO_LITTLE_ENUM(pData) /* enumeration is 1 byte wide */ +#else +#define HOST_TO_LITTLE_UINT16_CONVERSION(Data) (Data) +#define HOST_TO_LITTLE_UINT32_CONVERSION(Data) (Data) +#define HOST_TO_LITTLE_UINT16(pData) +#define HOST_TO_LITTLE_UINT32(pData) +#define HOST_TO_LITTLE_UINT64(pData) +#define HOST_TO_LITTLE_ENUM(pData) +#endif + +#define HOST_TO_BIG_UINT8(pData) +#ifdef GP_BIG_ENDIAN +#define HOST_TO_BIG_UINT16(pData) +#define HOST_TO_BIG_UINT32(pData) +#define HOST_TO_BIG_UINT64(pData) +#define HOST_TO_BIG_ENUM(pData) +#else +#define HOST_TO_BIG_UINT16(pData) GP_SWAP_UINT16(pData) +#define HOST_TO_BIG_UINT32(pData) GP_SWAP_UINT32(pData) +#define HOST_TO_BIG_UINT64(pData) GP_SWAP_UINT64(pData) +#define HOST_TO_BIG_ENUM(pData) /* enumeration is 1 byte wide */ +#endif + +//Inverse macros - equal to conversion macros +#define BIG_TO_HOST_UINT8(pData) +#define BIG_TO_HOST_UINT16(pData) HOST_TO_BIG_UINT16(pData) +#define BIG_TO_HOST_UINT32(pData) HOST_TO_BIG_UINT32(pData) +#define BIG_TO_HOST_UINT64(pData) HOST_TO_BIG_UINT64(pData) +#define BIG_TO_HOST_ENUM(pData) HOST_TO_BIG_ENUM(pData) + +#define LITTLE_TO_HOST_UINT8(pData) +#define LITTLE_TO_HOST_UINT16(pData) HOST_TO_LITTLE_UINT16(pData) +#define LITTLE_TO_HOST_UINT32(pData) HOST_TO_LITTLE_UINT32(pData) +#define LITTLE_TO_HOST_UINT64(pData) HOST_TO_LITTLE_UINT64(pData) +#define LITTLE_TO_HOST_ENUM(pData) HOST_TO_LITTLE_ENUM(pData) + +// To RF = To little endian +#define HOST_TO_RF_UINT8(pData) +#define HOST_TO_RF_UINT16_CONVERSION(Data) HOST_TO_LITTLE_UINT16_CONVERSION(Data) +#define HOST_TO_RF_UINT32_CONVERSION(Data) HOST_TO_LITTLE_UINT32_CONVERSION(Data) +#define HOST_TO_RF_UINT16(pData) HOST_TO_LITTLE_UINT16(pData) +#define HOST_TO_RF_UINT32(pData) HOST_TO_LITTLE_UINT32(pData) +#define HOST_TO_RF_UINT64(pData) HOST_TO_LITTLE_UINT64(pData) +#define HOST_TO_RF_ENUM(pData) HOST_TO_LITTLE_ENUM(pData) + +//Conversion from RF to host = Conversion from host to RF +#define RF_TO_HOST_UINT8(pData) +#define RF_TO_HOST_UINT16(pData) HOST_TO_RF_UINT16(pData) +#define RF_TO_HOST_UINT32(pData) HOST_TO_RF_UINT32(pData) +#define RF_TO_HOST_UINT64(pData) HOST_TO_RF_UINT64(pData) +#define RF_TO_HOST_ENUM(pData) HOST_TO_RF_ENUM(pData) + + +/***************************************************************************** + * String functions. + * you need to define these if the clib version is not suitable + * see c library for prototypes. + * a reason to define these macros is if the C compiler has "original" ideas about problematic casts and issues warnings for perfectly legal code. + *****************************************************************************/ +#ifndef MEMCPY +#define MEMCPY(dst, src, len) memcpy(dst, src, len) +#endif +#ifndef MEMCMP +#define MEMCMP(p1, p2, len) memcmp(p1, p2, len) +#endif +#ifndef MEMSET +#define MEMSET(dst, value, len) memset (dst, value, len) +#endif +#ifndef STRNCPY +#define STRNCPY(dst, src, len) strncpy (dst, src, len) +#endif +#ifndef STRNCMP +#define STRNCMP(p1, p2, len) strncmp(p1, p2, len) +#endif +#ifndef STRLEN +#define STRLEN(s) strlen(s) +#endif + +#define MEMCPY_INPLACE(dest, source, length) \ +{ \ + UInt16 index; \ + if(dest > source) /* shift to the right */ \ + { \ + for(index = length - 1; index <=0 ; index--) \ + { \ + (((UInt8*)dest)[index]) = (((UInt8*)source)[index]); \ + } \ + } \ + else if(source > dest) /* shift to the left */ \ + { \ + for(index = 0; index < length; index++) \ + { \ + (((UInt8*)dest)[index]) = (((UInt8*)source)[index]); \ + } \ + } \ +} + +/* + * const data in flash + * + * this define should be set in compiler.h, if the flash/rom/otp is in a different address space. + * in that case all the macros below should also be defined + * the documentation can be found below + */ +#ifndef GP_FLASH_PTR_IS_NO_ORDINARY_PTR + +/* + * a variable in flash is declared as + * const mytype ROM myvar FLASH_PROGMEM; + * most compilers that have special flash pointers need only to define one of these two keywords, the other can be left empty. + */ +#define ROM +#define FLASH_PROGMEM + +/* + * Keyword to indicate a symbol is weak +*/ +#ifndef WEAK +#define WEAK +#endif + +/** + * read one byte from flash. Argument is flash address * + */ +#ifndef PGM_READ_BYTE +#define PGM_READ_BYTE(address) (*(address)) +#endif //PGM_READ_BYTE +/** + * read 2 bytes from flash. Argument is a flash address * + */ +#ifndef PGM_READ_WORD +#define PGM_READ_WORD(address) (*(address)) +#endif //PGM_READ_WORD + +/** functions that work with a flash string as second argument instead of a normal string */ +#define MEMCPY_P(ptr,pprogmem,size) MEMCPY(ptr,(const void *)(pprogmem), size) +#define MEMCMP_P(ptr,pprogmem,size) MEMCMP(ptr,(const void *)(pprogmem), size) +#define STRNCPY_P(pchar,pprogmem,len) STRNCPY(pchar,(const void *)(pprogmem), len) +#define STRNCMP_P(ptr,pprogmem,size) STRNCMP(ptr,(const void *)(pprogmem),size) +#define STRLEN_P(pprogmem) STRLEN((const void *)(pprogmem)) + +/* + * the argument s is a literal string. + * example of usage: printf(GEN_STR2FLASH("iteration %u"), n); + * the macro should make sure the literal string ends up in flash + * this is rarely needed (atmel only) + */ +#define GEN_STR2FLASH(s) (s) +#endif //GP_FLASH_PTR_IS_NO_ORDINARY_PTR + +typedef const Char ROM gp_flash_char FLASH_PROGMEM; +#define FLASH_STRING gp_flash_char * + +/***************************************************************************** + * Preprocesser macros + *****************************************************************************/ + +//Convert defines into strings +#define XSTRINGIFY(s) STRINGIFY(s) +#define STRINGIFY(s) #s + +#if defined(__GNUC__) +//if GNU preprocessor is used, we do have variable length macros, so override compiler.h +#undef HAVE_NO_VARIABLE_LENGTH_MACRO +#endif //__GNUC__ + +#ifndef LINKER_SECTION +#define LINKER_SECTION(name) +#endif //LINKER_SECTION + +#ifndef GP_HAVE_EXTRAM_SECTION +#define GP_EXTRAM_SECTION_ATTR +#endif //GP_HAVE_EXTRAM_SECTION + +#define STATIC static +#define STATIC_VAR static +#define STATIC_VAR_CONST static const + +/** use this macro to get rid of warnings about unused variables/arguments*/ +#define NOT_USED(x) ((void) (x)) + +#ifdef GP_DIVERSITY_JUMPTABLES + +/* to be able to remove the static for functions that need to be patchable */ +#define STATIC_FUNC + +#ifdef GP_DIVERSITY_ROM_CODE +/* these macros will be generated in the ROM code to enable calling via jumptables */ +#define JUMPTABLE_FLASHTYPEDEF(rtype, func, ...) rtype JUMPTABLE_FLASH(func)(__VA_ARGS__) +#define JUMPTABLE_ROMDEF(rtype, func, ...) rtype func(__VA_ARGS__) LINKER_SECTION(".rom") +#define JUMPTABLE_ROMIMPL(func) rom_impl_##func +#define JUMPTABLE_FLASH(func) flash_jump_##func +#undef STATIC_VAR +#define STATIC_VAR "this should generate an error: you shouldn't use STATIC_VAR in ROM code." +#endif //GP_DIVERSITY_ROM_CODE + +#else // def GP_DIVERSITY_JUMPTABLES + +/* when the ROM code is compiled in legacy builds */ +#define STATIC_FUNC static + +#endif // def GP_DIVERSITY_JUMPTABLES + +/***************************************************************************** + * Base type marshalling macro's + *****************************************************************************/ + +#ifdef GP_BIG_ENDIAN +#define generic_api2buf(pDest, pSource, length, pIndex, byteSize) do { \ + UIntLoop __i; \ + const UInt8* __pSource = (const UInt8*)(pSource); \ + for (__i = 0; __i < length; __i++) \ + { \ + if (byteSize == 2) \ + { \ + UInt16 __v; \ + MEMCPY(&__v, __pSource, 2); \ + HOST_TO_LITTLE_UINT16(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 2); \ + } \ + else if (byteSize == 4) \ + { \ + UInt32 __v; \ + MEMCPY(&__v, __pSource, 4); \ + HOST_TO_LITTLE_UINT32(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 4); \ + } \ + else if (byteSize == 8) \ + { \ + UInt64Struct_t __v; \ + MEMCPY(&__v, __pSource, 8); \ + HOST_TO_LITTLE_UINT64(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 8); \ + } \ + *(pIndex) += byteSize; \ + __pSource += byteSize; \ + } \ +} while(false) +#define generic_api2buf_1(pDest, pSource, pIndex, byteSize) do { \ + if (byteSize == 2) \ + { \ + UInt16 __v; \ + MEMCPY(&__v, __pSource, 2); \ + HOST_TO_LITTLE_UINT16(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 2); \ + } \ + else if (byteSize == 4) \ + { \ + UInt32 __v; \ + MEMCPY(&__v, __pSource, 4); \ + HOST_TO_LITTLE_UINT32(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 4); \ + } \ + else if (byteSize == 8) \ + { \ + UInt64Struct_t __v; \ + MEMCPY(&__v, __pSource, 8); \ + HOST_TO_LITTLE_UINT64(&__v); \ + MEMCPY(&pDest[*(pIndex)], &__v, 8); \ + } \ + *(pIndex) += byteSize; \ + } while(false) +#else +#define generic_api2buf(pDest, pSource, length, pIndex, byteSize) do { \ + UIntLoop __i;\ + const UInt8* __pSource = (const UInt8*)(pSource); \ + for (__i = 0; __i < length; __i++) \ + {\ + MEMCPY(&pDest[*pIndex], __pSource, byteSize);\ + *(pIndex) += byteSize;\ + __pSource += byteSize;\ + }\ +} while(false) +#define generic_api2buf_1(pDest, pSource, pIndex, byteSize) do { \ + MEMCPY(&pDest[*pIndex], (const UInt8*)(pSource), byteSize);\ + *(pIndex) += byteSize;\ +} while(false) +#endif + +#define UInt8_api2buf(pDest, pSource, length, pIndex) do { \ + if(__builtin_constant_p(length) && (length == 1)) { \ + (pDest)[*(pIndex)] = *(pSource); \ + } \ + else\ + { \ + MEMCPY(&(pDest)[*(pIndex)], (pSource), (length)); \ + } \ + *(pIndex)+=(length); \ +} while(false) +#define UInt8_api2buf_1(pDest, pSource, pIndex) do { \ + (pDest)[*(pIndex)] = *(pSource); \ + *(pIndex)+=1; \ +} while(false) + +#define void_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define Bool_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define bool_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define char_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define Byte_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define uint8_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define void_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define Bool_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define bool_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define char_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define Byte_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define uint8_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +#define UInt16_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 2) +#define uint16_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 2) +#define UInt32_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 4) +#define uint32_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 4) +#define UInt16_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 2) +#define UInt32_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 4) +#define uint16_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 2) +#define uint32_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 4) + +#define Int8_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define int8_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define Int16_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define Int32_api2buf(pDest, pSource, length, pIndex) UInt32_api2buf(pDest, pSource, length, pIndex) +#define Int8_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define int8_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define Int16_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define Int32_api2buf_1(pDest, pSource, pIndex) UInt32_api2buf_1(pDest, pSource, pIndex) + +#ifndef HAVE_NO_64BIT +#define UInt64_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 8) +#define uint64_t_api2buf(pDest, pSource, pIndex) UInt64_api2buf(pDest, pSource, length, pIndex) +#define Int64_api2buf(pDest, pSource, length, pIndex) UInt64_api2buf(pDest, pSource, length, pIndex) +#define UInt64_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 8) +#define Int64_api2buf_1(pDest, pSource, pIndex) UInt64_api2buf_1(pDest, pSource, pIndex) +#define uint64_t_api2buf_1(pDest, pSource, pIndex) UInt64_api2buf_1(pDest, pSource, pIndex) +#endif + +#define UInt64Struct_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 8) +#define MACAddress_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 8) +#define BtDeviceAddress_t_api2buf(pDest, pSource, length, pIndex) generic_api2buf(pDest, pSource, length, pIndex, 6) +#define UInt64Struct_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 8) +#define MACAddress_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 8) +#define BtDeviceAddress_t_api2buf_1(pDest, pSource, pIndex) generic_api2buf_1(pDest, pSource, pIndex, 6) + + +#define generic_buf2api(pDest, pSource, length, pIndex, byteSize) do { \ + UIntLoop __i; \ + UInt8* __pDest = (UInt8*)(pDest); \ + for (__i = 0; __i < length; __i++) \ + { \ + MEMCPY(__pDest, &(pSource)[*(pIndex)], byteSize); \ + if(byteSize == 2) \ + { \ + LITTLE_TO_HOST_UINT16(__pDest); \ + } \ + else if(byteSize == 4) \ + { \ + LITTLE_TO_HOST_UINT32(__pDest); \ + } \ + else if(byteSize == 8) \ + { \ + LITTLE_TO_HOST_UINT64(__pDest); \ + } \ + *(pIndex) += byteSize; \ + __pDest += byteSize; \ + } \ +} while(false) +#define generic_buf2api_1(pDest, pSource, pIndex, byteSize) do { \ + UInt8* __pDest = (UInt8*)(pDest); \ + MEMCPY(__pDest, &(pSource)[*(pIndex)], byteSize); \ + if(byteSize == 2) \ + { \ + LITTLE_TO_HOST_UINT16(__pDest); \ + } \ + else if(byteSize == 4) \ + { \ + LITTLE_TO_HOST_UINT32(__pDest); \ + } \ + else if(byteSize == 8) \ + { \ + LITTLE_TO_HOST_UINT64(__pDest); \ + } \ + *(pIndex) += byteSize; \ +} while(false) + +#define UInt8_buf2api(pDest, pSource, length, pIndex) do { \ + if(__builtin_constant_p(length) && (length == 1)) { \ + *(pDest) = (pSource)[*(pIndex)]; \ + }\ + else\ + { \ + MEMCPY((pDest), &(pSource)[*(pIndex)], (length)); \ + }\ + *(pIndex)+=(length); \ +} while(false) +#define UInt8_buf2api_1(pDest, pSource, pIndex) do { \ + *(pDest) = (pSource)[*(pIndex)]; \ + *(pIndex)+=1; \ +} while(false) + +#define void_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define Bool_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define bool_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define char_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define Byte_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define uint8_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define void_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define Bool_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define bool_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define char_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define Byte_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define uint8_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) + +#define UInt16_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 2) +#define uint16_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 2) +#define UInt32_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 4) +#define uint32_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 4) +#define UInt16_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 2) +#define uint16_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 2) +#define UInt32_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 4) +#define uint32_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 4) + +#define Int8_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define int8_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define Int16_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define Int32_buf2api(pDest, pSource, length, pIndex) UInt32_buf2api(pDest, pSource, length, pIndex) +#define Int8_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define int8_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define Int16_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define Int32_buf2api_1(pDest, pSource, pIndex) UInt32_buf2api_1(pDest, pSource, pIndex) +#define int_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, sizeof(int)) +#define int_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, sizeof(int)) + +#ifndef HAVE_NO_64BIT +#define UInt64_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 8) +#define uint64_t_buf2api(pDest, pSource, length, pIndex) UInt64_buf2api(pDest, pSource, length, pIndex) +#define Int64_buf2api(pDest, pSource, length, pIndex) UInt64_buf2api(pDest, pSource, length, pIndex) +#define UInt64_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 8) +#define Int64_buf2api_1(pDest, pSource, pIndex) UInt64_buf2api_1(pDest, pSource, pIndex) +#define uint64_t_buf2api_1(pDest, pSource, pIndex) UInt64_buf2api_1(pDest, pSource, pIndex) +#endif + +#define UInt64Struct_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 8) +#define MACAddress_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 8) +#define BtDeviceAddress_t_buf2api(pDest, pSource, length, pIndex) generic_buf2api(pDest, pSource, length, pIndex, 6) +#define UInt64Struct_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 8) +#define MACAddress_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 8) +#define BtDeviceAddress_t_buf2api_1(pDest, pSource, pIndex) generic_buf2api_1(pDest, pSource, pIndex, 6) + + +/** @enum gpMarshall_AckStatus_t */ +//@{ +/** @brief Command processed correctly */ +#define gpMarshall_AckStatusSuccess 0x0 +/** @brief Command not known by device */ +#define gpMarshall_AckStatusUnknownCommand 0x1 +/** @brief Command unsupported */ +#define gpMarshall_AckStatusUnsupportedCommand 0x2 +/** @brief Command parameter length incorrect */ +#define gpMarshall_AckStatusWrongParameterLength 0x3 +/** @brief Command execution failure */ +#define gpMarshall_AckStatusExecutionFailed 0x4 +/** @brief Device not able to process command at this time */ +#define gpMarshall_AckStatusBusy 0x5 +/** @brief The connected PC client is not the expected client. Last connected client takes ownership of the board, rendering previously connected client invalid */ +#define gpMarshall_AckStatusClientIDMismatch 0x6 +/** @typedef AckStatus_t + @brief Serial status reported on communication +*/ +typedef UInt8 gpMarshall_AckStatus_t; +//@} + +/***************************************************************************** + * Main function return + *****************************************************************************/ +#define MAIN_FUNCTION_RETURN_TYPE int +#define MAIN_FUNCTION_RETURN_VALUE (0) + +#endif // _GLOBAL_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/inc/gpModule.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/inc/gpModule.h new file mode 100644 index 0000000..e5971e6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_PLATFORM/inc/gpModule.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpModule.h + * This file contains the MODULE ID of the components that uses the serial protocol. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_MODULE_H_ +#define _GP_MODULE_H_ + +#ifdef GP_COMP_SHMEM +#define GP_MODULE_ID_SHMEM 23 +#endif //GP_COMP_SHMEM +#ifdef GP_COMP_ASSERT +#define GP_MODULE_ID_ASSERTAPI 29 +#endif //GP_COMP_ASSERT +#ifdef GP_COMP_MACCORE +#define GP_MODULE_ID_MACCOREAPI 109 +#endif //GP_COMP_MACCORE + +#ifdef GP_COMP_NVM +#define GP_MODULE_ID_NVM_API 32 +#endif // GP_COMP_NVM +#if defined(GP_NVM_RW_CACHE_DIVERSITY_GPCOM_SERVER) || defined(GP_NVM_RW_CACHE_DIVERSITY_GPCOM_CLIENT) +#define GP_MODULE_ID_NVM_RW_CACHEAPI 111 +#endif //defined(GP_NVM_RW_CACHE_DIVERSITY_GPCOM_SERVER) || defined(GP_NVM_RW_CACHE_DIVERSITY_GPCOM_CLIENT) +#ifdef GP_COMP_RESET +#define GP_MODULE_ID_RESETAPI 33 +#endif // GP_COMP_RESET +#ifdef GP_COMP_BASECOMPS +#define GP_MODULE_ID_BASECOMPSAPI 35 +#endif +#ifdef GP_COMP_GPHAL +#define GP_MODULE_ID_SNIFFERAPI 68 +#endif //GP_COMP_GPHAL +#ifdef GP_COMP_KEYSCAN +#define GP_MODULE_ID_KEYSCAN 12 +#endif //GP_COMP_KEYSCAN +#ifdef GP_COMP_RANDOM +#define GP_MODULE_ID_RANDOMAPI 108 +#endif //GP_COMP_RANDOM +#ifdef GP_COMP_RFCHANNEL +#define GP_MODULE_ID_RFCHANNELAPI 113 +#endif //GP_COMP_RFCHANNEL +#ifdef GP_COMP_MACDISPATCHER +#define GP_MODULE_ID_MACDISPATCHERAPI 114 +#endif //GP_COMP_MACDISPATCHER +#ifdef GP_COMP_TXMONITOR +#define GP_MODULE_ID_TXMONITOR 122 +#endif +#ifdef GP_COMP_ENCRYPTION +#define GP_MODULE_ID_ENCRYPTIONAPI 124 +#endif +#ifdef GP_COMP_VERSION +#define GP_MODULE_ID_VERSIONAPI 129 +#endif +#ifdef GP_COMP_NVM +#define GP_MODULE_ID_NVMAPI 181 +#endif + +#endif // _GP_MODULE_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPad/inc/gpPad.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPad/inc/gpPad.h new file mode 100644 index 0000000..680aef9 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPad/inc/gpPad.h @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2013, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPPAD_H_ +#define _GPPAD_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_PAD_NR_OF_HANDLES +#define GP_PAD_NR_OF_HANDLES 3 +#endif //GP_PD_NR_OF_HANDLES + +#define GP_PAD_INVALID_HANDLE 0xFF + +#define GP_PAD_MAX_CHANNELS 3 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt8 gpPad_Handle_t; + +#define gpPad_ResultValidHandle 0x0 +#define gpPad_ResultInvalidHandle 0x1 +#define gpPad_ResultNotInUse 0x2 +typedef UInt8 gpPad_Result_t; + +typedef struct gpPad_Attributes_s { + UInt8 channels[GP_PAD_MAX_CHANNELS]; + UInt8 antenna; + Int8 txPower; + UInt8 minBE; + UInt8 maxBE; + UInt8 maxCsmaBackoffs; + UInt8 maxFrameRetries; + UInt8 csma; + UInt8 cca; + Bool retransmitOnCcaFail; + Bool retransmitRandomBackoff; + UInt8 minBERetransmit; + UInt8 maxBERetransmit; +} gpPad_Attributes_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpPad_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +void gpPad_Init(void); + +//Descriptor handling +gpPad_Handle_t gpPad_GetPad(gpPad_Attributes_t* pInitAttributes); +void gpPad_FreePad(gpPad_Handle_t padHandle); +gpPad_Result_t gpPad_CheckPadValid(gpPad_Handle_t padHandle); + +//TxRequest +void gpPad_SetAttributes(gpPad_Handle_t padHandle, gpPad_Attributes_t* pAttributes); +void gpPad_GetAttributes(gpPad_Handle_t padHandle, gpPad_Attributes_t* pAttributes); + +void gpPad_SetTxChannels(gpPad_Handle_t padHandle, UInt8* channels); +void gpPad_SetTxPower(gpPad_Handle_t padHandle, Int8 txPower); +void gpPad_SetTxAntenna(gpPad_Handle_t padHandle, UInt8 antenna); +void gpPad_SetTxMinBE(gpPad_Handle_t padHandle, UInt8 minBE); +void gpPad_SetTxMaxBE(gpPad_Handle_t padHandle, UInt8 maxBE); +void gpPad_SetTxMaxCsmaBackoffs(gpPad_Handle_t padHandle, UInt8 maxCsmaBackoffs); +void gpPad_SetTxMaxFrameRetries(gpPad_Handle_t padHandle, UInt8 maxFrameRetries); +void gpPad_SetTxCsmaMode(gpPad_Handle_t padHandle, UInt8 csma); +void gpPad_SetCcaMode(gpPad_Handle_t padHandle, UInt8 cca); + +void gpPad_GetTxChannels(gpPad_Handle_t padHandle, UInt8* channels); +Int8 gpPad_GetTxPower(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxAntenna(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxMinBE(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxMaxBE(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxMaxCsmaBackoffs(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxMaxFrameRetries(gpPad_Handle_t padHandle); +UInt8 gpPad_GetTxCsmaMode(gpPad_Handle_t padHandle); +UInt8 gpPad_GetCcaMode(gpPad_Handle_t padHandle); + +void gpPad_SetRetransmitOnCcaFail(gpPad_Handle_t padHandle, Bool enabled); +Bool gpPad_GetRetransmitOnCcaFail(gpPad_Handle_t padHandle); +void gpPad_SetRetransmitRandomBackoff(gpPad_Handle_t padHandle, Bool enabled); +Bool gpPad_GetRetransmitRandomBackoff(gpPad_Handle_t padHandle); + +void gpPad_SetMinBeRetransmit(gpPad_Handle_t padHandle, UInt8 minBERetransmit); +UInt8 gpPad_GetMinBeRetransmit(gpPad_Handle_t padHandle); +void gpPad_SetMaxBeRetransmit(gpPad_Handle_t padHandle, UInt8 maxBERetransmit); +UInt8 gpPad_GetMaxBeRetransmit(gpPad_Handle_t padHandle); +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPPD_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/inc/gen/gpPd_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/inc/gen/gpPd_marshalling.h new file mode 100644 index 0000000..00e6aaf --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/inc/gen/gpPd_marshalling.h @@ -0,0 +1,1079 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPPD_MARSHALLING_H_ +#define _GPPD_MARSHALLING_H_ + +//DOCUMENTATION PD: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpPd_Loh_t data[1]; +} gpPd_Loh_t_l1_pointer_marshall_t; + + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Offset_t offset; +} gpPd_ReadByte_Input_struct_t; + +typedef struct { + gpPd_ReadByte_Input_struct_t data; +} gpPd_ReadByte_Input_marshall_struct_t; + +typedef struct { + UInt8 returnVal; +} gpPd_ReadByte_Output_struct_t; + +typedef struct { + gpPd_ReadByte_Output_struct_t data; +} gpPd_ReadByte_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Offset_t offset; + UInt8 byte; +} gpPd_WriteByte_Input_struct_t; + +typedef struct { + gpPd_WriteByte_Input_struct_t data; +} gpPd_WriteByte_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Offset_t offset; + UInt8 length; +} gpPd_ReadByteStream_Input_struct_t; + +typedef struct { + gpPd_ReadByteStream_Input_struct_t data; +} gpPd_ReadByteStream_Input_marshall_struct_t; + +typedef struct { + UInt8* pBuf; +} gpPd_ReadByteStream_Output_struct_t; + +typedef struct { + gpPd_ReadByteStream_Output_struct_t data; + UInt8 pBuf[255]; +} gpPd_ReadByteStream_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Offset_t offset; + UInt8 length; + UInt8* pBuf; +} gpPd_WriteByteStream_Input_struct_t; + +typedef struct { + gpPd_WriteByteStream_Input_struct_t data; + UInt8 pBuf[255]; +} gpPd_WriteByteStream_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t returnVal; +} gpPd_GetPd_Output_struct_t; + +typedef struct { + gpPd_GetPd_Output_struct_t data; +} gpPd_GetPd_Output_marshall_struct_t; + + +typedef struct { + gpPd_BufferType_t type; + UInt16 size; +} gpPd_GetCustomPd_Input_struct_t; + +typedef struct { + gpPd_GetCustomPd_Input_struct_t data; +} gpPd_GetCustomPd_Input_marshall_struct_t; + +typedef struct { + gpPd_Handle_t returnVal; +} gpPd_GetCustomPd_Output_struct_t; + +typedef struct { + gpPd_GetCustomPd_Output_struct_t data; +} gpPd_GetCustomPd_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_FreePd_Input_struct_t; + +typedef struct { + gpPd_FreePd_Input_struct_t data; +} gpPd_FreePd_Input_marshall_struct_t; + + +typedef struct { + UInt8 pbmHandle; + UInt16 pbmOffset; + UInt16 pbmLength; +} gpPd_cbDataConfirm_Input_struct_t; + +typedef struct { + gpPd_cbDataConfirm_Input_struct_t data; +} gpPd_cbDataConfirm_Input_marshall_struct_t; + +typedef struct { + gpPd_Loh_t* p_PdLoh; +} gpPd_cbDataConfirm_Output_struct_t; + +typedef struct { + gpPd_cbDataConfirm_Output_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t p_PdLoh; +} gpPd_cbDataConfirm_Output_marshall_struct_t; + + +typedef struct { + UInt8 pbmHandle; + UInt16 pbmOffset; + UInt16 pbmLength; + gpPd_BufferType_t type; +} gpPd_DataIndication_Input_struct_t; + +typedef struct { + gpPd_DataIndication_Input_struct_t data; +} gpPd_DataIndication_Input_marshall_struct_t; + +typedef struct { + gpPd_Loh_t* p_PdLoh; +} gpPd_DataIndication_Output_struct_t; + +typedef struct { + gpPd_DataIndication_Output_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t p_PdLoh; +} gpPd_DataIndication_Output_marshall_struct_t; + + +typedef struct { + gpPd_Loh_t* p_PdLoh; +} gpPd_DataRequest_Input_struct_t; + +typedef struct { + gpPd_DataRequest_Input_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t p_PdLoh; +} gpPd_DataRequest_Input_marshall_struct_t; + +typedef struct { + UInt8 returnVal; +} gpPd_DataRequest_Output_struct_t; + +typedef struct { + gpPd_DataRequest_Output_struct_t data; +} gpPd_DataRequest_Output_marshall_struct_t; + + +typedef struct { + UInt8 pbmHandle; +} gpPd_cbPurgeConfirm_Input_struct_t; + +typedef struct { + gpPd_cbPurgeConfirm_Input_struct_t data; +} gpPd_cbPurgeConfirm_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_PurgeRequest_Input_struct_t; + +typedef struct { + gpPd_PurgeRequest_Input_struct_t data; +} gpPd_PurgeRequest_Input_marshall_struct_t; + +typedef struct { + gpPd_Handle_t returnVal; +} gpPd_PurgeRequest_Output_struct_t; + +typedef struct { + gpPd_PurgeRequest_Output_struct_t data; +} gpPd_PurgeRequest_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 dataOffset; + UInt8 dataLength; + UInt8 auxOffset; + UInt8 auxLength; +} gpPd_SecRequest_Input_struct_t; + +typedef struct { + gpPd_SecRequest_Input_struct_t data; +} gpPd_SecRequest_Input_marshall_struct_t; + +typedef struct { + UInt8 returnVal; +} gpPd_SecRequest_Output_struct_t; + +typedef struct { + gpPd_SecRequest_Output_struct_t data; +} gpPd_SecRequest_Output_marshall_struct_t; + + +typedef struct { + UInt8 pbmHandle; + UInt8 dataOffset; + UInt8 dataLength; +} gpPd_cbSecConfirm_Input_struct_t; + +typedef struct { + gpPd_cbSecConfirm_Input_struct_t data; +} gpPd_cbSecConfirm_Input_marshall_struct_t; + +typedef struct { + gpPd_Handle_t returnVal; +} gpPd_cbSecConfirm_Output_struct_t; + +typedef struct { + gpPd_cbSecConfirm_Output_struct_t data; +} gpPd_cbSecConfirm_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_CheckPdValid_Input_struct_t; + +typedef struct { + gpPd_CheckPdValid_Input_struct_t data; +} gpPd_CheckPdValid_Input_marshall_struct_t; + +typedef struct { + gpPd_Result_t returnVal; +} gpPd_CheckPdValid_Output_struct_t; + +typedef struct { + gpPd_CheckPdValid_Output_struct_t data; +} gpPd_CheckPdValid_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRssi_Input_struct_t; + +typedef struct { + gpPd_GetRssi_Input_struct_t data; +} gpPd_GetRssi_Input_marshall_struct_t; + +typedef struct { + gpPd_Rssi_t rssi; +} gpPd_GetRssi_Output_struct_t; + +typedef struct { + gpPd_GetRssi_Output_struct_t data; +} gpPd_GetRssi_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Rssi_t rssi; +} gpPd_SetRssi_Input_struct_t; + +typedef struct { + gpPd_SetRssi_Input_struct_t data; +} gpPd_SetRssi_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetLqi_Input_struct_t; + +typedef struct { + gpPd_GetLqi_Input_struct_t data; +} gpPd_GetLqi_Input_marshall_struct_t; + +typedef struct { + gpPd_Lqi_t lqi; +} gpPd_GetLqi_Output_struct_t; + +typedef struct { + gpPd_GetLqi_Output_struct_t data; +} gpPd_GetLqi_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_Lqi_t lqi; +} gpPd_SetLqi_Input_struct_t; + +typedef struct { + gpPd_SetLqi_Input_struct_t data; +} gpPd_SetLqi_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxTimestamp_Input_struct_t; + +typedef struct { + gpPd_GetRxTimestamp_Input_struct_t data; +} gpPd_GetRxTimestamp_Input_marshall_struct_t; + +typedef struct { + UInt32 timestamp; +} gpPd_GetRxTimestamp_Output_struct_t; + +typedef struct { + gpPd_GetRxTimestamp_Output_struct_t data; +} gpPd_GetRxTimestamp_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxTimestamp_Input_struct_t; + +typedef struct { + gpPd_GetTxTimestamp_Input_struct_t data; +} gpPd_GetTxTimestamp_Input_marshall_struct_t; + +typedef struct { + UInt32 timestamp; +} gpPd_GetTxTimestamp_Output_struct_t; + +typedef struct { + gpPd_GetTxTimestamp_Output_struct_t data; +} gpPd_GetTxTimestamp_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_TimeStamp_t timestamp; +} gpPd_SetRxTimestamp_Input_struct_t; + +typedef struct { + gpPd_SetRxTimestamp_Input_struct_t data; +} gpPd_SetRxTimestamp_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + gpPd_TimeStamp_t timestamp; +} gpPd_SetTxTimestamp_Input_struct_t; + +typedef struct { + gpPd_SetTxTimestamp_Input_struct_t data; +} gpPd_SetTxTimestamp_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_CopyPd_Input_struct_t; + +typedef struct { + gpPd_CopyPd_Input_struct_t data; +} gpPd_CopyPd_Input_marshall_struct_t; + +typedef struct { + gpPd_Handle_t copyPd; +} gpPd_CopyPd_Output_struct_t; + +typedef struct { + gpPd_CopyPd_Output_struct_t data; +} gpPd_CopyPd_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxRetryCntr_Input_struct_t; + +typedef struct { + gpPd_GetTxRetryCntr_Input_struct_t data; +} gpPd_GetTxRetryCntr_Input_marshall_struct_t; + +typedef struct { + UInt8 retryCntr; +} gpPd_GetTxRetryCntr_Output_struct_t; + +typedef struct { + gpPd_GetTxRetryCntr_Output_struct_t data; +} gpPd_GetTxRetryCntr_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxTimestampChip_Input_struct_t; + +typedef struct { + gpPd_GetRxTimestampChip_Input_struct_t data; +} gpPd_GetRxTimestampChip_Input_marshall_struct_t; + +typedef struct { + gpPd_TimeStamp_t timestamp; +} gpPd_GetRxTimestampChip_Output_struct_t; + +typedef struct { + gpPd_GetRxTimestampChip_Output_struct_t data; +} gpPd_GetRxTimestampChip_Output_marshall_struct_t; + + +typedef struct { + gpPd_Loh_t* pPdLoh; + UInt8 length; + UInt8* pData; //FIXME - Manual +} gpPd_AppendWithUpdate_Input_struct_t; + +typedef struct { + gpPd_AppendWithUpdate_Input_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t pPdLoh; + UInt8 pData[128]; +} gpPd_AppendWithUpdate_Input_marshall_struct_t; + +typedef struct { + // pPdLoh used from input structure because it is an inout parameter + char _unused_dummy; // struct shall not be empty in C99 +} gpPd_AppendWithUpdate_Output_struct_t; + +typedef struct { + gpPd_AppendWithUpdate_Output_struct_t data; + // pPdLoh used from input structure because it is an inout parameter +} gpPd_AppendWithUpdate_Output_marshall_struct_t; + + +typedef struct { + gpPd_Loh_t* pPdLoh; + UInt8 length; + UInt8* pData; +} gpPd_PrependWithUpdate_Input_struct_t; + +typedef struct { + gpPd_PrependWithUpdate_Input_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t pPdLoh; + UInt8 pData[128]; +} gpPd_PrependWithUpdate_Input_marshall_struct_t; + +typedef struct { + // pPdLoh used from input structure because it is an inout parameter + char _unused_dummy; // struct shall not be empty in C99 +} gpPd_PrependWithUpdate_Output_struct_t; + +typedef struct { + gpPd_PrependWithUpdate_Output_struct_t data; + // pPdLoh used from input structure because it is an inout parameter +} gpPd_PrependWithUpdate_Output_marshall_struct_t; + + +typedef struct { + gpPd_Loh_t* pPdLoh; + UInt8 length; +} gpPd_ReadWithUpdate_Input_struct_t; + +typedef struct { + gpPd_ReadWithUpdate_Input_struct_t data; + gpPd_Loh_t_l1_pointer_marshall_t pPdLoh; +} gpPd_ReadWithUpdate_Input_marshall_struct_t; + +typedef struct { + // pPdLoh used from input structure because it is an inout parameter + UInt8* pData; +} gpPd_ReadWithUpdate_Output_struct_t; + +typedef struct { + gpPd_ReadWithUpdate_Output_struct_t data; + // pPdLoh used from input structure because it is an inout parameter + UInt8 pData[128]; +} gpPd_ReadWithUpdate_Output_marshall_struct_t; + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxTimestampExt_Input_struct_t; //FIXME - Manual + +typedef struct { + gpPd_GetRxTimestampExt_Input_struct_t data; +} gpPd_GetRxTimestampExt_Input_marshall_struct_t; //FIXME - Manual + +typedef struct { + gpPd_TimeStamp_t timestamp; +} gpPd_GetRxTimestampExt_Output_struct_t; //FIXME - Manual + +typedef struct { + gpPd_GetRxTimestampExt_Output_struct_t data; +} gpPd_GetRxTimestampExt_Output_marshall_struct_t; //FIXME - Manual + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxTimestampExt_Input_struct_t; //FIXME - Manual + +typedef struct { + gpPd_GetTxTimestampExt_Input_struct_t data; +} gpPd_GetTxTimestampExt_Input_marshall_struct_t; //FIXME - Manual + +typedef struct { + gpPd_TimeStamp_t timestamp; +} gpPd_GetTxTimestampExt_Output_struct_t; //FIXME - Manual + +typedef struct { + gpPd_GetTxTimestampExt_Output_struct_t data; +} gpPd_GetTxTimestampExt_Output_marshall_struct_t; //FIXME - Manual + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 retryCntr; +} gpPd_SetTxRetryCntr_Input_struct_t; + +typedef struct { + gpPd_SetTxRetryCntr_Input_struct_t data; +} gpPd_SetTxRetryCntr_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxChannel_Input_struct_t; + +typedef struct { + gpPd_GetRxChannel_Input_struct_t data; +} gpPd_GetRxChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 rxChannel; +} gpPd_GetRxChannel_Output_struct_t; + +typedef struct { + gpPd_GetRxChannel_Output_struct_t data; +} gpPd_GetRxChannel_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 rxChannel; +} gpPd_SetRxChannel_Input_struct_t; + +typedef struct { + gpPd_SetRxChannel_Input_struct_t data; +} gpPd_SetRxChannel_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetFramePendingAfterTx_Input_struct_t; + +typedef struct { + gpPd_GetFramePendingAfterTx_Input_struct_t data; +} gpPd_GetFramePendingAfterTx_Input_marshall_struct_t; + +typedef struct { + UInt8 framePending; +} gpPd_GetFramePendingAfterTx_Output_struct_t; + +typedef struct { + gpPd_GetFramePendingAfterTx_Output_struct_t data; +} gpPd_GetFramePendingAfterTx_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 framePending; +} gpPd_SetFramePendingAfterTx_Input_struct_t; + +typedef struct { + gpPd_SetFramePendingAfterTx_Input_struct_t data; +} gpPd_SetFramePendingAfterTx_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxCCACntr_Input_struct_t; + +typedef struct { + gpPd_GetTxCCACntr_Input_struct_t data; +} gpPd_GetTxCCACntr_Input_marshall_struct_t; + +typedef struct { + UInt8 txCCACntr; +} gpPd_GetTxCCACntr_Output_struct_t; + +typedef struct { + gpPd_GetTxCCACntr_Output_struct_t data; +} gpPd_GetTxCCACntr_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxAckLqi_Input_struct_t; + +typedef struct { + gpPd_GetTxAckLqi_Input_struct_t data; +} gpPd_GetTxAckLqi_Input_marshall_struct_t; + +typedef struct { + gpPd_Lqi_t ackLqi; +} gpPd_GetTxAckLqi_Output_struct_t; + +typedef struct { + gpPd_GetTxAckLqi_Output_struct_t data; +} gpPd_GetTxAckLqi_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetFrameControlFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_GetFrameControlFromTxAckAfterRx_Input_struct_t data; +} gpPd_GetFrameControlFromTxAckAfterRx_Input_marshall_struct_t; + +typedef struct { + UInt16 framePending; +} gpPd_GetFrameControlFromTxAckAfterRx_Output_struct_t; + +typedef struct { + gpPd_GetFrameControlFromTxAckAfterRx_Output_struct_t data; +} gpPd_GetFrameControlFromTxAckAfterRx_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt16 framePending; +} gpPd_SetFrameControlFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_SetFrameControlFromTxAckAfterRx_Input_struct_t data; +} gpPd_SetFrameControlFromTxAckAfterRx_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetRxEnhancedAckFromTxPbm_Input_struct_t; + +typedef struct { + gpPd_GetRxEnhancedAckFromTxPbm_Input_struct_t data; +} gpPd_GetRxEnhancedAckFromTxPbm_Input_marshall_struct_t; + +typedef struct { + Bool enhancedAck; +} gpPd_GetRxEnhancedAckFromTxPbm_Output_struct_t; + +typedef struct { + gpPd_GetRxEnhancedAckFromTxPbm_Output_struct_t data; +} gpPd_GetRxEnhancedAckFromTxPbm_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + Bool enhancedAck; +} gpPd_SetRxEnhancedAckFromTxPbm_Input_struct_t; + +typedef struct { + gpPd_SetRxEnhancedAckFromTxPbm_Input_struct_t data; +} gpPd_SetRxEnhancedAckFromTxPbm_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetFrameCounterFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_GetFrameCounterFromTxAckAfterRx_Input_struct_t data; +} gpPd_GetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t; + +typedef struct { + UInt32 frameCounter; +} gpPd_GetFrameCounterFromTxAckAfterRx_Output_struct_t; + +typedef struct { + gpPd_GetFrameCounterFromTxAckAfterRx_Output_struct_t data; +} gpPd_GetFrameCounterFromTxAckAfterRx_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt32 frameCounter; +} gpPd_SetFrameCounterFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_SetFrameCounterFromTxAckAfterRx_Input_struct_t data; +} gpPd_SetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetKeyIdFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_GetKeyIdFromTxAckAfterRx_Input_struct_t data; +} gpPd_GetKeyIdFromTxAckAfterRx_Input_marshall_struct_t; + +typedef struct { + UInt8 keyId; +} gpPd_GetKeyIdFromTxAckAfterRx_Output_struct_t; + +typedef struct { + gpPd_GetKeyIdFromTxAckAfterRx_Output_struct_t data; +} gpPd_GetKeyIdFromTxAckAfterRx_Output_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; + UInt8 keyId; +} gpPd_SetKeyIdFromTxAckAfterRx_Input_struct_t; + +typedef struct { + gpPd_SetKeyIdFromTxAckAfterRx_Input_struct_t data; +} gpPd_SetKeyIdFromTxAckAfterRx_Input_marshall_struct_t; + + +typedef struct { + gpPd_Handle_t pdHandle; +} gpPd_GetTxChannel_Input_struct_t; + +typedef struct { + gpPd_GetTxChannel_Input_struct_t data; +} gpPd_GetTxChannel_Input_marshall_struct_t; + +typedef struct { + UInt8 channel; +} gpPd_GetTxChannel_Output_struct_t; + +typedef struct { + gpPd_GetTxChannel_Output_struct_t data; +} gpPd_GetTxChannel_Output_marshall_struct_t; + + +typedef union { + gpPd_ReadByte_Input_marshall_struct_t gpPd_ReadByte; + gpPd_WriteByte_Input_marshall_struct_t gpPd_WriteByte; + gpPd_ReadByteStream_Input_marshall_struct_t gpPd_ReadByteStream; + gpPd_WriteByteStream_Input_marshall_struct_t gpPd_WriteByteStream; + gpPd_GetCustomPd_Input_marshall_struct_t gpPd_GetCustomPd; + gpPd_FreePd_Input_marshall_struct_t gpPd_FreePd; + gpPd_cbDataConfirm_Input_marshall_struct_t gpPd_cbDataConfirm; + gpPd_DataIndication_Input_marshall_struct_t gpPd_DataIndication; + gpPd_DataRequest_Input_marshall_struct_t gpPd_DataRequest; + gpPd_cbPurgeConfirm_Input_marshall_struct_t gpPd_cbPurgeConfirm; + gpPd_PurgeRequest_Input_marshall_struct_t gpPd_PurgeRequest; + gpPd_SecRequest_Input_marshall_struct_t gpPd_SecRequest; + gpPd_cbSecConfirm_Input_marshall_struct_t gpPd_cbSecConfirm; + gpPd_CheckPdValid_Input_marshall_struct_t gpPd_CheckPdValid; + gpPd_GetRssi_Input_marshall_struct_t gpPd_GetRssi; + gpPd_SetRssi_Input_marshall_struct_t gpPd_SetRssi; + gpPd_GetLqi_Input_marshall_struct_t gpPd_GetLqi; + gpPd_SetLqi_Input_marshall_struct_t gpPd_SetLqi; + gpPd_GetRxTimestamp_Input_marshall_struct_t gpPd_GetRxTimestamp; + gpPd_GetTxTimestamp_Input_marshall_struct_t gpPd_GetTxTimestamp; + gpPd_SetRxTimestamp_Input_marshall_struct_t gpPd_SetRxTimestamp; + gpPd_SetTxTimestamp_Input_marshall_struct_t gpPd_SetTxTimestamp; + gpPd_CopyPd_Input_marshall_struct_t gpPd_CopyPd; + gpPd_GetTxRetryCntr_Input_marshall_struct_t gpPd_GetTxRetryCntr; + gpPd_GetRxTimestampChip_Input_marshall_struct_t gpPd_GetRxTimestampChip; + gpPd_AppendWithUpdate_Input_marshall_struct_t gpPd_AppendWithUpdate; + gpPd_PrependWithUpdate_Input_marshall_struct_t gpPd_PrependWithUpdate; + gpPd_ReadWithUpdate_Input_marshall_struct_t gpPd_ReadWithUpdate; + gpPd_GetRxTimestampExt_Input_marshall_struct_t gpPd_GetRxTimestampExt; //FIXME - Manual + gpPd_GetTxTimestampExt_Input_marshall_struct_t gpPd_GetTxTimestampExt; //FIXME - Manual + gpPd_SetTxRetryCntr_Input_marshall_struct_t gpPd_SetTxRetryCntr; + gpPd_GetRxChannel_Input_marshall_struct_t gpPd_GetRxChannel; + gpPd_SetRxChannel_Input_marshall_struct_t gpPd_SetRxChannel; + gpPd_GetFramePendingAfterTx_Input_marshall_struct_t gpPd_GetFramePendingAfterTx; + gpPd_SetFramePendingAfterTx_Input_marshall_struct_t gpPd_SetFramePendingAfterTx; + gpPd_GetTxCCACntr_Input_marshall_struct_t gpPd_GetTxCCACntr; + gpPd_GetTxAckLqi_Input_marshall_struct_t gpPd_GetTxAckLqi; + gpPd_GetFrameControlFromTxAckAfterRx_Input_marshall_struct_t gpPd_GetFrameControlFromTxAckAfterRx; + gpPd_SetFrameControlFromTxAckAfterRx_Input_marshall_struct_t gpPd_SetFrameControlFromTxAckAfterRx; + gpPd_GetRxEnhancedAckFromTxPbm_Input_marshall_struct_t gpPd_GetRxEnhancedAckFromTxPbm; + gpPd_SetRxEnhancedAckFromTxPbm_Input_marshall_struct_t gpPd_SetRxEnhancedAckFromTxPbm; + gpPd_GetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t gpPd_GetFrameCounterFromTxAckAfterRx; + gpPd_SetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t gpPd_SetFrameCounterFromTxAckAfterRx; + gpPd_GetKeyIdFromTxAckAfterRx_Input_marshall_struct_t gpPd_GetKeyIdFromTxAckAfterRx; + gpPd_SetKeyIdFromTxAckAfterRx_Input_marshall_struct_t gpPd_SetKeyIdFromTxAckAfterRx; + gpPd_GetTxChannel_Input_marshall_struct_t gpPd_GetTxChannel; + UInt8 dummy; //ensure none empty union definition +} gpPd_Server_Input_union_t; + +typedef union { + gpPd_ReadByte_Output_marshall_struct_t gpPd_ReadByte; + gpPd_ReadByteStream_Output_marshall_struct_t gpPd_ReadByteStream; + gpPd_GetPd_Output_marshall_struct_t gpPd_GetPd; + gpPd_GetCustomPd_Output_marshall_struct_t gpPd_GetCustomPd; + gpPd_cbDataConfirm_Output_marshall_struct_t gpPd_cbDataConfirm; + gpPd_DataIndication_Output_marshall_struct_t gpPd_DataIndication; + gpPd_DataRequest_Output_marshall_struct_t gpPd_DataRequest; + gpPd_PurgeRequest_Output_marshall_struct_t gpPd_PurgeRequest; + gpPd_SecRequest_Output_marshall_struct_t gpPd_SecRequest; + gpPd_cbSecConfirm_Output_marshall_struct_t gpPd_cbSecConfirm; + gpPd_CheckPdValid_Output_marshall_struct_t gpPd_CheckPdValid; + gpPd_GetRssi_Output_marshall_struct_t gpPd_GetRssi; + gpPd_GetLqi_Output_marshall_struct_t gpPd_GetLqi; + gpPd_GetRxTimestamp_Output_marshall_struct_t gpPd_GetRxTimestamp; + gpPd_GetTxTimestamp_Output_marshall_struct_t gpPd_GetTxTimestamp; + gpPd_CopyPd_Output_marshall_struct_t gpPd_CopyPd; + gpPd_GetTxRetryCntr_Output_marshall_struct_t gpPd_GetTxRetryCntr; + gpPd_GetRxTimestampChip_Output_marshall_struct_t gpPd_GetRxTimestampChip; + gpPd_AppendWithUpdate_Output_marshall_struct_t gpPd_AppendWithUpdate; + gpPd_PrependWithUpdate_Output_marshall_struct_t gpPd_PrependWithUpdate; + gpPd_ReadWithUpdate_Output_marshall_struct_t gpPd_ReadWithUpdate; + gpPd_GetRxTimestampExt_Output_marshall_struct_t gpPd_GetRxTimestampExt; //FIXME - Manual + gpPd_GetTxTimestampExt_Output_marshall_struct_t gpPd_GetTxTimestampExt; //FIXME - Manual + gpPd_GetRxChannel_Output_marshall_struct_t gpPd_GetRxChannel; + gpPd_GetFramePendingAfterTx_Output_marshall_struct_t gpPd_GetFramePendingAfterTx; + gpPd_GetTxCCACntr_Output_marshall_struct_t gpPd_GetTxCCACntr; + gpPd_GetTxAckLqi_Output_marshall_struct_t gpPd_GetTxAckLqi; + gpPd_GetFrameControlFromTxAckAfterRx_Output_marshall_struct_t gpPd_GetFrameControlFromTxAckAfterRx; + gpPd_GetRxEnhancedAckFromTxPbm_Output_marshall_struct_t gpPd_GetRxEnhancedAckFromTxPbm; + gpPd_GetFrameCounterFromTxAckAfterRx_Output_marshall_struct_t gpPd_GetFrameCounterFromTxAckAfterRx; + gpPd_GetKeyIdFromTxAckAfterRx_Output_marshall_struct_t gpPd_GetKeyIdFromTxAckAfterRx; + gpPd_GetTxChannel_Output_marshall_struct_t gpPd_GetTxChannel; + UInt8 dummy; //ensure none empty union definition +} gpPd_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpPd_Handle_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Handle_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Handle_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Handle_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Offset_t_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Offset_t_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Offset_t_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Offset_t_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Length_t_buf2api(pDest, pSource, length, pIndex) UInt16_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Length_t_api2buf(pDest, pSource, length, pIndex) UInt16_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Length_t_buf2api_1(pDest, pSource, pIndex) UInt16_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Length_t_api2buf_1(pDest, pSource, pIndex) UInt16_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Lqi_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Lqi_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Lqi_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Lqi_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Rssi_t_buf2api(pDest, pSource, length, pIndex) Int8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Rssi_t_api2buf(pDest, pSource, length, pIndex) Int8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Rssi_t_buf2api_1(pDest, pSource, pIndex) Int8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Rssi_t_api2buf_1(pDest, pSource, pIndex) Int8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_Result_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_Result_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_Result_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_Result_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_BufferType_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpPd_BufferType_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpPd_BufferType_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpPd_BufferType_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpPd_TimeStamp_t_buf2api(pDest, pSource, length, pIndex) UInt32_buf2api(pDest, pSource, length, pIndex) +#define gpPd_TimeStamp_t_api2buf(pDest, pSource, length, pIndex) UInt32_api2buf(pDest, pSource, length, pIndex) +#define gpPd_TimeStamp_t_buf2api_1(pDest, pSource, pIndex) UInt32_buf2api_1(pDest, pSource, pIndex) +#define gpPd_TimeStamp_t_api2buf_1(pDest, pSource, pIndex) UInt32_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +gpMarshall_AckStatus_t gpPd_Loh_t_buf2api(gpPd_Loh_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex , Bool storePdHandle ); +void gpPd_Loh_t_api2buf(UInt8Buffer* pDest , const gpPd_Loh_t* pSource , UInt16 length , UInt16* pIndex); +// Server functions +gpMarshall_AckStatus_t gpPd_ReadByte_Input_buf2api(gpPd_ReadByte_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_ReadByte_Output_api2buf(UInt8Buffer* pDest , gpPd_ReadByte_Output_marshall_struct_t* pSourceoutput , gpPd_ReadByte_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_WriteByte_Input_buf2api(gpPd_WriteByte_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_ReadByteStream_Input_buf2api(gpPd_ReadByteStream_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_ReadByteStream_Output_api2buf(UInt8Buffer* pDest , gpPd_ReadByteStream_Output_marshall_struct_t* pSourceoutput , gpPd_ReadByteStream_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_WriteByteStream_Input_buf2api(gpPd_WriteByteStream_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetPd_Output_api2buf(UInt8Buffer* pDest , gpPd_GetPd_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetCustomPd_Input_buf2api(gpPd_GetCustomPd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetCustomPd_Output_api2buf(UInt8Buffer* pDest , gpPd_GetCustomPd_Output_marshall_struct_t* pSourceoutput , gpPd_GetCustomPd_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_FreePd_Input_buf2api(gpPd_FreePd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_cbDataConfirm_Input_buf2api(gpPd_cbDataConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_cbDataConfirm_Output_api2buf(UInt8Buffer* pDest , gpPd_cbDataConfirm_Output_marshall_struct_t* pSourceoutput , gpPd_cbDataConfirm_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_DataIndication_Input_buf2api(gpPd_DataIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_DataIndication_Output_api2buf(UInt8Buffer* pDest , gpPd_DataIndication_Output_marshall_struct_t* pSourceoutput , gpPd_DataIndication_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_DataRequest_Input_buf2api(gpPd_DataRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_DataRequest_Output_api2buf(UInt8Buffer* pDest , gpPd_DataRequest_Output_marshall_struct_t* pSourceoutput , gpPd_DataRequest_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_cbPurgeConfirm_Input_buf2api(gpPd_cbPurgeConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_PurgeRequest_Input_buf2api(gpPd_PurgeRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_PurgeRequest_Output_api2buf(UInt8Buffer* pDest , gpPd_PurgeRequest_Output_marshall_struct_t* pSourceoutput , gpPd_PurgeRequest_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SecRequest_Input_buf2api(gpPd_SecRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SecRequest_Output_api2buf(UInt8Buffer* pDest , gpPd_SecRequest_Output_marshall_struct_t* pSourceoutput , gpPd_SecRequest_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_cbSecConfirm_Input_buf2api(gpPd_cbSecConfirm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_cbSecConfirm_Output_api2buf(UInt8Buffer* pDest , gpPd_cbSecConfirm_Output_marshall_struct_t* pSourceoutput , gpPd_cbSecConfirm_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_CheckPdValid_Input_buf2api(gpPd_CheckPdValid_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_CheckPdValid_Output_api2buf(UInt8Buffer* pDest , gpPd_CheckPdValid_Output_marshall_struct_t* pSourceoutput , gpPd_CheckPdValid_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRssi_Input_buf2api(gpPd_GetRssi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRssi_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRssi_Output_marshall_struct_t* pSourceoutput , gpPd_GetRssi_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetRssi_Input_buf2api(gpPd_SetRssi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetLqi_Input_buf2api(gpPd_GetLqi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetLqi_Output_api2buf(UInt8Buffer* pDest , gpPd_GetLqi_Output_marshall_struct_t* pSourceoutput , gpPd_GetLqi_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetLqi_Input_buf2api(gpPd_SetLqi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxTimestamp_Input_buf2api(gpPd_GetRxTimestamp_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxTimestamp_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRxTimestamp_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxTimestamp_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxTimestamp_Input_buf2api(gpPd_GetTxTimestamp_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxTimestamp_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxTimestamp_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxTimestamp_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetRxTimestamp_Input_buf2api(gpPd_SetRxTimestamp_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetTxTimestamp_Input_buf2api(gpPd_SetTxTimestamp_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_CopyPd_Input_buf2api(gpPd_CopyPd_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_CopyPd_Output_api2buf(UInt8Buffer* pDest , gpPd_CopyPd_Output_marshall_struct_t* pSourceoutput , gpPd_CopyPd_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxRetryCntr_Input_buf2api(gpPd_GetTxRetryCntr_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxRetryCntr_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxRetryCntr_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxRetryCntr_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxTimestampChip_Input_buf2api(gpPd_GetRxTimestampChip_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxTimestampChip_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRxTimestampChip_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxTimestampChip_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_AppendWithUpdate_Input_buf2api(gpPd_AppendWithUpdate_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_AppendWithUpdate_Output_api2buf(UInt8Buffer* pDest , gpPd_AppendWithUpdate_Output_marshall_struct_t* pSourceoutput , gpPd_AppendWithUpdate_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_PrependWithUpdate_Input_buf2api(gpPd_PrependWithUpdate_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_PrependWithUpdate_Output_api2buf(UInt8Buffer* pDest , gpPd_PrependWithUpdate_Output_marshall_struct_t* pSourceoutput , gpPd_PrependWithUpdate_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_ReadWithUpdate_Input_buf2api(gpPd_ReadWithUpdate_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_ReadWithUpdate_Output_api2buf(UInt8Buffer* pDest , gpPd_ReadWithUpdate_Output_marshall_struct_t* pSourceoutput , gpPd_ReadWithUpdate_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxTimestampExt_Input_buf2api( gpPd_GetRxTimestampExt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetRxTimestampExt_Output_api2buf( UInt8Buffer* pDest , gpPd_GetRxTimestampExt_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxTimestampExt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); //FIXME - Manual +gpMarshall_AckStatus_t gpPd_GetTxTimestampExt_Input_buf2api( gpPd_GetTxTimestampExt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetTxTimestampExt_Output_api2buf( UInt8Buffer* pDest , gpPd_GetTxTimestampExt_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxTimestampExt_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); //FIXME - Manual +gpMarshall_AckStatus_t gpPd_SetTxRetryCntr_Input_buf2api(gpPd_SetTxRetryCntr_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxChannel_Input_buf2api(gpPd_GetRxChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxChannel_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRxChannel_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetRxChannel_Input_buf2api(gpPd_SetRxChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetFramePendingAfterTx_Input_buf2api(gpPd_GetFramePendingAfterTx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetFramePendingAfterTx_Output_api2buf(UInt8Buffer* pDest , gpPd_GetFramePendingAfterTx_Output_marshall_struct_t* pSourceoutput , gpPd_GetFramePendingAfterTx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetFramePendingAfterTx_Input_buf2api(gpPd_SetFramePendingAfterTx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxCCACntr_Input_buf2api(gpPd_GetTxCCACntr_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxCCACntr_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxCCACntr_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxCCACntr_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxAckLqi_Input_buf2api(gpPd_GetTxAckLqi_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxAckLqi_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxAckLqi_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxAckLqi_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetFrameControlFromTxAckAfterRx_Input_buf2api(gpPd_GetFrameControlFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetFrameControlFromTxAckAfterRx_Output_api2buf(UInt8Buffer* pDest , gpPd_GetFrameControlFromTxAckAfterRx_Output_marshall_struct_t* pSourceoutput , gpPd_GetFrameControlFromTxAckAfterRx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetFrameControlFromTxAckAfterRx_Input_buf2api(gpPd_SetFrameControlFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetRxEnhancedAckFromTxPbm_Input_buf2api(gpPd_GetRxEnhancedAckFromTxPbm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxEnhancedAckFromTxPbm_Output_api2buf(UInt8Buffer* pDest , gpPd_GetRxEnhancedAckFromTxPbm_Output_marshall_struct_t* pSourceoutput , gpPd_GetRxEnhancedAckFromTxPbm_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetRxEnhancedAckFromTxPbm_Input_buf2api(gpPd_SetRxEnhancedAckFromTxPbm_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetFrameCounterFromTxAckAfterRx_Input_buf2api(gpPd_GetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetFrameCounterFromTxAckAfterRx_Output_api2buf(UInt8Buffer* pDest , gpPd_GetFrameCounterFromTxAckAfterRx_Output_marshall_struct_t* pSourceoutput , gpPd_GetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetFrameCounterFromTxAckAfterRx_Input_buf2api(gpPd_SetFrameCounterFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetKeyIdFromTxAckAfterRx_Input_buf2api(gpPd_GetKeyIdFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetKeyIdFromTxAckAfterRx_Output_api2buf(UInt8Buffer* pDest , gpPd_GetKeyIdFromTxAckAfterRx_Output_marshall_struct_t* pSourceoutput , gpPd_GetKeyIdFromTxAckAfterRx_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_SetKeyIdFromTxAckAfterRx_Input_buf2api(gpPd_SetKeyIdFromTxAckAfterRx_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +gpMarshall_AckStatus_t gpPd_GetTxChannel_Input_buf2api(gpPd_GetTxChannel_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxChannel_Output_api2buf(UInt8Buffer* pDest , gpPd_GetTxChannel_Output_marshall_struct_t* pSourceoutput , gpPd_GetTxChannel_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); + +// Client functions +void gpPd_ReadByte_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt16* pIndex); +void gpPd_ReadByte_Output_buf2par(UInt8* returnVal , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_WriteByte_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8 byte , UInt16* pIndex); +void gpPd_ReadByteStream_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8 length , UInt16* pIndex); +void gpPd_ReadByteStream_Output_buf2par(gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8 length , UInt8* pBuf , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_WriteByteStream_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Offset_t offset , UInt8 length , UInt8* pBuf , UInt16* pIndex); +void gpPd_GetPd_Output_buf2par(gpPd_Handle_t* returnVal , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetCustomPd_Input_par2buf(UInt8Buffer* pDest , gpPd_BufferType_t type , UInt16 size , UInt16* pIndex); +void gpPd_GetCustomPd_Output_buf2par(gpPd_Handle_t* returnVal , gpPd_BufferType_t type , UInt16 size , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_FreePd_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_cbDataConfirm_Input_par2buf(UInt8Buffer* pDest , UInt8 pbmHandle , UInt16 pbmOffset , UInt16 pbmLength , UInt16* pIndex); +void gpPd_cbDataConfirm_Output_buf2par(UInt8 pbmHandle , UInt16 pbmOffset , UInt16 pbmLength , gpPd_Loh_t* p_PdLoh , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_DataIndication_Input_par2buf(UInt8Buffer* pDest , UInt8 pbmHandle , UInt16 pbmOffset , UInt16 pbmLength , gpPd_BufferType_t type , UInt16* pIndex); +void gpPd_DataIndication_Output_buf2par(UInt8 pbmHandle , UInt16 pbmOffset , UInt16 pbmLength , gpPd_Loh_t* p_PdLoh , gpPd_BufferType_t type , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_DataRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Loh_t* p_PdLoh , UInt16* pIndex); +void gpPd_DataRequest_Output_buf2par(UInt8* returnVal , gpPd_Loh_t* p_PdLoh , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_cbPurgeConfirm_Input_par2buf(UInt8Buffer* pDest , UInt8 pbmHandle , UInt16* pIndex); +void gpPd_PurgeRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_PurgeRequest_Output_buf2par(gpPd_Handle_t* returnVal , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SecRequest_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 dataOffset , UInt8 dataLength , UInt8 auxOffset , UInt8 auxLength , UInt16* pIndex); +void gpPd_SecRequest_Output_buf2par(UInt8* returnVal , gpPd_Handle_t pdHandle , UInt8 dataOffset , UInt8 dataLength , UInt8 auxOffset , UInt8 auxLength , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_cbSecConfirm_Input_par2buf(UInt8Buffer* pDest , UInt8 pbmHandle , UInt8 dataOffset , UInt8 dataLength , UInt16* pIndex); +void gpPd_cbSecConfirm_Output_buf2par(gpPd_Handle_t* returnVal , UInt8 pbmHandle , UInt8 dataOffset , UInt8 dataLength , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_CheckPdValid_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_CheckPdValid_Output_buf2par(gpPd_Result_t* returnVal , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRssi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRssi_Output_buf2par(gpPd_Rssi_t* rssi , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetRssi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Rssi_t rssi , UInt16* pIndex); +void gpPd_GetLqi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetLqi_Output_buf2par(gpPd_Lqi_t* lqi , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetLqi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_Lqi_t lqi , UInt16* pIndex); +void gpPd_GetRxTimestamp_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRxTimestamp_Output_buf2par(UInt32* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxTimestamp_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxTimestamp_Output_buf2par(UInt32* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetRxTimestamp_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_TimeStamp_t timestamp , UInt16* pIndex); +void gpPd_SetTxTimestamp_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , gpPd_TimeStamp_t timestamp , UInt16* pIndex); +void gpPd_CopyPd_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_CopyPd_Output_buf2par(gpPd_Handle_t* copyPd , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxRetryCntr_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxRetryCntr_Output_buf2par(UInt8* retryCntr , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxTimestampChip_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRxTimestampChip_Output_buf2par(gpPd_TimeStamp_t* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_AppendWithUpdate_Input_par2buf(UInt8Buffer* pDest , gpPd_Loh_t* pPdLoh , UInt8 length , const UInt8* pData , UInt16* pIndex); +void gpPd_AppendWithUpdate_Output_buf2par(gpPd_Loh_t* pPdLoh , UInt8 length , const UInt8* pData , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_PrependWithUpdate_Input_par2buf(UInt8Buffer* pDest , gpPd_Loh_t* pPdLoh , UInt8 length , UInt8* pData , UInt16* pIndex); +void gpPd_PrependWithUpdate_Output_buf2par(gpPd_Loh_t* pPdLoh , UInt8 length , UInt8* pData , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_ReadWithUpdate_Input_par2buf(UInt8Buffer* pDest , gpPd_Loh_t* pPdLoh , UInt8 length , UInt16* pIndex); +void gpPd_ReadWithUpdate_Output_buf2par(gpPd_Loh_t* pPdLoh , UInt8 length , UInt8* pData , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetRxTimestampExt_Input_par2buf( UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetRxTimestampExt_Output_buf2par( gpPd_TimeStamp_t* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetTxTimestampExt_Input_par2buf( UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex ); //FIXME - Manual +void gpPd_GetTxTimestampExt_Output_buf2par( gpPd_TimeStamp_t* timestamp , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex ); //FIXME - Manual +void gpPd_SetTxRetryCntr_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 retryCntr , UInt16* pIndex); +void gpPd_GetRxChannel_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRxChannel_Output_buf2par(UInt8* rxChannel , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetRxChannel_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 rxChannel , UInt16* pIndex); +void gpPd_GetFramePendingAfterTx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetFramePendingAfterTx_Output_buf2par(UInt8* framePending , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetFramePendingAfterTx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 framePending , UInt16* pIndex); +void gpPd_GetTxCCACntr_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxCCACntr_Output_buf2par(UInt8* txCCACntr , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetTxAckLqi_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxAckLqi_Output_buf2par(gpPd_Lqi_t* ackLqi , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_GetFrameControlFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetFrameControlFromTxAckAfterRx_Output_buf2par(UInt16* framePending , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetFrameControlFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16 framePending , UInt16* pIndex); +void gpPd_GetRxEnhancedAckFromTxPbm_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetRxEnhancedAckFromTxPbm_Output_buf2par(Bool* enhancedAck , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetRxEnhancedAckFromTxPbm_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , Bool enhancedAck , UInt16* pIndex); +void gpPd_GetFrameCounterFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetFrameCounterFromTxAckAfterRx_Output_buf2par(UInt32* frameCounter , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetFrameCounterFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt32 frameCounter , UInt16* pIndex); +void gpPd_GetKeyIdFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetKeyIdFromTxAckAfterRx_Output_buf2par(UInt8* keyId , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); +void gpPd_SetKeyIdFromTxAckAfterRx_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt8 keyId , UInt16* pIndex); +void gpPd_GetTxChannel_Input_par2buf(UInt8Buffer* pDest , gpPd_Handle_t pdHandle , UInt16* pIndex); +void gpPd_GetTxChannel_Output_buf2par(UInt8* channel , gpPd_Handle_t pdHandle , UInt8Buffer* pSource , UInt16* pIndex); + +void gpPd_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPPD_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd.h new file mode 100644 index 0000000..1cc56f9 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd.h @@ -0,0 +1,668 @@ +/* + * Copyright (c) 2011-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/** @file "gpPd.h" + * + * Packet Descriptor Implementation + * + * Declarations of the public functions of gpPd. + * + * The Packet Descriptor is a handle to packet memory for RF transmission and reception. + * It holds, next to the data, additional attributes around the received packet. + * The handle is used across RF API's in the Qorvo stack. + * + * For a TX flow, following steps need to be followed: + * - Get a Pd with gpPd_GetPd() (Support for 802.15.4) or gpPd_GetCustomPd() (Support for 802.15.4 and BLE packets) + * - Fill in data to be sent with the gpPd_Write*() functions. + * - Use the handled in the relevant DataRequest API. + * - Free the handle in the DataConfirm of the RF TX request + * + * For a RX flow: + * - The stack will have allocated a Pd handle with all data and attributes filled in. + * - It will be supplied through indication APIs to upper layers + * - That layer can read out data with gpPd_Read*() functions and fetch extra data through gpPd_Get*() + * - After using the Pd, the higher layer needs to free the Pd handle +*/ + +#ifndef _GPPD_H_ +#define _GPPD_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpPd_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include +#ifdef GP_COMP_GPHAL +// inclusion for number of pbms +#include "gpHal_Pbm.h" +#endif //GP_COMP_GPHAL + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_PD_NR_OF_HANDLES +#ifdef GPHAL_NUMBER_OF_PBMS_USED +#define GP_PD_NR_OF_HANDLES GPHAL_NUMBER_OF_PBMS_USED +#else +#define GP_PD_NR_OF_HANDLES 5 +#endif //GPHAL_NUMBER_OF_PBMS_USED +#endif //GP_PD_NR_OF_HANDLES + +/** @brief Handle value indicating an invalid handle. + * Note! + * Use gpPd_CheckPdValid() instead of a direct comparison + * to catch out of range or not in use handles +*/ +#define GP_PD_INVALID_HANDLE 0xFF + +/** @brief Buffer size for 802.15.4 packets */ +#define GP_PD_BUFFER_SIZE_ZIGBEE 128 +/** @brief Buffer size for BLE packets */ +#define GP_PD_BUFFER_SIZE_BLE 256 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @brief Reference handle to a Packet Descriptor. To be used across RF APIs. */ +typedef UInt8 gpPd_Handle_t; +/** @brief Length of data in a Packet Descriptor. */ +typedef UInt16 gpPd_Length_t; +/** @brief Offset in the data buffer of a Packet Descriptor. */ +typedef UInt16 gpPd_Offset_t; +/** @brief Time in us of reception or transmission of the packet. */ +typedef UInt32 gpPd_TimeStamp_t; +/** @brief RSSI (in dBm) of the received packet. */ +typedef Int8 gpPd_Rssi_t; +/** @brief Link Quality indication of the received packet. */ +typedef UInt8 gpPd_Lqi_t; + +/** @name gpPd_Result_t */ +//@{ +/** @brief Given handle is valid. Only allocated handles will be flagged valid. */ +#define gpPd_ResultValidHandle 0x0 +/** @brief Given handle is not valid. Can be out of range. */ +#define gpPd_ResultInvalidHandle 0x1 +/** @brief Given handle is valid but not in use. Handle can be wrong or no longe in use. */ +#define gpPd_ResultNotInUse 0x2 +/** @typedef gpPd_Result_t + * @brief The gpPd_Result_t type defines the result of handle check for validity. +*/ +typedef UInt8 gpPd_Result_t; +//@} + +/** @name gpPd_Result_t */ +//@{ +/** @brief Use a packet buffer with a size suitable for 802.15.4/ZigBee. */ +#define gpPd_BufferTypeZigBee 0x00 +/** @brief Use a packet buffer with a size suitable for BLE. */ +#define gpPd_BufferTypeBle 0x01 +/** @brief Invalid buffer type - used as check. */ +#define gpPd_BufferTypeInvalid 0x02 +/** @typedef gpPd_BufferType_t + * @brief The gpPd_BufferType_t type defines the type of Packet Descriptor the use. +*/ +typedef UInt8 gpPd_BufferType_t; +//@} + +/** @struct gpPd_Loh_t + * @brief Structure grouping information about a part of data to be read out or written. +*/ +typedef struct gpPd_Loh_s { + gpPd_Length_t length; + gpPd_Offset_t offset; + gpPd_Handle_t handle; +} gpPd_Loh_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpPd_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** @brief Initialize gpPd component. This will init all internal data structures */ +void gpPd_Init(void); + +/** @brief De-initializes gpPd component. */ +void gpPd_DeInit(void); + +//Descriptor handling +/** @brief Return a handle to use for packet construction and transmission + * This function will return a gpPd_BufferTypeZigBee. + * See gpPd_GetCustomPd() for other buffer types (BLE). + * + * @return pdHandle Handle as reference for use with the packet memory througout other APIs. + * GP_PD_INVALID_HANDLE will be returned if no handles are available. +*/ +gpPd_Handle_t gpPd_GetPd(void); + +/** @brief Return a handle to use for a specific packet buffer type. + * + * @param type Buffer type requested. Possible types listed in gpPd_BufferType_t. + * @param size Buffer size needed for the requested packet. Size must align with the request type (ZB/BLE/BLE XL). + * + * @return pdHandle Handle as reference for use with the packet memory througout other APIs. + * Will return GP_PD_INVALID_HANDLE in the following cases: + * - no handles are available. + * - no buffers with the requested size are available + * - requested size is not valid for the selected type. +*/ +gpPd_Handle_t gpPd_GetCustomPd(gpPd_BufferType_t type, UInt16 size); + +/** @brief Release a Pd handle and it's associated memory after use. + * + * Pd handle can be freed, allowing it and his associated memory to be re-used by the application (Tx) or HW (Rx). + * It is expected the handles are not kept for long durations, not to block the ability to send or receive new packets. + * The recommentation is the copy all needed information in a short lifespan. + * Note that accessing the handle after freeing is an illegal operation. + * + * @param pdHandle Handle referring to Tx or Rx buffer used. +*/ +void gpPd_FreePd(gpPd_Handle_t pdHandle); + +/** @brief Copy all contents of a Packet Descriptor to a new one. + * + * This function can be used when distributing a packet over multiple upper layers. + * + * @param pdHandle Handle to copy all information from + * + * @return newHandle New handle to copied content. + * Will return GP_PD_INVALID_HANDLE in the following case: + * - no handles are available with the same type +*/ +gpPd_Handle_t gpPd_CopyPd(gpPd_Handle_t pdHandle); + +/** @brief Lookup pd handle by PBM. + * + * + * @param pdHandle Handle referring to Tx or Rx buffer used. +*/ +gpPd_Handle_t gpPd_GetPdFromPBM(UInt8 pbmHandle); + +/** @brief Check if the Pd is valid. + * To be used to check a fetched Pd. + * This function is advised to be used opposed to comparing against GP_PD_INVALID_HANDLE as more checks are performed. + * + * @param pdHandle Handle fetched or received. + * @return result Can return the following: + - gpPd_ResultValidHandle if it's in range of possible handle values. + - gpPd_ResultInvalidHandle if the handle is outside the possible range. + - gpPd_ResultNotInUse if the handle is not considered claimed (fi when feeding an unfetched but valid handle value). +*/ +gpPd_Result_t gpPd_CheckPdValid(gpPd_Handle_t pdHandle); + +/** @brief Check if the Pd is valid. + * + * @param pdHandle Handle referring to buffer. + * @return type Buffer type of gpPd_BufferType_t pertaining to the given handle. +*/ +gpPd_BufferType_t gpPd_GetPdType(gpPd_Handle_t pdHandle); + +//Data handling +/** @brief Read one byte from a Pd buffer. + * + * @param pdHandle Handle associated with the packet buffer. + * @param offset Offset to location in buffer to read from. + * @return byte Byte read out @ offset. +*/ +UInt8 gpPd_ReadByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset); + +/** @brief Write one byte to a Pd buffer. + * + * @param pdHandle Handle associated with the packet buffer. + * @param offset Offset to location in buffer to write to. + * @param byte Byte to write @ offset. +*/ +void gpPd_WriteByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 byte); + +/** @brief Read a bytestream from a Pd buffer. + * + * @param pdHandle Handle associated with the packet buffer. + * @param offset Offset to location in buffer to start read from. + * @param length Length to read. + * @return pData Pointer to buffer for bytes read out @ offset. +*/ +void gpPd_ReadByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData); + +/** @brief Write a bytestream to a Pd buffer. + * + * @param pdHandle Handle associated with the packet buffer. + * @param offset Offset to location in buffer to start write operation. + * @param length Length to write. + * @return pData Pointer to buffer of bytes written @ offset. +*/ +void gpPd_WriteByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData); + +//Data handling with update of pdLoh +/** @brief Append a bytestream to a Pd buffer and update the pdLoh structure. + * + * @param pPdLoh Pointer to Length,Offset,Handle associated with the packet buffer. + * @param length Length to write. + * @param pData Pointer to buffer of bytes written @ Offset (in pdLoh structure). +*/ +void gpPd_AppendWithUpdate(gpPd_Loh_t* pPdLoh, UInt8 length, UInt8 const* pData); + +/** @brief Prepend a bytestream to a Pd buffer and update the pdLoh structure. + * Typically used to add header information in front of payload bytes of higher layers. + * + * @param pPdLoh Pointer to Length,Offset,Handle associated with the packet buffer. + * @param length Length to write. + * @param pData Pointer to buffer of bytes written @ Offset (in pdLoh structure). +*/ +void gpPd_PrependWithUpdate(gpPd_Loh_t* pPdLoh, UInt8 length, UInt8 const* pData); + +/** @brief Read a bytestream from a Pd buffer and update the pdLoh structure. + * Typically used to scroll through bytes in a Pd. + * + * @param pPdLoh Pointer to Length,Offset,Handle associated with the packet buffer. + * @param length Length to read. + * @param pData Pointer to buffer for bytes read out @ Offset (in pdLoh structure). +*/ +void gpPd_ReadWithUpdate(gpPd_Loh_t* pPdLoh, UInt8 length, UInt8* pData); + +//Properties handling +//Rx +/** @brief Return the Relative Signal Strength Indication (RSSI) of the received packet. + * + * @param pdHandle Handle associated with the packet buffer. + * @return rssi RSSI value in dBm. +*/ +gpPd_Rssi_t gpPd_GetRssi(gpPd_Handle_t pdHandle); + +/** @brief Return the Link Quality Indication (LQI) of the received packet. + * + * @param pdHandle Handle associated with the packet buffer. + * @return lqi LQI value (as specified in 802.15.4 PHY specification). +*/ +gpPd_Lqi_t gpPd_GetLqi(gpPd_Handle_t pdHandle); + +/** @brief Return the timestamp of the received packet. + * + * @param pdHandle Handle associated with the packet buffer. + * @return timestamp Timestamp in us, taken from the timebase of the OS (hal timing). +*/ +gpPd_TimeStamp_t gpPd_GetRxTimestamp(gpPd_Handle_t pdHandle); + +/** @brief Return the timestamp of the received packet taken from the chip HW timer. + * + * @param pdHandle Handle associated with the packet buffer. + * @return timestamp Timestamp in us, taken from the timer of the chip HW (gpHal timing). + * The timestamp will be equivalent to gpPd_GetRxTimestamp() when running fully embedded (no transceiver setup). +*/ +gpPd_TimeStamp_t gpPd_GetRxTimestampChip(gpPd_Handle_t pdHandle); + +/** @brief Return the channel on which the packet was received. + * + * @param pdHandle Handle associated with the packet buffer. + * @return rxChannel Channel on which the packet was received. + * +*/ +UInt8 gpPd_GetRxChannel(gpPd_Handle_t pdHandle); + +/** @brief Return the buffer of BLE phase samples of the received packet. + * + * @param pdHandle Handle associated with the packet buffer. + * @return pSamples Pointer to the received phase samples. + * NULL if not available and valid untill free of the pdHandle. +*/ +UInt16* gpPd_GetPhaseSamplesBuffer(gpPd_Handle_t pdHandle); + +//TxConfirm +/** @brief Return the timestamp of a transmitted packet. + * + * @param pdHandle Handle associated with the packet. + * @return timestamp Timestamp in us at which the packet was sent, taken from the timebase of the OS (hal timing). +*/ +gpPd_TimeStamp_t gpPd_GetTxTimestamp(gpPd_Handle_t pdHandle); + +/** @brief Return the timestamp of a transmitted packet. + * + * @param pdHandle Handle associated with the packet. + * @return channel The last channel at which the packet was sent +*/ +UInt8 gpPd_GetTxChannel(gpPd_Handle_t pdHandle); + +/** @brief Return the Link Quality Indication (LQI) of the ACK for the transmitted packet. + * + * @param pdHandle Handle associated with the packet. + * @return lqi LQI value of the received ACK - only valid when there was an ACK present. +*/ +gpPd_Lqi_t gpPd_GetTxAckLqi(gpPd_Handle_t pdHandle); + +/** @brief Return the amount of CCA retries of the transmitted packet + * + * @param pdHandle Handle associated with the packet. + * @return retries Amount of CCA retries performed. +*/ +UInt8 gpPd_GetTxCCACntr(gpPd_Handle_t pdHandle); + +/** @brief Return the amount of MAC retries of the transmitted packet + * + * @param pdHandle Handle associated with the packet. + * @return retries Amount of MAC retries. 0 if the first attempt succeeded. +*/ +UInt8 gpPd_GetTxRetryCntr(gpPd_Handle_t pdHandle); + +/** @brief Return the framepending bit from the ACK of a transmitted packet. + * + * @param pdHandle Handle associated with the packet. + * @return framePending True if the frame pending bit was set in the associated ACK. +*/ +UInt8 gpPd_GetFramePendingAfterTx(gpPd_Handle_t pdHandle); + +/** @brief Returns a bool indicating the reception of an enhanced ack after a transmission of a packet. + * + * @param pdHandle Handle associated with the transmitted packet. + * @return enhancedAck True if the an enhanced ack was received. +*/ +Bool gpPd_GetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle); + +/** @brief Return the framecontrol field from the ACK transmitted after receiving a frame. + * + * @param pdHandle Handle associated with the rx packet. + * @return frameControl The framecontrol field as it was was set in the tx ACK. +*/ +UInt16 gpPd_GetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle); + +/** @brief Get the framecounter for the ACK transmitted after receiving a frame. + * + * This function returns the value of the framecounter on a Tx Ack. + * @param pdHandle Handle associated with the rx packet. + * @return frameCounter The framecounter field used in the Ack frame. +*/ +UInt32 gpPd_GetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle); + +/** @brief Get the keyid field for the ACK transmitted after receiving a frame. + * + * This function returns the value of the keyid field on a Tx Ack. + * @param pdHandle Handle associated with the rx packet. + * @return keyId The keyid field used in the Ack frame. +*/ +UInt8 gpPd_GetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle); + +//Internal Helper functions + +/****************************** + * Rx Flow fill-in + ******************************/ +/** @brief Function to fill in RSSI value during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param rssi RSSI value (in dBm) +*/ +void gpPd_SetRssi(gpPd_Handle_t pdHandle, gpPd_Rssi_t rssi); + +/** @brief Function to fill in LQI value during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param lqi LQI value. +*/ +void gpPd_SetLqi(gpPd_Handle_t pdHandle, gpPd_Lqi_t lqi); + +/** @brief Function to fill in timestamp value during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param timestamp Time of reception (in us) of the associated packet. +*/ +void gpPd_SetRxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp); + +/** @brief Function to fill in channel on which packet was received during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param rxChannel Channel on which packet was received. + * 802.15.4 or BLE channel range will be filled in according to the type of Pd. +*/ +void gpPd_SetRxChannel(gpPd_Handle_t pdHandle, UInt8 rxChannel); + +/** @brief Function to fill in FrameControl of Ack sent during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param frameControl 802.15.4 frame control field of the ACK sent out in response of packet. +*/ +void gpPd_SetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt16 frameControl); + +/** @brief Function to fill in FrameCounter of Ack sent during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param frameCounter 802.15.4 security frame counter field of the ACK sent out in response of packet. +*/ +void gpPd_SetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt32 frameCounter); + +/** @brief Function to fill in KeyId for Ack sent during processing of an incoming packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the rx packet. + * @param keyId 802.15.4 security key Id used for the ACK sent out in response of packet. +*/ +void gpPd_SetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt8 keyId); + +/****************************** + * Tx Flow fill-in + ******************************/ +/** @brief Function to fill in timestamp during processing of an confirm of a sent packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the Tx packet. + * @param timestamp Time of Tx (in us) of the associated packet. +*/ +void gpPd_SetTxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp); + +/** @brief Function to fill in the retry count during processing of an confirm of a sent packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the Tx packet. + * @param txRetryCntr Retry count of the transmit. +*/ +void gpPd_SetTxRetryCntr(gpPd_Handle_t pdHandle, UInt8 txRetryCntr); + +/** @brief Function to fill in the frame pending bit of the ack during processing of an confirm of a sent packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the Tx packet. + * @param framePending set to @True if the frame pending bit was set in the associated + * ACK.Time of Tx (in us) of the associated packet. +*/ +void gpPd_SetFramePendingAfterTx(gpPd_Handle_t pdHandle, UInt8 framePending); + +/** @brief Function to fill in the ack type during processing of an confirm of a sent packet. + * + * Only to be used by stack when processing incoming packet. + * @param pdHandle Handle associated with the Tx packet. + * @param enhancedAck set to @True if the transmitted frame was acked with an enhanced ack +*/ +void gpPd_SetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle, Bool enhancedAck); + +/****************************** + * Internal stack calls + ******************************/ +//Data +/** @brief Function to prepare a Packet Descriptor for transmission. + * + * Only to be used by stack when processing a packet transmission. + * @param p_PdLoh Pointer to relevant data. + * @return pdHandle Allocated handle for data to be sent. +*/ +UInt8 gpPd_DataRequest(gpPd_Loh_t* p_PdLoh); + +/** @brief Function to prepare a Packet Descriptor after a Tx + * + * Only to be used by stack when processing a packet Tx confirm. + * Will translate HW buffers into a Packet Descriptor + * + * @param pbmHandle HW buffer handle + * @param pbmOffset Offset of the data in the buffer + * @param pbmLength Length of data + * @param[out] p_PdLoh Pointer to output processed Packet Descriptor +*/ +void gpPd_cbDataConfirm(UInt8 pbmHandle, UInt16 pbmOffset, UInt16 pbmLength, gpPd_Loh_t* p_PdLoh); + +/** @brief Function to prepare a Packet Descriptor after a received packet + * + * Only to be used by stack when processing a packet reception. + * Will translate HW buffers into a Packet Descriptor + * + * @param pbmHandle HW buffer handle + * @param pbmOffset Offset of the data in the buffer + * @param pbmLength Length of data + * @param[out] p_PdLoh Pointer to output processed Packet Descriptor + * @param type Type of received data (802.15.4/BLE) +*/ +void gpPd_DataIndication(UInt8 pbmHandle, UInt16 pbmOffset, UInt16 pbmLength, gpPd_Loh_t* p_PdLoh, gpPd_BufferType_t type); + +//Security +/** @brief Function to prepare a Packet Descriptor for a Security operation + * + * Only to be used by stack when processing a security operation. + * Will translate HW buffers into a Packet Descriptor + * + * @param pdHandle Packet Descriptor handle + * @param dataOffset Offset of the data in the buffer + * @param dataLength Length of data + * @param auxOffset Offset of auxiliary security data. Can be part of overal data. + * @param auxLength Length of auxiliary security data + * + * @return pbmHandle HW buffer handle +*/ +UInt8 gpPd_SecRequest(gpPd_Handle_t pdHandle, UInt8 dataOffset, UInt8 dataLength, UInt8 auxOffset, UInt8 auxLength); + +/** @brief Function to prepare a Packet Descriptor after completing a security operation. + * + * Only to be used by stack when processing a security operation. + * Will translate HW buffers into a Packet Descriptor + * + * @param pbmHandle HW buffer handle + * @param dataOffset Offset of the data in the buffer + * @param dataLength Length of data + * + * @return pdHandle Packet Descriptor handle containing processed security operation +*/ +gpPd_Handle_t gpPd_cbSecConfirm(UInt8 pbmHandle, UInt8 dataOffset, UInt8 dataLength); + +//Purge +/** @brief Function to prepare a Packet Descriptor for a Purge operation + * + * Only to be used by stack when processing a purge operation. + * Will translate HW buffers into a Packet Descriptor + * + * @param pdHandle Packet Descriptor handle + * + * @return pbmHandle HW buffer handle +*/ +UInt8 gpPd_PurgeRequest(gpPd_Handle_t pdHandle); + +/** @brief Function to prepare a Packet Descriptor after completing a Purge operation. + * + * Only to be used by stack when processing a purge operation. + * Will finalize work for the operation. + * + * @param pbmHandle HW buffer handle +*/ +void gpPd_cbPurgeConfirm(UInt8 pbmHandle); + + +#include "gpPd_ram.h" + +/****************************** + * Serialization helper functions + ******************************/ + +/** @brief Initialize mapping between incoming and internal handles. + * + * When a serialized component uses Pd handles, the ones used at client side + * are different from the ones managed in the server side. + * A mapping is kept to track the ones from the client to return correct handles + * in any confirm. + * +*/ +void gpPd_InitPdHandleMapping(void); + +/** @brief Store a pair of mapped and new handle + * + * @param newPdHandle Handle taken at server side to store in mapping + * @param pdHandle Handle coming from client side to store + * + * @return success Returns true if mapping was succesfull, false if no space was available. +*/ +Bool gpPd_StorePdHandle(gpPd_Handle_t newPdHandle, gpPd_Handle_t pdHandle); + +/** @brief Retrieve a mapped pdHandle + * + * @param[out] storedPdHandle Pointer to return stored Packet Descriptor handle. + Will return GP_INVALID_HANDLE if not found. + * @param pdHandle Local handle used to look up external handle. + * + * @return success Returns true if operation was succesfull, false if invalid could not be set. +*/ +Bool gpPd_GetStoredPdHandle(gpPd_Handle_t* storedPdHandle, gpPd_Handle_t pdHandle); + +/** @brief Retrieve a mapped pdHandle and remove if necessary + * + * @param newPdHandle Local handle used when storing the external handle. + * @param remove Remove the handle from the mapping if true. + * + * @return pdHandle Returns GP_INVALID_HANDLE if not found. +*/ +gpPd_Handle_t gpPd_RestorePdHandle(gpPd_Handle_t newPdHandle, Bool remove); + +#if defined(GP_COMP_UNIT_TEST) +#include "gpPd_ut.h" +#endif //GP_COMP_UNIT_TEST + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPPD_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd_ram.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd_ram.h new file mode 100644 index 0000000..a25febc --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/inc/gpPd_ram.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPPD_RAM_H_ +#define _GPPD_RAM_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#ifndef GP_PD_BUFFER_SIZE +#define GP_PD_BUFFER_SIZE 0x80 +#endif //GP_PD_BUFFER_SIZE + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ +typedef struct gpPd_RxAttributes_s { + UInt32 rxTimestamp; + UInt32 rxTimestampChip; + gpPd_Rssi_t rssi; + gpPd_Lqi_t lqi; + UInt8 rxChannel; + UInt8 txAckKeyId; + UInt16 txAckFc; + UInt32 txAckFrameCounter; +} gpPd_RxAttributes_t; + +typedef struct gpPd_TxCfmAttributes_s { + UInt32 txTimestamp; + UInt8 lastChannel; + UInt8 txRetryCntr; + UInt8 framePendingFromTxPbm; + UInt8 txCCACntr; + gpPd_Lqi_t ackLqi; + Bool rxEnhancedAck; +} gpPd_TxCfmAttributes_t; + +typedef struct { + gpPd_BufferType_t type; + union { + gpPd_RxAttributes_t rx; + gpPd_TxCfmAttributes_t txcfm; + }attr; + UInt8 buffer[GP_PD_BUFFER_SIZE]; +} gpPd_Descriptor_t; + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + + +#endif // _GPPD_RAM_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c new file mode 100644 index 0000000..17b4452 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gen/gpPd_marshalling.c @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpPd_marshalling.c" + * + * Packet Descriptor interface + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpPd.h" +#include "gpPd_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_PD + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpPd_Loh_t_buf2api(gpPd_Loh_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex , Bool storePdHandle ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + pDest->handle = gpPd_GetPd(); + if(gpPd_ResultValidHandle != gpPd_CheckPdValid(pDest->handle)) + { + return gpMarshall_AckStatusExecutionFailed;/* Failure to allocate handle. */ + } + gpPd_Length_t_buf2api_1(&(pDest->length), pSource, pIndex); + // 0-length parameter offset + pDest->offset = 0; + gpPd_WriteByteStream(pDest->handle, pDest->offset, pDest->length, &(pSource[*pIndex])); + *pIndex += pDest->length; + if(storePdHandle && !gpPd_StorePdHandle(pDest->handle,pSource[*pIndex]))/* sticky client side handle p_PdLoh has to be aasciated with server side handle. */ + { +#ifdef GP_DIVERSITY_LOG + GP_LOG_SYSTEM_PRINTF("handle assoc failed",0); +#endif + /* Failure to associate client and server side handles causes freeing of server side handle... */ +#ifdef GP_COMP_UNIT_TEST + gpPd_FreeRealPd(pDest->handle); +#else + gpPd_FreePd(pDest->handle); +#endif //GP_COMP_UNIT_TEST + /* ...and causes server to indicate failure in acknowledge to client. */ + return gpMarshall_AckStatusExecutionFailed; + } + *pIndex += 1; + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpPd_Loh_t_api2buf(UInt8Buffer* pDest , const gpPd_Loh_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpPd_Length_t_api2buf_1(pDest , &(pSource->length), pIndex); + // 0-length parameter offset + gpPd_ReadByteStream(pSource->handle, pSource->offset, pSource->length, &(pDest[*pIndex])); + *pIndex += pSource->length; +#ifdef GP_COMP_UNIT_TEST + { + gpPd_Handle_t uthandle = gpPd_GetUtPd(pSource->handle); + gpPd_Handle_t_api2buf_1(pDest, &uthandle, pIndex); + } +#else + gpPd_Handle_t_api2buf_1(pDest, &pSource->handle, pIndex); +#endif //GP_COMP_UNIT_TEST + pSource++; + } +} + + +void gpPd_InitMarshalling(void) +{ +/* gpPd_InitMarshalling */ + gpPd_InitPdHandleMapping(); +/* gpPd_InitMarshalling */ +} + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c new file mode 100644 index 0000000..b474c27 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd.c @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + + + +// General includes +#include "gpLog.h" +#include "gpAssert.h" +#include "gpStat.h" + +#include "gpPd.h" +#include "gpPd_marshalling.h" + + + +#define GP_COMPONENT_ID GP_COMPONENT_ID_PD +#define GP_MODULE_ID GP_MODULE_ID_PD + +#include "gpPd_ram.c" +#include "gpPd_common.c" + +//#define GP_LOCAL_LOG + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpPd_Init(void) +{ + Pd_Init(); + gpPd_InitMarshalling(); +} + +void gpPd_DeInit(void) +{ + Pd_DeInit(); + gpPd_Init(); +} + +gpPd_Handle_t gpPd_GetPd(void) +{ + return Pd_GetPd(gpPd_BufferTypeZigBee, GP_PD_BUFFER_SIZE_ZIGBEE); +} + +gpPd_Handle_t gpPd_GetCustomPd(gpPd_BufferType_t type, UInt16 size) +{ + GP_STAT_SAMPLE_TIME(); + return Pd_GetPd(type, size); +} + +void gpPd_FreePd(gpPd_Handle_t pdHandle) +{ + GP_STAT_SAMPLE_TIME(); + Pd_FreePd( pdHandle); +} + +gpPd_Result_t gpPd_CheckPdValid(gpPd_Handle_t pdHandle) +{ + return Pd_CheckPdValid( pdHandle); +} + +gpPd_BufferType_t gpPd_GetPdType(gpPd_Handle_t pdHandle) +{ + return Pd_GetPdType(pdHandle); +} + +UInt8 gpPd_ReadByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset) +{ + return Pd_ReadByte( pdHandle, offset); +} + +void gpPd_WriteByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 byte) +{ + Pd_WriteByte( pdHandle, offset, byte); +} + +void gpPd_ReadByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData) +{ + Pd_ReadByteStream( pdHandle, offset, length, pData); +} + +void gpPd_WriteByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData) +{ + Pd_WriteByteStream( pdHandle, offset, length, pData); +} + +//Convenience functions +void gpPd_AppendWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 const *pData) +{ + Pd_AppendWithUpdate(pPdLoh, length, pData); +} +void gpPd_PrependWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 const *pData) +{ + Pd_PrependWithUpdate(pPdLoh, length, pData); +} +void gpPd_ReadWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 *pData) +{ + Pd_ReadWithUpdate(pPdLoh, length, pData); +} + +//Properties handling + +gpPd_Rssi_t gpPd_GetRssi(gpPd_Handle_t pdHandle) +{ + return Pd_GetRssi(pdHandle); +} + +void gpPd_SetRssi(gpPd_Handle_t pdHandle, gpPd_Rssi_t rssi) +{ + Pd_SetRssi(pdHandle, rssi); +} + +gpPd_Lqi_t gpPd_GetLqi(gpPd_Handle_t pdHandle) +{ + return Pd_GetLqi(pdHandle); +} + +void gpPd_SetLqi(gpPd_Handle_t pdHandle, gpPd_Lqi_t lqi) +{ + Pd_SetLqi(pdHandle, lqi); +} + +gpPd_TimeStamp_t gpPd_GetRxTimestamp(gpPd_Handle_t pdHandle) +{ + return Pd_GetRxTimestamp( pdHandle); +} + +gpPd_TimeStamp_t gpPd_GetRxTimestampChip(gpPd_Handle_t pdHandle) +{ + return Pd_GetRxTimestampChip(pdHandle); +} + +UInt16* gpPd_GetPhaseSamplesBuffer(gpPd_Handle_t pdHandle) +{ + return Pd_GetPhaseSamplesBuffer(pdHandle); +} + +gpPd_TimeStamp_t gpPd_GetTxTimestamp(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxTimestamp( pdHandle); +} + +UInt8 gpPd_GetTxChannel(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxChannel( pdHandle); +} + +void gpPd_SetRxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp) +{ + Pd_SetRxTimestamp(pdHandle, timestamp); +} + +void gpPd_SetTxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp) +{ + Pd_SetTxTimestamp(pdHandle, timestamp); +} + +gpPd_Handle_t gpPd_CopyPd(gpPd_Handle_t pdHandle) +{ + return Pd_CopyPd( pdHandle ); +} + +gpPd_Lqi_t gpPd_GetTxAckLqi(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxAckLqi(pdHandle); +} + +UInt8 gpPd_GetTxCCACntr(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxCCACntr(pdHandle); +} + +UInt8 gpPd_GetTxRetryCntr(gpPd_Handle_t pdHandle) +{ + return Pd_GetTxRetryCntr(pdHandle); +} + +void gpPd_SetTxRetryCntr(gpPd_Handle_t pdHandle, UInt8 txRetryCntr) +{ + Pd_SetTxRetryCntr(pdHandle, txRetryCntr); +} + +UInt8 gpPd_GetFramePendingAfterTx(gpPd_Handle_t pdHandle) +{ + return Pd_GetFramePendingAfterTx(pdHandle); +} + +void gpPd_SetFramePendingAfterTx(gpPd_Handle_t pdHandle, UInt8 framePending) +{ + Pd_SetFramePendingAfterTx(pdHandle, framePending); +} + +Bool gpPd_GetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle) +{ + return Pd_GetRxEnhancedAckFromTxPbm(pdHandle); +} + +void gpPd_SetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle, Bool enhancedAck) +{ + Pd_SetRxEnhancedAckFromTxPbm(pdHandle, enhancedAck); +} + +UInt16 gpPd_GetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + return Pd_GetFrameControlFromTxAckAfterRx(pdHandle); +} + +void gpPd_SetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt16 frameControl) +{ + Pd_SetFrameControlFromTxAckAfterRx(pdHandle, frameControl); +} + + +UInt32 gpPd_GetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + return Pd_GetFrameCounterFromTxAckAfterRx(pdHandle); +} + +void gpPd_SetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt32 frameCounter) +{ + Pd_SetFrameCounterFromTxAckAfterRx(pdHandle, frameCounter); +} + +UInt8 gpPd_GetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + return Pd_GetKeyIdFromTxAckAfterRx(pdHandle); +} + +void gpPd_SetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt8 keyId) +{ + Pd_SetKeyIdFromTxAckAfterRx(pdHandle, keyId); +} + + +UInt8 gpPd_GetRxChannel(gpPd_Handle_t pdHandle) +{ + return Pd_GetRxChannel(pdHandle); +} + +void gpPd_SetRxChannel(gpPd_Handle_t pdHandle, UInt8 rxChannel) +{ + Pd_SetRxChannel(pdHandle, rxChannel); +} + +#if defined(GP_COMP_GPHAL) + +UInt8 gpPd_DataRequest(gpPd_Loh_t *p_PdLoh) +{ + return Pd_DataRequest(p_PdLoh); +} + + +UInt8 gpPd_SecRequest(gpPd_Handle_t pdHandle, UInt8 dataOffset, UInt8 dataLength, UInt8 auxOffset, UInt8 auxLength ) +{ + return Pd_SecRequest(pdHandle, dataOffset, dataLength, auxOffset,auxLength ); +} + +gpPd_Handle_t gpPd_cbSecConfirm(gpPd_Handle_t pbmHandle, UInt8 dataOffset, UInt8 dataLength) +{ + return Pd_cbSecConfirm(pbmHandle, dataOffset, dataLength); +} + +void gpPd_DataIndication(gpPd_Handle_t pbmHandle, UInt16 pbmOffset, UInt16 pbmLength, gpPd_Loh_t *p_PdLoh, gpPd_BufferType_t type) +{ + Pd_DataIndication(pbmHandle, pbmOffset, pbmLength, p_PdLoh, type); +} + +UInt8 gpPd_PurgeRequest(gpPd_Handle_t pdHandle) +{ + return Pd_PurgeRequest(pdHandle); +} + +void gpPd_cbPurgeConfirm(UInt8 pbmHandle) +{ + Pd_cbPurgeConfirm(pbmHandle); +} + +gpPd_Handle_t gpPd_GetPdFromPBM(UInt8 pbmHandle) +{ + return Pd_GetPdFromPBM(pbmHandle); +} +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_common.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_common.c new file mode 100644 index 0000000..78b11f1 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_common.c @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +INLINE static void Pd_AppendWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 const *pData) +{ + if (pPdLoh && length && pData) + { + if (length == 1) + { + Pd_WriteByte(pPdLoh->handle, pPdLoh->offset + pPdLoh->length, *pData); + } + else + { + Pd_WriteByteStream(pPdLoh->handle, pPdLoh->offset + pPdLoh->length, length, (UInt8*)pData); + } + pPdLoh->length += length; + } +} +INLINE static void Pd_PrependWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 const *pData) +{ + if (pPdLoh && length && pData) + { + pPdLoh->offset -= length; + if (length == 1) + { + Pd_WriteByte(pPdLoh->handle, pPdLoh->offset, *pData); + } + else + { + Pd_WriteByteStream(pPdLoh->handle, pPdLoh->offset, length, (UInt8*)pData); + } + pPdLoh->length += length; + } +} + +INLINE static void Pd_ReadWithUpdate(gpPd_Loh_t *pPdLoh, UInt8 length, UInt8 *pData) +{ + if (pPdLoh && length && pData) + { + if (length == 1) + { + *pData = Pd_ReadByte(pPdLoh->handle, pPdLoh->offset); + } + else + { + Pd_ReadByteStream(pPdLoh->handle, pPdLoh->offset, length, pData); + } + pPdLoh->offset += length; + pPdLoh->length -= length; + } +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_ram.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_ram.c new file mode 100644 index 0000000..b0274c5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_ram.c @@ -0,0 +1,868 @@ +/* + * Copyright (c) 2011-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +//#define GP_LOCAL_LOG +#if defined(GP_COMP_GPHAL) +#include "gpHal.h" +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) +#include "gpPoolMem.h" +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +#define PD_CHECK_HANDLE_VALID(pdHandle) (pdHandle < GP_PD_NR_OF_HANDLES) +#define PD_CHECK_HANDLE_IN_USE(pdHandle) (gpPd_Descriptors[pdHandle]) +#define PD_CHECK_HANDLE_ACCESSIBLE(pdHandle) (PD_CHECK_HANDLE_VALID(pdHandle) && PD_CHECK_HANDLE_IN_USE(pdHandle)) + +/** @brief Check a given buffer type is valid + * + * @param type Pd buffer type to check +*/ +#define GP_PD_IS_BUFFERTYPE_VALID(type) (type < gpPd_BufferTypeInvalid) + +#define PBM_CHECK_HANDLE_ACCESSIBLE(PbmHandle) (GP_HAL_CHECK_PBM_VALID(PbmHandle) && GP_HAL_IS_PBM_ALLOCATED(PbmHandle)) + +// Only allowed for ZigBee pds +#define PD_WRAP_OFFSET(offset) (offset &= 0x7f) +#if defined(GP_COMP_GPHAL) +#define PD_TMP_SIZE 128 +#endif // defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) + +#define PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle) do { \ + if(!PD_CHECK_HANDLE_ACCESSIBLE(pdHandle)) \ + { \ + GP_ASSERT_DEV_EXT(false); \ + return; \ + } \ +} while(false) + +#define PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, retVal) do { \ + if(!PD_CHECK_HANDLE_ACCESSIBLE(pdHandle)) \ + { \ + GP_ASSERT_DEV_EXT(false); \ + return retVal; \ + } \ +} while(false) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +//Pointers to Packet buffers and meta-data +gpPd_Descriptor_t* gpPd_Descriptors[GP_PD_NR_OF_HANDLES]; + +#if defined(GP_COMP_GPHAL) +// lookup table to bind a PD to a PBM +static gpPd_Handle_t Pd_Pbm2pd[GPHAL_NUMBER_OF_PBMS_USED]; +static UInt8 Pd_NmbrOfPbmsClaimedBySw; +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +#if defined(GP_COMP_GPHAL) +static void Pd_RestoreFromPbm(UInt8 pbmHandle, UInt8 pbmOffset, UInt8 pbmLength, gpPd_Handle_t pdHandle); +static void Pd_CopyToPbm(UInt8 pbmHandle, UInt8 offset, UInt8 length); +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +static void Pd_Init(void); +static void Pd_DeInit(void); + +//Descriptor handling +static gpPd_Handle_t Pd_GetPd(gpPd_BufferType_t type, UInt16 size); +static void Pd_FreePd(gpPd_Handle_t pdHandle); +static gpPd_Result_t Pd_CheckPdValid(gpPd_Handle_t pdHandle); +static gpPd_BufferType_t Pd_GetPdType(gpPd_Handle_t pdHandle); +#if defined(GP_COMP_GPHAL) +static UInt8 Pd_GetPBM(UInt8 pdHandle); +static UInt8 Pd_AllocatePBM(gpPd_Handle_t pdHandle,UInt16 size); +#endif + +//Data handling +static UInt8 Pd_ReadByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset); +static void Pd_WriteByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 byte); +static void Pd_ReadByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData); +static void Pd_WriteByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData); + +//Properties handling +static gpPd_Rssi_t Pd_GetRssi(gpPd_Handle_t pdHandle); +static void Pd_SetRssi(gpPd_Handle_t pdHandle, gpPd_Rssi_t rssi); +static gpPd_Lqi_t Pd_GetLqi(gpPd_Handle_t pdHandle); +static void Pd_SetLqi(gpPd_Handle_t pdHandle, gpPd_Lqi_t lqi); +static UInt32 Pd_GetRxTimestamp(gpPd_Handle_t pdHandle); +static UInt32 Pd_GetRxTimestampChip(gpPd_Handle_t pdHandle); +static void Pd_SetRxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp); +static UInt32 Pd_GetTxTimestamp(gpPd_Handle_t pdHandle); +static UInt8 Pd_GetTxChannel(gpPd_Handle_t pdHandle); +static UInt16* Pd_GetPhaseSamplesBuffer(gpPd_Handle_t pdHandle); +static UInt8 Pd_GetTxRetryCntr(gpPd_Handle_t pdHandle); +static void Pd_SetFramePendingAfterTx(gpPd_Handle_t pdHandle, UInt8 framePending); +static UInt8 Pd_GetFramePendingAfterTx(gpPd_Handle_t pdHandle); + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +static void Pd_Init(void) +{ + UInt8 i; + + for(i = 0; i < GP_PD_NR_OF_HANDLES; i++) + { + gpPd_Descriptors[i] = NULL; + } + //Cleanup lookup table +#if defined(GP_COMP_GPHAL) + Pd_NmbrOfPbmsClaimedBySw=0; + for(i = 0; i < GPHAL_NUMBER_OF_PBMS_USED; i++) + { + Pd_Pbm2pd[i] = GP_PD_INVALID_HANDLE; + } +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) +#ifdef GP_COMP_UNIT_TEST + gpPd_InitUnit(); +#endif // GP_COMP_UNIT_TEST +} + +static void Pd_DeInit(void) +{ + UInt8 i; + + for(i = 0; i < GP_PD_NR_OF_HANDLES; i++) + { + if(gpPd_Descriptors[i] != NULL) + { + Pd_FreePd(i); + } + } +} + +static gpPd_Handle_t Pd_AllocatePdHandle(void) +{ + gpPd_Handle_t pdHandle; + for(pdHandle = 0; pdHandle < GP_PD_NR_OF_HANDLES; pdHandle++) + { + if(!PD_CHECK_HANDLE_IN_USE(pdHandle)) + { + return pdHandle; + } + } + return GP_PD_INVALID_HANDLE; +} + +#if defined(GP_COMP_GPHAL) +static UInt8 Pd_AllocatePBM(gpPd_Handle_t pdHandle,UInt16 size) +{ + UInt8 pbmHandle; + pbmHandle = gpHal_GetHandle(size); + if(!GP_HAL_CHECK_PBM_VALID(pbmHandle)) + { + return GP_PBM_INVALID_HANDLE; + } + Pd_NmbrOfPbmsClaimedBySw++; + Pd_Pbm2pd[pbmHandle] = pdHandle; + return pbmHandle; +} +#endif + +void* Pd_AllocatePdMemory(gpPd_Handle_t pdHandle, gpPd_BufferType_t type) +{ + UInt16 mallocsize; + if (gpPd_BufferTypeBle == type) + { + /* allocate struct with buffer size for BLE packets */ + mallocsize = sizeof(gpPd_Descriptor_t)-GP_PD_BUFFER_SIZE+GP_PD_BUFFER_SIZE_BLE; + } + else + { + mallocsize = sizeof(gpPd_Descriptor_t); + } + return GP_POOLMEM_MALLOC(mallocsize); +} + +static gpPd_Handle_t Pd_GetPd(gpPd_BufferType_t type, UInt16 size) +{ + gpPd_Handle_t pdHandle = 0; + + if(!GP_PD_IS_BUFFERTYPE_VALID(type)) + { + GP_LOG_SYSTEM_PRINTF("inv 1",0); + return GP_PD_INVALID_HANDLE; + } + + + if(type == gpPd_BufferTypeZigBee) + { + // Make sure size is always 128 when using ZigBee, since current PD ram has only support for one size for all PDs + GP_ASSERT_DEV_EXT(GP_PD_BUFFER_SIZE == 0x80); + } + pdHandle = Pd_AllocatePdHandle(); + if (pdHandle == GP_PD_INVALID_HANDLE) + { + GP_LOG_PRINTF("G 0xFF",0); + return GP_PD_INVALID_HANDLE; + } + + + gpPd_Descriptors[pdHandle] = Pd_AllocatePdMemory(pdHandle, type); + + if (!gpPd_Descriptors[pdHandle]) + { + GP_LOG_SYSTEM_PRINTF("No mem for Pd found",0); + return GP_PD_INVALID_HANDLE; + } + + gpPd_Descriptors[pdHandle]->type = type; + return pdHandle; + +} + +static void Pd_FreePd(gpPd_Handle_t pdHandle) +{ + GP_LOG_PRINTF("F %i",0,(UInt16)pdHandle); + + if (pdHandle == GP_PD_INVALID_HANDLE) + { + return; + } + + if (( pdHandle < GP_PD_NR_OF_HANDLES ) && gpPd_Descriptors[pdHandle] != NULL ) + { + gpPoolMem_Free(gpPd_Descriptors[pdHandle]); + gpPd_Descriptors[pdHandle] = NULL; +#if defined(GP_COMP_GPHAL) + { + UInt8 pbmHandle; + for(pbmHandle = 0; pbmHandle < GPHAL_NUMBER_OF_PBMS_USED; pbmHandle++) + { + if(Pd_Pbm2pd[pbmHandle] == pdHandle) + { + Pd_Pbm2pd[pbmHandle] = GP_PD_INVALID_HANDLE; + } + } + } +#endif + + + return; + } + else + { + GP_ASSERT_DEV_EXT(false); //Make no fun about freeing unused handles! + } +} +#if defined(GP_COMP_GPHAL) +static void Pd_FreePBM(UInt8 pbmHandle) +{ + GP_ASSERT_DEV_EXT(Pd_NmbrOfPbmsClaimedBySw); + Pd_NmbrOfPbmsClaimedBySw--; + gpHal_FreeHandle(pbmHandle); + Pd_Pbm2pd[pbmHandle] = GP_PD_INVALID_HANDLE; +#if defined(GP_COMP_UNIT_TEST) + if( Pd_NmbrOfPbmsClaimedBySw == 0 ) + { + gpHal_GoToSleepWhenIdle(true); + } +#endif // GP_DIVERSITY_GPHAL_EXTERN +} + +static UInt8 Pd_GetPBM( UInt8 pdHandle ) +{ + UInt8 pbmHandle; + + GP_ASSERT_DEV_EXT(PD_CHECK_HANDLE_ACCESSIBLE(pdHandle)); + + //Check if pdHandle is already in table + for(pbmHandle = 0; pbmHandle < GPHAL_NUMBER_OF_PBMS_USED; pbmHandle++) + { + if(Pd_Pbm2pd[pbmHandle] == pdHandle) + { + //Would indicate duplicate use of handle for request + GP_LOG_SYSTEM_PRINTF("pbm %u<>handle %u exists",0, pbmHandle, pdHandle); + GP_ASSERT_DEV_EXT(false); + return GP_PBM_INVALID_HANDLE; + } + } +#if defined(GP_COMP_UNIT_TEST) + if(Pd_NmbrOfPbmsClaimedBySw == 0) + { + gpHal_GoToSleepWhenIdle(false); + } +#endif // GP_DIVERSITY_GPHAL_EXTERN + //Allocate PBM +//#warning implement size for gppd ram - SW-4772 + pbmHandle = Pd_AllocatePBM(pdHandle, PD_TMP_SIZE); + if(!GP_HAL_CHECK_PBM_VALID(pbmHandle)) + { +#if defined(GP_COMP_UNIT_TEST) + if(Pd_NmbrOfPbmsClaimedBySw == 0) + { + gpHal_GoToSleepWhenIdle(true); + } +#endif // GP_DIVERSITY_GPHAL_EXTERN + return GP_PBM_INVALID_HANDLE; + } + + return pbmHandle; +} + +gpPd_Handle_t Pd_GetPdFromPBM(UInt8 pbmHandle) +{ + //Protect out of range access + if(pbmHandle >= GPHAL_NUMBER_OF_PBMS_USED) + { + return GP_PD_INVALID_HANDLE; + } + + return Pd_Pbm2pd[pbmHandle]; +} +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) + +static gpPd_Result_t Pd_CheckPdValid(gpPd_Handle_t pdHandle) +{ + gpPd_Result_t result = gpPd_ResultValidHandle; + + if(!PD_CHECK_HANDLE_VALID(pdHandle)) + { + result = gpPd_ResultInvalidHandle; + } + else if(!PD_CHECK_HANDLE_IN_USE(pdHandle)) + { + result = gpPd_ResultNotInUse; + } + GP_LOG_PRINTF("Chck %i %i",0,(UInt16)pdHandle, (UInt16)result); + + return result; +} + +gpPd_BufferType_t Pd_GetPdType(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, gpPd_BufferTypeInvalid); + return gpPd_Descriptors[pdHandle]->type; +} + +//------------------------------ +// Data +//------------------------------ + +static UInt8 Pd_ReadByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset) +{ + GP_LOG_PRINTF("R %i %i",0,(UInt16)pdHandle, (UInt16)offset); + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0xFF); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(offset); + } + + return gpPd_Descriptors[pdHandle]->buffer[offset]; +} + +static void Pd_WriteByte(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 byte) +{ + GP_LOG_PRINTF("W %i %i %x access %x",0,(UInt16)pdHandle, (UInt16)offset, (UInt16)byte, PD_CHECK_HANDLE_ACCESSIBLE(pdHandle) ); + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(offset); + } + + gpPd_Descriptors[pdHandle]->buffer[offset] = byte; +} + +static void Pd_ReadByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData) +{ + UInt8 splitlength = 0; + GP_LOG_PRINTF("RS %i %i %i",0,(UInt16)pdHandle, (UInt16)offset, (UInt16)length); + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(offset); + // Out of bounds: 2 times memcpy (before and after cyclic part) + if(offset + length > GP_PD_BUFFER_SIZE) + { + // split in 2 + splitlength = (length + offset) - GP_PD_BUFFER_SIZE ; + // read first part of pd and copy it to second part of pData + MEMCPY( &pData[length-splitlength] , &gpPd_Descriptors[pdHandle]->buffer[0] , splitlength); + } + } + + // write first part or full part + MEMCPY( pData , &gpPd_Descriptors[pdHandle]->buffer[offset] , length-splitlength); +} + +static void Pd_WriteByteStream(gpPd_Handle_t pdHandle, gpPd_Offset_t offset, UInt8 length, UInt8* pData) +{ + UInt8 splitlength = 0; + GP_LOG_PRINTF("WS %i %i %i",0,(UInt16)pdHandle, (UInt16)offset, (UInt16)length); + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(offset); + // Out of bounds: 2 times memcpy (before and after cyclic part) + if(offset + length > GP_PD_BUFFER_SIZE) + { + // split in 2 + splitlength = (length + offset) - GP_PD_BUFFER_SIZE ; + // write second part of pData to first part of pd. + // to address 0, , from &pData[length-splitLength] , splitLength + MEMCPY(&gpPd_Descriptors[pdHandle]->buffer[0] , &pData[length-splitlength] , splitlength); + } + } + + // write first part or full part + MEMCPY(&gpPd_Descriptors[pdHandle]->buffer[offset], pData, length-splitlength); +} + +//------------------------------ +// Attributes +//------------------------------ + +static gpPd_Rssi_t Pd_GetRssi(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.rssi; +} + +static void Pd_SetRssi(gpPd_Handle_t pdHandle, gpPd_Rssi_t rssi) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.rssi = rssi; +} + +static gpPd_Lqi_t Pd_GetLqi(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.lqi; +} + +static void Pd_SetLqi(gpPd_Handle_t pdHandle, gpPd_Lqi_t lqi) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.lqi = lqi; +} + +static UInt32 Pd_GetRxTimestamp(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.rxTimestamp; +} + +static UInt32 Pd_GetRxTimestampChip(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.rxTimestampChip; +} + +static void Pd_SetRxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.rxTimestamp = timestamp; +} + +static UInt32 Pd_GetTxTimestamp(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.txTimestamp; +} + +static void Pd_SetTxTimestamp(gpPd_Handle_t pdHandle, gpPd_TimeStamp_t timestamp) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.txcfm.txTimestamp = timestamp; +} + +static UInt8 Pd_GetTxChannel(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.lastChannel; +} + +static UInt16* Pd_GetPhaseSamplesBuffer(gpPd_Handle_t pdHandle) +{ + NOT_USED(pdHandle); + return NULL; +} + +static gpPd_Lqi_t Pd_GetTxAckLqi(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.ackLqi; +} + +static UInt8 Pd_GetTxCCACntr(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.txCCACntr; +} + +static UInt8 Pd_GetTxRetryCntr(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.txRetryCntr; + +} + +static void Pd_SetTxRetryCntr(gpPd_Handle_t pdHandle, UInt8 txRetryCntr) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.txcfm.txRetryCntr = txRetryCntr; +} + +static UInt8 Pd_GetFramePendingAfterTx(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.framePendingFromTxPbm; +} + +static void Pd_SetFramePendingAfterTx(gpPd_Handle_t pdHandle, UInt8 framePending) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.txcfm.framePendingFromTxPbm = framePending; +} + +static Bool Pd_GetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.txcfm.rxEnhancedAck; +} + +static void Pd_SetRxEnhancedAckFromTxPbm(gpPd_Handle_t pdHandle, Bool enhancedAck) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.txcfm.rxEnhancedAck = enhancedAck; +} + +static UInt16 Pd_GetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.txAckFc; +} + +static void Pd_SetFrameControlFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt16 frameControl) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.txAckFc = frameControl; +} + +static UInt32 Pd_GetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.txAckFrameCounter; +} + +static void Pd_SetFrameCounterFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt32 frameCounter) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.txAckFrameCounter = frameCounter; +} + +static UInt8 Pd_GetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.txAckKeyId; +} + +static void Pd_SetKeyIdFromTxAckAfterRx(gpPd_Handle_t pdHandle, UInt8 keyId) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.txAckKeyId = keyId; +} + +static UInt8 Pd_GetRxChannel(gpPd_Handle_t pdHandle) +{ + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, 0); + return gpPd_Descriptors[pdHandle]->attr.rx.rxChannel; + +} + +static void Pd_SetRxChannel(gpPd_Handle_t pdHandle, UInt8 rxChannel) +{ + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + gpPd_Descriptors[pdHandle]->attr.rx.rxChannel = rxChannel; + +} +//------------------------------ +// Helper functions +//------------------------------ + +static gpPd_Handle_t Pd_CopyPd(gpPd_Handle_t pdHandle) +{ + gpPd_Handle_t pdHandleCopy; + + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, GP_PD_INVALID_HANDLE); + pdHandleCopy = gpPd_GetPd(); + if(pdHandleCopy != GP_PD_INVALID_HANDLE ) + { + MEMCPY( &gpPd_Descriptors[pdHandleCopy]->attr, &gpPd_Descriptors[pdHandle]->attr, sizeof(gpPd_Descriptors[pdHandle]->attr)); + MEMCPY( gpPd_Descriptors[pdHandleCopy]->buffer, gpPd_Descriptors[pdHandle]->buffer, GP_PD_BUFFER_SIZE); + } + return pdHandleCopy; +} + +#if defined(GP_COMP_GPHAL) +static void Pd_RestoreFromPbm(UInt8 pbmHandle, UInt8 pbmOffset, UInt8 pbmLength, gpPd_Handle_t pdHandle) +{ + gpHal_Address_t address; + UInt8 splitlength = 0; + + address = GP_HAL_PBM_ENTRY2ADDR(pbmHandle); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(pbmOffset); + // copy PBM -> RAM + // if PBM is cyclic PD should also be cyclic (exact copy): Copy to 2 parts + if(pbmOffset + pbmLength > GP_PD_BUFFER_SIZE) + { + // split in 2 + splitlength = (pbmOffset + pbmLength) - GP_PD_BUFFER_SIZE; + GP_HAL_READ_DATA_IN_PBM(address, gpPd_Descriptors[pdHandle]->buffer, splitlength, 0); + } + } + + // write first part or full part + GP_HAL_READ_DATA_IN_PBM(address, &gpPd_Descriptors[pdHandle]->buffer[pbmOffset], (pbmLength - splitlength), pbmOffset); +} + +static void Pd_CopyToPbm(UInt8 pbmHandle, UInt8 offset, UInt8 length) +{ + UInt8 splitLength = 0; + gpPd_Handle_t pdHandle; + gpHal_Address_t address = GP_HAL_PBM_ENTRY2ADDR(pbmHandle); + + pdHandle = Pd_GetPdFromPBM(pbmHandle); + GP_ASSERT_DEV_EXT(PD_CHECK_HANDLE_ACCESSIBLE(pdHandle)); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + if(offset + length > GP_PD_BUFFER_SIZE) + {// split in 2 + splitLength = (offset + length) - GP_PD_BUFFER_SIZE; + GP_HAL_WRITE_DATA_IN_PBM(address, gpPd_Descriptors[pdHandle]->buffer, splitLength, 0); + } + } + + // write first part or full part + GP_HAL_WRITE_DATA_IN_PBM(address, &gpPd_Descriptors[pdHandle]->buffer[offset], length-splitLength,offset); +} + +//-------------------- +// Request/indications +//-------------------- + +static UInt8 Pd_DataRequest(gpPd_Loh_t *p_PdLoh) +{ + UInt8 pbmHandle; + GP_ASSERT_DEV_EXT(p_PdLoh); + + pbmHandle = Pd_GetPBM(p_PdLoh->handle); + if(!GP_HAL_CHECK_PBM_VALID(pbmHandle)) + { + return GP_PD_INVALID_HANDLE; + } + + if(gpPd_Descriptors[p_PdLoh->handle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(p_PdLoh->offset); + } + { + // Copy RAM -> PBM + Pd_CopyToPbm(pbmHandle,p_PdLoh->offset,p_PdLoh->length); + } + + return pbmHandle; +} + + + +static void Pd_DataIndication(UInt8 pbmHandle, gpPd_Offset_t pbmOffset, gpPd_Length_t pbmLength, gpPd_Loh_t *p_PdLoh, gpPd_BufferType_t type) +{ + GP_ASSERT_DEV_EXT(p_PdLoh); + // get RAM PD + // This should be the max RX size (chip dependent) + + { + p_PdLoh->handle = Pd_GetPd(type, GP_PD_BUFFER_SIZE); + } + + if( p_PdLoh->handle != GP_PD_INVALID_HANDLE ) + { + gpPd_TimeStamp_t rxTimeStampChip; + gpPd_TimeStamp_t currentChipTime; + UInt32 currentHostTime; + + gpPd_Descriptors[p_PdLoh->handle]->type = type; + + // Copy PBM -> RAM + Pd_RestoreFromPbm(pbmHandle, pbmOffset, pbmLength, p_PdLoh->handle); + p_PdLoh->offset = pbmOffset; + p_PdLoh->length = pbmLength; + + // copy LQI, RSSI, rx channel + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.lqi = gpHal_GetLQI(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.rssi = gpHal_GetRSSI(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.rxChannel = gpHal_GetRxedChannel(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.txAckFc = gpHal_GetFrameControlFromTxAckAfterRx(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.txAckKeyId = gpHal_GetKeyIdFromTxAckAfterRx(pbmHandle); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.txAckFrameCounter = gpHal_GetFrameCounterFromTxAckAfterRx(pbmHandle); + + // Get timestamp + correct + gpHal_GetRxTimestamp(pbmHandle, &rxTimeStampChip); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.rxTimestampChip = rxTimeStampChip; + + // convert "chip time basis" to "host time basis" + gpHal_GetTime(¤tChipTime); + HAL_TIMER_GET_CURRENT_TIME_1US(currentHostTime); + gpPd_Descriptors[p_PdLoh->handle]->attr.rx.rxTimestamp = currentHostTime - (currentChipTime - rxTimeStampChip); + + } + { + // Free PBM + gpHal_FreeHandle(pbmHandle); + } +} + +static UInt8 Pd_SecRequest(gpPd_Handle_t pdHandle, UInt8 dataOffset, UInt8 dataLength, UInt8 auxOffset, UInt8 auxLength ) +{ + UInt8 pbmHandle; + + //Allocate PBM + pbmHandle = Pd_GetPBM(pdHandle); + if(!GP_HAL_CHECK_PBM_VALID(pbmHandle)) + { + return GP_PBM_INVALID_HANDLE; + } + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(dataOffset); + PD_WRAP_OFFSET(auxOffset); + } + + if(dataLength > 0) + { + //Copy data + Pd_CopyToPbm(pbmHandle,dataOffset,dataLength); + } + if(auxLength > 0) + { + //Copy aux + Pd_CopyToPbm(pbmHandle,auxOffset,auxLength); + } + return pbmHandle; +} + +static gpPd_Handle_t Pd_cbSecConfirm(UInt8 pbmHandle, UInt8 dataOffset, UInt8 dataLength) +{ + // Get previous claimed RAM PD + gpPd_Handle_t pdHandle; + + pdHandle = Pd_GetPdFromPBM(pbmHandle); + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, GP_PD_INVALID_HANDLE); + + if(gpPd_Descriptors[pdHandle]->type == gpPd_BufferTypeZigBee) + { + PD_WRAP_OFFSET(dataOffset); + } + { + // Copy PBM -> RAM + Pd_RestoreFromPbm(pbmHandle, dataOffset, dataLength, pdHandle); + // free PBM and keep lookup table clean + Pd_FreePBM(pbmHandle); + } + + return pdHandle; +} + +static UInt8 Pd_PurgeRequest(gpPd_Handle_t pdHandle) +{ + UInt8 pbmHandle; + //check if Pd valid + PD_CHECK_HANDLE_INPUT_WITH_RETURN(pdHandle, GP_PD_INVALID_HANDLE); + + //Lookup corresponding PBM from Pd + for (pbmHandle = 0; pbmHandle < GPHAL_NUMBER_OF_PBMS_USED; pbmHandle++) + { + if (Pd_Pbm2pd[pbmHandle] == pdHandle && PBM_CHECK_HANDLE_ACCESSIBLE(pbmHandle)) + { + return pbmHandle; + } + } + //Invalid Pd given. + GP_LOG_PRINTF("PdHandle %x not found!",0,pdHandle); + return GP_PD_INVALID_HANDLE; +} + +static void Pd_cbPurgeConfirm(UInt8 pbmHandle) +{ + gpPd_Handle_t pdHandle; + + //Check associated pdHandle + pdHandle = Pd_GetPdFromPBM(pbmHandle); + + PD_CHECK_HANDLE_INPUT_NO_RETURN(pdHandle); + + //Free PBM and keep lookup table free + Pd_FreePBM(pbmHandle); +} + +#endif //defined(GP_COMP_GPHAL) && !defined(GP_DIVERSITY_GPHAL_COPROC) diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c new file mode 100644 index 0000000..1728de5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gpPd/src/gpPd_server_pdhandling.c @@ -0,0 +1,157 @@ + +/* + * Copyright (c) 2017, Qorvo Inc + * + * This file contains the implementation of the gpPd API protocol. + * + * Packet Descriptor interface + * Handler Implementations + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpPd.h" + +#define GP_COMPONENT_ID GP_COMPONENT_ID_APP + +#ifndef GP_PD_NR_OF_HANDLES +/* workaround for when gpPd is not configured properly, but marshalling code + included anyhow */ +#define GP_PD_NR_OF_HANDLES (1) +#endif // ifndef GP_PD_NR_OF_HANDLES +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GPPD_HANDLE_ASSOCIATION_NUMBER (GP_PD_NR_OF_HANDLES + 1) //Place for all available pd's + 1 invalid + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +typedef struct { + UInt8 oldHandle; + UInt8 newHandle; +} Pd_pdHandleMapping_t; + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ +static Pd_pdHandleMapping_t Pd_handleAssociations[GPPD_HANDLE_ASSOCIATION_NUMBER]; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpPd_InitPdHandleMapping(void) +{ + UIntLoop i; + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + Pd_handleAssociations[i].newHandle = GP_PD_INVALID_HANDLE; + Pd_handleAssociations[i].oldHandle = GP_PD_INVALID_HANDLE; + } +} + +Bool gpPd_StorePdHandle(gpPd_Handle_t newPdHandle, gpPd_Handle_t pdHandle) +{ + UIntLoop i; + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + if( GP_PD_INVALID_HANDLE == Pd_handleAssociations[i].oldHandle ) + { + Pd_handleAssociations[i].newHandle = newPdHandle; + Pd_handleAssociations[i].oldHandle = pdHandle; + return true; + } + } + return false; +} + +/* This function will check if pdHandle exist in list, if not it will return GP_INVALID_HANDLE for storedPdHandle and return true + If no free entry in list for GP_INVALID_HANDLE it will return false */ +Bool gpPd_GetStoredPdHandle(gpPd_Handle_t* storedPdHandle, gpPd_Handle_t pdHandle) +{ + UIntLoop i; + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + if(Pd_handleAssociations[i].oldHandle == pdHandle) + { + *storedPdHandle = Pd_handleAssociations[i].newHandle; + return true; + } + } + *storedPdHandle = GP_PD_INVALID_HANDLE; + + //We can add only 1 invalid entry, check if already exist + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + if(GP_PD_INVALID_HANDLE == Pd_handleAssociations[i].newHandle + && GP_PD_INVALID_HANDLE != Pd_handleAssociations[i].oldHandle) + { + return false; + } + } + //No invalid found, add to list + return gpPd_StorePdHandle(GP_PD_INVALID_HANDLE,pdHandle); +} + +gpPd_Handle_t gpPd_RestorePdHandle(gpPd_Handle_t newPdHandle, Bool remove) +{ + UIntLoop i; + gpPd_Handle_t oldPdHandle = GP_PD_INVALID_HANDLE; + + for(i=0; i < GPPD_HANDLE_ASSOCIATION_NUMBER; i++) + { + if(Pd_handleAssociations[i].newHandle == newPdHandle + && GP_PD_INVALID_HANDLE != Pd_handleAssociations[i].oldHandle) + { + oldPdHandle = Pd_handleAssociations[i].oldHandle; + if(remove) + { + Pd_handleAssociations[i].newHandle = GP_PD_INVALID_HANDLE; + Pd_handleAssociations[i].oldHandle = GP_PD_INVALID_HANDLE; + } + break; + } + } + return oldPdHandle; +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gen/gpHal_Coex_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gen/gpHal_Coex_marshalling.h new file mode 100644 index 0000000..622c120 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gen/gpHal_Coex_marshalling.h @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPHAL_COEX_MARSHALLING_H_ +#define _GPHAL_COEX_MARSHALLING_H_ + +//DOCUMENTATION HAL_COEX: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpHal_Coex.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + Bool request; + UInt8 priority; +} gpHal_Set_MAC_RX_Packet_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_RX_Packet_Input_struct_t data; +} gpHal_Set_MAC_RX_Packet_Input_marshall_struct_t; + + +typedef struct { + Bool request; + UInt8 priority; + gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t txAckNotGrantedAction; +} gpHal_Set_MAC_TX_ACK_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_TX_ACK_Input_struct_t data; +} gpHal_Set_MAC_TX_ACK_Input_marshall_struct_t; + + +typedef struct { + Bool request; + UInt8 priority; + gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t txNotGrantedAction; +} gpHal_Set_MAC_TX_Packet_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_TX_Packet_Input_struct_t data; +} gpHal_Set_MAC_TX_Packet_Input_marshall_struct_t; + + +typedef struct { + Bool request; + UInt8 priority; +} gpHal_Set_MAC_RX_ACK_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_RX_ACK_Input_struct_t data; +} gpHal_Set_MAC_RX_ACK_Input_marshall_struct_t; + + +typedef struct { + gpHal_MAC_ReqExtTrigger_t trigger; + UInt8 priority; +} gpHal_Set_MAC_RX_ReqExt_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_RX_ReqExt_Input_struct_t data; +} gpHal_Set_MAC_RX_ReqExt_Input_marshall_struct_t; + + +typedef struct { + gpHal_GainControl_Mode_t gainControlMode; + gpHal_AttLna_t attLnaLow; + gpHal_AttLna_t attLnaHigh; +} gpHal_Set_GainControl_Input_struct_t; + +typedef struct { + gpHal_Set_GainControl_Input_struct_t data; +} gpHal_Set_GainControl_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpHal_Set_GainControl_Output_struct_t; + +typedef struct { + gpHal_Set_GainControl_Output_struct_t data; +} gpHal_Set_GainControl_Output_marshall_struct_t; + + +typedef struct { + Bool enableEarlyPreambleDetect; +} gpHal_Set_MAC_EarlyPreambleDetect_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_EarlyPreambleDetect_Input_struct_t data; +} gpHal_Set_MAC_EarlyPreambleDetect_Input_marshall_struct_t; + + +typedef struct { + UInt32 extCoexTimeout; +} gpHal_Set_MAC_ExtensionTimeout_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_ExtensionTimeout_Input_struct_t data; +} gpHal_Set_MAC_ExtensionTimeout_Input_marshall_struct_t; + +typedef struct { + Bool result; +} gpHal_Set_MAC_ExtensionTimeout_Output_struct_t; + +typedef struct { + gpHal_Set_MAC_ExtensionTimeout_Output_struct_t data; +} gpHal_Set_MAC_ExtensionTimeout_Output_marshall_struct_t; + + +typedef struct { + UInt8 retriesCnt; +} gpHal_Set_MAC_MacRetriesTreshold_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_MacRetriesTreshold_Input_struct_t data; +} gpHal_Set_MAC_MacRetriesTreshold_Input_marshall_struct_t; + + +typedef struct { + UInt8 retriesCnt; +} gpHal_Set_MAC_CcaRetriesTreshold_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_CcaRetriesTreshold_Input_struct_t data; +} gpHal_Set_MAC_CcaRetriesTreshold_Input_marshall_struct_t; + + +typedef struct { + gpHal_MAC_ReRequestTrigger_t trigger; + UInt8 offTime; + UInt8 onTime; +} gpHal_Set_MAC_ReRequest_Input_struct_t; + +typedef struct { + gpHal_Set_MAC_ReRequest_Input_struct_t data; +} gpHal_Set_MAC_ReRequest_Input_marshall_struct_t; + + +typedef union { + gpHal_Set_MAC_RX_Packet_Input_marshall_struct_t gpHal_Set_MAC_RX_Packet; + gpHal_Set_MAC_TX_ACK_Input_marshall_struct_t gpHal_Set_MAC_TX_ACK; + gpHal_Set_MAC_TX_Packet_Input_marshall_struct_t gpHal_Set_MAC_TX_Packet; + gpHal_Set_MAC_RX_ACK_Input_marshall_struct_t gpHal_Set_MAC_RX_ACK; + gpHal_Set_MAC_RX_ReqExt_Input_marshall_struct_t gpHal_Set_MAC_RX_ReqExt; + gpHal_Set_GainControl_Input_marshall_struct_t gpHal_Set_GainControl; + gpHal_Set_MAC_EarlyPreambleDetect_Input_marshall_struct_t gpHal_Set_MAC_EarlyPreambleDetect; + gpHal_Set_MAC_ExtensionTimeout_Input_marshall_struct_t gpHal_Set_MAC_ExtensionTimeout; + gpHal_Set_MAC_MacRetriesTreshold_Input_marshall_struct_t gpHal_Set_MAC_MacRetriesTreshold; + gpHal_Set_MAC_CcaRetriesTreshold_Input_marshall_struct_t gpHal_Set_MAC_CcaRetriesTreshold; + gpHal_Set_MAC_ReRequest_Input_marshall_struct_t gpHal_Set_MAC_ReRequest; + UInt8 dummy; //ensure none empty union definition +} gpHal_Coex_Server_Input_union_t; + +typedef union { + gpHal_Set_GainControl_Output_marshall_struct_t gpHal_Set_GainControl; + gpHal_Set_MAC_ExtensionTimeout_Output_marshall_struct_t gpHal_Set_MAC_ExtensionTimeout; + UInt8 dummy; //ensure none empty union definition +} gpHal_Coex_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpHal_MAC_ReRequestTrigger_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_MAC_ReRequestTrigger_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_MAC_ReRequestTrigger_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_MAC_ReRequestTrigger_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_MAC_ReqExtTrigger_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_MAC_ReqExtTrigger_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_MAC_ReqExtTrigger_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_MAC_ReqExtTrigger_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_GainControl_Mode_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_GainControl_Mode_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_GainControl_Mode_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_GainControl_Mode_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpHal_AttLna_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpHal_AttLna_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpHal_AttLna_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpHal_AttLna_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +// Server functions +gpMarshall_AckStatus_t gpHal_Set_MAC_RX_Packet_Input_buf2api( gpHal_Set_MAC_RX_Packet_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_TX_ACK_Input_buf2api( gpHal_Set_MAC_TX_ACK_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_TX_Packet_Input_buf2api( gpHal_Set_MAC_TX_Packet_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_RX_ACK_Input_buf2api( gpHal_Set_MAC_RX_ACK_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_RX_ReqExt_Input_buf2api( gpHal_Set_MAC_RX_ReqExt_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_GainControl_Input_buf2api( gpHal_Set_GainControl_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +void gpHal_Set_GainControl_Output_api2buf( UInt8Buffer* pDest , gpHal_Set_GainControl_Output_marshall_struct_t* pSourceoutput , gpHal_Set_GainControl_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_EarlyPreambleDetect_Input_buf2api( gpHal_Set_MAC_EarlyPreambleDetect_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_ExtensionTimeout_Input_buf2api( gpHal_Set_MAC_ExtensionTimeout_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +void gpHal_Set_MAC_ExtensionTimeout_Output_api2buf( UInt8Buffer* pDest , gpHal_Set_MAC_ExtensionTimeout_Output_marshall_struct_t* pSourceoutput , gpHal_Set_MAC_ExtensionTimeout_Input_marshall_struct_t* pSourceinput , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_MacRetriesTreshold_Input_buf2api( gpHal_Set_MAC_MacRetriesTreshold_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_CcaRetriesTreshold_Input_buf2api( gpHal_Set_MAC_CcaRetriesTreshold_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); +gpMarshall_AckStatus_t gpHal_Set_MAC_ReRequest_Input_buf2api( gpHal_Set_MAC_ReRequest_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex ); + +// Client functions +void gpHal_Set_MAC_RX_Packet_Input_par2buf( UInt8Buffer* pDest , Bool request , UInt8 priority , UInt16* pIndex ); +void gpHal_Set_MAC_TX_ACK_Input_par2buf( UInt8Buffer* pDest , Bool request , UInt8 priority , gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t txAckNotGrantedAction , UInt16* pIndex ); +void gpHal_Set_MAC_TX_Packet_Input_par2buf( UInt8Buffer* pDest , Bool request , UInt8 priority , gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t txNotGrantedAction , UInt16* pIndex ); +void gpHal_Set_MAC_RX_ACK_Input_par2buf( UInt8Buffer* pDest , Bool request , UInt8 priority , UInt16* pIndex ); +void gpHal_Set_MAC_RX_ReqExt_Input_par2buf( UInt8Buffer* pDest , gpHal_MAC_ReqExtTrigger_t trigger , UInt8 priority , UInt16* pIndex ); +void gpHal_Set_GainControl_Input_par2buf( UInt8Buffer* pDest , gpHal_GainControl_Mode_t gainControlMode , gpHal_AttLna_t attLnaLow , gpHal_AttLna_t attLnaHigh , UInt16* pIndex ); +void gpHal_Set_GainControl_Output_buf2par( Bool* result , gpHal_GainControl_Mode_t gainControlMode , gpHal_AttLna_t attLnaLow , gpHal_AttLna_t attLnaHigh , UInt8Buffer* pSource , UInt16* pIndex ); +void gpHal_Set_MAC_EarlyPreambleDetect_Input_par2buf( UInt8Buffer* pDest , Bool enableEarlyPreambleDetect , UInt16* pIndex ); +void gpHal_Set_MAC_ExtensionTimeout_Input_par2buf( UInt8Buffer* pDest , UInt32 extCoexTimeout , UInt16* pIndex ); +void gpHal_Set_MAC_ExtensionTimeout_Output_buf2par( Bool* result , UInt32 extCoexTimeout , UInt8Buffer* pSource , UInt16* pIndex ); +void gpHal_Set_MAC_MacRetriesTreshold_Input_par2buf( UInt8Buffer* pDest , UInt8 retriesCnt , UInt16* pIndex ); +void gpHal_Set_MAC_CcaRetriesTreshold_Input_par2buf( UInt8Buffer* pDest , UInt8 retriesCnt , UInt16* pIndex ); +void gpHal_Set_MAC_ReRequest_Input_par2buf( UInt8Buffer* pDest , gpHal_MAC_ReRequestTrigger_t trigger , UInt8 offTime , UInt8 onTime , UInt16* pIndex ); + +void gpHal_Coex_InitMarshalling( void ); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPHAL_COEX_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal.h new file mode 100644 index 0000000..9b824e5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal.h @@ -0,0 +1,288 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * The GreenPeak Hardware Abstraction Layer (HAL) implements the API to control the GP chip + * + * The HAL code is subdivided in different C-files as the chip itself consists of different blocks. + * In this way the user can quickly use the code of the block he needs. + * + * The file gpHal.h contains the general functions of the HAL (init, reset, interrupts). + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_H_ +#define _HAL_GP_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/** + * @file gpHal.h + * + * The general functions of the HAL including initialization, reset and interrupt mask control and MCU settings + * are included in the file gpHal.h + * + * @brief The file gpHal.h contains the general functions of the HAL (init, reset, interrupts). +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#ifdef GP_HAL_DIVERSITY_SINGLE_ANTENNA +#if (GP_HAL_DIVERSITY_SINGLE_ANTENNA!=0) && (GP_HAL_DIVERSITY_SINGLE_ANTENNA!=1) +#error error: gpHal GP_HAL_DIVERSITY_SINGLE_ANTENNA is unsupported single antenna +#endif +#endif + +#ifndef GP_DIVERSITY_NR_OF_STACKS +//Overruled from build normally +#define GP_DIVERSITY_NR_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS + +#include "global.h" +#include "gp_global.h" + +//Chip specific includes +#include "gpHal_reg.h" + +//Different GP blocks +#include "gpHal_HW.h" + + +#include "gpHal_MAC.h" //All 802.15.4 RF related functions +#include "gpHal_MAC_Ext.h" +#include "gpHal_ES.h" //Event Scheduler functions +#include "gpHal_SEC.h" //Security functions +#include "gpHal_MISC.h" //Miscellaneous functions +#include "gpHal_DP.h" //Data Pending functionality +#include "gpHal_DPI.h" //Deep Packet Inspection functionality + + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_HAL_DEFAULT_TIMEOUT 10000UL //10ms +#define GP_HAL_MAXIMUM_TIMEOUT 2097119UL // 2.097s - max 16-bit counter value shifted 5 positions -1 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +#define GP_HAL_TIME_DIFF(t1,t2) (t2 <= t1 ? (t1 - t2) : (0xFFFFFFFF - (t1 - t2))) +/** @brief Compares times from the chip's timebase - check if t1 < t2 +*/ +#define GP_HAL_TIME_COMPARE_LOWER(t1,t2) (!((UInt32)((t1) - (t2))/*&(0xFFFFFFFF)*/ < (0x80000000LU))) +/** @brief Compares times from the chip's timebase - check if t1 >= t2 +*/ +#define GP_HAL_TIME_COMPARE_BIGGER_EQUAL(t1,t2) ( ((UInt32)((t1) - (t2))/*&(0xFFFFFFFF)*/ < (0x80000000LU))) +/** @brief Compares times from the chip's timebase - check if t1 > t2 +*/ +#define GP_HAL_TIME_COMPARE_BIGGER(t1,t2) (!((UInt32)((t2) - (t1))/*&(0xFFFFFFFF)*/ < (0x80000000LU))) +/** @brief Compares times from the chip's timebase - check if t1 <= t2 +*/ +#define GP_HAL_TIME_COMPARE_LOWER_EQUAL(t1,t2) ( ((UInt32)((t2) - (t1))/*&(0xFFFFFFFF)*/ < (0x80000000LU))) + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** @brief Reads a register of the GP chip. + * + * Reads a register of the GP chip. + * @param Register The register address to read data from. +*/ +GP_API UInt8 gpHal_ReadReg(gpHal_Address_t Register); +/** @brief Reads a block of registers of the GP chip. + * + * Reads a block of registers of the GP chip. + * @param Address The register address where the block read starts. + * @param pBuffer The pointer to a byte buffer where the read data will be stored. + * @param Length The number of bytes to be read. +*/ +GP_API void gpHal_ReadRegs(gpHal_Address_t Address, void* pBuffer, UInt8 Length); + +/** @brief Write a register of the GP chip. + * + * Write a register of the GP chip. + * @param Register The register address to write to. + * @param Data The data to write to the register. +*/ +GP_API void gpHal_WriteReg(gpHal_Address_t Register, UInt8 Data); +/** + * @brief Writes a block of registers to the GP chip. + * + * Writes a block of registers to the GP chip. + * @param Address The register address where the block write starts. + * @param pBuffer The pointer to a byte buffer where the data to be written are stored. + * @param Length The number of bytes to be written. +*/ +GP_API void gpHal_WriteRegs(gpHal_Address_t Address, void* pBuffer, UInt8 Length); + +// AND register contents with inverted mask, OR in data, and write the result +/** @brief Reads a register, modifies the data with a certain mask and data, writes the register back. */ +GP_API void gpHal_ReadModifyWriteReg(gpHal_Address_t Register, UInt8 Mask, UInt8 Data); + +/** @brief Checks if MSI communication is possible and correct by reading a known register. */ +GP_API Bool gpHal_CheckMsi(void); + +/** + * @brief Returns the version information of the chip + * + * This function returns the version information of the chip. It indicates the current revision of the chip and other information + * +*/ +GP_API UInt16 gpHal_GetHWVersionId(void); + +/** + * @brief Getter method for the chip ID. + * @return The identifier of the silicon. +*/ +#define gpHal_GetChipId() (GP_HAL_EXPECTED_CHIP_ID) + +/** + * @brief Getter method for the chip version. + * @return The metal fix version of the chip. +*/ +GP_API UInt8 gpHal_GetChipVersion(void); + +/** + * @brief Getter method for the ROM BL version. + * + * Note that this function returns -on purpose- only the MSB of the ROM bootloader version. + * + * @return The version of the ROM bootloader. +*/ +GP_API UInt8 gpHal_GetRomBlVersion(void); + +/** + * @brief Initializes HAL variables and sets basic GP chip register values. + * + * The function has to be called at the beginning of the application as it initializes variables that are used throughout operation. + * At startup a decision is made to use the timed operation of the GP chip or not, by setting the parameter timedMAC. + * + * @param timedMAC If set to true, the GP chip will be used with a timed MAC. + * When a timed MAC is used all transmission is done using scheduled triggers from the Event Scheduler (ES). + * +*/ +GP_API void gpHal_Init(Bool timedMAC); + +/** + * @brief Initializes Advanced HAL variables + * + * The function has to be called at the end of the application initialization. In comparison with the basic gpHal_Init() + * method, the settings triggered by this initialization could interfere with initializations of other components. + * +*/ +GP_API void gpHal_AdvancedInit(void); + +/** + * @brief This function performs a reset of the chip. + * + * This function performs a reset of the functional registers. All registers are reverted to their default value and all memories are cleared. + * +*/ +GP_API void gpHal_Reset(void); +/** + * @brief This function checks if radio is awake + * @return Returns if value is awake. If value is 0, chip is asleep else the device is awake. + * +*/ +GP_API UInt8 gpHal_IsRadioAccessible(void); +/** + * @brief This function detects if a reset of the GP chip has occurred. + * + * This function will return true if the GP chip has resetted since its first startup. + * +*/ +GP_API Bool gpHal_DidGPReset(void); +/** + * @brief Thie functions enables the interrupt line of the GP chip. + * + * Sets the main interrupt mask of the GP chip. + * + * @param enable If set to true: main interrupt mask is switched on. +*/ +#define gpHal_EnableInterrupts(enable) GP_HAL_ENABLE_INTERRUPTS(enable) + +// Main interrupt service routine - to be registered by user using HAL_GP_INTERRUPT_INIT() +/** + * @brief The interrupt service routine to be called when the interrupt of the GP chip is seen. + * + * This ISR needs to be called when the interrupt line (INTOUTn) goes low (active low signal). + * It will handle the pending interrupt according to the callback functions registered to the different sources. + * +*/ +GP_API void gpHal_Interrupt(void); + +/** + * @brief This function regulates the GP chip sleep behaviour + * + * This function enables the sleep mode of the GP chip when the GP chip is idle. + * Enabling GoToSleepWhenIdle will cause the GP chip to go to sleep mode when nothing is busy (TX/RX/Receiver on/...) + * Be aware that the GP chip remains in sleep if no wakeup trigger or event is enabled and registered. + * + * It also regulates the GP chip sleep behaviour by keeping track of a "stay awake counter". + * When the counter reaches '0' the GP chip is put into sleep. + * It always needs to be used in pairs, one to wake up the GP chip when its needed and one to set it to sleep when the GP chip is no longer of use. + * In this way different functions can use the sleep functionality without overriding each others settings. + * + * @param enable + * - if set to true : The GP chip will be put to sleep if no other wake requests are pending, counter decremented + * - if set to false: The GP chip will be kept awake, counter incremented +*/ +GP_API void gpHal_GoToSleepWhenIdle(Bool enable); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif //_HAL_GP_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Coex.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Coex.h new file mode 100644 index 0000000..98d17b9 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Coex.h @@ -0,0 +1,294 @@ +/* + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpHal_Coex.h" + * + * gpHal Coexistence subcomponent + * + * Declarations of the public functions and enumerations of gpHal_Coex. +*/ + +#ifndef _GPHAL_COEX_H_ +#define _GPHAL_COEX_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" + +/***************************************************************************** + * Enum Definitions + *****************************************************************************/ + +/** @enum gpHal_MAC_ReRequestTrigger_t */ +//@{ +/** @brief No action. */ +#define gpHal_MAC_ReRequestTrigger_None 0x00 +/** @brief Re-Request if grant is lost or not given. */ +#define gpHal_MAC_ReRequestTrigger_NoGrant 0x01 +/** @brief Re-Request on priority change during ongoing request. */ +#define gpHal_MAC_ReRequestTrigger_PrioChange 0x02 +/** @typedef gpHal_MAC_ReRequestTrigger_t + @brief Mask with the ReRequest triggers. +*/ +typedef UInt8 gpHal_MAC_ReRequestTrigger_t; +//@} + +/** @enum gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t */ +//@{ +/** @brief No action, grant not aware. */ +#define gpHal_MAC_TX_Packet_Ignore 0x00 +/** @brief If not granted, then disable PA */ +#define gpHal_Coex_MAC_TX_Packet_DisablePa 0x01 +/** @brief If not granted, then trigger a CMSA_CA failure. Only applicable to TX_packet. */ +#define gpHal_Coex_MAC_TX_Packet_CcaFailure 0x02 +/** @brief If not granted, CSMA-CA delay backoff counter get frozen. Once grant is received, conter proceeds. Can be used to force wait for grant before CCA measurement. When using SW CSMA-CA, backoff delay is handled by SW, so this option is ignored. */ +#define gpHal_Coex_MAC_TX_Packet_CcaHold 0x04 +/** @brief If not granted, TX state machine is hold after doing CSMA-CA, but before starting the TX. Once Grant is received, TX starts imediatelly. */ +#define gpHal_Coex_MAC_TX_Packet_DelayedStart 0x08 +/** @typedef gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t + @brief Mask that sets the MAC packet TX actions upon not having grant. +*/ +typedef UInt8 gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t; +//@} + +/** @enum gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t */ +//@{ +/** @brief No action, grant not aware. */ +#define gpHal_MAC_TX_ACK_Ignore 0x00 +/** @brief If not granted, then disable PA */ +#define gpHal_Coex_MAC_TX_ACK_DisablePa 0x01 +/** @brief If not granted, skip sending of the ACK. */ +#define gpHal_Coex_MAC_TX_ACK_SkipTx 0x02 +/** @typedef gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t + @brief Mask that sets the MAC ACK TX actions upon not having grant. +*/ +typedef UInt8 gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t; +//@} + +/** @enum gpHal_MAC_ReqExtTrigger_t */ +//@{ +/** @brief No extension. */ +#define gpHal_MAC_ExtensionTriggers_None 0x00 +/** @brief Extend on preamble detect */ +#define gpHal_MAC_ExtensionTriggers_Preamble 0x01 +/** @brief Extend on SFD reception */ +#define gpHal_MAC_ExtensionTriggers_SFD 0x02 +/** @brief Extend on macfilter */ +#define gpHal_MAC_ExtensionTriggers_PacketAbort 0x04 +/** @brief Extend on CRC failure */ +#define gpHal_MAC_ExtensionTriggers_FCSERR 0x08 +/** @typedef gpHal_MAC_ReqExtTrigger_t + @brief Mask that sets request extension triggers +*/ +typedef UInt8 gpHal_MAC_ReqExtTrigger_t; +//@} + +/** @enum gpHal_GainControl_Mode_t */ +//@{ +/** @brief Use default fixed gain control level LNA0 */ +#define gpHal_GainControl_Mode_Default 0x00 +/** @brief Gain control levels will be fixed to the specified lowLnaAtt setting */ +#define gpHal_GainControl_Mode_Fixed 0x01 +/** @brief Gain control levels will be controlled by the internal AGC */ +#define gpHal_GainControl_Mode_RssiBasedAgc 0x02 +/** @brief Gain control levels will be controlled by the configured COEX_ATT_CTRL BSP setting */ +#define gpHal_GainControl_Mode_GpioBasedAgc 0x03 +/** @typedef gpHal_GainControl_Mode_t + @brief Enumeration specifying the gain control mode +*/ +typedef UInt8 gpHal_GainControl_Mode_t; +//@} + +/** @enum gpHal_AttLna_t */ +//@{ +/** @brief Select LNA0 */ +#define gpHal_AttLna_LNA0 0x00 +/** @brief Select LNA1 */ +#define gpHal_AttLna_LNA1 0x01 +/** @brief Select LNA2 */ +#define gpHal_AttLna_LNA2 0x02 +/** @brief Select LNA3 */ +#define gpHal_AttLna_LNA3 0x03 +/** @brief Select LNA4 */ +#define gpHal_AttLna_LNA4 0x04 +/** @brief Select LNA5 */ +#define gpHal_AttLna_LNA5 0x05 +/** @brief Don't use/update LNA setting */ +#define gpHal_AttLna_Ignore 0xFF +/** @typedef gpHal_AttLna_t + @brief Selection of predefined LNA condif +*/ +typedef UInt8 gpHal_AttLna_t; +//@} + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/* Callbacks for data confirm and GPIO interrupt */ +typedef void (*gpHal_CoexCbDataConfirm_t)(UInt8 result, UInt8 retries, UInt8 priority); +typedef UInt8 (*gpHal_CoexCbGpioInt_t)(UInt8 interruptsMasked); +typedef void (*gpHal_CoexCbCSMARetry_t)(UInt8 result, void *pCSMA_CA_State); + +/***************************************************************************** + * Public Function Prototypes + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +//Requests +/** @brief Set the coexistence parameters for 802.15.4 packet RX +* +* @param request +* @param priority +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_RX_Packet(Bool request, UInt8 priority); + +/** @brief Set the coexistence parameters for 802.15.4 ACK TX +* +* @param request +* @param priority +* @param txAckNotGrantedAction +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_TX_ACK(Bool request, UInt8 priority, gpHal_Coex_MAC_TX_ACK_NotGrantedActions_t txAckNotGrantedAction); + +/** @brief Set the coexistence parameters for 802.15.4 packet TX +* +* @param request +* @param priority +* @param txNotGrantedAction +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_TX_Packet(Bool request, UInt8 priority, gpHal_Coex_MAC_TX_Packet_NotGrantedActions_t txNotGrantedAction); + +/** @brief Set the coexistence parameters for 802.15.4 ACK RX +* +* @param request +* @param priority +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_RX_ACK(Bool request, UInt8 priority); + +/** @brief Configure the request extensions +* +* @param trigger +* @param priority +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_RX_ReqExt(gpHal_MAC_ReqExtTrigger_t trigger, UInt8 priority); + +/** @brief Set the gain control +* +* @param gainControlMode +* @param attLnaLow +* @param attLnaHigh +* @return result +*/ +gpHal_Result_t gpHal_Set_GainControl(gpHal_GainControl_Mode_t gainControlMode, gpHal_AttLna_t attLnaLow, gpHal_AttLna_t attLnaHigh); + +/** @brief Enable early preamble detection +* +* @param enableEarlyPreambleDetect +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_EarlyPreambleDetect(Bool enableEarlyPreambleDetect); + +/** @brief Set extension timeout in multiples of 16 us. +* +* @param extCoexTimeout +* @return result Returns false when value out of range, else sucess. +*/ +gpHal_Result_t gpHal_Set_MAC_ExtensionTimeout(UInt32 extCoexTimeout); + +/** @brief Set the number of consecutive mac retries before raising the priority of the packet TX. Setting to 0 deactivate it +* +* @param retriesCnt +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_MacRetriesTreshold(UInt8 retriesCnt); + +/** @brief Set the number of consecutive cca retries before raising the priority of the packet TX. Setting to 0 deactivate it +* +* @param retriesCnt +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_CcaRetriesTreshold(UInt8 retriesCnt); + +/** @brief Configure if the request line should be re-requested on case of grant not given or lost for over x time +* +* @param trigger Enable re-request upon no-grant or priority change +* @param offTime Set the time in uS that request should be off during a re-request toggle. +* @param onTime Set the time in uS it should wait for the grant, before turning request off to turn it on again. +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_ReRequest(gpHal_MAC_ReRequestTrigger_t trigger, UInt8 offTime, UInt8 onTime); + +/** @brief Configure if an 802.15.4 indirect packet TX should have a different priority level as normal TX. +* +* @param enable Enable the priority boost for indirect TX. +* When enabled, all indirect TX will use the priority defined by this API. +* When disabled, the priority applied is the same on for a normal packet TX. +* @param priority Priority level to be used when enabled. +* @return result +*/ +gpHal_Result_t gpHal_Set_MAC_IndTxPriorityBoost(Bool enable, UInt8 priority); + +//Indications +/** @brief Finalize handling after timeout on "Wait for COEX GRANT" +* Actions: +* Restore saved configuration for PA (internal and, if applcable, external PA) +* Modify result accordingly +* +*/ +UInt8 gpHal_CompletePossibleGrantimeoutByConfigRestore(UInt8 result); +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //_GPHAL_COEX_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DP.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DP.h new file mode 100644 index 0000000..7f0916a --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DP.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2013-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + + +#ifndef _GPHAL_DATAPENDING_H_ +#define _GPHAL_DATAPENDING_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_RomCode_DP.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/** @file gpHal_DP.h + * @brief This file contains all the functions needed for DataPending functionality. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @enum gpHal_AddressMode_t */ +//@{ +/** @brief No Address */ +#define gpHal_AddressModeNoAddress 0 +/** @brief Reserved */ +#define gpHal_AddressModeReserved 1 +/** @brief Short (i.e. 16-bit) address */ +#define gpHal_AddressModeShortAddress 2 +/** @brief Extended (i.e. 8-byte) address */ +#define gpHal_AddressModeExtendedAddress 3 +/** @typedef gpHal_AddressMode_t + @brief Selection of the address mode +*/ +typedef UInt8 gpHal_AddressMode_t; +//@} + +/** @union gpHal_RfAddress_t */ +typedef union { +/** The short address (2 bytes).*/ + UInt16 Short; +/** The extended address (MAC address), 8 bytes.*/ + MACAddress_t Extended; +} gpHal_RfAddress_t; + +/** @union gpHal_AddressInfo_t */ +typedef struct { + gpHal_RfAddress_t address; + UInt16 panId; + gpHal_AddressMode_t addressMode; +} gpHal_AddressInfo_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs_DP.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +gpHal_Result_t gpHal_DpClearEntries(UInt8 id); + +/** @brief Add an entry to the list of addresses for which a data packet is pending transission +* +* @param pAddressInfo The address for which a data packet is pending +* @param id The stack id which has the data packet pending +* @return result The return parameter indicating success or the failure code +* +*/ +gpHal_Result_t gpHal_DpAddEntry(gpHal_AddressInfo_t* pAddressInfo, UInt8 id); +/** @brief Remove an entry from the list of addresses for which a data packet is pending transission +* +* @param pAddressInfo The address for which a data packet is no longer pending +* @param id The stack id which had the data packet pending +* @return result The return parameter indicating success or the failure code +* +*/ +gpHal_Result_t gpHal_DpRemoveEntry(gpHal_AddressInfo_t* pAddressInfo, UInt8 id); + +/** @brief Check if there are datapending entries in the list +* +* @return result A boolean indicating if any stack has pending data packets in the list. +* +*/ +Bool gpHal_DPEntriesPending(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif /* _GPHAL_DATAPENDING_H_ */ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DPI.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DPI.h new file mode 100644 index 0000000..a24283a --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_DPI.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_DPI_H_ +#define _HAL_GP_DPI_H_ + +/** @file gpHal_DPI.h + * @brief This file contains functions for Deep Packet Inspection +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + /** + * @brief This function prepares the DPI block for further configuration +*/ +void gpHal_DpiPrepareForConfig(void); + +/** + * @brief Returns true if enabling without conflicts is allowed +*/ +Bool gpHal_DpiCheckPreConditions(void); + +/** + * @brief Returns true if DPI is running +*/ +Bool gpHal_DpiIsDpiRunning(void); + +/** + * @brief Enable the DPI block - only call when gpHal_DpiCheckPreConditions() returned true +*/ +gpHal_Result_t gpHal_DpiEnable(void); + +/** + * @brief Disable the DPI block +*/ +gpHal_Result_t gpHal_DpiDisable(void); + +/** + * @brief Add a pattern to be checked by DPI +*/ +void gpHal_DpiAddPattern(UInt8* pPattr, UInt8 length); + +/** + * @brief Add a device to be checked by DPI +*/ +void gpHal_DpiAddDevice(UInt32* pFrameCnt, UInt16* pShortAddr, MACAddress_t* pLongAddr, UInt8* pSecKey); + +#ifdef __cplusplus +} +#endif + +#endif //_HAL_GP_DPI_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_ES.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_ES.h new file mode 100644 index 0000000..aa49e05 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_ES.h @@ -0,0 +1,461 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpHal_ES.h + * + * This file defines all functions for the event scheduler and sleep modes. These functions can be used to schedule certain actions : an interrupt, TX of a packet, etc. + * The diffent sleep and wakeup modes can also be initialized and used with these functions. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_ES_H_ +#define _HAL_GP_ES_H_ + +/** @file gpHal_ES.h + * This file defines all functions for the event scheduler and sleep modes. These functions can be used to schedule certain actions : an interrupt, TX of a packet, etc. + * The different sleep and wakeup modes can also be initialized and used with these functions. + * + * @brief All functions for the event scheduler and sleep modes. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpHal_reg.h" +#include "gpHal_HW.h" + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +//Execution options +/** @brief Event exection options mask. */ +#define GP_ES_EXECUTION_OPTIONS_MASK 0xF +/** @brief Event exection options : Execute the event even if the trigger time has passed. */ +#define GP_ES_EXECUTION_OPTIONS_EXECUTE_IF_TOO_LATE 0x4 +/** @brief Event exection options : Prohibit standby as long as event is pending */ +#define GP_ES_EXECUTION_OPTIONS_PROHIBIT_STANDBY 0x8 +/** @brief Event exection options : Execute the event only if the event was triggered on time. */ +#define GP_ES_EXECUTION_OPTIONS_NOT_EXECUTE_IF_TOO_LATE 0x0 + +//Interrupt options +/** @brief Event interrupt options mask (enables all interrupt options).*/ +#define GP_ES_INTERRUPT_OPTIONS_MASK 0x3F +/** @brief Event interrupt option: generate interrupt on first event execution that is on time.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_FIRST_ON_TIME 0x01 //First bit +/** @brief Event interrupt option: generate interrupt on event execution other then first or last execution that is on time.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_OTHERS_ON_TIME 0x02 //2nd bit +/** @brief Event interrupt option: generate interrupt on last event execution that is on time.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_LAST_ON_TIME 0x04 //3rd bit +/** @brief Event interrupt option: generate interrupt on first event execution that is too late.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_FIRST_TOO_LATE 0x08 //4th bit +/** @brief Event interrupt option: generate interrupt on execution other then first or last execution that is too late.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_OTHERS_TOO_LATE 0x10 //5th bit +/** @brief Event interrupt option: generate interrupt on last event execution that is too late.*/ +#define GP_ES_INTERRUPT_OPTIONS_ON_LAST_TOO_LATE 0x20 //6th bit + +/** @brief Default value for the calibration of the 32kHz crystal */ +#define GPHAL_ES_32KHZ_SLEEP_DEFAULT_CALIB 0x3D090000 // 32,768kHz +/** @brief Default value for the calibration of the 16MHz crystal */ +#define GPHAL_ES_16MHZ_SLEEP_DEFAULT_CALIB 0x40000000 + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +//Result and state fields in the event control field +/** @brief Get the event result (top 4 bits of the control field). */ +#define GP_ES_GET_EVENT_RESULT(control) (((control)>>4) & 0xF) +/** @brief Get the event state (last 4 bits of the control field). */ +#define GP_ES_GET_EVENT_STATE(control) ( (control) & 0xF) +/** @brief Set the event result (top 4 bits of the control field). */ +#define GP_ES_SET_EVENT_RESULT(control,result) (control = (control & 0x0F) | (((result)<<4) & 0xF0)) +/** @brief Set the event state (last 4 bits of the control field). */ +#define GP_ES_SET_EVENT_STATE(control,state) (control = (control & 0xF0) | ( (state) & 0x0F)) + + +#define GPHAL_ES_ABSOLUTE_EVENT_ID_INVALID 0xFF + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +/** @name gpHal_EventType_t */ +//@{ +/** @typedef gpHal_EventType_t + * @brief The gpHal_EventType_t type defines the event type. +*/ +typedef UInt8 gpHal_EventType_t; +//@} +// +/** @name gpHal_AbsoluteEventId_t */ +//@{ +/** @typedef gpHal_AbsoluteEventId_t + * @brief The gpHal_AbsoluteEventId_t type holds an absolue event index +*/ +typedef UInt8 gpHal_AbsoluteEventId_t; +//@} + + +//Standby modes +/** @name gpHal_SleepMode_t */ +//@{ +/** @typedef gpHal_SleepMode_t + * @brief The gpHal_SleepMode_t type defines the GP chip sleep mode. +*/ +typedef UInt8 gpHal_SleepMode_t; +//@} + +// The status of a sleep mode (determined by oscillator benchmark measurements, by comparision against 32 MHz clock) +#define gpHal_SleepClockMeasurementStatusNotStarted 0x00 +#define gpHal_SleepClockMeasurementStatusPending 0x01 +#define gpHal_SleepClockMeasurementStatusNotStable 0x02 +#define gpHal_SleepClockMeasurementStatusStable 0x03 + +typedef UInt8 gpHal_SleepClockMeasurementStatus_t; + +//Event states enumeration +/** @name gpHal_EventState_t */ +//@{ +/** @brief The event is invalid, will not be executed if execution time is reached.*/ +#define gpHal_EventStateInvalid GPHAL_ENUM_EVENT_STATE_INVALID +/** @brief The event is scheduled, it will be executed if execution time is reached.*/ +#define gpHal_EventStateScheduled GPHAL_ENUM_EVENT_STATE_SCHEDULED +/** @brief The event is scheduled for immediate, it will be executed as soon as possible.*/ +#define gpHal_EventStateScheduledForImmediate GPHAL_ENUM_EVENT_STATE_SCHEDULED_FOR_IMMEDIATE_EXECUTION +/** @brief The event is rescheduled after being triggered before. It will be executed if execution time is reached.*/ +#define gpHal_EventStateReScheduled GPHAL_ENUM_EVENT_STATE_RESCHEDULED +/** @brief The event has been executed.*/ +#define gpHal_EventStateDone GPHAL_ENUM_EVENT_STATE_DONE +/** @typedef gpHal_EventState_t + * @brief The gpHal_EventState_t type defines the Absolute Event state. +*/ +typedef UInt8 gpHal_EventState_t; +//@} + +/** @name gpHal_EventResult_t */ +//@{ +/** @brief Event not yet executed. */ +#define gpHal_EventResultInvalid GPHAL_ENUM_EVENT_RESULT_UNKNOWN +/** @brief Event was executed on time. */ +#define gpHal_EventResultOnTime GPHAL_ENUM_EVENT_RESULT_EXECUTED_ON_TIME +/** @brief Event was executed too late and GP_ES_EXECUTION_OPTIONS_EXECUTE_IF_TOO_LATE was set */ +#define gpHal_EventResultTooLate GPHAL_ENUM_EVENT_RESULT_EXECUTED_TOO_LATE +/** @brief Event was executed too late and GP_ES_EXECUTION_OPTIONS_NOT_EXECUTE_IF_TOO_LATE was set */ +#define gpHal_EventResultMissed GPHAL_ENUM_EVENT_RESULT_MISSED_TOO_LATE +/** @typedef gpHal_EventResult_t + * @brief The gpHal_EventResult_t type defines the event result. +*/ +typedef UInt8 gpHal_EventResult_t; +//@} + +//Absolute event descriptor +/** @struct gpHal_AbsoluteEventDescriptor + * @brief The gpHal_AbsoluteEventDescriptor structure specifying the parameters of an Absolute Event. + * @typedef gpHal_AbsoluteEventDescriptor_t + * @brief The gpHal_AbsoluteEventDescriptor_t type definition based on the structure gpHal_AbsoluteEventDescriptor. +*/ +typedef struct gpHal_AbsoluteEventDescriptor +{ +/** This field contains the absolute time (absolute to the symbol counter of the GP chip) at which the event should be executed. */ + UInt32 exTime; +/** This field contains the period between different periodic executions of this event. This value will only be used by the GP chip when recAmount > 0. */ + UInt32 recPeriod; //Recurrence Period +/** This field contains the amount of recurrences of the event. If set to 0 = 1 execution, set to 1 = 2 executions. Value 0xFFFF indicates an endless recurrent event. */ + UInt16 recAmount; //Recurrence Amount +/** This field contains Custom Data that can be associated with the event. This data can be read when using the gpHal_MonitorAbsoluteEvent() function.*/ + UInt16 customData; //custom uP data +/** This field contains the bitfield specifying the execution of the event (see GP_ES_EXECUTION_OPTIONS_MASK).*/ + UInt8 executionOptions; +/** This field contains the bitfield specifying the interrupts given by the event (see GP_ES_INTERRUPT_OPTIONS_MASK).*/ + UInt8 interruptOptions; //interrupt on_first/others/last_on_time +/** This field contains the Event state (see enum gpHal_EventState_t) and the Event result + * (see enum gpHal_EventResult_t). The macro GP_ES_SET_EVENT_STATE() (resp. GP_ES_SET_EVENT_RESULT()) + * should be used in order to extract the information and the macro GP_ES_SET_EVENT_STATE() (resp. GP_ES_SET_EVENT_RESULT()) in order to initialize this field. + * + * Preferably the result field is written to INVALID at schedule time. After the event was triggered, + * this field will return information about the execution status. */ + UInt8 control; //Control +/** This field contains the Event type (see enum gpHal_EventType_t). This specifies what action needs to be performed on execution of the event. */ + UInt8 type; //Type +} gpHal_AbsoluteEventDescriptor_t; + +/** @struct gpHal_ExternalEventDescriptor + * @brief The gpHal_ExternalEventDescriptor structure specifying the External Event. + * @typedef gpHal_ExternalEventDescriptor_t + * @brief The gpHal_ExternalEventDescriptor_t type definition based on the structure gpHal_ExternalEventDescriptor. +*/ +typedef struct gpHal_ExternalEventDescriptor +{ +/** This field contains the Event type (see enum gpHal_EventType_t). This specifies what action needs to be performed on execution of the event. */ + gpHal_EventType_t type; +} gpHal_ExternalEventDescriptor_t; + + + +/***************************************************************************** + * Public function prototypes + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif +//ES Enable/Disable callbacks + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs_ES.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** + * @brief This function enables the interrupt line of the External Event interrupt. + * + * This function enables the interrupt line of the External Event interrupt by setting the interrupt mask of the External Event interrupt. + * + * @param enable Enables the interrupt source if true. +*/ +#define gpHal_EnableExternalEventCallbackInterrupt(enable) GP_HAL_ENABLE_EXTERNAL_EVENT_INTERRUPT(enable) + +/** + * @brief This function enables the interrupt line of an Absolute Event interrupt. + * + * This function enables the interrupt line of an Absolute Event interrupt by setting the interrupt mask of the Absolute Event with index eventNbr. + * + * @param eventNbr The index of the Absolute Event (1..16). + * @param enable Enables the interrupt source if true. +*/ +GP_API void gpHal_EnableAbsoluteEventCallbackInterrupt(UInt8 eventNbr, Bool enable); + +//ES register callbacks +/** + * @brief Registers the callback for an Absolute Event. + * + * This function registers the callback for an Absolute Event. The callback will be executed when the Absolute Event is triggered. + * The Absolute Event with the correct index needs to be enabled. + * + * @param callback The pointer to the callback function. + * @param eventNbr The index of the Absolute Event (1..16). +*/ +GP_API void gpHal_RegisterAbsoluteEventCallback(gpHal_AbsoluteEventCallback_t callback, UInt8 eventNbr); + +/** + * @brief Registers the callback for a External Event. + * + * This function registers the callback for a External Event. It returns the callback that was + * registered earlier or NULL if none was registered. Multiple External Event handlers can be + * threaded by calling previously registered handler from the new handler. + * + * The callback will be executed when the External Event is triggered. + * The External Event interrupt must be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API gpHal_ExternalEventCallback_t gpHal_RegisterExternalEventCallback(gpHal_ExternalEventCallback_t callback); + +// ES functions + +/** @brief Resets the timebase of the GP chip */ +GP_API void gpHal_ResetTime(void); + +/** + * @brief Gets the time of the GP chip. + * + * This function returns the current time of the GP chip in us. + * + * @param pTime Pointer to the variable where the time will be stored. +*/ +GP_API void gpHal_GetTime(UInt32* pTime); + +/** + * @brief Calibrates the timer of the GP chip. + * + * This function calibrates the GP chip time base by applying a correction of the current time and an adjustment of the timer slope. + * + * @param phaseAdjustment The phase adjustment to be applied to the GP chip timer. + * @param frequency The desired frequency of the timer/slope of the counter. +*/ +GP_API void gpHal_ApplyCalibration( Int32 phaseAdjustment, UInt32 frequency); + +/** + * @brief Schedules an Absolute Event in the GP chip. + * + * This function uploads and activates an event in the GP chip Event Scheduler. To facilitate a callback on the execution of the event + * one must register the callback using gpHal_RegisterAbsoluteEventCallback() and enable the interrupt using gpHal_EnableAbsoluteEventCallbackInterrupt(). + * + * @param pAbsoluteEventDescriptor Pointer to the AbsoluteEventDescriptor_t structure containing the Event options. + * @param eventNbr The index of the Absolute Event (1..16). +*/ +GP_API void gpHal_ScheduleAbsoluteEvent(gpHal_AbsoluteEventDescriptor_t* pAbsoluteEventDescriptor, gpHal_AbsoluteEventId_t eventNbr); + +/** + * @brief Allocates an available absolute event id + * +*/ +GP_API gpHal_AbsoluteEventId_t gpHal_GetAbsoluteEvent(void); +/** + * @brief Frees an allocated absolute event id + * +*/ +GP_API void gpHal_FreeAbsoluteEvent(gpHal_AbsoluteEventId_t EventId); + +/** + * @brief Refreshes an Absolute Event in the GP chip. + * + * This function refreshes an already prepared Absolute Event. The event descriptor gpHal_AbsoluteEventDescriptor_t needs to be written as part of the preparation. + * Writing the gpHal_AbsoluteEventDescriptor_t can be done with GP_ES_WRITE_EVENT_DESCRIPTOR(). + * + * @param eventNbr The index of the Absolute Event (1..16). + * @param absTime The absolute execution time of the event (in us) + * @param control The control field of the event descriptor (see gpHal_AbsoluteEventDescriptor_t). + * +*/ +GP_API void gpHal_RefreshAbsoluteEvent(gpHal_AbsoluteEventId_t eventNbr, UInt32 absTime, UInt8 control); + +/** + * @brief Unschedules an Absolute Event. + * + * This function disables the Absolute Event in the GP chip and returns the current EventState. + * Possible Event States are enumerated in the enumeration gpHal_EventState. + * + * @param eventNbr The index of the Absolute Event (1..16). +*/ +GP_API gpHal_EventState_t gpHal_UnscheduleAbsoluteEvent(gpHal_AbsoluteEventId_t eventNbr); + +/** + * @brief Returns all information about a registered event. + * + * This function returns the AbsoluteEventDescriptor_t structure of an Absolute Event. + * + * This function needs to be used carefully, because it temporarilly disables the event and the event could be missed. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidHandle (no Absolute Event registered at given index) + * + * @param eventNbr The index of the Absolute Event (1..16). + * @param pAbsoluteEvent The pointer where the AbsoluteEventDescriptor_t structure is returned. +*/ +GP_API gpHal_Result_t gpHal_MonitorAbsoluteEvent(UInt8 eventNbr, gpHal_AbsoluteEventDescriptor_t* pAbsoluteEvent); + +/** + * @brief Schedules an immediate event trigger in the GP chip. + * + * This function uploads and activates the Relative Event in the GP chip Event Scheduler immediately. + * + * @param type Type of event to execute without delay +*/ +GP_API void gpHal_ScheduleImmediateEvent(gpHal_EventType_t type); + +/** + * @brief Schedules the External Event in the GP chip + * + * This function uploads and activates the External Event in the GP chip Event Scheduler. To facilitate a callback on the execution of the event + * the callback must be registered using gpHal_RegisterExternalEventCallback() and the interrupt enabled using gpHal_EnableExternalEventCallbackInterrupt(). + * + * @param pExternalEventDescriptor Pointer to the gpHal_ExternalEventDescriptor_t structure containing the Event options. +*/ +GP_API void gpHal_ScheduleExternalEvent(gpHal_ExternalEventDescriptor_t* pExternalEventDescriptor); + +/** + * @brief Unschedules the External Event. + * + * This function disables the External Event in the GP chip. + * + * Possible results are: + * - gpHal_ResultSuccess +*/ +GP_API gpHal_Result_t gpHal_UnscheduleExternalEvent(void); + +/** + * @brief Returns all information about the External Event. + * + * This funcion returns the gpHal_ExternalEventDescriptor_t structure of the External Event. + * The contents of the structure are only valid in case the function returns gpHal_ResultSuccess. + * + * Possible results are: + * - gpHal_ResultSuccess (valid External Event found) + * - gpHal_ResultInvalidRequest (no valid External Event present) + * + * @param pExternalEventDescriptor The pointer where the gpHal_ExternalEventDescriptor_t structure is returned. +*/ +GP_API gpHal_Result_t gpHal_MonitorExternalEvent(gpHal_ExternalEventDescriptor_t* pExternalEventDescriptor); + +// Sleep functions +/** + * @brief Sets the sleep mode of the GP chip. + * + * This function sets the sleep mode of the GP chip. As enumerated under the enumeration gpHal_SleepMode the GP chip can be put into 4 different sleep modes. + * The desired setting can be made using this function. + * + * @param mode The sleepmode enumerated in gpHal_SleepMode. + * @return gpHal_ResultSuccess only if the operation was successful +*/ +GP_API gpHal_Result_t gpHal_SetSleepMode(gpHal_SleepMode_t mode); + +/** + * @brief Gets the sleep mode of the GP chip. + * + * This function returns which sleep mode is currently set. The return mode is returned as enumerated under the enumeration gpHal_SleepMode. +*/ +GP_API gpHal_SleepMode_t gpHal_GetSleepMode(void); +/** + * @brief Gets the actual (measured) deviation of a sleep clock with respect to the 32 MHz clock + * + * This function returns whether the measurements for the requested sleep mode have been performed and what the + * measured frequency is. +*/ +GP_API gpHal_SleepClockMeasurementStatus_t gpHal_GetMeasuredSleepClockFrequency(gpHal_SleepMode_t mode, UInt32* frequencymHz); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +/** + * @brief Returns the average sleep clock accuracy of the currently selected sleep clock +*/ +GP_API UInt16 gpHal_GetSleepClockAccuracy(void); + +/** + * @brief Returns the worst-case sleep clock accuracy of the currently selected sleep clock +*/ +GP_API UInt16 gpHal_GetWorstSleepClockAccuracy(void); + +#ifdef __cplusplus +} +#endif + + +#endif /* _HAL_GP_ES_H_ */ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW.h new file mode 100644 index 0000000..174908d --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW.h @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * gpHal_HW.h + * + * This file switches between the HW access modes (SPI, I2C, ...) + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * + */ + +#ifndef _HAL_GP_HW_H_ +#define _HAL_GP_HW_H_ + +/** + * @file gpHal_HW.h + * @brief This file switches between the HW access modes (SPI, I2C, ...) +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "hal.h" +#include "gpAssert.h" + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/** @brief A macro that is used to print log messages. + * + * A macro that is used to print log messages inside of the GPHAL. This macro is + * inserted in the GPHAL where the log messages are useful. By default, + * this macro is empty and it is up to the GPHAL user to implement it. + * + * @param fmt The format string of the print message. + * @param ... List of parameters for the print message. The first parameter of this list should be + * the length of the parameters in bytes. + */ +#if defined(GP_DIVERSITY_LOG) +#include "gpLog.h" + +#ifndef HAVE_NO_VARIABLE_LENGTH_MACRO +#define GP_LOG(fmt, ...) GP_LOG_SYSTEM_PRINTF(fmt, __VA_ARGS__) +#else +/* workaround for Holtek and others + * to avoid varargs macro trouble with holtec we always define it + * as GP_LOG_PRINTF, and not as an empty statement. + * gpLog.h is responsible to make it an empty statement/function + */ +#define GP_LOG GP_LOG_PRINTF +#endif //HAVE_NO_VARIABLE_LENGTH_MACRO + +#else + +#ifndef HAVE_NO_VARIABLE_LENGTH_MACRO +#define GP_LOG(fmt, ...) do {} while (false) +#else +#define GP_LOG +#endif //HAVE_NO_VARIABLE_LENGTH_MACRO + +#endif //GP_DIVERSITY_DEVELOPMENT && defined(GP_DIVERSITY_LOG) + +# include "gpHal_HW_MSI.h" + +/** only defined for internal usage*/ +#define GP_HAL_IS_ONLY_PROP_IN_REG(prop) (prop##_MASK == prop##_REG_BITS_IN_USE) +#define GP_HAL_CHECK_ONLY_PROP_IN_REG(prop) COMPILE_TIME_ASSERT(GP_HAL_IS_ONLY_PROP_IN_REG(prop)) +#define GP_HAL_CHECK_PROP_MATCHES_REG(prop,reg) COMPILE_TIME_ASSERT(prop##_REGISTER == reg) +#define GP_HAL_PROPOFFSET2REG(Offset, Property) (((UInt16) (Offset)) + Property##_REGISTER) +#define GP_HAL_CHECK_ONLY_PROPS_IN_REG(prop1, prop2) \ + do { \ + COMPILE_TIME_ASSERT(prop1##_REGISTER == prop2##_REGISTER); \ + COMPILE_TIME_ASSERT((prop1##_MASK | prop2##_MASK) == prop1##_REG_BITS_IN_USE); \ + } while (0) + +//actual check should be: if arrays on stack with run-time size is allowed +#ifdef __GNUC__ +//compile time assert on non-const will succeed, we can use it always +/**part of implementation, don't use*/ +#define GP_ASSERT_EARLY(cond) \ + do { \ + COMPILE_TIME_ASSERT(cond); \ + GP_ASSERT_DEV_INT(cond); \ + } while (false) +#else +//compile time assert on non-const will give syntax error, don't use +/**part of implementation, don't use*/ +#define GP_ASSERT_EARLY(cond) GP_ASSERT_DEV_INT(cond) +#endif +/** part of implementation, don't use */ +#define GP_HAL_VAL2PLACEDVAL(Value, Property) (((UInt8) (Value)) << Property##_LSB) +/** part of implementation, don't use! Use GP_HAL_WRITE_PROPTO */ +#define GP_HAL_BASE_WRITE_PROPTO(Byte, Property, Value) \ + do { \ + COMPILE_TIME_ASSERT(Property##_WRITABLE==1); \ + /* check if the value fits in the property*/ \ + GP_ASSERT_EARLY(((Value) & (Property##_MASK >> Property##_LSB)) == (Value)); \ + /* the if clause produces better code than the else on the xap, */ \ + /* even for mask 0xFF: no (value and 0xFF)*/ \ + if (GP_HAL_IS_ONLY_PROP_IN_REG(Property)) \ + { \ + (Byte) = GP_HAL_VAL2PLACEDVAL(Value, Property); \ + } \ + else \ + { \ + (Byte) = ((Byte) & ~(Property##_MASK)) \ + | (GP_HAL_VAL2PLACEDVAL(Value, Property) & (Property##_MASK)); \ + } \ + } while (0) + +/** @brief A macro to modify a property in a cached version of a GP chip register. + * + * A macro to modify a property in a cached version of a GP chip register. + * This cached memory has to written to the real register to have any effect. + * Use this to change several properties in the same register in an efficient manner. + * + * @param Byte the cached version register in memory. + * @param Property Property name (only use with regprop definition). + * @param Value Value to be set. + * @param Reg The GP chip register name that the Byte parameter represents. + */ +#define GP_HAL_WRITE_PROPTO(Byte, Reg, Property, Value) \ + do { \ + GP_HAL_CHECK_PROP_MATCHES_REG(Property, Reg); \ + GP_HAL_BASE_WRITE_PROPTO(Byte, Property, Value); \ + } while (0) + +/** internal usage, main code in auxiliary macro to make property substitution work as intended */ +#define GP_HAL_WRITE_PROP_OFFSET_AUX(Offset, Property, Value) \ + do { \ + COMPILE_TIME_ASSERT(Property##_WRITABLE==1); \ + /* check if the value fits in the property*/ \ + GP_ASSERT_EARLY(((Value) & (Property##_MASK >> Property##_LSB)) == (Value)); \ + if (Property##_READABLE && !(GP_HAL_IS_ONLY_PROP_IN_REG(Property))) \ + { \ + GP_HAL_READMODIFYWRITE_REG( ((UInt16) (Offset)) + Property##_REGISTER, Property##_MASK, GP_HAL_VAL2PLACEDVAL(Value, Property) );\ + } \ + else \ + { /* not readable/write to whole register*/ \ + GP_HAL_WRITE_REG( ((UInt16) (Offset)) + Property##_REGISTER, GP_HAL_VAL2PLACEDVAL(Value, Property)); \ + } \ + } while (0) + +/** @brief A macro to write a specific field (=property) in a register, + * for a property that is offset based. + * + * A macro to write a specific field (= property) in a register, + * for a property that is offset based. + * Register definitions are needed to preprocess these instructions. + * The register must be relative to a base address: for use with PBM, ES and other repeating structures. + * + * @param Offset Base address of the entry to which the property applies. + * @param Property Property name (only use with regprop definition). + * @param Value Value to be set. +*/ +#define GP_HAL_WRITE_PROP_OFFSET(Offset, Property, Value) GP_HAL_WRITE_PROP_OFFSET_AUX(Offset, Property, Value) + +/** @brief A macro to write a specific field (= property) in a register . + * + * A macro to write a specific field (= property) in a register. Register definitions are needed to preprocess these instructions . + * + * @param Property Property name (only use with regprop definition). + * @param Value Value to be set. +*/ +#define GP_HAL_WRITE_PROP(Property, Value) GP_HAL_WRITE_PROP_OFFSET(0, Property, Value) + + +/** internal*/ +#define GP_HAL_UNSAFE_WRITE_PROP(Property, Value) GP_HAL_WRITE_PROP_OFFSET_AUX(0, Property, Value) + +/* use this to force low-level signals */ +#define GP_HAL_TDC_ENABLE(Property, Value) \ + do \ + { \ + GP_HAL_WRITE_PROP(Property, Value); \ + GP_HAL_UNSAFE_WRITE_PROP(Property##_TDC_ENABLE, true); \ + } while (false) + + +/** part of implementation, don't use */ +#define GP_HAL_PLACEDVAL2VAL(Byte, Prop) \ + ( GP_HAL_IS_ONLY_PROP_IN_REG(Prop) \ + ? (((UInt8) (Byte)) >> Prop##_LSB) \ + : ((((UInt8) (Byte)) & Prop##_MASK) >> Prop##_LSB) \ + ) + +#define GP_HAL_BASE_READ_PROPFROM(Byte, Property) \ + ( COMPILE_TIME_ASSERT(Property##_READABLE), \ + (UInt8) GP_HAL_PLACEDVAL2VAL(Byte, Property) \ + ) + +/** @brief Read a property from a byte buffer. + * A macro to read a specific bit field (=property) of a byte buffer. + * + * @param Byte The byte buffer. + * @param Reg The register of the property to access. This parameter is used in order to check + * the consistency between the byte buffer and the accessed property. + * @param Property Property name (only use with regprop definition). +*/ +#define GP_HAL_READ_PROPFROM(Byte, Reg, Property) \ + ( GP_HAL_CHECK_PROP_MATCHES_REG(Property, Reg), \ + GP_HAL_BASE_READ_PROPFROM(Byte, Property) \ + ) + + +/** main code in auxiliary macro to make property substitution work as intended */ +#define GP_HAL_READ_PROP_OFFSET_AUX(Offset, Property) \ + GP_HAL_BASE_READ_PROPFROM(GP_HAL_READ_REG(((UInt16) (Offset)) + Property##_REGISTER), Property) + +/** @brief A macro to read a specific field (= property) of a register, + * for a property that is offset based + * + * A macro to read a specific field (= property) of a register, + * for a property that is offset based. + * Register definitions are needed to preprocess these instructions. + * + * @param Offset Base address of the entry to which the property applies. + * @param Property Property name (only use with regprop definition). +*/ +#define GP_HAL_READ_PROP_OFFSET(Offset, Property) GP_HAL_READ_PROP_OFFSET_AUX(Offset, Property) + +/** @brief A macro to read a specific field (= property) of a register. + * + * A macro to read a specific field (= property) of a register. Register definitions are needed to preprocess these instructions. + * + * @param Property Property name (only use with regprop definition). +*/ +#define GP_HAL_READ_PROP(Property) GP_HAL_READ_PROP_OFFSET(0, Property) + + +/** @brief A macro to modify some bits of a specific field (= property) in a register . + * + * A macro to modify some bits in a specific field (= property) in a register. Register definitions are needed to preprocess these instructions . + * + * @param Prop Property name (only use with regprop definition). + * @param Mask The read-modify-write mask. + * @param Data The Value to write. +*/ +#define GP_HAL_READMODIFYWRITE_PROP(Prop, Mask, Data) do \ +{ \ + UInt8 newData = (GP_HAL_READ_PROP(Prop) & ~(Mask)) | ((Data) & (Mask)); \ + GP_HAL_WRITE_PROP(Prop, newData); \ +} while (false) + +/* These macros read or write 2,4 or 8 bytes. (no endiannness conversion) + * if a particular implementation has efficient methods to access two/four/eight bytes, it can provide it's own implementations. + * (macro or inline). It should however set the various HAVE_ macros. + * for ease of use we define here default implementations. + */ +#ifndef GP_HAL_HAVE_READ_TWO_BYTES +#define GP_HAL_READ_TWO_BYTES(Address, pBuffer) GP_HAL_READ_BYTE_STREAM(Address, pBuffer, 2) +#endif +#ifndef GP_HAL_HAVE_READ_FOUR_BYTES +#define GP_HAL_READ_FOUR_BYTES(Address, pBuffer) GP_HAL_READ_BYTE_STREAM(Address, pBuffer, 4) +#endif +#ifndef GP_HAL_HAVE_READ_EIGHT_BYTES +#define GP_HAL_READ_EIGHT_BYTES(Address, pBuffer) GP_HAL_READ_BYTE_STREAM(Address, pBuffer, 8) +#endif +#ifndef GP_HAL_HAVE_WRITE_TWO_BYTES +#define GP_HAL_WRITE_TWO_BYTES(Address, pBuffer) GP_HAL_WRITE_BYTE_STREAM(Address, pBuffer, 2) +#endif +#define GP_HAL_WRITE_THREE_BYTES(Address, pBuffer) GP_HAL_WRITE_BYTE_STREAM(Address, pBuffer, 3) +#ifndef GP_HAL_HAVE_WRITE_FOUR_BYTES +#define GP_HAL_WRITE_FOUR_BYTES(Address, pBuffer) GP_HAL_WRITE_BYTE_STREAM(Address, pBuffer, 4) +#endif +#ifndef GP_HAL_HAVE_WRITE_EIGHT_BYTES +#define GP_HAL_WRITE_EIGHT_BYTES(Address, pBuffer) GP_HAL_WRITE_BYTE_STREAM(Address, pBuffer, 8) +#endif + +/** @brief A macro to read a 16 bit value. + * + * A macro to read a 16 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to read + * @param pBuffer The buffer where the data is returned. +*/ +#define GP_HAL_READ_REGS16(Address, pBuffer) do { GP_HAL_READ_TWO_BYTES(Address, pBuffer); RF_TO_HOST_UINT16(pBuffer); } while(false) + +/** @brief A macro to read a 32 bit value. + * + * A macro to read a 32 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to read + * @param pBuffer The buffer where the data is returned. +*/ +#define GP_HAL_READ_REGS32(Address, pBuffer) do { GP_HAL_READ_FOUR_BYTES(Address, pBuffer); RF_TO_HOST_UINT32(pBuffer); } while(false) + +/** @brief A macro to read a 64 bit value. + * + * A macro to read a 64 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to read + * @param pBuffer The buffer where the data is returned. +*/ +#define GP_HAL_READ_REGS64(Address, pBuffer) do { GP_HAL_READ_EIGHT_BYTES(Address, pBuffer); RF_TO_HOST_UINT64(pBuffer); } while(false) + +/** @brief A macro to write a 16 bit value. + * + * A macro to write a 16 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to write + * @param pBuffer The buffer where the data to write is read from. +*/ +#define GP_HAL_WRITE_REGS16(Address,pBuffer) do { HOST_TO_RF_UINT16(pBuffer); GP_HAL_WRITE_TWO_BYTES(Address, pBuffer); RF_TO_HOST_UINT16(pBuffer); } while(false) + +/** @brief A macro to write a 24 bit value. + * + * A macro to write a 24 bit value. The macro takes care of the endianness of the host processor. The argument should be a 32-bit value. + * + * @param Address The address of the value to write + * @param pBuffer The buffer where the data to write is read from. +*/ +#define GP_HAL_WRITE_REGS24(Address,pBuffer) do { HOST_TO_RF_UINT32(pBuffer); GP_HAL_WRITE_THREE_BYTES(Address, pBuffer); RF_TO_HOST_UINT32(pBuffer); } while(false) + +/** @brief A macro to write a 32 bit value. + * + * A macro to write a 32 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to write + * @param pBuffer The buffer where the data to write is read from. +*/ +#define GP_HAL_WRITE_REGS32(Address,pBuffer) do { HOST_TO_RF_UINT32(pBuffer); GP_HAL_WRITE_FOUR_BYTES(Address, pBuffer); RF_TO_HOST_UINT32(pBuffer); } while(false) + +/** @brief A macro to write a 64 bit value. + * + * A macro to write a 64 bit value. The macro takes care of the endianness of the host processor. + * + * @param Address The address of the value to write + * @param pBuffer The buffer where the data to write is read from. +*/ +#define GP_HAL_WRITE_REGS64(Address,pBuffer) do { HOST_TO_RF_UINT64(pBuffer); GP_HAL_WRITE_EIGHT_BYTES(Address, pBuffer); RF_TO_HOST_UINT64(pBuffer); } while(false) + +//------------------------------------------------------------------------------ +// INTERRUPT CONTROL COMMANDS +//------------------------------------------------------------------------------ + +//Turn off/on all interrupt sources of the micro processor +/** @brief Enable the interrupts on the micro processor*/ +#define ENABLE_GP_GLOBAL_INT() HAL_ENABLE_GLOBAL_INT() +/** @brief Disables the interrupts on the micro processor */ +#define DISABLE_GP_GLOBAL_INT() HAL_DISABLE_GLOBAL_INT() + +#endif //_HAL_GP_HW_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW_MSI.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW_MSI.h new file mode 100644 index 0000000..91e1196 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_HW_MSI.h @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2009-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpHal_HW_MSI.h + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPHAL_HW_MSI_H_ +#define _GPHAL_HW_MSI_H_ + +/** + * @file gpHal_HW_MSI.h + * @brief This file contains the functions dependent on the choice of MCU : MSI, Interrupts,... + * This particular file does it using the MSI protcol + our own hal functionality + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "gpBsp.h" //uC MSI (SPI/I2C) functions +#include "hal.h" //uC INT functions + +//this header implements GP_HAL_READ_REG, GP_HAL_WRITE_REG etc. +#include "gpHal_MSI.h" +//Get chip specific MSI definitions +#include "gpHal_reg.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ +//------------------------------------------------------------------------------ + +//Initialize MSI and wakeup,interrupt and reset pins +/** @brief Micro processor dependent macro to initialize communication interface and reset,interrupt and wakeup pins. */ +#define HAL_GP_HW_INIT() { HAL_WKUP_START(); HAL_SET_RESET_INACTIVE(); GP_MSI_INIT(); CONFIG_INTERRUPT_LINE(); } + +//------------------------------------------------------------------------------ +// INTERRUPT CONTROL COMMANDS +//------------------------------------------------------------------------------ + +#ifndef HAL_ISR_RADIO_INTERRUPT_START +#define HAL_ISR_RADIO_INTERRUPT_START(x) // not implemented yet for all ucHal variants +#endif + +//Register interrupt GP +/** @brief Intializes the interrupt line at micro processor side. + * + * This macro configures the pin on which the GP chip INTOUTn pin is connected as an input pin and configures the interrupt + * attached to this pin as a low level interrupt. +*/ +#define HAL_GP_INTERRUPT_INIT() \ + do { \ + HAL_ISR_RADIO_INTERRUPT_START( gpHal_ISR_Interrupt ); \ + HAL_RADIO_INTERRUPT_START( gpHal_Interrupt ); \ + } while(0) +//------------------------------------------------------------------------------ +// I/O CONTROL COMMANDS +//------------------------------------------------------------------------------ + +/** @brief Puts a high signal on the WKUP pin of the GP chip. + * + * Wakeup of the GP chip is done on a falling edge of the WKUP pin. +*/ +#define HAL_GP_SET_WAKEUP() HAL_SET_WKUP_ACTIVE() +/** @brief Puts a low signal on the WKUP pin of the GP chip. + * + * Wakeup of the GP chip is done on a falling edge of the WKUP pin. +*/ +#define HAL_GP_CLR_WAKEUP() HAL_SET_WKUP_INACTIVE() + + +#define HAL_GP_PULSE_WAKEUP() \ +do{ \ + HAL_GP_SET_WAKEUP();\ + HAL_GP_CLR_WAKEUP();\ +}while(false); + +/** @brief Sets the reset of the GP chip active. + * + * This macro sets and holds the GP chip in a reset state. + */ +#define HAL_GP_SET_RESET(level) HAL_SET_RESET_ACTIVE(level) +/** @brief Puts the reset of the GP chip inactive + * + * This macro releases the reset of the GP chip. +*/ +#define HAL_GP_CLR_RESET() HAL_SET_RESET_INACTIVE() + +#endif /* _GPHAL_HW_MSI_H_ */ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC.h new file mode 100644 index 0000000..bece601 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC.h @@ -0,0 +1,802 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + + +#ifndef _GPHAL_MAC_H_ +#define _GPHAL_MAC_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_RomCode_MAC.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/** @file gpHal_MAC.h + * @brief This file contains all the functions needed for MAC functionality. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpHal_reg.h" +#include "gpHal_HW.h" +#include "gpHal_Phy.h" +#include "gpPd.h" +#include "gpPad.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/** @brief Default value of the time to live setting of a PBM entry. */ +#define GPHAL_TTL_START_VALUE 20 + +/** @brief Maximum amount of channels used to do multi channel retries */ +#define GP_HAL_MULTICHANNEL_MAX_CHANNELS 3 + +/** @brief Maximum number of slots (simultaneously active RX channels) */ +#define GP_HAL_MAX_NUM_OF_SLOTS 6 + +/** @brief Define to ignore channel used in the multiChannel options struct */ +#define GP_HAL_MULTICHANNEL_INVALID_CHANNEL 0xFF + +/** @brief Offset in IEEE packet to check if Ack Request is required */ +#define GPHAL_ACK_REQ_LSB 5 + +// the result from formula 14 from the IEEE-802.15.4 spec is 31776 us ==> 0x7C2 symbols +#define GPHAL_POLL_REQ_MAX_WAIT_TIME 0x7C2 + +#define GPHAL_MAX_15_4_FCS_LENGTH 2 + +#define GPHAL_MAX_15_4_PACKET_LENGTH 127UL + +/** @brief Maximum length of a payload that can be written into a PBM entry. */ +#define GPHAL_MAX_15_4_PACKET_LENGTH_NO_FCS (GPHAL_MAX_15_4_PACKET_LENGTH - GPHAL_MAX_15_4_FCS_LENGTH) + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ +//------------------------------------------------------------------------------ +// ENUMERATIONS +//------------------------------------------------------------------------------ + + + +//@{ +/** @name gpHal_MacScenario_t */ +// MacScenarios +#define gpHal_MacDefault 0x0 +/** gpHal_MacSPollReq Mac Scenario to send a Poll Req*/ +#define gpHal_MacPollReq 0x1 +/** gpHal_MacTimedTx Put frame on timed TX queue; will be sent at next event gpHal_EventTypeTXPacket */ +#define gpHal_MacTimedTx 0x2 +/** gpHal_MacManualCrc Mac scenario to manually set a CRC checksum (a corrupt one if applicable for the test) */ +#define gpHal_MacManualCrc 0x3 +/** gpHal_MacManualCrc Mac scenario to manually set a CRC checksum (a corrupt one if applicable for the test), and force the retries tp 0 */ +#define gpHal_MacManualCrc_NoRetries 0x4 +/** @typedef gpHal_MacScenario_t + * @brief The gpHal_MacScenario_t type defines the Mac Scenario as defined in the databook. +*/ +typedef UInt8 gpHal_MacScenario_t; +//@} + + + + +/** @name gpHal_SourceIdentifier_t */ +//@{ +/** @brief Identifier for first Pan (pan 0) */ +#define gpHal_SourceIdentifier_0 0x0 +/** @brief Identifier for second Pan (pan 1) */ +#define gpHal_SourceIdentifier_1 0x1 +/** @brief Identifier for third Pan (pan 2) */ +#define gpHal_SourceIdentifier_2 0x2 +/** @brief Identifier for invalid value */ +#define gpHal_SourceIdentifier_Inv 0xFF +/** @typedef gpHal_SourceIdentifier_t + * @brief A source identifier refers to a group of settings (address, PAN, channel). + * + * The number of supported source identifiers depends on the device type and is specified as GP_HAL_NUMBER_OF_RX_SRCIDS. + */ +typedef UInt8 gpHal_SourceIdentifier_t; +//@} + +/** @brief This function sets the rx mode configuration for the MAC part of the radio. + * + * This function sets the rx mode configuration for the MAC part of the radio. + * + * @param enableMultiStandard Allows concurrent listening on ZigBee and BLE channels (not compatible with the other two options). + This option is also known as ConcurrentConnect™. Note that this is not available on some older products. + * + * @param enableMultiChannel Allows listening to multiple ZigBee channels simultaneously (not compatible with the other two options) + * + * @param enableHighSensitivity Allows for higher sensitivity ZigBee reception (not compatible with the other two options) + * + * @return gpHal_Result_t + * Possible results are : + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidParameter (invalid combination was selected) + */ +gpHal_Result_t gpHal_SetMacRxMode(Bool enableMultiStandard, Bool enableMultiChannel, Bool enableHighSensitivity); + +/** @brief This function gets the rx mode configuration for the MAC part of the radio. + * + * This function gets the rx mode configuration for the MAC part of the radio. + * + * @param enableMultiStandard Pointer to Bool indicating: concurrent listening on ZigBee and BLE channels (not compatible with the other two options) + * + * @param enableMultiChannel Pointer to Bool indicating: listening to multiple ZigBee channels simultaniously (not compatible with the other two options) + * + * @param enableHighSensitivity Pointer to Bool indicating: for higher sensitivity ZigBee reception (not compatible with the other two options) + * + * @return void + */ +void gpHal_GetMacRxMode(Bool* enableMultiStandard, Bool* enableMultiChannel, Bool* enableHighSensitivity); + +//@{ +/** @struct gpHal_DataReqOptions_t + * @param gpHal_MacScenario_t + * @brief These options dictate the way a data packet should be transmitted +*/ +typedef struct gpHal_DataReqOptions_s{ + gpHal_MacScenario_t macScenario; + gpHal_SourceIdentifier_t srcId; + Bool rawEncryptionEnable; + Bool rawKeepFrameCounter; + UInt16 rawAuxOffset; + UInt16 rawDataOffset; + UInt16 rawCslIeOffset; +}gpHal_DataReqOptions_t; +//@} + + + +/** @typedef gpHal_DataIndicationCallback_t + * @brief The gpHal_DataIndicationCallback_t callback type definition defines the callback prototype of the DataIndication.*/ +typedef void (*gpHal_DataIndicationCallback_t)(gpPd_Loh_t pdLoh, gpHal_RxInfo_t *rxInfo); + +/** @typedef gpHal_SnifferDataIndicationCallback_t + * @brief The gpHal_SnifferDataIndicationCallback_t callback type definition defines the callback prototype of the SnifferDataIndication.*/ +typedef void (*gpHal_SnifferDataIndicationCallback_t)(gpPd_Loh_t pdLoh, gpHal_RxInfo_t *rxInfo); + +/** @typedef gpHal_DataConfirmCallback_t + * @brief The gpHal_DataConfirmCallback_t callback type definition defines the callback prototype of the DataConfirm.*/ +typedef void (*gpHal_DataConfirmCallback_t)(UInt8 status, gpPd_Loh_t pdLoh, UInt8 lastChannelUsed); + +/** @typedef gpHal_EDConfirmCallback_t + * @brief The gpHal_EDConfirmCallback_t callback typedef defines the callback prototype of the EDConfirm. + * + * The parameter protoED isn't the real energy level. The real energy level needs to be calculated with the function gpHal_CalculateED(). + */ +typedef void (*gpHal_EDConfirmCallback_t)(UInt16 channelMask, UInt8 *protoED); + +/** @typedef gpHal_BusyTXCallback_t + * @brief The gpHal_BusyTXCallback_t callback type definition defines the callback prototype of the BusyTX interrupt. */ +typedef void (*gpHal_BusyTXCallback_t)(void); + +/** @typedef gpHal_EmptyQueueCallback_t + * @brief The gpHal_EmptyQueueCallback_t callback type definition defines the callback prototype of the EmptyQueue interrupt. */ +typedef void (*gpHal_EmptyQueueCallback_t)(void); + +/** @typedef gpHal_CmdDataReqCallback_t + * @brief The gpHal_CmdDataReqCallback_t callback type definition defines the callback prototype of the Cmd Data Req interrupt. */ +typedef void (*gpHal_CmdDataReqCallback_t)(void); + +typedef void (*gpHal_MacFrameQueued_t)(void); +typedef void (*gpHal_MacFrameUnqueued_t)(void); + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif +// see gpHal_DEFS.h +// MAC public functions + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs_MAC.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +//MAC-SEC interrupts +/** + * @brief Enables the interrupt line of the MAC and SEC operations. + * + * This function sets the interrupt mask of the PIO block. + * + * @param enable Enables the interrupt source if true. +*/ +#define gpHal_EnablePrimitiveCallbackInterrupt(enable) GP_HAL_ENABLE_PIO_INT(enable) +/** + * @brief Enables the interrupt line of the Empty Queue interrupt. + * + * This function sets the interrupt mask of the Empty Queue interrupt. + * + * @param enable Enables the interrupt source if true. +*/ +#define gpHal_EnableEmptyQueueCallbackInterrupt(enable) GP_HAL_ENABLE_EMPTY_QUEUE_CALLBACK_INTERRUPT(enable) + +/** + * @brief Enables the interrupt line of the BusyTX interrupt. + * + * This function sets the interrupt mask of the BusyTX interrupt. + * + * @param enable Enables the interrupt source if true. +*/ +#define gpHal_EnableBusyTXCallbackInterrupt(enable) GP_HAL_ENABLE_BUSY_TX_CALLBACK_INTERRUPT(enable) +/** + * @brief Registers the callback for a DataConfirm. + * + * This function registers the callback for a DataConfirm. The callback will be executed on a DataConfirm interrupt. + * This DataConfirm will be given after a DataRequest is finished. + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterDataConfirmCallback(gpHal_DataConfirmCallback_t callback); + +/** + * @brief Registers the callback for a DataIndication. + * + * This function registers the DataIndication callback. The callback will be executed on a DataIndication interrupt + * This DataIndication will be given if a packet is received. + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterDataIndicationCallback(gpHal_DataIndicationCallback_t callback); + + +/** + * @brief Registers the callback for a EDConfirm. + * + * This function registers the EDConfirm callback. The callback will be executed on a EDConfirm interrupt + * This EDConfirm will be given after a EDRequest is finished + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterEDConfirmCallback(gpHal_EDConfirmCallback_t callback); + +/** + * @brief Registers the callback for a BusyTX interrupt. + * + * This function registers the BusyTX callback. The callback will be executed on a BusyTX interrupt, i.e. + * is triggered when the MAC receives a TX trigger while he is already transmitting another packet. + * The BusyTX interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterBusyTXCallback(gpHal_BusyTXCallback_t callback); + +/** + * @brief Registers the callback for Empty Queue interrupt. + * + * This function registers the EmptyQueue callback. The callback will be executed on an Empty Queue interrupt, i.e. + * is triggered when a TX trigger is given to the MAC when no packet is pending in the TX queue. + * The Empty Queue interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterEmptyQueueCallback(gpHal_EmptyQueueCallback_t callback); + +/** + * @brief Registers the callback for the reception of a Cmd Data Req interrupt. + * + * This function registers the CmdDataReq callback. + * This function determines whether the Frame Pending bit in an Ack needs to be set. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterCmdDataReqConfirmCallback(gpHal_CmdDataReqCallback_t callback); + +/** @brief Start a data transmission. + * + * Performs a DataRequest(according to the IEEE802.15.4 specification). + * The DataConfirm function can be registered as a callback using gpHal_RegisterDataConfirmCallback(). + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy (no packet buffer available) + * - gpHal_ResultInvalidParameter + * + * @param dataReqOptions csma, multiChannelOptions, macScenario + * @param pdLoh The packet descriptor structure that contains length, offset and unique handle of the packet content. +*/ +GP_API gpHal_Result_t gpHal_DataRequest(gpHal_DataReqOptions_t *dataReqOptions, gpPad_Handle_t padHandle, gpPd_Loh_t pdLoh); + +/** @brief Returns the listening channel currently used + * + * @param srcId The source identifier. +*/ +GP_API UInt8 gpHal_GetRxChannel(gpHal_SourceIdentifier_t srcId); + +/** @brief This function returns the last 802.15.4 channel used to transmit on. + * + * This function returns the last 802.15.4 channel used to transmit on. + * + * @param PBMentry The last transmitted PBM + * @return channel The last 802.15.4 channel the radio transmitted on + * + */ +GP_API UInt8 gpHal_GetLastUsedChannel(UInt8 PBMentry); + +/** @brief This function returns @true if the raw frame encryption was done successfully. + * + * This function returns @true if the raw frame encryption was done successfully. + * Supported since k8c (but not on k8d) + * + * @param PBMentry The last transmitted PBM + * @return encryptionDone Whether or not raw frame TX enryption was done successfully + * + */ +GP_API Bool gpHal_GetTxEncryptionDone(UInt8 PBMentry); + +/** @brief Configure the default transmit power for each channel + * + * @param pointer to 16 byte array with default transmit power for each IEEE channel (11..26). + * +*/ +GP_API void gpHal_SetDefaultTransmitPowers(gpHal_TxPower_t* pDefaultTransmitPowerTable ); + +/** @brief Get the current default transmit power for the specified channel. + */ +GP_API gpHal_TxPower_t gpHal_GetDefaultTransmitPower(gpHal_Channel_t channel); + +/** @brief Set the CCA Threshold setting */ + +GP_API void gpHal_SetCCAThreshold(void); + + + + + +/** @brief Writes data in the specified pbm address*/ +#define gpHal_WriteDataInPbm(address,pData,length,offset) GP_HAL_WRITE_DATA_IN_PBM(address,pData,length,offset) + +#define gpHal_CalculateTxPbmDataBufferAddress(pbmEntry) GP_HAL_CALCULATE_TX_PBM_DATA_BUFFER_ADDRESS(pbmEntry) + +#define gpHal_CheckPbmValid(pbmEntry) GP_HAL_CHECK_PBM_VALID(pbmEntry) + +/** @brief Sets the Rx packet in packet mode + * + * The function sets the Rx packet in packet mode on or off + * +*/ +#define gpHal_SetPipMode(pipmode) GP_HAL_SET_PIP_MODE(pipmode) + +/** @brief Returns the number packet in packet mode */ +#define gpHal_GetPipMode() GP_HAL_GET_PIP_MODE() + + +GP_API gpHal_Result_t gpHal_GetRadioState(void); + +// MAC ED Request +/** @brief Performs a Energy Detect request according to the IEEE802.15.4 spec + * + * This function triggers an energy detection. The energy value of this function is given in the + * EDConfirm callback (to be registered with gpHal_RegisterEDConfirmCallback). + * + * To stop an ongoing ED Request, call this function again with time_us 0 and channelMask 0x0000. + * The scan will be aborted and the confirm will be generated with the results up to that point. + * Note this stop request will not generate a confirm. + * + * Possible results are : + * - gpHal_ResultSuccess + * - gpHal_ResultBusy (no packet buffer available) + * + * @param time_us Time period to scan on each channel given in the channelMask (in us). + * @param channelMask Mask of channels to scan. LSB bit = channel 11, MSB bit = channel 26. +*/ +GP_API gpHal_Result_t gpHal_EDRequest(UInt32 time_us , UInt16 channelMask); + +/** @brief Set the PAN ID + * + * This function sets the PAN ID . + * Setting the PAN ID of your network enables the automatic filter of + * packets not intended for your device. + * + * @param panId The PAN ID of the network. + * @param srcId The PAN src, we want to change the ID from. +*/ +GP_API void gpHal_SetPanId(UInt16 panId, gpHal_SourceIdentifier_t srcId); + +/** @brief Returns the PAN ID stored + * + * @param srcId The src id of the Pan. + **/ +GP_API UInt16 gpHal_GetPanId(gpHal_SourceIdentifier_t srcId); + +/** @brief Sets the Short Address. + * + * This functions sets the Short Address. + * Setting the Short Address of your device enables the automatic filter of + * packets not intended for your device. + * + * @param shortAddress The Short Address of the device. + * @param srcId The src id of the pan where we want to change the short address. +*/ +GP_API void gpHal_SetShortAddress(UInt16 shortAddress, gpHal_SourceIdentifier_t srcId); + +/** @brief Returns the ShortAddress + * + * @param srcId The src id of the pan where we want to get the short address. + */ +GP_API UInt16 gpHal_GetShortAddress(gpHal_SourceIdentifier_t srcId); + +/** @brief Set the Extended Address + * + * This function sets the Extended Address. + * Setting the Extended Address of your device enables the automatic filter of + * packets not intended for your device. + * @param pExtendedAddress The pointer to the Extended Address of the device. + * @param srcId The src id of the extended address. +*/ +GP_API void gpHal_SetExtendedAddress(MACAddress_t* pExtendedAddress, gpHal_SourceIdentifier_t srcId); + +/** @brief Returns the ExtendedAddress stored + * + * This function returns the extended address stored. + * @param pExtendedAddress pointer where the Extended Address is read back to + * @param srcId The src id of the extended address. +*/ +GP_API void gpHal_GetExtendedAddress(MACAddress_t* pExtendedAddress, gpHal_SourceIdentifier_t srcId); + +/** @brief Resets the ExtendedAddress to its factory value + * + * This function resets the extended address to its initial factory value. + * @param srcId The src id of the extended address. +*/ +GP_API void gpHal_ResetExtendedAddress(gpHal_SourceIdentifier_t srcId); + +/** @brief Set the Coordinator Address + * + * Setting the Coordinator Address enables the filtering of + * packets not coming from the coordinator. + * @param Address The pointer to the Address of the coordinator. +*/ +GP_API void gpHal_SetCoordExtendedAddress(MACAddress_t* pCoordExtendedAddress); +GP_API void gpHal_SetCoordShortAddress(UInt16 shortCoordAddress); + + +/** @brief Set the pan coordinator property + * + * This function sets the pan coordinator property of the device. + * + * @param panCoordinator true if the device is the pan coordinator, false otherwise. +*/ +GP_API void gpHal_SetPanCoordinator(Bool panCoordinator); + +/** @brief Returns the pan coordinator property of this device */ +GP_API Bool gpHal_GetPanCoordinator(void); + +/** @brief Enables/Disables Address Recognition. + * + * This function sets the address recognition options. + * @param enable Possible values are : + * - set to true : destination address of a packet will checked against the address (set by gpHal_SetExtendedAddress and gpHal_SetShortAddress) and destination PAN ID of incoming packets. + * - set to false: address recognition disabled. + * @param panCoordinator Possible values are : + * - set to true : The device is a PAN coordinator. He will accept messages without a destination address. + * - set to false: Normal filtering will be applied according to recognition settings. +*/ +GP_API void gpHal_SetAddressRecognition(Bool enable, Bool panCoordinator); + +/** @brief Returns the addressRecognition flag. */ +#define gpHal_GetAddressRecognition() GP_HAL_GET_ADDRESS_RECOGNITION() + +/** @brief Sets the HW FrameType FilterMask. + * + * This function sets the Frame Type filter mask used by HW + * + * Packets can be filtered out based on their frametype (BCN, DATA, CMD, RSV). + * This can be controlled by setting the filter bitmap with this function. + * Setting a certain type's mask bit to 1 will filter out the packet with that type. + * + * @param bitmap The FrameType FilterMask. +*/ +#define gpHal_SetFrameTypeFilterMask(bitmap) GP_HAL_SET_FRAME_TYPE_FILTER_MASK((bitmap)) + +/** @brief Returns the HW FrameType FilterMask. + * + * This function returns the Frame Type filter mask set in HW. + * Frametypes which have their mask bit set will be filtered out. + * + * @return bitmap The FrameType FilterMask. +*/ +#define gpHal_GetFrameTypeFilterMask() GP_HAL_GET_FRAME_TYPE_FILTER_MASK() + +/** @brief Sets the property for filtering beacons based on src pan. + * + * This function sets the property for filtering beacons based on src pan. + * + * @param enable If we want to enable beacon filtering on src pan or not. +*/ +GP_API void gpHal_SetBeaconSrcPanChecking(Bool enable); + + +/** @brief Gets the property for filtering beacons based on src pan. + * + * This function gets the property for filtering beacons based on src pan. + * +*/ +GP_API Bool gpHal_GetBeaconSrcPanChecking(void); + +/** @brief Sets the RxOnWhenIdle flag. + * + * This function sets the RxOnWhenIdle flag. + * Turns on the receiver when the device is idle. Switching between + * TX and RX is done automatically. + * + * @param srcId Source identifier. + * @param flag Possible values are : + * - set to true : RxOnWhenIdle is activated and the radio is turned on. + * - set to false: RxOnWhenIdle is deactivated. + * @param channel channel to enable radio on +*/ +GP_API void gpHal_SetRxOnWhenIdle(gpHal_SourceIdentifier_t srcId, Bool flag, UInt8 channel); +/** @brief Returns the RxOnWhenIdle flag. */ +#define gpHal_GetRxOnWhenIdle() GP_HAL_GET_RX_ON_WHEN_IDLE() + +/** @brief Sets the Auto Acknowledge flag. + * + * This function sets the Auto Acknowledge flag. + * All packets addressed to the device (see address recognition) will be automatically acknowledge + * (if requested by the MAC headerof the packet). + * @param flag + * - Set to true : Automatic acknowledgement enabled. + * - Set to false: Automatic acknowledgement disabled. +*/ +GP_API void gpHal_SetAutoAcknowledge(Bool flag); +/** @brief Returns the AutoAcknowledge flag. */ +GP_API Bool gpHal_GetAutoAcknowledge(void); + +extern UInt8 gpHal_MacState; + +/** @brief Sets the chip to timed MAC mode + * + * This function sets the chip to timed MAC mode. + * When a timed MAC is used all transmission is done using scheduled triggers from the Event Scheduler (ES). + * This function may only be called once after the initialization of the stack. + */ +GP_API void gpHal_SetTimedMode(Bool timedMode); + +/** @brief Calculate the protoRSSI from the protoED returned by the data indication handler. + * + * This function calculates the protoRSSI from the protoED value returned by the data indication handler. + * @param protoRSSI Value returned by data indication handler. +*/ +GP_API UInt8 gpHal_ConvertProtoEDToProtoRSSI( UInt8 protoED ); + +/** @brief Calculate the ED value from the protoED returned by the ED scan handler, values are conform the ZIP phy testspec. + * + * This function calculates the ED value from the protoED returned by the ED scan handler. The lowest value is 0, which is at -75dBm, the highest value is 0xFF, which is at -35dBm. + * @param protoED Value returned by ED scan handler. +*/ +GP_API UInt8 gpHal_CalculateED(UInt8 protoED); + +/** @brief Checks if a NO LOCK was triggerd by the radio. + * + * This function reports if a lock loss was detected by the radio. + * @return Result of the check. +*/ +GP_API Bool gpHal_CheckNoLock(void); + +/** @brief Enables the promiscuous mode. + * + * In promiscuous mode, all packets will be received. In order to enable the receiver the + * RxOnWhenIdle flag must be set. + * + * @param flag Possible values are : + * - set to true : Promiscuous mode is enabled and the filters disabled. + * - set to false: Normal filtering is applied on incoming packets. +*/ +GP_API void gpHal_SetPromiscuousMode(Bool flag); + +/** @brief Returns promiscuous mode state. +*/ +GP_API Bool gpHal_GetPromiscuousMode(void); + + +/** @brief Set the default ack frame pending bit. */ +#define gpHal_SetFramePendingAckDefault(enable) GP_HAL_WRITE_PROP(GPHAL_PROP_RIB_FP_ACK_DEFAULT_VALUE , enable ); + +/** @brief Returns the default ack frame pending bit. */ +#define gpHal_GetFramePendingAckDefault() GP_HAL_GET_ACK_DATA_PENDING() + +/** @brief Enables Duty Cycled Rx window + * + * Enable a duty cycled Rx window + * + * @param srcId Source identifier. + * @param channel Channel to perform duty cycling on + * @param dutyCycleOnTime Time to put radio on (in us) + * @param dutyCyclePeriod Period of the Rx Window (in us) + * @param recurrenceAmount Number of occurances that needs to be scheduled + * @param startTime Absolute start time (in us) of the rx windows +*/ +GP_API void gpHal_EnableRxWindows(gpHal_SourceIdentifier_t srcId, UInt8 channel, UInt32 dutyCycleOnTime, UInt32 dutyCyclePeriod, UInt16 recurrenceAmount, UInt32 startTime); + +/** @brief Disables Duty Cycled Rx Windows + * + * Disabley a periodic Rx window + * + * @param srcId The idx of the rx channel slot. +*/ +GP_API void gpHal_DisableRxWindows(gpHal_SourceIdentifier_t srcId); + +/** @brief Enables CSL IE insertion in Enhanced Acks + * + * Enables CSL IE insertion in Enhanced Acks + * + * @param dutyCyclePeriod The period in multiples of 160us that needs to be inserterd in the CSL IE. +*/ +GP_API void gpHal_EnableCsl(UInt16 dutyCyclePeriod); + +/** @brief Update the CSL samples time + * + * Update the CSL samples time at which the next Rx window should occur. + * This will be used in the phase calculation for the CSL IE. + * + * @param nextCslSampleTime The next CSL sample time (the rx window start without extra margin) +*/ +GP_API void gpHal_UpdateCslSampleTime(UInt32 nextCslSampleTime); + +/** @brief Enables Duty Cycling for multiple channels + * + * Enable a duty cycled Rx window for multiple channels + * + * @param pSrcId Pointer of a Source identifier list. + * @param pChannel Pointer of a Channel list to perform duty cycling on + * @param num Number of channel (or source identifier) + * @param dutyCycleOnTime Time to put radio on (in us) + * @param dutyCycleOffTime Time to put radio off (in us) +*/ +void gpHal_EnableDutyCycling_MultiChannel(UInt8 numChannels, gpHal_SourceIdentifier_t* pSrcId, UInt8* pChannel, UInt32 dutyCycleOnTime, UInt32 dutyCycleOffTime); +/** @brief Disables Duty Cycling for multiple channels + * + * Disable a duty cycled Rx window for multiple channels + * + * @param pSrcId Pointer of a Source identifier list. + * @param num Number of channel (or source identifier) +*/ +void gpHal_DisableDutyCycling_Multichannel(UInt8 numChannels, gpHal_SourceIdentifier_t* pSrcId); +/** @brief Store current Rx channel to be able to restore it after wakeup + * + * Store current Rx channel so it can be restored after a wakeup + * + * @param srcId A source identifier list. + * @param num Number of channel +*/ +GP_API void gpHal_BackupRxChannel(gpHal_SourceIdentifier_t srcId, UInt8 channel); + +/** @brief Get the last used chip transmit power +*/ +GP_API gpHal_TxPower_t gpHal_GetLastUsedTxPower(void); + +/** @brief Reset the history of the Tx power compensation. +*/ + + + +/** @brief This function gets the number of channels which can be used by different Zigbee/MAC stacks simultaniously. + * + * This function gets the number of channels on which different Zigbee/MAC stacks can listen simultaniously + * + * @return UInt8 The number of indexes on which a seperate rx channel can be configured. + * + */ +UInt8 gpHal_GetAvailableSrcIds(void); + +#if defined(GP_DIVERSITY_OOB) +/** @brief This function set channel frequency for OOB. + * + * This function set channel frequency, it is for supporting OOB + * + * @param frequency channel frequency (in mHz) + * + */ +GP_API void gpHal_SetChannelFrequency_OOB(UInt16 frequency); + +/** @brief This function cancel channel frequency for OOB. + * + * This function cancel the channel frequency to be used for OOB + * + */ +GP_API void gpHal_CancelChannelFrequency_OOB(void); + +/** @brief This function cancel channel frequency for OOB. + * + * This function restore the channel frequency to be used for OOB + * + */ +GP_API void gpHal_RestoreChannelFrequency_OOB(void); +#endif //GP_DIVERSITY_OOB + + +#if defined(GP_DIVERSITY_JUMPTABLES) +GP_API Int8 gpHalPhy_GetMinTransmitPower(void); +GP_API Int8 gpHalPhy_GetMaxTransmitPower(void); +#endif //defined(GP_DIVERSITY_JUMPTABLES) + +void gpHal_MacSetMaxTransferTime(UInt32 MacMaxTransferTime); + + +/** @brief This function enables the Enhanced FramePending behavior. + * + * This function enables the Enhanced FramePending behavior + * + * @param srcId The source identifier for which the Enhanced FramePending behavior needs to be configured. + * @param enable Enable or disable the Enhanced FramePending behavior + * + */ +GP_API void gpHal_MacEnableEnhancedFramePending(gpHal_SourceIdentifier_t srcId, Bool enable); + +/** @brief This function configures the insertion of a VS IE header in the Enh Ack frames containing probing data. + * + * This function configures the insertion of a VS IE header in the Enh Ack frames containing probing data. + * + * @param vsIeLen The length of the VS IE, including IE header which needs to be added to the EnhAck frame. + * @param pVsIeData A Pointer to the VS IE data, including IE header which needs to be added to the EnhAck frame. + * + */ +GP_API void gpHal_SetEnhAckVSIE(UInt8 vsIeLen, UInt8* pVsIeData); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif /* _GPHAL_MAC_H_ */ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC_Ext.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC_Ext.h new file mode 100644 index 0000000..52994fc --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MAC_Ext.h @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2012-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * gpHal_MAC_Ext.h + * This file contains all the functions needed for Extra MAC functionality. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + + +#ifndef _GPHAL_MAC_EXT_H_ +#define _GPHAL_MAC_EXT_H_ + +/** @file gpHal_MAC_Ext.h + * @brief This file contains all the extra functionality for MAC. +*/ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpHal_MAC.h" +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief Purges packet from TX queue. + * + * This function purges a packet currently in the TX queue using the pd handle of the packet. + * When the handle is non-existent or the packet is already transmitted an error is returned. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidRequest (Invalid pd handle given) + * - gpHal_ResultBusy (Packet already sent) + * + * @param pdHandle Unique pd handle given to packet at request time. +*/ +gpHal_Result_t gpHal_PurgeRequest(gpPd_Handle_t pdHandle); + +#ifdef GP_HAL_DIVERSITY_MACFILT_PATTERN_MATCH +/** + * @brief Hook to the application that determines if the data contained in the + * Pd is "custom data" or regular data + * + * @param pdLoh Contains info to retrieve the Tx data from the gpPd module + * @return gpHal_ResultSuccess on custom data + * gpHal_ResultInvalidRequest on regular data + * + * @details Using the gpPd API one can verify the contents of the Tx data + * e.g. gpPd_ReadByte() or gpPd_ReadByteStream() + */ +GP_API gpHal_Result_t gpHal_cbIsCustomData(gpPd_Loh_t pdLoh); + +/** + * @brief Registers the callback for a CUSTOM data confirm. + * + * This function registers the callback for a CustomDataConfirm. The callback will be executed on a DataConfirm interrupt, if the data is transmitted from the custom stack. + * This DataConfirm will be given after a DataRequest is finished. + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterCustomDataConfirmCallback(gpHal_DataConfirmCallback_t callback); + +/** + * @brief Registers the callback for CUSTOM data indication. + * + * This function registers the CustomDataIndication callback. The callback will be executed on a DataIndication interrupt, when pattern matches for custom data + * This DataIndication will be given if a packet is received. + * + * The Primitive interrupt needs to be enabled. + * + * @param callback The pointer to the callback function. +*/ +GP_API void gpHal_RegisterCustomDataIndicationCallback(gpHal_DataIndicationCallback_t callback); + +/** + * @brief Start matching all incoming radio packets to the supplied pattern. + * In case the pattern matches the first 2 bytes of the received data, + * it will bypass the MAC handling completely and offer the callback + * registered by gpHal_RegisterCustomDataIndicationCallback(). + */ +GP_API void gpHal_EnableCustomMac(UInt8 pattern[2]); + +/** + * @brief Stop pattern matching for custom MAC implementations + */ +GP_API void gpHal_DisableCustomMac(); +#endif /* GP_HAL_DIVERSITY_MACFILT_PATTERN_MATCH */ + +#ifdef __cplusplus +} +#endif +#endif /* _GPHAL_MAC_EXT_H_ */ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MISC.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MISC.h new file mode 100644 index 0000000..97333fe --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MISC.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpHal_MISC.h + * + * This file contains miscellaneous functions for GPIO and OTP functionality + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_MISC_H_ +#define _HAL_GP_MISC_H_ + +/** @file gpHal_MISC.h + * @brief This file contains miscellaneous functions for GPIO and OTP functionality +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpHal_reg.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief Returns a 8-bit random value. + * + * This function returns a 8-bit random value using samples of the GP chip radio I and Q signals. + */ +GP_API UInt8 gpHal_GetRandomSeed(void); + + + +#ifdef GP_DIVERSITY_GPHAL_DCDC_ENABLED + + +#define gpHal_DCDC_ResultSuccess 0 +#define gpHal_DCDC_ResultTimeout 1 + + +typedef UInt8 gpHal_DCDC_Result_t; + +GP_API void gpHal_DCDCEnable(void); +GP_API Bool gpHalDCDC_IsActive(void); +#endif // GP_DIVERSITY_GPHAL_DCDC_ENABLED + +#ifdef __cplusplus +} +#endif +#endif //_HAL_GP_MISC_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MSI.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MSI.h new file mode 100644 index 0000000..314f2c6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_MSI.h @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2009-2010, 2012-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * gpHal_MSI.h + * + * This file contains the functions dependent on the choice of MCU : MSI, Interrupts,... + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPHAL_MSI_H_ +#define _GPHAL_MSI_H_ + +/** + * @file gpHal_MSI.h + * @brief This file declares functions to access the radio over the MSI protocol. + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" + +#include "gpBsp.h" //uC SPI functions +#include "hal.h" //uC INT functions + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef UInt16 gpHal_Address_t; + +#define gphal_msi_resultSuccess 0 +#define gphal_msi_resultFailure 1 +typedef UInt8 gphal_msi_result_t; + + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +extern gphal_msi_result_t gpHal_msi_lastMsiResult; + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ +//------------------------------------------------------------------------------ + + +//GP Register Access +GP_API UInt8 readRegExternal (gpHal_Address_t Address); +GP_API void readByteStreamExternal (gpHal_Address_t Address, UInt8* pBuffer, UInt8 Length); +GP_API void writeRegExternal (gpHal_Address_t Address, UInt8 Data); +GP_API void writeByteStreamExternal (gpHal_Address_t Address, const UInt8* pBuffer, UInt8 Length); +GP_API void readModifyWriteRegExternal(gpHal_Address_t Address, UInt8 Mask, UInt8 Data); + +/** @brief Read register access macro. + * + * This is the raw macro for reading registers. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Address The address of the register. +*/ +#define GP_HAL_READ_REG(Address) readRegExternal(Address) +/** @brief Write register access macro. + * + * This is the raw macro for writing registers. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Address The address of the register. + * @param Data The data to write. +*/ +#define GP_HAL_WRITE_REG(Address,Data) writeRegExternal(Address, Data) +/** @brief Read byte stream access macro. + * + * This is the raw macro for reading bytes from consecutive registers. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Address The address of the first register to access. + * @param pBuffer The pointer to the buffer that receives the read data. + * @param Length The number of bytes to read. +*/ +#define GP_HAL_READ_BYTE_STREAM(Address, pBuffer, Length) readByteStreamExternal(Address, (UInt8*)pBuffer, Length) +/** @brief Write byte stream access macro. + * + * This is the raw macro for writing bytes to consecutive registers. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Address The address of the first register to access. + * @param pBuffer The pointer to the buffer that contains the data to write. + * @param Length The number of bytes to write. +*/ +#define GP_HAL_WRITE_BYTE_STREAM(Address,pBuffer, Length) writeByteStreamExternal(Address, (const UInt8*)pBuffer, Length) + +/** @brief Read-moify-write access macro. + * + * This is the raw macro for changing register bits with a read-modify-write action. + * + * Depending on the processor the macros are used on, access to the registers is + * direct (embedded processor) or using SPI/I2C (external processor). + * + * @param Register The address of the register. + * @param Mask The read-modify-write mask. + * @param Data The value to write. +*/ +#define GP_HAL_READMODIFYWRITE_REG(Address, Mask, Data) readModifyWriteRegExternal(Address, Mask, Data) + + +#endif /* _GPHAL_MSI_H_ */ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Phy.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Phy.h new file mode 100644 index 0000000..0a5d7b6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_Phy.h @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + + +#ifndef _GPHAL_PHY_H_ +#define _GPHAL_PHY_H_ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +/** @brief Default Tx Antenna selection + * + * This macros selects the antenna configuration. By default (macro GP_HAL_DIVERSITY_SINGLE_ANTENNA + * not defined), both antennas are used with antenna diversity. + * When the macro GP_HAL_DIVERSITY_SINGLE_ANTENNA is defined + * through the command line option of the compiler, the single antenna is selected. +*/ +#if defined(GP_HAL_DIVERSITY_SINGLE_ANTENNA) +#define GP_HAL_TX_ANTENNA GP_HAL_DIVERSITY_SINGLE_ANTENNA +#else +#define GP_HAL_TX_ANTENNA 0 +#endif +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +//Antenna selection options +/** @name gpHal_AntennaSelection_t */ +//@{ +/** @brief Force antenna 0 (termed RF Port 1 or Ant1 in datasheet) to be used*/ +#define gpHal_AntennaSelection_Ant0 0x0 +/** @brief Force antenna 1 (termed RF Port 2 or Ant2 in datasheet) to be used*/ +#define gpHal_AntennaSelection_Ant1 0x1 +/** @brief Automatic antenna seletion based on BBP-RX for RX and on MAC settings for TX */ +#define gpHal_AntennaSelection_Auto 0x2 +/** @brief Not possible to dedect which antenna is selected (error condition) */ +#define gpHal_AntennaSelection_Unknown 0x3 +/** @typedef gpHal_AntennaSelection_t + * @brief The gpHal_AntennaSelection_t type defines the antenna selection mode. +*/ +typedef UInt8 gpHal_AntennaSelection_t; +//@} + +/** @name gpHal_FirFilter_t */ +//@{ +/** @brief None means: no filtering, i.e. FIR is a dirac impulse. */ +#define gpHal_FirFilter_None 0x00 +/** @brief applies FIR 25 filter values. */ +#define gpHal_FirFilter_FIR25 0x01 +/** @typedef gpHal_FirFilter_t + * @brief The gpHal_FirFilter_t type defines the FIR filter type that will be used by the radio. + */ +typedef UInt8 gpHal_FirFilter_t; +//@} + +/** @name gpHal_ContinuousWaveMode_t */ +//@{ +/** @brief Unmodulated Continuous Wave Mode */ +#define gpHal_CW_Unmodulated 'U' /*0x55*/ +/** @brief Unmodulated (ble channelindex + unmodulated ) */ +#define gpHal_CW_Ble_UnModulated 'D' /*0x44*/ +/** @brief Modulated Continuous Wave Mode */ +#define gpHal_CW_Modulated 'M' /*0x4D*/ +/** @brief Modulated BLE (ble channelindex + blemode) */ +#define gpHal_CW_Ble_Modulated 'B' /*0x42*/ +/** @brief High Data Rate Modulated BLE (ble channelindex + blemode) */ +#define gpHal_CW_Ble_HDRModulated 'H' /*0x48*/ +/** @brief Continuous Wave Mode is off */ +#define gpHal_CW_Off 'O' /*0x4F*/ +/** @typedef gpHal_ContinuousWaveMode_t + * @brief The gpHal_ContinuousWaveMode_t type defines the different continuous wave modes. +*/ +typedef UInt8 gpHal_ContinuousWaveMode_t; +//@} + +/** @name gpHal_TxPower_t*/ +//@{ +/** @brief Default transmit power configured by gpHal_SetDefaultTransmitPowers. */ +#define gpHal_MinTransmitPower 0x7d +#define gpHal_MaxTransmitPower 0x7e +#define gpHal_DefaultTransmitPower 0x7f +/** @typedef gpHal_TxPower_t + * @brief The gpHal_TxPower_t type defines the transmit power in dBm or the default, min or max define. +*/ +typedef Int8 gpHal_TxPower_t; + + +/** @name gpHal_CCAMode_t*/ +//@{ +/** @brief CCA based on Energy Detect will be performed. */ +#define gpHal_CCAModeEnergy 0x1 +/** @brief CCA based on detection of modulated carrier will be performed. */ +#define gpHal_CCAModeModulatedCarrier 0x2 +/** @brief CCA based on an AND of Energy and Modulated Carrier Detect will be performed. */ +#define gpHal_CCAModeEnergyAndModulated 0x3 +/** @typedef gpHal_CCAMode_t + * @brief The gpHal_CCAMode_t type defines the CCA measurement method. +*/ +typedef UInt8 gpHal_CCAMode_t; +//@} + +/** @name gpHal_CollisionAvoidanceMode_t */ +//@{ +/** @brief No CCA nor CSMA will be performed. */ +#define gpHal_CollisionAvoidanceModeNoCCA 0 +/** @brief Only CCA will be performed. */ +#define gpHal_CollisionAvoidanceModeCCA 1 +/** @brief CSMA will be performed. */ +#define gpHal_CollisionAvoidanceModeCSMA 2 +/** @typedef gpHal_CollisionAvoidanceMode_t + * @brief The gpHal_CollisionAvoidanceMode_t type defines the CSMA/CA method in TX. +*/ +typedef UInt8 gpHal_CollisionAvoidanceMode_t; +//@} + +// RxMode selection options +/** @name gpHal_RxMode_t */ +//@{ +/** @brief Mode Normal to be used*/ +#define gpHal_RxModeNormal 0x1 +#define gpHal_RxModeHighSensitivity 0x1 /* new name for the normal mode */ +/** @brief Mode Low Power Listening to be used*/ +#define gpHal_RxModeLowPower 0x2 +/** @brief Mode Multi Channel Listening to be used*/ +#define gpHal_RxModeMultiChannel 0x4 +/** @brief Mode Multi Standard Listening to be used*/ +#define gpHal_RxModeMultiStandard 0x5 +/** @typedef gpHal_RxMode_t + @brief The gpHal_RxMode_t type defines the receiver mode selection. +*/ +typedef UInt8 gpHal_RxMode_t; +//@} + +#define gpHal_AntennaModeDiversity 0x0 +#define gpHal_AntennaModeAntenna0 0x1 +#define gpHal_AntennaModeAntenna1 0x2 +typedef UInt8 gpHal_AntennaMode_t; + +typedef UInt8 gpHal_Channel_t; + +//Channelslot identifier +/** @name gpHal_ChannelSlotIdentifier_t */ +//@{ +/** @brief ChannelSlot for first slot */ +#define gpHal_ChannelSlotIdentifier_0 0x0 +/** @brief ChannelSlot for second slot */ +#define gpHal_ChannelSlotIdentifier_1 0x1 +/** @brief ChannelSlot for third slot */ +#define gpHal_ChannelSlotIdentifier_2 0x2 +/** @brief ChannelSlot for fourth slot */ +#define gpHal_ChannelSlotIdentifier_3 0x3 +/** @brief ChannelSlot for fifth slot */ +#define gpHal_ChannelSlotIdentifier_4 0x4 +/** @brief ChannelSlot for sixth slot */ +#define gpHal_ChannelSlotIdentifier_5 0x5 +/** @typedef gpHal_ChannelSlotIdentifier_t + * @brief The gpHal_ChannelSlotIdentifier_t type defines the channel slot used +*/ +typedef UInt8 gpHal_ChannelSlotIdentifier_t; +//@} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief Set continuous wave mode on/off. + * + * This function sets the continuous wave mode + * + * @param mode Continuous wave mode can be Unmodulated, Modulated or Off. + * @param channel channel on which CW will be generated + * @param txpower power at which the CW will be generated (in dB) + * @param antenna antenna on which CW will be generated. Auto will default to Ant0 or the antenna selected with GP_HAL_DIVERSITY_SINGLE_ANTENNA diversity +*/ +void gpHal_SetContinuousWaveMode( gpHal_ContinuousWaveMode_t mode, UInt8 channel, Int8 txpower, gpHal_AntennaSelection_t antenna); + +void gpHal_CalibrateFllChannel(gpHal_ChannelSlotIdentifier_t slotId, UInt8 fllChannel); +// Same functionality as gpHal_CalibrateFllChannel, but without claiming the radio (the caller function is responsible for this) +void gpHal_CalibrateFllChannelUnprotected(gpHal_ChannelSlotIdentifier_t slotId, UInt8 fllChannel); + +/** @brief Claim radio management and wait for it to be granted +*/ +void gpHal_ClaimRadioMgmt(void); + +/** @brief Release radio management + */ +void gpHal_ReleaseRadioMgmt(void); + +UInt8 gpHalPhy_FillInModeSignals(UInt8 txEn, UInt8 rxEn, UInt8 mode); +void gpHalPhy_SetTxAntenna(UInt8 antenna); +UInt8 gpHalPhy_GetTxAntenna(void); + +/** @brief RX antenna select + * intAntSel - Select internal antenna port + * extAntSel - Select external antenna port + */ +void gpHalPhy_UpdateRxAntennaSelection(UInt8 intAntSel, UInt8 extAntSel); + +/** @brief Initialize signal to control an MODE bit for an external antenna switch */ +GP_API void gpHalPhy_InitExternalModeSignal(UInt8 mode_signal); + + +void gpHal_InitPhy(void); + + +/** @brief Gets the antenna used to transmit a packet + * + * This function queries the antenna used to transmit a packet + * @return the antenna used to transmit a packet, possible values defined in enumeration gpHal_AntennaSelection + */ +GP_API gpHal_AntennaSelection_t gpHal_GetTxAntenna(void); + +/** @brief Gets the antenna used to receive packets + * + * This function queries the antenna used to receive packets + * @return the antenna used to receive packets, possible values defined in enumeration gpHal_AntennaSelection + */ +GP_API gpHal_AntennaSelection_t gpHal_GetRxAntenna(void); + +/** @brief Sets the antenna used to transmit and receiving packets + * + * This function selects the used antenna used to transmit a packet + * Note that this function is obsolete, gpHal_SetRxAntenna should be used instead. + * @param antenna The antenna used to transmit and receive packets, possible values defined in enumeration gpHal_AntennaSelection + */ +GP_API void gpHal_SetAntenna(gpHal_AntennaSelection_t antenna); + +/** @brief Sets the antenna used to receive packets + * + * This function selects the used antenna used to receive a packet + * @param antenna The antenna used to receive packets, possible values defined in enumeration gpHal_AntennaSelection_t + */ +GP_API void gpHal_SetRxAntenna(gpHal_AntennaSelection_t antenna); + +/** @brief This function returns the antenna which is used by the BLE stack. + * + * @return gpHal_AntennaSelection_t The antenna which is used + */ +GP_API gpHal_AntennaSelection_t gpHal_GetBleAntenna(void); + +/** @brief Returns antenna diversity mode +* +* @return true if antenna diversity is enabled +*/ +GP_API Bool gpHal_GetRxAntennaDiversity(void); + +/** @brief Sets the FIR filter config + * + * This primitive is for configuring the values for the TX FIR filter. + * This affects the ZB transmission. + * @param firFilter An enum value that corresponds to one of the predefined sets of FIR filter coefficients. + */ +void gpHal_SetRadioFirFilter(gpHal_FirFilter_t firFilter); + +#ifdef __cplusplus +} +#endif + +#endif // _GPHAL_PHY_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_SEC.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_SEC.h new file mode 100644 index 0000000..c031bda --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_SEC.h @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * gpHal_SEC.h + * + * Contains all security functionality of the HAL + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _HAL_GP_SEC_H_ +#define _HAL_GP_SEC_H_ + +/** @file gpHal_SEC.h + * This file contains all security functionality of the HAL. Standalone AES encryption can be performed as well as CCM encryption and decryption. + * + * @brief Contains all security functionality of the HAL +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gp_global.h" +#include "gpEncryption.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Performs a synchronous AES Encryption. + * + * The function will encrypt the number of bytes specified in keylen with the AES algorithm and return the result in place. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy + * - gpHal_ResultInvalidParameter + * + * @param pInplaceBuffer Pointer to the buffer of the 16 to be encrypted bytes. Encrypted result will be returned in same buffer + * @param pAESKey Pointer to the byte key, this key is only uses if specified by the options parameter. When used but specified as NULL, 0 will be used as key value. + * @param AESOptions This parameter specifies the keylen and an 8bit bitmask specifying the options: bits[6:0] specify the keyid to be used (see gpEncryption_API_Manual); bit[7] indicates additional hardening + */ +GP_API gpHal_Result_t gpHal_AESEncrypt(UInt8* pInplaceBuffer, UInt8* pAESKey, gpEncryption_AESOptions_t AESOptions); + +/** + * @brief Performs a synchronous CCM Encryption with support for larger buffers. + * + * The function will encrypt the bytes with the CCM algorithm according to the specified options + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidRequest + * + * @param pCCMOptions Pointer to the gpHal_CCMOptions structure. + */ +gpHal_Result_t gpHal_CCMEncrypt_RAM(UInt16 dataLength, UInt16 auxLength, UInt8 micLength, UInt8* dataPtr, UInt8* auxPtr, UInt8* micPtr, UInt8* pKey, UInt8* pNonce, UInt8* dataOutPtr); + +/** + * @brief Performs a synchronous CCM Decryption with support for larger buffers. + * + * The function will decrypt the bytes with the CCM algorithm according to the specified options + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultInvalidRequest + * + * @param pCCMOptions Pointer to the gpHal_CCMOptions structure. + */ +gpHal_Result_t gpHal_CCMDecrypt_RAM(UInt16 dataLength, UInt16 auxLength, UInt8 micLength, UInt8* dataPtr, UInt8* auxPtr, UInt8* micPtr, UInt8* pKey, UInt8* pNonce, UInt8* dataOutPtr); + +/** + * @brief Performs a synchronous CCM Encryption. + * + * The function will encrypt the bytes with the CCM algorithm according to the specified options + * in the gpHal_CCMOptions structure. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy + * + * @param pCCMOptions Pointer to the gpHal_CCMOptions structure. + */ +GP_API gpHal_Result_t gpHal_CCMEncrypt(gpEncryption_CCMOptions_t * pCCMOptions); + +/** + * @brief Performs a synchronous CCM Decryption. + * + * The function will decrypt the bytes with the CCM algorithm according to the specified options + * in the gpHal_CCMOptions structure. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy + * - gpHal_ResultInvalidParameter + * + * @param pCCMOptions Pointer to the gpHal_CCMOptions structure. + */ +GP_API gpHal_Result_t gpHal_CCMDecrypt(gpEncryption_CCMOptions_t * pCCMOptions); + +/** + * @brief Hash-based message authentication code. + * + * This function performs HMAC, a mechanism for message authentication using cryptographic hash functions. + * + * Possible results are: + * - gpHal_ResultSuccess + * - gpHal_ResultBusy + * - gpHal_ResultUnsupported + * + * @param hashFct Type of hash funtion. + * @param pKey Secret cryptographic Key. + * @param pMsg Message for authentication. + * @param pResult Message Authentication Codes Result, The size of the output of HMAC is the same as that of the underlying hash function. + */ +GP_API gpHal_Result_t gpHal_HMAC(UInt8 hashFct, UInt16 keyLength, UInt16 msgLength, UInt8 resultLength, UInt8* pKey, UInt8* pMsg, UInt8* pResult); + + +/** + * @brief Configures the encryption key for raw frames (Thread). + * + * The function will configure the key and key index for the current encryption key. + * + * @param encryptionKeyId Key index for the current encryption key. + * @param pCurrKey Pointer to the current encryption key. + */ +void gpHal_SetRawModeEncryptionKeys(UInt8 encryptionKeyId, UInt8* pCurrKey); +/** + * @brief configures the fields for the Nonce used in the encryption of the raw frames (Thread) + * + * The function will set the fields for the Nonce. + * + * @param frameCounter Initial value of the Frame counter. It will be autoincremented in consecutive transmissions. + * @param pExtendedAddress Pointer to the extended (local) source address. + * @param seclevel Security Level. Only level 5 is supported currently. + */ +void gpHal_SetRawModeNonceFields(UInt32 frameCounter, MACAddress_t* pExtendedAddress , UInt8 seclevel); + + +#ifdef __cplusplus +} +#endif + +#endif //_HAL_GP_SEC_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_reg.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_reg.h new file mode 100644 index 0000000..0996d17 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gpHal_reg.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * gpHal_reg.h + * + * The file gpHal_reg.h is a wrapper around the correct register definitions + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_HAL_REG_H_ +#define _GP_HAL_REG_H_ + +/** + * @file gpHal_reg.h + * + * Wrapper around the register definitions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#ifdef GP_COMP_UNIT_TEST +//Only be used for gpHal as Tbc +#include "utTbc_gpHal_defs.h" +#endif + +#endif //_GP_HAL_REG_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gp_global.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gp_global.h new file mode 100644 index 0000000..22eb8c0 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/inc/gp_global.h @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2008-2010, 2012-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpHal_global.h + * + * Contains general definitions used in the different blocks. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPHAL_GLOBAL_H_ +#define _GPHAL_GLOBAL_H_ + +/** @file gp_global.h + * The file gp_global.h contains general definitions used in the different blocks. The result enumeration for the gphal functions and different callbacks can be found here. + * + * @brief Contains general definitions used in the different blocks. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpPd.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/** @name gpHal_Result_t*/ +//@{ +/** @brief The function returned successful. */ +#define gpHal_ResultSuccess 0x0 +/** @brief An invalid parameter was given as a parameter to this function. */ +#define gpHal_ResultInvalidParameter 0x5 +/** @brief The GP chip is in receive mode. */ +#define gpHal_ResultRxOn 0x6 +/** @brief The GP chip is busy. */ +#define gpHal_ResultBusy 0x7 +/** @brief The GP chip radio is off. */ +#define gpHal_ResultTrxOff 0x8 +/** @brief The GP chip radio is transmitting. */ +#define gpHal_ResultTxOn 0x9 +/** @brief The GP chip has timed out waiting for the COEX Grant signal. */ +#define gpHal_ResultGrantTimeout 0xa +/** @brief The GP chip unsupported operation*/ +#define gpHal_ResultUnsupported 0xb +/** @brief The request was invalid (event not present, ...)*/ +#define gpHal_ResultInvalidRequest 0xc2 +/** @brief The handle given as parameter cannot be found. */ +#define gpHal_ResultInvalidHandle 0xe7 +/** @brief Channel access failure. */ +#define gpHal_ResultCCAFailure 0xe1 +/** @brief Ack was required but no ack received. */ +#define gpHal_ResultNoAck 0xe9 +/** @typedef gpHal_Result_t + * @brief The gpHal_Result_t type defines the result of various HAL functions. +*/ +typedef UInt8 gpHal_Result_t; +//@} + +/** @typedef gpHal_AbsoluteEventCallback_t + * @brief The gpHal_AbsoluteEventCallback_t callback type definition defines the callback prototype of an Absolute Event interrupt. */ +typedef void (*gpHal_AbsoluteEventCallback_t)(void); + +/** @typedef gpHal_ExternalEventCallback_t + * @brief The gpHal_ExternalEventCallback_t callback typedef defines the callback prototype of the External Event interrupt. */ +typedef void (*gpHal_ExternalEventCallback_t)(void); + +typedef void (*gpHal_LowBatteryCallback_t)(void); + +/** @name gpHal_RxInfo_t */ +//@{ +typedef struct { +/** @brief The channel the packet was received on */ + UInt8 rxChannel; +/** @typedef gpHal_RxInfo_t + * @brief The gpHal_MultiChannelOptions_t struct contains some info about the rx of a packet. +*/ +} gpHal_RxInfo_t; +//@} + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpHal_CodeJumpTableFlash_Defs_gpglobal.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + + +/** + * @brief This callback indicates the reception of a data. + * + * This callback is called when a data packet has been received. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * + * @param pdLoh Packet descriptor structure that contains length, offset and unique handle of the received packet. + * @param rxInfo Additional information about the rx of the packet. +*/ +GP_API void gpHal_cbDataIndication(gpPd_Loh_t pdLoh, gpHal_RxInfo_t *rxInfo); + +/** + * @brief This callback indicates the completion of a data transmission. + * + * This callback is called when a data transmission has been completed. The transmission has been + * initiated by calling the gpHal_DataRequest() function. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * + * @param pdLoh Packet descriptor structure that contains length, offset + and unique handle of the transmitted packet. + * @param status The status of the data transfer. + * @param lastChannelUsed The channel where the packet has been sent. + * +*/ +GP_API void gpHal_cbDataConfirm(gpHal_Result_t status, gpPd_Loh_t pdLoh, UInt8 lastChannelUsed); + +/** + * @brief This callback indicates the reception of a commabd data request request. + * + * It's goal is to set the FP bit correctly in the Ack + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * +*/ +GP_API void gpHal_cbCmdDataRequest(void); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +/** + * @brief This callback indicates the completion of an Energy detection (ED). + * + * This callback is called when an energy detection (ED) has been completed. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * + * @param channelMask The measured channels. + * @param protoED The raw energy level measured. This value needs to be converted by gpHal_CalculateED() + * in order to get the real energy level. +*/ +GP_API void gpHal_cbEDConfirm(UInt16 channelMask, UInt8 *protoED); +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + +/** + * @brief This callback indicates that a timed trigger for a data transmission has failed. + * + * This callback is called when a timed transmission for a data transmission has failed due + * to a busy state of the transmitter. This can occur for instance, when the transmitter is + * transmitting a acknowledge frame at the moment the transmission triggers gets fired. + * + * When this occurs, the pending data packet in the transmission queue needs to be handled + * by the software (by clearing the pending packet or by rescheduling a new trigger). + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * +*/ +GP_API void gpHal_cbBusyTX(void); + +/** + * @brief This callback indicates the transmission queue was empty, when a timed transmission was triggered. + * + * This callback is called when the transmission queue is empty and a timed transmission should be started. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * +*/ +GP_API void gpHal_cbEmptyQueue(void); + +/** + * @brief This callback is called when an absolute event has occured. + * + * This callback is called when an absolute event has occured. + * + * This callback has to be implemented by the software layer that is using the GPHAL (only required + * when using the fixed callbacks). + * +*/ +GP_API void gpHal_cbExternalEvent(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif +#endif /* _GPHAL_GLOBAL_H_ */ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c new file mode 100644 index 0000000..b4fd7ac --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/HAL_RF/gphal/src/gen/gpHal_Coex_marshalling.c @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpHal_Coex_marshalling.c" + * + * gpHal Coexistence subcomponent + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpHal_Coex.h" +#include "gpHal_Coex_marshalling.h" + +#include "gpLog.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_HAL_COEX + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +void gpHal_Coex_InitMarshalling( void ) +{ +} + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/inc/gen/gpAssert_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/inc/gen/gpAssert_marshalling.h new file mode 100644 index 0000000..060346b --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/inc/gen/gpAssert_marshalling.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPASSERT_MARSHALLING_H_ +#define _GPASSERT_MARSHALLING_H_ + +//DOCUMENTATION ASSERT: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + + + + +typedef struct { + UInt16 componentId; + UInt16 lineNumber; +} gpAssert_cbIndication_Input_struct_t; + +typedef struct { + gpAssert_cbIndication_Input_struct_t data; +} gpAssert_cbIndication_Input_marshall_struct_t; + + +typedef union { + gpAssert_cbIndication_Input_marshall_struct_t gpAssert_cbIndication; + UInt8 dummy; //ensure none empty union definition +} gpAssert_Client_Input_union_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's + +// Structure copy functions +// Server functions +void gpAssert_cbIndication_Input_par2api(UInt8Buffer* pDest , UInt16 componentId , UInt16 lineNumber , UInt16* pIndex); + +// Client functions +gpMarshall_AckStatus_t gpAssert_cbIndication_Input_buf2api(gpAssert_cbIndication_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); + +void gpAssert_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPASSERT_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/inc/gpAssert.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/inc/gpAssert.h new file mode 100644 index 0000000..10513d7 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/inc/gpAssert.h @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpAssert.h + * This file contains the definitions of the public functions and enumerations of the gpAssert. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_ASSERT_H_ +#define _GP_ASSERT_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpAssert_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "global.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +#ifdef GP_COMP_UNIT_TEST +//Make sure unit and stacktest are able to stop after unexpected assert +#define GP_DIVERSITY_ASSERT_ACTION_EXIT +#endif //GP_COMP_UNIT_TEST + +// level of assert that should be kept (lower means more critical) +#define GP_DIVERSITY_ASSERT_LEVEL_SYSTEM 0 +#define GP_DIVERSITY_ASSERT_LEVEL_DEV_EXT 1 +#define GP_DIVERSITY_ASSERT_LEVEL_DEV_INT 2 +typedef UInt8 gpAssert_AssertLevel_t; + +// Id of the assert -- Fixme: add more ids here +#define GP_ASSERT_ID_UNDEFINED 0x00 +typedef UInt8 gpAssert_AssertId_t; + +// typedef for first parameter of assert macro (currently contains 2 bits level and optional 4 bits id) +typedef UInt8 gpAssert_AssertInfo_t; + +// structure that is passed to assert callback function +typedef struct { +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + gpAssert_AssertLevel_t level; + gpAssert_AssertId_t id; +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + UInt8 componentId; + UInt16 lineNumber; + FLASH_STRING fileName; +} gpAssert_NotifyInfo_t; + +// define type of assert callback +typedef void (*gpAssert_cbAssertIndication_t)(gpAssert_NotifyInfo_t* notifyInfo); + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifdef GP_FILENAME +#ifdef GP_DIVERSITY_LOG +//Define a FileName only once for use in Assertions - name comes from make environment +#if defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +static const char ROM gpFileName[] FLASH_PROGMEM @ ".rom" = { XSTRINGIFY(GP_FILENAME) }; +#else +static const char ROM gpFileName[] FLASH_PROGMEM = { XSTRINGIFY(GP_FILENAME) }; +#endif // defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +#define GP_ASSERT_FILENAME gpFileName +#endif //GP_DIVERSITY_LOG +#endif //GP_FILENAME + +#ifndef GP_ASSERT_FILENAME +#define GP_ASSERT_PSTR(s) (FLASH_STRING)GEN_STR2FLASH(s) +#ifdef GP_DIVERSITY_LOG +#if defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +static const char ROM gpFileName[] FLASH_PROGMEM @ ".rom" = { XSTRINGIFY(__FILE__) }; +#define GP_ASSERT_FILENAME gpFileName +#else +#define GP_ASSERT_FILENAME GP_ASSERT_PSTR(__FILE__) +#endif +#else +#define GP_ASSERT_FILENAME 0 +#endif +#endif //GP_ASSERT_FILENAME + +// In case no global assert level is provided, define it (maps on previous structure). +#ifndef GP_DIVERSITY_GLOBAL_ASSERT_LEVEL +#define GP_DIVERSITY_GLOBAL_ASSERT_LEVEL GP_DIVERSITY_ASSERT_LEVEL_DEV_INT +#endif //GP_DIVERSITY_GLOBAL_ASSERT_LEVEL + + +// when no reporting is defined, take callback (has also logging) as default +#if !defined(GP_DIVERSITY_ASSERT_REPORTING_LOG) && !defined(GP_DIVERSITY_ASSERT_REPORTING_CALLBACK) && !defined(GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG) && !defined(GP_DIVERSITY_ASSERT_REPORTING_NOTHING) +#define GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +#endif //!defined(GP_DIVERSITY_ASSERT_REPORTING_LOG) && !defined(GP_DIVERSITY_ASSERT_REPORTING_CALLBACK) && !defined(GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG) && !defined(GP_DIVERSITY_ASSERT_REPORTING_NOTHING) + +// when no action is defined, take endless loop (blinking led) as default +#if !defined(GP_DIVERSITY_ASSERT_ACTION_BLINK_LED) && !defined(GP_DIVERSITY_ASSERT_ACTION_EXIT) && !defined(GP_DIVERSITY_ASSERT_ACTION_RESET) && !defined(GP_DIVERSITY_ASSERT_ACTION_NOTHING) +#define GP_DIVERSITY_ASSERT_ACTION_BLINK_LED +#endif //!defined(GP_DIVERSITY_ASSERT_ACTION_BLINK_LED) && !defined(GP_DIVERSITY_ASSERT_ACTION_EXIT) && !defined(GP_DIVERSITY_ASSERT_ACTION_RESET) && !defined(GP_DIVERSITY_ASSERT_ACTION_NOTHING) + +#if defined(GP_DIVERSITY_ASSERT_REPORTING_LOG) && !defined(GP_DIVERSITY_LOG) +#error Log reporting only possible when log is defined! +#endif + +// define reporting behavior +#if defined(GP_DIVERSITY_ASSERT_REPORTING_CALLBACK) +#define GP_ASSERT_REPORT(info, compId, file, line) gpAssert_CallCbAssertIndication(info,compId,file,line) +#elif defined(GP_DIVERSITY_ASSERT_REPORTING_LOG) +#define GP_ASSERT_REPORT(info, compId, file, line) gpAssert_PrintLogString(compId,file,line) +#elif defined(GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG) +#define GP_ASSERT_REPORT(info, compId, file, line) gpAssert_LedDebug(line) +#elif defined(GP_DIVERSITY_ASSERT_REPORTING_NOTHING) +#define GP_ASSERT_REPORT(info, compId, file, line) do {} while(false) +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK + +// define action behavior +#if defined(GP_DIVERSITY_ASSERT_ACTION_BLINK_LED) +#define GP_ASSERT_FOLLOW_UP_ACTION() gpAssert_BlinkLed() +#elif defined(GP_DIVERSITY_ASSERT_ACTION_EXIT) +#define GP_ASSERT_FOLLOW_UP_ACTION() gpAssert_Exit() +#elif defined(GP_DIVERSITY_ASSERT_ACTION_RESET) +#define GP_ASSERT_FOLLOW_UP_ACTION() gpAssert_ResetSystem() +#elif defined(GP_DIVERSITY_ASSERT_ACTION_NOTHING) +#define GP_ASSERT_FOLLOW_UP_ACTION() do {} while(false) +#endif + +// basic or extend handling (assert identifier specified or not) +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +#define GP_ASSERT_DO_ASSERT_HANDLING(info, compId, file, line) gpAssert_DoAssertHandling_Extended(info, compId, file, line) +#else +#define GP_ASSERT_DO_ASSERT_HANDLING(info, compId, file, line) gpAssert_DoAssertHandling_Basic(compId, file, line) +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + +// default assert macro +#define GP_ASSERT(info, check) \ +do { \ + if(GP_DIVERSITY_GLOBAL_ASSERT_LEVEL >= GP_ASSERT_GET_LEVEL(info)) \ + { \ + if (!(check)) \ + { \ + GP_ASSERT_DO_ASSERT_HANDLING(info, GP_COMPONENT_ID, GP_ASSERT_FILENAME, __LINE__); \ + } \ + } \ +} while (false) + +// assert macro that only checks value, but leaves handling to the user +#define GP_ASSERT_IF(level, check) ((GP_DIVERSITY_GLOBAL_ASSERT_LEVEL >= level) ? (!(check)) : (false)) + +//debug backdoor +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +#define GP_ASSERT_ENABLE_DEBUG() gpAssert_EnableDebug() +#else +#define GP_ASSERT_ENABLE_DEBUG() do {} while(false) +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// map old asserts to new structure +#define GP_ASSERT_DEV_INT(x) GP_ASSERT(GP_DIVERSITY_ASSERT_LEVEL_DEV_INT,x) +#define GP_ASSERT_DEV_EXT(x) GP_ASSERT(GP_DIVERSITY_ASSERT_LEVEL_DEV_EXT,x) +#define GP_ASSERT_SYSTEM(x) GP_ASSERT(GP_DIVERSITY_ASSERT_LEVEL_SYSTEM,x) + +// fixme: move this functionality to a global place? +#define ASSERT_BM_SET(bf,bm,idx,v) bf &= ~bm; bf |= (((UInt16)v) << idx) +#define ASSERT_BM_GET(value, mask, idx) ((value & mask) >> idx) + +// structure of info field +// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +// | id | x | x | level | +#define GP_ASSERT_LEVEL_BM 0x03 +#define GP_ASSERT_ID_BM 0xF0 +#define GP_ASSERT_LEVEL_IDX 0 +#define GP_ASSERT_ID_IDX 4 + +#define GP_ASSERT_GET_LEVEL(info) ASSERT_BM_GET(info, GP_ASSERT_LEVEL_BM, GP_ASSERT_LEVEL_IDX) +#define GP_ASSERT_SET_LEVEL(info, level) ASSERT_BM_SET(info, GP_ASSERT_LEVEL_BM, GP_ASSERT_LEVEL_IDX, level) + +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +#define GP_ASSERT_GET_ID(info) ASSERT_BM_GET(info, GP_ASSERT_ID_BM, GP_ASSERT_ID_IDX) +#define GP_ASSERT_SET_ID(info, id) ASSERT_BM_SET(info, GP_ASSERT_ID_BM, GP_ASSERT_ID_IDX, id) +#else +#define GP_ASSERT_GET_ID(info) GP_ASSERT_ID_UNDEFINED +#define GP_ASSERT_SET_ID(info, id) do {} while(false) +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + +/** @brief Call condition until timeout expires. + * + * @param cond code snippet that will be called in a while loop. Has to evaluate to a usable value. + * @param timeout timeout in us + * @param pTimedOut Pointer to variable is set to true if timeout has occured +*/ +#define GP_DO_WHILE_TIMEOUT(cond, timeout, pTimedOut) do { \ + UInt32 __timeout = timeout; \ + while ( (cond) ) \ + { \ + __timeout = Assert_doWhileTimeOutBody(__timeout); \ + if (__timeout == 0) \ + { \ + break; \ + } \ + }; \ + *pTimedOut = (__timeout == 0); \ +} while(false) + +/** @brief Call condition until timeout expires. Assert if timeout is reached. + * + * @param cond code that will be called in a while loop + * @param timeout timeout in us +*/ +#define GP_DO_WHILE_TIMEOUT_ASSERT(cond, timeout) do { \ + UInt32 __timeout = timeout; \ + while ( (cond) ) \ + { \ + __timeout = Assert_doWhileTimeOutBody_Assert(__timeout ,GP_COMPONENT_ID,GP_ASSERT_FILENAME, __LINE__); \ + if (__timeout == 0) \ + { \ + break; \ + } \ + }; \ +} while(false) + + +/***************************************************************************** + * 'Private' Function Definitions + *****************************************************************************/ + +// These methods used by the GP_DO_WHILE_TIMEOUT(_ASSERT) macro's for code optimisations and should not be called a +// such. The macro implemenations are required to have proper condition evaluation and line printing in case of an +// assert. Reinstanciating the code has however code size impact so these methods reduce the reinstanciated code. +UInt32 Assert_doWhileTimeOutBody(UInt32 timeout); +UInt32 Assert_doWhileTimeOutBody_Assert(UInt32 timeout,UInt8 compId, FLASH_STRING filename, UInt16 line); + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpAssert_CodeJumpTableFlash_Defs.h" +#endif //defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +void gpAssert_DoAssertHandling_Extended(gpAssert_AssertInfo_t assertInfo, UInt8 componentId, FLASH_STRING filename, UInt16 line); +#else +void gpAssert_DoAssertHandling_Basic(UInt8 componentId, FLASH_STRING filename, UInt16 line); +#endif // GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +gpAssert_cbAssertIndication_t gpAssert_RegisterCbAssertIndication(gpAssert_cbAssertIndication_t cbAssertIndication); +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +GP_API void gpAssert_EnableDebug(void); +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// reporting functions +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +void gpAssert_CallCbAssertIndication(gpAssert_AssertInfo_t assertInfo, UInt8 componentId, FLASH_STRING filename, UInt16 line); +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +#ifdef GP_DIVERSITY_LOG +void gpAssert_PrintLogString(UInt8 componentId, FLASH_STRING filename, UInt16 line); +#endif //GP_DIVERSITY_LOG +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +void gpAssert_LedDebug(UInt16 line); +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// action functions +#ifdef GP_DIVERSITY_ASSERT_ACTION_RESET +void gpAssert_ResetSystem(void); +#endif //GP_DIVERSITY_ASSERT_ACTION_RESET +#ifdef GP_DIVERSITY_ASSERT_ACTION_EXIT +void gpAssert_Exit(void); +#endif //GP_DIVERSITY_ASSERT_ACTION_EXIT +#ifdef GP_DIVERSITY_ASSERT_ACTION_BLINK_LED +void gpAssert_BlinkLed(void); +#endif //GP_DIVERSITY_ASSERT_ACTION_BLINK_LED +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ +/** @brief Notify an assert happened +* +* @param componentId +* @param lineNumber +*/ +void gpAssert_cbIndication(UInt16 componentId, UInt16 lineNumber); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //defined(GP_DIVERSITY_ROM_CODE) +#endif //_GP_ASSERT_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c new file mode 100644 index 0000000..08929d2 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/src/gen/gpAssert_marshalling.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpAssert_marshalling.c" + * + * gpAssert component + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpAssert.h" +#include "gpAssert_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_ASSERT + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +void gpAssert_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c new file mode 100644 index 0000000..334aefe --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpAssert/src/gpAssert.c @@ -0,0 +1,339 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpAssert.c + * This file contains the implementation of the Assert functions. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_ASSERT + +#include "gpAssert.h" +#include "hal.h" +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif //GP_DIVERSITY_LOG +#ifdef GP_DIVERSITY_ASSERT_ACTION_RESET +#include "gpReset.h" +#endif //GP_DIVERSITY_ASSERT_ACTION_RESET + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +#define GP_ASSERT_DIVERSITY_LED_DEBUG_MAGIC_WORD 0x72 +#endif + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +static void Assert_blinkLedAssert(UInt16 number); +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +gpAssert_cbAssertIndication_t gpAssert_cbAssertIndication = NULL; +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK + +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +static Bool gpAssert_DebugEnabled = 0; +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +#ifdef GP_DIVERSITY_LOG + +#if !defined(GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH) +#define GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH 30 +#endif + +FLASH_STRING gpAssert_filename; +UInt16 gpAssert_line; +#endif //GP_DIVERSITY_LOG + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ +#if defined(GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG) +static void Assert_blinkLedAssert(UInt16 number) +{ + UIntLoop i = 5; + + HAL_LED_SET(RED); + while(i) + { + UInt16 subtractor= 0; + UIntLoop j; + + switch(i) + { + case 1: + subtractor = 1; + break; + case 2: + subtractor = 10; + break; + case 3: + subtractor = 100; + break; + case 4: + subtractor = 1000; + break; + case 5: + subtractor = 10000; + break; + default: + break; + } + + for(j=0; j< 10; j++) + { + if(number >= subtractor) + { + HAL_LED_SET(GRN); + number-=subtractor; + } + else + { + HAL_LED_CLR(GRN); + } + HAL_WAIT_MS(1); + HAL_LED_CLR(GRN); + HAL_WAIT_MS(1); + } + + i--; + } + HAL_LED_CLR(RED); +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +UInt32 Assert_doWhileTimeOutBody(UInt32 timeout) +{ + const UInt8 TimeDecrement = 4; + + if (timeout < TimeDecrement) + { + return 0; + } + + HAL_WDT_RESET(); + HAL_WAIT_US(TimeDecrement); + + return (timeout - TimeDecrement); +} + +UInt32 Assert_doWhileTimeOutBody_Assert(UInt32 timeout, UInt8 compId, FLASH_STRING filename, UInt16 line) +{ + UInt32 __timeout = Assert_doWhileTimeOutBody(timeout); + if (__timeout == 0) + GP_ASSERT_DO_ASSERT_HANDLING (GP_DIVERSITY_ASSERT_LEVEL_SYSTEM, compId,filename,line); + return __timeout; +} + +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER +void gpAssert_DoAssertHandling_Extended(gpAssert_AssertInfo_t assertInfo, UInt8 componentId, FLASH_STRING filename, UInt16 line) +{ + NOT_USED(assertInfo); + NOT_USED(componentId); + NOT_USED(filename); + NOT_USED(line); + + GP_ASSERT_REPORT(assertInfo, componentId, filename, line); + GP_ASSERT_FOLLOW_UP_ACTION(); +} +#else +void gpAssert_DoAssertHandling_Basic(UInt8 componentId, FLASH_STRING filename, UInt16 line) +{ + NOT_USED(componentId); + NOT_USED(filename); + NOT_USED(line); + + GP_ASSERT_REPORT(0, componentId, filename, line); + GP_ASSERT_FOLLOW_UP_ACTION(); +} +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +gpAssert_cbAssertIndication_t gpAssert_RegisterCbAssertIndication(gpAssert_cbAssertIndication_t cbAssertIndication) +{ + gpAssert_cbAssertIndication_t prevCb; + + prevCb = gpAssert_cbAssertIndication; + gpAssert_cbAssertIndication = cbAssertIndication; + + return prevCb; +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK + +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +void gpAssert_EnableDebug(void) +{ + gpAssert_DebugEnabled = GP_ASSERT_DIVERSITY_LED_DEBUG_MAGIC_WORD; +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// reporting +#ifdef GP_DIVERSITY_ASSERT_REPORTING_CALLBACK +void gpAssert_CallCbAssertIndication(gpAssert_AssertInfo_t assertInfo, UInt8 componentId, FLASH_STRING filename, UInt16 line) +{ +#ifndef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + NOT_USED(assertInfo); +#endif //not defined GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + if(gpAssert_cbAssertIndication != NULL) + { + gpAssert_NotifyInfo_t notifyInfo; +#ifdef GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + notifyInfo.level = GP_ASSERT_GET_LEVEL(assertInfo); + notifyInfo.id = GP_ASSERT_GET_ID(assertInfo); +#endif //GP_DIVERSITY_ASSERT_ENABLE_IDENTIFIER + notifyInfo.componentId = componentId; + notifyInfo.lineNumber = line; + notifyInfo.fileName = filename; + gpAssert_cbAssertIndication(¬ifyInfo); + } + else + { +#if defined(GP_DIVERSITY_LOG) + // print logging when enabled + gpAssert_PrintLogString(componentId, filename, line); +#endif //GP_DIVERSITY_LOG + } +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_CALLBACK + +#ifdef GP_DIVERSITY_LOG +void gpAssert_PrintLogString(UInt8 componentID, FLASH_STRING filename, UInt16 line) +{ + Char gpAssert_File[11+GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH] = "Assert %i!"; + + HAL_DISABLE_GLOBAL_INT(); + + //Store in static variables for debuggers + gpAssert_filename = filename; + gpAssert_line = line; + + //Copy filename after '!' + STRNCPY_P(&(gpAssert_File[10]), filename,GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH); + gpLog_Flush(); + gpLog_Printf(componentID, false , (FLASH_STRING)gpAssert_File,2,line); + gpLog_Flush(); + hal_dump_backtrace(0); + + HAL_ENABLE_GLOBAL_INT(); + return; +} +#endif //#ifdef GP_DIVERSITY_LOG + +#ifdef GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG +void gpAssert_LedDebug(UInt16 line) +{ + HAL_FORCE_DISABLE_GLOBAL_INT(); + if(gpAssert_DebugEnabled == GP_ASSERT_DIVERSITY_LED_DEBUG_MAGIC_WORD) + { +#ifdef GP_DIVERSITY_LOG + //Flush out any pending messages + gpLog_Flush(); +#endif //GP_DIVERSITY_LOG + volatile Bool EndlessLoop = true; + while(EndlessLoop) + { + HAL_WDT_RESET(); + HAL_WAIT_MS(10); + Assert_blinkLedAssert(line); + } + } +} +#endif //GP_DIVERSITY_ASSERT_REPORTING_LED_DEBUG + +// action functions +#ifdef GP_DIVERSITY_ASSERT_ACTION_RESET +void gpAssert_ResetSystem(void) +{ + gpReset_ResetSystem(); +} +#endif //GP_DIVERSITY_ASSERT_ACTION_RESET + +#ifdef GP_DIVERSITY_ASSERT_ACTION_EXIT +void gpAssert_Exit(void) +{ +#ifdef GP_DIVERSITY_LOG + gpLog_Flush(); +#endif + exit(-1); +} +#endif //GP_DIVERSITY_ASSERT_ACTION_EXIT + +#if defined(GP_DIVERSITY_ASSERT_ACTION_BLINK_LED) +void gpAssert_BlinkLed(void) +{ + volatile Bool EndLessLoop = true; + + //Performs the end loop with LED blink + + // When the debugger reset the variable EndLessLoop, the CPU can return to the position, where the assert was called + while (EndLessLoop) + { + //toggle green led + HAL_WDT_RESET(); + HAL_LED_TGL(GRN); + HAL_WAIT_MS(500); +#ifdef GP_DIVERSITY_LOG + //Flush out any pending messages + gpLog_Flush(); +#endif //GP_DIVERSITY_LOG + } +} +#endif //GP_DIVERSITY_ASSERT_ACTION_BLINK_LED + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpBaseComps/inc/gpBaseComps.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpBaseComps/inc/gpBaseComps.h new file mode 100644 index 0000000..a741453 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpBaseComps/inc/gpBaseComps.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpBaseComps.h + * + * Initialization function of the BaseComps components. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ +#ifndef _GPBASECOMPS_H_ +#define _GPBASECOMPS_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpBaseComps_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +#include "global.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpBaseComps_CodeJumpTableFlash_Defs.h" +#include "gpBaseComps_CodeJumpTableRom_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +GP_API void gpBaseComps_StackInit(void); +GP_API void gpBaseComps_StackDeInit(void); + +GP_API void gpBaseComps_RegisterPreReInitCallback(void (*callback)(void)); +GP_API void gpBaseComps_RegisterPostReInitCallback(void (*callback)(void)); +GP_API void gpBaseComps_StackReInit(void); + + + + +GP_API void gpBaseComps_MacDeInit(void); +GP_API void gpBaseComps_MacInit(void); + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPBASECOMPS_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c new file mode 100644 index 0000000..a868696 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017-2021, Qorvo Inc + * + * gpBaseComps_StackInit.c + * + * The file contains the function that initializes all the base components that are used. + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#define GP_COMPONENT_ID GP_COMPONENT_ID_BASECOMPS + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +#include "gpBaseComps.h" + +#include "hal.h" + +#if defined(GP_DIVERSITY_JUMPTABLES) +#include "gpJumpTables.h" + +//Adding symbol pointing to Jump table to avoid optimizing out during linking +#include "gpJumpTables_DataTable.h" +const void* gpBaseComps_ForceDataJumpTableInclude = &JumpTables_DataTable; +#endif + +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER +#include "gpJumpTablesMatter.h" +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + +#include "gpSched.h" + + +#ifdef GP_COMP_RESET +#include "gpReset.h" +#endif //GP_COMP_RESET + +#ifdef GP_COMP_UNIT_TEST +#include "gpUnitTest.h" +#endif //GP_COMP_UNIT_TEST + + +#ifdef GP_COMP_COM +#include "gpCom.h" +#endif //GP_COMP_COM + +#include "gpLog.h" + + + +#ifdef GP_COMP_GPHAL +#include "gpHal.h" +#endif //GP_COMP_GPHAL + +#ifdef GP_COMP_RADIO +#include "gpRadio.h" +#endif //GP_COMP_RADIO + +#ifdef GP_COMP_MACCORE +#include "gpMacCore.h" +#endif //GP_COMP_MACCORE +#ifdef GP_COMP_MACDISPATCHER +#include "gpMacDispatcher.h" +#endif // GP_COMP_MACDISPATCHER + +#ifdef GP_COMP_RANDOM +#include "gpRandom.h" +#endif //GP_COMP_RANDOM +#ifdef GP_COMP_ENCRYPTION +#include "gpEncryption.h" +#endif //GP_COMP_ENCRYPTION + +#include "gpStat.h" + +#ifdef GP_COMP_POOLMEM +#include "gpPoolMem.h" +#endif //GP_COMP_POOLMEM + +#ifdef GP_COMP_PD +#include "gpPd.h" +#endif //GP_COMP_PD +#ifdef GP_COMP_PAD +#include "gpPad.h" +#endif //GP_COMP_PAD + +#ifdef GP_COMP_NVM +#include "gpNvm.h" +#endif //GP_COMP_NVM + +#ifdef GP_COMP_BSPRECFG +#include "gpBspReCfg.h" +#endif //GP_COMP_BSPRECFG + +#ifdef GP_COMP_KEYSCAN +#include "gpKeyScan.h" +#endif //GP_COMP_KEYSCAN + + + +#ifdef GP_COMP_TXMONITOR +#include "gpTxMonitor.h" +#endif //GP_COMP_TXMONITOR + +#ifdef GP_COMP_RANDOM +#include "gpRandom.h" +#endif /* GP_COMP_RANDOM */ + +#ifdef GP_COMP_VERSION +#include "gpVersion.h" +#endif //GP_COMP_VERSION + + +#include "gpAssert.h" +#include "gpRxArbiter.h" + +#ifdef GP_COMP_RFCHANNEL +#include "gpRFChannel.h" +#endif //GP_COMP_RFCHANNEL + + + +#ifdef GP_COMP_SILEXCRYPTOSOC +#include "silexCryptoSoc.h" +#endif + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpBaseComps_StackInit(void) +{ +//-------------------------- +//Initialize logging components +//-------------------------- + + + +#if defined(GP_COMP_COM) && !defined(TBC_GPCOM) + gpCom_Init(); +#endif + +#ifdef GP_DIVERSITY_LOG + gpLog_Init(); +#endif //GP_DIVERSITY_LOG + +//-------------------------- +//Init low level components +//-------------------------- + +#ifdef GP_COMP_GPHAL + gpHal_Init(false); + gpHal_EnableInterrupts(true); +#endif //GP_COMP_GPHAL + +#ifdef GP_COMP_RADIO + gpRadio_Init(); +#endif //GP_COMP_RADIO + + +#if defined(GP_DIVERSITY_JUMPTABLES) + GP_LOG_SYSTEM_PRINTF("NRT ROM v%d",0,gpJumpTables_GetRomVersion()); + /* Make sure the application has been built with the right minimal ROM version */ + GP_ASSERT_SYSTEM(gpJumpTables_GetRomVersion() >= GPJUMPTABLES_MIN_ROMVERSION); +#endif // defined(GP_DIVERSITY_JUMPTABLES) && !defined(GP_DIVERSITY_KEEP_NRT_IN_FLASH) && !defined(GP_DIVERSITY_ROM_BUILD) + +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER + gpJumpTablesMatter_Init(); +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + + gpSched_Init(); + +#ifdef GP_FREERTOS_DIVERSITY_SLEEP +#endif //GP_FREERTOS_DIVERSITY_SLEEP + + + +#ifdef GP_COMP_POOLMEM + gpPoolMem_Init(); +#endif //GP_COMP_POOLMEM + +#ifdef GP_COMP_VERSION + gpVersion_Init(); +#endif //GP_COMP_VERSION + + + + + + gpSched_StartTimeBase(); +#ifndef GP_SCHED_FREE_CPU_TIME +#ifndef GP_DIVERSITY_FREERTOS + gpSched_SetGotoSleepEnable(false); +#endif +#endif //GP_SCHED_FREE_CPU_TIME + +#ifdef GP_FREERTOS_DIVERSITY_SLEEP + hal_SleepSetGotoSleepEnable(false); +#endif //GP_FREERTOS_DIVERSITY_SLEEP + +#ifdef GP_COMP_UNIT_TEST + gpUnitTest_Init(); +#endif //GP_COMP_UNIT_TEST + + +#ifdef GP_COMP_TXMONITOR + gpTxMonitor_Init(GP_BSP_TXMONITOR_SETTLING_TIME_IN_SYMBOLS()); +#endif //GP_COMP_TXMONITOR + +//-------------------------- +// Init low level components with possible external communication +//-------------------------- + +#ifdef GP_COMP_NVM + gpNvm_Init(); +#endif //GP_COMP_NVM + +#ifdef GP_COMP_RESET + gpReset_Init(); +#endif //GP_COMP_RESET + + gpRxArbiter_Init(); + +#ifdef GP_COMP_PD + gpPd_Init(); +#endif //GP_COMP_PD +#ifdef GP_COMP_PAD + gpPad_Init(); +#endif //GP_COMP_PAD + +#ifdef GP_COMP_GPHAL + gpHal_AdvancedInit(); +#endif //GP_COMP_GPHAL + +#ifdef GP_COMP_SILEXCRYPTOSOC + silexCryptoSoc_InitFuncptr(); +#endif + +//-------------------------- +//Init higher level components +//-------------------------- +#ifdef GP_COMP_RANDOM + gpRandom_Init(); +#endif //GP_COMP_RANDOM +#ifdef GP_COMP_ENCRYPTION + gpEncryption_Init(); +#endif //GP_COMP_ENCRYPTION + + gpStat_Init(); + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && !defined(GP_COMP_UNIT_TEST) + if (gpVersion_ExchangeCompatibility() != gpVersion_CompatibilityResultCompatible) + { + GP_ASSERT_DEV_EXT(false); + } +#endif + + gpBaseComps_MacInit(); + +#ifdef GP_COMP_BSPRECFG + gpBspReCfg_Init(); +#endif //GP_COMP_STAT + +#ifdef GP_COMP_KEYSCAN + gpKeyScan_Init(); +#endif //GP_COMP_KEYSCAN + + + +#ifdef GP_COMP_RFCHANNEL + gpRFChannel_Init(); +#endif //GP_COMP_RFCHANNEL + +} + +void gpBaseComps_MacInit(void) +{ +#ifdef GP_COMP_MACCORE + gpMacCore_Init(); +#endif //GP_COMP_MACCORE +#ifdef GP_COMP_MACDISPATCHER + gpMacDispatcher_Init(); +#endif //GP_COMP_MACDISPATCHER +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpLog/inc/gpLog.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpLog/inc/gpLog.h new file mode 100644 index 0000000..5b62723 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpLog/inc/gpLog.h @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2021, Qorvo Inc + * + * gpLog.h + * + * This file contains the API definition of the logging module (printfs and asserts). + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPLOG_H_ +#define _GPLOG_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpLog_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_LOG_PSTR(s) (FLASH_STRING) GEN_STR2FLASH(s) + +#define GP_LOG_SPLIT_UINT32(i) (UInt16)(((i)&0xFFFF0000) >> 16), (UInt16)((i)&0xFFFF) + +#if defined(GP_DIVERSITY_LOG) && defined(GP_LOCAL_LOG) + +#if defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +#define GP_LOG_PRINTF(s, ...) \ + do { \ + static const char ROM rom_str[] @ ".rom" = s; \ + gpLog_Printf(GP_COMPONENT_ID, true, rom_str, __VA_ARGS__); \ + } while(false) +#else +#define GP_LOG_PRINTF(s, ...) gpLog_Printf(GP_COMPONENT_ID, true, GP_LOG_PSTR(s), __VA_ARGS__) +#endif + + +#else //defined(GP_DIVERSITY_LOG) && defined(GP_LOCAL_LOG) +#ifndef HAVE_NO_VARIABLE_LENGTH_MACRO +#define GP_LOG_PRINTF(s, ...) +#else +#define GP_LOG_PRINTF +#endif //HAVE_NO_VARIABLE_LENGTH_MACRO +#endif //defined(GP_DIVERSITY_LOG) && defined(GP_LOCAL_LOG) + +#ifdef GP_DIVERSITY_LOG +#if defined(__IAR_SYSTEMS_ICC__) && defined(GP_DIVERSITY_ROM_CODE) && defined(GP_DIVERSITY_JUMPTABLES) +#define GP_LOG_SYSTEM_PRINTF(s, ...) \ + do { \ + static const char ROM rom_str[] @ ".rom" = s; \ + gpLog_Printf(GP_COMPONENT_ID, true, rom_str, __VA_ARGS__); \ + } while(false) +#else +#define GP_LOG_SYSTEM_PRINTF(s, ...) gpLog_Printf(GP_COMPONENT_ID, true, GP_LOG_PSTR(s), __VA_ARGS__) +#endif +#else //GP_COMP_LOG +#ifndef HAVE_NO_VARIABLE_LENGTH_MACRO +#define GP_LOG_SYSTEM_PRINTF(s, ...) +#else +#define GP_LOG_SYSTEM_PRINTF +#endif //HAVE_NO_VARIABLE_LENGTH_MACRO +#define gpLog_PrintBuffer(length, pData) +#define gpLog_Flush() +#endif //GP_DIVERSITY_LOG + +#define gpLog_PrintfEnable(enable) + +/* Print bits easily */ +#define BYTE_TO_BIN(byte) \ + (byte & 0x80 ? '1' : '0'), \ + (byte & 0x40 ? '1' : '0'), \ + (byte & 0x20 ? '1' : '0'), \ + (byte & 0x10 ? '1' : '0'), \ + (byte & 0x08 ? '1' : '0'), \ + (byte & 0x04 ? '1' : '0'), \ + (byte & 0x02 ? '1' : '0'), \ + (byte & 0x01 ? '1' : '0') + +#define BYTE_TO_BIN_PATTERN "%c%c%c%c%c%c%c%c" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpLog_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/** +* @brief Initializes the logging module +*/ +GP_API void gpLog_Init(void); + +/** +* @brief Prints a string with formats through the debug interface. +* +* @param componentID Component ID of component calling the print function. +* @param progmem Indicate if format string buffer originates from FLASH or RAM memory. +* @param format_str NULL terminated string with formatting parameters. +* @param length Deprecated variable, previously indication size of following parameters. +*/ +#ifdef __GNUC__ +GP_API void gpLog_Printf(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...) __attribute__((format(printf, 3, 5))); +#else +GP_API void gpLog_Printf(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...); +#endif + +/** +* @brief Prints a string with formats through the debug interface. +* +* @param componentID Component ID of component calling the print function. +* @param progmem Indicate if format string buffer originates from FLASH or RAM memory. +* @param format_str NULL terminated string with formatting parameters. +* @param length Deprecated variable, previously indication size of following parameters. +*/ +#ifdef __GNUC__ +GP_API void gpLog_Printf_Com(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...) __attribute__((format(printf, 3, 5))); +#else +GP_API void gpLog_Printf_Com(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...); +#endif + +#ifdef GP_DIVERSITY_LOG +/** +* @brief Prints a data buffer in hex format. +* +* @param pData pointer to the buffer +* @param length length to be printed +*/ +GP_API void gpLog_PrintBuffer(UInt16 length, UInt8* pData); + +/** +* @brief Flush any pending logging. +*/ +GP_API void gpLog_Flush(void); + + +/** +* @brief Enable or disable the default gpLog print to console on terminal based applications. +* +* @param enable true or false to enable or disable the print +*/ +GP_API void gpLog_EnableConsoleLog(Bool enable); + +/** +* @brief Retrieve the value of the 'gpLog print to console on terminal based applications' setting +* +* @return Bool true if the print is enabled +*/ +GP_API Bool gpLog_GetConsoleLog(void); + +/** +* @brief Set a file pointer to output the Logging to. File creation should be managed by the caller. +* +* @param pFile file pointer to print to. If NULL print to file is disabled. +*/ +GP_API void gpLog_SetFilePointer(void* pFile); + + +#endif //GP_DIVERSITY_LOG + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPLOG_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c new file mode 100644 index 0000000..c339bab --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpLog/src/gpLog_printf.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2010-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * This file contains the implementation of the logging module (forward to printf version). + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_LOG + +#include "gpLog.h" +#include "hal.h" /*HAVE_LOCALTIME setting*/ + +#include +#include +#include + + + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define LOG_MAX_LEN 200 + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +#ifdef GP_LOG_BUFFERED_COMPID +static char Log_BufferCompId[LOG_MAX_LEN]; +#endif //GP_LOG_BUFFERED_COMPID + +static FILE* Log_pLogFile = NULL; +static Bool Log_Enabled = true; + + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +static void Log_Formatted(UInt8 componentID, char* buf); + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +#ifdef GP_LOG_BUFFERED_COMPID +Bool Log_Buffer(char* buf) +{ + UIntLoop i; + Bool buffered; + + UInt8 newBufLength; + UInt8 logBufLength; + + newBufLength = strlen(buf); + logBufLength = strlen(Log_BufferCompId); + + //Max buffering exceeded - dump what is stored + if((newBufLength + logBufLength) >= LOG_MAX_LEN) + { + Log_Formatted(GP_LOG_BUFFERED_COMPID, Log_BufferCompId); + //Reset buffer + MEMSET(Log_BufferCompId, 0, sizeof(Log_BufferCompId)); + logBufLength = 0; + } + + //buffer to static buffer - limited to max length + STRNCPY(&Log_BufferCompId[logBufLength], buf, LOG_MAX_LEN - logBufLength); + buffered = true; + + // check for \n present: + for(i = 0; i < newBufLength; i++) + { + if(buf[i] == '\n') //End of line found + { + //Add buffered logging to end-of-line logging and let it pass + STRNCPY(buf, Log_BufferCompId, LOG_MAX_LEN); + + buf[strlen(buf) - 1] = 0x0; //remove /n + + //Reset buffer + MEMSET(Log_BufferCompId, 0, sizeof(Log_BufferCompId)); + buffered = false; + break; + } + } + + return buffered; +} +#endif //GP_LOG_BUFFERED_COMPID + +static void Log_Formatted(UInt8 componentID, char* buf) +{ +#if defined(HAVE_LOCALTIME) + char timeBuf[10]; + struct tm* local; +#endif +#if defined(GP_COMP_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + UInt16 ms, us; +#endif + +#ifdef HAVE_LOCALTIME +#if defined(GP_COMP_UNIT_TEST) || defined(GP_COMP_CHIPEMU) + time_t t; + t = (time_t)hal_GetCurrentTime()*32; + us = (UInt16)(t % 1000); + t = t / 1000; + ms = (UInt16)(t % 1000); + t = t / 1000; + local = localtime(&t); + strftime(timeBuf, 10, "%H:%M:%S", local); + printf("%s.%03d.%03d: %02X %s\n", timeBuf, ms, us, componentID, buf); +#else + struct timeval tv; + gettimeofday(&tv, NULL); + local = localtime(&tv.tv_sec); + strftime(timeBuf, 10, "%H:%M:%S", local); + if(Log_Enabled) + { + printf("%s:%03u %02X %s\n", timeBuf, (UInt16)(tv.tv_usec / 1000), componentID, buf); + } + if(Log_pLogFile) + { + fprintf(Log_pLogFile, "%s:%03u %02X %s\n", timeBuf, (UInt16)(tv.tv_usec / 1000), componentID, buf); + fflush(Log_pLogFile); + } +#endif +#else + printf("%02X %s\n", componentID, buf); +#endif +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpLog_Init(void) +{ +#ifdef GP_LOG_BUFFERED_COMPID + MEMSET(Log_BufferCompId, 0, sizeof(Log_BufferCompId)); +#endif //GP_LOG_BUFFERED_COMPID +} + +void gpLog_Printf(UInt8 componentID, Bool progmem, FLASH_STRING format_str, UInt8 length, ...) +{ + NOT_USED(progmem); + char buf[LOG_MAX_LEN]; + + va_list ap; + va_start(ap, length); + vsnprintf(buf, LOG_MAX_LEN, format_str, ap); + va_end(ap); + +#ifdef GP_LOG_BUFFERED_COMPID + if((componentID == GP_LOG_BUFFERED_COMPID) && Log_Buffer(buf)) + { + return; + } +#endif + Log_Formatted(componentID, buf); +} + +void gpLog_PrintBuffer(UInt16 length, UInt8* buf) +{ + int i; + + for(i = 0; i < length; i += 8) + { + gpLog_Printf(GP_COMPONENT_ID, true, "%u/%u: %04x %04x %04x %04x", 0, + i, length, ((buf[i] << 8) | buf[i + 1]), + ((buf[i + 2] << 8) | buf[i + 3]), + ((buf[i + 4] << 8) | buf[i + 5]), + ((buf[i + 6] << 8) | buf[i + 7])); + gpLog_Flush(); + } +} + +void gpLog_Flush(void) +{ + fflush(stdout); +} + +void gpLog_EnableConsoleLog(Bool enable) +{ + Log_Enabled = enable; +} +Bool gpLog_GetConsoleLog(void) +{ + return Log_Enabled; +} +void gpLog_SetFilePointer(void* pFile) +{ + Log_pLogFile = (FILE*)pFile; +} + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/inc/gpPoolMem.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/inc/gpPoolMem.h new file mode 100644 index 0000000..9415a06 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/inc/gpPoolMem.h @@ -0,0 +1,157 @@ + +/* + * Copyright (c) 2011-2012, 2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + + +#ifndef _GPPOOLMEM_H_ +#define _GPPOOLMEM_H_ + +#if defined(GP_DIVERSITY_ROM_CODE) +#include "gpPoolMem_RomCode.h" +#else //defined(GP_DIVERSITY_ROM_CODE) + +//DOCUMENTATION GENERATION: no @file required as all documented items are refered to a group + +/** + *@defgroup DEF_POOLMEM General PoolMem Definitions + * @brief The general PoolMem Definitions + * + * Maximal 3 different sizes of chunks available + * + * @image html chunk.png + * @image latex chunk.png "Single Chunk structure" + * + *@defgroup GEN_POOLMEM General PoolMem Public Functions + * @brief The general public PoolMem functionality is implemented in these functions + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpPd.h" // for gpPd_Descriptor_t +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_POOLMEM_MALLOC(nbytes) gpPoolMem_Malloc(GP_COMPONENT_ID,(nbytes), false) +#define GP_POOLMEM_TRYMALLOC(nbytes) gpPoolMem_Malloc(GP_COMPONENT_ID,(nbytes), true) + + +#define GP_POOLMEM_PD_SIZE (sizeof(gpPd_Descriptor_t)) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpPoolMem_CodeJumpTableFlash_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ + +/**@ingroup GEN_POOLMEM + * @brief This function initialize the chunks, it basically sets all the guards and the InUse flags on false. + * +*/ +void gpPoolMem_Init(void); + +/**@ingroup GEN_POOLMEM + * @brief This function is almost similar as PoolMem_Init; invoked at warm restart. + * +*/ +void gpPoolMem_Reset(void); + +/**@ingroup GEN_POOLMEM + * @brief This function allocates a free chunk + * +* @param nbytes Minimal Chunk size +* @param try avoid assert and returning a NULL is handled +* @return void* Returns pointer to allocated chunk +* @return Assert When no chunk free (depends on try) +* @return Assert When nbytes > size of biggest chunk +* @return Assert When GuardEnd or GuardStart overwritten of free chunk +*/ +void* gpPoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_); + + +/**@ingroup GEN_POOLMEM + * @brief This function will free an allocated chunk + * +* @param pData Pointer to Chunk +* @return Assert When wrong pointer given +* @return Assert When GuardEnd or GuardStart overwritten +*/ +void gpPoolMem_Free (void* pData); + +/**@ingroup GEN_POOLMEM + * @brief This function will dump all PoolMem content and check consistency + * +* @param checkConsistency Assert when consistency check fails +* @return Assert When consistency is compromised +*/ +void gpPoolMem_Dump(Bool checkConsistency); + +#ifdef GP_COMP_UNIT_TEST +// Backdoor interface for Unit Tests +void PoolMem_Init(void); +void* PoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_); +void PoolMem_Free (void* pData); +void PoolMem_Free_ByCompId(UInt8 comp_id); +UInt8 PoolMem_InUse(void); +#endif //GP_COMP_UNIT_TEST + +UInt32 gpPoolMem_GetMaxAvailableChunkSize(void); + + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //defined(GP_DIVERSITY_ROM_CODE) + +#endif // _GPPOOLMEM_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c new file mode 100644 index 0000000..bef6394 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem.c @@ -0,0 +1,85 @@ + +/* + * Copyright (c) 2011-2012, 2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This file implements a pool memory allocator + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright law + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_POOLMEM + +// General includes +#include "gpPoolMem.h" +#include "gpPoolMem_defs.h" + + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + /* Init amount of chunks inside memory */ + void gpPoolMem_Init(void) + { + PoolMem_Init(); + } + + /* Implement malloc function */ +void *gpPoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_) +{ + void *handle; + handle = PoolMem_Malloc(comp_id,nbytes, try_); + return handle; +} + +/* Implement free function */ +void gpPoolMem_Free (void* pData) +/* Check guards and free chunk, if guard error -> assert */ +{ + // If chunk not found, wrong pointer is given or InUse flag overwritten -> assert + PoolMem_Free(pData); +} + +#if defined(GP_DIVERSITY_JUMPTABLES) +// Full debugging disabled in application, but ROM code will still call this function. +void gpPoolMem_SetDebugLine(UInt16 lineNumber) +{ + NOT_USED(lineNumber); +} +#endif // GP_POOLMEM_DIVERSITY_DUMP_FULL_POOL diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c new file mode 100644 index 0000000..c5b64f0 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_data.c @@ -0,0 +1,59 @@ + +/* + * Copyright (c) 2012-2014, GreenPeak Technologies + * Copyright (c) 2017, Qorvo Inc + * + * This file defines the pools used by the pool memory allocator + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright law + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Include Definitions + *****************************************************************************/ + +#include "gpPoolMem.h" +#include "gpPoolMem_defs.h" + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ +#if GP_POOLMEM_CHUNK_AMOUNT1 == 0 +#error Minimum need 1 buffer to play with +#endif + +//Various data +gpPoolMem_Chunkpd_t Chunkpd[GP_POOLMEM_PD_AMOUNT] GP_EXTRAM_SECTION_ATTR; +gpPoolMem_Chunks1_t Chunks1[GP_POOLMEM_CHUNK_AMOUNT1] GP_EXTRAM_SECTION_ATTR; +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 +gpPoolMem_Chunks2_t Chunks2[GP_POOLMEM_CHUNK_AMOUNT2] GP_EXTRAM_SECTION_ATTR; +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 +gpPoolMem_Chunks3_t Chunks3[GP_POOLMEM_CHUNK_AMOUNT3] GP_EXTRAM_SECTION_ATTR; +#endif diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_defs.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_defs.h new file mode 100644 index 0000000..92a3af1 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_defs.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2012, 2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GPPOOLMEM_DEFS_H_ +#define _GPPOOLMEM_DEFS_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include +#include "gpPoolMem.h" + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + /** @ingroup DEF_POOLMEM + * @brief Size of Chunk size 1 +*/ +#ifndef GP_POOLMEM_CHUNK_SIZE1 +#define GP_POOLMEM_CHUNK_SIZE1 50 +#endif //GP_POOLMEM_CHUNK_SIZE1 + /** @ingroup DEF_POOLMEM + * @brief Size of Chunk size 2 +*/ +#ifndef GP_POOLMEM_CHUNK_SIZE2 +#define GP_POOLMEM_CHUNK_SIZE2 100 +#endif //GP_POOLMEM_CHUNK_SIZE2 + /** @ingroup DEF_POOLMEM + * @brief Size of Chunk size 3 +*/ +#ifndef GP_POOLMEM_CHUNK_SIZE3 +#define GP_POOLMEM_CHUNK_SIZE3 150 +#endif //GP_POOLMEM_CHUNK_SIZE3 + /** @ingroup DEF_POOLMEM + * @brief Amount of Chunk Size 1 +*/ +#ifndef GP_POOLMEM_CHUNK_AMOUNT1 +#define GP_POOLMEM_CHUNK_AMOUNT1 1 +#endif //GP_POOLMEM_CHUNK_AMOUNT1 + /** @ingroup DEF_POOLMEM + * @brief Amount of Chunk Size 2 +*/ +#ifndef GP_POOLMEM_CHUNK_AMOUNT2 +#define GP_POOLMEM_CHUNK_AMOUNT2 1 +#endif //GP_POOLMEM_CHUNK_AMOUNT2 + /** @ingroup DEF_POOLMEM + * @brief Amount of Chunk Size 3 +*/ +#ifndef GP_POOLMEM_CHUNK_AMOUNT3 +#define GP_POOLMEM_CHUNK_AMOUNT3 0 +#endif //GP_POOLMEM_CHUNK_AMOUNT3 + +/** @ingroup DEF_POOLMEM + * @brief Amount of PD Size +*/ + +#ifndef GP_POOLMEM_PD_AMOUNT + #ifdef GP_PD_NR_OF_HANDLES + #define GP_POOLMEM_PD_AMOUNT GP_PD_NR_OF_HANDLES + #else + #define GP_POOLMEM_PD_AMOUNT 5 + #endif //GP_PD_NR_OF_HANDLES +#endif // GP_POOLMEM_PD_AMOUNT + +#ifdef GP_POOLMEM_PD_AMOUNT +#define GP_POOLMEM_MAX_ENTRIES (GP_POOLMEM_PD_AMOUNT + GP_POOLMEM_CHUNK_AMOUNT1 + GP_POOLMEM_CHUNK_AMOUNT2 + GP_POOLMEM_CHUNK_AMOUNT3) +#else +#define GP_POOLMEM_MAX_ENTRIES (GP_POOLMEM_CHUNK_AMOUNT1 + GP_POOLMEM_CHUNK_AMOUNT2 + GP_POOLMEM_CHUNK_AMOUNT3) +#endif // GP_POOLMEM_PD_AMOUNT + +#ifdef ALIGNMENT_NEEDED +typedef UInt32 GUARD; +#else +typedef UInt16 GUARD; +#endif + /** @ingroup DEF_POOLMEM + * @brief Guard Pattern +*/ + +#ifdef ALIGNMENT_NEEDED +#define GP_POOLMEM_GUARD 0xCA4EE4AC +#else +#define GP_POOLMEM_GUARD 0xCA4E +#endif + /** @ingroup DEF_POOLMEM + * @brief NotUsed pattern +*/ +#define GP_POOLMEM_NOTUSED 0xFF + +/* Chunk structure, max 3 different sizes to use */ + +/** @ingroup DEF_POOLMEM + * @brief Structure of Chunk s1 +*/ +typedef struct gpPoolMem_Chunks1 { + GUARD GuardStart; + UInt8 Data[GP_POOLMEM_CHUNK_SIZE1]; + GUARD GuardEnd; + Bool InUse; +} gpPoolMem_Chunks1_t; + + +/** @ingroup DEF_POOLMEM + * @brief Structure of Chunk s2 +*/ +typedef struct gpPoolMem_Chunks2 { + GUARD GuardStart; + UInt8 Data[GP_POOLMEM_CHUNK_SIZE2]; + GUARD GuardEnd; + Bool InUse; +} gpPoolMem_Chunks2_t; + + +/** @ingroup DEF_POOLMEM + * @brief Structure of Chunk s3 +*/ +typedef struct gpPoolMem_Chunks3 { + GUARD GuardStart; + UInt8 Data[GP_POOLMEM_CHUNK_SIZE3]; + GUARD GuardEnd; + Bool InUse; +} gpPoolMem_Chunks3_t; + +/** @ingroup DEF_POOLMEM + * @brief Structure of Chunk pd +*/ +typedef struct gpPoolMem_Chunkpd { + GUARD GuardStart; + UInt8 Data[GP_POOLMEM_PD_SIZE]; + GUARD GuardEnd; + Bool InUse; +} gpPoolMem_Chunkpd_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void PoolMem_Init(void); +void *PoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_); +void PoolMem_Free (void* pData); + +#endif // _GPPOOLMEM_DEFS_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c new file mode 100644 index 0000000..637b6b7 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpPoolMem/src/gpPoolMem_impl.c @@ -0,0 +1,374 @@ + +/* + * Copyright (c) 2012-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This file implements a pool memory allocator + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright law + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_POOLMEM +#define GP_MODULE_ID GP_MODULE_ID_POOLMEM + +//#define GP_LOCAL_LOG + +#include "gpLog.h" +#include "gpAssert.h" +#include "gpWmrk.h" +#include "gpPoolMem.h" +#include "gpPoolMem_defs.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define POOLMEM_CHECK(size,amount) do { \ + UIntLoop i; \ + Bool failure = false; \ + for (i = 0; i < amount; i++) \ + { \ + if(!(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD)) \ + { \ + GP_LOG_SYSTEM_PRINTF("BA-%u[%u]-grd fail",8,(UInt16)sizeof(Chunk##size[i].Data),(UInt16)i);\ + failure = true; \ + } \ + } \ + GP_ASSERT_SYSTEM(!failure); \ + } while(false) + +#define POOLMEM_DUMP(size,amount) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + gpLog_PrintBuffer(sizeof(Chunk##size[i]), (UInt8*)&Chunk##size[i]); \ + } \ + } while(false) + +/* Init chunks, put all InUse flags on false and fill Guard with pattern */ +/* InUse flag on GP_POOLMEM_NOTUSED when not used. If used we will place CompId inside */ +#define POOLMEM_INIT(size,amount) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + Chunk##size[i].InUse = GP_POOLMEM_NOTUSED; \ + Chunk##size[i].GuardStart = GP_POOLMEM_GUARD;\ + Chunk##size[i].GuardEnd = GP_POOLMEM_GUARD; \ + } \ + } while(false) + +/* Look for free chunk and return pointer to data. Check guardStart before checking InUse flag. */ +/* Component Id will be used as InUse flag */ +#define POOLMEM_MALLOC(size,amount,nbytes,comp_id) do { \ + UIntLoop i; \ + for (i = 0; i < amount; ++i) \ + { \ + if (Chunk##size[i].InUse == GP_POOLMEM_NOTUSED) \ + { \ + GP_LOG_PRINTF("BA-%u[%u]-CId:%u-S:%lu",8,(UInt16)sizeof(Chunk##size[i].Data),(UInt16)i,(UInt16)comp_id,(UInt32)nbytes);\ + GP_ASSERT_SYSTEM(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD);\ + Chunk##size[i].InUse = comp_id; \ + gpWmrk_CntrToLimit(gpPoolMemWmrk##size); \ + gpWmrk_CntrSet(gpPoolMemWmrkSize, nbytes); \ + return &(Chunk##size[i].Data[0]); \ + } \ + } \ + } while(false) + +/* Look for chunk to be freed */ +#define POOLMEM_FREE(size,amount) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + if (pData == &(Chunk##size[i].Data[0])) \ + { \ + GP_LOG_PRINTF("BF-%u[%u]:%u",6,(UInt16)sizeof(Chunk##size[i].Data),(UInt16)i,(UInt16)Chunk##size[i].InUse);\ + GP_ASSERT_SYSTEM(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD\ + && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD && Chunk##size[i].InUse != GP_POOLMEM_NOTUSED);\ + Chunk##size[i].InUse = GP_POOLMEM_NOTUSED; \ + gpWmrk_CntrFromLimit(gpPoolMemWmrk##size); \ + return; \ + } \ + }\ + } while(false) + +#define POOLMEM_FREE_BY_COMPID(size,amount, comp_id) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + if (comp_id == Chunk##size[i].InUse) \ + { \ + GP_LOG_PRINTF("BF-%u[%u]:CId:%u %u",6,(UInt16)sizeof(Chunk##size[i].Data),(UInt16)i, comp_id, (UInt16)Chunk##size[i].InUse);\ + GP_ASSERT_SYSTEM(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD\ + && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD );\ + Chunk##size[i].InUse = GP_POOLMEM_NOTUSED; \ + gpWmrk_CntrFromLimit(gpPoolMemWmrk##size); \ + } \ + }\ + } while(false) + +#define POOLMEM_IN_USE(size,amount,amountInUse) do { \ + UIntLoop i; \ + for (i = 0; i < amount; i++) \ + { \ + if (GP_POOLMEM_NOTUSED != Chunk##size[i].InUse) \ + { \ + GP_ASSERT_SYSTEM(Chunk##size[i].GuardStart == GP_POOLMEM_GUARD\ + && Chunk##size[i].GuardEnd == GP_POOLMEM_GUARD );\ + amountInUse++; \ + } \ + }\ + } while(false) +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +#if defined GP_POOLMEM_CHUNK_AMOUNT1 == 0 +#error Minimum need 1 buffer to play with +#endif + +//Data pools +extern gpPoolMem_Chunkpd_t Chunkpd[]; +extern gpPoolMem_Chunks1_t Chunks1[]; +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 +extern gpPoolMem_Chunks2_t Chunks2[]; +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 +extern gpPoolMem_Chunks3_t Chunks3[]; +#endif + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +/* Init of chunks inside memory */ + void PoolMem_Init(void) + { + GP_LOG_PRINTF("Init PoolMem",0); + POOLMEM_INIT(pd,GP_POOLMEM_PD_AMOUNT); + POOLMEM_INIT(s1,GP_POOLMEM_CHUNK_AMOUNT1); +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_INIT(s2,GP_POOLMEM_CHUNK_AMOUNT2); +#endif // GP_POOLMEM_CHUNK_AMOUNT2 > 0 +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_INIT(s3,GP_POOLMEM_CHUNK_AMOUNT3); +#endif + } + +void gpPoolMem_Reset(void) + { + GP_LOG_PRINTF("Reset PoolMem",0); + POOLMEM_INIT(pd,GP_POOLMEM_PD_AMOUNT); + POOLMEM_INIT(s1,GP_POOLMEM_CHUNK_AMOUNT1); + +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_INIT(s2,GP_POOLMEM_CHUNK_AMOUNT2); +#endif // GP_POOLMEM_CHUNK_AMOUNT2 > 0 + +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_INIT(s3,GP_POOLMEM_CHUNK_AMOUNT3); +#endif // GP_POOLMEM_CHUNK_AMOUNT3 > 0 + } + +/* Implementation Malloc function */ +void *PoolMem_Malloc (UInt8 comp_id, UInt32 nbytes, Bool try_) +{ + /* Look for free chunk + Check GuardStart before checking InUse flag */ + if ((GP_POOLMEM_CHUNK_SIZE1 < GP_POOLMEM_PD_SIZE) && (GP_POOLMEM_CHUNK_AMOUNT2 == 0) && (GP_POOLMEM_CHUNK_AMOUNT3 == 0)) + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE1) POOLMEM_MALLOC(s1,GP_POOLMEM_CHUNK_AMOUNT1,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + } + else if((GP_POOLMEM_CHUNK_SIZE1 > GP_POOLMEM_PD_SIZE) && (GP_POOLMEM_CHUNK_AMOUNT2 == 0) && (GP_POOLMEM_CHUNK_AMOUNT3 == 0)) + { + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE1) POOLMEM_MALLOC(s1,GP_POOLMEM_CHUNK_AMOUNT1,nbytes,comp_id); + } +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + else if((GP_POOLMEM_CHUNK_AMOUNT2 > 0) && (GP_POOLMEM_CHUNK_AMOUNT3 == 0)) + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE1) POOLMEM_MALLOC(s1,GP_POOLMEM_CHUNK_AMOUNT1,nbytes,comp_id); + + if (GP_POOLMEM_PD_SIZE < GP_POOLMEM_CHUNK_AMOUNT2) + { + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE2) POOLMEM_MALLOC(s2,GP_POOLMEM_CHUNK_AMOUNT2,nbytes,comp_id); + } + else + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE2) POOLMEM_MALLOC(s2,GP_POOLMEM_CHUNK_AMOUNT2,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + } + } +#endif // GP_POOLMEM_CHUNK_AMOUNT2 > 0 +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + else // (GP_POOLMEM_CHUNK_AMOUNT3 > 0) && (GP_POOLMEM_CHUNK_AMOUNT2 > 0) + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE1) POOLMEM_MALLOC(s1,GP_POOLMEM_CHUNK_AMOUNT1,nbytes,comp_id); + if (GP_POOLMEM_PD_SIZE < GP_POOLMEM_CHUNK_AMOUNT2) + { + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE2) POOLMEM_MALLOC(s2,GP_POOLMEM_CHUNK_AMOUNT2,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE3) POOLMEM_MALLOC(s3,GP_POOLMEM_CHUNK_AMOUNT3,nbytes,comp_id); + } + else + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE2) POOLMEM_MALLOC(s2,GP_POOLMEM_CHUNK_AMOUNT2,nbytes,comp_id); + if (GP_POOLMEM_PD_SIZE < GP_POOLMEM_CHUNK_AMOUNT3) + { + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_CHUNK_SIZE3) POOLMEM_MALLOC(s3,GP_POOLMEM_CHUNK_AMOUNT3,nbytes,comp_id); + } + else + { + if (nbytes <= GP_POOLMEM_CHUNK_SIZE3) POOLMEM_MALLOC(s3,GP_POOLMEM_CHUNK_AMOUNT3,nbytes,comp_id); + if (nbytes <= GP_POOLMEM_PD_SIZE) POOLMEM_MALLOC(pd,GP_POOLMEM_PD_AMOUNT,nbytes,comp_id); + } + } + } +#endif // GP_POOLMEM_CHUNK_AMOUNT3 > 0 + //If no buffer available or buffer sizes too small: + GP_LOG_PRINTF("Chunk size too small: CId:%u - size:%lu",4,(UInt16)comp_id,(UInt32)nbytes); + + if(!try_) + { + GP_ASSERT_DEV_EXT(false); + } + return NULL; +} + +/* Implementation Free function */ +void PoolMem_Free (void* pData) +/* Check guards and free chunk, if guard error -> assert */ +{ + // Release chunk + POOLMEM_FREE(pd,GP_POOLMEM_PD_AMOUNT); + POOLMEM_FREE(s1,GP_POOLMEM_CHUNK_AMOUNT1); +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_FREE(s2,GP_POOLMEM_CHUNK_AMOUNT2); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_FREE(s3,GP_POOLMEM_CHUNK_AMOUNT3); +#endif + // If chunk not found, wrong pointer is given: + GP_ASSERT_DEV_EXT(false); +} + +#ifdef GP_COMP_UNIT_TEST + +void PoolMem_Free_ByCompId (UInt8 comp_id) +{ + // Release chunk by CompId + POOLMEM_FREE_BY_COMPID(pd,GP_POOLMEM_PD_AMOUNT, comp_id); + POOLMEM_FREE_BY_COMPID(s1,GP_POOLMEM_CHUNK_AMOUNT1, comp_id); +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_FREE_BY_COMPID(s2,GP_POOLMEM_CHUNK_AMOUNT2, comp_id); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_FREE_BY_COMPID(s3,GP_POOLMEM_CHUNK_AMOUNT3, comp_id); +#endif + return; +} + +UInt8 PoolMem_InUse (void) +{ + UInt8 amountInUse = 0; + + POOLMEM_IN_USE(pd,GP_POOLMEM_PD_AMOUNT,amountInUse); + POOLMEM_IN_USE(s1,GP_POOLMEM_CHUNK_AMOUNT1,amountInUse); +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_IN_USE(s2,GP_POOLMEM_CHUNK_AMOUNT2,amountInUse); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_IN_USE(s3,GP_POOLMEM_CHUNK_AMOUNT3,amountInUse); +#endif + return amountInUse; +} +#endif //GP_COMP_UNIT_TEST + +void gpPoolMem_Dump(Bool checkConsistency) +{ +#if GP_POOLMEM_CHUNK_AMOUNT1 > 0 + POOLMEM_DUMP(s1, GP_POOLMEM_CHUNK_AMOUNT1); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_DUMP(s2, GP_POOLMEM_CHUNK_AMOUNT2); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_DUMP(s3, GP_POOLMEM_CHUNK_AMOUNT3); +#endif + + if(checkConsistency) + { +#if GP_POOLMEM_CHUNK_AMOUNT1 > 0 + POOLMEM_CHECK(s1, GP_POOLMEM_CHUNK_AMOUNT1); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + POOLMEM_CHECK(s2, GP_POOLMEM_CHUNK_AMOUNT2); +#endif +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + POOLMEM_CHECK(s3, GP_POOLMEM_CHUNK_AMOUNT3); +#endif + } +} + +UInt32 gpPoolMem_GetMaxAvailableChunkSize(void) +{ + UIntLoop i; +#if GP_POOLMEM_CHUNK_AMOUNT3 > 0 + for (i = 0; i < GP_POOLMEM_CHUNK_AMOUNT3; i++) + { + if (GP_POOLMEM_NOTUSED == Chunks3[i].InUse) + { + return GP_POOLMEM_CHUNK_SIZE3; + } + } +#endif +#if GP_POOLMEM_CHUNK_AMOUNT2 > 0 + for (i = 0; i < GP_POOLMEM_CHUNK_AMOUNT2; i++) + { + if (GP_POOLMEM_NOTUSED == Chunks2[i].InUse) + { + return GP_POOLMEM_CHUNK_SIZE2; + } + } +#endif +#if GP_POOLMEM_CHUNK_AMOUNT1 > 0 + for (i = 0; i < GP_POOLMEM_CHUNK_AMOUNT1; i++) + { + if (GP_POOLMEM_NOTUSED == Chunks1[i].InUse) + { + return GP_POOLMEM_CHUNK_SIZE1; + } + } +#endif + return 0; +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/inc/gpSched.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/inc/gpSched.h new file mode 100644 index 0000000..29c64c7 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/inc/gpSched.h @@ -0,0 +1,362 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2021, Qorvo Inc + * + * gpSched.h + * This file contains the definitions of the scheduler, wich is the operating system. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ +/** + * @file gpSched.h + * @brief The cooperative scheduling component that handles all Qorvo stack events. + */ + +#ifndef _GPSCHED_H_ +#define _GPSCHED_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "global.h" +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_SCHED_DISTANTEVENTS_INTERVAL (20 * 60) +#define GP_SCHED_EVENT_TIME_NOW ((UInt32)-1L) +#define GP_SCHED_EVENT_TIME_MAX 0x7FFFFFFFUL + +/** @brief Compares times from the chip's timebase - check if t1 < t2 (in us) +*/ +#define GP_SCHED_TIME_COMPARE_LOWER_US(t1, t2) (!((UInt32)((t1) - (t2)) /*&(0xFFFFFFFF)*/ < (0x80000000LU))) + +/** @brief Allow sleep only if no events are pending +*/ +#define GP_SCHED_NO_EVENTS_GOTOSLEEP_THRES ((UInt32)(0xFFFFFFFF)) + +/** @brief Default time between events before going to sleep is considered */ +#ifndef GP_SCHED_DEFAULT_GOTOSLEEP_THRES +#define GP_SCHED_DEFAULT_GOTOSLEEP_THRES GP_SCHED_NO_EVENTS_GOTOSLEEP_THRES +#endif + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef void (*gpSched_EventCallback_t)(void*); + +typedef Bool (*gpSched_GotoSleepCheckCallback_t)(void); + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpJumpTables_DataTable.h" +#include "gpSched_CodeJumpTableFlash_Defs.h" +#include "gpSched_CodeJumpTableRom_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ + +/** + * @brief Initializes the scheduler + * + * This function intializes the scheduler. + * + */ +GP_API void gpSched_Init(void); +GP_API void gpSched_DeInit(void); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ +/** + * @brief Sets the minimum time required between events for going to sleep. + * + * This function sets a threshold in us, that is used for determining if we can go to sleep. + * If the next scheduled event is at a time later than the current time + the defined threshold (- wakeup threshold) + * then going to sleep is allowed + * + * @param Threshold threshold in us + */ +GP_API Bool gpSched_SetGotoSleepThreshold(UInt32 Threshold); +GP_API void gpSched_SetGotoSleepCheckCallback(gpSched_GotoSleepCheckCallback_t gotoSleepCheckCallback); +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +GP_API void gpSched_SetGotoSleepEnable(Bool enable); + +GP_API void gpSched_GoToSleep(void); +GP_API UInt32 Sched_CanGoToSleep(void); + +/** + * @brief Starts the time base. + * + * Starts the time base, i.e. the timer interrupts are enabled. + */ +GP_API void gpSched_StartTimeBase(void); + +/** + * @brief Returns the current time of the time base. + * + * @return The current time in time base units of 1us. + */ +GP_API UInt32 gpSched_GetCurrentTime(void); + +/** + * @brief Compare 2 times (in 1us) taking overflows into account. + * + * @param n_time1 Time (in us) to be compared. + * @param n_time2 Second time (in us) to compare against n_time1. + * + * @return return True if n_time1 is earlier then n_time2 + */ +GP_API Bool gpSched_TimeCompareLower(UInt32 n_time1, UInt32 n_time2); + +/** + * @brief Clears the event queue. + * + * Clears the event queue. + * + */ +GP_API void gpSched_Clear(void); + +/** + * @brief Returns the event queue status. + * + * Returns the next event to execute. The return pointer is NULL when no event is pending yet. This function + * should be called in a polling loop in the main thread. + * + * @return Event queue status: + * - true: Queue is empty + * - false: Still events in the queue + */ +GP_API Bool gpSched_EventQueueEmpty(void); + +/** + * @brief Schedules a scheduled event. + * + * Schedules an event. The event is inserted into the event queue. + * + * @param rel_time Relative execution time (delay) in us. If the delay equals 0, the function will be scheduled for immedate execution. rel_time shall not exceed GP_SCHED_EVENT_TIME_MAX. + * @param callback Callback function. + */ +GP_API void gpSched_ScheduleEvent(UInt32 rel_time, void_func callback); + +/** + * @brief Schedules a scheduled event. + * + * Schedules an event. The event is inserted into the event queue. + * + * @param rel_time Relative execution time (delay) in us. If the delay equals 0, the function will be scheduled for immedate execution. rel_time shall not exceed GP_SCHED_EVENT_TIME_MAX. + * @param callback Callback function. + * @param arg Pointer to the argument buffer. + * Limitation: Passing a NULL pointer or ((void*) 0) as @p arg will result in calling @p callback + * WITHOUT an argument: i.e. callback(); instead of callback(arg); + * If the callback were to use the argument, it will use random data from the stack. + */ +GP_API void gpSched_ScheduleEventArg(UInt32 rel_time, gpSched_EventCallback_t callback, void* arg); + +/** + * @brief Unschedule a scheduled event. + * + * Unschedules a scheduled event before its execution. The event is identified with the callback pointer + * + * @param callback Scheduled event callback. + * @return True if event was found. False if event was no longer in the queue. + */ +GP_API Bool gpSched_UnscheduleEvent(void_func callback); + +/** + * @brief Check if an event is still waiting for execution + * + * @param callback Scheduled event callback to check. + * @return True if callback is still pending. +*/ +GP_API Bool gpSched_ExistsEvent(void_func callback); +/** + * @brief Get the remaining time untill event execution + * + * @param callback Scheduled event callback to check. + * @return Time in us untill event normally executes. If event is not found 0xFFFFFFFF is returned. +*/ +GP_API UInt32 gpSched_GetRemainingTime(void_func callback); + +/** + * @brief Unschedule a scheduled event. + * + * Unschedules a scheduled event before its execution. The event is identified with the callback pointer and the + * arguments content. + * + * @param callback Scheduled event callback. + * @param arg Pointer to the the arguments used when scheduling. Use NULL to skip matching the arg pointer. + * @return True if event was found. False if event was no longer in the queue. + */ +GP_API Bool gpSched_UnscheduleEventArg(gpSched_EventCallback_t callback, void* arg); +/** + * @brief Check if an event is still waiting for execution. + * + * @param callback Scheduled event callback to check. + * @param arg Pointer to the the arguments used when scheduling. Use NULL to skip matching the arg pointer. + * @return True if callback is still pending. +*/ +GP_API Bool gpSched_ExistsEventArg(gpSched_EventCallback_t callback, void* arg); +/** + * @brief Get the remaining time untill event execution. + * + * @param callback Scheduled event callback to check. + * @param arg Pointer to the the arguments used when scheduling. Use NULL to skip matching the arg pointer. + * @return Time in us untill event normally executes. If event is not found 0xFFFFFFFF is returned. +*/ +GP_API UInt32 gpSched_GetRemainingTimeArg(gpSched_EventCallback_t callback, void* arg); + +/** + * @brief Get the remaining time untill event execution. + * The remaining time for the event can be computed from the *sec parameter and the return parameter as: (*sec * 1000000 + returnvalue) microseconds. + * + * @param callback Scheduled event callback to check. + * @param arg Pointer to the the arguments used when scheduling. Use NULL to skip matching the arg pointer. + * @param sec Pointer to a UInt32, where the remaining time in seconds will be stored. If event is not found 0xFFFFFFFF is filled in. + * @return Time in us untill event normally executes. If event is not found 0xFFFFFFFF is returned. +*/ +GP_API UInt32 gpSched_GetRemainingTimeArgInSecAndUs(gpSched_EventCallback_t callback, void* arg, UInt32* sec); + + +GP_API void gpSched_Main_Body(void); + +/** + * + * This primitive is used to schedule an event with seconds resolution. + * The gpSched_ScheduleEvent has a limit on 30 minutes, therefore this function was built to allow scheduling beyond that limit + * + * @param delayInSec Relative execution time (delay) in seconds. If the delay equals 0, the function will be scheduled for immediate execution. + * @param callback Callback function. + * @param arg Pointer to the argument buffer. +*/ +GP_API void gpSched_ScheduleEventInSeconds(UInt32 delayInSec, gpSched_EventCallback_t callback, void* arg); + +/** + * + * This primitive is used to schedule an event with seconds and microseconds resolution + * The event will be scheduled after a delay of (delayInSec * 1000000 + delayInUs) microseconds. + * + * @param delayInSec Relative execution time (delay) in seconds. + * @param delayInUs Relative execution time (delay) in microseconds. If both delay parameters equal 0, the function will be scheduled for immediate execution. + * @param callback Callback function. + * @param arg Pointer to the argument buffer. +*/ +void gpSched_ScheduleEventInSecAndUs(UInt32 delayInSec, UInt32 delayInUs, gpSched_EventCallback_t callback, void* arg); + +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + + +GP_API UInt32 gpSched_GetTimeToNextEvent(void); +GP_API UInt32 gpSched_GetGoToSleepThreshold(void); +GP_API Bool gpSched_IsSleepEnabled(void); + +/** + * @brief Function to notify gpSched task/thread when running on an OS. + * + * Will notify the thread to run again in an OS-dependent manner. + */ +void gpSched_NotifySchedTask(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 +typedef void (*gpSched_OnIdleCallback_t)(void); + +/** + * @brief Register a function that should be called when nothing is scheduled. + * This is also referred to as post processing. + * The callback should be: + * - non-blocking + * - Use the scheduler for deffered work (using gpSched_ScheduleEvent) + * + * @param callback Function that will be triggered when the scheduler(OS) is idle. +*/ +GP_API void gpSched_RegisterOnIdleCallback(gpSched_OnIdleCallback_t callback); + +/** + * @brief Execute all registered idle callback functions + * +*/ +GP_API void gpSched_PostProcessIdle(void); +#endif /* GP_SCHED_NR_OF_IDLE_CALLBACKS > 0*/ + +/** + * @brief the MAIN_FUNCTION_NAME define will be used as entry point for the gpSched scheduler + * + * When defining MAIN_FUNCTION_NAME to a certain function, another main() implementation is expected + * To start the normal gpSched operation, the MAIN_FUNCTION_NAME can be called. + * gpSched will then loop infinitely, executing any scheduled event and servicing stack functionality +*/ +#ifndef GP_SCHED_EXTERNAL_MAIN +#ifdef MAIN_FUNCTION_NAME +GP_API MAIN_FUNCTION_RETURN_TYPE MAIN_FUNCTION_NAME(void); +#else //MAIN_FUNCTION_NAME +#define MAIN_FUNCTION_NAME main +#endif //MAIN_FUNCTION_NAME +#endif // not defined GP_SCHED_EXTERNAL_MAIN + +GP_API void gpSched_Main_Init(void); + +#define GP_SCHED_GET_TIME_DIFF(earliestTs, latestTs) ((UInt32)(latestTs) - (UInt32)(earliestTs)) + + +/** + * @brief Callback to initialize gpSched task/thread when running on an OS + * + * This function should be used in the main() to register the gpSched main loop as a task within an OS (FreeRTOS/Linux/...) + * + * @return success True if creation succeeded, False if task creation/registration failed. + */ +Bool gpSched_InitTask(void); + +/** + * @brief A function that checks if an schedule event should be deferred to the context of the task + * + * @return success True if need be deffered, False if called from task without deffer. + */ +Bool gpSched_ScheduleEventDeferred(UInt32 rel_time, gpSched_EventCallback_t callback, void* arg); + +/** + * @brief A function that notifies the gpSched task to process new events. + */ +void gpSched_Trigger(void); +#ifdef __cplusplus +} +#endif + +#endif // _GPSCHED_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched.c new file mode 100644 index 0000000..0e191aa --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched.c @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2008-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpSched.c + * This file contains the implementation of the scheduler, which is the operating system. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_SCHED + +#include "gpSched.h" +#include "gpSched_defs.h" +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" + +UInt32 gpSched_GetTimeToNextEvent (void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + UInt32 timeToNextEvent = 0; + gpSched_Event_t* pevt; + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = (gpSched_Event_t*)gpUtils_LLGetFirstElem(sched_globals->gpSched_EventList_p); + if(pevt) + { + UInt32 time_now; + HAL_TIMER_GET_CURRENT_TIME_1US(time_now); + + if(GP_SCHED_TIME_COMPARE_BIGGER_EQUAL(pevt->time, time_now)) + { + timeToNextEvent = GP_SCHED_GET_TIME_DIFF(time_now, pevt->time); + } + else + { + timeToNextEvent = 0; + } + } + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + + return timeToNextEvent; +} + +UInt32 gpSched_GetGoToSleepThreshold (void) +{ + UInt32 threshold; + + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + threshold = (sched_globals->gpSched_GoToSleepTreshold); + return threshold; +} + +/* return 1 if sleep is enabled and 0 otherwise */ +Bool gpSched_IsSleepEnabled(void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + return (sched_globals->gpSched_GoToSleepDisableCounter == 0); +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c new file mode 100644 index 0000000..673a60e --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched_data.c @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2010-2013, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpSched_simple.c + * This file contains the data buffers used by the scheduler + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_SCHED + +#include "gpUtils.h" +#include "gpSched.h" +#include "gpSched_defs.h" + +#include "gpLog.h" +#include "gpAssert.h" + + +/***************************************************************************** + * Precompiler checks + *****************************************************************************/ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +//Size definitions +#ifndef GP_SCHED_EVENT_LIST_SIZE +#define GP_SCHED_EVENT_LIST_SIZE 10 +#endif + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +GP_UTILS_LL_MEMORY_DECLARATION(gpSched_Event_t, GP_SCHED_EVENT_LIST_SIZE); + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +GP_UTILS_LL_MEMORY_ALOCATION(gpSched_Event_t, gpSched_EventArray) GP_EXTRAM_SECTION_ATTR; + +gpSched_globals_t gpSched_globals; + +#if (defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2)) +gpUtils_LinkFree_t gpSched_eventLinkFree; +gpUtils_LinkList_t gpSched_eventLinkList; +#endif + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 +static gpSched_OnIdleCallback_t sched_OnIdleCallbacks[GP_SCHED_NR_OF_IDLE_CALLBACKS]; /**< Array with functions to call when the scheduler is idle */ +#endif /* GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 */ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 +void gpSched_RegisterOnIdleCallback(gpSched_OnIdleCallback_t callback) +{ + UInt32 i; + + GP_ASSERT_DEV_EXT(callback != NULL); + + for(i=0; i 0 */ + + +void gpSched_InitExtramData(void) +{ +#if (defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2)) + gpSched_globals.gpSched_EventFree_p = &gpSched_eventLinkFree; + gpSched_globals.gpSched_EventList_p = &gpSched_eventLinkList; +#endif + gpUtils_LLInit(gpSched_EventArray, GP_UTILS_LL_SIZE_OF (gpSched_Event_t) , GP_SCHED_EVENT_LIST_SIZE, gpSched_globals.gpSched_EventFree_p); + +#if defined(GP_DIVERSITY_JUMPTABLES) + gpSched_globals.AppDiversitySleep = SCHED_APP_DIVERSITY_SLEEP(); + gpSched_globals.AppDiversityCom = SCHED_APP_DIVERSITY_COM(); + gpSched_globals.AppDiversityComNoRx = SCHED_APP_DIVERSITY_COM_NO_RX(); +#endif //defined(GP_DIVERSITY_JUMPTABLES) + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 + MEMSET(sched_OnIdleCallbacks, 0, sizeof(sched_OnIdleCallbacks)); +#endif /* GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 */ + +} + + +void gpSched_SetGotoSleepCheckCallback( gpSched_GotoSleepCheckCallback_t gotoSleepCheckCallback ) +{ + NOT_USED(gotoSleepCheckCallback); + gpSched_globals.gpSched_cbGotoSleepCheck = gotoSleepCheckCallback; +} + +Bool gpSched_SetGotoSleepThreshold (UInt32 Threshold /*us*/) +{ + //This defines the minimum time between SW events required for allowing to go to sleep + gpSched_globals.gpSched_GoToSleepTreshold = Threshold; + return true; +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched_defs.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched_defs.h new file mode 100644 index 0000000..d982a03 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched_defs.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2010-2014, 2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * gpSched_defs.h + * This file holds the internal defines, typedefs,... of the gpSched component + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_SCHED_DEFS_H_ +#define _GP_SCHED_DEFS_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include "gpUtils.h" +#include "gpSched.h" + +/***************************************************************************** + * Precompiler checks + *****************************************************************************/ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_SCHED_TIME_COMPARE_BIGGER(t1,t2) (!((UInt32)(((t2) - (t1))) <= 0x80000000LU)) +#define GP_SCHED_TIME_COMPARE_BIGGER_EQUAL(t1,t2) ( ((UInt32)(((t1) - (t2))) < 0x80000000LU)) +#define GP_SCHED_TIME_COMPARE_LOWER_EQUAL(t1,t2) ( ((UInt32)(((t2) - (t1))) <= 0x80000000LU)) +#define GP_SCHED_TIME_COMPARE_LOWER(t1,t2) (!((UInt32)(((t1) - (t2))) < 0x80000000LU)) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + + +typedef union { + void_func callback; // Event to be executed without arguments + gpSched_EventCallback_t callbackarg; // Event to be executed with arguments +} gpSched_func_t; + +typedef struct gpSched_Event { + UInt32 time; // sorting key : Absolute in 1us + gpSched_func_t func; + void* arg; + UInt32 RemainderInSeconds; +} gpSched_Event_t; + +typedef struct gpSched_globals_s { + UInt8 gpSched_GoToSleepDisableCounter; + gpSched_GotoSleepCheckCallback_t gpSched_cbGotoSleepCheck; + UInt32 gpSched_GoToSleepTreshold; +#if (defined(GP_DIVERSITY_FREERTOS) || !defined(GP_DIVERSITY_JUMPTABLES) || defined(GP_DIVERSITY_ROM_GPSCHED_V2)) + gpUtils_LinkFree_t *gpSched_EventFree_p; + gpUtils_LinkList_t *gpSched_EventList_p; +#else + gpUtils_LinkFree_t gpSched_EventFree_p[1]; + gpUtils_LinkList_t gpSched_EventList_p[1]; +#endif + #if defined(GP_DIVERSITY_JUMPTABLES) + Bool AppDiversitySleep; + Bool AppDiversityCom; + Bool AppDiversityComNoRx; + #endif //defined(GP_DIVERSITY_JUMPTABLES) +} gpSched_globals_t; + +/***************************************************************************** + * External Data Definitions + *****************************************************************************/ + +//extern gpUtils_LinkFree_t gpSched_EventFree[1]; +//extern gpUtils_LinkList_t gpSched_EventList[1]; + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpJumpTables_DataTable.h" +#include "gpSched_CodeJumpTableFlash_Defs_defs.h" +#endif// defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +void gpSched_InitExtramData(void); +void Sched_Integration_Init(void); +void Sched_Integration_DeInit(void); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + // in case we are in ROM, we need to retrieve the pointer via a shim table entry +#define GP_SCHED_GET_GLOBALS() ((gpSched_globals_t*) JumpTables_DataTable.gpSched_globals_ptr) +#else // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + // in case we're not in ROM, we can directly fetch the address of the global vars. +extern gpSched_globals_t gpSched_globals; +#define GP_SCHED_GET_GLOBALS() (&gpSched_globals) +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +// When running from ROM, check run-time application diversities. + +#define SCHED_APP_DIVERSITY_SLEEP() (GP_SCHED_GET_GLOBALS()->AppDiversitySleep) +#define SCHED_APP_DIVERSITY_COM() (GP_SCHED_GET_GLOBALS()->AppDiversityCom) +#define SCHED_APP_DIVERSITY_COM_NO_RX() (GP_SCHED_GET_GLOBALS()->AppDiversityComNoRx) + +#else // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +// When running from flash, check compile-time application diversities. + +#define SCHED_APP_DIVERSITY_SLEEP() (true) + +#ifdef GP_COMP_COM +#define SCHED_APP_DIVERSITY_COM() (true) +#else +#define SCHED_APP_DIVERSITY_COM() (false) +#endif + +#define SCHED_APP_DIVERSITY_COM_NO_RX() (false) + +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +#ifdef __cplusplus +} +#endif + +#endif //_GP_SCHED_DEFS_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c new file mode 100644 index 0000000..a668954 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/gpSched_rom.c @@ -0,0 +1,835 @@ +/* + * Copyright (c) 2017-2019, Qorvo Inc + * + * gpSched.c + * This file contains the implementation of the scheduler, which is the operating system. + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_SCHED +#ifdef GP_DIVERSITY_JUMPTABLES +#define GP_DIVERSITY_ROM_CODE +#endif //def GP_DIVERSITY_JUMPTABLES + +#include "gpSched.h" +#include "gpSched_defs.h" +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#ifdef GP_COMP_COM +#include "gpCom.h" +#endif +#include "gpAssert.h" + +#include "gpWmrk.h" + +#ifdef GP_COMP_CHIPEMU +#include "gpChipEmu.h" +#endif + +#ifdef GP_DIVERSITY_JUMPTABLES +#include "gpJumpTables_DataTable.h" +#endif //def GP_DIVERSITY_JUMPTABLES + +/***************************************************************************** + * Precompiler checks + *****************************************************************************/ + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/* Macros defining hook for SCHED_MAIN_BODY patch */ +#define SCHED_MAIN_BODY(pS) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + + + +/***************************************************************************** + * External Function Prototypes + *****************************************************************************/ + + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ +#if defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) +#include "gpSched_CodeJumpTableFlash_Defs_rom_c.h" +#include "gpSched_CodeJumpTableRom_Defs_rom_c.h" +#include "gpSched_CodeJumpTableRom_Defs.h" +#endif // defined(GP_DIVERSITY_JUMPTABLES) && defined(GP_DIVERSITY_ROM_CODE) + +/* + * @brief Internal helper function to schedule an event with argument + * + * @param time relative time in us, or, in case scheduleAbsTime==true, absolute time in us + * @param scheduleAbsTime Set to true when specifying an absolute time + * @param RemainderInSeconds An additional value in seconds to be added to the time argument + */ +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_START */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_START */ +STATIC_FUNC void Sched_ScheduleEvent( UInt32 time, gpSched_EventCallback_t callback, void* arg,UInt32 RemainderInSeconds ,Bool scheduleAbsTime); +STATIC_FUNC void Sched_ScheduleEventInSeconds(UInt32 delayInSec, UInt32 delayInUs, Bool reScheduling, UInt32 delayerror, gpSched_EventCallback_t callback, void* arg); + +STATIC_FUNC gpSched_Event_t* Sched_GetEvent( void ); +STATIC_FUNC gpSched_Event_t* Sched_FindEventArg(gpUtils_LinkList_t* plst, gpSched_EventCallback_t callback, void* arg, Bool unscheduleWhenFound ); +STATIC_FUNC void Sched_RescheduleEvent (UInt32 rel_time, gpSched_Event_t * pevt); +STATIC_FUNC void Sched_RescheduleEventAbs (UInt32 time, gpSched_Event_t * pevt); +STATIC_FUNC void Sched_ReleaseEventBody(gpSched_Event_t* pevt ); + + +STATIC_FUNC UInt32 Sched_GetEventIdlePeriod(void); + + +STATIC_FUNC UInt32 Sched_GetRemainingTime(gpSched_Event_t* pevt, UInt32* sec); + +STATIC_FUNC void Sched_ExecEvent(gpSched_Event_t * pevt); +STATIC_FUNC void Sched_ReleaseEvent(gpSched_Event_t * pevt); + +/* JUMPTABLE_FLASH_FUNCTION_DEFINITIONS_END */ +/* JUMPTABLE_ROM_FUNCTION_DEFINITIONS_END */ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +void Sched_ExecEvent(gpSched_Event_t * pevt) +{ + if (pevt->arg) pevt->func.callbackarg(pevt->arg); + else pevt->func.callback(); +} + +void Sched_ReleaseEvent(gpSched_Event_t * pevt) +{ + HAL_DISABLE_GLOBAL_INT(); + Sched_ReleaseEventBody(pevt); + HAL_ENABLE_GLOBAL_INT(); +} + +void Sched_RescheduleEvent (UInt32 rel_time, gpSched_Event_t * pevt) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpUtils_LinkList_t* pList = sched_globals->gpSched_EventList_p; + gpSched_Event_t* pevt_nxt = NULL; + UInt32 now; + + GP_ASSERT_DEV_INT(pevt); //pevt pointer should be != NULL + + HAL_TIMER_GET_CURRENT_TIME_1US(now); + if (rel_time == GP_SCHED_EVENT_TIME_NOW) + { + UInt32 first_time; + + if (pList->plnk_first) + { + pevt_nxt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(pList->plnk_first); + first_time = pevt_nxt->time; + } + else + { + first_time = now; + } + pevt->time = GP_SCHED_TIME_COMPARE_LOWER_EQUAL (first_time, now)? + first_time - 1L + : + now - 1L; + } + else + { + pevt->time = now + rel_time; + } + + // You can't schedule negative times. + // This is aLready checked: GP_ASSERT_SYSTEM((rel_time <= GP_SCHED_EVENT_TIME_MAX) || (rel_time == GP_SCHED_EVENT_TIME_NOW)); + // But you also can't schedule further then GP_SCHED_EVENT_TIME_MAX from the first event in the list (else the order in the list will be wrong) + // This is especially true if the first event in the list is in the past (before 'now'). + + if(pList->plnk_first) + { + pevt_nxt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(pList->plnk_first); + + // equal mean max time event already exist + GP_ASSERT_SYSTEM(rel_time <= (pevt_nxt->time - now + GP_SCHED_EVENT_TIME_MAX)); + } + + Sched_RescheduleEventAbs (pevt->time, pevt); +} + +STATIC_FUNC void Sched_RescheduleEventAbs (UInt32 time, gpSched_Event_t * pevt) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpUtils_LinkList_t* pList = sched_globals->gpSched_EventList_p; + gpSched_Event_t* pevt_nxt = NULL; + gpUtils_Link_t* plnk = NULL; + + pevt->time = time; + + // Scroll pointer + // Insert event + // Duration : 8us per loop + { + // Search for first item, that should be executed later as the current one + // or that will be executed as last + for (plnk = pList->plnk_first; + plnk; + plnk = plnk->plnk_nxt) + { + pevt_nxt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(plnk); + if (GP_SCHED_TIME_COMPARE_BIGGER( pevt_nxt->time, pevt->time )) + { + break; + } + } + } + + if (plnk) + { + gpUtils_LLInsertBefore( pevt, pevt_nxt, pList); + } + else + { + gpUtils_LLAdd( pevt, pList ); + } + gpSched_Trigger(); +} + +void Sched_ScheduleEvent( UInt32 time, gpSched_EventCallback_t callback, void* arg,UInt32 RemainderInSeconds ,Bool scheduleAbsTime) +{ + gpSched_Event_t* pevt; + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventFree_p); + pevt = (gpSched_Event_t*)gpUtils_LLNew(sched_globals->gpSched_EventFree_p); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventFree_p); + + if (!pevt) + { + + /* Maximum number of events scheduled has been reached (maximum number of scheduled events can be changed with GP_SCHED_EVENT_LIST_SIZE) */ + GP_ASSERT_SYSTEM(false); + } + else + { + { + pevt->arg = arg; + } + pevt->func.callbackarg = callback; + pevt->RemainderInSeconds = RemainderInSeconds; + if (scheduleAbsTime) + { + Sched_RescheduleEventAbs(time, pevt); + } + else + { + Sched_RescheduleEvent( time, pevt); + } + + } +} + +void Sched_ReleaseEventBody(gpSched_Event_t* pevt ) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + // Free event (Unlink has been done by GetEvent) + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventFree_p); + gpUtils_LLFree(pevt, sched_globals->gpSched_EventFree_p); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventFree_p); +} + + + +/* +* @brief Returns time untill next event (in microseconds) compared with the gpSched_GoToSleepTreshold. +*/ +UInt32 Sched_GetEventIdlePeriod (void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + UInt32 idleTime = HAL_SLEEP_INDEFINITE_SLEEP_TIME; + + gpSched_Event_t* pevt; + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = (gpSched_Event_t*)gpUtils_LLGetFirstElem(sched_globals->gpSched_EventList_p); + if (pevt) + { + if(sched_globals->gpSched_GoToSleepTreshold == GP_SCHED_NO_EVENTS_GOTOSLEEP_THRES) //Only sleep if no events are pending + { + idleTime = 0; + } + else + { + UInt32 time_now; + HAL_TIMER_GET_CURRENT_TIME_1US(time_now); + + if(GP_SCHED_TIME_COMPARE_BIGGER(pevt->time,(time_now + sched_globals->gpSched_GoToSleepTreshold))) + { + idleTime = GP_SCHED_GET_TIME_DIFF(time_now, pevt->time); + } + else + { + idleTime = 0; + } + } + } + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + + return (idleTime); +} + + +STATIC_FUNC gpSched_Event_t* Sched_GetEvent(void) +{ + gpSched_Event_t* pevt = NULL; + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = (gpSched_Event_t*)gpUtils_LLGetFirstElem(sched_globals->gpSched_EventList_p); + if(pevt) + { + UInt32 time_now; + //Check the eventList for overdue events + HAL_TIMER_GET_CURRENT_TIME_1US(time_now); + + if (GP_SCHED_TIME_COMPARE_BIGGER_EQUAL (time_now, pevt->time)) + { + gpUtils_LLUnlink(pevt, sched_globals->gpSched_EventList_p); + } + else + { + pevt = NULL; + } + } + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + return pevt; +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpSched_Init(void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + // Inititialize event lists + gpSched_InitExtramData(); //Initialize free list and event data buffer + gpUtils_LLClear(sched_globals->gpSched_EventList_p); + + sched_globals->gpSched_GoToSleepTreshold = GP_SCHED_DEFAULT_GOTOSLEEP_THRES; + + + sched_globals->gpSched_GoToSleepDisableCounter = 0; // Enable GotoSleep by default + sched_globals->gpSched_cbGotoSleepCheck = NULL; + Sched_Integration_Init(); +} //gpSched_init + +void gpSched_DeInit(void) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpUtils_LLDeInit(sched_globals->gpSched_EventList_p); + gpUtils_LLDeInitFree(sched_globals->gpSched_EventFree_p); + + Sched_Integration_DeInit(); +} + +void gpSched_StartTimeBase( void ) +{ + //Startup sync timer + + HAL_DISABLE_GLOBAL_INT(); + + //init the timer1 + HAL_TIMER_START( 0 ); + HAL_ENABLE_GLOBAL_INT(); +} + +UInt32 gpSched_GetCurrentTime( void ) +{ + // This function should not be called from an interrupt service routine, + // since it uses atomic_on/off, and this can cause unwanted nested interrupt + // service routines; instead, HAL_TIMER_GET_CURRENT_TIME_1US() should be used in such cases + UInt32 time; + + HAL_TIMER_GET_CURRENT_TIME_1US( time ); + + return time; +} + +Bool gpSched_TimeCompareLower (UInt32 n_time1, UInt32 n_time2) +{ + return GP_SCHED_TIME_COMPARE_LOWER(n_time1,n_time2); +} + +void gpSched_Clear( void ) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + while(sched_globals->gpSched_EventList_p->plnk_last) + { + gpSched_Event_t* pevt; + + pevt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(sched_globals->gpSched_EventList_p->plnk_last); + GP_LOG_SYSTEM_PRINTF("event %p",2, pevt->func.callback); + gpUtils_LLUnlink(pevt, sched_globals->gpSched_EventList_p); + Sched_ReleaseEventBody(pevt); + } + + + sched_globals->gpSched_GoToSleepDisableCounter = 0; // Enable GotoSleep by default + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); +} + +Bool gpSched_EventQueueEmpty( void ) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + Bool Empty; + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + Empty = (!sched_globals->gpSched_EventList_p->plnk_first); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + return Empty; +} + +void gpSched_ScheduleEventArg(UInt32 rel_time, gpSched_EventCallback_t callback, void* arg) +{ + gpSched_globals_t* sched_globals; + GP_ASSERT_SYSTEM((rel_time <= GP_SCHED_EVENT_TIME_MAX) || (rel_time == GP_SCHED_EVENT_TIME_NOW)); +#ifdef GP_DIVERSITY_FREERTOS + if(gpSched_ScheduleEventDeferred(rel_time, callback, arg)) + { + return; + } +#endif + sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + + Sched_ScheduleEvent(rel_time , callback , arg, 0, false); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); +} + +void gpSched_ScheduleEvent(UInt32 rel_time, void_func callback ) +{ + gpSched_ScheduleEventArg(rel_time,(gpSched_EventCallback_t)callback, NULL); +} + +Bool gpSched_UnscheduleEventArg(gpSched_EventCallback_t callback, void* arg) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpSched_Event_t* pevt; + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = Sched_FindEventArg(sched_globals->gpSched_EventList_p, callback, arg, true); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + return pevt?true:false; +} + +Bool gpSched_ExistsEventArg(gpSched_EventCallback_t callback, void* arg) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + gpSched_Event_t* pevt; + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = Sched_FindEventArg(sched_globals->gpSched_EventList_p,callback, arg, false); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + return pevt?true:false; +} + +STATIC_FUNC UInt32 Sched_GetRemainingTime(gpSched_Event_t* pevt, UInt32* sec) +{ + UInt32 RemainderInSec = 0xffffffff; + UInt32 RemainderInUs = 0xffffffff; + + if(pevt) + { + UInt32 time_now; + HAL_TIMER_GET_CURRENT_TIME_1US(time_now); + + if(GP_SCHED_TIME_COMPARE_BIGGER_EQUAL(pevt->time, time_now)) + { + RemainderInUs = GP_SCHED_GET_TIME_DIFF(time_now, pevt->time); + } + else + { + RemainderInUs = 0; + } + RemainderInSec = pevt->RemainderInSeconds; + } + if(sec) + { + *sec = RemainderInSec; + *sec += (RemainderInUs / 1000000); + RemainderInUs = RemainderInUs % 1000000; + } + + GP_LOG_PRINTF("delta %u evt %u cb 0x%lx",10, RemainderInUs, pevt->time,(UIntPtr) pevt->func.callback); + + return RemainderInUs; +} + +UInt32 gpSched_GetRemainingTimeArg(gpSched_EventCallback_t callback, void* arg) +{ + return gpSched_GetRemainingTimeArgInSecAndUs(callback, arg, NULL); +} + +UInt32 gpSched_GetRemainingTimeArgInSecAndUs(gpSched_EventCallback_t callback, void* arg, UInt32* sec) +{ + gpSched_Event_t* pevt=NULL; + UInt32 remainingTime = 0xffffffff; + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + pevt = Sched_FindEventArg(sched_globals->gpSched_EventList_p, callback, arg, false); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + + remainingTime = Sched_GetRemainingTime(pevt, sec); + + return remainingTime; +} + +gpSched_Event_t* Sched_FindEventArg(gpUtils_LinkList_t* plst , gpSched_EventCallback_t callback, void* arg, Bool unscheduleWhenFound) +{ + gpUtils_Link_t* plnk; + for (plnk = plst->plnk_first;plnk;plnk = plnk->plnk_nxt) + { + gpSched_Event_t* pevt; + pevt = (gpSched_Event_t*)GP_UTILS_LL_GET_ELEM(plnk); + //using (arg == NULL) as wildcard + + if ((pevt->func.callbackarg == callback) && ((pevt->arg == arg) || (arg == NULL))) + { + if (unscheduleWhenFound) + { + gpUtils_LLUnlink (pevt, plst); + Sched_ReleaseEventBody(pevt); + } + return pevt; + } + } + + return NULL; +} + +Bool gpSched_UnscheduleEvent(void_func callback) +{ + return gpSched_UnscheduleEventArg((gpSched_EventCallback_t)callback, NULL); +} + +Bool gpSched_ExistsEvent(void_func callback) +{ + return gpSched_ExistsEventArg((gpSched_EventCallback_t)callback, NULL); +} + +UInt32 gpSched_GetRemainingTime(void_func callback) +{ + return gpSched_GetRemainingTimeArg((gpSched_EventCallback_t)callback,NULL); +} + +void gpSched_ScheduleEventInSeconds (UInt32 delayInSec, gpSched_EventCallback_t callback, void* arg) +{ + Sched_ScheduleEventInSeconds(delayInSec, 0, false, 0, callback, arg); +} +void gpSched_ScheduleEventInSecAndUs(UInt32 delayInSec, UInt32 delayInUs, gpSched_EventCallback_t callback, void* arg) +{ + Sched_ScheduleEventInSeconds(delayInSec, delayInUs, false, 0, callback, arg); +} + +STATIC_FUNC void Sched_ScheduleEventInSeconds(UInt32 delayInSec, UInt32 delayInUs, Bool reScheduling, UInt32 prevDeadline, gpSched_EventCallback_t callback, void* arg) +{ + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + UInt32 RemainderInUs = delayInUs % 1000000; + UInt32 RemainderInSec = delayInSec + (delayInUs / 1000000); + UInt32 NextIntervalInSec; + const Bool scheduleAbsTime = reScheduling; + + if(RemainderInSec > GP_SCHED_DISTANTEVENTS_INTERVAL) + { + NextIntervalInSec = GP_SCHED_DISTANTEVENTS_INTERVAL; + RemainderInSec -= GP_SCHED_DISTANTEVENTS_INTERVAL; + } + else + { + NextIntervalInSec = RemainderInSec; + RemainderInSec = 0; + } + + RemainderInUs += NextIntervalInSec * 1000000; + + if (reScheduling) { + RemainderInUs += prevDeadline; + } + + gpUtils_LLLockAcquire((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); + Sched_ScheduleEvent( + RemainderInUs, + callback, + arg, + RemainderInSec, + scheduleAbsTime + ); + gpUtils_LLLockRelease((gpUtils_Links_t *)sched_globals->gpSched_EventList_p); +} + + + + +/* +* @brief Returns time to sleep (in microseconds). +* Will return 0 if no sleep is permitted at this point (pending actions, idle time below threshold) +*/ +UInt32 Sched_CanGoToSleep(void) +{ + UInt32 result = 0; + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + + HAL_DISABLE_GLOBAL_INT(); + result = Sched_GetEventIdlePeriod(); + + if (sched_globals->gpSched_GoToSleepDisableCounter || + (sched_globals->gpSched_cbGotoSleepCheck && !sched_globals->gpSched_cbGotoSleepCheck())) + { +#ifdef GP_SCHED_FREE_CPU_TIME +/* Even when sleep is disabled, sleep for GP_SCHED_FREE_CPU_TIME */ + if(result > GP_SCHED_FREE_CPU_TIME) + { + result = GP_SCHED_FREE_CPU_TIME; + } +#else + result = 0; +#endif //GP_SCHED_FREE_CPU_TIME + } + +#if defined(GP_COMP_COM) && !defined(TBC_GPCOM) + if (SCHED_APP_DIVERSITY_COM() && !SCHED_APP_DIVERSITY_COM_NO_RX()) + { + //overrule if pending RX data on COM + if(gpCom_IsReceivedPacketPending()) + { + result = 0; + } + } +#endif //defined(GP_COMP_COM) && !defined(GP_COM_DIVERSITY_NO_RX) + +#if defined(GP_COMP_COM) && !defined(TBC_GPCOM) + if (SCHED_APP_DIVERSITY_COM()) + { + //overrule if pending TX data on COM + if(gpCom_TXDataPending()) + { + result = 0; + } + } +#endif //defined(GP_COMP_COM) && !defined(GP_COM_DIVERSITY_NO_RX) + + /* the radio is on a FD, so it is also checked in hal_HandleFds, except for halLinux/hal_noradio.c */ + if (hal_HandleFds(false)) + { + result = 0; + } +#if !defined(HAL_LINUX_DIVERSITY_INTERRUPT_WAKES_IOTHREAD) + //Don't go to sleep when Radio interrupt is pending + if(HAL_RADIO_INT_CHECK_IF_OCCURED()) + { + result = 0; + } +#endif + + + +// FIXME: should implement this callback also for other chipemu variants. + + HAL_ENABLE_GLOBAL_INT(); + + + return result; +} + +/* +* @brief Goes to sleep if able. Flushes com, stops timers, ... +*/ +void gpSched_GoToSleep( void ) +{ + if (SCHED_APP_DIVERSITY_SLEEP()) + { + UInt32 timeTosleep; + + timeTosleep = Sched_CanGoToSleep(); + if (timeTosleep) + { + + + HAL_DISABLE_GLOBAL_INT(); + // Disable unneeded interrupts + HAL_TIMER_STOP(); // Re-enabled by TIMER_RESTART() + + HAL_ENABLE_SLEEP_UC(); + HAL_ENABLE_GLOBAL_INT(); + + while (true) + { + timeTosleep = Sched_CanGoToSleep(); + if(timeTosleep == 0) + { + break; + } + HAL_SLEEP_UC_1US(timeTosleep); + HAL_ENABLE_SLEEP_UC(); + } + + // Restart timer of uC without initialization + // Note: if we have a HAL that supports going to sleep while an event is pending, + // we have to forward the time of the scheduler when a new event is scheduled from an ISR or + // when we wake-up to execute the pending event. + HAL_TIMER_RESTART(); + } + } +} + +void gpSched_SetGotoSleepEnable( Bool enable ) +{ +#if !defined(GP_FREERTOS_DIVERSITY_SLEEP) + if (SCHED_APP_DIVERSITY_SLEEP()) + { + gpSched_globals_t* sched_globals = GP_SCHED_GET_GLOBALS(); + //gpSched_GoToSleepEnable = enable; + HAL_DISABLE_GLOBAL_INT(); + if (enable) + { + GP_ASSERT_DEV_EXT(sched_globals->gpSched_GoToSleepDisableCounter); + sched_globals->gpSched_GoToSleepDisableCounter--; + } + else + { + sched_globals->gpSched_GoToSleepDisableCounter++; + } + HAL_ENABLE_GLOBAL_INT(); + } +#else // GP_SCHED_DIVERSITY_SLEEP + NOT_USED(enable); +#endif // GP_SCHED_DIVERSITY_SLEEP +} + + +/***************************************************************************** + * Main function + *****************************************************************************/ + +void gpSched_Main_Body(void) +{ + gpSched_Event_t* pevt; + + + + // Check stack before event (after coming from sleep) + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); + + GP_ASSERT_DEV_EXT(HAL_GLOBAL_INT_ENABLED()); + + HAL_WDT_RESET(); + + /* service radio before hal_HandleFds */ + // Handle radio interrupts +#if !defined(HAL_LINUX_DIVERSITY_INTERRUPT_WAKES_IOTHREAD) + HAL_RADIO_INT_EXEC_IF_OCCURED(); +#endif + GP_UTILS_CPUMON_PROCDONE(RADIO_INT); + /* the radio will be serviced again if possible, since it is in the list of FD's! */ + (void)hal_HandleFds(true); + +#if defined(GP_COMP_COM) && !defined(TBC_GPCOM) + if (SCHED_APP_DIVERSITY_COM()) + { + // Handle non-interrupt driven actions from gpCom + gpCom_HandleTx(); + if (!SCHED_APP_DIVERSITY_COM_NO_RX()) + { + gpCom_HandleRx(); + } + GP_UTILS_CPUMON_PROCDONE(GPCOMTXRX); + } +#endif //GP_COMP_COM + + // Handle events + pevt = Sched_GetEvent(); + SCHED_MAIN_BODY( pevt ); + if (pevt) // get event + { + GP_ASSERT_DEV_EXT(HAL_GLOBAL_INT_ENABLED()); + //GP_LOG_SYSTEM_PRINTF("sched: %08lx",0, pevt->func.callback); + if (pevt->RemainderInSeconds) { + Sched_ScheduleEventInSeconds(pevt->RemainderInSeconds, 0, true, pevt->time, pevt->func.callbackarg, pevt->arg); + } else + { + Sched_ExecEvent(pevt); + } + + // check stack after event + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); + + if (!HAL_GLOBAL_INT_ENABLED()) + { + GP_LOG_PRINTF("AtomF %p",2,pevt->func.callback); + GP_ASSERT_DEV_EXT(HAL_GLOBAL_INT_ENABLED()); + } + Sched_ReleaseEvent(pevt); // release event + // check stack after event release + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); + GP_UTILS_CHECK_STACK_USAGE(); + } + GP_UTILS_CPUMON_PROCDONE(SCHEDEVENT); + +#ifdef GP_COMP_CHIPEMU + gpChipEmu_RunEmu(); +#endif // GP_COMP_CHIPEMU + + GP_ASSERT_DEV_EXT(HAL_GLOBAL_INT_ENABLED()); +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c new file mode 100644 index 0000000..43f972a --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpSched/src/integration/linux/gpSched_il.c @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + */ + +/** + * @file gpSched_il.c + * @brief GP Scheduler integration layer implementation + * + * This file implements the for gpSched integration layer interface APIs + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_SCHED + +#include "hal.h" +#include "gpLog.h" +#include "gpUtils.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpSched_defs.h" + +/***************************************************************************** + * External Function Prototypes + *****************************************************************************/ + +extern void Application_Init( void ); +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +#ifndef GP_SCHED_EXTERNAL_MAIN +void gpSched_Main_Init(void) +{ + HAL_INITIALIZE_GLOBAL_INT(); + + // Hardware initialization + HAL_INIT(); + + // Radio interrupts that occur will only be handled later on in the main loop + // Other interrupt source do not trigger any calls to blocks that are not initialized yet + HAL_ENABLE_GLOBAL_INT(); + + Application_Init(); + + GP_UTILS_DUMP_STACK_POINTER(); + GP_UTILS_CHECK_STACK_PATTERN(); + GP_UTILS_CHECK_STACK_POINTER(); +} +#endif + +#ifndef GP_SCHED_EXTERNAL_MAIN +MAIN_FUNCTION_RETURN_TYPE MAIN_FUNCTION_NAME(void) +{ + //the line below destroys the stack. so don't call it from a function! + GP_UTILS_INIT_STACK(); + gpSched_Main_Init(); + GP_UTILS_CPUMON_INIT(); + for (;;) + { + GP_UTILS_CPUMON_NEW_SCHEDULER_LOOP(); + /* The scheduler task flag serves to notice events scheduled + * asynchronously, we clear it now to avoid dropping out of sleep + * immediately since CanGoToSleep will consider these events created up + * until now. */ + hal_ClearWakeUpEvent(); + // Check if the system can go to sleep + gpSched_GoToSleep(); + gpSched_Main_Body(); + +#if GP_SCHED_NR_OF_IDLE_CALLBACKS > 0 + /* When new work can be indicated to an external stack/scheduler at many locations in our stack it is + * easier and less error-prone to service that stack here than at all these different code locations. + * Continuously rescheduling a handler event is not a good alternative because this prohibits sleeping. */ + /* Call all registered post processing callbacks*/ + gpSched_PostProcessIdle(); + GP_UTILS_CPUMON_PROCDONE(POSTPROCESSING); +#endif /* GP_SCHED_NR_OF_IDLE_CALLBACKS > 0*/ + } + + return MAIN_FUNCTION_RETURN_VALUE; +} +#endif + + +/* + * @brief Wake up a sleeping scheduler thread + * + * This function can used to wake up a sleeping scheduler thread. + */ +void gpSched_NotifySchedTask(void) +{ + hal_WakeEventloop(); +} + +void Sched_Integration_Init(void) +{ +} + +void Sched_Integration_DeInit(void) +{ +} + +void gpSched_Trigger(void) +{ + hal_WakeEventloop(); +} diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_clientServerCmdId.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_clientServerCmdId.h new file mode 100644 index 0000000..e6b34e0 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_clientServerCmdId.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpVersion_clientServerCmdId.h" + * + * GPVERSION + * + * Client Server Link Command IDs +*/ + +#ifndef _GPVERSION_CLIENTSERVERCMDID_H_ +#define _GPVERSION_CLIENTSERVERCMDID_H_ + +/***************************************************************************** + * Common timeout + *****************************************************************************/ + +#ifndef GPVERSION_GPCOMTIMEOUT_US +#define GPVERSION_GPCOMTIMEOUT_US 10000000UL //10s +#endif //GPVERSION_GPCOMTIMEOUT_US + +/***************************************************************************** + * Component Specific Command IDs + *****************************************************************************/ + +#define Version_ExchangeGlobalVersion_CmdId 0x02 /*02*/ +#define Version_NegotiateModuleVersion_CmdId 0x03 /*03*/ + +/***************************************************************************** + * Fixed Command IDs + *****************************************************************************/ + +#define gpVersion_Acknowledge_CmdId 0xfe /*254*/ +#define gpVersion_GetServerCompatibilityNumber_CmdId 0xfd /*253*/ + +#endif //_GPVERSION_CLIENTSERVERCMDID_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_marshalling.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_marshalling.h new file mode 100644 index 0000000..559c47f --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/inc/gen/gpVersion_marshalling.h @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +#ifndef _GPVERSION_MARSHALLING_H_ +#define _GPVERSION_MARSHALLING_H_ + +//DOCUMENTATION VERSION: no @file required as all documented items are refered to a group + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include +#include "gpVersion.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef struct { + gpVersion_ReleaseInfo_t data[1]; +} gpVersion_ReleaseInfo_t_l1_pointer_marshall_t; + +typedef struct { + gpVersion_ReleaseInfo_t data[6]; +} gpVersion_ReleaseInfo_t_l6_pointer_marshall_t; + + +typedef struct { + gpVersion_SoftwareInfo_t data[1]; +} gpVersion_SoftwareInfo_t_l1_pointer_marshall_t; + + + +typedef struct { + gpVersion_ReleaseInfo_t clientInfo; +} Version_ExchangeGlobalVersion_Input_struct_t; + +typedef struct { + Version_ExchangeGlobalVersion_Input_struct_t data; + gpVersion_ReleaseInfo_t_l1_pointer_marshall_t clientInfo; +} Version_ExchangeGlobalVersion_Input_marshall_struct_t; + +typedef struct { + gpVersion_VersionStatusResult_t result; + gpVersion_ReleaseInfo_t* serverInfo; +} Version_ExchangeGlobalVersion_Output_struct_t; + +typedef struct { + Version_ExchangeGlobalVersion_Output_struct_t data; + gpVersion_ReleaseInfo_t_l1_pointer_marshall_t serverInfo; +} Version_ExchangeGlobalVersion_Output_marshall_struct_t; + + +typedef struct { + UInt8 moduleId; + UInt8 nrOfClientVersions; + gpVersion_ReleaseInfo_t* pClientVersions; +} Version_NegotiateModuleVersion_Input_struct_t; + +typedef struct { + Version_NegotiateModuleVersion_Input_struct_t data; + gpVersion_ReleaseInfo_t_l6_pointer_marshall_t pClientVersions; +} Version_NegotiateModuleVersion_Input_marshall_struct_t; + +typedef struct { + gpVersion_VersionStatusResult_t result; + gpVersion_ReleaseInfo_t* serverInfo; +} Version_NegotiateModuleVersion_Output_struct_t; + +typedef struct { + Version_NegotiateModuleVersion_Output_struct_t data; + gpVersion_ReleaseInfo_t_l1_pointer_marshall_t serverInfo; +} Version_NegotiateModuleVersion_Output_marshall_struct_t; + + +typedef struct { + gpVersion_VersionStatusResult_t result; +} gpVersion_ExchangeCompatibility_Output_struct_t; + +typedef struct { + gpVersion_ExchangeCompatibility_Output_struct_t data; +} gpVersion_ExchangeCompatibility_Output_marshall_struct_t; + + + +typedef union { + Version_ExchangeGlobalVersion_Input_marshall_struct_t Version_ExchangeGlobalVersion; + Version_NegotiateModuleVersion_Input_marshall_struct_t Version_NegotiateModuleVersion; + UInt8 dummy; //ensure none empty union definition +} gpVersion_Server_Input_union_t; + +typedef union { + Version_ExchangeGlobalVersion_Output_marshall_struct_t Version_ExchangeGlobalVersion; + Version_NegotiateModuleVersion_Output_marshall_struct_t Version_NegotiateModuleVersion; + gpVersion_ExchangeCompatibility_Output_marshall_struct_t gpVersion_ExchangeCompatibility; + UInt8 dummy; //ensure none empty union definition +} gpVersion_Server_Output_union_t; +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Alias/enum copy macro's +#define gpVersion_VersionNumber_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpVersion_VersionNumber_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpVersion_VersionNumber_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpVersion_VersionNumber_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) +#define gpVersion_VersionStatusResult_t_buf2api(pDest, pSource, length, pIndex) UInt8_buf2api(pDest, pSource, length, pIndex) +#define gpVersion_VersionStatusResult_t_api2buf(pDest, pSource, length, pIndex) UInt8_api2buf(pDest, pSource, length, pIndex) +#define gpVersion_VersionStatusResult_t_buf2api_1(pDest, pSource, pIndex) UInt8_buf2api_1(pDest, pSource, pIndex) +#define gpVersion_VersionStatusResult_t_api2buf_1(pDest, pSource, pIndex) UInt8_api2buf_1(pDest, pSource, pIndex) + +// Structure copy functions +gpMarshall_AckStatus_t gpVersion_ReleaseInfo_t_buf2api(gpVersion_ReleaseInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpVersion_ReleaseInfo_t_api2buf(UInt8Buffer* pDest , const gpVersion_ReleaseInfo_t* pSource , UInt16 length , UInt16* pIndex); +gpMarshall_AckStatus_t gpVersion_SoftwareInfo_t_buf2api(gpVersion_SoftwareInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ); +void gpVersion_SoftwareInfo_t_api2buf(UInt8Buffer* pDest , const gpVersion_SoftwareInfo_t* pSource , UInt16 length , UInt16* pIndex); +// Server functions +gpMarshall_AckStatus_t Version_ExchangeGlobalVersion_Input_buf2api(Version_ExchangeGlobalVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void Version_ExchangeGlobalVersion_Output_api2buf(UInt8Buffer* pDest , Version_ExchangeGlobalVersion_Output_marshall_struct_t* pSourceoutput , Version_ExchangeGlobalVersion_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +gpMarshall_AckStatus_t Version_NegotiateModuleVersion_Input_buf2api(Version_NegotiateModuleVersion_Input_marshall_struct_t* pDest , UInt8Buffer* pSource , UInt16* pIndex); +void Version_NegotiateModuleVersion_Output_api2buf(UInt8Buffer* pDest , Version_NegotiateModuleVersion_Output_marshall_struct_t* pSourceoutput , Version_NegotiateModuleVersion_Input_marshall_struct_t* pSourceinput , UInt16* pIndex); +void gpVersion_ExchangeCompatibility_Output_api2buf(UInt8Buffer* pDest , gpVersion_ExchangeCompatibility_Output_marshall_struct_t* pSourceoutput , UInt16* pIndex); + +// Client functions +void Version_ExchangeGlobalVersion_Input_par2buf(UInt8Buffer* pDest , gpVersion_ReleaseInfo_t clientInfo , UInt16* pIndex); +void Version_ExchangeGlobalVersion_Output_buf2par(gpVersion_VersionStatusResult_t* result , gpVersion_ReleaseInfo_t clientInfo , gpVersion_ReleaseInfo_t* serverInfo , UInt8Buffer* pSource , UInt16* pIndex); +void Version_NegotiateModuleVersion_Input_par2buf(UInt8Buffer* pDest , UInt8 moduleId , UInt8 nrOfClientVersions , gpVersion_ReleaseInfo_t* pClientVersions , UInt16* pIndex); +void Version_NegotiateModuleVersion_Output_buf2par(gpVersion_VersionStatusResult_t* result , UInt8 moduleId , UInt8 nrOfClientVersions , gpVersion_ReleaseInfo_t* pClientVersions , gpVersion_ReleaseInfo_t* serverInfo , UInt8Buffer* pSource , UInt16* pIndex); +void gpVersion_ExchangeCompatibility_Output_buf2par(gpVersion_VersionStatusResult_t* result , UInt8Buffer* pSource , UInt16* pIndex); + +void gpVersion_InitMarshalling(void); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _GPVERSION_MARSHALLING_H_ + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/inc/gpVersion.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/inc/gpVersion.h new file mode 100644 index 0000000..ee74795 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/inc/gpVersion.h @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2013-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +#ifndef _GP_VERSION_H_ +#define _GP_VERSION_H_ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +#include + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#ifndef GP_DIVERSITY_NR_OF_STACKS +#define GP_DIVERSITY_NR_OF_STACKS 1 +#endif //GP_DIVERSITY_NR_OF_STACKS + +#define GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE (8*GP_DIVERSITY_NR_OF_STACKS) +#define GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE 6 + +#define GP_VERSION_VERSION_FLATTEN(v) (((UInt32)((v).major) << 24) | ((UInt32)((v).minor) << 16) | ((UInt32)((v).revision) << 8) | ((v).patch)) +#define GP_VERSION_VERSIONS_EQUAL(v1, v2) ((v1).major == (v2).major && (v1).minor == (v2).minor && (v1).revision == (v2).revision && (v1).patch == (v2).patch) +#define GP_VERSION_VERSIONS_SMALLER(v1, v2) (GP_VERSION_VERSION_FLATTEN(v1) < GP_VERSION_VERSION_FLATTEN(v2)) +#define GP_VERSION_VERSIONS_GREATER(v1, v2) (GP_VERSION_VERSION_FLATTEN(v1) > GP_VERSION_VERSION_FLATTEN(v2)) + +#define GP_VERSION_MODULE_ID_INVALID 0xFF +#define GP_VERSION_VERSION_INDEX_INVALID 0xFF + +#define GP_VERSION_MAKE_VERSION_STRING_FROM_PARTS(major,minor,revision,patch,cl) \ + #major "." #minor "." #revision "." #patch " - CL" #cl +#define GP_VERSION_MAKE_VERSION_STRING(version,cl) GP_VERSION_MAKE_VERSION_STRING_FROM_PARTS(version,cl) +#define GP_VERSION_STRING GP_VERSION_MAKE_VERSION_STRING(GP_VERSIONINFO_GLOBAL_VERSION,GP_CHANGELIST) + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +#define gpVersion_CompatibilityResultCompatible 0 +#define gpVersion_CompatibilityResultMaybeCompatible 1 +#define gpVersion_CompatibilityResultNotCompatible 2 +#define gpVersion_CompatibilityResultInvalidParameter 0xFF +typedef UInt8 gpVersion_VersionStatusResult_t; + +typedef UInt8 gpVersion_VersionNumber_t; + +// defines release version +typedef struct { + gpVersion_VersionNumber_t major; + gpVersion_VersionNumber_t minor; + gpVersion_VersionNumber_t revision; + gpVersion_VersionNumber_t patch; +} gpVersion_ReleaseInfo_t; + +// defines software information +typedef struct { + gpVersion_ReleaseInfo_t version; + UInt8 ctrl; + UInt8 reserved; + UInt16 number; + UInt32 changeList; +} gpVersion_SoftwareInfo_t; + +typedef struct { + gpVersion_ReleaseInfo_t versions[GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE]; +} gpVersion_ModuleVersions_t; + +// callback structure for all modules +typedef struct { + UInt32 commId; + UInt8 moduleId; + UInt8 nrOfVersions; + UInt8 selectedVersionIndex; + gpVersion_ReleaseInfo_t versionInfo[GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE]; +} gpVersion_ModuleVersionInfo_t; + +// callback type for wrappers +typedef void (*gpVersion_cbSetModuleVersion_t)(gpVersion_ModuleVersionInfo_t* moduleVersionInfo); + +// structure that contains all useful module information +typedef struct { + gpVersion_ModuleVersionInfo_t moduleVersionInfo; + gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion; +} gpVersion_ModuleInfo_t; + +typedef struct { + UInt32 commId; + UInt8 moduleId; + gpVersion_ReleaseInfo_t version; +} gpVersion_ClientVersionMapping_t; + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +void gpVersion_Init(void); + +/** @brief Return the compile-time application version number. + * @param[out] swVersion Buffer to hold version number. + */ +void gpVersion_GetSoftwareVersion(gpVersion_ReleaseInfo_t* swVersion); + +/** @brief Return software information, including application version number and changelist number. + * @param[out] swInfo Buffer to hold software information. + */ +void gpVersion_GetSoftwareInfo(gpVersion_SoftwareInfo_t* swInfo); + +/** @brief Return the compile-time BaseComps version number. + * @param[out] pVersion Buffer to hold version number. + */ +void gpVersion_GetBaseCompsVersion(gpVersion_ReleaseInfo_t* pVersion); + +// for backward compatibility +#define gpVersion_GetBcVersion gpVersion_GetBaseCompsVersion + +/** @brief Return the compile-time Components/Qorvo/BleController version number. + * @param[out] pVersion Buffer to hold version number. + */ +void gpVersion_GetBleControllerVersion(gpVersion_ReleaseInfo_t* pVersion); + + + + +/** @brief Function to fetch NRT ROM version + * @return ROM version number. Returns 0xFF when no valid ROM is found. Returns 0 if no ROM code is used. + */ +UInt8 gpVersion_GetNrtRomVersion(void); + +/** @brief Function to get minimal Matter ROM version needed + * @return ROM version number. Returns 0 if no Matter ROM code is used. + */ +UInt8 gpVersion_GetMinimalMatterRomVersion(void); + +/** @brief Function to fetch Matter ROM version + * @return ROM version number. Returns 0xFF when no valid ROM is found. Returns 0 if no Matter ROM code is used. + */ +UInt8 gpVersion_GetMatterRomVersion(void); + +UInt32 gpVersion_GetChangelist(void); + +/** @brief Register a module to the version administration. + * + * This function is only available in client/server applications. + * It should be called for each module used accross the client/server barrier. + * This function is typically called by the clientwrapper/serverwrapper code + * of the corresponding module. + * + * @param moduleId GP_MODULE_ID of the module to be registered + * @param versions Array of API versions supported for this module, preferred version first. + * @param nrOfVersions Number of valid array elements in @a versions + * @param cbSetModuleApiVersion Function to be called when an API version is selected + */ +void gpVersion_RegisterModule(UInt8 moduleId, gpVersion_ReleaseInfo_t* versions, UInt8 nrOfVersions, gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion); + +/** @brief De-register a module to the version administration. + * + * This function is only available in client/server applications. + * It should be called for each module used accross the client/server barrier. + * This function is typically called by the clientwrapper/serverwrapper code + * of the corresponding module. + * + * @param moduleId GP_MODULE_ID of the module to be de-registered + */ +void gpVersion_DeRegisterModule(UInt8 moduleId); + + +/* Dump Functions */ +void gpVersion_DumpVersion(gpVersion_ReleaseInfo_t swVersion); +void gpVersion_DumpModuleMapping(void); + + +/** @brief Exchange version numbers and negotiate API compatibility between client and server. + * + * This function is only available in client applications. + * It should be called once at the start of the application, as early as + * possible after component initialization. + * + * @return gpVersion_CompatibilityResultCompatible if all modules are compatible with the server API + * @return gpVersion_CompatibilityResultNotCompatible if some modules are incompatible with the server API +*/ +gpVersion_VersionStatusResult_t gpVersion_ExchangeCompatibility(void); + +/** @brief Return server version number. + * + * This function is only available in client applications. + * It may be called after gpVersion_ExchangeCompatibility to obtain the + * server application version number. + * + * @param[out] serverVersion Buffer to hold version number. + */ +void gpVersion_GetServerVersion(gpVersion_ReleaseInfo_t* serverVersion); + +//for backward compatibility - prefered to use gpVersion_ExchangeCompatibility() +gpVersion_VersionStatusResult_t gpVersion_ExchangeGlobalVersion(gpVersion_ReleaseInfo_t clientInfo, gpVersion_ReleaseInfo_t* serverInfo); + + +#ifdef __cplusplus +} +#endif + +#endif // _GP_VERSION_H_ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c new file mode 100644 index 0000000..ff44f39 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling.c @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpVersion_marshalling.c" + * + * GPVERSION + * + * Marshalling structures and functions. +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpVersion.h" +#include "gpVersion_marshalling.h" + +#ifdef GP_DIVERSITY_LOG +#include "gpLog.h" +#endif + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +gpMarshall_AckStatus_t gpVersion_ReleaseInfo_t_buf2api(gpVersion_ReleaseInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpVersion_VersionNumber_t_buf2api_1(&(pDest->major), pSource, pIndex); + gpVersion_VersionNumber_t_buf2api_1(&(pDest->minor), pSource, pIndex); + gpVersion_VersionNumber_t_buf2api_1(&(pDest->revision), pSource, pIndex); + gpVersion_VersionNumber_t_buf2api_1(&(pDest->patch), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpVersion_ReleaseInfo_t_api2buf(UInt8Buffer* pDest , const gpVersion_ReleaseInfo_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpVersion_VersionNumber_t_api2buf_1(pDest , &(pSource->major), pIndex); + gpVersion_VersionNumber_t_api2buf_1(pDest , &(pSource->minor), pIndex); + gpVersion_VersionNumber_t_api2buf_1(pDest , &(pSource->revision), pIndex); + gpVersion_VersionNumber_t_api2buf_1(pDest , &(pSource->patch), pIndex); + pSource++; + } +} + +gpMarshall_AckStatus_t gpVersion_SoftwareInfo_t_buf2api(gpVersion_SoftwareInfo_t* pDest , UInt8Buffer* pSource , UInt16 length , UInt16* pIndex ) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpVersion_ReleaseInfo_t_buf2api(&(pDest->version), pSource, 1, pIndex); + UInt8_buf2api_1(&(pDest->ctrl), pSource, pIndex); + UInt8_buf2api_1(&(pDest->reserved), pSource, pIndex); + UInt16_buf2api_1(&(pDest->number), pSource, pIndex); + UInt32_buf2api_1(&(pDest->changeList), pSource, pIndex); + pDest++; + } + return gpMarshall_AckStatusSuccess; +} + +void gpVersion_SoftwareInfo_t_api2buf(UInt8Buffer* pDest , const gpVersion_SoftwareInfo_t* pSource , UInt16 length , UInt16* pIndex) +{ + UIntLoop i; + for(i = 0; i < length; i++) + { + gpVersion_ReleaseInfo_t_api2buf(pDest , &(pSource->version), 1, pIndex); + UInt8_api2buf_1(pDest , &(pSource->ctrl), pIndex); + UInt8_api2buf_1(pDest , &(pSource->reserved), pIndex); + UInt16_api2buf_1(pDest , &(pSource->number), pIndex); + UInt32_api2buf_1(pDest , &(pSource->changeList), pIndex); + pSource++; + } +} + + +void gpVersion_InitMarshalling(void) +{ +} + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c new file mode 100644 index 0000000..8154624 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_marshalling_client.c @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2018, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpVersion_marshalling_client.c" + * + * GPVERSION + * + * Marshalling structures and functions +*/ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ + +// General includes +#include "gpVersion.h" +#include "gpVersion_marshalling.h" + +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + + /***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + /***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void Version_ExchangeGlobalVersion_Input_par2buf(UInt8Buffer* pDest , gpVersion_ReleaseInfo_t clientInfo , UInt16* pIndex) +{ + gpVersion_ReleaseInfo_t_api2buf(pDest, &(clientInfo), 1, pIndex); +} + +void Version_ExchangeGlobalVersion_Output_buf2par(gpVersion_VersionStatusResult_t* result , gpVersion_ReleaseInfo_t clientInfo , gpVersion_ReleaseInfo_t* serverInfo , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpVersion_VersionStatusResult_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(clientInfo); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpVersion_ReleaseInfo_t_buf2api(serverInfo , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } +} + +void Version_NegotiateModuleVersion_Input_par2buf(UInt8Buffer* pDest , UInt8 moduleId , UInt8 nrOfClientVersions , gpVersion_ReleaseInfo_t* pClientVersions , UInt16* pIndex) +{ + UInt8_api2buf_1(pDest, &(moduleId), pIndex); + UInt8_api2buf_1(pDest, &(nrOfClientVersions), pIndex); + pDest[(*pIndex)++] = (NULL == pClientVersions); + if (NULL != pClientVersions) + { + gpVersion_ReleaseInfo_t_api2buf(pDest, pClientVersions, nrOfClientVersions, pIndex); + } +} + +void Version_NegotiateModuleVersion_Output_buf2par(gpVersion_VersionStatusResult_t* result , UInt8 moduleId , UInt8 nrOfClientVersions , gpVersion_ReleaseInfo_t* pClientVersions , gpVersion_ReleaseInfo_t* serverInfo , UInt8Buffer* pSource , UInt16* pIndex) +{ + gpVersion_VersionStatusResult_t_buf2api(result, pSource, 1, pIndex); + NOT_USED(moduleId); + NOT_USED(nrOfClientVersions); + NOT_USED(pClientVersions); + // no NULL byte check for output buffers if (0x0 == pSource[(*pIndex)++]) // Check null byte + { + gpMarshall_AckStatus_t marshall_result = gpVersion_ReleaseInfo_t_buf2api(serverInfo , pSource , 1 , pIndex); + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == marshall_result); + } +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c new file mode 100644 index 0000000..42e1c3d --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gen/gpVersion_wrapper_client.c @@ -0,0 +1,277 @@ +/* + * Copyright (c) 2015-2016, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + */ + +/** @file "gpVersion_wrapper_client.c" + * + * GPVERSION + * + * Wrapper implementation +*/ + +/***************************************************************************** + * Includes Definition + *****************************************************************************/ + +#include "hal.h" +#include "gpUtils.h" +#include "gpLog.h" +#include "gpAssert.h" +#include "gpSched.h" +#include "gpCom.h" +#include "gpModule.h" +#include "gpVersion_clientServerCmdId.h" +#include "gpVersion.h" +#include "gpVersion_marshalling.h" +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +#include "gpVersion.h" +#endif +/* AdditionalIncludes */ +#include "gpVersion_defs.h" +/* AdditionalIncludes */ + +/***************************************************************************** + * Typedef Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Functions Declaration + *****************************************************************************/ + +static void gpVersion_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId); +static void Version_HandleConnectionClose(gpCom_CommunicationId_t communicationId); + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ + +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION +#define GP_MODULE_ID GP_COMPONENT_ID + + +#ifndef GP_VERSION_COMM_ID +#define GP_VERSION_COMM_ID GP_COM_DEFAULT_COMMUNICATION_ID +#endif + +#define REGISTER_MODULE(handle) GP_COM_REGISTER_MODULE(handle) +#define DATA_REQUEST(len,buf,commId) GP_COM_DATA_REQUEST(len,buf,commId) +#define DATA_REQUEST_ACKED(len,buf,commId) gpCom_DataRequestAndWaitForAck(GP_MODULE_ID, len, buf, commId, &gpVersion_reqAcked, GPVERSION_GPCOMTIMEOUT_US, gpVersion_Acknowledge_CmdId) + +/* AdditionalMacros */ +#define gpVersion_ResultInvalidParameter gpVersion_CompatibilityResultInvalidParameter +/* AdditionalMacros */ +/***************************************************************************** + * Static Data + *****************************************************************************/ + +typedef union ackDataNeeded { + UInt8 dataBuf0[(1 + 1 + 1 + 1)+1]; +} ackDataNeeded_t; +static UInt8 gpVersion_ackBuffer[1 + 1 + 1 + sizeof(ackDataNeeded_t)]; +static Bool gpVersion_reqAcked; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +static Bool Version_clientApiVersionSelected = false; +#endif + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +static void Version_HandleConnectionClose(gpCom_CommunicationId_t communicationId) +{ +} + +static void gpVersion_HandleIndicationClient(UInt16 length, UInt8* pPayload, gpCom_CommunicationId_t communicationId) +{ +#define commandId pPayload[0] + UInt8 ackBuffer[1 + 1 + 1]; + UInt8 ackBytes = 0; /*No ack's on indication - fill in length when needed - 3+x */ + + if(pPayload == NULL) + { + Version_HandleConnectionClose(communicationId); + return; + } + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Version_clientApiVersionSelected); +#endif + + ackBuffer[0] = gpVersion_Acknowledge_CmdId; + ackBuffer[1] = gpMarshall_AckStatusSuccess; + ackBuffer[2] = commandId; + + switch(commandId) + { + + case gpVersion_Acknowledge_CmdId: + { + GP_ASSERT_SYSTEM(length <= sizeof(gpVersion_ackBuffer)); + MEMCPY(gpVersion_ackBuffer, pPayload, length); + gpVersion_reqAcked = true; + return; + } + default: + { + GP_ASSERT_DEV_INT(false); + break; + } + } +#undef commandId + if(0 < ackBytes) + { + DATA_REQUEST(ackBytes, ackBuffer, communicationId); + } +} +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) +void gpVersion_SetDefaultApiVersion(gpVersion_ModuleVersionInfo_t* moduleVersionInfo) +{ + Version_clientApiVersionSelected = true; + //TBD +} +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + + +void gpVersion_DeInit(void) +{ +/* DeInit */ + Version_Init(); + Version_InitClient(); +/* DeInit */ + + gpCom_DeRegisterModule(GP_MODULE_ID); +} + +void gpVersion_Init(void) +{ +/* Init */ + Version_Init(); + Version_InitClient(); +/* Init */ + + gpVersion_InitMarshalling(); + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + gpVersion_ReleaseInfo_t versions[1] = {{2,0,0,0}}; + Version_clientApiVersionSelected = false; + gpVersion_RegisterModule(GP_MODULE_ID, versions,1,gpVersion_SetDefaultApiVersion); +#endif //defined(GP_VERSION_DIVERSITY_GPCOM_CLIENT) && !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) + REGISTER_MODULE(gpVersion_HandleIndicationClient); +} + +/***************************************************************************** + * gpVersion Require Functions + *****************************************************************************/ + +gpVersion_VersionStatusResult_t Version_ExchangeGlobalVersion(gpVersion_ReleaseInfo_t clientInfo, gpVersion_ReleaseInfo_t* serverInfo) +{ + UInt16 _index = 1; + gpVersion_VersionStatusResult_t result; + UInt8 dataBuf[1 + (1 + 1 + 1 + 1)]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Version_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = Version_ExchangeGlobalVersion_CmdId; + + Version_ExchangeGlobalVersion_Input_par2buf(dataBuf + , clientInfo + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_VERSION_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpVersion_ackBuffer[1]); + GP_ASSERT_SYSTEM(Version_ExchangeGlobalVersion_CmdId == gpVersion_ackBuffer[2]); + + _index = 3; + Version_ExchangeGlobalVersion_Output_buf2par( + &result + , clientInfo + , serverInfo + , gpVersion_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpVersion_ackBuffer)); + +#undef commandId + return result; +} + +gpVersion_VersionStatusResult_t Version_NegotiateModuleVersion(UInt8 moduleId, UInt8 nrOfClientVersions, gpVersion_ReleaseInfo_t* pClientVersions, gpVersion_ReleaseInfo_t* serverInfo) +{ + UInt16 _index = 1; + gpVersion_VersionStatusResult_t result; + UInt8 dataBuf[1 + 1 + 1 + 1 + 6*(1 + 1 + 1 + 1)]; + +#if !defined(GP_VERSION_DIVERSITY_NO_MODULE_VERSION) && GP_COMPONENT_ID != GP_COMPONENT_ID_VERSION + GP_ASSERT_DEV_EXT(Version_clientApiVersionSelected); +#endif + +#define commandId dataBuf[0] + + commandId = Version_NegotiateModuleVersion_CmdId; + + Version_NegotiateModuleVersion_Input_par2buf(dataBuf + , moduleId + , nrOfClientVersions + , pClientVersions + , &_index); + + GP_ASSERT_SYSTEM(_index <= sizeof(dataBuf)); + DATA_REQUEST_ACKED(_index, dataBuf, GP_VERSION_COMM_ID); + + GP_ASSERT_SYSTEM(gpMarshall_AckStatusSuccess == gpVersion_ackBuffer[1]); + GP_ASSERT_SYSTEM(Version_NegotiateModuleVersion_CmdId == gpVersion_ackBuffer[2]); + + _index = 3; + Version_NegotiateModuleVersion_Output_buf2par( + &result + , moduleId + , nrOfClientVersions + , pClientVersions + , serverInfo + , gpVersion_ackBuffer + , &_index); + GP_ASSERT_SYSTEM(_index <= sizeof(gpVersion_ackBuffer)); + +#undef commandId + return result; +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c new file mode 100644 index 0000000..6177264 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_clientAdministration.c @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2014-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +//#define GP_LOCAL_LOG + +#include "gpAssert.h" +#include "gpVersion.h" +#include "gpLog.h" +#include "gpVersion_defs.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +static Bool Version_ExchangeDone; +static gpVersion_ReleaseInfo_t Version_ServerAppVersion; + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void Version_InitClient(void) +{ + Version_ExchangeDone = false; + MEMSET(&Version_ServerAppVersion, -1, sizeof(Version_ServerAppVersion)); +} + +static gpVersion_VersionStatusResult_t Version_ExchangeModuleCompatibility(UInt8 moduleIndex) +{ + gpVersion_VersionStatusResult_t moduleResult; + gpVersion_ReleaseInfo_t apiVersion; + + GP_ASSERT_DEV_EXT(moduleIndex < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE); + + moduleResult = Version_NegotiateModuleVersion(Version_ModuleMapping[moduleIndex].moduleVersionInfo.moduleId, + Version_ModuleMapping[moduleIndex].moduleVersionInfo.nrOfVersions, + Version_ModuleMapping[moduleIndex].moduleVersionInfo.versionInfo, + &apiVersion); + + GP_LOG_PRINTF("Mod 0x%x r%i v%i.%i.%i.%i", 0, + Version_ModuleMapping[moduleIndex].moduleVersionInfo.moduleId, + moduleResult, + apiVersion.major, + apiVersion.minor, + apiVersion.revision, + apiVersion.patch); + + if (moduleResult == gpVersion_CompatibilityResultCompatible) + { + Version_UpdateModuleVersion(&(Version_ModuleMapping[moduleIndex]), apiVersion, 0xFFFFFFFF); + } + + return moduleResult; +} + +gpVersion_VersionStatusResult_t gpVersion_ExchangeCompatibility(void) +{ + gpVersion_ReleaseInfo_t ownSwVersion; + gpVersion_VersionStatusResult_t appsCompatibilityResult; + UIntLoop i; + + // Exchange application version number with the server. + gpVersion_GetSoftwareVersion(&ownSwVersion); + + GP_LOG_PRINTF("Client v%i.%i.%i.%i", 0, + ownSwVersion.major, + ownSwVersion.minor, + ownSwVersion.revision, + ownSwVersion.patch); + + appsCompatibilityResult = Version_ExchangeGlobalVersion(ownSwVersion, &Version_ServerAppVersion); + + GP_LOG_PRINTF("Server r%i v%i.%i.%i.%i", 0, + appsCompatibilityResult, + Version_ServerAppVersion.major, + Version_ServerAppVersion.minor, + Version_ServerAppVersion.revision, + Version_ServerAppVersion.patch); + + if (appsCompatibilityResult == gpVersion_CompatibilityResultMaybeCompatible) + { + // Assume compatible. Each registered module API version will be checked anyway. + appsCompatibilityResult = gpVersion_CompatibilityResultCompatible; + } + + // Consider each registered module. + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + // only check valid API's + if(Version_ModuleMapping[i].moduleVersionInfo.moduleId != GP_VERSION_MODULE_ID_INVALID) + { + gpVersion_VersionStatusResult_t moduleResult; + + // Negotiate the API version of this module with the server. + // This is necessary even when the application version numbers match; + // application version number does not guarantee component APIs. + moduleResult = Version_ExchangeModuleCompatibility(i); + + if (moduleResult != gpVersion_CompatibilityResultCompatible) + { + appsCompatibilityResult = gpVersion_CompatibilityResultNotCompatible; + GP_LOG_SYSTEM_PRINTF("Warning: non matching API for module: %x. Communication not possible!", 0, Version_ModuleMapping[i].moduleVersionInfo.moduleId); + } + } + } + + if (appsCompatibilityResult != gpVersion_CompatibilityResultCompatible) + { + gpVersion_DumpModuleMapping(); + } + + Version_ExchangeDone = true; + return appsCompatibilityResult; +} + +void gpVersion_GetServerVersion(gpVersion_ReleaseInfo_t* serverVersion) +{ + GP_ASSERT_DEV_EXT(Version_ExchangeDone); + *serverVersion = Version_ServerAppVersion; +} + +gpVersion_VersionStatusResult_t gpVersion_ExchangeGlobalVersion(gpVersion_ReleaseInfo_t clientInfo, gpVersion_ReleaseInfo_t* serverInfo) +{ + gpVersion_VersionStatusResult_t appsCompatibilityResult; + + appsCompatibilityResult = gpVersion_ExchangeCompatibility(); + gpVersion_GetServerVersion(serverInfo); + + return appsCompatibilityResult; +} + +void gpVersion_RegisterModule(UInt8 moduleId, gpVersion_ReleaseInfo_t* versions, UInt8 nrOfVersions, gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion) +{ + GP_LOG_PRINTF("gpVersion_RegisterModule %d", 0, moduleId); + Version_RegisterModule_Common(moduleId, versions, nrOfVersions, cbSetModuleApiVersion); + + if (Version_ExchangeDone) + { + // Initial version exchange has already happened. + // Negotiate the API version of this module immediately after it gets registered. + UIntLoop i; + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + if (Version_ModuleMapping[i].moduleVersionInfo.moduleId == moduleId) + { + gpVersion_VersionStatusResult_t moduleResult = Version_ExchangeModuleCompatibility(i); + + if (moduleResult != gpVersion_CompatibilityResultCompatible) + { + GP_LOG_SYSTEM_PRINTF("Warning: non matching API for module: %x. Communication not possible!", 0, Version_ModuleMapping[i].moduleVersionInfo.moduleId); + GP_ASSERT_DEV_EXT(false); + } + + return; + } + } + + GP_ASSERT_DEV_EXT(false); // module just registered but not in module table + } +} + +void gpVersion_DeRegisterModule(UInt8 moduleId) +{ + GP_LOG_PRINTF("gpVersion_DeRegisterModule %d", 0, moduleId); + Version_DeRegisterModule_Common(moduleId); +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_defs.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_defs.h new file mode 100644 index 0000000..dee253a --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_defs.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2014-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "gpVersion.h" +#ifdef GP_COMP_COM +#include "gpCom.h" +#endif //GP_COMP_COM + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +extern gpVersion_ModuleInfo_t Version_ModuleMapping[GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE]; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void Version_Init(void); +void Version_UpdateModuleVersion(gpVersion_ModuleInfo_t* moduleInfo, gpVersion_ReleaseInfo_t apiVersion, UInt32 commId); +void Version_RegisterModule_Common(UInt8 moduleId, gpVersion_ReleaseInfo_t* versions, UInt8 nrOfVersions, gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion); +void Version_DeRegisterModule_Common(UInt8 moduleId); +#ifdef GP_COMP_COM +void Version_ConnectionClose(UInt8 moduleId, gpCom_CommunicationId_t communicationId); +#endif + +void Version_InitClient(void); +gpVersion_VersionStatusResult_t Version_ExchangeGlobalVersion(gpVersion_ReleaseInfo_t clientInfo, gpVersion_ReleaseInfo_t* serverInfo); +gpVersion_VersionStatusResult_t Version_NegotiateModuleVersion(UInt8 moduleId, UInt8 nrOfClientVersions, gpVersion_ReleaseInfo_t* clientVersions, gpVersion_ReleaseInfo_t* serverInfo); + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c new file mode 100644 index 0000000..0f2c364 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_moduleAdministration.c @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2014-2016, GreenPeak Technologies + * Copyright (c) 2017, 2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "gpVersion.h" +#include "gpVersion_defs.h" +#include "gpLog.h" +#include "gpAssert.h" + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION + +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +gpVersion_ModuleInfo_t Version_ModuleMapping[GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE]; + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ +void Version_Init(void) +{ + MEMSET(Version_ModuleMapping, -1, sizeof(gpVersion_ModuleInfo_t)*GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE); +} + +void Version_UpdateModuleVersion(gpVersion_ModuleInfo_t* moduleInfo, gpVersion_ReleaseInfo_t apiVersion, UInt32 commId) +{ + UIntLoop i; + + GP_ASSERT_DEV_EXT(moduleInfo->moduleVersionInfo.nrOfVersions <= GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE); + + moduleInfo->moduleVersionInfo.commId = commId; + moduleInfo->moduleVersionInfo.selectedVersionIndex = GP_VERSION_VERSION_INDEX_INVALID; + for (i = 0; i < moduleInfo->moduleVersionInfo.nrOfVersions; i++) + { + if (GP_VERSION_VERSIONS_EQUAL(moduleInfo->moduleVersionInfo.versionInfo[i], apiVersion)) + { + moduleInfo->moduleVersionInfo.selectedVersionIndex = i; + break; + } + } + + GP_ASSERT_DEV_EXT(moduleInfo->moduleVersionInfo.selectedVersionIndex < moduleInfo->moduleVersionInfo.nrOfVersions); + + if (moduleInfo->cbSetModuleApiVersion) + { + moduleInfo->cbSetModuleApiVersion(&(moduleInfo->moduleVersionInfo)); + } +} + +void gpVersion_DumpModuleMapping(void) +{ + UIntLoop i,j; + + GP_LOG_SYSTEM_PRINTF("Module Mapping...",0); + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + if(Version_ModuleMapping[i].moduleVersionInfo.moduleId != 0xFF) + { + GP_LOG_SYSTEM_PRINTF("Module: %x sel=%i", 0, + Version_ModuleMapping[i].moduleVersionInfo.moduleId, + Version_ModuleMapping[i].moduleVersionInfo.selectedVersionIndex); + for(j=0; j < Version_ModuleMapping[i].moduleVersionInfo.nrOfVersions; j++) + { + gpVersion_DumpVersion(Version_ModuleMapping[i].moduleVersionInfo.versionInfo[j]); + } + } + } + GP_LOG_SYSTEM_PRINTF("End of module list",0); +} + +void Version_RegisterModule_Common(UInt8 moduleId, gpVersion_ReleaseInfo_t* versions, UInt8 nrOfVersions, gpVersion_cbSetModuleVersion_t cbSetModuleApiVersion) +{ + UIntLoop i; + + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + if(Version_ModuleMapping[i].moduleVersionInfo.moduleId == 0xFF) + { + Version_ModuleMapping[i].moduleVersionInfo.moduleId = moduleId; + Version_ModuleMapping[i].moduleVersionInfo.nrOfVersions = nrOfVersions; + Version_ModuleMapping[i].cbSetModuleApiVersion = cbSetModuleApiVersion; + GP_ASSERT_SYSTEM(nrOfVersions <= GP_DIVERSITY_VERSION_MAX_VERSIONS_SIZE); + MEMCPY(&Version_ModuleMapping[i].moduleVersionInfo.versionInfo, &versions[0], sizeof(gpVersion_ReleaseInfo_t)*nrOfVersions); + return; + } + } + GP_ASSERT_DEV_EXT(false); // table is full +} + +void Version_DeRegisterModule_Common(UInt8 moduleId) +{ + UIntLoop i; + + for(i = 0; i < GP_DIVERSITY_VERSION_MAX_MODULE_TABLE_SIZE; i++) + { + if(Version_ModuleMapping[i].moduleVersionInfo.moduleId == moduleId) + { + Version_ModuleMapping[i].moduleVersionInfo.moduleId = 0xFF; + } + } +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c new file mode 100644 index 0000000..8304ebd --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/Qorvo/OS/gpVersion/src/gpVersion_versionInfo.c @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2014, GreenPeak Technologies + * Copyright (c) 2017-2019, Qorvo Inc + * + * + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + * Alternatively, this software may be distributed under the terms of the + * modified BSD License or the 3-clause BSD License as published by the Free + * Software Foundation @ https://directory.fsf.org/wiki/License:BSD-3-Clause + * + * $Header$ + * $Change$ + * $DateTime$ + * + */ + +/***************************************************************************** + * Includes Definitions + *****************************************************************************/ +#include "gpVersion.h" +#include "gpVersion_defs.h" +#include "gpLog.h" + + +#ifdef GP_DIVERSITY_JUMPTABLES +#include "gpJumpTables.h" +#endif // GP_DIVERSITY_JUMPTABLES +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER +#include "gpJumpTablesMatter.h" +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + +/***************************************************************************** + * Macro Definitions + *****************************************************************************/ +#define GP_COMPONENT_ID GP_COMPONENT_ID_VERSION +/***************************************************************************** + * Functional Macro Definitions + *****************************************************************************/ + +/***************************************************************************** + * Type Definitions + *****************************************************************************/ + +/***************************************************************************** + * Static Function Prototypes + *****************************************************************************/ + +/***************************************************************************** + * Static Data Definitions + *****************************************************************************/ + + +// changelist is 3 bytes and LSB is reserved +static const ROM gpVersion_SoftwareInfo_t FLASH_PROGMEM gpVersionSw LINKER_SECTION(".version_sw") + = {{GP_VERSIONINFO_GLOBAL_VERSION},0x00,0,0,((0x00FFFFFFUL & GP_CHANGELIST)<<8)}; +static const ROM gpVersion_ReleaseInfo_t FLASH_PROGMEM gpVersionBaseComps = {GP_VERSIONINFO_BASE_COMPS}; +static const ROM gpVersion_ReleaseInfo_t FLASH_PROGMEM gpVersionBleController = {GP_VERSIONINFO_BLE_COMPS}; + +/***************************************************************************** + * External Data Definition + *****************************************************************************/ + +/***************************************************************************** + * Static Function Definitions + *****************************************************************************/ + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void gpVersion_GetSoftwareVersion(gpVersion_ReleaseInfo_t* swVersion) +{ + MEMCPY_P(swVersion, &(gpVersionSw.version), sizeof(gpVersion_ReleaseInfo_t)); +} + + +void gpVersion_GetSoftwareInfo(gpVersion_SoftwareInfo_t* swInfo) +{ + MEMCPY_P(swInfo, &gpVersionSw, sizeof(gpVersion_SoftwareInfo_t)); + +} + +void gpVersion_GetBaseCompsVersion(gpVersion_ReleaseInfo_t* pVersion) +{ + MEMCPY_P(pVersion, &gpVersionBaseComps, sizeof(gpVersion_ReleaseInfo_t)); +} + +void gpVersion_GetBleControllerVersion(gpVersion_ReleaseInfo_t* pVersion) +{ + MEMCPY_P(pVersion, &gpVersionBleController, sizeof(gpVersion_ReleaseInfo_t)); +} + + + +UInt8 gpVersion_GetNrtRomVersion(void) +{ + UInt8 nrtRomVersion = 0; + +#ifdef GP_DIVERSITY_JUMPTABLES + nrtRomVersion = gpJumpTables_GetRomVersionFromRom(); +#endif //GP_DIVERSITY_JUMPTABLES + + return nrtRomVersion; +} + +UInt8 gpVersion_GetMinimalMatterRomVersion(void) +{ + UInt8 minMatterRomVersion = 0; + +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER + minMatterRomVersion = GPJUMPTABLESMATTER_MIN_ROMVERSION; +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + + return minMatterRomVersion; +} + +UInt8 gpVersion_GetMatterRomVersion(void) +{ + UInt8 matterRomVersion = 0; + +#ifdef GP_DIVERSITY_ROMUSAGE_FOR_MATTER + matterRomVersion = gpJumpTablesMatter_GetVersion(); +#endif //GP_DIVERSITY_ROMUSAGE_FOR_MATTER + + return matterRomVersion; +} + +UInt32 gpVersion_GetChangelist(void) +{ + return GP_CHANGELIST; +} + +void gpVersion_DumpVersion(gpVersion_ReleaseInfo_t swVersion) +{ + GP_LOG_SYSTEM_PRINTF("Version is: v%i.%i.%i.%i",0, swVersion.major, swVersion.minor, swVersion.revision, swVersion.patch); +} + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms/utils/uart.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms/utils/uart.h new file mode 100644 index 0000000..6366dfe --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms/utils/uart.h @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes the platform abstraction for UART communication. + */ + +#ifndef OPENTHREAD_PLATFORM_UART_H_ +#define OPENTHREAD_PLATFORM_UART_H_ + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-uart + * + * @brief + * This module includes the platform abstraction for UART communication. + * + * @{ + * + */ + +/** + * Enable the UART. + * + * @retval OT_ERROR_NONE Successfully enabled the UART. + * @retval OT_ERROR_FAILED Failed to enabled the UART. + * + */ +otError otPlatUartEnable(void); + +/** + * Disable the UART. + * + * @retval OT_ERROR_NONE Successfully disabled the UART. + * @retval OT_ERROR_FAILED Failed to disable the UART. + * + */ +otError otPlatUartDisable(void); + +/** + * Send bytes over the UART. + * + * @param[in] aBuf A pointer to the data buffer. + * @param[in] aBufLength Number of bytes to transmit. + * + * @retval OT_ERROR_NONE Successfully started transmission. + * @retval OT_ERROR_FAILED Failed to start the transmission. + * + */ +otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength); + +/** + * Flush the outgoing transmit buffer and wait for the data to be sent. + * This is called when the CLI UART interface has a full buffer but still + * wishes to send more data. + * + * @retval OT_ERROR_NONE Flush succeeded, we can proceed to write more + * data to the buffer. + * + * @retval OT_ERROR_NOT_IMPLEMENTED Driver does not support synchronous flush. + * @retval OT_ERROR_INVALID_STATE Driver has no data to flush. + */ +otError otPlatUartFlush(void); + +/** + * The UART driver calls this method to notify OpenThread that the requested bytes have been sent. + * + */ +extern void otPlatUartSendDone(void); + +/** + * The UART driver calls this method to notify OpenThread that bytes have been received. + * + * @param[in] aBuf A pointer to the received bytes. + * @param[in] aBufLength The number of bytes received. + * + */ +extern void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_UART_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/config.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/config.h new file mode 100644 index 0000000..090532c --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/config.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes required defines config header. + */ + +#ifndef OPENTHREAD_CONFIG_H_ +#define OPENTHREAD_CONFIG_H_ + +/** + * @def OPENTHREAD_CONFIG_FILE + * + * The OpenThread feature configuration file. + * + */ +#if defined(OPENTHREAD_CONFIG_FILE) +#include OPENTHREAD_CONFIG_FILE +#endif + +#endif // OPENTHREAD_CONFIG_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/error.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/error.h new file mode 100644 index 0000000..66cb3c5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/error.h @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file defines the errors used in the OpenThread. + */ + +#ifndef OPENTHREAD_ERROR_H_ +#define OPENTHREAD_ERROR_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup api-error + * + * @brief + * This module includes error definitions used in OpenThread. + * + * @{ + * + */ + +/** + * This enumeration represents error codes used throughout OpenThread. + * + */ +typedef enum OT_MUST_USE_RESULT otError +{ + /** + * No error. + */ + OT_ERROR_NONE = 0, + + /** + * Operational failed. + */ + OT_ERROR_FAILED = 1, + + /** + * Message was dropped. + */ + OT_ERROR_DROP = 2, + + /** + * Insufficient buffers. + */ + OT_ERROR_NO_BUFS = 3, + + /** + * No route available. + */ + OT_ERROR_NO_ROUTE = 4, + + /** + * Service is busy and could not service the operation. + */ + OT_ERROR_BUSY = 5, + + /** + * Failed to parse message. + */ + OT_ERROR_PARSE = 6, + + /** + * Input arguments are invalid. + */ + OT_ERROR_INVALID_ARGS = 7, + + /** + * Security checks failed. + */ + OT_ERROR_SECURITY = 8, + + /** + * Address resolution requires an address query operation. + */ + OT_ERROR_ADDRESS_QUERY = 9, + + /** + * Address is not in the source match table. + */ + OT_ERROR_NO_ADDRESS = 10, + + /** + * Operation was aborted. + */ + OT_ERROR_ABORT = 11, + + /** + * Function or method is not implemented. + */ + OT_ERROR_NOT_IMPLEMENTED = 12, + + /** + * Cannot complete due to invalid state. + */ + OT_ERROR_INVALID_STATE = 13, + + /** + * No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006). + */ + OT_ERROR_NO_ACK = 14, + + /** + * A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed + * (IEEE 802.15.4-2006). + */ + OT_ERROR_CHANNEL_ACCESS_FAILURE = 15, + + /** + * Not currently attached to a Thread Partition. + */ + OT_ERROR_DETACHED = 16, + + /** + * FCS check failure while receiving. + */ + OT_ERROR_FCS = 17, + + /** + * No frame received. + */ + OT_ERROR_NO_FRAME_RECEIVED = 18, + + /** + * Received a frame from an unknown neighbor. + */ + OT_ERROR_UNKNOWN_NEIGHBOR = 19, + + /** + * Received a frame from an invalid source address. + */ + OT_ERROR_INVALID_SOURCE_ADDRESS = 20, + + /** + * Received a frame filtered by the address filter (allowlisted or denylisted). + */ + OT_ERROR_ADDRESS_FILTERED = 21, + + /** + * Received a frame filtered by the destination address check. + */ + OT_ERROR_DESTINATION_ADDRESS_FILTERED = 22, + + /** + * The requested item could not be found. + */ + OT_ERROR_NOT_FOUND = 23, + + /** + * The operation is already in progress. + */ + OT_ERROR_ALREADY = 24, + + /** + * The creation of IPv6 address failed. + */ + OT_ERROR_IP6_ADDRESS_CREATION_FAILURE = 26, + + /** + * Operation prevented by mode flags + */ + OT_ERROR_NOT_CAPABLE = 27, + + /** + * Coap response or acknowledgment or DNS, SNTP response not received. + */ + OT_ERROR_RESPONSE_TIMEOUT = 28, + + /** + * Received a duplicated frame. + */ + OT_ERROR_DUPLICATED = 29, + + /** + * Message is being dropped from reassembly list due to timeout. + */ + OT_ERROR_REASSEMBLY_TIMEOUT = 30, + + /** + * Message is not a TMF Message. + */ + OT_ERROR_NOT_TMF = 31, + + /** + * Received a non-lowpan data frame. + */ + OT_ERROR_NOT_LOWPAN_DATA_FRAME = 32, + + /** + * The link margin was too low. + */ + OT_ERROR_LINK_MARGIN_LOW = 34, + + /** + * Input (CLI) command is invalid. + */ + OT_ERROR_INVALID_COMMAND = 35, + + /** + * Special error code used to indicate success/error status is pending and not yet known. + * + */ + OT_ERROR_PENDING = 36, + + /** + * Request rejected. + */ + OT_ERROR_REJECTED = 37, + + /** + * The number of defined errors. + */ + OT_NUM_ERRORS, + + /** + * Generic error (should not use). + */ + OT_ERROR_GENERIC = 255, +} otError; + +/** + * This function converts an otError enum into a string. + * + * @param[in] aError An otError enum. + * + * @returns A string representation of an otError. + * + */ +const char *otThreadErrorToString(otError aError); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_ERROR_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/instance.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/instance.h new file mode 100644 index 0000000..5eee72d --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/instance.h @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file defines the OpenThread Instance API. + */ + +#ifndef OPENTHREAD_INSTANCE_H_ +#define OPENTHREAD_INSTANCE_H_ + +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The OpenThread API monotonic version number. + * + * This number MUST increase by one each time the contents of public OpenThread API include headers change. + * + * @note This number versions both OpenThread platform and user APIs. + * + */ +#define OPENTHREAD_API_VERSION (238) + +/** + * @addtogroup api-instance + * + * @brief + * This module includes functions that control the OpenThread Instance. + * + * @{ + * + */ + +/** + * This structure represents the OpenThread instance structure. + */ +typedef struct otInstance otInstance; + +/** + * This function initializes the OpenThread library. + * + * This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be + * called before any other calls to OpenThread. + * + * This function is available and can only be used when support for multiple OpenThread instances is enabled. + * + * @param[in] aInstanceBuffer The buffer for OpenThread to use for allocating the otInstance structure. + * @param[in,out] aInstanceBufferSize On input, the size of aInstanceBuffer. On output, if not enough space for + * otInstance, the number of bytes required for otInstance. + * + * @returns A pointer to the new OpenThread instance. + * + * @sa otInstanceFinalize + * + */ +otInstance *otInstanceInit(void *aInstanceBuffer, size_t *aInstanceBufferSize); + +/** + * This function initializes the static single instance of the OpenThread library. + * + * This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be + * called before any other calls to OpenThread. + * + * This function is available and can only be used when support for multiple OpenThread instances is disabled. + * + * @returns A pointer to the single OpenThread instance. + * + */ +otInstance *otInstanceInitSingle(void); + +/** + * This function indicates whether or not the instance is valid/initialized. + * + * The instance is considered valid if it is acquired and initialized using either `otInstanceInitSingle()` (in single + * instance case) or `otInstanceInit()` (in multi instance case). A subsequent call to `otInstanceFinalize()` causes + * the instance to be considered as uninitialized. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns TRUE if the given instance is valid/initialized, FALSE otherwise. + * + */ +bool otInstanceIsInitialized(otInstance *aInstance); + +/** + * This function disables the OpenThread library. + * + * Call this function when OpenThread is no longer in use. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + */ +void otInstanceFinalize(otInstance *aInstance); + +/** + * This function returns the current instance uptime (in msec). + * + * This function requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled. + * + * The uptime is given as number of milliseconds since OpenThread instance was initialized. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The uptime (number of milliseconds). + * + */ +uint64_t otInstanceGetUptime(otInstance *aInstance); + +#define OT_UPTIME_STRING_SIZE 24 ///< Recommended size for string representation of uptime. + +/** + * This function returns the current instance uptime as a human-readable string. + * + * This function requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled. + * + * The string follows the format "::." for hours, minutes, seconds and millisecond (if uptime is + * shorter than one day) or "
d.::." (if longer than a day). + * + * If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated + * but the outputted string is always null-terminated. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[out] aBuffer A pointer to a char array to output the string. + * @param[in] aSize The size of @p aBuffer (in bytes). Recommended to use `OT_UPTIME_STRING_SIZE`. + * + */ +void otInstanceGetUptimeAsString(otInstance *aInstance, char *aBuffer, uint16_t aSize); + +/** + * This enumeration defines flags that are passed as part of `otStateChangedCallback`. + * + */ +enum +{ + OT_CHANGED_IP6_ADDRESS_ADDED = 1 << 0, ///< IPv6 address was added + OT_CHANGED_IP6_ADDRESS_REMOVED = 1 << 1, ///< IPv6 address was removed + OT_CHANGED_THREAD_ROLE = 1 << 2, ///< Role (disabled, detached, child, router, leader) changed + OT_CHANGED_THREAD_LL_ADDR = 1 << 3, ///< The link-local address changed + OT_CHANGED_THREAD_ML_ADDR = 1 << 4, ///< The mesh-local address changed + OT_CHANGED_THREAD_RLOC_ADDED = 1 << 5, ///< RLOC was added + OT_CHANGED_THREAD_RLOC_REMOVED = 1 << 6, ///< RLOC was removed + OT_CHANGED_THREAD_PARTITION_ID = 1 << 7, ///< Partition ID changed + OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER = 1 << 8, ///< Thread Key Sequence changed + OT_CHANGED_THREAD_NETDATA = 1 << 9, ///< Thread Network Data changed + OT_CHANGED_THREAD_CHILD_ADDED = 1 << 10, ///< Child was added + OT_CHANGED_THREAD_CHILD_REMOVED = 1 << 11, ///< Child was removed + OT_CHANGED_IP6_MULTICAST_SUBSCRIBED = 1 << 12, ///< Subscribed to a IPv6 multicast address + OT_CHANGED_IP6_MULTICAST_UNSUBSCRIBED = 1 << 13, ///< Unsubscribed from a IPv6 multicast address + OT_CHANGED_THREAD_CHANNEL = 1 << 14, ///< Thread network channel changed + OT_CHANGED_THREAD_PANID = 1 << 15, ///< Thread network PAN Id changed + OT_CHANGED_THREAD_NETWORK_NAME = 1 << 16, ///< Thread network name changed + OT_CHANGED_THREAD_EXT_PANID = 1 << 17, ///< Thread network extended PAN ID changed + OT_CHANGED_NETWORK_KEY = 1 << 18, ///< Network key changed + OT_CHANGED_PSKC = 1 << 19, ///< PSKc changed + OT_CHANGED_SECURITY_POLICY = 1 << 20, ///< Security Policy changed + OT_CHANGED_CHANNEL_MANAGER_NEW_CHANNEL = 1 << 21, ///< Channel Manager new pending Thread channel changed + OT_CHANGED_SUPPORTED_CHANNEL_MASK = 1 << 22, ///< Supported channel mask changed + OT_CHANGED_COMMISSIONER_STATE = 1 << 23, ///< Commissioner state changed + OT_CHANGED_THREAD_NETIF_STATE = 1 << 24, ///< Thread network interface state changed + OT_CHANGED_THREAD_BACKBONE_ROUTER_STATE = 1 << 25, ///< Backbone Router state changed + OT_CHANGED_THREAD_BACKBONE_ROUTER_LOCAL = 1 << 26, ///< Local Backbone Router configuration changed + OT_CHANGED_JOINER_STATE = 1 << 27, ///< Joiner state changed + OT_CHANGED_ACTIVE_DATASET = 1 << 28, ///< Active Operational Dataset changed + OT_CHANGED_PENDING_DATASET = 1 << 29, ///< Pending Operational Dataset changed +}; + +/** + * This type represents a bit-field indicating specific state/configuration that has changed. See `OT_CHANGED_*` + * definitions. + * + */ +typedef uint32_t otChangedFlags; + +/** + * This function pointer is called to notify certain configuration or state changes within OpenThread. + * + * @param[in] aFlags A bit-field indicating specific state that has changed. See `OT_CHANGED_*` definitions. + * @param[in] aContext A pointer to application-specific context. + * + */ +typedef void (*otStateChangedCallback)(otChangedFlags aFlags, void *aContext); + +/** + * This function registers a callback to indicate when certain configuration or state changes within OpenThread. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aCallback A pointer to a function that is called with certain configuration or state changes. + * @param[in] aContext A pointer to application-specific context. + * + * @retval OT_ERROR_NONE Added the callback to the list of callbacks. + * @retval OT_ERROR_ALREADY The callback was already registered. + * @retval OT_ERROR_NO_BUFS Could not add the callback due to resource constraints. + * + */ +otError otSetStateChangedCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aContext); + +/** + * This function removes a callback to indicate when certain configuration or state changes within OpenThread. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aCallback A pointer to a function that is called with certain configuration or state changes. + * @param[in] aContext A pointer to application-specific context. + * + */ +void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aContext); + +/** + * This method triggers a platform reset. + * + * The reset process ensures that all the OpenThread state/info (stored in volatile memory) is erased. Note that the + * `otPlatformReset` does not erase any persistent state/info saved in non-volatile memory. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + */ +void otInstanceReset(otInstance *aInstance); + +/** + * Deletes all the settings stored on non-volatile memory, and then triggers a platform reset. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + */ +void otInstanceFactoryReset(otInstance *aInstance); + +/** + * This method resets the internal states of the OpenThread radio stack. + * + * Callbacks and configurations are preserved. + * + * This API is only available under radio builds (`OPENTHREAD_RADIO = 1`). + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + */ +void otInstanceResetRadioStack(otInstance *aInstance); + +/** + * This function erases all the OpenThread persistent info (network settings) stored on non-volatile memory. + * Erase is successful only if the device is in `disabled` state/role. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @retval OT_ERROR_NONE All persistent info/state was erased successfully. + * @retval OT_ERROR_INVALID_STATE Device is not in `disabled` state/role. + * + */ +otError otInstanceErasePersistentInfo(otInstance *aInstance); + +/** + * This function gets the OpenThread version string. + * + * @returns A pointer to the OpenThread version. + * + */ +const char *otGetVersionString(void); + +/** + * This function gets the OpenThread radio version string. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns A pointer to the OpenThread radio version. + * + */ +const char *otGetRadioVersionString(otInstance *aInstance); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_INSTANCE_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/crypto.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/crypto.h new file mode 100644 index 0000000..7cadc8e --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/crypto.h @@ -0,0 +1,500 @@ +/* + * Copyright (c) 2021, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes the platform abstraction for Crypto operations. + */ + +#ifndef OPENTHREAD_PLATFORM_CRYPTO_H_ +#define OPENTHREAD_PLATFORM_CRYPTO_H_ + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-crypto + * + * @brief + * This module includes the platform abstraction for Crypto. + * + * @{ + * + */ + +/** + * This enumeration defines the key types. + * + */ +typedef enum +{ + OT_CRYPTO_KEY_TYPE_RAW, ///< Key Type: Raw Data. + OT_CRYPTO_KEY_TYPE_AES, ///< Key Type: AES. + OT_CRYPTO_KEY_TYPE_HMAC, ///< Key Type: HMAC. +} otCryptoKeyType; + +/** + * This enumeration defines the key algorithms. + * + */ +typedef enum +{ + OT_CRYPTO_KEY_ALG_VENDOR, ///< Key Algorithm: Vendor Defined. + OT_CRYPTO_KEY_ALG_AES_ECB, ///< Key Algorithm: AES ECB. + OT_CRYPTO_KEY_ALG_HMAC_SHA_256, ///< Key Algorithm: HMAC SHA-256. +} otCryptoKeyAlgorithm; + +/** + * This enumeration defines the key usage flags. + * + */ +enum +{ + OT_CRYPTO_KEY_USAGE_NONE = 0, ///< Key Usage: Key Usage is empty. + OT_CRYPTO_KEY_USAGE_EXPORT = 1 << 0, ///< Key Usage: Key can be exported. + OT_CRYPTO_KEY_USAGE_ENCRYPT = 1 << 1, ///< Key Usage: Encryption (vendor defined). + OT_CRYPTO_KEY_USAGE_DECRYPT = 1 << 2, ///< Key Usage: AES ECB. + OT_CRYPTO_KEY_USAGE_SIGN_HASH = 1 << 3, ///< Key Usage: HMAC SHA-256. +}; + +/** + * This enumeration defines the key storage types. + * + */ +typedef enum +{ + OT_CRYPTO_KEY_STORAGE_VOLATILE, ///< Key Persistence: Key is volatile. + OT_CRYPTO_KEY_STORAGE_PERSISTENT, ///< Key Persistence: Key is persistent. +} otCryptoKeyStorage; + +/** + * This datatype represents the key reference. + * + */ +typedef uint32_t otCryptoKeyRef; + +/** + * @struct otCryptoKey + * + * This structure represents the Key Material required for Crypto operations. + * + */ +typedef struct otCryptoKey +{ + const uint8_t *mKey; ///< Pointer to the buffer containing key. NULL indicates to use `mKeyRef`. + uint16_t mKeyLength; ///< The key length in bytes (applicable when `mKey` is not NULL). + uint32_t mKeyRef; ///< The PSA key ref (requires `mKey` to be NULL). +} otCryptoKey; + +/** + * @struct otCryptoContext + * + * This structure stores the context object for platform APIs. + * + */ +typedef struct otCryptoContext +{ + void * mContext; ///< Pointer to the context. + uint16_t mContextSize; ///< The length of the context in bytes. +} otCryptoContext; + +/** + * Initialize the Crypto module. + * + */ +void otPlatCryptoInit(void); + +/** + * Import a key into PSA ITS. + * + * @param[in,out] aKeyRef Pointer to the key ref to be used for crypto operations. + * @param[in] aKeyType Key Type encoding for the key. + * @param[in] aKeyAlgorithm Key algorithm encoding for the key. + * @param[in] aKeyUsage Key Usage encoding for the key (combinations of `OT_CRYPTO_KEY_USAGE_*`). + * @param[in] aKeyPersistence Key Persistence for this key + * @param[in] aKey Actual key to be imported. + * @param[in] aKeyLen Length of the key to be imported. + * + * @retval OT_ERROR_NONE Successfully imported the key. + * @retval OT_ERROR_FAILED Failed to import the key. + * @retval OT_ERROR_INVALID_ARGS @p aKey was set to NULL. + * + * @note If OT_CRYPTO_KEY_STORAGE_PERSISTENT is passed for aKeyPersistence then @p aKeyRef is input and platform + * should use the given aKeyRef and MUST not change it. + * + * If OT_CRYPTO_KEY_STORAGE_VOLATILE is passed for aKeyPersistence then @p aKeyRef is output, the initial + * value does not matter and platform API MUST update it to return the new key ref. + * + * This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled. + * + */ +otError otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef, + otCryptoKeyType aKeyType, + otCryptoKeyAlgorithm aKeyAlgorithm, + int aKeyUsage, + otCryptoKeyStorage aKeyPersistence, + const uint8_t * aKey, + size_t aKeyLen); + +/** + * Export a key stored in PSA ITS. + * + * @param[in] aKeyRef The key ref to be used for crypto operations. + * @param[out] aBuffer Pointer to the buffer where key needs to be exported. + * @param[in] aBufferLen Length of the buffer passed to store the exported key. + * @param[out] aKeyLen Pointer to return the length of the exported key. + * + * @retval OT_ERROR_NONE Successfully exported @p aKeyRef. + * @retval OT_ERROR_FAILED Failed to export @p aKeyRef. + * @retval OT_ERROR_INVALID_ARGS @p aBuffer was NULL + * + * @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled. + * + */ +otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen); + +/** + * Destroy a key stored in PSA ITS. + * + * @param[in] aKeyRef The key ref to be destroyed + * + * @retval OT_ERROR_NONE Successfully destroyed the key. + * @retval OT_ERROR_FAILED Failed to destroy the key. + * + * @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled. + * + */ +otError otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef); + +/** + * Check if the key ref passed has an associated key in PSA ITS. + * + * @param[in] aKeyRef The Key Ref to check. + * + * @retval TRUE There is an associated key with @p aKeyRef. + * @retval FALSE There is no associated key with @p aKeyRef. + * + * @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled. + * + */ +bool otPlatCryptoHasKey(otCryptoKeyRef aKeyRef); + +/** + * Initialize the HMAC operation. + * + * @param[in] aContext Context for HMAC operation. + * + * @retval OT_ERROR_NONE Successfully initialized HMAC operation. + * @retval OT_ERROR_FAILED Failed to initialize HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + * @note The platform driver shall point the context to the correct object such as psa_mac_operation_t or + * mbedtls_md_context_t. + * + */ +otError otPlatCryptoHmacSha256Init(otCryptoContext *aContext); + +/** + * Uninitialize the HMAC operation. + * + * @param[in] aContext Context for HMAC operation. + * + * @retval OT_ERROR_NONE Successfully uninitialized HMAC operation. + * @retval OT_ERROR_FAILED Failed to uninitialized HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoHmacSha256Deinit(otCryptoContext *aContext); + +/** + * Start HMAC operation. + * + * @param[in] aContext Context for HMAC operation. + * @param[in] aKey Key material to be used for for HMAC operation. + * + * @retval OT_ERROR_NONE Successfully started HMAC operation. + * @retval OT_ERROR_FAILED Failed to start HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aKey was NULL + * + */ +otError otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey *aKey); + +/** + * Update the HMAC operation with new input. + * + * @param[in] aContext Context for HMAC operation. + * @param[in] aBuf A pointer to the input buffer. + * @param[in] aBufLength The length of @p aBuf in bytes. + * + * @retval OT_ERROR_NONE Successfully updated HMAC with new input operation. + * @retval OT_ERROR_FAILED Failed to update HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aBuf was NULL + * + */ +otError otPlatCryptoHmacSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength); + +/** + * Complete the HMAC operation. + * + * @param[in] aContext Context for HMAC operation. + * @param[out] aBuf A pointer to the output buffer. + * @param[in] aBufLength The length of @p aBuf in bytes. + * + * @retval OT_ERROR_NONE Successfully completed HMAC operation. + * @retval OT_ERROR_FAILED Failed to complete HMAC operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aBuf was NULL + * + */ +otError otPlatCryptoHmacSha256Finish(otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength); + +/** + * Initialise the AES operation. + * + * @param[in] aContext Context for AES operation. + * + * @retval OT_ERROR_NONE Successfully Initialised AES operation. + * @retval OT_ERROR_FAILED Failed to Initialise AES operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * @retval OT_ERROR_NO_BUFS Cannot allocate the context. + * + * @note The platform driver shall point the context to the correct object such as psa_key_id + * or mbedtls_aes_context_t. + * + */ +otError otPlatCryptoAesInit(otCryptoContext *aContext); + +/** + * Set the key for AES operation. + * + * @param[in] aContext Context for AES operation. + * @param[out] aKey Key to use for AES operation. + * + * @retval OT_ERROR_NONE Successfully set the key for AES operation. + * @retval OT_ERROR_FAILED Failed to set the key for AES operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aKey was NULL + * + */ +otError otPlatCryptoAesSetKey(otCryptoContext *aContext, const otCryptoKey *aKey); + +/** + * Encrypt the given data. + * + * @param[in] aContext Context for AES operation. + * @param[in] aInput Pointer to the input buffer. + * @param[in] aOutput Pointer to the output buffer. + * + * @retval OT_ERROR_NONE Successfully encrypted @p aInput. + * @retval OT_ERROR_FAILED Failed to encrypt @p aInput. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aKey or @p aOutput were NULL + * + */ +otError otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, uint8_t *aOutput); + +/** + * Free the AES context. + * + * @param[in] aContext Context for AES operation. + * + * @retval OT_ERROR_NONE Successfully freed AES context. + * @retval OT_ERROR_FAILED Failed to free AES context. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoAesFree(otCryptoContext *aContext); + +/** + * Initialise the HKDF context. + * + * @param[in] aContext Context for HKDF operation. + * + * @retval OT_ERROR_NONE Successfully Initialised AES operation. + * @retval OT_ERROR_FAILED Failed to Initialise AES operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + * @note The platform driver shall point the context to the correct object such as psa_key_derivation_operation_t + * or HmacSha256::Hash + * + */ +otError otPlatCryptoHkdfInit(otCryptoContext *aContext); + +/** + * Perform HKDF Expand step. + * + * @param[in] aContext Operation context for HKDF operation. + * @param[in] aInfo Pointer to the Info sequence. + * @param[in] aInfoLength Length of the Info sequence. + * @param[out] aOutputKey Pointer to the output Key. + * @param[in] aOutputKeyLength Size of the output key buffer. + * + * @retval OT_ERROR_NONE HKDF Expand was successful. + * @retval OT_ERROR_FAILED HKDF Expand failed. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoHkdfExpand(otCryptoContext *aContext, + const uint8_t * aInfo, + uint16_t aInfoLength, + uint8_t * aOutputKey, + uint16_t aOutputKeyLength); + +/** + * Perform HKDF Extract step. + * + * @param[in] aContext Operation context for HKDF operation. + * @param[in] aSalt Pointer to the Salt for HKDF. + * @param[in] aSaltLength Length of Salt. + * @param[in] aInputKey Pointer to the input key. + * + * @retval OT_ERROR_NONE HKDF Extract was successful. + * @retval OT_ERROR_FAILED HKDF Extract failed. + * + */ +otError otPlatCryptoHkdfExtract(otCryptoContext * aContext, + const uint8_t * aSalt, + uint16_t aSaltLength, + const otCryptoKey *aInputKey); + +/** + * Uninitialize the HKDF context. + * + * @param[in] aContext Context for HKDF operation. + * + * @retval OT_ERROR_NONE Successfully un-initialised HKDF operation. + * @retval OT_ERROR_FAILED Failed to un-initialised HKDF operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoHkdfDeinit(otCryptoContext *aContext); + +/** + * Initialise the SHA-256 operation. + * + * @param[in] aContext Context for SHA-256 operation. + * + * @retval OT_ERROR_NONE Successfully initialised SHA-256 operation. + * @retval OT_ERROR_FAILED Failed to initialise SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + * + * @note The platform driver shall point the context to the correct object such as psa_hash_operation_t + * or mbedtls_sha256_context. + */ +otError otPlatCryptoSha256Init(otCryptoContext *aContext); + +/** + * Uninitialize the SHA-256 operation. + * + * @param[in] aContext Context for SHA-256 operation. + * + * @retval OT_ERROR_NONE Successfully un-initialised SHA-256 operation. + * @retval OT_ERROR_FAILED Failed to un-initialised SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoSha256Deinit(otCryptoContext *aContext); + +/** + * Start SHA-256 operation. + * + * @param[in] aContext Context for SHA-256 operation. + * + * @retval OT_ERROR_NONE Successfully started SHA-256 operation. + * @retval OT_ERROR_FAILED Failed to start SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext was NULL + * + */ +otError otPlatCryptoSha256Start(otCryptoContext *aContext); + +/** + * Update SHA-256 operation with new input. + * + * @param[in] aContext Context for SHA-256 operation. + * @param[in] aBuf A pointer to the input buffer. + * @param[in] aBufLength The length of @p aBuf in bytes. + * + * @retval OT_ERROR_NONE Successfully updated SHA-256 with new input operation. + * @retval OT_ERROR_FAILED Failed to update SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aBuf was NULL + * + */ +otError otPlatCryptoSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength); + +/** + * Finish SHA-256 operation. + * + * @param[in] aContext Context for SHA-256 operation. + * @param[in] aHash A pointer to the output buffer, where hash needs to be stored. + * @param[in] aHashSize The length of @p aHash in bytes. + * + * @retval OT_ERROR_NONE Successfully completed the SHA-256 operation. + * @retval OT_ERROR_FAILED Failed to complete SHA-256 operation. + * @retval OT_ERROR_INVALID_ARGS @p aContext or @p aHash was NULL + * + */ +otError otPlatCryptoSha256Finish(otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize); + +/** + * Initialize cryptographically-secure pseudorandom number generator (CSPRNG). + * + */ +void otPlatCryptoRandomInit(void); + +/** + * Deinitialize cryptographically-secure pseudorandom number generator (CSPRNG). + * + */ +void otPlatCryptoRandomDeinit(void); + +/** + * Fills a given buffer with cryptographically secure random bytes. + * + * @param[out] aBuffer A pointer to a buffer to fill with the random bytes. + * @param[in] aSize Size of buffer (number of bytes to fill). + * + * @retval OT_ERROR_NONE Successfully filled buffer with random values. + * @retval OT_ERROR_FAILED Operation failed. + * + */ +otError otPlatCryptoRandomGet(uint8_t *aBuffer, uint16_t aSize); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // end of extern "C" +#endif +#endif // OPENTHREAD_PLATFORM_CRYPTO_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/diag.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/diag.h new file mode 100644 index 0000000..9dee346 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/diag.h @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file defines the platform diag interface. + * + */ + +#ifndef OPENTHREAD_PLATFORM_DIAG_H_ +#define OPENTHREAD_PLATFORM_DIAG_H_ + +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-factory-diagnostics + * + * @brief + * This module includes the platform abstraction for diagnostics features. + * + * @{ + * + */ + +/** + * This function processes a factory diagnostics command line. + * + * The output of this function (the content written to @p aOutput) MUST terminate with `\0` and the `\0` is within the + * output buffer. + * + * @param[in] aInstance The OpenThread instance for current request. + * @param[in] aArgsLength The number of arguments in @p aArgs. + * @param[in] aArgs The arguments of diagnostics command line. + * @param[out] aOutput The diagnostics execution result. + * @param[in] aOutputMaxLen The output buffer size. + * + * @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided. + * @retval OT_ERROR_NONE The command is successfully process. + * @retval OT_ERROR_INVALID_COMMAND The command is not valid or not supported. + * + */ +otError otPlatDiagProcess(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen); + +/** + * This function enables/disables the factory diagnostics mode. + * + * @param[in] aMode TRUE to enable diagnostics mode, FALSE otherwise. + * + */ +void otPlatDiagModeSet(bool aMode); + +/** + * This function indicates whether or not factory diagnostics mode is enabled. + * + * @returns TRUE if factory diagnostics mode is enabled, FALSE otherwise. + * + */ +bool otPlatDiagModeGet(void); + +/** + * This function sets the channel to use for factory diagnostics. + * + * @param[in] aChannel The channel value. + * + */ +void otPlatDiagChannelSet(uint8_t aChannel); + +/** + * This function sets the transmit power to use for factory diagnostics. + * + * @param[in] aTxPower The transmit power value. + * + */ +void otPlatDiagTxPowerSet(int8_t aTxPower); + +/** + * This function processes the received radio frame. + * + * @param[in] aInstance The OpenThread instance for current request. + * @param[in] aFrame The received radio frame. + * @param[in] aError The received radio frame status. + * + */ +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError); + +/** + * This function processes the alarm event. + * + * @param[in] aInstance The OpenThread instance for current request. + * + */ +void otPlatDiagAlarmCallback(otInstance *aInstance); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // end of extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_DIAG_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/logging.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/logging.h new file mode 100644 index 0000000..adf123f --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/logging.h @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes the platform abstraction for the debug log service. + */ + +#ifndef OPENTHREAD_PLATFORM_LOGGING_H_ +#define OPENTHREAD_PLATFORM_LOGGING_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-logging + * + * @brief + * This module includes the platform abstraction for the debug log service. + * + * @{ + * + */ + +/** + * Log level None. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_NONE 0 + +/** + * Log level Critical. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_CRIT 1 + +/** + * Log level Warning. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_WARN 2 + +/** + * Log level Notice. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_NOTE 3 + +/** + * Log level Informational. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_INFO 4 + +/** + * Log level Debug. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_DEBG 5 + +/** + * This type represents the log level. + * + */ +typedef int otLogLevel; + +/** + * This enumeration represents log regions. + * + * The support for log region is removed and instead each core module can define its own name to appended to the logs. + * However, the `otLogRegion` enumeration is still defined as before to help with platforms which we may be using it + * in their `otPlatLog()` implementation. The OT core will always emit all logs with `OT_LOG_REGION_CORE`. + * + */ +typedef enum otLogRegion +{ + OT_LOG_REGION_API = 1, ///< OpenThread API + OT_LOG_REGION_MLE = 2, ///< MLE + OT_LOG_REGION_ARP = 3, ///< EID-to-RLOC mapping. + OT_LOG_REGION_NET_DATA = 4, ///< Network Data + OT_LOG_REGION_ICMP = 5, ///< ICMPv6 + OT_LOG_REGION_IP6 = 6, ///< IPv6 + OT_LOG_REGION_TCP = 7, ///< TCP + OT_LOG_REGION_MAC = 8, ///< IEEE 802.15.4 MAC + OT_LOG_REGION_MEM = 9, ///< Memory + OT_LOG_REGION_NCP = 10, ///< NCP + OT_LOG_REGION_MESH_COP = 11, ///< Mesh Commissioning Protocol + OT_LOG_REGION_NET_DIAG = 12, ///< Network Diagnostic + OT_LOG_REGION_PLATFORM = 13, ///< Platform + OT_LOG_REGION_COAP = 14, ///< CoAP + OT_LOG_REGION_CLI = 15, ///< CLI + OT_LOG_REGION_CORE = 16, ///< OpenThread Core + OT_LOG_REGION_UTIL = 17, ///< Utility module + OT_LOG_REGION_BBR = 18, ///< Backbone Router (available since Thread 1.2) + OT_LOG_REGION_MLR = 19, ///< Multicast Listener Registration (available since Thread 1.2) + OT_LOG_REGION_DUA = 20, ///< Domain Unicast Address (available since Thread 1.2) + OT_LOG_REGION_BR = 21, ///< Border Router + OT_LOG_REGION_SRP = 22, ///< Service Registration Protocol (SRP) + OT_LOG_REGION_DNS = 23, ///< DNS +} otLogRegion; + +/** + * This function outputs logs. + * + * Note that the support for log region is removed. The OT core will always emit all logs with `OT_LOG_REGION_CORE` + * as @p aLogRegion. + * + * @param[in] aLogLevel The log level. + * @param[in] aLogRegion The log region. + * @param[in] aFormat A pointer to the format string. + * @param[in] ... Arguments for the format specification. + * + */ +void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...); + +/** + * This function handles OpenThread log level changes. + * + * This platform function is called whenever the OpenThread log level changes. + * This platform function is optional since an empty weak implementation has been provided. + * + * @note Only applicable when `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1`. + * + * @param[in] aLogLevel The new OpenThread log level. + * + */ +void otPlatLogHandleLevelChanged(otLogLevel aLogLevel); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_LOGGING_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/radio.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/radio.h new file mode 100644 index 0000000..3ac715c --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/radio.h @@ -0,0 +1,1158 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file defines the radio interface for OpenThread. + * + */ + +#ifndef OPENTHREAD_PLATFORM_RADIO_H_ +#define OPENTHREAD_PLATFORM_RADIO_H_ + +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup plat-radio + * + * @brief + * This module includes the platform abstraction for radio communication. + * + * @{ + * + */ + +/** + * @defgroup radio-types Radio Types + * + * @brief + * This module includes the platform abstraction for a radio frame. + * + * @{ + * + */ + +enum +{ + OT_RADIO_FRAME_MAX_SIZE = 127, ///< aMaxPHYPacketSize (IEEE 802.15.4-2006) + OT_RADIO_FRAME_MIN_SIZE = 3, ///< Minimal size of frame FCS + CONTROL + OT_RADIO_SYMBOLS_PER_OCTET = 2, ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_BIT_RATE = 250000, ///< 2.4 GHz IEEE 802.15.4 (bits per second) + OT_RADIO_BITS_PER_OCTET = 8, ///< Number of bits per octet + + OT_RADIO_SYMBOL_TIME = ((OT_RADIO_BITS_PER_OCTET / OT_RADIO_SYMBOLS_PER_OCTET) * 1000000) / OT_RADIO_BIT_RATE, + OT_RADIO_LQI_NONE = 0, ///< LQI measurement not supported + OT_RADIO_RSSI_INVALID = 127, ///< Invalid or unknown RSSI value + OT_RADIO_POWER_INVALID = 127, ///< Invalid or unknown power value +}; + +/** + * This enumeration defines the channel page. + * + */ +enum +{ + OT_RADIO_CHANNEL_PAGE_0 = 0, ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_CHANNEL_PAGE_0_MASK = (1U << OT_RADIO_CHANNEL_PAGE_0), ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_CHANNEL_PAGE_2 = 2, ///< 915 MHz IEEE 802.15.4-2006 + OT_RADIO_CHANNEL_PAGE_2_MASK = (1U << OT_RADIO_CHANNEL_PAGE_2), ///< 915 MHz IEEE 802.15.4-2006 +}; + +/** + * This enumeration defines the frequency band channel range. + * + */ +enum +{ + OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN = 1, ///< 915 MHz IEEE 802.15.4-2006 + OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX = 10, ///< 915 MHz IEEE 802.15.4-2006 + OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK = 0x3ff << OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN, ///< 915 MHz IEEE 802.15.4-2006 + OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN = 11, ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX = 26, ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK = 0xffff << OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN, ///< 2.4 GHz IEEE 802.15.4-2006 +}; + +/** + * This type represents radio capabilities. + * + * The value is a bit-field indicating the capabilities supported by the radio. See `OT_RADIO_CAPS_*` definitions. + * + */ +typedef uint8_t otRadioCaps; + +/** + * This enumeration defines constants that are used to indicate different radio capabilities. See `otRadioCaps`. + * + */ +enum +{ + OT_RADIO_CAPS_NONE = 0, ///< Radio supports no capability. + OT_RADIO_CAPS_ACK_TIMEOUT = 1 << 0, ///< Radio supports AckTime event. + OT_RADIO_CAPS_ENERGY_SCAN = 1 << 1, ///< Radio supports Energy Scans. + OT_RADIO_CAPS_TRANSMIT_RETRIES = 1 << 2, ///< Radio supports tx retry logic with collision avoidance (CSMA). + OT_RADIO_CAPS_CSMA_BACKOFF = 1 << 3, ///< Radio supports CSMA backoff for frame transmission (but no retry). + OT_RADIO_CAPS_SLEEP_TO_TX = 1 << 4, ///< Radio supports direct transition from sleep to TX with CSMA. + OT_RADIO_CAPS_TRANSMIT_SEC = 1 << 5, ///< Radio supports tx security. + OT_RADIO_CAPS_TRANSMIT_TIMING = 1 << 6, ///< Radio supports tx at specific time. + OT_RADIO_CAPS_RECEIVE_TIMING = 1 << 7, ///< Radio supports rx at specific time. +}; + +#define OT_PANID_BROADCAST 0xffff ///< IEEE 802.15.4 Broadcast PAN ID + +/** + * This type represents the IEEE 802.15.4 PAN ID. + * + */ +typedef uint16_t otPanId; + +/** + * This type represents the IEEE 802.15.4 Short Address. + * + */ +typedef uint16_t otShortAddress; + +#define OT_EXT_ADDRESS_SIZE 8 ///< Size of an IEEE 802.15.4 Extended Address (bytes) + +/** + * This enumeration defines constants about size of header IE in ACK. + * + */ +enum +{ + OT_IE_HEADER_SIZE = 2, ///< Size of IE header in bytes. + OT_CSL_IE_SIZE = 4, ///< Size of CSL IE content in bytes. + OT_ACK_IE_MAX_SIZE = 16, ///< Max length for header IE in ACK. + OT_ENH_PROBING_IE_DATA_MAX_SIZE = 2, ///< Max length of Link Metrics data in Vendor-Specific IE. +}; + +#define CSL_IE_HEADER_BYTES_LO 0x04 ///< Fixed CSL IE header first byte +#define CSL_IE_HEADER_BYTES_HI 0x0d ///< Fixed CSL IE header second byte + +/** + * @struct otExtAddress + * + * This structure represents the IEEE 802.15.4 Extended Address. + * + */ +OT_TOOL_PACKED_BEGIN +struct otExtAddress +{ + uint8_t m8[OT_EXT_ADDRESS_SIZE]; ///< IEEE 802.15.4 Extended Address bytes +} OT_TOOL_PACKED_END; + +/** + * This structure represents the IEEE 802.15.4 Extended Address. + * + */ +typedef struct otExtAddress otExtAddress; + +#define OT_MAC_KEY_SIZE 16 ///< Size of the MAC Key in bytes. + +/** + * @struct otMacKey + * + * This structure represents a MAC Key. + * + */ +OT_TOOL_PACKED_BEGIN +struct otMacKey +{ + uint8_t m8[OT_MAC_KEY_SIZE]; ///< MAC Key bytes. +} OT_TOOL_PACKED_END; + +/** + * This structure represents a MAC Key. + * + */ +typedef struct otMacKey otMacKey; + +/** + * This type represents a MAC Key Ref used by PSA. + * + */ +typedef otCryptoKeyRef otMacKeyRef; + +/** + * @struct otMacKeyMaterial + * + * This structure represents a MAC Key. + * + */ +typedef struct otMacKeyMaterial +{ + union + { + otMacKeyRef mKeyRef; ///< Reference to the key stored. + otMacKey mKey; ///< Key stored as literal. + } mKeyMaterial; +} otMacKeyMaterial; + +/** + * This enumeration defines constants about key types. + * + */ +typedef enum +{ + OT_KEY_TYPE_LITERAL_KEY = 0, ///< Use Literal Keys. + OT_KEY_TYPE_KEY_REF = 1, ///< Use Reference to Key. +} otRadioKeyType; + +/** + * This structure represents the IEEE 802.15.4 Header IE (Information Element) related information of a radio frame. + */ +typedef struct otRadioIeInfo +{ + int64_t mNetworkTimeOffset; ///< The time offset to the Thread network time. + uint8_t mTimeIeOffset; ///< The Time IE offset from the start of PSDU. + uint8_t mTimeSyncSeq; ///< The Time sync sequence. +} otRadioIeInfo; + +/** + * This structure represents an IEEE 802.15.4 radio frame. + */ +typedef struct otRadioFrame +{ + uint8_t *mPsdu; ///< The PSDU. + + uint16_t mLength; ///< Length of the PSDU. + uint8_t mChannel; ///< Channel used to transmit/receive the frame. + + uint8_t mRadioType; ///< Radio link type - should be ignored by radio driver. + + /** + * The union of transmit and receive information for a radio frame. + */ + union + { + /** + * Structure representing radio frame transmit information. + */ + struct + { + const otMacKeyMaterial *mAesKey; ///< The key material used for AES-CCM frame security. + otRadioIeInfo * mIeInfo; ///< The pointer to the Header IE(s) related information. + uint32_t mTxDelay; ///< The delay time for this transmission (based on `mTxDelayBaseTime`). + uint32_t mTxDelayBaseTime; ///< The base time for the transmission delay. + uint8_t mMaxCsmaBackoffs; ///< Maximum number of backoffs attempts before declaring CCA failure. + uint8_t mMaxFrameRetries; ///< Maximum number of retries allowed after a transmission failure. + + /** + * Indicates whether frame counter and CSL IEs are properly updated in the header. + * + * If the platform layer does not provide `OT_RADIO_CAPS_TRANSMIT_SEC` capability, it can ignore this flag. + * + * If the platform provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability, then platform is expected to handle tx + * security processing and assignment of frame counter. In this case the following behavior is expected: + * + * When `mIsHeaderUpdated` is set, it indicates that OpenThread core has already set the frame counter and + * CSL IEs (if security is enabled) in the prepared frame. The counter is ensured to match the counter value + * from the previous attempts of the same frame. The platform should not assign or change the frame counter + * (but may still need to perform security processing depending on `mIsSecurityProcessed` flag). + * + * If `mIsHeaderUpdated` is not set, then the frame counter and key CSL IE not set in the frame by + * OpenThread core and it is the responsibility of the radio platform to assign them. The platform + * must update the frame header (assign counter and CSL IE values) before sending the frame over the air, + * however if the the transmission gets aborted and the frame is never sent over the air (e.g., channel + * access error) the platform may choose to not update the header. If the platform updates the header, + * it must also set this flag before passing the frame back from the `otPlatRadioTxDone()` callback. + * + */ + bool mIsHeaderUpdated : 1; + bool mIsARetx : 1; ///< Indicates whether the frame is a retransmission or not. + bool mCsmaCaEnabled : 1; ///< Set to true to enable CSMA-CA for this packet, false otherwise. + bool mCslPresent : 1; ///< Set to true if CSL header IE is present. + bool mIsSecurityProcessed : 1; ///< True if SubMac should skip the AES processing of this frame. + } mTxInfo; + + /** + * Structure representing radio frame receive information. + */ + struct + { + /** + * The timestamp when the frame was received in microseconds. + * + * The value SHALL be the time when the SFD was received when TIME_SYNC or CSL is enabled. + * Otherwise, the time when the MAC frame was fully received is also acceptable. + * + */ + uint64_t mTimestamp; + + uint32_t mAckFrameCounter; ///< ACK security frame counter (applicable when `mAckedWithSecEnhAck` is set). + uint8_t mAckKeyId; ///< ACK security key index (applicable when `mAckedWithSecEnhAck` is set). + int8_t mRssi; ///< Received signal strength indicator in dBm for received frames. + uint8_t mLqi; ///< Link Quality Indicator for received frames. + + // Flags + bool mAckedWithFramePending : 1; ///< This indicates if this frame was acknowledged with frame pending set. + bool mAckedWithSecEnhAck : 1; ///< This indicates if this frame was acknowledged with secured enhance ACK. + } mRxInfo; + } mInfo; +} otRadioFrame; + +/** + * This structure represents the state of a radio. + * Initially, a radio is in the Disabled state. + */ +typedef enum otRadioState +{ + OT_RADIO_STATE_DISABLED = 0, + OT_RADIO_STATE_SLEEP = 1, + OT_RADIO_STATE_RECEIVE = 2, + OT_RADIO_STATE_TRANSMIT = 3, + OT_RADIO_STATE_INVALID = 255, +} otRadioState; + +/** + * The following are valid radio state transitions: + * + * (Radio ON) + * +----------+ Enable() +-------+ Receive() +---------+ Transmit() +----------+ + * | |----------->| |----------->| |-------------->| | + * | Disabled | | Sleep | | Receive | | Transmit | + * | |<-----------| |<-----------| |<--------------| | + * +----------+ Disable() +-------+ Sleep() +---------+ Receive() +----------+ + * (Radio OFF) or + * signal TransmitDone + * + * During the IEEE 802.15.4 data request command the transition Sleep->Receive->Transmit + * can be shortened to direct transition from Sleep to Transmit if the platform supports + * the OT_RADIO_CAPS_SLEEP_TO_TX capability. + */ + +/** + * This structure represents radio coexistence metrics. + */ +typedef struct otRadioCoexMetrics +{ + uint32_t mNumGrantGlitch; ///< Number of grant glitches. + uint32_t mNumTxRequest; ///< Number of tx requests. + uint32_t mNumTxGrantImmediate; ///< Number of tx requests while grant was active. + uint32_t mNumTxGrantWait; ///< Number of tx requests while grant was inactive. + uint32_t mNumTxGrantWaitActivated; ///< Number of tx requests while grant was inactive that were ultimately granted. + uint32_t mNumTxGrantWaitTimeout; ///< Number of tx requests while grant was inactive that timed out. + uint32_t mNumTxGrantDeactivatedDuringRequest; ///< Number of tx that were in progress when grant was deactivated. + uint32_t mNumTxDelayedGrant; ///< Number of tx requests that were not granted within 50us. + uint32_t mAvgTxRequestToGrantTime; ///< Average time in usec from tx request to grant. + uint32_t mNumRxRequest; ///< Number of rx requests. + uint32_t mNumRxGrantImmediate; ///< Number of rx requests while grant was active. + uint32_t mNumRxGrantWait; ///< Number of rx requests while grant was inactive. + uint32_t mNumRxGrantWaitActivated; ///< Number of rx requests while grant was inactive that were ultimately granted. + uint32_t mNumRxGrantWaitTimeout; ///< Number of rx requests while grant was inactive that timed out. + uint32_t mNumRxGrantDeactivatedDuringRequest; ///< Number of rx that were in progress when grant was deactivated. + uint32_t mNumRxDelayedGrant; ///< Number of rx requests that were not granted within 50us. + uint32_t mAvgRxRequestToGrantTime; ///< Average time in usec from rx request to grant. + uint32_t mNumRxGrantNone; ///< Number of rx requests that completed without receiving grant. + bool mStopped; ///< Stats collection stopped due to saturation. +} otRadioCoexMetrics; + +/** + * This structure represents what metrics are specified to query. + * + */ +typedef struct otLinkMetrics +{ + bool mPduCount : 1; ///< Pdu count. + bool mLqi : 1; ///< Link Quality Indicator. + bool mLinkMargin : 1; ///< Link Margin. + bool mRssi : 1; ///< Received Signal Strength Indicator. + bool mReserved : 1; ///< Reserved, this is for reference device. +} otLinkMetrics; + +/** + * @} + * + */ + +/** + * @defgroup radio-config Radio Configuration + * + * @brief + * This module includes the platform abstraction for radio configuration. + * + * @{ + * + */ + +/** + * Get the radio capabilities. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The radio capability bit vector (see `OT_RADIO_CAP_*` definitions). + * + */ +otRadioCaps otPlatRadioGetCaps(otInstance *aInstance); + +/** + * Get the radio version string. + * + * This is an optional radio driver platform function. If not provided by platform radio driver, OpenThread uses + * the OpenThread version instead (@sa otGetVersionString()). + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns A pointer to the OpenThread radio version. + * + */ +const char *otPlatRadioGetVersionString(otInstance *aInstance); + +/** + * Get the radio receive sensitivity value. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The radio receive sensitivity value in dBm. + * + */ +int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance); + +/** + * Gets the factory-assigned IEEE EUI-64 for this interface. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aIeeeEui64 A pointer to the factory-assigned IEEE EUI-64. + * + */ +void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64); + +/** + * Set the PAN ID for address filtering. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aPanId The IEEE 802.15.4 PAN ID. + * + */ +void otPlatRadioSetPanId(otInstance *aInstance, otPanId aPanId); + +/** + * Set the Extended Address for address filtering. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aExtAddress A pointer to the IEEE 802.15.4 Extended Address stored in little-endian byte order. + * + * + */ +void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtAddress); + +/** + * Set the Short Address for address filtering. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aShortAddress The IEEE 802.15.4 Short Address. + * + */ +void otPlatRadioSetShortAddress(otInstance *aInstance, otShortAddress aShortAddress); + +/** + * Get the radio's transmit power in dBm. + * + * @note The transmit power returned will be no larger than the power specified in the max power table for + * the current channel. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aPower The transmit power in dBm. + * + * @retval OT_ERROR_NONE Successfully retrieved the transmit power. + * @retval OT_ERROR_INVALID_ARGS @p aPower was NULL. + * @retval OT_ERROR_NOT_IMPLEMENTED Transmit power configuration via dBm is not implemented. + * + */ +otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower); + +/** + * Set the radio's transmit power in dBm. + * + * @note The real transmit power will be no larger than the power specified in the max power table for + * the current channel. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aPower The transmit power in dBm. + * + * @retval OT_ERROR_NONE Successfully set the transmit power. + * @retval OT_ERROR_NOT_IMPLEMENTED Transmit power configuration via dBm is not implemented. + * + */ +otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower); + +/** + * Get the radio's CCA ED threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE Successfully retrieved the CCA ED threshold. + * @retval OT_ERROR_INVALID_ARGS @p aThreshold was NULL. + * @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented. + * + */ +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold); + +/** + * Set the radio's CCA ED threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE Successfully set the transmit power. + * @retval OT_ERROR_INVALID_ARGS Given threshold is out of range. + * @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented. + * + */ +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold); + +/** + * Gets the external FEM's Rx LNA gain in dBm. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aGain The external FEM's Rx LNA gain in dBm. + * + * @retval OT_ERROR_NONE Successfully retrieved the external FEM's LNA gain. + * @retval OT_ERROR_INVALID_ARGS @p aGain was NULL. + * @retval OT_ERROR_NOT_IMPLEMENTED External FEM's LNA setting is not implemented. + * + */ +otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain); + +/** + * Sets the external FEM's Rx LNA gain in dBm. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aGain The external FEM's Rx LNA gain in dBm. + * + * @retval OT_ERROR_NONE Successfully set the external FEM's LNA gain. + * @retval OT_ERROR_NOT_IMPLEMENTED External FEM's LNA gain setting is not implemented. + * + */ +otError otPlatRadioSetFemLnaGain(otInstance *aInstance, int8_t aGain); + +/** + * Get the status of promiscuous mode. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @retval TRUE Promiscuous mode is enabled. + * @retval FALSE Promiscuous mode is disabled. + * + */ +bool otPlatRadioGetPromiscuous(otInstance *aInstance); + +/** + * Enable or disable promiscuous mode. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnable TRUE to enable or FALSE to disable promiscuous mode. + * + */ +void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable); + +/** + * Update MAC keys and key index + * + * This function is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aKeyIdMode The key ID mode. + * @param[in] aKeyId Current MAC key index. + * @param[in] aPrevKey A pointer to the previous MAC key. + * @param[in] aCurrKey A pointer to the current MAC key. + * @param[in] aNextKey A pointer to the next MAC key. + * @param[in] aKeyType Key Type used. + * + */ +void otPlatRadioSetMacKey(otInstance * aInstance, + uint8_t aKeyIdMode, + uint8_t aKeyId, + const otMacKeyMaterial *aPrevKey, + const otMacKeyMaterial *aCurrKey, + const otMacKeyMaterial *aNextKey, + otRadioKeyType aKeyType); + +/** + * This method sets the current MAC frame counter value. + * + * This function is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aMacFrameCounter The MAC frame counter value. + * + */ +void otPlatRadioSetMacFrameCounter(otInstance *aInstance, uint32_t aMacFrameCounter); + +/** + * Get the current estimated time (in microseconds) of the radio chip. + * + * This microsecond timer must be a free-running timer. The timer must continue to advance with microsecond precision + * even when the radio is in the sleep state. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The current time in microseconds. UINT64_MAX when platform does not support or radio time is not ready. + * + */ +uint64_t otPlatRadioGetNow(otInstance *aInstance); + +/** + * Get the bus speed in bits/second between the host and the radio chip. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The bus speed in bits/second between the host and the radio chip. + * Return 0 when the MAC and above layer and Radio layer resides on the same chip. + * + */ +uint32_t otPlatRadioGetBusSpeed(otInstance *aInstance); + +/** + * @} + * + */ + +/** + * @defgroup radio-operation Radio Operation + * + * @brief + * This module includes the platform abstraction for radio operations. + * + * @{ + * + */ + +/** + * Get current state of the radio. + * + * This function is not required by OpenThread. It may be used for debugging and/or application-specific purposes. + * + * @note This function may be not implemented. It does not affect OpenThread. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @return Current state of the radio. + * + */ +otRadioState otPlatRadioGetState(otInstance *aInstance); + +/** + * Enable the radio. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @retval OT_ERROR_NONE Successfully enabled. + * @retval OT_ERROR_FAILED The radio could not be enabled. + * + */ +otError otPlatRadioEnable(otInstance *aInstance); + +/** + * Disable the radio. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @retval OT_ERROR_NONE Successfully transitioned to Disabled. + * @retval OT_ERROR_INVALID_STATE The radio was not in sleep state. + * + */ +otError otPlatRadioDisable(otInstance *aInstance); + +/** + * Check whether radio is enabled or not. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns TRUE if the radio is enabled, FALSE otherwise. + * + */ +bool otPlatRadioIsEnabled(otInstance *aInstance); + +/** + * Transition the radio from Receive to Sleep (turn off the radio). + * + * @param[in] aInstance The OpenThread instance structure. + * + * @retval OT_ERROR_NONE Successfully transitioned to Sleep. + * @retval OT_ERROR_BUSY The radio was transmitting. + * @retval OT_ERROR_INVALID_STATE The radio was disabled. + * + */ +otError otPlatRadioSleep(otInstance *aInstance); + +/** + * Transition the radio from Sleep to Receive (turn on the radio). + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aChannel The channel to use for receiving. + * + * @retval OT_ERROR_NONE Successfully transitioned to Receive. + * @retval OT_ERROR_INVALID_STATE The radio was disabled or transmitting. + * + */ +otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel); + +/** + * Schedule a radio reception window at a specific time and duration. + * + * @param[in] aChannel The radio channel on which to receive. + * @param[in] aStart The receive window start time, in microseconds. + * @param[in] aDuration The receive window duration, in microseconds + * + * @retval OT_ERROR_NONE Successfully scheduled receive window. + * @retval OT_ERROR_FAILED The receive window could not be scheduled. + */ +otError otPlatRadioReceiveAt(otInstance *aInstance, uint8_t aChannel, uint32_t aStart, uint32_t aDuration); + +/** + * The radio driver calls this method to notify OpenThread of a received frame. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed. + * @param[in] aError OT_ERROR_NONE when successfully received a frame, + * OT_ERROR_ABORT when reception was aborted and a frame was not received, + * OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space. + * + */ +extern void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); + +/** + * The radio driver calls this method to notify OpenThread diagnostics module of a received frame. + * + * This function is used when diagnostics is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed. + * @param[in] aError OT_ERROR_NONE when successfully received a frame, + * OT_ERROR_ABORT when reception was aborted and a frame was not received, + * OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space. + * + */ +extern void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); + +/** + * Get the radio transmit frame buffer. + * + * OpenThread forms the IEEE 802.15.4 frame in this buffer then calls `otPlatRadioTransmit()` to request transmission. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns A pointer to the transmit frame buffer. + * + */ +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance); + +/** + * Begin the transmit sequence on the radio. + * + * The caller must form the IEEE 802.15.4 frame in the buffer provided by `otPlatRadioGetTransmitBuffer()` before + * requesting transmission. The channel and transmit power are also included in the otRadioFrame structure. + * + * The transmit sequence consists of: + * 1. Transitioning the radio to Transmit from one of the following states: + * - Receive if RX is on when the device is idle or OT_RADIO_CAPS_SLEEP_TO_TX is not supported + * - Sleep if RX is off when the device is idle and OT_RADIO_CAPS_SLEEP_TO_TX is supported. + * 2. Transmits the psdu on the given channel and at the given transmit power. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the frame to be transmitted. + * + * @retval OT_ERROR_NONE Successfully transitioned to Transmit. + * @retval OT_ERROR_INVALID_STATE The radio was not in the Receive state. + * + */ +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame); + +/** + * The radio driver calls this method to notify OpenThread that the transmission has started. + * + * @note This function should be called by the same thread that executes all of the other OpenThread code. It should + * not be called by ISR or any other task. + * + * @param[in] aInstance A pointer to the OpenThread instance structure. + * @param[in] aFrame A pointer to the frame that is being transmitted. + * + */ +extern void otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame); + +/** + * The radio driver calls this function to notify OpenThread that the transmit operation has completed, + * providing both the transmitted frame and, if applicable, the received ack frame. + * + * When radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability, radio platform layer updates @p aFrame + * with the security frame counter and key index values maintained by the radio. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the frame that was transmitted. + * @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received. + * @param[in] aError OT_ERROR_NONE when the frame was transmitted, + * OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received, + * OT_ERROR_CHANNEL_ACCESS_FAILURE tx could not take place due to activity on the channel, + * OT_ERROR_ABORT when transmission was aborted for other reasons. + * + */ +extern void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); + +/** + * The radio driver calls this method to notify OpenThread diagnostics module that the transmission has completed. + * + * This function is used when diagnostics is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the frame that was transmitted. + * @param[in] aError OT_ERROR_NONE when the frame was transmitted, + * OT_ERROR_CHANNEL_ACCESS_FAILURE tx could not take place due to activity on the channel, + * OT_ERROR_ABORT when transmission was aborted for other reasons. + * + */ +extern void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); + +/** + * Get the most recent RSSI measurement. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The RSSI in dBm when it is valid. 127 when RSSI is invalid. + * + */ +int8_t otPlatRadioGetRssi(otInstance *aInstance); + +/** + * Begin the energy scan sequence on the radio. + * + * This function is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aScanChannel The channel to perform the energy scan on. + * @param[in] aScanDuration The duration, in milliseconds, for the channel to be scanned. + * + * @retval OT_ERROR_NONE Successfully started scanning the channel. + * @retval OT_ERROR_BUSY The radio is performing enery scanning. + * @retval OT_ERROR_NOT_IMPLEMENTED The radio doesn't support energy scanning. + * + */ +otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration); + +/** + * The radio driver calls this method to notify OpenThread that the energy scan is complete. + * + * This function is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnergyScanMaxRssi The maximum RSSI encountered on the scanned channel. + * + */ +extern void otPlatRadioEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi); + +/** + * Enable/Disable source address match feature. + * + * The source address match feature controls how the radio layer decides the "frame pending" bit for acks sent in + * response to data request commands from children. + * + * If disabled, the radio layer must set the "frame pending" on all acks to data request commands. + * + * If enabled, the radio layer uses the source address match table to determine whether to set or clear the "frame + * pending" bit in an ack to a data request command. + * + * The source address match table provides the list of children for which there is a pending frame. Either a short + * address or an extended/long address can be added to the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnable Enable/disable source address match feature. + * + */ +void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable); + +/** + * Add a short address to the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aShortAddress The short address to be added. + * + * @retval OT_ERROR_NONE Successfully added short address to the source match table. + * @retval OT_ERROR_NO_BUFS No available entry in the source match table. + * + */ +otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress); + +/** + * Add an extended address to the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aExtAddress The extended address to be added stored in little-endian byte order. + * + * @retval OT_ERROR_NONE Successfully added extended address to the source match table. + * @retval OT_ERROR_NO_BUFS No available entry in the source match table. + * + */ +otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress); + +/** + * Remove a short address from the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aShortAddress The short address to be removed. + * + * @retval OT_ERROR_NONE Successfully removed short address from the source match table. + * @retval OT_ERROR_NO_ADDRESS The short address is not in source address match table. + * + */ +otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress); + +/** + * Remove an extended address from the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aExtAddress The extended address to be removed stored in little-endian byte order. + * + * @retval OT_ERROR_NONE Successfully removed the extended address from the source match table. + * @retval OT_ERROR_NO_ADDRESS The extended address is not in source address match table. + * + */ +otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress); + +/** + * Clear all short addresses from the source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * + */ +void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance); + +/** + * Clear all the extended/long addresses from source address match table. + * + * @param[in] aInstance The OpenThread instance structure. + * + */ +void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance); + +/** + * Get the radio supported channel mask that the device is allowed to be on. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The radio supported channel mask. + * + */ +uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance); + +/** + * Gets the radio preferred channel mask that the device prefers to form on. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns The radio preferred channel mask. + * + */ +uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance); + +/** + * Enable the radio coex. + * + * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnabled TRUE to enable the radio coex, FALSE otherwise. + * + * @retval OT_ERROR_NONE Successfully enabled. + * @retval OT_ERROR_FAILED The radio coex could not be enabled. + * + */ +otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled); + +/** + * Check whether radio coex is enabled or not. + * + * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns TRUE if the radio coex is enabled, FALSE otherwise. + * + */ +bool otPlatRadioIsCoexEnabled(otInstance *aInstance); + +/** + * Get the radio coexistence metrics. + * + * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aCoexMetrics A pointer to the coexistence metrics structure. + * + * @retval OT_ERROR_NONE Successfully retrieved the coex metrics. + * @retval OT_ERROR_INVALID_ARGS @p aCoexMetrics was NULL. + */ +otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics); + +/** + * Enable or disable CSL receiver. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aCslPeriod CSL period, 0 for disabling CSL. + * @param[in] aShortAddr The short source address of CSL receiver's peer. + * @param[in] aExtAddr The extended source address of CSL receiver's peer. + * + * @note Platforms should use CSL peer addresses to include CSL IE when generating enhanced acks. + * + * @retval kErrorNotImplemented Radio driver doesn't support CSL. + * @retval kErrorFailed Other platform specific errors. + * @retval kErrorNone Successfully enabled or disabled CSL. + * + */ +otError otPlatRadioEnableCsl(otInstance * aInstance, + uint32_t aCslPeriod, + otShortAddress aShortAddr, + const otExtAddress *aExtAddr); + +/** + * Update CSL sample time in radio driver. + * + * Sample time is stored in radio driver as a copy to calculate phase when sending ACK with CSL IE. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aCslSampleTime The latest sample time. + * + */ +void otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTime); + +/** + * Get the current accuracy, in units of ± ppm, of the clock used for scheduling CSL operations. + * + * @note Platforms may optimize this value based on operational conditions (i.e.: temperature). + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The current CSL rx/tx scheduling drift, in units of ± ppm. + * + */ +uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance); + +/** + * The fixed uncertainty of the Device for scheduling CSL Transmissions in units of 10 microseconds. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns The CSL Uncertainty in units of 10 us. + * + */ +uint8_t otPlatRadioGetCslUncertainty(otInstance *aInstance); + +/** + * Set the max transmit power for a specific channel. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aChannel The radio channel. + * @param[in] aMaxPower The max power in dBm, passing OT_RADIO_RSSI_INVALID will disable this channel. + * + * @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented + * @retval OT_ERROR_INVALID_ARGS The specified channel is not valid. + * @retval OT_ERROR_FAILED Other platform specific errors. + * @retval OT_ERROR_NONE Successfully set max transmit power. + * + */ +otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower); + +/** + * Set the region code. + * + * The radio region format is the 2-bytes ascii representation of the + * ISO 3166 alpha-2 code. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aRegionCode The radio region. + * + * @retval OT_ERROR_FAILED Other platform specific errors. + * @retval OT_ERROR_NONE Successfully set region code. + * + */ +otError otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode); + +/** + * Get the region code. + * + * The radio region format is the 2-bytes ascii representation of the + * ISO 3166 alpha-2 code. + + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aRegionCode The radio region. + * + * @retval OT_ERROR_INVALID_ARGS @p aRegionCode is nullptr. + * @retval OT_ERROR_FAILED Other platform specific errors. + * @retval OT_ERROR_NONE Successfully got region code. + * + */ +otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode); + +/** + * Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator. + * + * After Enhanced-ACK Based Probing is configured by a specific Probing Initiator, the Enhanced-ACK sent to that + * node should include Vendor-Specific IE containing Link Metrics data. This method informs the radio to start/stop to + * collect Link Metrics data and include Vendor-Specific IE that containing the data in Enhanced-ACK sent to that + * Probing Initiator. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aLinkMetrics This parameter specifies what metrics to query. Per spec 4.11.3.4.4.6, at most 2 metrics + * can be specified. The probing would be disabled if @p `aLinkMetrics` is bitwise 0. + * @param[in] aShortAddress The short address of the Probing Initiator. + * @param[in] aExtAddress The extended source address of the Probing Initiator. @p aExtAddr MUST NOT be `NULL`. + * + * @retval OT_ERROR_NONE Successfully configured the Enhanced-ACK Based Probing. + * @retval OT_ERROR_INVALID_ARGS @p aExtAddress is `NULL`. + * @retval OT_ERROR_NOT_FOUND The Initiator indicated by @p aShortAddress is not found when trying to clear. + * @retval OT_ERROR_NO_BUFS No more Initiator can be supported. + * + */ +otError otPlatRadioConfigureEnhAckProbing(otInstance * aInstance, + otLinkMetrics aLinkMetrics, + otShortAddress aShortAddress, + const otExtAddress *aExtAddress); + +/** + * @} + * + */ + +/** + * @} + * + */ + +#ifdef __cplusplus +} // end of extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_RADIO_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/toolchain.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/toolchain.h new file mode 100644 index 0000000..5610985 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/include/openthread/platform/toolchain.h @@ -0,0 +1,288 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @addtogroup plat-toolchain + * + * @brief + * This module defines a toolchain abstraction layer through macros. + * + * Usage: + * + * @code + * + * typedef + * OT_TOOL_PACKED_BEGIN + * struct + * { + * char mField1; + * union + * { + * char mField2; + * long mField3; + * } OT_TOOL_PACKED_FIELD; + * } OT_TOOL_PACKED_END packed_struct_t; + * + * @endcode + * + * @{ + * + */ + +#ifndef OPENTHREAD_PLATFORM_TOOLCHAIN_H_ +#define OPENTHREAD_PLATFORM_TOOLCHAIN_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @def OT_MUST_USE_RESULT + * + * Compiler-specific indication that a class or enum must be used when it is + * the return value of a function. + * + * @note This is currently only available with clang (C++17 implements it + * as attribute [[nodiscard]]). + * @note To suppress the 'unused-result' warning/error, please use the + * '-Wno-unused-result' compiler option. + * + */ +#if defined(__clang__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 9)) +#define OT_MUST_USE_RESULT __attribute__((warn_unused_result)) +#else +#define OT_MUST_USE_RESULT +#endif + +/** + * @def OT_TOOL_PACKED_BEGIN + * + * Compiler-specific indication that a class or struct must be byte packed. + * + */ + +/** + * @def OT_TOOL_PACKED_FIELD + * + * Indicate to the compiler a nested struct or union to be packed + * within byte packed class or struct. + * + */ + +/** + * @def OT_TOOL_PACKED_END + * + * Compiler-specific indication at the end of a byte packed class or struct. + * + */ + +/** + * @def OT_TOOL_WEAK + * + * Compiler-specific weak symbol modifier. + * + */ + +// =========== TOOLCHAIN SELECTION : START =========== + +#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) || defined(__TI_ARM__) + +// https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html +// http://www.keil.com/support/man/docs/armcc/armcc_chr1359124973480.htm + +#define OT_TOOL_PACKED_BEGIN +#define OT_TOOL_PACKED_FIELD __attribute__((packed)) +#define OT_TOOL_PACKED_END __attribute__((packed)) +#define OT_TOOL_WEAK __attribute__((weak)) + +#elif defined(__ICCARM__) || defined(__ICC8051__) + +// http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf + +#include "intrinsics.h" + +#define OT_TOOL_PACKED_BEGIN __packed +#define OT_TOOL_PACKED_FIELD +#define OT_TOOL_PACKED_END +#define OT_TOOL_WEAK __weak + +#elif defined(__SDCC) + +// Structures are packed by default in sdcc, as it primarily targets 8-bit MCUs. + +#define OT_TOOL_PACKED_BEGIN +#define OT_TOOL_PACKED_FIELD +#define OT_TOOL_PACKED_END +#define OT_TOOL_WEAK + +#else + +#error "Error: No valid Toolchain specified" + +// Symbols for Doxygen + +#define OT_TOOL_PACKED_BEGIN +#define OT_TOOL_PACKED_FIELD +#define OT_TOOL_PACKED_END +#define OT_TOOL_WEAK + +#endif + +// =========== TOOLCHAIN SELECTION : END =========== + +/** + * @def OT_UNUSED_VARIABLE + * + * Suppress unused variable warning in specific toolchains. + * + */ + +/** + * @def OT_UNREACHABLE_CODE + * + * Suppress Unreachable code warning in specific toolchains. + * + */ + +#if defined(__ICCARM__) + +#include + +#define OT_UNUSED_VARIABLE(VARIABLE) \ + do \ + { \ + if (&VARIABLE == NULL) \ + { \ + } \ + } while (false) + +#define OT_UNREACHABLE_CODE(CODE) \ + _Pragma("diag_suppress=Pe111") _Pragma("diag_suppress=Pe128") CODE _Pragma("diag_default=Pe111") \ + _Pragma("diag_default=Pe128") + +#elif defined(__CC_ARM) + +#include + +#define OT_UNUSED_VARIABLE(VARIABLE) \ + do \ + { \ + if (&VARIABLE == NULL) \ + { \ + } \ + } while (false) + +#define OT_UNREACHABLE_CODE(CODE) CODE + +#elif defined(__TI_ARM__) + +#include + +#define OT_UNUSED_VARIABLE(VARIABLE) \ + do \ + { \ + if (&VARIABLE == NULL) \ + { \ + } \ + } while (false) + +/* + * #112-D statement is unreachable + * #129-D loop is not reachable + */ +#define OT_UNREACHABLE_CODE(CODE) \ + _Pragma("diag_push") _Pragma("diag_suppress 112") _Pragma("diag_suppress 129") CODE _Pragma("diag_pop") + +#else + +#define OT_UNUSED_VARIABLE(VARIABLE) \ + do \ + { \ + (void)(VARIABLE); \ + } while (false) + +#define OT_UNREACHABLE_CODE(CODE) CODE + +#endif + +/* + * Keil and IAR compiler doesn't provide type limits for C++. + */ +#ifdef __cplusplus +#if defined(__CC_ARM) || defined(__ICCARM__) + +#ifndef UINT8_MAX +#define UINT8_MAX 0xff +#endif + +#ifndef UINT16_MAX +#define UINT16_MAX 0xffff +#endif + +#endif +#endif + +#ifdef __APPLE__ +#define OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT(...) \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wgnu-folding-constant\"") \ + __VA_ARGS__ _Pragma("GCC diagnostic pop") +#else +#define OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT(...) __VA_ARGS__ +#endif + +/** + * @def OT_FALL_THROUGH + * + * Suppress fall through warning in specific compiler. + * + */ +#if defined(__cplusplus) && (__cplusplus >= 201703L) +#define OT_FALL_THROUGH [[fallthrough]] +#elif defined(__clang__) +#define OT_FALL_THROUGH [[clang::fallthrough]] +#elif defined(__GNUC__) && (__GNUC__ >= 7) +#define OT_FALL_THROUGH __attribute__((fallthrough)) +#else +#define OT_FALL_THROUGH \ + do \ + { \ + } while (false) /* fallthrough */ +#endif + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_PLATFORM_TOOLCHAIN_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/arg_macros.hpp b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/arg_macros.hpp new file mode 100644 index 0000000..e832f2f --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/arg_macros.hpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2020, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes macros for parsing variadic arguments. + */ + +#ifndef OT_ARG_MACROS_HPP_ +#define OT_ARG_MACROS_HPP_ + +/** + * This macro returns the first argument in a list of input arguments. + * + * @param[in] ... A list of arguments (MUST contain at least one). + * + * @returns The first argument in the given list of input arguments. + * + */ +#define OT_FIRST_ARG(...) _OT_GET_FIRST_ARG(__VA_ARGS__, JUNK) + +/** + * This macro returns the second argument in a list of input arguments if any. + * + * @note: This macro works when the list contains either one or two arguments. + * + * @param[in] ... A list of arguments (MUST contain either one or two arguments). + * + * @returns The second argument if any. + * + */ +#define OT_SECOND_ARG(...) _OT_GET_SECOND_ARG(_OT_HAS_ONE_ARG_OR_TWO_ARGS(__VA_ARGS__), __VA_ARGS__) + +/** + * This macro expands to comma separated list of arguments excluding the first one. + * + * If there is only one argument, it expands to empty. If there is more than one argument, it expands to an initial + * comma followed by all the rest of arguments excluding the first one. + * + * @note: This macro supports up to 20 arguments. + * + * @param[in] ... A list of arguments (MUST contain at least one). + * + * @returns A comma separated list of arguments excluding the first one. + * + */ +#define OT_REST_ARGS(...) _OT_GET_REST_ARGS(_OT_HAS_ONE_ARG_VS_TWO_OR_MORE(__VA_ARGS__), __VA_ARGS__) + +//--------------------------------------------------------------------------------------------------------------------- +// Private/local macros - for use in this header only. + +#define _OT_GET_FIRST_ARG(aFirst, ...) aFirst + +#define _OT_HAS_ONE_ARG_OR_TWO_ARGS(...) _OT_SELECT_3(__VA_ARGS__, TWO_ARGS, ONE_ARG, JUNK) +#define _OT_SELECT_3(a1, a2, a3, ...) a3 + +#define _OT_GET_SECOND_ARG(aNum, ...) _OT_GET_SECOND_APPEND_NUM_ARGS(aNum, __VA_ARGS__) +#define _OT_GET_SECOND_APPEND_NUM_ARGS(aNum, ...) _OT_GET_SECOND_WITH_##aNum(__VA_ARGS__) + +#define _OT_GET_SECOND_WITH_ONE_ARG(aFirst) +#define _OT_GET_SECOND_WITH_TWO_ARGS(aFirst, aSecond) aSecond + +#define _OT_GET_REST_ARGS(aNum, ...) _OT_GET_REST_APPEND_NUM_ARGS(aNum, __VA_ARGS__) +#define _OT_GET_REST_APPEND_NUM_ARGS(aNum, ...) _OT_GET_REST_WITH_##aNum(__VA_ARGS__) + +#define _OT_GET_REST_WITH_ONE_ARG(aFirst) +#define _OT_GET_REST_WITH_TWO_OR_MORE_ARGS(aFirst, ...) , __VA_ARGS__ + +#define _OT_HAS_ONE_ARG_VS_TWO_OR_MORE(...) \ + _OT_SELECT_20(__VA_ARGS__, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, \ + TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, \ + TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, \ + TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, TWO_OR_MORE_ARGS, ONE_ARG, JUNK) + +#define _OT_SELECT_20(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, ...) \ + a20 + +#endif // OT_ARG_MACROS_HPP_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/code_utils.hpp b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/code_utils.hpp new file mode 100644 index 0000000..78e01c6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core/common/code_utils.hpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2016, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes macros for validating runtime conditions. + */ + +#ifndef CODE_UTILS_HPP_ +#define CODE_UTILS_HPP_ + +#include + +#include + +#include "common/arg_macros.hpp" + +/** + * This macro calculates the number of elements in an array. + * + * @param[in] aArray Name of the array variable. + * + * @returns Number of elements in the array. + * + */ +#define OT_ARRAY_LENGTH(aArray) (sizeof(aArray) / sizeof(aArray[0])) + +/** + * This macro returns a pointer to end of a given array (pointing to the past-the-end element). + * + * Note that the past-the-end element is a theoretical element that would follow the last element in the array. It does + * not point to an actual element in array, and thus should not be dereferenced. + * + * @param[in] Name of the array variable + * + * @returns Pointer to the past-the-end element. + * + */ +#define OT_ARRAY_END(aArray) (&aArray[OT_ARRAY_LENGTH(aArray)]) + +/** + * This macro returns a pointer aligned by @p aAlignment. + * + * @param[in] aPointer A pointer to contiguous space. + * @param[in] aAlignment The desired alignment. + * + * @returns The aligned pointer. + * + */ +#define OT_ALIGN(aPointer, aAlignment) \ + ((void *)(((uintptr_t)(aPointer) + (aAlignment)-1UL) & ~((uintptr_t)(aAlignment)-1UL))) + +// Calculates the aligned variable size. +#define OT_ALIGNED_VAR_SIZE(size, align_type) (((size) + (sizeof(align_type) - 1)) / sizeof(align_type)) + +// Allocate the structure using "raw" storage. +#define OT_DEFINE_ALIGNED_VAR(name, size, align_type) \ + align_type name[(((size) + (sizeof(align_type) - 1)) / sizeof(align_type))] + +/** + * This macro returns the smaller of @p a and @p b. + * + */ +#define OT_MIN(a, b) ((b) < (a) ? (b) : (a)) + +/** + * This macro returns the greater of @p a and @p b. + * + */ +#define OT_MAX(a, b) ((a) < (b) ? (b) : (a)) + +/** + * This macro checks for the specified status, which is expected to commonly be successful, and branches to the local + * label 'exit' if the status is unsuccessful. + * + * @param[in] aStatus A scalar status to be evaluated against zero (0). + * + */ +#define SuccessOrExit(aStatus) \ + do \ + { \ + if ((aStatus) != 0) \ + { \ + goto exit; \ + } \ + } while (false) + +/** + * This macro checks for the specified condition, which is expected to commonly be true, and both executes @a ... and + * branches to the local label 'exit' if the condition is false. + * + * @param[in] aCondition A Boolean expression to be evaluated. + * @param[in] aAction An optional expression or block to execute when the assertion fails. + * + */ +#define VerifyOrExit(...) \ + do \ + { \ + if (!(OT_FIRST_ARG(__VA_ARGS__))) \ + { \ + OT_SECOND_ARG(__VA_ARGS__); \ + goto exit; \ + } \ + } while (false) + +/** + * This macro unconditionally executes @a ... and branches to the local label 'exit'. + * + * @note The use of this interface implies neither success nor failure for the overall exit status of the enclosing + * function body. + * + * @param[in] ... An optional expression or block to execute when the assertion fails. + * + */ +#define ExitNow(...) \ + do \ + { \ + __VA_ARGS__; \ + goto exit; \ + } while (false) + +/* + * This macro executes the `statement` and ignores the return value. + * + * This is primarily used to indicate the intention of developer that the return value of a function/method can be + * safely ignored. + * + * @param[in] aStatement The function/method to execute. + * + */ +#define IgnoreReturnValue(aStatement) \ + do \ + { \ + if (aStatement) \ + { \ + } \ + } while (false) + +/** + * This function ignores an error explicitly. + * + * This is primarily used to indicate the intention of developer that + * the error can be safely ignored or there is guaranteed to be no error. + * + * @param[in] aError The error to be ignored. + * + */ +static inline void IgnoreError(otError aError) +{ + OT_UNUSED_VARIABLE(aError); +} + +#endif // CODE_UTILS_HPP_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/IncludeFile.QorvoQPG7015M_rpi_cli_ftd_socket b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/IncludeFile.QorvoQPG7015M_rpi_cli_ftd_socket new file mode 100644 index 0000000..91df87c --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/IncludeFile.QorvoQPG7015M_rpi_cli_ftd_socket @@ -0,0 +1,248 @@ +# To be used with an 'include' statement in another makefile +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/qpg7015m_rpi_cli_ftd_socket.py + +PYTHON_BIN?=/usr/bin/python3 + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_config.h + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_config.h +FLAGS= +FLAGS+=-DGP_CONFIG_HEADER + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) + + +#Depends on: +# src: +COMPS+=gpBaseComps +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) + + +#Depends on: +# src: +COMPS+=gpBsp +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) + + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) + + +#Depends on: +# src: gpAssert +COMPS+=gpLog +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) + + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC+=$(INC_gpMacCore) + + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC+=$(INC_gpMacDispatcher) + + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) + + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) + + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) + + +#Depends on: +# src: +COMPS+=gpVersion +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC+=$(INC_gpVersion) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + + +#Depends on: +# src: gpAssert, gpReset, silexCryptoSoc, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=rt +LIB_halLinux+=pthread +LIB+=$(LIB_halLinux) + + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/qpg7015m +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC+=$(INC_qvOT) + + +#Depends on: +# src: gpAssert, gpLog +COMPS+=silexCryptoSoc +INC_silexCryptoSoc:= +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/silexCryptoSoc/inc +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/include +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src +INC+=$(INC_silexCryptoSoc) + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_config.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_config.h new file mode 100644 index 0000000..7d534bf --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_config.h @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_config.h" + * + */ + +#ifndef _QORVO_CONFIG_H_ +#define _QORVO_CONFIG_H_ + +/* + * Version info + */ + +#define GP_CHANGELIST 144207 +#define GP_VERSIONINFO_APP QorvoQPG7015M_rpi_cli_ftd_socket +#define GP_VERSIONINFO_BASE_COMPS 0,0,0,0 +#define GP_VERSIONINFO_BLE_COMPS 2,10,3,1 +#define GP_VERSIONINFO_DATE 2023-07-06 +#define GP_VERSIONINFO_GLOBAL_VERSION 1,2,0,4 +#define GP_VERSIONINFO_HOST UNKNOWN +#define GP_VERSIONINFO_PROJECT P959_OpenThread +#define GP_VERSIONINFO_USER ak105542@UNKNOWN + + +/* + * Component: gpAssert + */ + +/* Length of the filename string to be printed */ +#define GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH 160 + + +/* + * Component: gpBsp + */ + +/* Contains filename of BSP header file to include */ +#define GP_BSP_FILENAME "gpBsp_linux_user.h" + + +/* + * Component: gpCom + */ + +/* To be specified when using multiple comms */ +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_IOCTL_USER1 + +/* Maximum amount of modules supported for Rx handling by gpCom. Environment already calculates minimal required module ID's */ +#define GP_COM_MAX_NUMBER_OF_MODULE_IDS 10 + +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE 500 + +#define GP_COM_RX_PACKET_BUFFERS 50 + + +/* + * Component: gphal + */ + +/* Amount of 64-bit long IEEE addresses entries to keep data pending for */ +#define GPHAL_DP_LONG_LIST_MAX 10 + +/* Amount of 16-bit short address entries to keep data pending for */ +#define GPHAL_DP_SHORT_LIST_MAX 10 + + +/* + * Component: gpMacCore + */ + +/* Number of known Neighbours for use with indirect transmission */ +#define GP_MACCORE_MAX_NEIGHBOURS 10 + + +/* + * Component: gpPoolMem + */ + +/* Number of packet descriptors */ +#define GP_PD_NR_OF_HANDLES 20 + + +/* + * Component: gpSched + */ + +#define GP_SCHED_EVENT_LIST_SIZE 50 + +/* Don't include the implementation for our mainloop MAIN_FUNCTION_NAME */ +#define GP_SCHED_EXTERNAL_MAIN + +/* Callback after every main loop iteration. */ +#define GP_SCHED_NR_OF_IDLE_CALLBACKS 0 + + +/* + * Component: silexCryptoSoc + */ + +#define AES_GCM_EMABLED 0 + +#define AES_HW_KEYS_ENABLED 0 + +#define AES_MASK_ENABLED 0 + + +#include "qorvo_internals.h" + +#endif //_QORVO_CONFIG_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_internals.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_internals.h new file mode 100644 index 0000000..97c2ed6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_ftd_socket/gen/qorvo_internals.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_internals.h" + * + */ + +#ifndef _QORVO_INTERNALS_H_ +#define _QORVO_INTERNALS_H_ + +/* + * Enabled components + */ + +#define GP_COMP_ASSERT +#define GP_COMP_BASECOMPS +#define GP_COMP_COM +#define GP_COMP_MACDISPATCHER +#define GP_COMP_PD +#define GP_COMP_POOLMEM +#define GP_COMP_RANDOM +#define GP_COMP_VERSION + +/* + * Components numeric ids + */ + +#define GP_COMPONENT_ID_APP 1 +#define GP_COMPONENT_ID_ASSERT 29 +#define GP_COMPONENT_ID_BASECOMPS 35 +#define GP_COMPONENT_ID_BSP 8 +#define GP_COMPONENT_ID_COM 10 +#define GP_COMPONENT_ID_ENCRYPTION 124 +#define GP_COMPONENT_ID_GPHAL 7 +#define GP_COMPONENT_ID_HALLINUX 6 +#define GP_COMPONENT_ID_LOG 11 +#define GP_COMPONENT_ID_MACCORE 109 +#define GP_COMPONENT_ID_MACDISPATCHER 114 +#define GP_COMPONENT_ID_PAD 126 +#define GP_COMPONENT_ID_PD 104 +#define GP_COMPONENT_ID_POOLMEM 106 +#define GP_COMPONENT_ID_QVOT 157 +#define GP_COMPONENT_ID_RANDOM 108 +#define GP_COMPONENT_ID_RESET 33 +#define GP_COMPONENT_ID_RXARBITER 2 +#define GP_COMPONENT_ID_SCHED 9 +#define GP_COMPONENT_ID_SILEXCRYPTOSOC 54 +#define GP_COMPONENT_ID_STAT 22 +#define GP_COMPONENT_ID_UTILS 4 +#define GP_COMPONENT_ID_VERSION 129 +#define GP_COMPONENT_ID_WMRK 51 + +/* + * Other flags + */ + +#define GP_DIVERSITY_LOG +#define GP_DIVERSITY_NR_OF_STACKS 2 +#define GP_GIT_SHA 2334f506f9cba16a755256babb1eb0a69878a600 +#define GP_GIT_SHA_SHORT 2334f +#define GP_SCHED_DEFAULT_GOTOSLEEP_THRES 1000 +#define OPENTHREAD_COMMISSIONER +#define QORVOOPENTHREAD_MAX_CHILDREN 64 +#define QVOT_THREAD_1_2 + +#endif //_QORVO_INTERNALS_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/IncludeFile.QorvoQPG7015M_rpi_cli_mtd_socket b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/IncludeFile.QorvoQPG7015M_rpi_cli_mtd_socket new file mode 100644 index 0000000..0d9fdf5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/IncludeFile.QorvoQPG7015M_rpi_cli_mtd_socket @@ -0,0 +1,248 @@ +# To be used with an 'include' statement in another makefile +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/qpg7015m_rpi_cli_mtd_socket.py + +PYTHON_BIN?=/usr/bin/python3 + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_config.h + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_config.h +FLAGS= +FLAGS+=-DGP_CONFIG_HEADER + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) + + +#Depends on: +# src: +COMPS+=gpBaseComps +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) + + +#Depends on: +# src: +COMPS+=gpBsp +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) + + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) + + +#Depends on: +# src: gpAssert +COMPS+=gpLog +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) + + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC+=$(INC_gpMacCore) + + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC+=$(INC_gpMacDispatcher) + + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) + + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) + + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) + + +#Depends on: +# src: +COMPS+=gpVersion +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC+=$(INC_gpVersion) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + + +#Depends on: +# src: gpAssert, gpReset, silexCryptoSoc, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=rt +LIB_halLinux+=pthread +LIB+=$(LIB_halLinux) + + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/qpg7015m +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC+=$(INC_qvOT) + + +#Depends on: +# src: gpAssert, gpLog +COMPS+=silexCryptoSoc +INC_silexCryptoSoc:= +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/silexCryptoSoc/inc +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/include +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src +INC+=$(INC_silexCryptoSoc) + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_config.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_config.h new file mode 100644 index 0000000..fccad79 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_config.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_config.h" + * + */ + +#ifndef _QORVO_CONFIG_H_ +#define _QORVO_CONFIG_H_ + +/* + * Version info + */ + +#define GP_CHANGELIST 144207 +#define GP_VERSIONINFO_APP QorvoQPG7015M_rpi_cli_mtd_socket +#define GP_VERSIONINFO_BASE_COMPS 0,0,0,0 +#define GP_VERSIONINFO_BLE_COMPS 2,10,3,1 +#define GP_VERSIONINFO_DATE 2023-07-06 +#define GP_VERSIONINFO_GLOBAL_VERSION 1,2,0,4 +#define GP_VERSIONINFO_HOST UNKNOWN +#define GP_VERSIONINFO_PROJECT P959_OpenThread +#define GP_VERSIONINFO_USER ak105542@UNKNOWN + + +/* + * Component: gpAssert + */ + +/* Length of the filename string to be printed */ +#define GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH 160 + + +/* + * Component: gpBsp + */ + +/* Contains filename of BSP header file to include */ +#define GP_BSP_FILENAME "gpBsp_linux_user.h" + + +/* + * Component: gpCom + */ + +/* To be specified when using multiple comms */ +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_IOCTL_USER1 + +/* Maximum amount of modules supported for Rx handling by gpCom. Environment already calculates minimal required module ID's */ +#define GP_COM_MAX_NUMBER_OF_MODULE_IDS 10 + +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE 500 + +#define GP_COM_RX_PACKET_BUFFERS 50 + + +/* + * Component: gpPoolMem + */ + +/* Number of packet descriptors */ +#define GP_PD_NR_OF_HANDLES 20 + + +/* + * Component: gpSched + */ + +#define GP_SCHED_EVENT_LIST_SIZE 50 + +/* Don't include the implementation for our mainloop MAIN_FUNCTION_NAME */ +#define GP_SCHED_EXTERNAL_MAIN + +/* Callback after every main loop iteration. */ +#define GP_SCHED_NR_OF_IDLE_CALLBACKS 0 + + +/* + * Component: silexCryptoSoc + */ + +#define AES_GCM_EMABLED 0 + +#define AES_HW_KEYS_ENABLED 0 + +#define AES_MASK_ENABLED 0 + + +#include "qorvo_internals.h" + +#endif //_QORVO_CONFIG_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_internals.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_internals.h new file mode 100644 index 0000000..3d82b9d --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_cli_mtd_socket/gen/qorvo_internals.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_internals.h" + * + */ + +#ifndef _QORVO_INTERNALS_H_ +#define _QORVO_INTERNALS_H_ + +/* + * Enabled components + */ + +#define GP_COMP_ASSERT +#define GP_COMP_BASECOMPS +#define GP_COMP_COM +#define GP_COMP_MACDISPATCHER +#define GP_COMP_PD +#define GP_COMP_POOLMEM +#define GP_COMP_RANDOM +#define GP_COMP_VERSION + +/* + * Components numeric ids + */ + +#define GP_COMPONENT_ID_APP 1 +#define GP_COMPONENT_ID_ASSERT 29 +#define GP_COMPONENT_ID_BASECOMPS 35 +#define GP_COMPONENT_ID_BSP 8 +#define GP_COMPONENT_ID_COM 10 +#define GP_COMPONENT_ID_ENCRYPTION 124 +#define GP_COMPONENT_ID_GPHAL 7 +#define GP_COMPONENT_ID_HALLINUX 6 +#define GP_COMPONENT_ID_LOG 11 +#define GP_COMPONENT_ID_MACCORE 109 +#define GP_COMPONENT_ID_MACDISPATCHER 114 +#define GP_COMPONENT_ID_PAD 126 +#define GP_COMPONENT_ID_PD 104 +#define GP_COMPONENT_ID_POOLMEM 106 +#define GP_COMPONENT_ID_QVOT 157 +#define GP_COMPONENT_ID_RANDOM 108 +#define GP_COMPONENT_ID_RESET 33 +#define GP_COMPONENT_ID_RXARBITER 2 +#define GP_COMPONENT_ID_SCHED 9 +#define GP_COMPONENT_ID_SILEXCRYPTOSOC 54 +#define GP_COMPONENT_ID_STAT 22 +#define GP_COMPONENT_ID_UTILS 4 +#define GP_COMPONENT_ID_VERSION 129 +#define GP_COMPONENT_ID_WMRK 51 + +/* + * Other flags + */ + +#define GP_DIVERSITY_LOG +#define GP_DIVERSITY_NR_OF_STACKS 2 +#define GP_GIT_SHA 2334f506f9cba16a755256babb1eb0a69878a600 +#define GP_GIT_SHA_SHORT 2334f +#define GP_SCHED_DEFAULT_GOTOSLEEP_THRES 1000 +#define QVOT_THREAD_1_2 + +#endif //_QORVO_INTERNALS_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/IncludeFile.QorvoQPG7015M_rpi_rcp_socket b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/IncludeFile.QorvoQPG7015M_rpi_rcp_socket new file mode 100644 index 0000000..f0c2c48 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/IncludeFile.QorvoQPG7015M_rpi_rcp_socket @@ -0,0 +1,248 @@ +# To be used with an 'include' statement in another makefile +#Generated from: +# $(BASEDIR)/code/Applications/P959_OpenThread/apps/lib_qorvo/qpg7015m_rpi_rcp_socket.py + +PYTHON_BIN?=/usr/bin/python3 + +CONFIG_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_config.h +INTERNALS_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_internals.h +PREINCLUDE_HEADER:=$(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_config.h + +#Compilation flags are defined in $(BASEDIR)/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_config.h +FLAGS= +FLAGS+=-DGP_CONFIG_HEADER + +PREBUILD_SCRIPT:= + +POSTBUILD_SCRIPT:= + +#Component sources +#Depends on: +# src: gpLog +COMPS+=gpAssert +INC_gpAssert:= +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc +INC_gpAssert+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpAssert/inc/gen +INC+=$(INC_gpAssert) + + +#Depends on: +# src: +COMPS+=gpBaseComps +INC_gpBaseComps:= +INC_gpBaseComps+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpBaseComps/inc +INC+=$(INC_gpBaseComps) + + +#Depends on: +# src: +COMPS+=gpBsp +INC_gpBsp:= +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/BLE +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FoundationAndSilicon +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/FTS +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/Gateway +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PeripheralExamples +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/PTC +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/RemoteControl +INC_gpBsp+=-I$(BASEDIR)/code/Components/Qorvo/BSP/gpBsp/inc/SmartHomeAndLighting +INC+=$(INC_gpBsp) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpCom +INC_gpCom:= +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/inc/gen +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src +INC_gpCom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpCom/src/gen +INC+=$(INC_gpCom) + + +#Depends on: +# src: gpPd, gphal +COMPS+=gpEncryption +INC_gpEncryption:= +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc +INC_gpEncryption+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpEncryption/inc/gen +INC+=$(INC_gpEncryption) + + +#Depends on: +# src: gpAssert +COMPS+=gpLog +INC_gpLog:= +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc +INC_gpLog+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpLog/inc/gen +INC+=$(INC_gpLog) + + +#Depends on: +# src: gphal, gpAssert, gpPd, gpPad, gpRxArbiter, gpPoolMem, gpEncryption +# inc: gpStat +COMPS+=gpMacCore +INC_gpMacCore:= +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/src +INC_gpMacCore+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacCore/inc/gen +INC+=$(INC_gpMacCore) + + +#Depends on: +# src: +# inc: gpStat, gpMacCore, gpAssert, gpPd, gpSched +COMPS+=gpMacDispatcher +INC_gpMacDispatcher:= +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/src +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC_gpMacDispatcher+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpMacDispatcher/inc/gen +INC+=$(INC_gpMacDispatcher) + + +#Depends on: +# src: gpLog, gpAssert, gphal +COMPS+=gpPad +INC_gpPad:= +INC_gpPad+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPad/inc +INC+=$(INC_gpPad) + + +#Depends on: +# src: gpLog, gpAssert, gpPoolMem +# inc: gpSched, gphal +COMPS+=gpPd +INC_gpPd:= +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc +INC_gpPd+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gpPd/inc/gen +INC+=$(INC_gpPd) + + +#Depends on: +# src: gpLog, gpAssert, gpWmrk +# inc: gpPd +COMPS+=gpPoolMem +INC_gpPoolMem:= +INC_gpPoolMem+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpPoolMem/inc +INC+=$(INC_gpPoolMem) + + +#Depends on: +# src: +# inc: gpLog, gpSched +COMPS+=gpRandom +INC_gpRandom:= +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc +INC_gpRandom+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpRandom/inc/gen +INC+=$(INC_gpRandom) + + +#Depends on: +# src: gpLog +COMPS+=gpReset +INC_gpReset:= +INC_gpReset+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpReset/inc +INC+=$(INC_gpReset) + + +#Depends on: +# src: +# inc: gpAssert, gphal, gpLog +COMPS+=gpRxArbiter +INC_gpRxArbiter:= +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc +INC_gpRxArbiter+=-I$(BASEDIR)/code/Components/Qorvo/802_15_4/gpRxArbiter/inc/gen +INC+=$(INC_gpRxArbiter) + + +#Depends on: +# src: gpAssert, gpLog, gpUtils +COMPS+=gpSched +INC_gpSched:= +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/inc +INC_gpSched+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpSched/src +INC+=$(INC_gpSched) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpStat +INC_gpStat:= +INC_gpStat+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpStat/inc +INC+=$(INC_gpStat) + + +#Depends on: +# src: gpAssert, gpLog +COMPS+=gpUtils +INC_gpUtils:= +INC_gpUtils+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpUtils/inc +INC+=$(INC_gpUtils) + + +#Depends on: +# src: +COMPS+=gpVersion +INC_gpVersion:= +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/src +INC_gpVersion+=-I$(BASEDIR)/code/Components/Qorvo/OS/gpVersion/inc/gen +INC+=$(INC_gpVersion) + + +#Depends on: +# src: gpLog, gpAssert +COMPS+=gpWmrk +INC_gpWmrk:= +INC_gpWmrk+=-I$(BASEDIR)/code/Components/Qorvo/BaseUtils/gpWmrk/inc +INC+=$(INC_gpWmrk) + + +#Depends on: +# src: gpAssert, gpReset, silexCryptoSoc, gpSched +# inc: gpStat, gpBsp, gpEncryption +COMPS+=gphal +INC_gphal:= +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc +INC_gphal+=-I$(BASEDIR)/code/Components/Qorvo/HAL_RF/gphal/inc/gen +INC+=$(INC_gphal) + + +#Depends on: +# src: gpBsp, gpAssert +COMPS+=halLinux +INC_halLinux:= +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/inc +INC_halLinux+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/halLinux/user/inc +INC+=$(INC_halLinux) +LIB_halLinux:= +LIB_halLinux+=rt +LIB_halLinux+=pthread +LIB+=$(LIB_halLinux) + + +#Depends on: +# src: +# inc: gpAssert, gpBaseComps, gpSched, gpPd, gpMacDispatcher, gpRxArbiter, gpRandom, gpCom +COMPS+=qvOT +INC_qvOT:= +INC_qvOT+=-I$(BASEDIR)/code/Applications/P959_OpenThread/qvOT/inc +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/src/qpg7015m +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/include +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/src/core +INC_qvOT+=-I$(BASEDIR)/code/Components/ThirdParty/P959_ot-qorvo/openthread/examples/platforms +INC+=$(INC_qvOT) + + +#Depends on: +# src: gpAssert, gpLog +COMPS+=silexCryptoSoc +INC_silexCryptoSoc:= +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/Qorvo/HAL_PLATFORM/silexCryptoSoc/inc +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/include +INC_silexCryptoSoc+=-I$(BASEDIR)/code/Components/ThirdParty/Silex/cryptosoc/libcryptosoc/src +INC+=$(INC_silexCryptoSoc) + + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_config.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_config.h new file mode 100644 index 0000000..201b107 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_config.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_config.h" + * + */ + +#ifndef _QORVO_CONFIG_H_ +#define _QORVO_CONFIG_H_ + +/* + * Version info + */ + +#define GP_CHANGELIST 144207 +#define GP_VERSIONINFO_APP QorvoQPG7015M_rpi_rcp_socket +#define GP_VERSIONINFO_BASE_COMPS 0,0,0,0 +#define GP_VERSIONINFO_BLE_COMPS 2,10,3,1 +#define GP_VERSIONINFO_DATE 2023-07-06 +#define GP_VERSIONINFO_GLOBAL_VERSION 1,2,0,4 +#define GP_VERSIONINFO_HOST UNKNOWN +#define GP_VERSIONINFO_PROJECT P959_OpenThread +#define GP_VERSIONINFO_USER ak105542@UNKNOWN + + +/* + * Component: gpAssert + */ + +/* Length of the filename string to be printed */ +#define GP_ASSERT_DIVERSITY_LOG_FILENAME_LENGTH 160 + + +/* + * Component: gpBsp + */ + +/* Contains filename of BSP header file to include */ +#define GP_BSP_FILENAME "gpBsp_linux_user.h" + + +/* + * Component: gpCom + */ + +/* To be specified when using multiple comms */ +#define GP_COM_DEFAULT_COMMUNICATION_ID GP_COM_COMM_ID_IOCTL_USER1 + +/* Maximum amount of modules supported for Rx handling by gpCom. Environment already calculates minimal required module ID's */ +#define GP_COM_MAX_NUMBER_OF_MODULE_IDS 10 + +#define GP_COM_MAX_PACKET_PAYLOAD_SIZE 500 + +#define GP_COM_RX_PACKET_BUFFERS 50 + + +/* + * Component: gpPoolMem + */ + +/* Number of packet descriptors */ +#define GP_PD_NR_OF_HANDLES 20 + + +/* + * Component: gpSched + */ + +#define GP_SCHED_EVENT_LIST_SIZE 50 + +/* Don't include the implementation for our mainloop MAIN_FUNCTION_NAME */ +#define GP_SCHED_EXTERNAL_MAIN + +/* Callback after every main loop iteration. */ +#define GP_SCHED_NR_OF_IDLE_CALLBACKS 0 + + +/* + * Component: silexCryptoSoc + */ + +#define AES_GCM_EMABLED 0 + +#define AES_HW_KEYS_ENABLED 0 + +#define AES_MASK_ENABLED 0 + + +#include "qorvo_internals.h" + +#endif //_QORVO_CONFIG_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_internals.h b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_internals.h new file mode 100644 index 0000000..3d82b9d --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/code/Work/Applications/P959_OpenThread/QorvoQPG7015M_rpi_rcp_socket/gen/qorvo_internals.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2020, Qorvo Inc + * + * This software is owned by Qorvo Inc + * and protected under applicable copyright laws. + * It is delivered under the terms of the license + * and is intended and supplied for use solely and + * exclusively with products manufactured by + * Qorvo Inc. + * + * + * THIS SOFTWARE IS PROVIDED IN AN "AS IS" + * CONDITION. NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, INCLUDING, BUT NOT + * LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * QORVO INC. SHALL NOT, IN ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL OR CONSEQUENTIAL DAMAGES, + * FOR ANY REASON WHATSOEVER. + * + */ + +/** @file "qorvo_internals.h" + * + */ + +#ifndef _QORVO_INTERNALS_H_ +#define _QORVO_INTERNALS_H_ + +/* + * Enabled components + */ + +#define GP_COMP_ASSERT +#define GP_COMP_BASECOMPS +#define GP_COMP_COM +#define GP_COMP_MACDISPATCHER +#define GP_COMP_PD +#define GP_COMP_POOLMEM +#define GP_COMP_RANDOM +#define GP_COMP_VERSION + +/* + * Components numeric ids + */ + +#define GP_COMPONENT_ID_APP 1 +#define GP_COMPONENT_ID_ASSERT 29 +#define GP_COMPONENT_ID_BASECOMPS 35 +#define GP_COMPONENT_ID_BSP 8 +#define GP_COMPONENT_ID_COM 10 +#define GP_COMPONENT_ID_ENCRYPTION 124 +#define GP_COMPONENT_ID_GPHAL 7 +#define GP_COMPONENT_ID_HALLINUX 6 +#define GP_COMPONENT_ID_LOG 11 +#define GP_COMPONENT_ID_MACCORE 109 +#define GP_COMPONENT_ID_MACDISPATCHER 114 +#define GP_COMPONENT_ID_PAD 126 +#define GP_COMPONENT_ID_PD 104 +#define GP_COMPONENT_ID_POOLMEM 106 +#define GP_COMPONENT_ID_QVOT 157 +#define GP_COMPONENT_ID_RANDOM 108 +#define GP_COMPONENT_ID_RESET 33 +#define GP_COMPONENT_ID_RXARBITER 2 +#define GP_COMPONENT_ID_SCHED 9 +#define GP_COMPONENT_ID_SILEXCRYPTOSOC 54 +#define GP_COMPONENT_ID_STAT 22 +#define GP_COMPONENT_ID_UTILS 4 +#define GP_COMPONENT_ID_VERSION 129 +#define GP_COMPONENT_ID_WMRK 51 + +/* + * Other flags + */ + +#define GP_DIVERSITY_LOG +#define GP_DIVERSITY_NR_OF_STACKS 2 +#define GP_GIT_SHA 2334f506f9cba16a755256babb1eb0a69878a600 +#define GP_GIT_SHA_SHORT 2334f +#define GP_SCHED_DEFAULT_GOTOSLEEP_THRES 1000 +#define QVOT_THREAD_1_2 + +#endif //_QORVO_INTERNALS_H_ diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/compilers/bcmcommon/compiler_defines.mk b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/compilers/bcmcommon/compiler_defines.mk new file mode 100644 index 0000000..1838dc5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/compilers/bcmcommon/compiler_defines.mk @@ -0,0 +1,77 @@ +#------- Toolchain ------------------------ + +TOOLCHAIN ?=$(error specify TOOLCHAIN dir) +TOOLCHAINBIN ?=$(TOOLCHAIN)/bin +ARCH ?=$(error specify ARCH) +CROSS_COMPILE ?=$(error specify CROSS_COMPILE) + +# Define programs and commands. +CC = $(TOOLCHAINBIN)/$(CROSS_COMPILE)gcc +CXX = $(TOOLCHAINBIN)/$(CROSS_COMPILE)g++ +AR = $(TOOLCHAINBIN)/$(CROSS_COMPILE)ar rsc +LINK = $(TOOLCHAINBIN)/$(CROSS_COMPILE)ld +OBJCOPY = $(TOOLCHAINBIN)/$(CROSS_COMPILE)objcopy +OBJDUMP = $(TOOLCHAINBIN)/$(CROSS_COMPILE)objdump +SIZE = $(TOOLCHAINBIN)/$(CROSS_COMPILE)size -A +NM = $(TOOLCHAINBIN)/$(CROSS_COMPILE)nm + +#------- Extensions ------------------------ + +PROGRAM_EXT :=elf +LIB_EXT :=a + +#------- Specific defines ------------------------ + +MCU_HAL ?= halLinux + +#------- C compiler options ------------------------ + +# Compiler flag to set the C Standard level. +# c89 = "ANSI" C +# gnu89 = c89 plus GCC extensions +# c99 = ISO C99 standard (not yet fully implemented) +# gnu99 = c99 plus GCC extensions +CFLAGS_COMPILER +=-std=gnu99 +CFLAGS_COMPILER +=$(subst $<,-Werror,$(filter $<,$(SRC_NOWARNING))) +ifneq (,$(PREINCLUDE_HEADER)) +CFLAGS_COMPILER +=-include $(PREINCLUDE_HEADER) +endif + +#------- C++ compiler options ------------------------ + +CXXFLAGS_COMPILER +=-std=c++11 +ifneq (,$(PREINCLUDE_HEADER)) +CXXFLAGS_COMPILER +=-include $(PREINCLUDE_HEADER) +endif + +#------- Assemble options ------------------------ + +ASFLAGS_COMPILER += + +#------- Linker options ------------------------ + +ifneq (,$(BUILDOPT_STRIP)) + # Strip symbols and debug info from executable file. + LDFLAGS_COMPILER += -Wl,--strip-all +endif + +# FIXME - Check use - Compiler flags to generate dependency files. +GENDEPFLAGS_COMPILER = -MM -MF $(DIRDEP)/$(*F).d -MT $(DIROBJ)/$(*F).o +#------- Library options ------------------------ + +#Check if real location of library was used +LIBFILES =$(wildcard $(LIB)) +LIBIMPLICIT =$(filter-out $(LIBFILES),$(LIB)) + +LIBFLAGS_DIR=$(sort $(subst \,/, $(patsubst %, -L%, $(dir $(LIBFILES))))) +#end up with -lLibName for full location and implicit location +LIBNAMES =$(sort $(addprefix -l,$(patsubst lib%,%,$(notdir $(basename $(LIBFILES)) $(LIBIMPLICIT))))) + +LIBFLAGS_COMPILER+=-Wl,--start-group $(LIBNAMES) -Wl,--end-group +ifneq (,$(LIBNAMES_WHOLE)) +LIBFLAGS_COMPILER+=-Wl,--whole-archive $(LIBNAMES_WHOLE) -Wl,--no-whole-archive +endif +LIBFLAGS_COMPILER+=$(LIBFLAGS_DIR) + +#------- Linkerscripts ------------------------ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/compilers/rpi_bcm2708/compiler_defines.mk b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/compilers/rpi_bcm2708/compiler_defines.mk new file mode 100644 index 0000000..b0c4c1d --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/compilers/rpi_bcm2708/compiler_defines.mk @@ -0,0 +1,85 @@ +#------- Toolchain ------------------------ + +# Define directories, if needed. + +include $(ENV_PATH)/make/compilers/bcmcommon/compiler_defines.mk + +#---------------- Compiler Options ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing + +FLAGS_COMPILER += -Os +FLAGS_COMPILER += -march=armv6j +FLAGS_COMPILER += -Wall +#Find alignment problems due to casting +#FLAGS_COMPILER += -Wcast-align +FLAGS_COMPILER += -fomit-frame-pointer +FLAGS_COMPILER += -fno-strict-aliasing +#CFLAGS_COMPILER += -mno-abicalls +ifneq (,$(FLAGS_COMPILER_PIC_CODE)) +FLAGS_COMPILER += -fPIC +else +FLAGS_COMPILER += -fno-pic +endif +FLAGS_COMPILER += -ffreestanding +ifneq (,$(PREINCLUDE_HEADER)) +FLAGS_COMPILER += -include $(PREINCLUDE_HEADER) +endif + +#-- folowing compiler flags added by BRDB +FLAGS_COMPILER += -mfloat-abi=hard +FLAGS_COMPILER += -mfpu=vfp +FLAGS_COMPILER += -pipe +FLAGS_COMPILER +=--sysroot=$(SYSTEMROOT) + +ifeq (,$(FLAGS_COMPILER_DISABLE_ALIGNMENT_WARNING)) +FLAGS_COMPILER += $(if $(filter $<,$(SRC_DISABLE_ALIGNMENT_WARNING)),,-Wcast-align) +endif + +#Option to remove FLAGS +FLAGS_COMPILER_FILTERED = $(filter-out $(FLAGS_COMPILER_FILTER_OUT), $(FLAGS_COMPILER)) +ifneq (,$(FLAGS_COMPILER_FILTER_OUT)) +$(warning Filtering out compiler flags: $(FLAGS_COMPILER_FILTER_OUT)) +endif +#------- C compiler options ------------------------ + +CFLAGS_COMPILER += $(FLAGS_COMPILER_FILTERED) + +#------- C++ compiler options ------------------------ + +CXXFLAGS_COMPILER += $(FLAGS_COMPILER_FILTERED) +CXXFLAGS_COMPILER +=-Wno-reorder +CXXFLAGS_COMPILER +=-Wno-unknown-pragmas +CXXFLAGS_COMPILER +=-Wno-sign-compare +CXXFLAGS_COMPILER +=-Wno-unused-function +CXXFLAGS_COMPILER +=-std=c++11 +CXXFLAGS_COMPILER +=-g + + +#------- Assemble options ------------------------ + +ASFLAGS_COMPILER+= + +#------- Linker options ------------------------ + +LDFLAGS_COMPILER+=--sysroot=$(SYSTEMROOT) + +#Split in file and extension - if rule linking has no $* +word-dot = $(word $2,$(subst ., ,$1)) +MAP_FILENAME=$(call word-dot,$@,1).map + +LDFLAGS_COMPILER+=-Wl,-Map=$(MAP_FILENAME),--cref +#Drop unused sections +LDFLAGS_COMPILER+=-Wl,--gc-sections +#LDFLAGS_COMPILER+=-Wl,--print-gc-sections + +#------- Library options ------------------------ + +LIBFLAGS_COMPILER+= + +#------- Linkerscripts ------------------------ + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/gpcommon.mk b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/gpcommon.mk new file mode 100644 index 0000000..29c8166 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/gpcommon.mk @@ -0,0 +1,430 @@ + +###### Definitions ####### +PREREQ_HEADER_GENERATION_TARGETS ?= +COMMA=, +SPACE=$(EMPTY) $(EMPTY) +list2lines = $(subst $(SPACE),\n,$(1)) + +RM =rm -rf +MKDIR =mkdir -p +MV =mv + +#Quick Non-Linux shell check +ifeq (,$(PWD)) +OS_USED?=WIN +ECHO =echo -e +Color_Off=\e[0m +# Bold +BBlack=\e[1;30m +BRed=\e[1;31m +BGreen=\e[1;32m +BYellow=\e[1;33m +BBlue=\e[1;34m +BPurple=\e[1;35m +BCyan=\e[1;36m +BWhite=\e[1;37m +else +OS_USED?=LINUX +ECHO =echo +Color_Off= +# Bold +BBlack= +BRed= +BGreen= +BYellow= +BBlue= +BPurple= +BCyan= +BWhite= +endif + +###### Function to convert Linux-style paths to Windows-style ##### +# Roots +LINUX_WSL_ROOT := /home/ +WINDOWS_WSL_ROOT := wsl$$/Ubuntu-18.04/home/ +LINUX_C_ROOT := /mnt/c/ +WINDOWS_C_ROOT := C:/ +LINUX_D_ROOT := /mnt/d/ +WINDOWS_D_ROOT := D:/ +LINUX_E_ROOT := /mnt/e/ +WINDOWS_E_ROOT := E:/ +LINUX_R_ROOT := /mnt/r/ +WINDOWS_R_ROOT := R:/ +LINUX_Q_ROOT := /mnt/q/ +WINDOWS_Q_ROOT := Q:/ +# GPHUB_ROOT will be set by m.py normally, but need to strip trailing slashes as IAR cannot handle double slashes in paths +GPHUB_ROOT ?= $(ROOTDIR)/gpHub +override GPHUB_ROOT := $(patsubst %\,%,$(GPHUB_ROOT)) +override GPHUB_ROOT := $(patsubst %/,%,$(GPHUB_ROOT)) +# Replace windows roots "function" +replace_win_roots = $(patsubst $(LINUX_Q_ROOT)%,$(WINDOWS_Q_ROOT)%,$(patsubst $(LINUX_R_ROOT)%,$(WINDOWS_R_ROOT)%,$(patsubst $(LINUX_C_ROOT)%,$(WINDOWS_C_ROOT)%,$(patsubst $(LINUX_D_ROOT)%,$(WINDOWS_D_ROOT)%,$(patsubst $(LINUX_E_ROOT)%,$(WINDOWS_E_ROOT)%,$(1)))))) +replace_win_roots_includes = $(patsubst -I$(LINUX_Q_ROOT)%,-I$(WINDOWS_Q_ROOT)%,$(patsubst -I$(LINUX_R_ROOT)%,-I$(WINDOWS_R_ROOT)%,$(patsubst -I$(LINUX_C_ROOT)%,-I$(WINDOWS_C_ROOT)%,$(patsubst -I$(LINUX_D_ROOT)%,-I$(WINDOWS_D_ROOT)%,$(patsubst -I$(LINUX_E_ROOT)%,-I$(WINDOWS_E_ROOT)%,$(1)))))) + + +###### Speed optimizations ####### + +#Disable Parallel build with PAR= +PAR?=j4 +ifeq (s,$(findstring s, $(MAKEFLAGS))) +MAKEFLAGS=sr$(PAR) +else +MAKEFLAGS=r$(PAR) +endif + +###### Build rules ###### + +# Deleting the default suffixes +# Slight casing variations on Windows could give compilation using default rules iso our own +.SUFFIXES: + +#Rules only active if a configuration was included +ifneq (,$(CURRENT_CONF)) + +# Used flags by compiler: +CFLAGS_COMPILER ?= +ASFLAGS_COMPILER ?= +LDFLAGS_COMPILER ?= +LIBFLAGS_COMPILER?= + +##### Compiler-specific definitions ####### +NR_OF_PROCESSORS=$(shell nproc) +ifeq ($(shell test $(NR_OF_PROCESSORS) -le 4; echo $$?),0) + # For regression machines, use all cores + NR_OF_PROCESSORS_FOR_COMPILATION?=$(NR_OF_PROCESSORS) +else + # For local machines, free up one core + NR_OF_PROCESSORS_FOR_COMPILATION?=$$(( $(NR_OF_PROCESSORS) - 1 )) +endif + +COMPILER_DEFINES?=$(ENV_PATH)/make/compilers/$(COMPILER)/compiler_defines.mk +-include $(COMPILER_DEFINES) + +# Define all object files. +ALL_SOURCES := $(SRC) $(ASRC) +# Change wanted output directory to workdirectory +ALL_SOURCES := $(subst $(GPHUB_ROOT),$(WORKDIR),$(subst $(ROOTDIR),$(WORKDIR),$(subst \,/, $(ALL_SOURCES)))) +# Available file extensions that lead to objects +OBJS:= $(ALL_SOURCES) +OBJS:= $(OBJS:.cpp=.o) +OBJS:= $(OBJS:.c=.o) +OBJS:= $(OBJS:.S=.o) +OBJS:= $(OBJS:.s=.o) + +# Define all listing files. +LSTS:= $(OBJS:.o=.lst) +# Define all dependency files. +DEPS:= $(OBJS:.o=.d) +# Define all library files +LIB := $(subst \,/, $(LIB)) +LIB_DEP := $(filter %.$(LIB_EXT), $(LIB)) + +OBJ_DIRS:= $(foreach file,$(OBJS),$(dir $(file))) +EXPORT_OBJ_DIRS:= $(foreach file,$(subst $(GPHUB_ROOT),$(WORKDIR),$(subst $(ROOTDIR),$(WORKDIR),$(subst \,/, $(patsubst %, %.o, $(basename $(foreach comp,$(EXPORT_LIBCOMPS),$(SRC_$(comp)) $(ASRC_$(comp)))))))),$(dir $(file))) +LST_DIRS:= $(foreach file,$(LSTS),$(dir $(file))) +DEP_DIRS:= $(foreach file,$(DEPS),$(dir $(file))) +TARGET_DIRS:= $(sort $(OBJ_DIRS) $(EXPORT_OBJ_DIRS) $(LST_DIRS) $(DEP_DIRS) $(dir $(APPFILE))) # sort removes duplicates :-) + +#Adjust paths +SRC_NOWARNING := $(subst \,/,$(SRC_NOWARNING)) +SRC_DISABLE_ALIGNMENT_WARNING := $(subst \,/,$(SRC_DISABLE_ALIGNMENT_WARNING)) +SRC_DISABLE_STRICT_ALIASING_WARNING := $(subst \,/,$(SRC_DISABLE_STRICT_ALIASING_WARNING)) +SRC_DISABLE_UNDEF_WARNING := $(subst \,/,$(SRC_DISABLE_UNDEF_WARNING)) + +###### Output files ###### + +#Primary target - executable +ifneq (,$(APPFILE)) +TARGET_FILES = $(APPFILE) +else +ifneq (,$(SOLIB)) +TARGET_FILES = $(SOLIB) +else +TARGET_FILES = $(APPLIB) +endif +endif +#Secondary targets - mainly used in debugging +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).elf +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).map +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).lss +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).sym +TARGET_FILES_SEC+=$(WORKDIR)/$(APPNAME).size.sym +TARGET_FILES_SEC+=$(LSTS) + +#Digsim targets - mainly used in Digsim debugging +TARGET_FILES_DIGSIM+=$(WORKDIR)/$(APPNAME).elf +TARGET_FILES_DIGSIM+=$(WORKDIR)/$(APPNAME).sym + +###### Flags used in build rules ###### + +INC := $(subst \,/,$(INC)) +CFLAGS =$(CFLAGS_COMPILER) $(FLAGS) +ASFLAGS =$(ASFLAGS_COMPILER) $(FLAGS) +CXXFLAGS =$(CXXFLAGS_COMPILER) $(FLAGS) +ALL_CFLAGS =$(CFLAGS) $(INC) +ALL_CXXFLAGS =$(CXXFLAGS) $(INC) +ALL_ASFLAGS =$(ASFLAGS) $(AINC) + +#Library inclusion +LIBFLAGS =$(LIBFLAGS_COMPILER) +LDFLAGS =$(LDFLAGS_COMPILER) + +###### Convert Linux-style paths to Windows-style ##### +ifneq (, $(CONVERT_TO_WIN_PATHS)) + # Convert paths: + INC := $(call replace_win_roots_includes,$(INC)) + AINC := $(call replace_win_roots_includes,$(AINC)) + LIB := $(call replace_win_roots,$(LIB)) + OBJS_COMP := $(call replace_win_roots,$(OBJS)) + TARGET = $(call replace_win_roots,$(@)) + SOURCE = $(call replace_win_roots,$(<)) + STEM = $(call replace_win_roots,$(*)) + PRE_REQS = $(call replace_win_roots,$(^)) + BINSHIPPED_COMP = $(call replace_win_roots,$(BINSHIPPED)) + # Dependency files will be generated with Windows paths => convert back to linux + CORRECT_DEPS := $(PYTHON_BIN) $(ENV_PATH)/make/compilers/windows_only/correctdep.py -r $(WINDOWS_WSL_ROOT) $(LINUX_WSL_ROOT) -r $(WINDOWS_C_ROOT) $(LINUX_C_ROOT) -r $(WINDOWS_R_ROOT) $(LINUX_R_ROOT) -r $(WINDOWS_D_ROOT) $(LINUX_D_ROOT) -r $(WINDOWS_E_ROOT) $(LINUX_E_ROOT) + # we need a temporary dependency file to not leave a corrupt one + DEP_FILE = $(@:.o=.dd) + DEP_FILE_FLAG = -MF $(call replace_win_roots,$(DEP_FILE)) + PREINCLUDE_HEADER := $(call replace_win_roots,$(PREINCLUDE_HEADER)) +else + # INC := $(INC) + # LIB := $(LIB) + TARGET = $@ + SOURCE = $< + STEM = $* + PRE_REQS = $^ + OBJS_COMP := $(OBJS) + BINSHIPPED_COMP = $(BINSHIPPED) + # No need to correct dependencies when not converting paths + CORRECT_DEPS := + DEP_FILE := + DEP_FILE_FLAG := + CONFIG_HEADER := $(subst \,/,$(CONFIG_HEADER)) + INTERNALS_HEADER := $(subst \,/,$(INTERNALS_HEADER)) + PREINCLUDE_HEADER := $(subst \,/,$(PREINCLUDE_HEADER)) +endif + +###### Default build target ###### + +.PHONY:app all postbuild-app postbuild-all build-app build-all prebuild-script app-target all-target +app: postbuild-app +all: postbuild-all +digsim: $(TARGET_FILES) $(TARGET_FILES_DIGSIM) + +postbuild-app: build-app +ifneq (,$(POSTBUILD_SCRIPT)) + cd "$(WORKDIR)" && \ + export ENV_PATH="$(ENV_PATH)" && \ + sh $(POSTBUILD_SCRIPT) $(dir $(firstword $(MAKEFILE_LIST))) $(APPFILE) && \ + cd - +endif + +postbuild-all: build-all +ifneq (,$(POSTBUILD_SCRIPT)) + cd "$(WORKDIR)" && \ + export ENV_PATH="$(ENV_PATH)" && \ + sh $(POSTBUILD_SCRIPT) $(dir $(firstword $(MAKEFILE_LIST))) $(APPFILE) && \ + cd - +endif + +ifneq (,$(PREBUILD_SCRIPT)) +build-app: prebuild-script + @$(MAKE) -f $(firstword $(MAKEFILE_LIST)) --no-print-directory app-target +else +build-app: app-target +endif + +ifneq (,$(PREBUILD_SCRIPT)) +build-all: prebuild-script + @$(MAKE) -f $(firstword $(MAKEFILE_LIST)) --no-print-directory all-target +else +build-all: all-target +endif + +prebuild-script: +ifneq (,$(PREBUILD_SCRIPT)) + sh $(PREBUILD_SCRIPT) $(dir $(firstword $(MAKEFILE_LIST))) $(APPFILE) +endif + +app-target: $(TARGET_FILES) +all-target: $(TARGET_FILES) $(TARGET_FILES_SEC) + +###### Default build rules ###### + +# We make all target directories sequentially because we noticed some strange mkdir errors +# when running mkdir in the compile rule which we suspect enabled to some race condition +$(TARGET_DIRS) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)): + for d in $@; do $(MKDIR) $$d; done + +.PRECIOUS : $(WORKDIR)/%.o + +#Include compiler specific rules +COMPILER_RULES?=$(ENV_PATH)/make/compilers/$(COMPILER)/compiler_rules.mk +-include $(COMPILER_RULES) + +#Use C or CXX compiler to link +ifdef LINK_CXX +LINK_COMMAND=$(CXX) +else +LINK_COMMAND=$(CC) +endif + +.SECONDEXPANSION: +%.elf %.map: $(OBJS) $(BINSHIPPED) $(LINKERSCRIPT) $(LIB_DEP) | $$(dir $$@) + @$(ECHO) "$(BYellow)Linking $(notdir $@)$(Color_Off)" + $(LINK_COMMAND) $(OBJS_COMP) $(BINSHIPPED) $(LIBFLAGS) --output $(STEM).elf $(LDFLAGS) + +%.sym %.size.sym: %.elf + @$(ECHO) "$(BWhite)Creating symbol table:$(Color_Off)" $@ + $(NM) -S -n -l $< > $(dir $@)/tmp.sym + $(MV) $(dir $@)tmp.sym $@ + $(NM) -S --size-sort $< > $(dir $@).size.sym + +%.lss: %.elf + @$(ECHO) "$(BWhite)Creating basic listing:$(Color_Off)" $@ + $(OBJDUMP) -h -d -l $(SOURCE) > $(TARGET) + +# Define compilation function to avoid repeating recipes +define compile # (compiler, flags) + @$(ECHO) "$(BYellow)Building $(notdir $@)$(Color_Off)" + $(1) -c $(2) $(INC) -DGP_FILENAME=$(basename $(notdir $<)). -MMD $(DEP_FILE_FLAG) $(SOURCE) -o $(TARGET) + $(CORRECT_DEPS) $(DEP_FILE) +endef + +# flag_lookup: if the flag is present, return its name +# flag_value: if the flag has a value, return its value +ifdef CONFIG_HEADER +flag_lookup = $(shell grep -Eq -e '\#define[[:space:]]+$(1)$$' -e '\#define[[:space:]]+$(1)[[:space:]]+' $(CONFIG_HEADER) $(INTERNALS_HEADER) && echo $(1)) +flag_value = $(shell sed -ne 's/\#define[[:space:]][[:space:]]*$(1)[[:space:]][[:space:]]*(..*)[[:space:]]*/\1/p' $(CONFIG_HEADER) $(INTERNALS_HEADER)) +else +flag_lookup = $(patsubst %,$(1),$(filter -D$(1) -D$(1)=%,$(FLAGS))) +flag_value = $(patsubst -D$(1)=%,%,$(filter -D$(1)=%,$(FLAGS))) +endif + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(ROOTDIR)/%.c | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(CFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(GPHUB_ROOT)/%.c | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(CFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(ROOTDIR)/%.cpp | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CXX), $(CXXFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(GPHUB_ROOT)/%.cpp | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CXX), $(CXXFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(ROOTDIR)/%.S | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(ROOTDIR)/%.s | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(GPHUB_ROOT)/%.S | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.o: $(GPHUB_ROOT)/%.s | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call compile,$(CC), $(ASFLAGS)) + +# Define listing function to avoid repeating recipes +define list # (compiler, flags) + @$(ECHO) "$(BYellow)Creating $(notdir $@)$(Color_Off)" + $(1) -c $(2) $(INC) -DGP_FILENAME=$(basename $(notdir $<)). -Wa,-adhlns=$(TARGET) -MMD $(SOURCE) +endef + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(ROOTDIR)/%.c | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(CFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(GPHUB_ROOT)/%.c | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(CFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(ROOTDIR)/%.cpp | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CXX), $(CXXFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(GPHUB_ROOT)/%.cpp | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CXX), $(CXXFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(ROOTDIR)/%.S | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(GPHUB_ROOT)/%.S | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(ROOTDIR)/%.s | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(ASFLAGS)) + +.SECONDEXPANSION: +$(WORKDIR)/%.lst: $(GPHUB_ROOT)/%.s | $$(dir $$@) $(dir $(PREREQ_HEADER_GENERATION_TARGETS)) $(PREREQ_HEADER_GENERATION_TARGETS) + $(call list,$(CC), $(ASFLAGS)) + +ifeq (,$(COMPILER_SPECIFIC_LIB_RULE)) +.PHONY: +applib: $(APPLIB) + +$(APPLIB): $(BINSHIPPED) $(OBJS) + #create or update archive + @$(ECHO) "$(BYellow)Archiving $@$(Color_Off)" + $(RM) $@ ; \ + $(AR) $(TARGET) $(BINSHIPPED) $(OBJS_COMP) +#Adding libraries flattend through ar scripting + (echo "OPEN $(TARGET)"; \ + for lib in $(LIBFILES) ; do echo "ADDLIB " $$lib; done; \ + echo "SAVE"; \ + echo "END") | $(firstword $(AR)) -M +endif + +ifeq (,$(COMPILER_SPECIFIC_SO_LIB_RULE)) +.PHONY: +solib: $(SOLIB) + +$(SOLIB): $(BINSHIPPED) $(OBJS) + #create or update library + @$(ECHO) "$(BYellow)Creating .so lib $@$(Color_Off)" + $(RM) $@ ; \ + $(CXX) -shared -o $(TARGET) $(BINSHIPPED) $(OBJS_COMP) $(LIBFLAGS) $(LDFLAGS) +endif + +#Include extra programmer rules +PROGRAMMER_RULES?=$(ENV_PATH)/make/programmers/$(PROGRAMMER)/programmer_rules.mk +-include $(PROGRAMMER_RULES) + +###### Dependencies ###### + +# We generate a file for each .d files with addition rules to avoid the +# "no rule to make target" whenever a .h-file is deleted or renamed. +%.sd: %.d $(ENV_PATH)/make/make_d_rules.py + $(PYTHON_BIN) $(ENV_PATH)/make/make_d_rules.py <$< >$@ + +SAFE_DEPS:= $(OBJS:.o=.sd) + +-include $(DEPS) $(SAFE_DEPS) +endif + +#Include GreenPeak specific rules +-include $(ENV_PATH)/make/gpinternal.mk + +.PHONY:clean +clean: + $(ECHO) "$(BGreen)---- Cleaning $(APPNAME) ----$(Color_Off)" + $(RM) $(WORKDIR) + +help:: + $(ECHO) "$(BWhite)--- Common ---$(Color_Off)\n\ +app - create targets $(BWhite)(default)$(Color_Off)\n$(call list2lines,$(TARGET_FILES))\n\ +all - create targets+secondary\n$(call list2lines,$(filter-out $(LSTS),$(TARGET_FILES_SEC)))\n\ +digsim - make for digsim - create targets\n$(call list2lines,$(filter-out $(LSTS),$(TARGET_FILES_DIGSIM)))\n\ +clean - clean working directory\n$(WORKDIR)\n" diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/overview.QorvoQPG7015M_rpi_cli_ftd_socket.txt b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/overview.QorvoQPG7015M_rpi_cli_ftd_socket.txt new file mode 100644 index 0000000..d64efad --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/overview.QorvoQPG7015M_rpi_cli_ftd_socket.txt @@ -0,0 +1,33 @@ +Package created from: +Applications/P959_OpenThread/v1.2.0.4/apps/lib_qorvo/qpg7015m_rpi_cli_ftd_socket.py - commit reference 2334f506f9cba16a755256babb1eb0a69878a600 + +Components in source: +--------------------- +gpAssert - Components/Qorvo/OS/vlatest +gpBaseComps - Components/Qorvo/OS/vlatest +gpBsp - Components/Qorvo/BSP/vlatest +gpCom - Components/Qorvo/BaseUtils/vlatest +gpEncryption - Components/Qorvo/BaseUtils/vlatest +gpLog - Components/Qorvo/OS/vlatest +gpMacCore - Components/Qorvo/802_15_4/vlatest +gpMacDispatcher - Components/Qorvo/802_15_4/vlatest +gpPad - Components/Qorvo/HAL_RF/vlatest +gpPd - Components/Qorvo/HAL_RF/vlatest +gpPoolMem - Components/Qorvo/OS/vlatest +gpRandom - Components/Qorvo/BaseUtils/vlatest +gpReset - Components/Qorvo/OS/vlatest +gpRxArbiter - Components/Qorvo/802_15_4/vlatest +gpSched - Components/Qorvo/OS/vlatest +gpStat - Components/Qorvo/BaseUtils/vlatest +gpUtils - Components/Qorvo/BaseUtils/vlatest +gpVersion - Components/Qorvo/OS/vlatest +gpWmrk - Components/Qorvo/BaseUtils/vlatest +gphal - Components/Qorvo/HAL_RF/vlatest +halLinux - Components/Qorvo/HAL_PLATFORM/v2.10.3.1 +qvOT - Applications/P959_OpenThread/v1.2.0.4 +silexCryptoSoc - Components/Qorvo/HAL_PLATFORM/v2.10.3.1 + +Repositories: +--------------------- +P959_ot-qorvo - P959_ot-qorvo/v1.2.0.4 + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/overview.QorvoQPG7015M_rpi_cli_mtd_socket.txt b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/overview.QorvoQPG7015M_rpi_cli_mtd_socket.txt new file mode 100644 index 0000000..48460cd --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/overview.QorvoQPG7015M_rpi_cli_mtd_socket.txt @@ -0,0 +1,33 @@ +Package created from: +Applications/P959_OpenThread/v1.2.0.4/apps/lib_qorvo/qpg7015m_rpi_cli_mtd_socket.py - commit reference 2334f506f9cba16a755256babb1eb0a69878a600 + +Components in source: +--------------------- +gpAssert - Components/Qorvo/OS/vlatest +gpBaseComps - Components/Qorvo/OS/vlatest +gpBsp - Components/Qorvo/BSP/vlatest +gpCom - Components/Qorvo/BaseUtils/vlatest +gpEncryption - Components/Qorvo/BaseUtils/vlatest +gpLog - Components/Qorvo/OS/vlatest +gpMacCore - Components/Qorvo/802_15_4/vlatest +gpMacDispatcher - Components/Qorvo/802_15_4/vlatest +gpPad - Components/Qorvo/HAL_RF/vlatest +gpPd - Components/Qorvo/HAL_RF/vlatest +gpPoolMem - Components/Qorvo/OS/vlatest +gpRandom - Components/Qorvo/BaseUtils/vlatest +gpReset - Components/Qorvo/OS/vlatest +gpRxArbiter - Components/Qorvo/802_15_4/vlatest +gpSched - Components/Qorvo/OS/vlatest +gpStat - Components/Qorvo/BaseUtils/vlatest +gpUtils - Components/Qorvo/BaseUtils/vlatest +gpVersion - Components/Qorvo/OS/vlatest +gpWmrk - Components/Qorvo/BaseUtils/vlatest +gphal - Components/Qorvo/HAL_RF/vlatest +halLinux - Components/Qorvo/HAL_PLATFORM/v2.10.3.1 +qvOT - Applications/P959_OpenThread/v1.2.0.4 +silexCryptoSoc - Components/Qorvo/HAL_PLATFORM/v2.10.3.1 + +Repositories: +--------------------- +P959_ot-qorvo - P959_ot-qorvo/v1.2.0.4 + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/overview.QorvoQPG7015M_rpi_rcp_socket.txt b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/overview.QorvoQPG7015M_rpi_rcp_socket.txt new file mode 100644 index 0000000..be3a89d --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/overview.QorvoQPG7015M_rpi_rcp_socket.txt @@ -0,0 +1,33 @@ +Package created from: +Applications/P959_OpenThread/v1.2.0.4/apps/lib_qorvo/qpg7015m_rpi_rcp_socket.py - commit reference 2334f506f9cba16a755256babb1eb0a69878a600 + +Components in source: +--------------------- +gpAssert - Components/Qorvo/OS/vlatest +gpBaseComps - Components/Qorvo/OS/vlatest +gpBsp - Components/Qorvo/BSP/vlatest +gpCom - Components/Qorvo/BaseUtils/vlatest +gpEncryption - Components/Qorvo/BaseUtils/vlatest +gpLog - Components/Qorvo/OS/vlatest +gpMacCore - Components/Qorvo/802_15_4/vlatest +gpMacDispatcher - Components/Qorvo/802_15_4/vlatest +gpPad - Components/Qorvo/HAL_RF/vlatest +gpPd - Components/Qorvo/HAL_RF/vlatest +gpPoolMem - Components/Qorvo/OS/vlatest +gpRandom - Components/Qorvo/BaseUtils/vlatest +gpReset - Components/Qorvo/OS/vlatest +gpRxArbiter - Components/Qorvo/802_15_4/vlatest +gpSched - Components/Qorvo/OS/vlatest +gpStat - Components/Qorvo/BaseUtils/vlatest +gpUtils - Components/Qorvo/BaseUtils/vlatest +gpVersion - Components/Qorvo/OS/vlatest +gpWmrk - Components/Qorvo/BaseUtils/vlatest +gphal - Components/Qorvo/HAL_RF/vlatest +halLinux - Components/Qorvo/HAL_PLATFORM/v2.10.3.1 +qvOT - Applications/P959_OpenThread/v1.2.0.4 +silexCryptoSoc - Components/Qorvo/HAL_PLATFORM/v2.10.3.1 + +Repositories: +--------------------- +P959_ot-qorvo - P959_ot-qorvo/v1.2.0.4 + diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/build.sh b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/build.sh new file mode 100755 index 0000000..08844ee --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/build.sh @@ -0,0 +1,133 @@ +#!/bin/bash +set -x +# Script settings + +# shellcheck disable=SC1091 +source package_defs.sh + +if grep -qE "(Microsoft|WSL)" /proc/sys/kernel/osrelease ; then + BUILD_OS='OS_USED=WSL' +fi + +# Print log +log () +{ + echo "$1" +} + +# Fail with message +failed() +{ + log "[BUILD FAILED] $1"; + exit 255 +} + +print_info() +{ + log "${BUNDLE_NAME}" +} + +preconditions() +{ + pushd . || failed + COUNTER=0 + + test -f Module.symvers && rm Module.symvers + for DEPENDENCY_LINK in "${BUILD_DEPENDENCIES[@]}"; do + # LKM build Workaround: with 5.10.17, MODPOST fails unless Kbuild or Makefile + # exist and point to the Makefile.xxx + DEPENDENCY_KEY="${DEPENDENCY_LINK%%|*}" + if [ "${DEPENDENCY_KEY}" != "$1" ] + then + continue + fi + DEPENDENCY="${DEPENDENCY_LINK#*|}" + # word splitting with cp destination in variable (SC2086,SC2225 are required) + # shellcheck disable=SC2086,SC2225 + test -f Kbuild && rm Kbuild + # shellcheck disable=SC2086 + ln -s ${DEPENDENCY%% *} Kbuild + # shellcheck disable=SC2086 + make -j4 -f ${DEPENDENCY} ${BUILD_OS}|| failed "Unable to do make ${DEPENDENCY}" + if [ -f Module.symvers ] + then + mv Module.symvers Module.symvers.$COUNTER + ((COUNTER++)) + fi + done +# cat Module.symvers.* |sort -k 1 |tee Module.symvers + + popd || failed + +} + +make_unpack() +{ + pushd . || failed + for ARCHIVE in "${PACKAGE_ARCHIVES[@]}"; do + ARCHIVE_NAME=$(basename -- "${ARCHIVE}") + ARCHIVE_DIR=$(dirname -- "${ARCHIVE}") + UNPACKED_ARCHIVE="${ARCHIVE_NAME%_*_*}" + cd "${ARCHIVE_DIR}" || failed + if [ -d "${UNPACKED_ARCHIVE}" ] ; then + log "${UNPACKED_ARCHIVE} already available, extracting ${ARCHIVE_NAME} skipped" + else + tar -xzvf "${ARCHIVE_NAME}" || failed "Unable to extract tar" + fi + + cd - || failed + done + popd || failed +} + +make_target() +{ + pushd . || failed + cd "${BUNDLE_NAME}/" || failed + for TARGET in "${MAKE_TARGETS[@]}"; do + for COPY_DEPENDENCY in "${COPY_DEPENDENCIES[@]}"; do + if [[ "${TARGET%% *}" == Makefile."${COPY_DEPENDENCY%%|*}" ]]; then + # word splitting with cp destination in variable (SC2086,SC2225 are required) + # shellcheck disable=SC2086,SC2225 + cp -v ${COPY_DEPENDENCY##*|} || failed + fi + done + # LKM build Workaround: with 5.10.17, MODPOST fails unless Kbuild or Makefile + # exist and point to the Makefile.xxx + preconditions "${TARGET%% *}" + # word splitting (SC2086 is required) + test -f Kbuild && rm Kbuild + # shellcheck disable=SC2086 + ln -s ${TARGET%% *} Kbuild + # shellcheck disable=SC2086 + make -f ${TARGET} ${BUILD_OS}|| failed "Unable to do make ${TARGET}" + done + popd || failed +} + +check_artifacts() +{ + pushd . || failed + for ARTIFACT in "${PACKAGE_ARTIFACTS[@]}"; do + if [ ! -f "${ARTIFACT}" ]; then + failed "Artifact not found: ${ARTIFACT}" + fi + done + popd || failed +} + +make_clean() +{ + pushd . || failed + cd "${BUNDLE_NAME}/" || failed + for TARGET in "${CLEAN_TARGETS[@]}"; do + # word splitting (SC2086 is required) + # shellcheck disable=SC2086 + make -f ${TARGET} ${BUILD_OS}|| failed "Unable to do make ${TARGET}" + done + popd || failed +} + +print_info && make_unpack +[[ $1 == "clean" ]] && make_clean +make_target && check_artifacts diff --git a/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/package_defs.sh b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/package_defs.sh new file mode 100644 index 0000000..df33e61 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/package_defs.sh @@ -0,0 +1,25 @@ +BUNDLE_NAME=OpenThread_Lib_QPG7015M +TOOLCHAIN_RPI="${TOOLCHAIN_RPI-/mnt/c/gpHub/TOOL_RPi/vlatest/bin/arm-linux-gnueabihf}" + +PACKAGE_ARCHIVES=( \ +"OpenThread_Lib_QPG7015M_2334f_v1.5.2.0.tgz" \ +) +PACKAGE_ARTIFACTS=( \ +"OpenThread_Lib_QPG7015M/Work/QorvoQPG7015M_rpi_cli_mtd_socket/libQorvoQPG7015M_rpi_cli_mtd_socket.a" \ +"OpenThread_Lib_QPG7015M/Work/QorvoQPG7015M_rpi_cli_ftd_socket/libQorvoQPG7015M_rpi_cli_ftd_socket.a" \ +"OpenThread_Lib_QPG7015M/Work/QorvoQPG7015M_rpi_rcp_socket/libQorvoQPG7015M_rpi_rcp_socket.a" \ +) +MAKE_TARGETS=( \ +"Makefile.QorvoQPG7015M_rpi_cli_mtd_socket applib TOOLCHAIN=${TOOLCHAIN_RPI}" \ +"Makefile.QorvoQPG7015M_rpi_cli_ftd_socket applib TOOLCHAIN=${TOOLCHAIN_RPI}" \ +"Makefile.QorvoQPG7015M_rpi_rcp_socket applib TOOLCHAIN=${TOOLCHAIN_RPI}" \ +) +CLEAN_TARGETS=( \ +"Makefile.QorvoQPG7015M_rpi_cli_mtd_socket clean TOOLCHAIN=${TOOLCHAIN_RPI}" \ +"Makefile.QorvoQPG7015M_rpi_cli_ftd_socket clean TOOLCHAIN=${TOOLCHAIN_RPI}" \ +"Makefile.QorvoQPG7015M_rpi_rcp_socket clean TOOLCHAIN=${TOOLCHAIN_RPI}" \ +) +BUILD_DEPENDENCIES=( \ +) +COPY_DEPENDENCIES=( \ +) diff --git a/Software/OpenThread/src/qpg7015m/alarm.c b/Software/OpenThread/src/qpg7015m/alarm.c new file mode 100644 index 0000000..6a04fef --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/alarm.c @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file implements the OpenThread platform abstraction for the alarm. + * + */ + +#include +#include + +#include "qvOT/inc/alarm_qorvo.h" +#include +#include +#include + +uint32_t otPlatAlarmMilliGetNow(void) +{ + return qorvoAlarmGetTimeMs(); +} + +static void qorvoAlarmMilliFired(void *aInstance) +{ + otPlatAlarmMilliFired((otInstance *)aInstance); +} + +void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt) +{ + OT_UNUSED_VARIABLE(t0); + + qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance); + qorvoAlarmMilliStart(dt, qorvoAlarmMilliFired, aInstance); +} + +void otPlatAlarmMilliStop(otInstance *aInstance) +{ + qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance); +} + +uint32_t otPlatAlarmMicroGetNow(void) +{ + return qorvoAlarmGetTimeUs(); +} + +static void qorvoAlarmMicroFired(void *aInstance) +{ + otPlatAlarmMicroFired((otInstance *)aInstance); +} + +void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt) +{ + OT_UNUSED_VARIABLE(t0); + + qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance); + qorvoAlarmMicroStart(dt, qorvoAlarmMicroFired, aInstance); +} + +void otPlatAlarmMicroStop(otInstance *aInstance) +{ + qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance); +} diff --git a/Software/OpenThread/src/qpg7015m/arm-linux-gnueabihf.cmake b/Software/OpenThread/src/qpg7015m/arm-linux-gnueabihf.cmake new file mode 100644 index 0000000..ff6855a --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/arm-linux-gnueabihf.cmake @@ -0,0 +1,43 @@ +# +# Copyright (c) 2020, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_PROCESSOR ARM) + +set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) +set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) +set(CMAKE_ASM_COMPILER arm-linux-gnueabihf-as) +set(CMAKE_RANLIB arm-linux-gnueabihf-ranlib) + +set(COMMON_C_FLAGS "-fdata-sections -ffunction-sections") + + +set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99") +set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti") +set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS}") diff --git a/Software/OpenThread/src/qpg7015m/crypto/qpg7015m-mbedtls-config.h b/Software/OpenThread/src/qpg7015m/crypto/qpg7015m-mbedtls-config.h new file mode 100644 index 0000000..e614954 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/crypto/qpg7015m-mbedtls-config.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef QPG7015M_MBEDTLS_CONFIG_H +#define QPG7015M_MBEDTLS_CONFIG_H + +#if defined(QORVO_MBEDTLS_DEBUG) +#ifndef MBEDTLS_DEBUG_C +#define MBEDTLS_DEBUG_C +#endif // MBEDTLS_DEBUG_C +#else +#ifdef MBEDTLS_DEBUG_C +#undef MBEDTLS_DEBUG_C +#endif // MBEDTLS_DEBUG_C +#endif // QORVO_MBEDTLS_DEBUG + +#include "mbedtls/check_config.h" + +#endif // QPG7015M_MBEDTLS_CONFIG_H diff --git a/Software/OpenThread/src/qpg7015m/diag.c b/Software/OpenThread/src/qpg7015m/diag.c new file mode 100644 index 0000000..e79c2f2 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/diag.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include +#include +#include + +#if OPENTHREAD_CONFIG_DIAG_ENABLE + +/** + * Diagnostics mode variables. + * + */ +static bool sDiagMode = false; + +void otPlatDiagModeSet(bool aMode) +{ + sDiagMode = aMode; +} + +bool otPlatDiagModeGet() +{ + return sDiagMode; +} + +void otPlatDiagChannelSet(uint8_t aChannel) +{ + OT_UNUSED_VARIABLE(aChannel); +} + +void otPlatDiagTxPowerSet(int8_t aTxPower) +{ + OT_UNUSED_VARIABLE(aTxPower); +} + +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aFrame); + OT_UNUSED_VARIABLE(aError); +} + +void otPlatDiagAlarmCallback(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); +} + +#endif // OPENTHREAD_CONFIG_DIAG_ENABLE diff --git a/Software/OpenThread/src/qpg7015m/entropy.c b/Software/OpenThread/src/qpg7015m/entropy.c new file mode 100644 index 0000000..bf25db5 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/entropy.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file implements an entropy source based on /dev/urandom or pseudo-random generator. + * + */ + +#include + +#include +#include + +#include + +#include "utils/code_utils.h" + +void qorvoRandomInit(void) +{ +} + +otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength) +{ + otError error = OT_ERROR_NONE; + + FILE * file = NULL; + size_t readLength; + + otEXPECT_ACTION(aOutput && aOutputLength, error = OT_ERROR_INVALID_ARGS); + + file = fopen("/dev/urandom", "rb"); + otEXPECT_ACTION(file != NULL, error = OT_ERROR_FAILED); + + readLength = fread(aOutput, 1, aOutputLength, file); + otEXPECT_ACTION(readLength == aOutputLength, error = OT_ERROR_FAILED); + +exit: + + if (file != NULL) + { + fclose(file); + } + + return error; +} diff --git a/Software/OpenThread/src/qpg7015m/flash.c b/Software/OpenThread/src/qpg7015m/flash.c new file mode 100644 index 0000000..3314656 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/flash.c @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 500 + +#include "qvOT/inc/platform_qorvo.h" + +#undef NDEBUG +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static int sFlashFd = -1; + +enum +{ + SWAP_SIZE = 2048, + SWAP_NUM = 2, +}; + +void otPlatFlashInit(otInstance *aInstance) +{ + char fileName[20]; + struct stat st; + bool create = false; + + memset(&st, 0, sizeof(st)); + + if (stat("tmp", &st) == -1) + { + mkdir("tmp", 0777); + } + + snprintf(fileName, sizeof(fileName), "tmp/node.flash"); + + if (access(fileName, 0)) + { + create = true; + } + + sFlashFd = open(fileName, O_RDWR | O_CREAT, 0600); + lseek(sFlashFd, 0, SEEK_SET); + + assert(sFlashFd >= 0); + + if (create) + { + for (uint8_t index = 0; index < SWAP_NUM; index++) + { + otPlatFlashErase(aInstance, index); + } + } +} + +uint32_t otPlatFlashGetSwapSize(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + return SWAP_SIZE; +} + +void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex) +{ + OT_UNUSED_VARIABLE(aInstance); + uint32_t address; + uint8_t buffer[SWAP_SIZE]; + ssize_t r; + + assert((sFlashFd) >= 0 && (aSwapIndex < SWAP_NUM)); + + address = aSwapIndex ? SWAP_SIZE : 0; + memset(buffer, 0xff, sizeof(buffer)); + + // Write the page + r = pwrite(sFlashFd, buffer, sizeof(buffer), (off_t)address); + assert(r == SWAP_SIZE); +} + +void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize) +{ + OT_UNUSED_VARIABLE(aInstance); + + uint32_t address; + ssize_t rval; + + assert((sFlashFd >= 0) && (aSwapIndex < SWAP_NUM) && (aSize <= SWAP_SIZE) && (aOffset <= (SWAP_SIZE - aSize))); + + address = aSwapIndex ? SWAP_SIZE : 0; + + rval = pread(sFlashFd, aData, aSize, (off_t)(address + aOffset)); + assert((uint32_t)rval == aSize); +} + +void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize) +{ + OT_UNUSED_VARIABLE(aInstance); + + uint32_t address; + uint8_t byte; + ssize_t rval; + + assert((sFlashFd >= 0) && (aSwapIndex < SWAP_NUM) && (aSize <= SWAP_SIZE) && (aOffset <= (SWAP_SIZE - aSize))); + + address = aSwapIndex ? SWAP_SIZE : 0; + address += aOffset; + + for (uint32_t offset = 0; offset < aSize; offset++) + { + rval = pread(sFlashFd, &byte, sizeof(byte), (off_t)(address + offset)); + assert(rval == sizeof(byte)); + + // Use bitwise AND to emulate the behavior of flash memory + byte &= ((uint8_t *)aData)[offset]; + + rval = pwrite(sFlashFd, &byte, sizeof(byte), (off_t)(address + offset)); + assert(rval == sizeof(byte)); + } +} diff --git a/Software/OpenThread/src/qpg7015m/logging.c b/Software/OpenThread/src/qpg7015m/logging.c new file mode 100644 index 0000000..3ac2bc6 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/logging.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "qvOT/inc/platform_qorvo.h" +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "qvOT/inc/uart_qorvo.h" +#include "utils/code_utils.h" + +// Macro to append content to end of the log string. + +#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) + +OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...) +{ + va_list args; + va_start(args, aFormat); + qorvoUartLog(aLogLevel, aLogRegion, aFormat, args); + va_end(args); +} + +#endif diff --git a/Software/OpenThread/src/qpg7015m/misc.c b/Software/OpenThread/src/qpg7015m/misc.c new file mode 100644 index 0000000..daaaaf0 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/misc.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "qvOT/inc/platform_qorvo.h" + +#include +#include + +#include "qvOT/inc/radio_qorvo.h" +#include + +#include +#include + +extern int gArgumentsCount; +extern char **gArguments; + +extern void platformUartRestore(void); + +void otPlatReset(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + char *argv[gArgumentsCount + 1]; + + for (int i = 0; i < gArgumentsCount; ++i) + { + argv[i] = gArguments[i]; + } + + argv[gArgumentsCount] = NULL; + + qorvoRadioReset(); + platformUartRestore(); + + execvp(argv[0], argv); + perror("reset failed"); + exit(EXIT_FAILURE); +} + +otPlatResetReason otPlatGetResetReason(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return OT_PLAT_RESET_REASON_POWER_ON; +} + +void otPlatWakeHost(void) +{ + // TODO: implement an operation to wake the host from sleep state. +} diff --git a/Software/OpenThread/src/qpg7015m/openthread-core-qpg7015m-config-check.h b/Software/OpenThread/src/qpg7015m/openthread-core-qpg7015m-config-check.h new file mode 100644 index 0000000..c249326 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/openthread-core-qpg7015m-config-check.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPENTHREAD_CORE_QPG7015M_CONFIG_CHECK_H_ +#define OPENTHREAD_CORE_QPG7015M_CONFIG_CHECK_H_ + +#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#error "Platform qpg7015m doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE" +#endif + +#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT +#error "Platform qpg7015m doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT" +#endif + +#endif /* OPENTHREAD_CORE_QPG7015M_CONFIG_CHECK_H_ */ diff --git a/Software/OpenThread/src/qpg7015m/openthread-core-qpg7015m-config.h b/Software/OpenThread/src/qpg7015m/openthread-core-qpg7015m-config.h new file mode 100755 index 0000000..02751db --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/openthread-core-qpg7015m-config.h @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes qpg7015m compile-time configuration constants for OpenThread. + */ + +#ifndef OPENTHREAD_CORE_QPG7015M_CONFIG_H_ +#define OPENTHREAD_CORE_QPG7015M_CONFIG_H_ + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_INFO + * + * The platform-specific string to insert into the OpenThread version string. + * + */ +#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG7015M" + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_INFO + * + * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage. + * + * When defined to 1, the platform MUST implement the otPlatFlash* APIs + * instead of the otPlatSettings* + * + */ +#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE + * + * Define to 1 if you want to enable the csl receiver feature (for Thread >= 1.2 only) + * + */ +#ifndef OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE +#define OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) +#endif + +/** + * @def OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE + * + * Define to 1 if you want to enable the csl receiver feature (for Thread >= 1.2 only) + * + */ +#ifndef OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE +#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) +#endif + +#if defined(OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE) +#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD 1150 +#endif + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT + * + * The assert is managed by platform defined logic when this flag is set. + * + */ +#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 0 + +/** + * @def OPENTHREAD_CONFIG_DIAG_ENABLE + * + * Define as 1 to enable the diag feature. + * + */ +#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE +#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE + * + * This is required for the CSL receiver feature + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE +#endif + +#if defined(OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE) && defined(DEBUG) +#define OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE + * + * Enable the Link Metrics subject feature (for Thread >= 1.2 only) + * A Thread Router has to be able to be a Link Metrics Subject + * + */ +#ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) +#endif + +/** + * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE + * + * Enable the Link Metrics subject feature (for Thread >= 1.2 only) + * + */ +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) + +/** + * @def OPENTHREAD_CONFIG_DUA_ENABLE + * + * Enable the DUA feature (for Thread >= 1.2 only) + * + */ +#define OPENTHREAD_CONFIG_DUA_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) + +/** + * @def OPENTHREAD_CONFIG_MLR_ENABLE + * + * Enable the Multicast Listener Registration feature (MLR) (for Thread >= 1.2 only) + * + */ +#ifndef OPENTHREAD_CONFIG_MLR_ENABLE +#define OPENTHREAD_CONFIG_MLR_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) +#endif + +/** + * @def OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE + * + * Enable the Service Registry Proxy client (for Thread >= 1.3 only) + * It also requires support for ECDSA + * + */ +#ifndef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE +#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_3) +#endif + +#if defined(OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE) || defined(OPENTHREAD_CONFIG_SRP_SERVER_ENABLE) +#if !defined(OPENTHREAD_CONFIG_ECDSA_ENABLE) || !OPENTHREAD_CONFIG_ECDSA_ENABLE +#undef OPENTHREAD_CONFIG_ECDSA_ENABLE +#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 +#endif +#endif + +/** + * @def OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_DEFAULT_MODE + * + * Define the default mode (enabled or disabled) of auto-start mode. + * + * This config is applicable only when `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` is enabled. + * + */ +#ifndef OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_DEFAULT_MODE +#define OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_DEFAULT_MODE \ + ((OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_3) && OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE) +#endif + +/** + * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE + * + * Enable the Domain Name Service client (for Thread >= 1.3 only) + * + */ +#ifndef OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE +#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_3) +#endif +/** + * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE + * + * Define as 1 to enable SPI NCP interface. + * + */ +#ifndef OPENTHREAD_CONFIG_NCP_SPI_ENABLE +#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE + * + * Define to 1 to enable NCP HDLC support. + * + */ +#ifndef OPENTHREAD_CONFIG_NCP_HDLC_ENABLE +#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE + * + * Configure the available heap size. + * The heap is used by Mbedtls + * + */ +#ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE +#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (2048 * sizeof(void *)) +#endif + +#endif // OPENTHREAD_CORE_QPG7015M_CONFIG_H_ diff --git a/Software/OpenThread/src/qpg7015m/radio.c b/Software/OpenThread/src/qpg7015m/radio.c new file mode 100644 index 0000000..bf71372 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/radio.c @@ -0,0 +1,610 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file implements the OpenThread platform abstraction for radio communication. + * + */ + +#include + +#include +#include + +#include "utils/code_utils.h" + +#include "qvOT/inc/radio_qorvo.h" + +enum +{ + QPG_RECEIVE_SENSITIVITY = -100, // dBm + QPG_CSL_ACCURACY = 50, // ppm + QPG_CSL_CLOCK_UNCERTAINTY = 255, // us +}; + +enum +{ + IEEE802154_MIN_LENGTH = 5, + IEEE802154_MAX_LENGTH = 127, + IEEE802154_ACK_LENGTH = 5, + IEEE802154_FRAME_TYPE_MASK = 0x7, + IEEE802154_FRAME_TYPE_ACK = 0x2, + IEEE802154_FRAME_PENDING = 1 << 4, + IEEE802154_ACK_REQUEST = 1 << 5, + IEEE802154_DSN_OFFSET = 2, +}; + +enum +{ + QORVO_RSSI_OFFSET = 73, + QORVO_CRC_BIT_MASK = 0x80, + QORVO_LQI_BIT_MASK = 0x7f, +}; + +extern otRadioFrame sTransmitFrame; + +static otRadioState sState; +static otInstance * pQorvoInstance; + +typedef struct otCachedSettings_s +{ + uint16_t panid; +} otCachedSettings_t; + +static otCachedSettings_t otCachedSettings; + +/* Upper layer relies on txpower could be set before receive, but MAC have per-channel config for it. + Store txpower until channel set in Receive(). */ +#define PENDING_TX_POWER_NONE (-1) +static int8_t pendingTxPower = PENDING_TX_POWER_NONE; + +static uint8_t sScanstate = 0; +static int8_t sLastReceivedPower = 127; + +otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioGetCaps(); +} + +const char *otPlatRadioGetVersionString(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return "OPENTHREAD/Qorvo/0.0"; +} + +int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return QPG_RECEIVE_SENSITIVITY; +} + +void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioGetIeeeEui64(aIeeeEui64); +} + +void otPlatRadioSetPanId(otInstance *aInstance, otPanId aPanId) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetPanId((uint16_t)aPanId); + otCachedSettings.panid = aPanId; +} + +void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *address) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetExtendedAddress(address->m8); +} + +void otPlatRadioSetShortAddress(otInstance *aInstance, otShortAddress aShortAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetShortAddress((uint16_t)aShortAddress); +} + +otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower) +{ + OT_UNUSED_VARIABLE(aInstance); + + otError result; + + if (aPower == NULL) + { + return OT_ERROR_INVALID_ARGS; + } + + if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0)) + { + *aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower; + return OT_ERROR_NONE; + } + + result = qorvoRadioGetTransmitPower(aPower); + + if (result == OT_ERROR_INVALID_STATE) + { + // Channel was not set, so txpower is ambigious + *aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower; + return OT_ERROR_NONE; + } + + return result; +} + +otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) +{ + OT_UNUSED_VARIABLE(aInstance); + + otError result; + + if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0)) + { + pendingTxPower = aPower; + return OT_ERROR_NONE; + } + + result = qorvoRadioSetTransmitPower(aPower); + + if (result == OT_ERROR_INVALID_STATE) + { + // Channel was not set, so txpower is ambigious + pendingTxPower = aPower; + result = OT_ERROR_NONE; + } + + return result; +} + +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aGain); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetFemLnaGain(otInstance *aInstance, int8_t aGain) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aGain); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +bool otPlatRadioGetPromiscuous(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioGetPromiscuous(); +} + +void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetPromiscuous(aEnable); +} + +void otPlatRadioSetMacKey(otInstance * aInstance, + uint8_t aKeyIdMode, + uint8_t aKeyId, + const otMacKeyMaterial *aPrevKey, + const otMacKeyMaterial *aCurrKey, + const otMacKeyMaterial *aNextKey, + otRadioKeyType aKeyType) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetMacKey(aKeyIdMode, aKeyId, aPrevKey->mKeyMaterial.mKey.m8, aCurrKey->mKeyMaterial.mKey.m8, + aNextKey->mKeyMaterial.mKey.m8, aKeyType); +} + +void otPlatRadioSetMacFrameCounter(otInstance *aInstance, uint32_t aMacFrameCounter) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioSetMacFrameCounter(aMacFrameCounter); +} + +uint64_t otPlatTimeGet(void) +{ + // required for RCP/spinel + return qorvoRadioGetNow(); +} + +uint64_t otPlatRadioGetNow(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioGetNow(); +} + +uint32_t otPlatRadioGetBusSpeed(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return 0; +} + +otError otPlatRadioEnable(otInstance *aInstance) +{ + pQorvoInstance = aInstance; + memset(&otCachedSettings, 0x00, sizeof(otCachedSettings_t)); + + if (!otPlatRadioIsEnabled(aInstance)) + { + sState = OT_RADIO_STATE_SLEEP; + } + + return OT_ERROR_NONE; +} + +otError otPlatRadioDisable(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + otEXPECT(otPlatRadioIsEnabled(aInstance)); + + if (sState == OT_RADIO_STATE_RECEIVE) + { + qorvoRadioSetRxOnWhenIdle(false); + } + + sState = OT_RADIO_STATE_DISABLED; + +exit: + return OT_ERROR_NONE; +} + +bool otPlatRadioIsEnabled(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return (sState != OT_RADIO_STATE_DISABLED); +} + +otError otPlatRadioSleep(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + otError error = OT_ERROR_INVALID_STATE; + + if (sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_SLEEP) + { + qorvoRadioSetRxOnWhenIdle(false); + error = OT_ERROR_NONE; + sState = OT_RADIO_STATE_SLEEP; + } + return error; +} + +otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) +{ + otError error = OT_ERROR_INVALID_STATE; + + pQorvoInstance = aInstance; + + if ((sState != OT_RADIO_STATE_DISABLED) && (sScanstate == 0)) + { + qorvoRadioSetCurrentChannel(aChannel); + if (pendingTxPower != PENDING_TX_POWER_NONE) + { + qorvoRadioSetTransmitPower(pendingTxPower); + pendingTxPower = PENDING_TX_POWER_NONE; + } + error = OT_ERROR_NONE; + } + + if (sState == OT_RADIO_STATE_SLEEP) + { + qorvoRadioSetRxOnWhenIdle(true); + error = OT_ERROR_NONE; + sState = OT_RADIO_STATE_RECEIVE; + } + + return error; +} + +otError otPlatRadioReceiveAt(otInstance *aInstance, uint8_t aChannel, uint32_t aStart, uint32_t aDuration) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioReceiveAt(aChannel, aStart, aDuration); +} + +void cbQorvoRadioReceiveDone(otRadioFrame *aFrame, otError aError) +{ + if (aError == OT_ERROR_NONE) + { + sLastReceivedPower = aFrame->mInfo.mRxInfo.mRssi; + } + + otPlatRadioReceiveDone(pQorvoInstance, aFrame, aError); +} + +void cbQorvoDiagRadioReceiveDone(otRadioFrame *aFrame, otError aError) +{ + otPlatDiagRadioReceiveDone(pQorvoInstance, aFrame, aError); +} + +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return &sTransmitFrame; +} + +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) +{ + otError err = OT_ERROR_NONE; + + pQorvoInstance = aInstance; + + otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, err = OT_ERROR_INVALID_STATE); + + err = qorvoRadioTransmit(aFrame); + +exit: + return err; +} + +void cbQorvoRadioTxStarted(otRadioFrame *aFrame) +{ + otPlatRadioTxStarted(pQorvoInstance, aFrame); +} + +void cbQorvoRadioTransmitDone_AckFrame(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError) +{ + otPlatRadioTxDone(pQorvoInstance, aFrame, (aError == OT_ERROR_NONE) ? aAckFrame : NULL, aError); +} + +void cbQorvoRadioTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError) +{ + // TODO: pass received ACK frame instead of generating one. + otRadioFrame ackFrame; + uint8_t psdu[IEEE802154_ACK_LENGTH]; + + ackFrame.mPsdu = psdu; + ackFrame.mLength = IEEE802154_ACK_LENGTH; + ackFrame.mPsdu[0] = IEEE802154_FRAME_TYPE_ACK; + + if (aFramePending) + { + ackFrame.mPsdu[0] |= IEEE802154_FRAME_PENDING; + } + + ackFrame.mPsdu[1] = 0; + ackFrame.mPsdu[2] = aFrame->mPsdu[IEEE802154_DSN_OFFSET]; + + otPlatRadioTxDone(pQorvoInstance, aFrame, (aError == OT_ERROR_NONE) ? &ackFrame : NULL, aError); +} + +void cbQorvoDiagRadioTransmitDone(otRadioFrame *aFrame, otError aError) +{ + otPlatDiagRadioTransmitDone(pQorvoInstance, aFrame, aError); +} + +int8_t otPlatRadioGetRssi(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return sLastReceivedPower; +} + +otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration) +{ + OT_UNUSED_VARIABLE(aInstance); + + sScanstate = 1; + return qorvoRadioEnergyScan(aScanChannel, aScanDuration); +} + +void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi) +{ + sScanstate = 0; + otPlatRadioEnergyScanDone(pQorvoInstance, aEnergyScanMaxRssi); +} + +void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioEnableSrcMatch(aEnable); +} + +otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioAddSrcMatchShortEntry((uint16_t)aShortAddress, otCachedSettings.panid); +} + +otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioAddSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid); +} + +otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioClearSrcMatchShortEntry((uint16_t)aShortAddress, otCachedSettings.panid); +} + +otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioClearSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid); +} + +void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + /* clear both short and extended addresses here */ + qorvoRadioClearSrcMatchEntries(); +} + +void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + /* not implemented */ + /* assumes clearing of short and extended entries is done simultaniously by the openthread stack */ +} +uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return 0x03fff800; +} + +uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return 0x03fff800; +} + +otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aEnabled); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +bool otPlatRadioIsCoexEnabled(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return false; +} + +otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aCoexMetrics); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioEnableCsl(otInstance * aInstance, + uint32_t aCslPeriod, + otShortAddress aShortAddr, + const otExtAddress *aExtAddr) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioEnableCsl(aCslPeriod, (uint16_t)aShortAddr, aExtAddr->m8); +} + +void otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTime) +{ + OT_UNUSED_VARIABLE(aInstance); + + qorvoRadioUpdateCslSampleTime(aCslSampleTime); +} + +uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return QPG_CSL_ACCURACY; +} + +uint8_t otPlatRadioGetCslClockUncertainty(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + + return QPG_CSL_CLOCK_UNCERTAINTY; +} + +otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aChannel); + OT_UNUSED_VARIABLE(aMaxPower); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aRegionCode); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aRegionCode); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioConfigureEnhAckProbing(otInstance * aInstance, + otLinkMetrics aLinkMetrics, + otShortAddress aShortAddress, + const otExtAddress *aExtAddress) +{ + OT_UNUSED_VARIABLE(aInstance); + + return qorvoRadioConfigureEnhAckProbing(aLinkMetrics, (uint16_t)aShortAddress, aExtAddress->m8); +} diff --git a/Software/OpenThread/src/qpg7015m/random_qorvo.h b/Software/OpenThread/src/qpg7015m/random_qorvo.h new file mode 100644 index 0000000..277019c --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/random_qorvo.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the declarations of the random functions from the Qorvo library. + * + */ + +#ifndef RANDOM_QORVO_H_ +#define RANDOM_QORVO_H_ + +#include + +/** + * This function initializes the random number service used by OpenThread. + * + */ +void qorvoRandomInit(void); + +/** + * This function returns an array of random numbers. + * + * @param[out] aOutput Pointer to an array which will be filled with random data. + * @param[in] aOutputLength number of bytes which will be written into the array. + * + */ +void qorvoRandomGet(uint8_t *aOutput, uint8_t aOutputLength); + +#endif // RANDOM_QORVO_H_ diff --git a/Software/OpenThread/src/qpg7015m/system.c b/Software/OpenThread/src/qpg7015m/system.c new file mode 100644 index 0000000..de1c9f0 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/system.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes the platform-specific initializers. + */ + +#include "stdio.h" +#include "stdlib.h" + +#include + +#include "utils/uart.h" + +#include "qvOT/inc/alarm_qorvo.h" +#include "qvOT/inc/platform_qorvo.h" +#include "qvOT/inc/radio_qorvo.h" +#include "random_qorvo.h" +#include "qvOT/inc/uart_qorvo.h" + +void platformUartInit(void); +void platformUartProcess(void); + +otInstance *localInstance = NULL; + +int gArgumentsCount = 0; +char **gArguments = NULL; + +uint8_t qorvoPlatGotoSleepCheck(void) +{ + bool canGotoSleep = false; + + if (localInstance) + { + canGotoSleep = !otTaskletsArePending(localInstance); + } + + return canGotoSleep; +} + +void otSysInit(int argc, char *argv[]) +{ + gArgumentsCount = argc; + gArguments = argv; + + qorvoPlatInit((qorvoPlatGotoSleepCheckCallback_t)qorvoPlatGotoSleepCheck); + platformUartInit(); + qorvoAlarmInit(); + qorvoRandomInit(); + qorvoRadioInit(); +} + +bool otSysPseudoResetWasRequested(void) +{ + return false; +} + +void otSysProcessDrivers(otInstance *aInstance) +{ + if (localInstance == NULL) + { + // local copy in case we need to perform a callback. + localInstance = aInstance; + } + + qorvoPlatMainLoop(!otTaskletsArePending(aInstance)); + platformUartProcess(); + // qorvoRadioProcess(); + // qorvoAlarmProcess(); +} diff --git a/Software/OpenThread/src/qpg7015m/uart-posix.c b/Software/OpenThread/src/qpg7015m/uart-posix.c new file mode 100644 index 0000000..3afc586 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/uart-posix.c @@ -0,0 +1,364 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#define _XOPEN_SOURCE 500 + +#include "qvOT/inc/alarm_qorvo.h" +#include "qvOT/inc/platform_qorvo.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utils/code_utils.h" +#include "utils/uart.h" + +#ifdef __linux__ +#include +int posix_openpt(int oflag); +int grantpt(int fildes); +int unlockpt(int fd); +char *ptsname(int fd); +#endif // __linux__ + +static uint8_t s_receive_buffer[128]; +static const uint8_t *s_write_buffer; +static uint16_t s_write_length; +static int s_in_fd; +static int s_out_fd; + +static struct termios original_stdin_termios; +static struct termios original_stdout_termios; + +static void restore_stdin_termios(void) +{ + tcsetattr(s_in_fd, TCSAFLUSH, &original_stdin_termios); +} + +static void restore_stdout_termios(void) +{ + tcsetattr(s_out_fd, TCSAFLUSH, &original_stdout_termios); +} + +void platformDummy(void *dummyPointer) +{ + OT_UNUSED_VARIABLE(dummyPointer); +} + +static void cbKeyPressed(uint8_t Param) +{ + OT_UNUSED_VARIABLE(Param); + + qorvoAlarmMilliStart(0, platformDummy, (void *)&s_in_fd); +} + +void platformUartRestore(void) +{ + restore_stdin_termios(); + restore_stdout_termios(); + dup2(s_out_fd, STDOUT_FILENO); + + qorvoPlatUnRegisterPollFunction(s_in_fd); + qorvoPlatUnRegisterPollFunction(s_out_fd); + + otPlatUartDisable(); +} + +void platformUartInit(void) +{ + s_in_fd = dup(STDIN_FILENO); + s_out_fd = dup(STDOUT_FILENO); + dup2(STDERR_FILENO, STDOUT_FILENO); + + int res = fcntl(s_in_fd, F_SETFD, fcntl(s_in_fd, F_GETFD) | FD_CLOEXEC); + otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed")); + + res = fcntl(s_out_fd, F_SETFD, fcntl(s_out_fd, F_GETFD) | FD_CLOEXEC); + otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed")); + + qorvoPlatRegisterPollFunction(s_in_fd, cbKeyPressed); + qorvoPlatRegisterPollFunction(s_out_fd, cbKeyPressed); + + return; + +exit: + exit(1); +} + +otError otPlatUartEnable(void) +{ + otError error = OT_ERROR_NONE; + struct termios termios; + +#ifdef __linux__ + // Ensure we terminate this process if the + // parent process dies. + prctl(PR_SET_PDEATHSIG, SIGHUP); +#endif + + // We need this signal to make sure that this + // process terminates properly. + signal(SIGPIPE, SIG_DFL); + + if (isatty(s_in_fd)) + { + tcgetattr(s_in_fd, &original_stdin_termios); + atexit(&restore_stdin_termios); + } + + if (isatty(s_out_fd)) + { + tcgetattr(s_out_fd, &original_stdout_termios); + atexit(&restore_stdout_termios); + } + + if (isatty(s_in_fd)) + { + // get current configuration + otEXPECT_ACTION(tcgetattr(s_in_fd, &termios) == 0, perror("tcgetattr"); error = OT_ERROR_GENERIC); + + // Set up the termios settings for raw mode. This turns + // off input/output processing, line processing, and character processing. + cfmakeraw(&termios); + + // Set up our cflags for local use. Turn on hangup-on-close. + termios.c_cflag |= HUPCL | CREAD | CLOCAL; + + // "Minimum number of characters for noncanonical read" + termios.c_cc[VMIN] = 1; + + // "Timeout in deciseconds for noncanonical read" + termios.c_cc[VTIME] = 0; + + // configure baud rate + otEXPECT_ACTION(cfsetispeed(&termios, B115200) == 0, perror("cfsetispeed"); error = OT_ERROR_GENERIC); + + // set configuration + otEXPECT_ACTION(tcsetattr(s_in_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC); + } + + if (isatty(s_out_fd)) + { + // get current configuration + otEXPECT_ACTION(tcgetattr(s_out_fd, &termios) == 0, perror("tcgetattr"); error = OT_ERROR_GENERIC); + + // Set up the termios settings for raw mode. This turns + // off input/output processing, line processing, and character processing. + cfmakeraw(&termios); + + // Absolutely obliterate all output processing. + termios.c_oflag = 0; + + // Set up our cflags for local use. Turn on hangup-on-close. + termios.c_cflag |= HUPCL | CREAD | CLOCAL; + + // configure baud rate + otEXPECT_ACTION(cfsetospeed(&termios, B115200) == 0, perror("cfsetospeed"); error = OT_ERROR_GENERIC); + + // set configuration + otEXPECT_ACTION(tcsetattr(s_out_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC); + } + + return error; + +exit: + close(s_in_fd); + close(s_out_fd); + return error; +} + +otError otPlatUartDisable(void) +{ + otError error = OT_ERROR_NONE; + + close(s_in_fd); + close(s_out_fd); + + return error; +} + +otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength) +{ + otError error = OT_ERROR_NONE; + + otEXPECT_ACTION(s_write_length == 0, error = OT_ERROR_BUSY); + + s_write_buffer = aBuf; + s_write_length = aBufLength; + + qorvoAlarmMilliStart(0, platformDummy, (void *)&s_in_fd); + +exit: + return error; +} + +void platformUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, fd_set *aErrorFdSet, int *aMaxFd) +{ + if (aReadFdSet != NULL) + { + FD_SET(s_in_fd, aReadFdSet); + + if (aErrorFdSet != NULL) + { + FD_SET(s_in_fd, aErrorFdSet); + } + + if (aMaxFd != NULL && *aMaxFd < s_in_fd) + { + *aMaxFd = s_in_fd; + } + } + + if ((aWriteFdSet != NULL) && (s_write_length > 0)) + { + FD_SET(s_out_fd, aWriteFdSet); + + if (aErrorFdSet != NULL) + { + FD_SET(s_out_fd, aErrorFdSet); + } + + if (aMaxFd != NULL && *aMaxFd < s_out_fd) + { + *aMaxFd = s_out_fd; + } + } +} + +otError otPlatUartFlush(void) +{ + otError error = OT_ERROR_NONE; + ssize_t count; + + otEXPECT_ACTION(s_write_buffer != NULL && s_write_length > 0, error = OT_ERROR_INVALID_STATE); + + while ((count = write(s_out_fd, s_write_buffer, s_write_length)) > 0 && (s_write_length -= count) > 0) + { + s_write_buffer += count; + } + + if (count != -1) + { + assert(s_write_length == 0); + s_write_buffer = NULL; + } + else + { + perror("write(UART)"); + exit(EXIT_FAILURE); + } + +exit: + return error; +} + +void platformUartProcess(void) +{ + ssize_t rval; + const int error_flags = POLLERR | POLLNVAL | POLLHUP; + struct pollfd pollfd[] = { + {s_in_fd, POLLIN | error_flags, 0}, + {s_out_fd, POLLOUT | error_flags, 0}, + }; + + errno = 0; + + rval = poll(pollfd, sizeof(pollfd) / sizeof(*pollfd), 0); + + if (rval < 0) + { + perror("poll"); + exit(EXIT_FAILURE); + } + + if (rval > 0) + { + if ((pollfd[0].revents & error_flags) != 0) + { + perror("s_in_fd"); + exit(EXIT_FAILURE); + } + + if ((pollfd[1].revents & error_flags) != 0) + { + perror("s_out_fd"); + exit(EXIT_FAILURE); + } + + if (pollfd[0].revents & POLLIN) + { + rval = read(s_in_fd, s_receive_buffer, sizeof(s_receive_buffer)); + + if (rval <= 0) + { + perror("read"); + exit(EXIT_FAILURE); + } + otPlatUartReceived(s_receive_buffer, (uint16_t)rval); + } + + if ((s_write_length > 0) && (pollfd[1].revents & POLLOUT)) + { + rval = write(s_out_fd, s_write_buffer, s_write_length); + + if (rval >= 0) + { + s_write_buffer += (uint16_t)rval; + s_write_length -= (uint16_t)rval; + + if (s_write_length == 0) + { + otPlatUartSendDone(); + } + } + else if (errno != EINTR) + { + perror("write"); + exit(EXIT_FAILURE); + } + } + } +} + +/** + * The weak stubs functions definition. + */ +OT_TOOL_WEAK void otPlatUartSendDone(void) +{ +} + +OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) +{ + (void)aBuf; + (void)aBufLength; +} diff --git a/Software/OpenThread/src/qpg7015m/uart-socket.c b/Software/OpenThread/src/qpg7015m/uart-socket.c new file mode 100644 index 0000000..2238577 --- /dev/null +++ b/Software/OpenThread/src/qpg7015m/uart-socket.c @@ -0,0 +1,385 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file implements the OpenThread platform abstraction for cli over ip socket communication. + * + */ + +#include "qvOT/inc/alarm_qorvo.h" +#include "qvOT/inc/platform_qorvo.h" +#include "qvOT/inc/uart_qorvo.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include "utils/code_utils.h" +#include "utils/uart.h" + +#define BUFFER_MAX_SIZE 255 +#define SOCKET_PORT 9190 +#define SOCKET_WRITE(socketInfo, buf, length) \ + sendto(socketInfo.socketId, (const char *)buf, length, 0, &socketInfo.addr, sizeof(socketInfo.addr)) +#define SOCKET_READ(socketId, buf, length) recv(socketId, buf, length, 0) + +typedef struct +{ + int socketId; + bool isValid; + struct sockaddr addr; + pthread_t rfReadThread; +} PlatSocket_t; + +PlatSocket_t PlatSocketConnection = {-1, 0, {0}, 0}; +int PlatSocketPipeFd[2] = {-1, -1}; +int PlatServerSocketId = -1; + +void PlatSocketRxNewConn(uint8_t id); +void PlatSocketInit(void); +void PlatSocketDeInit(void); +int PlatSocketTxData(uint16_t length, uint8_t *pData, int socketId); + +#define PLAT_UART_MAX_CHAR 1024 + +uint32_t PlatSocketId = 0; + +void PlatSocketSendInput(void *buffer) +{ + uint16_t len = 0; + uint8_t *buf = &((uint8_t *)buffer)[2]; + + len = ((uint16_t *)buffer)[0]; + otPlatUartReceived(buf, len); + free(buffer); +} + +void PlatSocketRx(uint16_t length, const char *buffer, uint32_t socketId) +{ + uint8_t *buf = 0; + PlatSocketId = socketId; + + if (length > 0) + { + buf = malloc(sizeof(length) + length); + memcpy(buf, &length, sizeof(length)); + memcpy(buf + sizeof(length), buffer, length); + qorvoAlarmMilliStart(0, PlatSocketSendInput, (void *)buf); + } +} + +void PlatSocketClose(uint32_t socketId) +{ + close(socketId); +} + +otError otPlatUartEnable(void) +{ + PlatSocketInit(); + return OT_ERROR_NONE; +} + +otError otPlatUartDisable(void) +{ + PlatSocketDeInit(); + return OT_ERROR_NONE; +} + +otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength) +{ + otError error = OT_ERROR_NONE; + char localbuf[PLAT_UART_MAX_CHAR]; + + if (aBufLength > PLAT_UART_MAX_CHAR - 1) + { + perror("Max buffer length exceeded"); + return OT_ERROR_GENERIC; + } + + memcpy(localbuf, aBuf, aBufLength); + localbuf[aBufLength] = 0; + printf("%s", localbuf); + + if (PlatSocketId) + { + PlatSocketTxData(aBufLength, (uint8_t *)aBuf, PlatSocketId); + } + + otPlatUartSendDone(); + return error; +} + +otError otPlatUartFlush(void) +{ + return OT_ERROR_NOT_IMPLEMENTED; +} + +int PlatSocketListenForClients() +{ + // Setup server side socket + int sockfd; + struct sockaddr_in serv_addr; + uint32_t flag = 1; + int ret; + + sockfd = socket(AF_INET, SOCK_STREAM, 0); + otEXPECT_ACTION(sockfd >= 0, sockfd = -1); + + // disable Nagle's algorithm to avoid long latency + setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag)); + // allow reuse of the same address + setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof(flag)); + memset(&serv_addr, 0, sizeof(serv_addr)); + + serv_addr.sin_addr.s_addr = INADDR_ANY; + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(SOCKET_PORT); + ret = bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)); + otEXPECT_ACTION(ret >= 0, close(sockfd); sockfd = -1; perror("bind() failed"); exit(ret)); + ret = listen(sockfd, 10); + otEXPECT_ACTION(ret != -1, perror("listen() failed"); exit(1)); +exit: + return sockfd; +} + +void PlatSocketRxSignaled(uint8_t id) +{ + OT_UNUSED_VARIABLE(id); + + // Dummy callback function to flush pipe + uint8_t readChar; + // Remove trigger byte from pipe + read(PlatSocketPipeFd[0], &readChar, 1); +} + +void *PlatSocketReadThread(void *pClientSocket) +{ + char buffer[BUFFER_MAX_SIZE]; + PlatSocket_t *clientSocket = ((PlatSocket_t *)pClientSocket); + + memset(buffer, 0, BUFFER_MAX_SIZE); + + while (1) + { + int readLen = SOCKET_READ(clientSocket->socketId, buffer, BUFFER_MAX_SIZE); + + if (readLen < 0) + { + perror("Reading socket"); + break; + } + else + { + if (readLen == 0) + { + break; + } + + { + uint8_t someByte = 0x12; // No functional use only using pipe to kick main thread + + PlatSocketRx(readLen, buffer, clientSocket->socketId); + + write(PlatSocketPipeFd[1], &someByte, 1); //[1] = write fd + } + } + } + + clientSocket->isValid = 0; + qorvoPlatUnRegisterPollFunction(clientSocket->socketId); + + PlatSocketClose(clientSocket->socketId); + + return NULL; +} + +void PlatSocketRxNewConn(uint8_t id) +{ + // Find first non-valid client in list - add here + if (PlatSocketConnection.isValid == 0) + { + // Add new client to client list + socklen_t len; + len = sizeof(PlatSocketConnection.addr); + int retval = accept(id, (struct sockaddr *)&PlatSocketConnection.addr, (socklen_t *)&len); + + if (retval >= 0) + { + int retErr; + PlatSocketConnection.socketId = retval; + retErr = + pthread_create(&PlatSocketConnection.rfReadThread, NULL, PlatSocketReadThread, &PlatSocketConnection); + + if (retErr) + { + close(PlatSocketConnection.socketId); + } + else + { + PlatSocketConnection.isValid = 1; + } + } + } + else + { + int tempfd; + tempfd = accept(id, (struct sockaddr *)NULL, NULL); + + if (tempfd >= 0) + { + close(tempfd); + } + } +} + +/***************************************************************************** + * Public Function Definitions + *****************************************************************************/ + +void PlatSocketInit(void) +{ + int res; + memset(&PlatSocketConnection, 0, sizeof(PlatSocketConnection)); + + // in case we are a server, setup listening for client + PlatServerSocketId = PlatSocketListenForClients(); + qorvoPlatRegisterPollFunction(PlatServerSocketId, PlatSocketRxNewConn); + + // hack + res = pipe(PlatSocketPipeFd); + otEXPECT_ACTION(res == 0, perror("pipe() failed")); + + res = fcntl(PlatSocketPipeFd[0], F_SETFD, fcntl(PlatSocketPipeFd[0], F_GETFD) | FD_CLOEXEC); + otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed")); + + res = fcntl(PlatSocketPipeFd[1], F_SETFD, fcntl(PlatSocketPipeFd[1], F_GETFD) | FD_CLOEXEC); + otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed")); + + qorvoPlatRegisterPollFunction(PlatSocketPipeFd[0], PlatSocketRxSignaled); + + return; + +exit: + qorvoPlatUnRegisterPollFunction(PlatServerSocketId); + close(PlatServerSocketId); + exit(1); +} + +void platformUartRestore(void) +{ + PlatSocketDeInit(); +} + +void PlatSocketDeInit(void) +{ + if (PlatServerSocketId >= 0) + { + qorvoPlatUnRegisterPollFunction(PlatServerSocketId); + close(PlatServerSocketId); + } + + if (PlatSocketPipeFd[0] >= 0) + { + qorvoPlatUnRegisterPollFunction(PlatSocketPipeFd[0]); + close(PlatSocketPipeFd[0]); + } + + if (PlatSocketPipeFd[1] >= 0) + { + close(PlatSocketPipeFd[1]); + } + + if (PlatSocketConnection.socketId >= 0) + { + close(PlatSocketConnection.socketId); + } + sync(); +} + +int PlatSocketTxData(uint16_t length, uint8_t *pData, int socketId) +{ + int result = -1; + + // All sockets + if (PlatSocketConnection.isValid) + { + if (PlatSocketConnection.socketId == socketId) + { + if (SOCKET_WRITE(PlatSocketConnection, (const char *)pData, length) < 0) + { + perror("TxSocket: Error Writing to client"); + close(PlatSocketConnection.socketId); + PlatSocketConnection.isValid = 0; + } + else + { + result = 0; + } + } + } + + return result; +} + +void platformUartProcess(void) +{ +} + +void platformUartInit(void) +{ +} + +OT_TOOL_WEAK void otPlatUartSendDone(void) +{ +} + +OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) +{ + OT_UNUSED_VARIABLE(aBuf); + OT_UNUSED_VARIABLE(aBufLength); +} diff --git a/ThirdParty/openthread b/ThirdParty/openthread new file mode 160000 index 0000000..5516024 --- /dev/null +++ b/ThirdParty/openthread @@ -0,0 +1 @@ +Subproject commit 551602490555033a010ed4b4649821df4b2b882d diff --git a/ThirdParty/tool_rpi b/ThirdParty/tool_rpi new file mode 160000 index 0000000..13474ee --- /dev/null +++ b/ThirdParty/tool_rpi @@ -0,0 +1 @@ +Subproject commit 13474ee775d0c5ec8a7da4fb0a9fa84187abfc87 diff --git a/build_steps_and_customization.md b/build_steps_and_customization.md new file mode 100644 index 0000000..5af7e5c --- /dev/null +++ b/build_steps_and_customization.md @@ -0,0 +1,197 @@ +# Buil Steps and customization + +This document describes the steps used by the [buildall.sh script](Software/OpenThread/buildall.sh) to build OpenThread _CLI_ and _RCP_ for the Raspberry Pi, it also includes instructions on building for custom platforms. Please refer to the [README.md](README.md) for more information about the architecture. + +> **NOTE** this guide will only refer to GPG1715M for simplicity, but the steps are the same for GP712. + +--- + +- [Buil Steps and customization](#buil-steps-and-customization) + - [Build steps](#build-steps) + - [Building libQorvo](#building-libqorvo) + - [Building RCP and CLI](#building-rcp-and-cli) + - [Prepare the environment](#prepare-the-environment) + - [Build CLI](#build-cli) + - [Build RCP](#build-rcp) + - [Building libQorvo for Custom Platform](#building-libqorvo-for-custom-platform) + - [Customizing Compiler Settings](#customizing-compiler-settings) +--- + +## Build steps + +### Building libQorvo + +The sources and makefiles to build `libQorvo` are available under [Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M](Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M) and can be built as: + +```shell +cd Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software +./build.sh +``` + +If everything is configured correctly, the build script will generate library files at (paths are relative to `build.sh` location): + +- `OpenThread_Lib_QPG7015M/Work/QorvoQPG7015M_rpi_cli_ftd_socket/libQorvoQPG7015M_rpi_cli_ftd_socket.a` +- `OpenThread_Lib_QPG7015M/Work/QorvoQPG7015M_rpi_cli_mtd_socket/libQorvoQPG7015M_rpi_cli_mtd_socket.a` +- `OpenThread_Lib_QPG7015M/Work/QorvoQPG7015M_rpi_rcp_socket/libQorvoQPG7015M_rpi_rcp_socket.a` + +The compiler for `build.sh` and underlying makefiles can be configured by setting system environment variables. + +Here is an example from [buildall.sh script](Software/OpenThread/buildall.sh) and more details can be found in [Customizing Compiler Settings](#customizing-compiler-settings). + +```shell +export TOOLCHAIN_RPI="/ThirdParty/tool_rpi/arm-bcm2708/arm-linux-gnueabihf)" +export TOOLCHAIN="${TOOLCHAIN_RPI}" +export CROSS_COMPILE="arm-linux-gnueabihf-" +export SYSTEMROOT="${TOOLCHAIN}/arm-linux-gnueabihf/sysroot" +``` + +When the compiler is configured, the libraries can be also built by running the makefiles that are included in the libQorvo source package: + +`GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M` + +```shell +make –f Makefile.QorvoQPG7015M_rpi_cli_ftd_socket +make –f Makefile.QorvoQPG7015M_rpi_cli_mtd_socket +make –f Makefile.QorvoQPG7015M_rpi_rcp_socket +``` + +**Note:** Both _Full Thread Device_ and _Minimal Thread Device_ libraries are provided, although FTD is a more likely scenario in a gateway context (the one used in `buildall.sh`). the difference is that FTD library supports Commissioner role while MTD library does not. + +### Building RCP and CLI + +#### Prepare the environment + +Add the compiler to `$PATH` + +```shell +export PATH=/ThirdParty/tool_rpi/arm-bcm2708/arm-linux-gnueabihf/bin/:$PATH +``` + +Prepare folder structure + +```shell +cd Software/OpenThread +mkdir -p library/qpg7015m/lib +``` + +OpenThread provides a series of configuration switches to enable additional functionality in the build. For a list of the regular and the advanced features we refer you to [common-switches.mk](https://github.com/openthread/openthread/tree/master/examples/common-switches.mk) and the enhanced feature menu on the [build instructions landing page](https://openthread.io/guides/build), respectively. + +#### Build CLI + +Copy the library generated in the [Building libQorvo](#building-libqorvo) step to `Software/OpenThread/library/qpg7015m/lib/libQorvoQPG7015M_ftd.a` + +```shell +rm -f ./library/qpg7015m/lib/libQorvoQPG7015M_ftd.a +cp ./src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Work/QorvoQPG7015M_rpi_cli_ftd_socket/libQorvoQPG7015M_rpi_cli_ftd_socket.a ./library/qpg7015m/lib/libQorvoQPG7015M_ftd.a +``` + +The basic build command for the QPG7015M is: + +```shell +./script/build qpg7015m +``` +This will build the CLI application for *Full Thread Device*. The output will be the following `.elf` file located in `Software/OpenThread/build/bin` + +- `qpg7015m-ot-cli-ftd.elf` + +Note that the Raspberry Pi binaries available in the QPG7015M DK have both commissioner and joiner functionality built-in since they are built with: + +```shell +./script/build qpg7015m -DOT_APP_CLI=1 -DOT_FTD=1 -DOT_COMMISSIONER=1 -DOT_JOINER=1 -DOT_DHCP6_CLIENT=1 -DOT_DHCP6_SERVER=1 +``` + +#### Build RCP + +Copy library generated in [Building libQorvo](#building-libqorvo) step to `Software/OpenThread/library/qpg7015m/lib/libQorvoQPG7015M_rcp.a` + +```shell +rm -f ./library/qpg7015m/lib/libQorvoQPG7015M_rcp.a +cp ./src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/Work/QorvoQPG7015M_rpi_cli_ftd_socket/libQorvoQPG7015M_rpi_cli_rcp_socket.a ./library/qpg7015m/lib/libQorvoQPG7015M_rcp.a +``` + +```shell +./script/build qpg7015m -DOT_APP_RCP=1 -DOT_RCP=1 -DOT_COMMISSIONER=1 -DOT_JOINER=1 -DOT_DHCP6_CLIENT=1 -DOT_DHCP6_SERVER=1 +``` + +This will build the CLI application for *RCP*. The output will be the following `.elf` file located in `Software/OpenThread/build/bin` + +- `qpg7015m-ot-cli-rcp.elf` + + +### Building libQorvo for Custom Platform + +The OpenThread implementation provides network stack source and platform-independent APIs to build applications on top of it. Device-specific code is separated from platform libraries such as libQorvo. The Qorvo OpenThread package provides the following components: + +- libQorvo sources for building on the target platform including needed components +- Makefile with buildflags +- Toolchain defines for make + +#### Customizing Compiler Settings + +Toolchain path and settings can be configured by editing Makefiles in `Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M` directory. Target compiler can be selected by editing `COMPILER` variable in Makefile, i.e. `COMPILER:=rpi_bcm2708` will use `Software/OpenThread/src/qpg7015m/GP_P1053_SW_15655_Smart_Home_Gateway_OpenThread_Lib_QPG7015M/Software/OpenThread_Lib_QPG7015M/make/compilers/rpi_bcm2708/compiler_defines.mk` + +Basic `compiler_defines.mk` toolchain +configuration includes: + +Path to toolchain root: + +```shell +TOOLCHAIN ?=$(ROOTDIR)/gpHub/TOOL_RPi/bin/arm-gcc-4.7.1 +``` + +Architecture name: + +```shell +ARCH ?=arm +``` + +Toolchain prefix: + +```shell +CROSS_COMPILE ?=$(ARCH)-bcm2708hardfp-linux-gnueabi- +``` + +System root definition: + +```shell +SYSTEMROOT ?=$(TOOLCHAIN)/arm-bcm2708hardfp-linux-gnueabi/sysroot +``` + +Default compiler flags: + +```shell +FLAGS_COMPILER += -Os +FLAGS_COMPILER += -march=armv6j +FLAGS_COMPILER += -Wall +``` + +C compiler flags: + +```shell +CFLAGS_COMPILER += $(FLAGS_COMPILER_FILTERED) +``` + +C++ compiler flags: + +```shell +CXXFLAGS_COMPILER += $(FLAGS_COMPILER_FILTERED) +CXXFLAGS_COMPILER +=-Wno-reorder +``` + +Assembler flags: + +```shell +ASFLAGS_COMPILER+= +``` + +Linker options: + +```shell +LDFLAGS_COMPILER+=--sysroot=$(SYSTEMROOT) +``` + +Library options: + +```shell +LIBFLAGS_COMPILER+= +``` \ No newline at end of file