drivers: ieee802154: cc1200: SUN-FSK compatibility
Preparative change to introduce build-time configured channel pages. This fixes the description of the driver's available PHYs and makes channel page and channel range independent from runtime attributes. Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This commit is contained in:
parent
dce3df81d4
commit
ea6248b870
|
@ -85,13 +85,22 @@ choice
|
|||
Set the RF preset you want to use.
|
||||
|
||||
config IEEE802154_CC1200_RF_SET_0
|
||||
bool "868MHz - 50Kbps - 2-GFSK - IEEE 802.15.4g compliant - ETSI"
|
||||
bool "IEEE 802.15.4g SUN MR-FSK, 863MHz band, mode #1 - channel page 9, 34 channels, 50Kbps (ETSI)"
|
||||
help
|
||||
This is a legacy IEEE 802.15.4g-2012 SUN MR-FSK PHY that does no
|
||||
longer exist in recent standards (IEEE 802.15.4-2015+).
|
||||
|
||||
config IEEE802154_CC1200_RF_SET_1
|
||||
bool "920MHz - 50Kbps - 2-GFSK - IEEE 802.15.4g compliant - ARIB"
|
||||
bool "IEEE 802.15.4g SUN MR-FSK 920MHz band, mode #1 - channel page 9, 39 channels, 50Kbps (ARIB)"
|
||||
help
|
||||
This is a legacy IEEE 802.15.4g-2012 SUN MR-FSK PHY that does no
|
||||
longer exist in recent standards (IEEE 802.15.4-2015+).
|
||||
|
||||
config IEEE802154_CC1200_RF_SET_2
|
||||
bool "434MHz - 50Kbps - 2-GFSK - IEEE 802.15.4g compliant - ETSI"
|
||||
bool "IEEE 802.15.4 Non-Standard 2-GFSK 433MHz band - channel page 9, 15 channels, 50Kbps (ETSI)"
|
||||
help
|
||||
This is a non-standard PHY similar to the IEEE 802.15.4g-2012 SUN
|
||||
MR-FSK PHY but not in one of the standard bands.
|
||||
|
||||
endchoice
|
||||
|
||||
|
|
|
@ -543,6 +543,15 @@ static int cc1200_cca(const struct device *dev)
|
|||
static int cc1200_set_channel(const struct device *dev, uint16_t channel)
|
||||
{
|
||||
struct cc1200_context *cc1200 = dev->data;
|
||||
uint32_t freq;
|
||||
|
||||
/* As SUN FSK provides a host of configurations with extremely different
|
||||
* channel counts it doesn't make sense to validate (aka -EINVAL) a
|
||||
* global upper limit on the number of supported channels on this page.
|
||||
*/
|
||||
if (channel > IEEE802154_CC1200_CHANNEL_LIMIT) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
/* Unlike usual 15.4 chips, cc1200 is closer to a bare metal radio modem
|
||||
* and thus does not provide any means to select a channel directly, but
|
||||
|
@ -552,14 +561,16 @@ static int cc1200_set_channel(const struct device *dev, uint16_t channel)
|
|||
* See rf_evaluate_freq_setting() above.
|
||||
*/
|
||||
|
||||
if (atomic_get(&cc1200->rx) == 0) {
|
||||
uint32_t freq = rf_evaluate_freq_setting(dev, channel);
|
||||
if (atomic_get(&cc1200->rx) != 0) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (!write_reg_freq(dev, freq) ||
|
||||
rf_calibrate(dev)) {
|
||||
LOG_ERR("Could not set channel %u", channel);
|
||||
return -EIO;
|
||||
}
|
||||
freq = rf_evaluate_freq_setting(dev, channel);
|
||||
|
||||
if (!write_reg_freq(dev, freq) ||
|
||||
rf_calibrate(dev)) {
|
||||
LOG_ERR("Could not set channel %u", channel);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -23,9 +23,10 @@
|
|||
|
||||
#if defined(CONFIG_IEEE802154_CC1200_RF_SET_0)
|
||||
|
||||
#define IEEE802154_CC1200_CHANNEL_LIMIT 33
|
||||
|
||||
const struct cc1200_rf_registers_set cc1200_rf_settings = {
|
||||
.chan_center_freq0 = 863125,
|
||||
.channel_limit = 33,
|
||||
.channel_spacing = 2000, /* 200 KHz */
|
||||
.registers = {
|
||||
0x6F, /* SYNC3 */
|
||||
|
@ -133,9 +134,10 @@ const struct cc1200_rf_registers_set cc1200_rf_settings = {
|
|||
|
||||
#elif defined(CONFIG_IEEE802154_CC1200_RF_SET_1)
|
||||
|
||||
#define IEEE802154_CC1200_CHANNEL_LIMIT 38
|
||||
|
||||
const struct cc1200_rf_registers_set cc1200_rf_settings = {
|
||||
.chan_center_freq0 = 920600,
|
||||
.channel_limit = 38,
|
||||
.channel_spacing = 2000, /* 200 KHz */
|
||||
.registers = {
|
||||
0x6F, /* SYNC3 */
|
||||
|
@ -243,9 +245,10 @@ const struct cc1200_rf_registers_set cc1200_rf_settings = {
|
|||
|
||||
#elif defined(CONFIG_IEEE802154_CC1200_RF_SET_2)
|
||||
|
||||
#define IEEE802154_CC1200_CHANNEL_LIMIT 14
|
||||
|
||||
const struct cc1200_rf_registers_set cc1200_rf_settings = {
|
||||
.chan_center_freq0 = 433164,
|
||||
.channel_limit = 14,
|
||||
.channel_spacing = 2000, /* 200 KHz */
|
||||
.registers = {
|
||||
0x6F, /* SYNC3 */
|
||||
|
|
Loading…
Reference in a new issue