@@ -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,36 @@ 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
+ * value = 4 ;
837
+ break ;
838
+
839
+ case DMA_ATTR_BUFFER_SIZE_ALIGNMENT :
840
+ * value = 4 ;
841
+ break ;
842
+
843
+ case DMA_ATTR_COPY_ALIGNMENT :
844
+ * value = 4 ;
845
+ break ;
846
+
847
+ default :
848
+ return - EINVAL ;
849
+ }
850
+
851
+ return 0 ;
852
+ }
853
+
828
854
static int dma_mcux_lpc_init (const struct device * dev )
829
855
{
830
856
const struct dma_mcux_lpc_config * config = dev -> config ;
831
857
struct dma_mcux_lpc_dma_data * data = dev -> data ;
832
858
859
+ data -> ctx .magic = DMA_MAGIC ;
860
+ data -> ctx .dma_channels = config -> num_of_channels ;
861
+
833
862
/* Indicate that the Otrig Muxes are not connected */
834
863
for (int i = 0 ; i < config -> num_of_otrigs ; i ++ ) {
835
864
data -> otrig_array [i ].source_channel = EMPTY_OTRIG ;
@@ -860,6 +889,7 @@ static DEVICE_API(dma, dma_mcux_lpc_api) = {
860
889
.stop = dma_mcux_lpc_stop ,
861
890
.reload = dma_mcux_lpc_reload ,
862
891
.get_status = dma_mcux_lpc_get_status ,
892
+ .get_attribute = dma_mcux_lpc_get_attribute
863
893
};
864
894
865
895
#define DMA_MCUX_LPC_CONFIG_FUNC (n ) \
0 commit comments