Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
cubexHal.pdf
Скачиваний:
110
Добавлен:
10.02.2016
Размер:
16.16 Mб
Скачать

UM1725

Overview of HAL drivers

d.Use HAL_DMA_IRQHandler() called under DMA_IRQHandler() Interrupt subroutine

e.When data transfer is complete, HAL_DMA_IRQHandler() function is executed and a user function can be called by customizing XferCpltCallback and XferErrorCallback function pointer (i.e. a member of DMA handle structure).

Additional functions and macros are available to ensure efficient DMA management:

Use HAL_DMA_GetState() function to return the DMA state and HAL_DMA_GetError() in case of error detection.

Use HAL_DMA_Abort() function to abort the current transfer The most used DMA HAL driver macros are the following:

__HAL_DMA_ENABLE: enablse the specified DMA Stream.

__HAL_DMA_DISABLE: disables the specified DMA Stream.

__HAL_DMA_GET_FS: returns the current DMA Stream FIFO filled level.

__HAL_DMA_GET_FLAG: gets the DMA Stream pending flags.

__HAL_DMA_CLEAR_FLAG: clears the DMA Stream pending flags.

__HAL_DMA_ENABLE_IT: enables the specified DMA Stream interrupts.

__HAL_DMA_DISABLE_IT: disables the specified DMA Stream interrupts.

__HAL_DMA_GET_IT_SOURCE: checks whether the specified DMA stream interrupt has occurred or not.

When a peripheral is used in DMA mode, the DMA initialization should be done in the HAL_PPP_MspInit() callback. In addition, the user application should associate the DMA handle to the PPP handle (refer to section “HAL IO operation functions”).

DMA double-buffering feature is handled as an extension API.

DMA channel callbacks need to be initialized by the user application only in case of memory-to-memory transfer. However when peripheral-to-memory transfers are used, these callbacks are automatically initialized by calling a process API function that uses the DMA.

2.12How to use HAL drivers

2.12.1HAL usage models

The following figure shows the typical use of the HAL driver and the interaction between the application user, the HAL driver and the interrupts.

DOCID025834 Rev 2

81/900

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]