rt-thread/bsp/efm32/Libraries/efm32lib/src/efm32_prs.c

81 lines
3.2 KiB
C

/***************************************************************************//**
* @file
* @brief Peripheral Reflex System (PRS) peripheral module library
* implementation for EFM32.
* @author Energy Micro AS
* @version 1.3.0
*******************************************************************************
* @section License
* <b>(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com</b>
*******************************************************************************
*
* This source code is the property of Energy Micro AS. The source and compiled
* code may only be used on Energy Micro "EFM32" microcontrollers.
*
* This copyright notice may not be removed from the source code nor changed.
*
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
* obligation to support this Software. Energy Micro AS is providing the
* Software "AS IS", with no express or implied warranties of any kind,
* including, but not limited to, any implied warranties of merchantability
* or fitness for any particular purpose or warranties against infringement
* of any proprietary rights of a third party.
*
* Energy Micro AS will not be liable for any consequential, incidental, or
* special damages, or any other relief, or for any claim by any third party,
* arising from your use of this Software.
*
******************************************************************************/
#include "efm32_prs.h"
#include "efm32_assert.h"
#include "efm32_bitband.h"
/***************************************************************************//**
* @addtogroup EFM32_Library
* @{
******************************************************************************/
/***************************************************************************//**
* @addtogroup PRS
* @brief EFM32 peripheral reflex system utilities.
* @{
******************************************************************************/
/*******************************************************************************
************************** GLOBAL FUNCTIONS *******************************
******************************************************************************/
/***************************************************************************//**
* @brief
* Set source and signal to be used for a channel.
*
* @param[in] ch
* Channel to define signal and source for.
*
* @param[in] source
* Source to select for channel. Use one of PRS_CH_CTRL_SOURCESEL_x defines.
*
* @param[in] signal
* Signal (for selected @p source) to use. Use one of PRS_CH_CTRL_SIGSEL_x
* defines.
*
* @param[in] edge
* Edge (for selected source/signal) to generate pulse for.
******************************************************************************/
void PRS_SourceSignalSet(unsigned int ch,
uint32_t source,
uint32_t signal,
PRS_Edge_TypeDef edge)
{
EFM_ASSERT(ch < 8);
PRS->CH[ch].CTRL = (source & _PRS_CH_CTRL_SOURCESEL_MASK) |
(signal & _PRS_CH_CTRL_SIGSEL_MASK) |
(uint32_t) edge;
}
/** @} (end addtogroup PRS) */
/** @} (end addtogroup EFM32_Library) */