A31L12x F/W Packages  1.4.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
Functions | Variables
A31L12x_hal_dmacn.c File Reference

Contains all functions support for dmacn firmware library on A31L12x. More...

Go to the source code of this file.

Functions

HAL_Status_Type HAL_DMAC_Init (DMACn_Type *DMACx, uint8_t PERSEL, uint8_t DIR, uint8_t SIZE, uint8_t ERFGSTP)
 Init the DMAC configuration with the specified values. More...
 
HAL_Status_Type HAL_DMAC_DeInit (DMACn_Type *DMACx)
 DeInitialize DMAC peripheral. More...
 
HAL_Status_Type HAL_DMAC_Setup (DMACn_Type *DMACx, uint32_t MAR, uint16_t TRANSCNT)
 Enable the transfer. More...
 

Variables

uint16_t PeripheralAddress []
 

Detailed Description

Contains all functions support for dmacn firmware library on A31L12x.

Version
1.00
Date
2020-05-29
Author
ABOV Application Team

Copyright(C) 2019, ABOV Semiconductor All rights reserved.

ABOV Disclaimer

IMPORTANT NOTICE ? PLEASE READ CAREFULLY ABOV Semiconductor ("ABOV") reserves the right to make changes, corrections, enhancements, modifications, and improvements to ABOV products and/or to this document at any time without notice. ABOV does not give warranties as to the accuracy or completeness of the information included herein. Purchasers should obtain the latest relevant information of ABOV products before placing orders. Purchasers are entirely responsible for the choice, selection, and use of ABOV products and ABOV assumes no liability for application assistance or the design of purchasers' products. No license, express or implied, to any intellectual property rights is granted by ABOV herein. ABOV disclaims all express and implied warranties and shall not be responsible or liable for any injuries or damages related to use of ABOV products in such unauthorized applications. ABOV and the ABOV logo are trademarks of ABOV. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces the information previously supplied in any former versions of this document. 2020 ABOV Semiconductor All rights reserved

Definition in file A31L12x_hal_dmacn.c.

Function Documentation

◆ HAL_DMAC_DeInit()

HAL_Status_Type HAL_DMAC_DeInit ( DMACn_Type *  DMACx)

DeInitialize DMAC peripheral.

Parameters
[in]DMACxPointer to the target DMAC
  • DMAC0 ~ DMAC4
Returns
HAL_Status_Type

Definition at line 171 of file A31L12x_hal_dmacn.c.

172 {
173  /* Check DMAC handle */
174  if( DMACx == NULL )
175  {
176  return HAL_ERROR;
177  }
178 
179  return HAL_OK;
180 }

References HAL_ERROR, and HAL_OK.

◆ HAL_DMAC_Init()

HAL_Status_Type HAL_DMAC_Init ( DMACn_Type *  DMACx,
uint8_t  PERSEL,
uint8_t  DIR,
uint8_t  SIZE,
uint8_t  ERFGSTP 
)

Init the DMAC configuration with the specified values.

Parameters
[in]DMACxPointer to the target DMAC
  • DMAC0 ~ DMAC4
[in]PERSELPeripheral Selection
  • PERSEL_Idle
  • PERSEL_ADC
  • PERSEL_SPI0Rx
  • PERSEL_SPI0Tx
  • PERSEL_SPI1Rx
  • PERSEL_SPI1Tx
  • PERSEL_USART10Rx
  • PERSEL_USART10Tx
  • PERSEL_I2C0Rx
  • PERSEL_I2C0Tx
  • PERSEL_I2C1Rx
  • PERSEL_I2C1Tx
  • PERSEL_UART0Rx
  • PERSEL_UART0Tx
  • PERSEL_UART1Rx
  • PERSEL_UART1Tx
  • PERSEL_LPUARTRx
  • PERSEL_LPUARTTx
  • PERSEL_SC0Rx
  • PERSEL_SC0Tx
  • PERSEL_SC1Rx
  • PERSEL_SC1Tx
[in]DIRTransfer Direction
  • DIR_MemToPeri
  • DIR_PeriToMem
[in]SIZETransfer Size Selection
  • SIZE_8bit
  • SIZE_16bit
  • SIZE_32bit
[in]ERFGSTPError Flag Stop
  • ERFGSTP_Disable
  • ERFGSTP_Enable
Returns
HAL_Status_Type

This fuunction configures the DMA Controller.

[Example]
HAL_DMAC_Init( ( DMACn_Type* )DMAC0, PERSEL_USART10Tx, DIR_MemToPeri, SIZE_8bit, ERFGSTP_Disable );

Definition at line 127 of file A31L12x_hal_dmacn.c.

128 {
129  /* Check DMAC handle */
130  if( DMACx == NULL )
131  {
132  return HAL_ERROR;
133  }
134 
135  // enable peripheral clock and reset peripheral
136  if( SCUCG->PPCLKEN2_b.DMACLKE == 0 )
137  {
138  // enable peripheral clock
139  SCUCG->PPCLKEN2_b.DMACLKE = 1; // DMACLKE[31:31] [0] in [0(disable clock) 1(enable)]
140 
141  // reset peripheral
142  SCUCG->PPRST2_b.DMARST = 1; // DMARST[31:31] [0] in [0(no effect) 1(reset; reset by w0)]
143  SCUCG->PPRST2_b.DMARST = 0; // DMARST[31:31] [0] in [0(no effect) 1(reset; reset by w0)]
144  }
145 
146  // select peripheral address: PAR
147  DMACx->PAR = PeripheralAddress[PERSEL];
148 
149  // select peripheral: PERSEL
150  DMACx->CR_b.PERSEL = PERSEL;
151 
152  // select direction: DIR
153  DMACx->CR_b.DIR = DIR;
154 
155  // select size: SIZE
156  DMACx->CR_b.SIZE = SIZE;
157 
158  // select ERFGSTP: ERFGSTP
159  DMACx->CR_b.ERFGSTP = ERFGSTP; // ERFGSTP[15:15] [0] in [0(disable DMA Stop Function by an error of peripheral) 1(enable)]
160 
161  return HAL_OK;
162 }
uint16_t PeripheralAddress[]

References HAL_ERROR, HAL_OK, and PeripheralAddress.

◆ HAL_DMAC_Setup()

HAL_Status_Type HAL_DMAC_Setup ( DMACn_Type *  DMACx,
uint32_t  MAR,
uint16_t  TRANSCNT 
)

Enable the transfer.

Parameters
[in]DMACxPointer to the target DMAC
  • DMAC0 ~ DMAC4
[in]MARMemory Address
[in]TRANSCNTThe number of times to transfer
Returns
HAL_Status_Type

This fuunction enables the DMA transfer.

[Example]
HAL_DMAC_Setup( ( DMACn_Type* )DMAC0, ( uint32_t )buffer, len );

Definition at line 199 of file A31L12x_hal_dmacn.c.

200 {
201  /* Check DMAC handle */
202  if( DMACx == NULL )
203  {
204  return HAL_ERROR;
205  }
206 
207  // select memory address: MAR
208  DMACx->MAR = MAR;
209 
210  // select count: TRANSCNT
211  DMACx->CR_b.TRANSCNT = TRANSCNT;
212 
213  // enable channel
214  DMACx->CR_b.CHnEN = 1; // CHnEN[00:00] [0] in [0(disable channel n) 1(enable; reset by transfer complete or error)]
215 
216  return HAL_OK;
217 }

References HAL_ERROR, and HAL_OK.

Referenced by HAL_I2C_MasterTransferData_DMA(), and HAL_I2C_SlaveTransferData_DMA().

Here is the caller graph for this function:

Variable Documentation

◆ PeripheralAddress

uint16_t PeripheralAddress[]
Initial value:
=
{
0x0,
PAR_ADC,
PAR_SPI0_Rx,
PAR_SPI0_Tx,
PAR_SPI1_Rx,
PAR_SPI1_Tx,
PAR_USART10_Rx,
PAR_USART10_Tx,
PAR_I2C0_Rx,
PAR_I2C0_Tx,
PAR_I2C1_Rx,
PAR_I2C1_Tx,
PAR_UART0_Rx,
PAR_UART0_Tx,
PAR_UART1_Rx,
PAR_UART1_Tx,
PAR_LPUART_Rx,
PAR_LPUART_Tx,
PAR_SC0_Rx,
PAR_SC0_Tx,
PAR_SC1_Rx,
PAR_SC1_Tx,
}

Definition at line 46 of file A31L12x_hal_dmacn.c.

Referenced by HAL_DMAC_Init().