Skip to content

Commit 18bef7e

Browse files
authored
Merge pull request #48 from kuldeepdhaka/danielg-dma-number-of-data
stm32: add dma_get_number_of_data
2 parents ef98896 + 1e8b1a7 commit 18bef7e

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

include/unicore-mx/stm32/common/dma_common_f247.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Ken Sarkies <[email protected]>
99
/*
1010
* Copyright (C) 2011 Fergus Noble <[email protected]>
1111
* Copyright (C) 2012 Ken Sarkies <[email protected]>
12+
* Copyright (C) 2016 Daniel Gröber <[email protected]>
1213
*
1314
* This library is free software: you can redistribute it and/or modify
1415
* it under the terms of the GNU Lesser General Public License as published by
@@ -611,6 +612,7 @@ void dma_disable_stream(uint32_t dma, uint8_t stream);
611612
void dma_set_peripheral_address(uint32_t dma, uint8_t stream, uint32_t address);
612613
void dma_set_memory_address(uint32_t dma, uint8_t stream, uint32_t address);
613614
void dma_set_memory_address_1(uint32_t dma, uint8_t stream, uint32_t address);
615+
uint16_t dma_get_number_of_data(uint32_t dma, uint8_t stream);
614616
void dma_set_number_of_data(uint32_t dma, uint8_t stream, uint16_t number);
615617

616618
END_DECLS
@@ -621,4 +623,3 @@ END_DECLS
621623
#warning "dma_common_f247.h should not be included explicitly, only via dma.h"
622624
#endif
623625
/** @endcond */
624-

include/unicore-mx/stm32/common/dma_common_l1f013.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Piotr Esden-Tempski <[email protected]>
1010
/*
1111
* Copyright (C) 2010 Thomas Otto <[email protected]>
1212
* Copyright (C) 2012 Piotr Esden-Tempski <[email protected]>
13+
* Copyright (C) 2016 Daniel Gröber <[email protected]>
1314
*
1415
* This library is free software: you can redistribute it and/or modify
1516
* it under the terms of the GNU Lesser General Public License as published by
@@ -408,6 +409,7 @@ void dma_disable_channel(uint32_t dma, uint8_t channel);
408409
void dma_set_peripheral_address(uint32_t dma, uint8_t channel,
409410
uint32_t address);
410411
void dma_set_memory_address(uint32_t dma, uint8_t channel, uint32_t address);
412+
uint16_t dma_get_number_of_data(uint32_t dma, uint8_t channel);
411413
void dma_set_number_of_data(uint32_t dma, uint8_t channel, uint16_t number);
412414

413415
END_DECLS
@@ -420,4 +422,3 @@ END_DECLS
420422
/** @endcond */
421423

422424
/**@}*/
423-

lib/stm32/common/dma_common_f247.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ LGPL License Terms @ref lgpl_license
2727
*/
2828
/*
2929
* Copyright (C) 2012 Ken Sarkies <[email protected]>
30+
* Copyright (C) 2016 Daniel Gröber <[email protected]>
3031
*
3132
* This library is free software: you can redistribute it and/or modify
3233
* it under the terms of the GNU Lesser General Public License as published by
@@ -772,6 +773,20 @@ void dma_set_memory_address_1(uint32_t dma, uint8_t stream, uint32_t address)
772773
}
773774
}
774775

776+
/*---------------------------------------------------------------------------*/
777+
/** @brief DMA Stream Get the Transfer Block Size
778+
779+
@param[in] dma unsigned int32. DMA controller base address: DMA1 or DMA2
780+
@param[in] stream unsigned int8. Stream number: @ref dma_st_number
781+
@returns unsigned int16. Number of remaining data words to transfer (65535
782+
maximum).
783+
*/
784+
785+
uint16_t dma_get_number_of_data(uint32_t dma, uint8_t stream)
786+
{
787+
return DMA_SNDTR(dma, stream);
788+
}
789+
775790
/*---------------------------------------------------------------------------*/
776791
/** @brief DMA Stream Set the Transfer Block Size
777792
@@ -789,4 +804,3 @@ void dma_set_number_of_data(uint32_t dma, uint8_t stream, uint16_t number)
789804
DMA_SNDTR(dma, stream) = number;
790805
}
791806
/**@}*/
792-

lib/stm32/common/dma_common_l1f013.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ LGPL License Terms @ref lgpl_license
1919
*/
2020
/*
2121
* Copyright (C) 2010 Thomas Otto <[email protected]>
22+
* Copyright (C) 2016 Daniel Gröber <[email protected]>
2223
*
2324
* This library is free software: you can redistribute it and/or modify
2425
* it under the terms of the GNU Lesser General Public License as published by
@@ -413,6 +414,20 @@ void dma_set_memory_address(uint32_t dma, uint8_t channel, uint32_t address)
413414
}
414415
}
415416

417+
/*---------------------------------------------------------------------------*/
418+
/** @brief DMA Channel Get the Transfer Block Size
419+
420+
@param[in] dma unsigned int32. DMA controller base address: DMA1 or DMA2
421+
@param[in] channel unsigned int8. Channel number: 1-7 for DMA1 or 1-5 for DMA2
422+
@returns unsigned int16. Number of remaining data words to transfer (65535
423+
maximum).
424+
*/
425+
426+
uint16_t dma_get_number_of_data(uint32_t dma, uint8_t channel)
427+
{
428+
return DMA_CNDTR(dma, channel);
429+
}
430+
416431
/*---------------------------------------------------------------------------*/
417432
/** @brief DMA Channel Set the Transfer Block Size
418433
@@ -430,4 +445,3 @@ void dma_set_number_of_data(uint32_t dma, uint8_t channel, uint16_t number)
430445
DMA_CNDTR(dma, channel) = number;
431446
}
432447
/**@}*/
433-

0 commit comments

Comments
 (0)