1 /***************************************************************************//**
\r
3 * @brief Peripheral Reflex System (PRS) peripheral API
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * Permission is granted to anyone to use this software for any purpose,
\r
11 * including commercial applications, and to alter it and redistribute it
\r
12 * freely, subject to the following restrictions:
\r
14 * 1. The origin of this software must not be misrepresented; you must not
\r
15 * claim that you wrote the original software.
\r
16 * 2. Altered source versions must be plainly marked as such, and must not be
\r
17 * misrepresented as being the original software.
\r
18 * 3. This notice may not be removed or altered from any source distribution.
\r
20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
21 * obligation to support this Software. Silicon Labs is providing the
\r
22 * Software "AS IS", with no express or implied warranties of any kind,
\r
23 * including, but not limited to, any implied warranties of merchantability
\r
24 * or fitness for any particular purpose or warranties against infringement
\r
25 * of any proprietary rights of a third party.
\r
27 * Silicon Labs will not be liable for any consequential, incidental, or
\r
28 * special damages, or any other relief, or for any claim by any third party,
\r
29 * arising from your use of this Software.
\r
31 ******************************************************************************/
\r
34 #ifndef __SILICON_LABS_EM_PRS_H_
\r
35 #define __SILICON_LABS_EM_PRS_H_
\r
37 #include "em_device.h"
\r
38 #if defined(PRS_COUNT) && (PRS_COUNT > 0)
\r
44 /***************************************************************************//**
\r
45 * @addtogroup EM_Library
\r
47 ******************************************************************************/
\r
49 /***************************************************************************//**
\r
52 ******************************************************************************/
\r
54 /*******************************************************************************
\r
55 ******************************** ENUMS ************************************
\r
56 ******************************************************************************/
\r
58 /** Edge detection type. */
\r
61 prsEdgeOff = PRS_CH_CTRL_EDSEL_OFF, /**< Leave signal as is. */
\r
62 prsEdgePos = PRS_CH_CTRL_EDSEL_POSEDGE, /**< Generate pules on positive edge. */
\r
63 prsEdgeNeg = PRS_CH_CTRL_EDSEL_NEGEDGE, /**< Generate pules on negative edge. */
\r
64 prsEdgeBoth = PRS_CH_CTRL_EDSEL_BOTHEDGES /**< Generate pules on both edges. */
\r
67 /*******************************************************************************
\r
68 ***************************** PROTOTYPES **********************************
\r
69 ******************************************************************************/
\r
71 /***************************************************************************//**
\r
73 * Set level control bit for one or more channels.
\r
76 * The level value for a channel is XORed with both the pulse possible issued
\r
77 * by PRS_PulseTrigger() and the PRS input signal selected for the channel(s).
\r
80 * Level to use for channels indicated by @p mask. Use logical OR combination
\r
81 * of PRS_SWLEVEL_CHnLEVEL defines for channels to set high level, otherwise 0.
\r
84 * Mask indicating which channels to set level for. Use logical OR combination
\r
85 * of PRS_SWLEVEL_CHnLEVEL defines.
\r
86 ******************************************************************************/
\r
87 __STATIC_INLINE void PRS_LevelSet(uint32_t level, uint32_t mask)
\r
89 PRS->SWLEVEL = (PRS->SWLEVEL & ~mask) | (level & mask);
\r
93 /***************************************************************************//**
\r
95 * Trigger a high pulse (one HFPERCLK) for one or more channels.
\r
98 * Setting a bit for a channel causes the bit in the register to remain high
\r
99 * for one HFPERCLK cycle. The pulse is XORed with both the corresponding bit
\r
100 * in PRS SWLEVEL register and the PRS input signal selected for the
\r
103 * @param[in] channels
\r
104 * Logical ORed combination of channels to trigger a pulse for. Use
\r
105 * PRS_SWPULSE_CHnPULSE defines.
\r
106 ******************************************************************************/
\r
107 __STATIC_INLINE void PRS_PulseTrigger(uint32_t channels)
\r
109 PRS->SWPULSE = channels & _PRS_SWPULSE_MASK;
\r
112 void PRS_SourceSignalSet(unsigned int ch,
\r
115 PRS_Edge_TypeDef edge);
\r
117 #if defined( PRS_CH_CTRL_ASYNC )
\r
118 void PRS_SourceAsyncSignalSet(unsigned int ch,
\r
123 /** @} (end addtogroup PRS) */
\r
124 /** @} (end addtogroup EM_Library) */
\r
130 #endif /* defined(PRS_COUNT) && (PRS_COUNT > 0) */
\r
131 #endif /* __SILICON_LABS_EM_PRS_H_ */
\r