summaryrefslogtreecommitdiff
path: root/radio
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2021-09-16 11:09:30 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2021-09-16 11:09:30 +0200
commitcad5bd6501868f9532d5b4a227ca156f9c9d1d8e (patch)
tree7dce7fe31ed3f85ade53d38fe68b76e540403e5e /radio
parent3c526f3d0b30e200462290651f7c6a5eb30710a2 (diff)
Added NRF52 support.nrf52
Diffstat (limited to 'radio')
-rw-r--r--radio/radio.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/radio/radio.h b/radio/radio.h
new file mode 100644
index 0000000..010db43
--- /dev/null
+++ b/radio/radio.h
@@ -0,0 +1,115 @@
+#ifndef LAKS_RADIO_RADIO_H
+#define LAKS_RADIO_RADIO_H
+
+class RADIO_NRF_t {
+ private:
+ struct tasks_t {
+ volatile uint32_t TXEN;
+ volatile uint32_t RXEN;
+ volatile uint32_t START;
+ volatile uint32_t STOP;
+ volatile uint32_t DISABLE;
+ volatile uint32_t RSSISTART;
+ volatile uint32_t RSSISTOP;
+ volatile uint32_t BCSTART;
+ volatile uint32_t BCSTOP;
+ volatile uint32_t EDSTART;
+ volatile uint32_t EDSTOP;
+ volatile uint32_t CCASTART;
+ volatile uint32_t CCASTOP;
+ };
+
+ struct events_t {
+ volatile uint32_t READY;
+ volatile uint32_t ADDRESS;
+ volatile uint32_t PAYLOAD;
+ volatile uint32_t END;
+ volatile uint32_t DISABLED;
+ volatile uint32_t DEVMATCH;
+ volatile uint32_t DEVMISS;
+ volatile uint32_t RSSIEND;
+ uint32_t _reserved[2];
+ volatile uint32_t BCMATCH;
+ uint32_t _reserved_1;
+ volatile uint32_t CRCOK;
+ volatile uint32_t CRCERROR;
+ volatile uint32_t FRAMESTART;
+ volatile uint32_t EDEND;
+ volatile uint32_t EDSTOPPED;
+ volatile uint32_t CCAIDLE;
+ volatile uint32_t CCABUSY;
+ volatile uint32_t CCASTOPPED;
+ volatile uint32_t RATEBOOST;
+ volatile uint32_t TXREADY;
+ volatile uint32_t RXREADY;
+ volatile uint32_t MHRMATCH;
+ uint32_t _reserved_2[3];
+ volatile uint32_t PHYEND;
+ };
+
+ struct reg_t {
+ volatile uint32_t SHORTS;
+ uint32_t _reserved[63];
+ volatile uint32_t INTEN;
+ volatile uint32_t INTENSET;
+ volatile uint32_t INTENCLR;
+ uint32_t _reserved_1[61];
+ volatile uint32_t CRCSTATUS;
+ uint32_t _reserved_2;
+ volatile uint32_t RXMATCH;
+ volatile uint32_t RXCRC;
+ volatile uint32_t DAI;
+ volatile uint32_t PDUSTAT;
+ uint32_t _reserved_3[59];
+ volatile uint32_t PACKETPTR;
+ volatile uint32_t FREQUENCY;
+ volatile uint32_t TXPOWER;
+ volatile uint32_t MODE;
+ volatile uint32_t PCNF0;
+ volatile uint32_t PCNF1;
+ volatile uint32_t BASE[2];
+ volatile uint32_t PREFIX[2];
+ volatile uint32_t TXADDRESS;
+ volatile uint32_t RXADDRESSES;
+ volatile uint32_t CRCCNF;
+ volatile uint32_t CRCPOLY;
+ volatile uint32_t CRCINIT;
+ uint32_t _reserved_4;
+ volatile uint32_t TIFS;
+ volatile uint32_t RSSISAMPLE;
+ uint32_t _reserved_5;
+ volatile uint32_t STATE;
+ volatile uint32_t DATAWHITEIV;
+ uint32_t _reserved_6[2];
+ volatile uint32_t BCC;
+ uint32_t _reserved_7[39];
+ volatile uint32_t DAB[8];
+ volatile uint32_t DAP[8];
+ volatile uint32_t DACNF;
+ volatile uint32_t MHRMATCHCONF;
+ volatile uint32_t MHRMATCHMAS;
+ uint32_t _reserved_8;
+ volatile uint32_t MODECNF0;
+ uint32_t _reserved_9[3];
+ volatile uint32_t SFD;
+ volatile uint32_t EDCNT;
+ volatile uint32_t EDSAMPLE;
+ volatile uint32_t CCACTRL;
+ uint32_t _reserved_10[611];
+ volatile uint32_t POWER;
+ };
+
+ public:
+ tasks_t& tasks;
+ events_t& events;
+ reg_t& reg;
+
+ RADIO_NRF_t(uint32_t reg_addr) :
+ tasks(*(tasks_t*)(reg_addr + 0x0)),
+ events(*(events_t*)(reg_addr + 0x100)),
+ reg(*(reg_t*)(reg_addr + 0x200)) {}
+};
+
+static RADIO_NRF_t RADIO(0x40001000);
+
+#endif