emlib/src/em_ldma.c
void LDMA_Init(const LDMA_Init_t *init)
{
  EFM_ASSERT(init != NULL);
  EFM_ASSERT(!((init->ldmaInitCtrlNumFixed << _LDMA_CTRL_NUMFIXED_SHIFT)
               & ~_LDMA_CTRL_NUMFIXED_MASK));
  EFM_ASSERT(!((init->ldmaInitCtrlSyncPrsClrEn << _LDMA_CTRL_SYNCPRSCLREN_SHIFT)
               & ~_LDMA_CTRL_SYNCPRSCLREN_MASK));
  EFM_ASSERT(!((init->ldmaInitCtrlSyncPrsSetEn << _LDMA_CTRL_SYNCPRSSETEN_SHIFT)
               & ~_LDMA_CTRL_SYNCPRSSETEN_MASK));
  EFM_ASSERT(init->ldmaInitIrqPriority < (1 << __NVIC_PRIO_BITS));

  CMU_ClockEnable(cmuClock_LDMA, true);

  LDMA->CTRL = (init->ldmaInitCtrlNumFixed << _LDMA_CTRL_NUMFIXED_SHIFT)
               | (init->ldmaInitCtrlSyncPrsClrEn << _LDMA_CTRL_SYNCPRSCLREN_SHIFT)
               | (init->ldmaInitCtrlSyncPrsSetEn << _LDMA_CTRL_SYNCPRSSETEN_SHIFT);

  LDMA->CHEN    = 0;
  LDMA->DBGHALT = 0;
  LDMA->REQDIS  = 0;

  /* Enable LDMA error interrupt. */
  LDMA->IEN = LDMA_IEN_ERROR;
  LDMA->IFC = 0xFFFFFFFF;

  NVIC_ClearPendingIRQ(LDMA_IRQn);

  /* Range is 0..7, 0 is highest priority. */
  NVIC_SetPriority(LDMA_IRQn, init->ldmaInitIrqPriority);

  NVIC_EnableIRQ(LDMA_IRQn);
}
/***************************************************************************/
/**
 * @brief
 *   Initialize the LDMA controller.
 *
 * @details
 *   This function will disable all the LDMA channels and enable the LDMA bus
 *   clock in the CMU. This function will also enable the LDMA IRQ in the NVIC
 *   and set the LDMA IRQ priority to a user configurable priority. The LDMA
 *   interrupt priority is configured using the @ref LDMA_Init_t structure.
 *
 * @note
 *   Since this function enables the LDMA IRQ you should always add a custom
 *   LDMA_IRQHandler to the application in order to handle any interrupts
 *   from LDMA.
 *
 * @param[in] init
 *   Pointer to initialization structure used to configure the LDMA.
 ******************************************************************************/
@brief
Initialize the LDMA controller.

@details
This function will disable all the LDMA channels and enable the LDMA bus
clock in the CMU. This function will also enable the LDMA IRQ in the NVIC
and set the LDMA IRQ priority to a user configurable priority. The LDMA
interrupt priority is configured using the @ref LDMA_Init_t structure.

@note
Since this function enables the LDMA IRQ you should always add a custom
LDMA_IRQHandler to the application in order to handle any interrupts
from LDMA.

@param[in] init
Pointer to initialization structure used to configure the LDMA.
@brief Initialize the LDMA controller . @details This function will disable all the LDMA channels and enable the LDMA bus clock in the CMU . This function will also enable the LDMA IRQ in the NVIC and set the LDMA IRQ priority to a user configurable priority . The LDMA interrupt priority is configured using the @ref LDMA_Init_t structure . @note Since this function enables the LDMA IRQ you should always add a custom LDMA_IRQHandler to the application in order to handle any interrupts from LDMA . @param [ in ] init Pointer to initialization structure used to configure the LDMA .
void LDMA_Init(const LDMA_Init_t *init)
{
  EFM_ASSERT(init != NULL);
  EFM_ASSERT(!((init->ldmaInitCtrlNumFixed << _LDMA_CTRL_NUMFIXED_SHIFT)
               & ~_LDMA_CTRL_NUMFIXED_MASK));
  EFM_ASSERT(!((init->ldmaInitCtrlSyncPrsClrEn << _LDMA_CTRL_SYNCPRSCLREN_SHIFT)
               & ~_LDMA_CTRL_SYNCPRSCLREN_MASK));
  EFM_ASSERT(!((init->ldmaInitCtrlSyncPrsSetEn << _LDMA_CTRL_SYNCPRSSETEN_SHIFT)
               & ~_LDMA_CTRL_SYNCPRSSETEN_MASK));
  EFM_ASSERT(init->ldmaInitIrqPriority < (1 << __NVIC_PRIO_BITS));
  CMU_ClockEnable(cmuClock_LDMA, true);
  LDMA->CTRL = (init->ldmaInitCtrlNumFixed << _LDMA_CTRL_NUMFIXED_SHIFT)
               | (init->ldmaInitCtrlSyncPrsClrEn << _LDMA_CTRL_SYNCPRSCLREN_SHIFT)
               | (init->ldmaInitCtrlSyncPrsSetEn << _LDMA_CTRL_SYNCPRSSETEN_SHIFT);
  LDMA->CHEN    = 0;
  LDMA->DBGHALT = 0;
  LDMA->REQDIS  = 0;
  LDMA->IEN = LDMA_IEN_ERROR;
  LDMA->IFC = 0xFFFFFFFF;
  NVIC_ClearPendingIRQ(LDMA_IRQn);
  NVIC_SetPriority(LDMA_IRQn, init->ldmaInitIrqPriority);
  NVIC_EnableIRQ(LDMA_IRQn);
}
void LDMA_Init ( const LDMA_Init_t * init ) { EFM_ASSERT ( init != NULL ) ; EFM_ASSERT ( ! ( ( init -> ldmaInitCtrlNumFixed << _LDMA_CTRL_NUMFIXED_SHIFT ) & ~ _LDMA_CTRL_NUMFIXED_MASK ) ) ; EFM_ASSERT ( ! ( ( init -> ldmaInitCtrlSyncPrsClrEn << _LDMA_CTRL_SYNCPRSCLREN_SHIFT ) & ~ _LDMA_CTRL_SYNCPRSCLREN_MASK ) ) ; EFM_ASSERT ( ! ( ( init -> ldmaInitCtrlSyncPrsSetEn << _LDMA_CTRL_SYNCPRSSETEN_SHIFT ) & ~ _LDMA_CTRL_SYNCPRSSETEN_MASK ) ) ; EFM_ASSERT ( init -> ldmaInitIrqPriority < ( 1 << __NVIC_PRIO_BITS ) ) ; CMU_ClockEnable ( cmuClock_LDMA , true ) ; LDMA -> CTRL = ( init -> ldmaInitCtrlNumFixed << _LDMA_CTRL_NUMFIXED_SHIFT ) | ( init -> ldmaInitCtrlSyncPrsClrEn << _LDMA_CTRL_SYNCPRSCLREN_SHIFT ) | ( init -> ldmaInitCtrlSyncPrsSetEn << _LDMA_CTRL_SYNCPRSSETEN_SHIFT ) ; LDMA -> CHEN = 0 ; LDMA -> DBGHALT = 0 ; LDMA -> REQDIS = 0 ; LDMA -> IEN = LDMA_IEN_ERROR ; LDMA -> IFC = 0xFFFFFFFF ; NVIC_ClearPendingIRQ ( LDMA_IRQn ) ; NVIC_SetPriority ( LDMA_IRQn , init -> ldmaInitIrqPriority ) ; NVIC_EnableIRQ ( LDMA_IRQn ) ; }
@brief
   Initialize the LDMA controller.
@brief Initialize the LDMA controller .
/* Enable LDMA error interrupt. */ /* Range is 0..7, 0 is highest priority. */