Skip to content

Commit 14d313a

Browse files
committed
nrfx: hal: mvdma: Align to the latest changes
Remove support for the legacy version. Add missing tasks and events. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 54f33f1 commit 14d313a

File tree

1 file changed

+8
-87
lines changed

1 file changed

+8
-87
lines changed

nrfx/hal/nrf_mvdma.h

Lines changed: 8 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ extern "C" {
4848
* @brief Hardware access layer for managing the Memory-to-Memory Vector DMA (MVDMA) peripheral.
4949
*/
5050

51-
#if defined(MVDMA_TASKS_PAUSE_TASKS_PAUSE_Pos) || defined(__NRFX_DOXYGEN__)
52-
/** @brief Symbol indicating whether MVDMA uses new or old version. */
53-
#define NRF_MVDMA_HAS_NEW_VER 1
54-
#else
55-
#define NRF_MVDMA_HAS_NEW_VER 0
56-
#endif
57-
5851
#if defined(MVDMA_CONFIG_AXIMODE_AXIMODE_Msk) || defined(__NRFX_DOXYGEN__)
5952
/** @brief Symbol indicating whether AXIMODE configuration is present. */
6053
#define NRF_MVDMA_HAS_AXIMODE 1
@@ -72,11 +65,7 @@ extern "C" {
7265
/** @brief MVDMA tasks. */
7366
typedef enum
7467
{
75-
#if NRF_MVDMA_HAS_NEW_VER
7668
NRF_MVDMA_TASK_PAUSE = offsetof(NRF_MVDMA_Type, TASKS_PAUSE), ///< Pause DMA transaction at next idle stage on memory bus.
77-
#else
78-
NRF_MVDMA_TASK_STOP = offsetof(NRF_MVDMA_Type, TASKS_STOP), ///< Stop DMA transaction immediately, or after an ongoing AXI burst.
79-
#endif
8069
NRF_MVDMA_TASK_RESET = offsetof(NRF_MVDMA_Type, TASKS_RESET), ///< Return all registers to default state and FSMs to IDLE.
8170
NRF_MVDMA_TASK_START0 = offsetof(NRF_MVDMA_Type, TASKS_START[0]), ///< Start or continue processing of descriptor list 0.
8271
NRF_MVDMA_TASK_START1 = offsetof(NRF_MVDMA_Type, TASKS_START[1]), ///< Start or continue processing of descriptor list 1.
@@ -93,43 +82,33 @@ typedef enum
9382
{
9483
NRF_MVDMA_EVENT_END = offsetof(NRF_MVDMA_Type, EVENTS_END), ///< Sink data descriptor list has been completed.
9584
NRF_MVDMA_EVENT_STARTED = offsetof(NRF_MVDMA_Type, EVENTS_STARTED), ///< Data descriptor list processing has been started.
96-
#if NRF_MVDMA_HAS_NEW_VER
9785
NRF_MVDMA_EVENT_PAUSED = offsetof(NRF_MVDMA_Type, EVENTS_PAUSED), ///< Data transfer has been paused.
98-
#else
99-
NRF_MVDMA_EVENT_STOPPED = offsetof(NRF_MVDMA_Type, EVENTS_STOPPED), ///< Data descriptor list processing has been stopped.
100-
#endif
10186
NRF_MVDMA_EVENT_RESET = offsetof(NRF_MVDMA_Type, EVENTS_RESET), ///< MVDMA has been reset.
102-
#if NRF_MVDMA_HAS_NEW_VER
10387
NRF_MVDMA_EVENT_SOURCEBUSERROR = offsetof(NRF_MVDMA_Type, EVENTS_SOURCE.BUSERROR), ///< Bus error has been received on the source channel.
10488
NRF_MVDMA_EVENT_SOURCESELECTJOBDONE = offsetof(NRF_MVDMA_Type, EVENTS_SOURCE.SELECTJOBDONE), ///< Job on the source channel with event enable attribute bit active has been processed.
105-
#else
106-
NRF_MVDMA_EVENT_SOURCEBUSERROR = offsetof(NRF_MVDMA_Type, EVENTS_SOURCEBUSERROR), ///< Bus error has been received on the source channel.
107-
#endif
108-
#if NRF_MVDMA_HAS_NEW_VER
10989
NRF_MVDMA_EVENT_SINKBUSERROR = offsetof(NRF_MVDMA_Type, EVENTS_SINK.BUSERROR), ///< Bus error has been received on the sink channel.
11090
NRF_MVDMA_EVENT_SINKSELECTJOBDONE = offsetof(NRF_MVDMA_Type, EVENTS_SINK.SELECTJOBDONE), ///< Job on the sink channel with event enable attribute bit active has been processed.
111-
#else
112-
NRF_MVDMA_EVENT_SINKBUSERROR = offsetof(NRF_MVDMA_Type, EVENTS_SINKBUSERROR), ///< Bus error has been received on the sink channel.
113-
#endif
91+
NRF_MVDMA_EVENT_COMPLETED0 = offsetof(NRF_MVDMA_Type, EVENTS_COMPLETED[0]), ///< Job 0 is completed.
92+
NRF_MVDMA_EVENT_COMPLETED1 = offsetof(NRF_MVDMA_Type, EVENTS_COMPLETED[1]), ///< Job 0 is completed.
93+
NRF_MVDMA_EVENT_COMPLETED2 = offsetof(NRF_MVDMA_Type, EVENTS_COMPLETED[2]), ///< Job 0 is completed.
94+
NRF_MVDMA_EVENT_COMPLETED3 = offsetof(NRF_MVDMA_Type, EVENTS_COMPLETED[3]), ///< Job 0 is completed.
11495
} nrf_mvdma_event_t;
11596

11697
/** @brief MVDMA interrupts. */
11798
typedef enum
11899
{
119100
NRF_MVDMA_INT_END_MASK = MVDMA_INTENSET_END_Msk, ///< Interrupt on END event.
120101
NRF_MVDMA_INT_STARTED_MASK = MVDMA_INTENSET_STARTED_Msk, ///< Interrupt on STARTED event.
121-
#if NRF_MVDMA_HAS_NEW_VER
122102
NRF_MVDMA_INT_PAUSED_MASK = MVDMA_INTENSET_PAUSED_Msk, ///< Interrupt on PAUSED event.
123-
#else
124-
NRF_MVDMA_INT_STOPPED_MASK = MVDMA_INTENSET_STOPPED_Msk, ///< Interrupt on STOPPED event.
125-
#endif
126103
NRF_MVDMA_INT_RESET_MASK = MVDMA_INTENSET_RESET_Msk, ///< Interrupt on RESET event.
127104
NRF_MVDMA_INT_SOURCEBUSERROR_MASK = MVDMA_INTENSET_SOURCEBUSERROR_Msk, ///< Interrupt on SOURCEBUSERROR event.
128105
NRF_MVDMA_INT_SINKBUSERROR_MASK = MVDMA_INTENSET_SINKBUSERROR_Msk, ///< Interrupt on SINKBUSERROR event.
129-
#if NRF_MVDMA_HAS_NEW_VER
130106
NRF_MVDMA_INT_SOURCESELECTJOBDONE_MASK = MVDMA_INTENSET_SOURCESELECTJOBDONE_Msk, ///< Interrupt on SOURCESELECTJOBDONE event.
131107
NRF_MVDMA_INT_SINKSELECTJOBDONE_MASK = MVDMA_INTENSET_SINKSELECTJOBDONE_Msk, ///< Interrupt on SINKSELECTJOBDONE event.
132-
#endif
108+
NRF_MVDMA_INT_COMPLETED0_MASK = MVDMA_INTENSET_COMPLETED0_Msk, ///< Interrupt on COMPLETED0 event.
109+
NRF_MVDMA_INT_COMPLETED1_MASK = MVDMA_INTENSET_COMPLETED1_Msk, ///< Interrupt on COMPLETED0 event.
110+
NRF_MVDMA_INT_COMPLETED2_MASK = MVDMA_INTENSET_COMPLETED2_Msk, ///< Interrupt on COMPLETED0 event.
111+
NRF_MVDMA_INT_COMPLETED3_MASK = MVDMA_INTENSET_COMPLETED3_Msk, ///< Interrupt on COMPLETED0 event.
133112
} nrf_mvdma_int_mask_t;
134113

135114
/** @brief MVDMA modes of operation. */
@@ -152,44 +131,26 @@ typedef enum
152131
typedef enum
153132
{
154133
NRF_MVDMA_FIFO_STATUS_EMPTY = MVDMA_STATUS_FIFO_FIFOSTATUS_Empty, ///< No data in intermediate FIFO.
155-
#if NRF_MVDMA_HAS_NEW_VER
156134
NRF_MVDMA_FIFO_STATUS_NOT_EMPTY = MVDMA_STATUS_FIFO_FIFOSTATUS_NotEmpty, ///< Intermediate FIFO contains data.
157-
#else
158-
NRF_MVDMA_FIFO_STATUS_ALMOST_FULL = MVDMA_STATUS_FIFO_FIFOSTATUS_AlmostFull, ///< Intermediate FIFO is almost full.
159-
#endif
160135
NRF_MVDMA_FIFO_STATUS_FULL = MVDMA_STATUS_FIFO_FIFOSTATUS_Full, ///< Intermediate FIFO is full.
161136
} nrf_mvdma_fifo_status_t;
162137

163138
/** @brief MVDMA data source errors. */
164139
typedef enum
165140
{
166-
#if NRF_MVDMA_HAS_NEW_VER
167141
NRF_MVDMA_SOURCE_ERROR_NONE = MVDMA_SOURCE_BUSERROR_BUSERROR_NoError, ///< No error.
168142
NRF_MVDMA_SOURCE_ERROR_READ = MVDMA_SOURCE_BUSERROR_BUSERROR_ReadError, ///< Error related to memory when reading joblist or memory/register when reading data.
169143
NRF_MVDMA_SOURCE_ERROR_READ_DECODE = MVDMA_SOURCE_BUSERROR_BUSERROR_ReadDecodeError, ///< Error related to the joblist address or address when reading memory/register.
170-
#else
171-
NRF_MVDMA_SOURCE_ERROR_NONE = MVDMA_STATUS_SOURCEBUSERROR_BUSERROR_NoError, ///< No error.
172-
NRF_MVDMA_SOURCE_ERROR_SLAVE = MVDMA_STATUS_SOURCEBUSERROR_BUSERROR_SlaveError, ///< Error generated by AXI slave.
173-
NRF_MVDMA_SOURCE_ERROR_DECODE = MVDMA_STATUS_SOURCEBUSERROR_BUSERROR_DecodeError, ///< Error generated by interconnect.
174-
#endif
175144
} nrf_mvdma_source_error_t;
176145

177146
/** @brief MVDMA data sink errors. */
178147
typedef enum
179148
{
180-
#if NRF_MVDMA_HAS_NEW_VER
181149
NRF_MVDMA_SINK_ERROR_NONE = MVDMA_SINK_BUSERROR_BUSERROR_NoError, ///< No error.
182150
NRF_MVDMA_SINK_ERROR_READ = MVDMA_SINK_BUSERROR_BUSERROR_ReadError, ///< Error related to memory when reading joblist.
183151
NRF_MVDMA_SINK_ERROR_WRITE = MVDMA_SINK_BUSERROR_BUSERROR_WriteError, ///< Error related to memory/register when writing data.
184152
NRF_MVDMA_SINK_ERROR_DECODE_READ = MVDMA_SINK_BUSERROR_BUSERROR_ReadDecodeError, ///< Error related to the joblist address when reading joblist.
185153
NRF_MVDMA_SINK_ERROR_DECODE_WRITE = MVDMA_SINK_BUSERROR_BUSERROR_WriteDecodeError, ///< Error related to the memory/register address when writing data.
186-
#else
187-
NRF_MVDMA_SINK_ERROR_NONE = MVDMA_STATUS_SINKBUSERROR_BUSERROR_NoError, ///< No error.
188-
NRF_MVDMA_SINK_ERROR_SLAVE_READ = MVDMA_STATUS_SINKBUSERROR_BUSERROR_ReadSlaveError, ///< Read error generated by AXI slave.
189-
NRF_MVDMA_SINK_ERROR_SLAVE_WRITE = MVDMA_STATUS_SINKBUSERROR_BUSERROR_WriteSlaveError, ///< Write error generated by AXI slave.
190-
NRF_MVDMA_SINK_ERROR_DECODE_READ = MVDMA_STATUS_SINKBUSERROR_BUSERROR_ReadDecodeError, ///< Read error generated by interconnect.
191-
NRF_MVDMA_SINK_ERROR_DECODE_WRITE = MVDMA_STATUS_SINKBUSERROR_BUSERROR_WriteDecodeError, ///< Write error generated by interconnect.
192-
#endif
193154
} nrf_mvdma_sink_error_t;
194155

195156
/**
@@ -627,39 +588,23 @@ NRF_STATIC_INLINE void nrf_mvdma_aximode_set(NRF_MVDMA_Type * p_reg, nrf_mvdma_a
627588
NRF_STATIC_INLINE void nrf_mvdma_source_list_ptr_set(NRF_MVDMA_Type * p_reg,
628589
nrf_vdma_job_t const * p_job)
629590
{
630-
#if NRF_MVDMA_HAS_NEW_VER
631591
p_reg->SOURCE.LISTPTR = (uint32_t)p_job;
632-
#else
633-
p_reg->CONFIG.SOURCELISTPTR = (uint32_t)p_job;
634-
#endif
635592
}
636593

637594
NRF_STATIC_INLINE nrf_vdma_job_t * nrf_mvdma_source_list_ptr_get(NRF_MVDMA_Type const * p_reg)
638595
{
639-
#if NRF_MVDMA_HAS_NEW_VER
640596
return (nrf_vdma_job_t *)(p_reg->SOURCE.LISTPTR);
641-
#else
642-
return (nrf_vdma_job_t *)(p_reg->CONFIG.SOURCELISTPTR);
643-
#endif
644597
}
645598

646599
NRF_STATIC_INLINE void nrf_mvdma_sink_list_ptr_set(NRF_MVDMA_Type * p_reg,
647600
nrf_vdma_job_t const * p_job)
648601
{
649-
#if NRF_MVDMA_HAS_NEW_VER
650602
p_reg->SINK.LISTPTR = (uint32_t)p_job;
651-
#else
652-
p_reg->CONFIG.SINKLISTPTR = (uint32_t)p_job;
653-
#endif
654603
}
655604

656605
NRF_STATIC_INLINE nrf_vdma_job_t * nrf_mvdma_sink_list_ptr_get(NRF_MVDMA_Type const * p_reg)
657606
{
658-
#if NRF_MVDMA_HAS_NEW_VER
659607
return (nrf_vdma_job_t *)(p_reg->SINK.LISTPTR);
660-
#else
661-
return (nrf_vdma_job_t *)(p_reg->CONFIG.SINKLISTPTR);
662-
#endif
663608
}
664609

665610
NRF_STATIC_INLINE uint32_t nrf_mvdma_crc_result_get(NRF_MVDMA_Type const * p_reg)
@@ -680,56 +625,32 @@ NRF_STATIC_INLINE bool nrf_mvdma_activity_check(NRF_MVDMA_Type const * p_reg)
680625

681626
NRF_STATIC_INLINE nrf_mvdma_source_error_t nrf_mvdma_source_error_get(NRF_MVDMA_Type const * p_reg)
682627
{
683-
#if NRF_MVDMA_HAS_NEW_VER
684628
return (nrf_mvdma_source_error_t)(p_reg->SOURCE.BUSERROR);
685-
#else
686-
return (nrf_mvdma_source_error_t)(p_reg->STATUS.SOURCEBUSERROR);
687-
#endif
688629
}
689630

690631
NRF_STATIC_INLINE nrf_mvdma_sink_error_t nrf_mvdma_sink_error_get(NRF_MVDMA_Type const * p_reg)
691632
{
692-
#if NRF_MVDMA_HAS_NEW_VER
693633
return (nrf_mvdma_sink_error_t)(p_reg->SINK.BUSERROR);
694-
#else
695-
return (nrf_mvdma_sink_error_t)(p_reg->STATUS.SINKBUSERROR);
696-
#endif
697634
}
698635

699636
NRF_STATIC_INLINE uint32_t nrf_mvdma_last_source_address_get(NRF_MVDMA_Type const * p_reg)
700637
{
701-
#if NRF_MVDMA_HAS_NEW_VER
702638
return p_reg->SOURCE.ADDRESS;
703-
#else
704-
return p_reg->STATUS.SOURCEADDRESS;
705-
#endif
706639
}
707640

708641
NRF_STATIC_INLINE uint32_t nrf_mvdma_last_sink_address_get(NRF_MVDMA_Type const * p_reg)
709642
{
710-
#if NRF_MVDMA_HAS_NEW_VER
711643
return p_reg->SINK.ADDRESS;
712-
#else
713-
return p_reg->STATUS.SINKADDRESS;
714-
#endif
715644
}
716645

717646
NRF_STATIC_INLINE uint32_t nrf_mvdma_source_job_count_get(NRF_MVDMA_Type const * p_reg)
718647
{
719-
#if NRF_MVDMA_HAS_NEW_VER
720648
return p_reg->SOURCE.JOBCOUNT;
721-
#else
722-
return p_reg->STATUS.SOURCEJOBCOUNT;
723-
#endif
724649
}
725650

726651
NRF_STATIC_INLINE uint32_t nrf_mvdma_sink_job_count_get(NRF_MVDMA_Type const * p_reg)
727652
{
728-
#if NRF_MVDMA_HAS_NEW_VER
729653
return p_reg->SINK.JOBCOUNT;
730-
#else
731-
return p_reg->STATUS.SINKJOBCOUNT;
732-
#endif
733654
}
734655

735656
#endif // NRF_DECLARE_ONLY

0 commit comments

Comments
 (0)