drivers: ieee802154: New API for modulated carrier wave transmission.
Added new API function to start modulated carrier wave transmission Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
This commit is contained in:
parent
c25e31512c
commit
e0f94f8823
8 changed files with 59 additions and 4 deletions
|
|
@ -100,6 +100,11 @@ config IEEE802154_SELECTIVE_TXCHANNEL
|
||||||
this Kconfig option is enabled. If the Kconfig option is disabled the drivers
|
this Kconfig option is enabled. If the Kconfig option is disabled the drivers
|
||||||
MUST NOT have the capability.
|
MUST NOT have the capability.
|
||||||
|
|
||||||
|
config IEEE802154_CARRIER_FUNCTIONS
|
||||||
|
bool "Support for carrier functions"
|
||||||
|
help
|
||||||
|
Enable support for functions such as modulated carrier and continuous carrier.
|
||||||
|
|
||||||
module = IEEE802154_DRIVER
|
module = IEEE802154_DRIVER
|
||||||
module-str = IEEE 802.15.4 driver
|
module-str = IEEE 802.15.4 driver
|
||||||
module-help = Sets log level for IEEE 802.15.4 Device Drivers.
|
module-help = Sets log level for IEEE 802.15.4 Device Drivers.
|
||||||
|
|
|
||||||
|
|
@ -730,7 +730,7 @@ static int nrf5_stop(const struct device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_NRF_802154_CARRIER_FUNCTIONS)
|
#if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS)
|
||||||
static int nrf5_continuous_carrier(const struct device *dev)
|
static int nrf5_continuous_carrier(const struct device *dev)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(dev);
|
ARG_UNUSED(dev);
|
||||||
|
|
@ -747,6 +747,23 @@ static int nrf5_continuous_carrier(const struct device *dev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int nrf_modulated_carrier(const struct device *dev, const uint8_t *data)
|
||||||
|
{
|
||||||
|
ARG_UNUSED(dev);
|
||||||
|
|
||||||
|
nrf_802154_tx_power_set(nrf5_data.txpwr);
|
||||||
|
|
||||||
|
if (!nrf_802154_modulated_carrier(data)) {
|
||||||
|
LOG_ERR("Failed to enter modulated carrier state");
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_DBG("Modulated carrier wave transmission started (channel: %d)",
|
||||||
|
nrf_802154_channel_get());
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CONFIG_IEEE802154_NRF5_EXT_IRQ_MGMT)
|
#if !defined(CONFIG_IEEE802154_NRF5_EXT_IRQ_MGMT)
|
||||||
|
|
@ -1271,15 +1288,16 @@ static const struct ieee802154_radio_api nrf5_radio_api = {
|
||||||
.set_txpower = nrf5_set_txpower,
|
.set_txpower = nrf5_set_txpower,
|
||||||
.start = nrf5_start,
|
.start = nrf5_start,
|
||||||
.stop = nrf5_stop,
|
.stop = nrf5_stop,
|
||||||
#if defined(CONFIG_NRF_802154_CARRIER_FUNCTIONS)
|
#if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS)
|
||||||
.continuous_carrier = nrf5_continuous_carrier,
|
.continuous_carrier = nrf5_continuous_carrier,
|
||||||
|
.modulated_carrier = nrf_modulated_carrier,
|
||||||
#endif
|
#endif
|
||||||
.tx = nrf5_tx,
|
.tx = nrf5_tx,
|
||||||
.ed_scan = nrf5_energy_scan_start,
|
.ed_scan = nrf5_energy_scan_start,
|
||||||
.get_time = nrf5_get_time,
|
.get_time = nrf5_get_time,
|
||||||
.get_sch_acc = nrf5_get_acc,
|
.get_sch_acc = nrf5_get_acc,
|
||||||
.configure = nrf5_configure,
|
.configure = nrf5_configure,
|
||||||
.attr_get = nrf5_attr_get
|
.attr_get = nrf5_attr_get,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CONFIG_NET_L2_IEEE802154)
|
#if defined(CONFIG_NET_L2_IEEE802154)
|
||||||
|
|
|
||||||
|
|
@ -1765,6 +1765,7 @@ struct ieee802154_radio_api {
|
||||||
*/
|
*/
|
||||||
int (*stop)(const struct device *dev);
|
int (*stop)(const struct device *dev);
|
||||||
|
|
||||||
|
#if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS)
|
||||||
/**
|
/**
|
||||||
* @brief Start continuous carrier wave transmission.
|
* @brief Start continuous carrier wave transmission.
|
||||||
*
|
*
|
||||||
|
|
@ -1786,6 +1787,30 @@ struct ieee802154_radio_api {
|
||||||
*/
|
*/
|
||||||
int (*continuous_carrier)(const struct device *dev);
|
int (*continuous_carrier)(const struct device *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Start modulated carrier wave transmission.
|
||||||
|
*
|
||||||
|
* @details When the radio is emitting modulated carrier signals, it
|
||||||
|
* blocks all transmissions on the selected channel.
|
||||||
|
* This function is to be called only during radio
|
||||||
|
* tests. Do not use it during normal device operation.
|
||||||
|
*
|
||||||
|
* @note Implementations MAY **sleep** and will usually NOT be
|
||||||
|
* **isr-ok**. MAY be called in any interface state once the driver is
|
||||||
|
* fully initialized ("ready").
|
||||||
|
*
|
||||||
|
* @param dev pointer to IEEE 802.15.4 driver device
|
||||||
|
* @param data Pointer to a buffer to modulate the carrier with.
|
||||||
|
* The first byte is the data length.
|
||||||
|
*
|
||||||
|
* @retval 0 modulated carrier wave transmission started
|
||||||
|
* @retval -EALREADY The driver was already in "TESTING" state and
|
||||||
|
* emitting a modulated carrier.
|
||||||
|
* @retval -EIO not started
|
||||||
|
*/
|
||||||
|
int (*modulated_carrier)(const struct device *dev, const uint8_t *data);
|
||||||
|
#endif /* CONFIG_IEEE802154_CARRIER_FUNCTIONS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set or update driver configuration.
|
* @brief Set or update driver configuration.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ config NRF_802154_SECURITY_KEY_STORAGE_SIZE
|
||||||
|
|
||||||
config NRF_802154_CARRIER_FUNCTIONS
|
config NRF_802154_CARRIER_FUNCTIONS
|
||||||
bool "nRF 802.15.4 carrier functions"
|
bool "nRF 802.15.4 carrier functions"
|
||||||
default y if OPENTHREAD_DIAG
|
default y if (OPENTHREAD_DIAG || IEEE802154_CARRIER_FUNCTIONS)
|
||||||
help
|
help
|
||||||
This option enables functions such as modulated carrier and continuous carrier.
|
This option enables functions such as modulated carrier and continuous carrier.
|
||||||
If this option is modified on a multicore SoC, its remote counterpart must be set to the exact same value.
|
If this option is modified on a multicore SoC, its remote counterpart must be set to the exact same value.
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,7 @@ config OPENTHREAD_DHCP6_SERVER
|
||||||
|
|
||||||
config OPENTHREAD_DIAG
|
config OPENTHREAD_DIAG
|
||||||
bool "Diagnostic functions support"
|
bool "Diagnostic functions support"
|
||||||
|
depends on IEEE802154_CARRIER_FUNCTIONS
|
||||||
help
|
help
|
||||||
Enable OpenThread CLI diagnostic commands
|
Enable OpenThread CLI diagnostic commands
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ void otPlatDiagRadioReceived(otInstance *aInstance,
|
||||||
ARG_UNUSED(aError);
|
ARG_UNUSED(aError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS)
|
||||||
otError otPlatDiagRadioTransmitCarrier(otInstance *aInstance, bool aEnable)
|
otError otPlatDiagRadioTransmitCarrier(otInstance *aInstance, bool aEnable)
|
||||||
{
|
{
|
||||||
if (!otPlatDiagModeGet()) {
|
if (!otPlatDiagModeGet()) {
|
||||||
|
|
@ -94,6 +95,7 @@ otError otPlatDiagRadioTransmitCarrier(otInstance *aInstance, bool aEnable)
|
||||||
|
|
||||||
return platformRadioTransmitCarrier(aInstance, aEnable);
|
return platformRadioTransmitCarrier(aInstance, aEnable);
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_IEEE802154_CARRIER_FUNCTIONS */
|
||||||
|
|
||||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,12 @@ void platformUartPanic(void);
|
||||||
*/
|
*/
|
||||||
uint16_t platformRadioChannelGet(otInstance *aInstance);
|
uint16_t platformRadioChannelGet(otInstance *aInstance);
|
||||||
|
|
||||||
|
#if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS)
|
||||||
/**
|
/**
|
||||||
* Start/stop continuous carrier wave transmission.
|
* Start/stop continuous carrier wave transmission.
|
||||||
*/
|
*/
|
||||||
otError platformRadioTransmitCarrier(otInstance *aInstance, bool aEnable);
|
otError platformRadioTransmitCarrier(otInstance *aInstance, bool aEnable);
|
||||||
|
#endif /* CONFIG_IEEE802154_CARRIER_FUNCTIONS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function initializes the random number service used by OpenThread.
|
* This function initializes the random number service used by OpenThread.
|
||||||
|
|
|
||||||
|
|
@ -823,6 +823,7 @@ otError otPlatRadioReceiveAt(otInstance *aInstance, uint8_t aChannel,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS)
|
||||||
otError platformRadioTransmitCarrier(otInstance *aInstance, bool aEnable)
|
otError platformRadioTransmitCarrier(otInstance *aInstance, bool aEnable)
|
||||||
{
|
{
|
||||||
if (radio_api->continuous_carrier == NULL) {
|
if (radio_api->continuous_carrier == NULL) {
|
||||||
|
|
@ -845,6 +846,7 @@ otError platformRadioTransmitCarrier(otInstance *aInstance, bool aEnable)
|
||||||
|
|
||||||
return OT_ERROR_NONE;
|
return OT_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_IEEE802154_CARRIER_FUNCTIONS */
|
||||||
|
|
||||||
otRadioState otPlatRadioGetState(otInstance *aInstance)
|
otRadioState otPlatRadioGetState(otInstance *aInstance)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue