From: Keith Packard Date: Thu, 23 Jan 2025 17:21:26 +0000 (-0800) Subject: altos: Add ao_radio_post (power-on self-test) for cc1200 X-Git-Tag: 1.9.20~1^2~24 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=adb1df0ae200d4aa37fed5a80d5be8cab305b1b3;p=fw%2Faltos altos: Add ao_radio_post (power-on self-test) for cc1200 This function checks to make sure the radio chip is present on the SPI bus. Signed-off-by: Keith Packard --- diff --git a/src/drivers/ao_cc1200.c b/src/drivers/ao_cc1200.c index ed1d298e..b3a1e575 100644 --- a/src/drivers/ao_cc1200.c +++ b/src/drivers/ao_cc1200.c @@ -1456,6 +1456,22 @@ static const struct ao_cmds ao_radio_cmds[] = { { 0, NULL } }; +/* Make sure the radio is alive */ +bool +ao_radio_post(void) +{ + uint8_t partnum; + + partnum = ao_radio_reg_read(CC1200_PARTNUMBER); + switch (partnum) { + case CC1200_PARTNUMBER_CC1200: + case CC1200_PARTNUMBER_CC1201: + return true; + default: + return false; + } +} + void ao_radio_init(void) { diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 0437cb07..1cfe29e9 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -667,6 +667,9 @@ ao_radio_test_on(void); void ao_radio_test_off(void); +bool +ao_radio_post(void); + void ao_radio_init(void);