Skip to content

Commit

Permalink
rtos: branch out dma.h for Zephyr and XTOS
Browse files Browse the repository at this point in the history
The SOF DMA RTOS interface is one of the largest and also one of the
hardest to maintain, as it's used a lot in SOF, and there is unfortunate
overlap in interface naming between Zephyr and XTOS.

To get the cleanup work started, branch out the sof/lib/dma.h for Zephyr
and remove the conditional definitions from both versions. This patch
maintains support for all build variants, including building SOF with
Zephyr but using XTOS drivers.

Link: #9015
Signed-off-by: Kai Vehmanen <[email protected]>
  • Loading branch information
kv2019i authored and lgirdwood committed Oct 16, 2024
1 parent 5dcc7c8 commit cf409e9
Show file tree
Hide file tree
Showing 2 changed files with 576 additions and 13 deletions.
14 changes: 1 addition & 13 deletions xtos/include/sof/lib/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#include <stdint.h>

#ifdef __ZEPHYR__
#include <zephyr/device.h>
#include <zephyr/drivers/dma.h>
#error "Please use zephyr/include/sof/lib/dma.h instead"
#endif

struct comp_buffer;
Expand Down Expand Up @@ -106,16 +105,11 @@ enum dma_irq_cmd {
#define DMA_CHAN_INVALID 0xFFFFFFFF
#define DMA_CORE_INVALID 0xFFFFFFFF

/* Attributes have been ported to Zephyr. This condition is necessary until full support of
* CONFIG_SOF_ZEPHYR_STRICT_HEADERS.
*/
#ifndef CONFIG_ZEPHYR_NATIVE_DRIVERS
/* DMA attributes */
#define DMA_ATTR_BUFFER_ALIGNMENT 0
#define DMA_ATTR_COPY_ALIGNMENT 1
#define DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT 2
#define DMA_ATTR_BUFFER_PERIOD_COUNT 3
#endif

struct dma;

Expand Down Expand Up @@ -215,9 +209,6 @@ struct dma_plat_data {
const char *irq_name;
uint32_t chan_size;
const void *drv_plat_data;
#ifdef __ZEPHYR__
uint32_t period_count;
#endif
};

struct dma {
Expand All @@ -227,9 +218,6 @@ struct dma {
const struct dma_ops *ops;
atomic_t num_channels_busy; /* number of busy channels */
struct dma_chan_data *chan; /* channels array */
#ifdef __ZEPHYR__
const struct device *z_dev; /* Zephyr driver */
#endif
void *priv_data;
};

Expand Down
Loading

0 comments on commit cf409e9

Please sign in to comment.