Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dev by
targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/emlib/src/em_prs.c@50:a417edff4437, 2016-01-15 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Jan 15 07:45:16 2016 +0000
- Revision:
- 50:a417edff4437
- Parent:
- 0:9b334a45a8ff
Synchronized with git revision 6010f32619bfcbb01cc73747d4ff9040863482d9
Full URL: https://github.com/mbedmicro/mbed/commit/6010f32619bfcbb01cc73747d4ff9040863482d9/
Remove doubling of buffer size in realiseEndpoint()
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| bogdanm | 0:9b334a45a8ff | 1 | /***************************************************************************//** |
| bogdanm | 0:9b334a45a8ff | 2 | * @file em_prs.c |
| bogdanm | 0:9b334a45a8ff | 3 | * @brief Peripheral Reflex System (PRS) Peripheral API |
| mbed_official | 50:a417edff4437 | 4 | * @version 4.2.1 |
| bogdanm | 0:9b334a45a8ff | 5 | ******************************************************************************* |
| bogdanm | 0:9b334a45a8ff | 6 | * @section License |
| mbed_official | 50:a417edff4437 | 7 | * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b> |
| bogdanm | 0:9b334a45a8ff | 8 | ******************************************************************************* |
| bogdanm | 0:9b334a45a8ff | 9 | * |
| bogdanm | 0:9b334a45a8ff | 10 | * Permission is granted to anyone to use this software for any purpose, |
| bogdanm | 0:9b334a45a8ff | 11 | * including commercial applications, and to alter it and redistribute it |
| bogdanm | 0:9b334a45a8ff | 12 | * freely, subject to the following restrictions: |
| bogdanm | 0:9b334a45a8ff | 13 | * |
| bogdanm | 0:9b334a45a8ff | 14 | * 1. The origin of this software must not be misrepresented; you must not |
| bogdanm | 0:9b334a45a8ff | 15 | * claim that you wrote the original software. |
| bogdanm | 0:9b334a45a8ff | 16 | * 2. Altered source versions must be plainly marked as such, and must not be |
| bogdanm | 0:9b334a45a8ff | 17 | * misrepresented as being the original software. |
| bogdanm | 0:9b334a45a8ff | 18 | * 3. This notice may not be removed or altered from any source distribution. |
| bogdanm | 0:9b334a45a8ff | 19 | * |
| bogdanm | 0:9b334a45a8ff | 20 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
| bogdanm | 0:9b334a45a8ff | 21 | * obligation to support this Software. Silicon Labs is providing the |
| bogdanm | 0:9b334a45a8ff | 22 | * Software "AS IS", with no express or implied warranties of any kind, |
| bogdanm | 0:9b334a45a8ff | 23 | * including, but not limited to, any implied warranties of merchantability |
| bogdanm | 0:9b334a45a8ff | 24 | * or fitness for any particular purpose or warranties against infringement |
| bogdanm | 0:9b334a45a8ff | 25 | * of any proprietary rights of a third party. |
| bogdanm | 0:9b334a45a8ff | 26 | * |
| bogdanm | 0:9b334a45a8ff | 27 | * Silicon Labs will not be liable for any consequential, incidental, or |
| bogdanm | 0:9b334a45a8ff | 28 | * special damages, or any other relief, or for any claim by any third party, |
| bogdanm | 0:9b334a45a8ff | 29 | * arising from your use of this Software. |
| bogdanm | 0:9b334a45a8ff | 30 | * |
| bogdanm | 0:9b334a45a8ff | 31 | ******************************************************************************/ |
| bogdanm | 0:9b334a45a8ff | 32 | |
| bogdanm | 0:9b334a45a8ff | 33 | #include "em_prs.h" |
| bogdanm | 0:9b334a45a8ff | 34 | #if defined(PRS_COUNT) && (PRS_COUNT > 0) |
| bogdanm | 0:9b334a45a8ff | 35 | |
| bogdanm | 0:9b334a45a8ff | 36 | #include "em_assert.h" |
| bogdanm | 0:9b334a45a8ff | 37 | |
| bogdanm | 0:9b334a45a8ff | 38 | /***************************************************************************//** |
| bogdanm | 0:9b334a45a8ff | 39 | * @addtogroup EM_Library |
| bogdanm | 0:9b334a45a8ff | 40 | * @{ |
| bogdanm | 0:9b334a45a8ff | 41 | ******************************************************************************/ |
| bogdanm | 0:9b334a45a8ff | 42 | |
| bogdanm | 0:9b334a45a8ff | 43 | /***************************************************************************//** |
| bogdanm | 0:9b334a45a8ff | 44 | * @addtogroup PRS |
| bogdanm | 0:9b334a45a8ff | 45 | * @brief Peripheral Reflex System (PRS) Peripheral API |
| bogdanm | 0:9b334a45a8ff | 46 | * @{ |
| bogdanm | 0:9b334a45a8ff | 47 | ******************************************************************************/ |
| bogdanm | 0:9b334a45a8ff | 48 | |
| bogdanm | 0:9b334a45a8ff | 49 | /******************************************************************************* |
| bogdanm | 0:9b334a45a8ff | 50 | ************************** GLOBAL FUNCTIONS ******************************* |
| bogdanm | 0:9b334a45a8ff | 51 | ******************************************************************************/ |
| bogdanm | 0:9b334a45a8ff | 52 | |
| bogdanm | 0:9b334a45a8ff | 53 | /***************************************************************************//** |
| bogdanm | 0:9b334a45a8ff | 54 | * @brief |
| bogdanm | 0:9b334a45a8ff | 55 | * Set source and signal to be used for a channel. |
| bogdanm | 0:9b334a45a8ff | 56 | * |
| bogdanm | 0:9b334a45a8ff | 57 | * @param[in] ch |
| bogdanm | 0:9b334a45a8ff | 58 | * Channel to define signal and source for. |
| bogdanm | 0:9b334a45a8ff | 59 | * |
| bogdanm | 0:9b334a45a8ff | 60 | * @param[in] source |
| bogdanm | 0:9b334a45a8ff | 61 | * Source to select for channel. Use one of PRS_CH_CTRL_SOURCESEL_x defines. |
| bogdanm | 0:9b334a45a8ff | 62 | * |
| bogdanm | 0:9b334a45a8ff | 63 | * @param[in] signal |
| bogdanm | 0:9b334a45a8ff | 64 | * Signal (for selected @p source) to use. Use one of PRS_CH_CTRL_SIGSEL_x |
| bogdanm | 0:9b334a45a8ff | 65 | * defines. |
| bogdanm | 0:9b334a45a8ff | 66 | * |
| bogdanm | 0:9b334a45a8ff | 67 | * @param[in] edge |
| bogdanm | 0:9b334a45a8ff | 68 | * Edge (for selected source/signal) to generate pulse for. |
| bogdanm | 0:9b334a45a8ff | 69 | ******************************************************************************/ |
| bogdanm | 0:9b334a45a8ff | 70 | void PRS_SourceSignalSet(unsigned int ch, |
| bogdanm | 0:9b334a45a8ff | 71 | uint32_t source, |
| bogdanm | 0:9b334a45a8ff | 72 | uint32_t signal, |
| bogdanm | 0:9b334a45a8ff | 73 | PRS_Edge_TypeDef edge) |
| bogdanm | 0:9b334a45a8ff | 74 | { |
| bogdanm | 0:9b334a45a8ff | 75 | EFM_ASSERT(ch < PRS_CHAN_COUNT); |
| bogdanm | 0:9b334a45a8ff | 76 | |
| mbed_official | 50:a417edff4437 | 77 | PRS->CH[ch].CTRL = (source & _PRS_CH_CTRL_SOURCESEL_MASK) |
| mbed_official | 50:a417edff4437 | 78 | | (signal & _PRS_CH_CTRL_SIGSEL_MASK) |
| mbed_official | 50:a417edff4437 | 79 | | (uint32_t)edge; |
| bogdanm | 0:9b334a45a8ff | 80 | } |
| bogdanm | 0:9b334a45a8ff | 81 | |
| bogdanm | 0:9b334a45a8ff | 82 | #if defined( PRS_CH_CTRL_ASYNC ) |
| bogdanm | 0:9b334a45a8ff | 83 | /***************************************************************************//** |
| bogdanm | 0:9b334a45a8ff | 84 | * @brief |
| bogdanm | 0:9b334a45a8ff | 85 | * Set source and asynchronous signal to be used for a channel. |
| bogdanm | 0:9b334a45a8ff | 86 | * |
| bogdanm | 0:9b334a45a8ff | 87 | * @details |
| bogdanm | 0:9b334a45a8ff | 88 | * Asynchronous reflexes are not clocked on HFPERCLK, and can be used even in |
| bogdanm | 0:9b334a45a8ff | 89 | * EM2/EM3. |
| bogdanm | 0:9b334a45a8ff | 90 | * There is a limitation to reflexes operating in asynchronous mode: they can |
| bogdanm | 0:9b334a45a8ff | 91 | * only be used by a subset of the reflex consumers. Please refer to PRS |
| bogdanm | 0:9b334a45a8ff | 92 | * chapter in the reference manual for the complete list of supported |
| bogdanm | 0:9b334a45a8ff | 93 | * asynchronous signals and consumers. |
| bogdanm | 0:9b334a45a8ff | 94 | * |
| bogdanm | 0:9b334a45a8ff | 95 | * @note |
| mbed_official | 50:a417edff4437 | 96 | * This function is not supported on EFM32GxxxFyyy parts. |
| bogdanm | 0:9b334a45a8ff | 97 | * In asynchronous mode, the edge detector only works in EM0, hence it shall |
| bogdanm | 0:9b334a45a8ff | 98 | * not be used. The EDSEL parameter in PRS_CHx_CTRL register is set to 0 (OFF) |
| bogdanm | 0:9b334a45a8ff | 99 | * by default. |
| bogdanm | 0:9b334a45a8ff | 100 | * |
| bogdanm | 0:9b334a45a8ff | 101 | * @param[in] ch |
| bogdanm | 0:9b334a45a8ff | 102 | * Channel to define source and asynchronous signal for. |
| bogdanm | 0:9b334a45a8ff | 103 | * |
| bogdanm | 0:9b334a45a8ff | 104 | * @param[in] source |
| bogdanm | 0:9b334a45a8ff | 105 | * Source to select for channel. Use one of PRS_CH_CTRL_SOURCESEL_x defines. |
| bogdanm | 0:9b334a45a8ff | 106 | * |
| bogdanm | 0:9b334a45a8ff | 107 | * @param[in] signal |
| bogdanm | 0:9b334a45a8ff | 108 | * Asynchronous signal (for selected @p source) to use. Use one of the |
| bogdanm | 0:9b334a45a8ff | 109 | * PRS_CH_CTRL_SIGSEL_x defines that support asynchronous operation. |
| bogdanm | 0:9b334a45a8ff | 110 | ******************************************************************************/ |
| bogdanm | 0:9b334a45a8ff | 111 | void PRS_SourceAsyncSignalSet(unsigned int ch, |
| bogdanm | 0:9b334a45a8ff | 112 | uint32_t source, |
| bogdanm | 0:9b334a45a8ff | 113 | uint32_t signal) |
| bogdanm | 0:9b334a45a8ff | 114 | { |
| bogdanm | 0:9b334a45a8ff | 115 | EFM_ASSERT(ch < PRS_CHAN_COUNT); |
| bogdanm | 0:9b334a45a8ff | 116 | |
| mbed_official | 50:a417edff4437 | 117 | PRS->CH[ch].CTRL = PRS_CH_CTRL_ASYNC |
| mbed_official | 50:a417edff4437 | 118 | | (source & _PRS_CH_CTRL_SOURCESEL_MASK) |
| mbed_official | 50:a417edff4437 | 119 | | (signal & _PRS_CH_CTRL_SIGSEL_MASK) |
| mbed_official | 50:a417edff4437 | 120 | | PRS_CH_CTRL_EDSEL_OFF; |
| bogdanm | 0:9b334a45a8ff | 121 | } |
| bogdanm | 0:9b334a45a8ff | 122 | #endif |
| bogdanm | 0:9b334a45a8ff | 123 | |
| bogdanm | 0:9b334a45a8ff | 124 | /** @} (end addtogroup PRS) */ |
| bogdanm | 0:9b334a45a8ff | 125 | /** @} (end addtogroup EM_Library) */ |
| bogdanm | 0:9b334a45a8ff | 126 | #endif /* defined(PRS_COUNT) && (PRS_COUNT > 0) */ |
