Skip to content

File syn_port_dma.h

File List > port > syn_port_dma.h

Go to the documentation of this file

#ifndef SYN_PORT_DMA_H
#define SYN_PORT_DMA_H

#include "../common/syn_defs.h"

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    SYN_DMA_DIR_MEM_TO_MEM = 0,    
    SYN_DMA_DIR_MEM_TO_PERIPH = 1, 
    SYN_DMA_DIR_PERIPH_TO_MEM = 2  
} SYN_DMA_Direction;

typedef enum {
    SYN_DMA_SIZE_8BIT = 1,  
    SYN_DMA_SIZE_16BIT = 2, 
    SYN_DMA_SIZE_32BIT = 4  
} SYN_DMA_Size;

typedef struct {
    uint8_t channel_id;     
    SYN_DMA_Direction dir;  
    SYN_DMA_Size data_size; 
    bool src_inc;           
    bool dst_inc;           
    const void *src;        
    void *dst;              
    size_t count;           
} SYN_PortDmaTransfer;

SYN_Status syn_port_dma_start(const SYN_PortDmaTransfer *xfer);

SYN_Status syn_port_dma_stop(uint8_t channel_id);

bool syn_port_dma_is_busy(uint8_t channel_id);

uint32_t syn_port_dma_get_counter(uint8_t channel_id);

void syn_port_cache_clean(const void *addr, size_t len);

void syn_port_cache_invalidate(void *addr, size_t len);

#ifdef __cplusplus
}
#endif

#endif /* SYN_PORT_DMA_H */