1414#include "time_machine_if.h"
1515#include "NRF_RADIO.h"
1616#include "NRF_HW_model_top.h"
17+ #if defined(PPI_PRESENT )
1718#include "NRF_PPI.h"
19+ #elif defined(DPPI_PRESENT )
20+ #include "NRF_DPPI.h"
21+ #endif
1822#include "NRF_AES_CCM.h"
1923#include "irq_ctrl.h"
2024#include "irq_sources.h"
@@ -414,7 +418,16 @@ void nrf_radio_regw_sideeffects_POWER(){
414418
415419static void signal_READY (){
416420 NRF_RADIO_regs .EVENTS_READY = 1 ;
421+
422+ #if defined(PPI_PRESENT )
417423 nrf_ppi_event (RADIO_EVENTS_READY );
424+ #elif defined(DPPI_PRESENT )
425+ if (NRF_RADIO_regs .PUBLISH_READY & RADIO_PUBLISH_READY_EN_Msk )
426+ {
427+ uint8_t channel = NRF_RADIO_regs .PUBLISH_READY & RADIO_PUBLISH_READY_CHIDX_Msk ;
428+ nrf_dppi_publish (channel );
429+ }
430+ #endif
418431
419432 if ( NRF_RADIO_regs .SHORTS & RADIO_SHORTS_READY_START_Msk ) {
420433 nrf_radio_tasks_start ();
@@ -455,7 +468,16 @@ static void signal_RXREADY(){
455468
456469static void signal_RSSIEND (){
457470 NRF_RADIO_regs .EVENTS_RSSIEND = 1 ;
471+
472+ #if defined(PPI_PRESENT )
458473 nrf_ppi_event (RADIO_EVENTS_RSSIEND );
474+ #elif defined(DPPI_PRESENT )
475+ if (NRF_RADIO_regs .PUBLISH_RSSIEND & RADIO_PUBLISH_RSSIEND_EN_Msk )
476+ {
477+ uint8_t channel = NRF_RADIO_regs .PUBLISH_RSSIEND & RADIO_PUBLISH_RSSIEND_CHIDX_Msk ;
478+ nrf_dppi_publish (channel );
479+ }
480+ #endif
459481
460482 if ( RADIO_INTEN & RADIO_INTENSET_RSSIEND_Msk ){
461483 hw_irq_ctrl_set_irq (NRF5_IRQ_RADIO_IRQn );
@@ -464,7 +486,16 @@ static void signal_RSSIEND(){
464486
465487static void signal_ADDRESS (){
466488 NRF_RADIO_regs .EVENTS_ADDRESS = 1 ;
489+
490+ #if defined(PPI_PRESENT )
467491 nrf_ppi_event (RADIO_EVENTS_ADDRESS );
492+ #elif defined(DPPI_PRESENT )
493+ if (NRF_RADIO_regs .PUBLISH_ADDRESS & RADIO_PUBLISH_ADDRESS_EN_Msk )
494+ {
495+ uint8_t channel = NRF_RADIO_regs .PUBLISH_ADDRESS & RADIO_PUBLISH_ADDRESS_CHIDX_Msk ;
496+ nrf_dppi_publish (channel );
497+ }
498+ #endif
468499
469500 if ( NRF_RADIO_regs .SHORTS & RADIO_SHORTS_ADDRESS_RSSISTART_Msk ) {
470501 nrf_radio_tasks_rssistart ();
@@ -480,7 +511,16 @@ static void signal_ADDRESS(){
480511
481512static void signal_PAYLOAD (){
482513 NRF_RADIO_regs .EVENTS_PAYLOAD = 1 ;
514+
515+ #if defined(PPI_PRESENT )
483516 nrf_ppi_event (RADIO_EVENTS_PAYLOAD );
517+ #elif defined(DPPI_PRESENT )
518+ if (NRF_RADIO_regs .PUBLISH_PAYLOAD & RADIO_PUBLISH_PAYLOAD_EN_Msk )
519+ {
520+ uint8_t channel = NRF_RADIO_regs .PUBLISH_PAYLOAD & RADIO_PUBLISH_PAYLOAD_CHIDX_Msk ;
521+ nrf_dppi_publish (channel );
522+ }
523+ #endif
484524
485525 if ( RADIO_INTEN & RADIO_INTENSET_PAYLOAD_Msk ){
486526 hw_irq_ctrl_set_irq (NRF5_IRQ_RADIO_IRQn );
@@ -489,7 +529,16 @@ static void signal_PAYLOAD(){
489529
490530static void signal_CRCOK (){
491531 NRF_RADIO_regs .EVENTS_CRCOK = 1 ;
532+
533+ #if defined(PPI_PRESENT )
492534 nrf_ppi_event (RADIO_EVENTS_CRCOK );
535+ #elif defined(DPPI_PRESENT )
536+ if (NRF_RADIO_regs .PUBLISH_CRCOK & RADIO_PUBLISH_CRCOK_EN_Msk )
537+ {
538+ uint8_t channel = NRF_RADIO_regs .PUBLISH_CRCOK & RADIO_PUBLISH_CRCOK_CHIDX_Msk ;
539+ nrf_dppi_publish (channel );
540+ }
541+ #endif
493542
494543 if ( RADIO_INTEN & RADIO_INTENSET_CRCOK_Msk ) {
495544 hw_irq_ctrl_set_irq (NRF5_IRQ_RADIO_IRQn );
@@ -498,7 +547,16 @@ static void signal_CRCOK(){
498547
499548static void signal_CRCERROR (){
500549 NRF_RADIO_regs .EVENTS_CRCERROR = 1 ;
550+
551+ #if defined(PPI_PRESENT )
501552 nrf_ppi_event (RADIO_EVENTS_CRCERROR );
553+ #elif defined(DPPI_PRESENT )
554+ if (NRF_RADIO_regs .PUBLISH_CRCERROR & RADIO_PUBLISH_CRCERROR_EN_Msk )
555+ {
556+ uint8_t channel = NRF_RADIO_regs .PUBLISH_CRCERROR & RADIO_PUBLISH_CRCERROR_CHIDX_Msk ;
557+ nrf_dppi_publish (channel );
558+ }
559+ #endif
502560
503561 if ( RADIO_INTEN & RADIO_INTENSET_CRCERROR_Msk ) {
504562 hw_irq_ctrl_set_irq (NRF5_IRQ_RADIO_IRQn );
@@ -509,7 +567,16 @@ static void signal_END(){
509567 nrf_radio_stop_bit_counter ();
510568
511569 NRF_RADIO_regs .EVENTS_END = 1 ;
570+
571+ #if defined(PPI_PRESENT )
512572 nrf_ppi_event (RADIO_EVENTS_END );
573+ #elif defined(DPPI_PRESENT )
574+ if (NRF_RADIO_regs .PUBLISH_END & RADIO_PUBLISH_END_EN_Msk )
575+ {
576+ uint8_t channel = NRF_RADIO_regs .PUBLISH_END & RADIO_PUBLISH_END_CHIDX_Msk ;
577+ nrf_dppi_publish (channel );
578+ }
579+ #endif
513580
514581 if ( NRF_RADIO_regs .SHORTS & RADIO_SHORTS_END_DISABLE_Msk ) {
515582 nrf_radio_tasks_disable ();
@@ -527,7 +594,16 @@ static void signal_DISABLED(){
527594 nrf_radio_stop_bit_counter ();
528595
529596 NRF_RADIO_regs .EVENTS_DISABLED = 1 ;
597+
598+ #if defined(PPI_PRESENT )
530599 nrf_ppi_event (RADIO_EVENTS_DISABLED );
600+ #elif defined(DPPI_PRESENT )
601+ if (NRF_RADIO_regs .PUBLISH_DISABLED & RADIO_PUBLISH_DISABLED_EN_Msk )
602+ {
603+ uint8_t channel = NRF_RADIO_regs .PUBLISH_DISABLED & RADIO_PUBLISH_DISABLED_CHIDX_Msk ;
604+ nrf_dppi_publish (channel );
605+ }
606+ #endif
531607
532608 //These 2 are fake shortcuts meant to start a HW timer for the TIFS
533609 if ( NRF_RADIO_regs .SHORTS & RADIO_SHORTS_DISABLED_TXEN_Msk ) {
@@ -904,7 +980,7 @@ static void handle_Rx_response(int ret){
904980
905981 ongoing_rx_RADIO_status .ADDRESS_End_Time = address_time + get_Rx_chain_delay ();
906982 uint length = rx_buf [1 ];
907- uint max_length = (NRF_RADIO_regs .PCNF1 & NFCT_MAXLEN_MAXLEN_Msk ) >> NFCT_MAXLEN_MAXLEN_Pos ;
983+ uint max_length = (NRF_RADIO_regs .PCNF1 & RADIO_PCNF1_MAXLEN_Msk ) >> RADIO_PCNF1_MAXLEN_Pos ;
908984 if (length > max_length ){
909985 length = max_length ;
910986 //TODO: check packet length. If too long the packet should be truncated and not accepted from the phy, [we already have it in the buffer and we will have a CRC error anyhow. And we cannot let the phy run for longer than we will]
@@ -1092,7 +1168,16 @@ static void Rx_Addr_received(){
10921168
10931169static void signal_DEVMATCH () {
10941170 NRF_RADIO_regs .EVENTS_DEVMATCH = 1 ;
1171+
1172+ #if defined(PPI_PRESENT )
10951173 nrf_ppi_event (RADIO_EVENTS_DEVMATCH );
1174+ #elif defined(DPPI_PRESENT )
1175+ if (NRF_RADIO_regs .PUBLISH_DEVMATCH & RADIO_PUBLISH_DEVMATCH_EN_Msk )
1176+ {
1177+ uint8_t channel = NRF_RADIO_regs .PUBLISH_DEVMATCH & RADIO_PUBLISH_DEVMATCH_CHIDX_Msk ;
1178+ nrf_dppi_publish (channel );
1179+ }
1180+ #endif
10961181
10971182 if (RADIO_INTEN & RADIO_INTENSET_DEVMATCH_Msk ) {
10981183 hw_irq_ctrl_set_irq (NRF5_IRQ_RADIO_IRQn );
@@ -1101,7 +1186,16 @@ static void signal_DEVMATCH() {
11011186
11021187static void signal_DEVMISS () {
11031188 NRF_RADIO_regs .EVENTS_DEVMISS = 1 ;
1189+
1190+ #if defined(PPI_PRESENT )
11041191 nrf_ppi_event (RADIO_EVENTS_DEVMISS );
1192+ #elif defined(DPPI_PRESENT )
1193+ if (NRF_RADIO_regs .PUBLISH_DEVMISS & RADIO_PUBLISH_DEVMISS_EN_Msk )
1194+ {
1195+ uint8_t channel = NRF_RADIO_regs .PUBLISH_DEVMISS & RADIO_PUBLISH_DEVMISS_CHIDX_Msk ;
1196+ nrf_dppi_publish (channel );
1197+ }
1198+ #endif
11051199
11061200 if (RADIO_INTEN & RADIO_INTENSET_DEVMISS_Msk ) {
11071201 hw_irq_ctrl_set_irq (NRF5_IRQ_RADIO_IRQn );
@@ -1151,7 +1245,16 @@ static void do_device_address_match() {
11511245
11521246static void signal_BCMATCH () {
11531247 NRF_RADIO_regs .EVENTS_BCMATCH = 1 ;
1248+
1249+ #if defined(PPI_PRESENT )
11541250 nrf_ppi_event (RADIO_EVENTS_BCMATCH );
1251+ #elif defined(DPPI_PRESENT )
1252+ if (NRF_RADIO_regs .PUBLISH_BCMATCH & RADIO_PUBLISH_BCMATCH_EN_Msk )
1253+ {
1254+ uint8_t channel = NRF_RADIO_regs .PUBLISH_BCMATCH & RADIO_PUBLISH_BCMATCH_CHIDX_Msk ;
1255+ nrf_dppi_publish (channel );
1256+ }
1257+ #endif
11551258
11561259 if (RADIO_INTEN & RADIO_INTENSET_BCMATCH_Msk ) {
11571260 hw_irq_ctrl_set_irq (NRF5_IRQ_RADIO_IRQn );
0 commit comments