diff --git a/drivers/include/net/netdev2/ieee802154.h b/drivers/include/net/netdev2/ieee802154.h index d491d5b43d00d41804caab507c2aa114ff558c53..26c861af5e64154bc42772c1a62dc6266e42bbb2 100644 --- a/drivers/include/net/netdev2/ieee802154.h +++ b/drivers/include/net/netdev2/ieee802154.h @@ -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 * diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index 9bf1bad0a8e811b64bf3727d2491cdd754beccb8..d9a02b1060749b3a70f42b7a611c23cb3acc0a5d 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -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 * @@ -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 */ /** @@ -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 * diff --git a/sys/net/crosslayer/netopt/netopt.c b/sys/net/crosslayer/netopt/netopt.c index 83ec4d26efafe21c20c8410ff768932c01b62829..4900bb59aa06d039b8efeaae9aad45bb137cafd7 100644 --- a/sys/net/crosslayer/netopt/netopt.c +++ b/sys/net/crosslayer/netopt/netopt.c @@ -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", };