Skip to content

Commit

Permalink
Merge pull request #5485 from jfischer-phytec-iot/pr@add-opt-netdev
Browse files Browse the repository at this point in the history
add testmode and cca mode option to netdev
  • Loading branch information
miri64 committed Aug 5, 2016
2 parents f1b519d + d111f1f commit cf11a0d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/include/net/netdev2/ieee802154.h
Expand Up @@ -58,6 +58,21 @@ extern "C" {
* @}
*/

/**
* @brief Option parameter to be used with @ref NETOPT_CCA_MODE to set
* the mode of the clear channel assessment (CCA) defined
* in Std 802.15.4.
*/
typedef enum {
NETDEV2_IEEE802154_CCA_MODE_1 = 1, /**< Energy above threshold */
NETDEV2_IEEE802154_CCA_MODE_2, /**< Carrier sense only */
NETDEV2_IEEE802154_CCA_MODE_3, /**< Carrier sense with energy above threshold */
NETDEV2_IEEE802154_CCA_MODE_4, /**< ALOHA */
NETDEV2_IEEE802154_CCA_MODE_5, /**< UWB preamble sense based on the SHR of a frame */
NETDEV2_IEEE802154_CCA_MODE_6, /**< UWB preamble sense based on the packet
* with the multiplexed preamble */
} netdev2_ieee802154_cca_mode_t;

/**
* @brief Extended structure to hold IEEE 802.15.4 driver state
*
Expand Down
35 changes: 35 additions & 0 deletions sys/include/net/netopt.h
Expand Up @@ -201,6 +201,15 @@ typedef enum {
*/
NETOPT_CCA_THRESHOLD,

/**
* @brief CCA mode for the radio transceiver
*
* Get/set the CCA mode as uint8_t
* corresponding to the respective PHY standard.
* - IEEE 802.15.4: @ref netdev2_ieee802154_cca_mode_t
*/
NETOPT_CCA_MODE,

/**
* @brief get statistics about sent and received packets and data of the device or protocol
*
Expand All @@ -215,6 +224,22 @@ typedef enum {
NETOPT_ENCRYPTION, /**< en/disable encryption */
NETOPT_ENCRYPTION_KEY, /**< set encryption key */

/**
* @brief Test mode for the radio, e.g. for CE or FCC certification
*
* Get/set the test mode as type @ref netopt_rf_testmode_t or as uint8_t
* if the radio supports other vendor specific test modes.
*
* @note Setting this option should always return -ENOTSUP,
* unless it was explicitly allowed at build time,
* therefore it should be secured with an additional macro in the device driver.
* For development and certification purposes only, this test modes can disturb
* normal radio communications and exceed the limits, established by
* the regulatory authority.
*
*/
NETOPT_RF_TESTMODE,

/* add more options if needed */

/**
Expand Down Expand Up @@ -255,6 +280,16 @@ typedef enum {
/* add other states if needed */
} netopt_state_t;

/**
* @brief Option parameter to be used with @ref NETOPT_RF_TESTMODE
*/
typedef enum {
NETOPT_RF_TESTMODE_IDLE = 0, /**< idle mode, radio off */
NETOPT_RF_TESTMODE_CRX, /**< continuous rx mode */
NETOPT_RF_TESTMODE_CTX_CW, /**< carrier wave continuous tx mode */
NETOPT_RF_TESTMODE_CTX_PRBS9, /**< PRBS9 continuous tx mode */
} netopt_rf_testmode_t;

/**
* @brief Get a string ptr corresponding to opt, for debugging
*
Expand Down
2 changes: 2 additions & 0 deletions sys/net/crosslayer/netopt/netopt.c
Expand Up @@ -53,9 +53,11 @@ static const char *_netopt_strmap[] = {
[NETOPT_DEVICE_TYPE] = "NETOPT_DEVICE_TYPE",
[NETOPT_CHANNEL_PAGE] = "NETOPT_CHANNEL_PAGE",
[NETOPT_CCA_THRESHOLD] = "NETOPT_CCA_THRESHOLD",
[NETOPT_CCA_MODE] = "NETOPT_CCA_MODE",
[NETOPT_STATS] = "NETOPT_STATS",
[NETOPT_ENCRYPTION] = "NETOPT_ENCRYPTION",
[NETOPT_ENCRYPTION_KEY] = "NETOPT_ENCRYPTION_KEY",
[NETOPT_RF_TESTMODE] = "NETOPT_RF_TESTMODE",
[NETOPT_NUMOF] = "NETOPT_NUMOF",
};

Expand Down

0 comments on commit cf11a0d

Please sign in to comment.