1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef _NRF_HW_MODEL_EVDMA_H 8 #define _NRF_HW_MODEL_EVDMA_H 9 10 #include <stdlib.h> 11 #include <stdint.h> 12 #include <stdbool.h> 13 14 #ifdef __cplusplus 15 extern "C"{ 16 #endif 17 18 /* Job (list) entry (what FW programs in memory) */ 19 struct job_list { 20 char *job_buff; 21 uint32_t attr_len; 22 }; 23 24 typedef struct { 25 struct job_list *joblist_ptr; /* Pointer to the *next* job entry to be processed */ 26 enum evdma_mode {EVDMA_idle = 0, EVDMA_read = 1, EVDMA_write = 2} mode; /* 0: nothing, 1: read, 2: write */ 27 28 /* Current job status: */ 29 char *job_buff; /* Pointer to job buffer in memory with whatever offset */ 30 uint32_t job_pend_length; /* Pending length in current job */ 31 unsigned int job_attrib; /* Attribute of the current job */ 32 } EVDMA_status_t; 33 34 int nhw_EVDMA_start(EVDMA_status_t *st, void *joblist_ptr); 35 int nhw_EVDMA_access(EVDMA_status_t *st, 36 bool read_not_write, 37 uint8_t *periph_buf, 38 size_t nbytes, 39 size_t *n_actual, 40 bool new_job); 41 42 #define NHW_EVDMA_READ true 43 #define NHW_EVDMA_WRITE false 44 #define NHW_EVDMA_NEWJOB true 45 #define NHW_EVDMA_CONTINUEJOB false 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif 52