@@ -56,6 +56,8 @@ struct dma_otrig {
56
56
};
57
57
58
58
struct dma_mcux_lpc_dma_data {
59
+ struct dma_context ctx ;
60
+
59
61
struct channel_data * channel_data ;
60
62
struct dma_otrig * otrig_array ;
61
63
int8_t * channel_index ;
@@ -401,6 +403,8 @@ static int dma_mcux_lpc_configure(const struct device *dev, uint32_t channel,
401
403
402
404
switch (config -> channel_direction ) {
403
405
case MEMORY_TO_MEMORY :
406
+ case HOST_TO_MEMORY :
407
+ case MEMORY_TO_HOST :
404
408
is_periph = false;
405
409
if (block_config -> source_gather_en ) {
406
410
src_inc = block_config -> source_gather_interval / width ;
@@ -825,11 +829,30 @@ static int dma_mcux_lpc_get_status(const struct device *dev, uint32_t channel,
825
829
return 0 ;
826
830
}
827
831
832
+ static int dma_mcux_lpc_get_attribute (const struct device * dev , uint32_t type , uint32_t * value )
833
+ {
834
+ switch (type ) {
835
+ case DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT :
836
+ case DMA_ATTR_BUFFER_SIZE_ALIGNMENT :
837
+ case DMA_ATTR_COPY_ALIGNMENT :
838
+ * value = 4 ;
839
+ break ;
840
+
841
+ default :
842
+ return - EINVAL ;
843
+ }
844
+
845
+ return 0 ;
846
+ }
847
+
828
848
static int dma_mcux_lpc_init (const struct device * dev )
829
849
{
830
850
const struct dma_mcux_lpc_config * config = dev -> config ;
831
851
struct dma_mcux_lpc_dma_data * data = dev -> data ;
832
852
853
+ data -> ctx .magic = DMA_MAGIC ;
854
+ data -> ctx .dma_channels = config -> num_of_channels ;
855
+
833
856
/* Indicate that the Otrig Muxes are not connected */
834
857
for (int i = 0 ; i < config -> num_of_otrigs ; i ++ ) {
835
858
data -> otrig_array [i ].source_channel = EMPTY_OTRIG ;
@@ -860,6 +883,7 @@ static DEVICE_API(dma, dma_mcux_lpc_api) = {
860
883
.stop = dma_mcux_lpc_stop ,
861
884
.reload = dma_mcux_lpc_reload ,
862
885
.get_status = dma_mcux_lpc_get_status ,
886
+ .get_attribute = dma_mcux_lpc_get_attribute
863
887
};
864
888
865
889
#define DMA_MCUX_LPC_CONFIG_FUNC (n ) \
0 commit comments