Skip to content
Merged
20 changes: 20 additions & 0 deletions zephyr/include/sof/lib/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ enum sof_dma_cb_status {
/* Attributes have been ported to Zephyr. This condition is necessary until full support of
* CONFIG_SOF_ZEPHYR_STRICT_HEADERS.
*/
#ifdef CONFIG_ZEPHYR_NATIVE_DRIVERS
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems confusing. This header shouldn't be included if the SOF drivers are in use, no? I suspect the real bug here is upstream header hygiene, some include or another should probably be guarded.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andyross This is ok. We've done a flurry of changes to drop XTOS support at start of the SOF 2.14 cycle and commit ee58c00 went too far.

This is still overloaded in sof/lib/dma.h, but we'll need to keep the ifdefs until everybody has moved to native drivers.

struct sof_dma;
#else
struct dma;
#endif

/**
* \brief Element of SG list (as array item).
Expand Down Expand Up @@ -194,7 +198,11 @@ struct dma_plat_data {
uint32_t period_count;
};

#ifdef CONFIG_ZEPHYR_NATIVE_DRIVERS
struct sof_dma {
#else
struct dma {
#endif
struct dma_plat_data plat_data;
struct k_spinlock lock; /**< locking mechanism */
int sref; /**< simple ref counter, guarded by lock */
Expand All @@ -206,7 +214,11 @@ struct sof_dma {
};

struct dma_chan_data {
#ifdef CONFIG_ZEPHYR_NATIVE_DRIVERS
struct sof_dma *dma;
#else
struct dma *dma;
#endif

uint32_t status;
uint32_t direction;
Expand All @@ -224,14 +236,22 @@ struct dma_chan_data {
};

struct dma_info {
#ifdef CONFIG_ZEPHYR_NATIVE_DRIVERS
struct sof_dma *dma_array;
#else
struct dma *dma_array;
#endif
size_t num_dmas;
};

/* generic DMA DSP <-> Host copier */
struct dma_copy {
struct dma_chan_data *chan;
#ifdef CONFIG_ZEPHYR_NATIVE_DRIVERS
struct sof_dma *dmac;
#else
struct dma *dmac;
#endif
};

struct audio_stream;
Expand Down