added prescaler for 16 bit pwm in LPC1347 target
Fork of mbed-dev by
targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/emlib/src/em_dbg.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
- Child:
- 144:ef7eb2e8f9f7
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_dbg.c |
bogdanm | 0:9b334a45a8ff | 3 | * @brief Debug (DBG) 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_dbg.h" |
bogdanm | 0:9b334a45a8ff | 34 | |
mbed_official | 50:a417edff4437 | 35 | #if defined( CoreDebug_DHCSR_C_DEBUGEN_Msk ) |
bogdanm | 0:9b334a45a8ff | 36 | |
bogdanm | 0:9b334a45a8ff | 37 | #include "em_assert.h" |
bogdanm | 0:9b334a45a8ff | 38 | #include "em_cmu.h" |
bogdanm | 0:9b334a45a8ff | 39 | #include "em_gpio.h" |
bogdanm | 0:9b334a45a8ff | 40 | |
bogdanm | 0:9b334a45a8ff | 41 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 42 | * @addtogroup EM_Library |
bogdanm | 0:9b334a45a8ff | 43 | * @{ |
bogdanm | 0:9b334a45a8ff | 44 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 45 | |
bogdanm | 0:9b334a45a8ff | 46 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 47 | * @addtogroup DBG |
bogdanm | 0:9b334a45a8ff | 48 | * @brief Debug (DBG) Peripheral API |
bogdanm | 0:9b334a45a8ff | 49 | * @{ |
bogdanm | 0:9b334a45a8ff | 50 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 51 | |
bogdanm | 0:9b334a45a8ff | 52 | /******************************************************************************* |
bogdanm | 0:9b334a45a8ff | 53 | ************************** GLOBAL FUNCTIONS ******************************* |
bogdanm | 0:9b334a45a8ff | 54 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 55 | |
mbed_official | 50:a417edff4437 | 56 | #if defined( GPIO_ROUTE_SWOPEN ) || defined( GPIO_ROUTEPEN_SWVPEN ) |
bogdanm | 0:9b334a45a8ff | 57 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 58 | * @brief |
bogdanm | 0:9b334a45a8ff | 59 | * Enable Serial Wire Output (SWO) pin. |
bogdanm | 0:9b334a45a8ff | 60 | * |
bogdanm | 0:9b334a45a8ff | 61 | * @details |
bogdanm | 0:9b334a45a8ff | 62 | * The SWO pin (sometimes denoted SWV, serial wire viewer) allows for |
bogdanm | 0:9b334a45a8ff | 63 | * miscellaneous output to be passed from the Cortex-M3 debug trace module to |
bogdanm | 0:9b334a45a8ff | 64 | * an external debug probe. By default, the debug trace module and pin output |
bogdanm | 0:9b334a45a8ff | 65 | * may be disabled. |
bogdanm | 0:9b334a45a8ff | 66 | * |
bogdanm | 0:9b334a45a8ff | 67 | * Since the SWO pin is only useful when using a debugger, a suggested use |
bogdanm | 0:9b334a45a8ff | 68 | * of this function during startup may be: |
bogdanm | 0:9b334a45a8ff | 69 | * @verbatim |
bogdanm | 0:9b334a45a8ff | 70 | * if (DBG_Connected()) |
bogdanm | 0:9b334a45a8ff | 71 | * { |
bogdanm | 0:9b334a45a8ff | 72 | * DBG_SWOEnable(1); |
bogdanm | 0:9b334a45a8ff | 73 | * } |
bogdanm | 0:9b334a45a8ff | 74 | * @endverbatim |
bogdanm | 0:9b334a45a8ff | 75 | * By checking if debugger is attached, some setup leading to higher energy |
bogdanm | 0:9b334a45a8ff | 76 | * consumption when debugger is attached, can be avoided when not using |
bogdanm | 0:9b334a45a8ff | 77 | * a debugger. |
bogdanm | 0:9b334a45a8ff | 78 | * |
bogdanm | 0:9b334a45a8ff | 79 | * Another alternative may be to set the debugger tool chain to configure |
bogdanm | 0:9b334a45a8ff | 80 | * the required setup (similar to the content of this function) by some |
bogdanm | 0:9b334a45a8ff | 81 | * sort of toolchain scripting during its attach/reset procedure. In that |
bogdanm | 0:9b334a45a8ff | 82 | * case, the above suggested code for enabling the SWO pin is not required |
bogdanm | 0:9b334a45a8ff | 83 | * in the application. |
bogdanm | 0:9b334a45a8ff | 84 | * |
bogdanm | 0:9b334a45a8ff | 85 | * @param[in] location |
bogdanm | 0:9b334a45a8ff | 86 | * Pin location used for SWO pin on the application in use. |
bogdanm | 0:9b334a45a8ff | 87 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 88 | void DBG_SWOEnable(unsigned int location) |
bogdanm | 0:9b334a45a8ff | 89 | { |
bogdanm | 0:9b334a45a8ff | 90 | int port; |
bogdanm | 0:9b334a45a8ff | 91 | int pin; |
bogdanm | 0:9b334a45a8ff | 92 | |
bogdanm | 0:9b334a45a8ff | 93 | EFM_ASSERT(location < AFCHANLOC_MAX); |
bogdanm | 0:9b334a45a8ff | 94 | |
mbed_official | 50:a417edff4437 | 95 | #if defined ( AF_DBG_SWO_PORT ) |
bogdanm | 0:9b334a45a8ff | 96 | port = AF_DBG_SWO_PORT(location); |
bogdanm | 0:9b334a45a8ff | 97 | pin = AF_DBG_SWO_PIN(location); |
mbed_official | 50:a417edff4437 | 98 | #elif defined (AF_DBG_SWV_PORT ) |
mbed_official | 50:a417edff4437 | 99 | port = AF_DBG_SWV_PORT(location); |
mbed_official | 50:a417edff4437 | 100 | pin = AF_DBG_SWV_PIN(location); |
mbed_official | 50:a417edff4437 | 101 | #else |
mbed_official | 50:a417edff4437 | 102 | #warning "AF debug port is not defined." |
mbed_official | 50:a417edff4437 | 103 | #endif |
bogdanm | 0:9b334a45a8ff | 104 | |
bogdanm | 0:9b334a45a8ff | 105 | /* Port/pin location not defined for device? */ |
bogdanm | 0:9b334a45a8ff | 106 | if ((pin < 0) || (port < 0)) |
bogdanm | 0:9b334a45a8ff | 107 | { |
bogdanm | 0:9b334a45a8ff | 108 | EFM_ASSERT(0); |
bogdanm | 0:9b334a45a8ff | 109 | return; |
bogdanm | 0:9b334a45a8ff | 110 | } |
bogdanm | 0:9b334a45a8ff | 111 | |
bogdanm | 0:9b334a45a8ff | 112 | /* Ensure auxiliary clock going to the Cortex debug trace module is enabled */ |
bogdanm | 0:9b334a45a8ff | 113 | CMU_OscillatorEnable(cmuOsc_AUXHFRCO, true, false); |
bogdanm | 0:9b334a45a8ff | 114 | |
bogdanm | 0:9b334a45a8ff | 115 | /* Set selected pin location for SWO pin and enable it */ |
bogdanm | 0:9b334a45a8ff | 116 | GPIO_DbgLocationSet(location); |
bogdanm | 0:9b334a45a8ff | 117 | GPIO_DbgSWOEnable(true); |
bogdanm | 0:9b334a45a8ff | 118 | |
bogdanm | 0:9b334a45a8ff | 119 | /* Configure SWO pin for output */ |
bogdanm | 0:9b334a45a8ff | 120 | GPIO_PinModeSet((GPIO_Port_TypeDef)port, pin, gpioModePushPull, 0); |
bogdanm | 0:9b334a45a8ff | 121 | } |
bogdanm | 0:9b334a45a8ff | 122 | #endif |
bogdanm | 0:9b334a45a8ff | 123 | |
bogdanm | 0:9b334a45a8ff | 124 | /** @} (end addtogroup DBG) */ |
bogdanm | 0:9b334a45a8ff | 125 | /** @} (end addtogroup EM_Library) */ |
mbed_official | 50:a417edff4437 | 126 | #endif /* defined( CoreDebug_DHCSR_C_DEBUGEN_Msk ) */ |