mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Wed Apr 29 10:16:23 2015 +0100
Revision:
98:8ab26030e058
Child:
113:f141b2784e32
Release 98 of the mbed library

Changes:
- Silabs new targets (Giant, Zero, Happy, Leopard, Wonder Geckos)
- Asynchronous SPI, I2C, Serial
- LowPower classes
- Nordic - nordic SDK v8.0 update
- Teensy - gcc arm fix for startup
- Nucleo F411 - usb freq fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 98:8ab26030e058 1 /***************************************************************************//**
Kojto 98:8ab26030e058 2 * @file em_prs.h
Kojto 98:8ab26030e058 3 * @brief Peripheral Reflex System (PRS) peripheral API
Kojto 98:8ab26030e058 4 * @version 3.20.12
Kojto 98:8ab26030e058 5 *******************************************************************************
Kojto 98:8ab26030e058 6 * @section License
Kojto 98:8ab26030e058 7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
Kojto 98:8ab26030e058 8 *******************************************************************************
Kojto 98:8ab26030e058 9 *
Kojto 98:8ab26030e058 10 * Permission is granted to anyone to use this software for any purpose,
Kojto 98:8ab26030e058 11 * including commercial applications, and to alter it and redistribute it
Kojto 98:8ab26030e058 12 * freely, subject to the following restrictions:
Kojto 98:8ab26030e058 13 *
Kojto 98:8ab26030e058 14 * 1. The origin of this software must not be misrepresented; you must not
Kojto 98:8ab26030e058 15 * claim that you wrote the original software.
Kojto 98:8ab26030e058 16 * 2. Altered source versions must be plainly marked as such, and must not be
Kojto 98:8ab26030e058 17 * misrepresented as being the original software.
Kojto 98:8ab26030e058 18 * 3. This notice may not be removed or altered from any source distribution.
Kojto 98:8ab26030e058 19 *
Kojto 98:8ab26030e058 20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
Kojto 98:8ab26030e058 21 * obligation to support this Software. Silicon Labs is providing the
Kojto 98:8ab26030e058 22 * Software "AS IS", with no express or implied warranties of any kind,
Kojto 98:8ab26030e058 23 * including, but not limited to, any implied warranties of merchantability
Kojto 98:8ab26030e058 24 * or fitness for any particular purpose or warranties against infringement
Kojto 98:8ab26030e058 25 * of any proprietary rights of a third party.
Kojto 98:8ab26030e058 26 *
Kojto 98:8ab26030e058 27 * Silicon Labs will not be liable for any consequential, incidental, or
Kojto 98:8ab26030e058 28 * special damages, or any other relief, or for any claim by any third party,
Kojto 98:8ab26030e058 29 * arising from your use of this Software.
Kojto 98:8ab26030e058 30 *
Kojto 98:8ab26030e058 31 ******************************************************************************/
Kojto 98:8ab26030e058 32
Kojto 98:8ab26030e058 33
Kojto 98:8ab26030e058 34 #ifndef __SILICON_LABS_EM_PRS_H_
Kojto 98:8ab26030e058 35 #define __SILICON_LABS_EM_PRS_H_
Kojto 98:8ab26030e058 36
Kojto 98:8ab26030e058 37 #include "em_device.h"
Kojto 98:8ab26030e058 38 #if defined(PRS_COUNT) && (PRS_COUNT > 0)
Kojto 98:8ab26030e058 39
Kojto 98:8ab26030e058 40 #ifdef __cplusplus
Kojto 98:8ab26030e058 41 extern "C" {
Kojto 98:8ab26030e058 42 #endif
Kojto 98:8ab26030e058 43
Kojto 98:8ab26030e058 44 /***************************************************************************//**
Kojto 98:8ab26030e058 45 * @addtogroup EM_Library
Kojto 98:8ab26030e058 46 * @{
Kojto 98:8ab26030e058 47 ******************************************************************************/
Kojto 98:8ab26030e058 48
Kojto 98:8ab26030e058 49 /***************************************************************************//**
Kojto 98:8ab26030e058 50 * @addtogroup PRS
Kojto 98:8ab26030e058 51 * @{
Kojto 98:8ab26030e058 52 ******************************************************************************/
Kojto 98:8ab26030e058 53
Kojto 98:8ab26030e058 54 /*******************************************************************************
Kojto 98:8ab26030e058 55 ******************************** ENUMS ************************************
Kojto 98:8ab26030e058 56 ******************************************************************************/
Kojto 98:8ab26030e058 57
Kojto 98:8ab26030e058 58 /** Edge detection type. */
Kojto 98:8ab26030e058 59 typedef enum
Kojto 98:8ab26030e058 60 {
Kojto 98:8ab26030e058 61 prsEdgeOff = PRS_CH_CTRL_EDSEL_OFF, /**< Leave signal as is. */
Kojto 98:8ab26030e058 62 prsEdgePos = PRS_CH_CTRL_EDSEL_POSEDGE, /**< Generate pules on positive edge. */
Kojto 98:8ab26030e058 63 prsEdgeNeg = PRS_CH_CTRL_EDSEL_NEGEDGE, /**< Generate pules on negative edge. */
Kojto 98:8ab26030e058 64 prsEdgeBoth = PRS_CH_CTRL_EDSEL_BOTHEDGES /**< Generate pules on both edges. */
Kojto 98:8ab26030e058 65 } PRS_Edge_TypeDef;
Kojto 98:8ab26030e058 66
Kojto 98:8ab26030e058 67 /*******************************************************************************
Kojto 98:8ab26030e058 68 ***************************** PROTOTYPES **********************************
Kojto 98:8ab26030e058 69 ******************************************************************************/
Kojto 98:8ab26030e058 70
Kojto 98:8ab26030e058 71 /***************************************************************************//**
Kojto 98:8ab26030e058 72 * @brief
Kojto 98:8ab26030e058 73 * Set level control bit for one or more channels.
Kojto 98:8ab26030e058 74 *
Kojto 98:8ab26030e058 75 * @details
Kojto 98:8ab26030e058 76 * The level value for a channel is XORed with both the pulse possible issued
Kojto 98:8ab26030e058 77 * by PRS_PulseTrigger() and the PRS input signal selected for the channel(s).
Kojto 98:8ab26030e058 78 *
Kojto 98:8ab26030e058 79 * @param[in] level
Kojto 98:8ab26030e058 80 * Level to use for channels indicated by @p mask. Use logical OR combination
Kojto 98:8ab26030e058 81 * of PRS_SWLEVEL_CHnLEVEL defines for channels to set high level, otherwise 0.
Kojto 98:8ab26030e058 82 *
Kojto 98:8ab26030e058 83 * @param[in] mask
Kojto 98:8ab26030e058 84 * Mask indicating which channels to set level for. Use logical OR combination
Kojto 98:8ab26030e058 85 * of PRS_SWLEVEL_CHnLEVEL defines.
Kojto 98:8ab26030e058 86 ******************************************************************************/
Kojto 98:8ab26030e058 87 __STATIC_INLINE void PRS_LevelSet(uint32_t level, uint32_t mask)
Kojto 98:8ab26030e058 88 {
Kojto 98:8ab26030e058 89 PRS->SWLEVEL = (PRS->SWLEVEL & ~mask) | (level & mask);
Kojto 98:8ab26030e058 90 }
Kojto 98:8ab26030e058 91
Kojto 98:8ab26030e058 92
Kojto 98:8ab26030e058 93 /***************************************************************************//**
Kojto 98:8ab26030e058 94 * @brief
Kojto 98:8ab26030e058 95 * Trigger a high pulse (one HFPERCLK) for one or more channels.
Kojto 98:8ab26030e058 96 *
Kojto 98:8ab26030e058 97 * @details
Kojto 98:8ab26030e058 98 * Setting a bit for a channel causes the bit in the register to remain high
Kojto 98:8ab26030e058 99 * for one HFPERCLK cycle. The pulse is XORed with both the corresponding bit
Kojto 98:8ab26030e058 100 * in PRS SWLEVEL register and the PRS input signal selected for the
Kojto 98:8ab26030e058 101 * channel(s).
Kojto 98:8ab26030e058 102 *
Kojto 98:8ab26030e058 103 * @param[in] channels
Kojto 98:8ab26030e058 104 * Logical ORed combination of channels to trigger a pulse for. Use
Kojto 98:8ab26030e058 105 * PRS_SWPULSE_CHnPULSE defines.
Kojto 98:8ab26030e058 106 ******************************************************************************/
Kojto 98:8ab26030e058 107 __STATIC_INLINE void PRS_PulseTrigger(uint32_t channels)
Kojto 98:8ab26030e058 108 {
Kojto 98:8ab26030e058 109 PRS->SWPULSE = channels & _PRS_SWPULSE_MASK;
Kojto 98:8ab26030e058 110 }
Kojto 98:8ab26030e058 111
Kojto 98:8ab26030e058 112 void PRS_SourceSignalSet(unsigned int ch,
Kojto 98:8ab26030e058 113 uint32_t source,
Kojto 98:8ab26030e058 114 uint32_t signal,
Kojto 98:8ab26030e058 115 PRS_Edge_TypeDef edge);
Kojto 98:8ab26030e058 116
Kojto 98:8ab26030e058 117 #if defined( PRS_CH_CTRL_ASYNC )
Kojto 98:8ab26030e058 118 void PRS_SourceAsyncSignalSet(unsigned int ch,
Kojto 98:8ab26030e058 119 uint32_t source,
Kojto 98:8ab26030e058 120 uint32_t signal);
Kojto 98:8ab26030e058 121 #endif
Kojto 98:8ab26030e058 122
Kojto 98:8ab26030e058 123 /** @} (end addtogroup PRS) */
Kojto 98:8ab26030e058 124 /** @} (end addtogroup EM_Library) */
Kojto 98:8ab26030e058 125
Kojto 98:8ab26030e058 126 #ifdef __cplusplus
Kojto 98:8ab26030e058 127 }
Kojto 98:8ab26030e058 128 #endif
Kojto 98:8ab26030e058 129
Kojto 98:8ab26030e058 130 #endif /* defined(PRS_COUNT) && (PRS_COUNT > 0) */
Kojto 98:8ab26030e058 131 #endif /* __SILICON_LABS_EM_PRS_H_ */