added prescaler for 16 bit pwm in LPC1347 target
Fork of mbed-dev by
targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/emlib/src/em_crc.c@50:a417edff4437, 2016-01-15 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Jan 15 07:45:16 2016 +0000
- Revision:
- 50:a417edff4437
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 |
---|---|---|---|
mbed_official | 50:a417edff4437 | 1 | /***************************************************************************//** |
mbed_official | 50:a417edff4437 | 2 | * @file |
mbed_official | 50:a417edff4437 | 3 | * @brief Cyclic Redundancy Check (CRC) API. |
mbed_official | 50:a417edff4437 | 4 | * @version 4.2.1 |
mbed_official | 50:a417edff4437 | 5 | ******************************************************************************* |
mbed_official | 50:a417edff4437 | 6 | * @section License |
mbed_official | 50:a417edff4437 | 7 | * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b> |
mbed_official | 50:a417edff4437 | 8 | ******************************************************************************* |
mbed_official | 50:a417edff4437 | 9 | * |
mbed_official | 50:a417edff4437 | 10 | * Permission is granted to anyone to use this software for any purpose, |
mbed_official | 50:a417edff4437 | 11 | * including commercial applications, and to alter it and redistribute it |
mbed_official | 50:a417edff4437 | 12 | * freely, subject to the following restrictions: |
mbed_official | 50:a417edff4437 | 13 | * |
mbed_official | 50:a417edff4437 | 14 | * 1. The origin of this software must not be misrepresented; you must not |
mbed_official | 50:a417edff4437 | 15 | * claim that you wrote the original software. |
mbed_official | 50:a417edff4437 | 16 | * 2. Altered source versions must be plainly marked as such, and must not be |
mbed_official | 50:a417edff4437 | 17 | * misrepresented as being the original software. |
mbed_official | 50:a417edff4437 | 18 | * 3. This notice may not be removed or altered from any source distribution. |
mbed_official | 50:a417edff4437 | 19 | * |
mbed_official | 50:a417edff4437 | 20 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
mbed_official | 50:a417edff4437 | 21 | * obligation to support this Software. Silicon Labs is providing the |
mbed_official | 50:a417edff4437 | 22 | * Software "AS IS", with no express or implied warranties of any kind, |
mbed_official | 50:a417edff4437 | 23 | * including, but not limited to, any implied warranties of merchantability |
mbed_official | 50:a417edff4437 | 24 | * or fitness for any particular purpose or warranties against infringement |
mbed_official | 50:a417edff4437 | 25 | * of any proprietary rights of a third party. |
mbed_official | 50:a417edff4437 | 26 | * |
mbed_official | 50:a417edff4437 | 27 | * Silicon Labs will not be liable for any consequential, incidental, or |
mbed_official | 50:a417edff4437 | 28 | * special damages, or any other relief, or for any claim by any third party, |
mbed_official | 50:a417edff4437 | 29 | * arising from your use of this Software. |
mbed_official | 50:a417edff4437 | 30 | * |
mbed_official | 50:a417edff4437 | 31 | ******************************************************************************/ |
mbed_official | 50:a417edff4437 | 32 | |
mbed_official | 50:a417edff4437 | 33 | #include "em_crc.h" |
mbed_official | 50:a417edff4437 | 34 | #include "em_assert.h" |
mbed_official | 50:a417edff4437 | 35 | |
mbed_official | 50:a417edff4437 | 36 | #if defined(CRC_COUNT) && (CRC_COUNT > 0) |
mbed_official | 50:a417edff4437 | 37 | |
mbed_official | 50:a417edff4437 | 38 | /***************************************************************************//** |
mbed_official | 50:a417edff4437 | 39 | * @addtogroup EM_Library |
mbed_official | 50:a417edff4437 | 40 | * @{ |
mbed_official | 50:a417edff4437 | 41 | ******************************************************************************/ |
mbed_official | 50:a417edff4437 | 42 | |
mbed_official | 50:a417edff4437 | 43 | /***************************************************************************//** |
mbed_official | 50:a417edff4437 | 44 | * @addtogroup CRC |
mbed_official | 50:a417edff4437 | 45 | * @{ |
mbed_official | 50:a417edff4437 | 46 | ******************************************************************************/ |
mbed_official | 50:a417edff4437 | 47 | |
mbed_official | 50:a417edff4437 | 48 | /******************************************************************************* |
mbed_official | 50:a417edff4437 | 49 | ******************************** ENUMS ************************************ |
mbed_official | 50:a417edff4437 | 50 | ******************************************************************************/ |
mbed_official | 50:a417edff4437 | 51 | |
mbed_official | 50:a417edff4437 | 52 | |
mbed_official | 50:a417edff4437 | 53 | /******************************************************************************* |
mbed_official | 50:a417edff4437 | 54 | ******************************* STRUCTS *********************************** |
mbed_official | 50:a417edff4437 | 55 | ******************************************************************************/ |
mbed_official | 50:a417edff4437 | 56 | |
mbed_official | 50:a417edff4437 | 57 | |
mbed_official | 50:a417edff4437 | 58 | /******************************************************************************* |
mbed_official | 50:a417edff4437 | 59 | *************************** GLOBAL FUNCTIONS ****************************** |
mbed_official | 50:a417edff4437 | 60 | ******************************************************************************/ |
mbed_official | 50:a417edff4437 | 61 | |
mbed_official | 50:a417edff4437 | 62 | /***************************************************************************//** |
mbed_official | 50:a417edff4437 | 63 | * @brief |
mbed_official | 50:a417edff4437 | 64 | * Initialize the Cyclic Redundancy Check (CRC) module of EFR. |
mbed_official | 50:a417edff4437 | 65 | * |
mbed_official | 50:a417edff4437 | 66 | * @details |
mbed_official | 50:a417edff4437 | 67 | * Use this function to configure the main operational parameters of the CRC |
mbed_official | 50:a417edff4437 | 68 | * such as CRC bytes, number of valid input bits, input/output bit- and bit |
mbed_official | 50:a417edff4437 | 69 | * order reversing. |
mbed_official | 50:a417edff4437 | 70 | * Refer to EFR Reference Manual Chapter 14 and the configuration structure |
mbed_official | 50:a417edff4437 | 71 | * CRC_Init_TypeDef for more details. |
mbed_official | 50:a417edff4437 | 72 | * |
mbed_official | 50:a417edff4437 | 73 | * @note |
mbed_official | 50:a417edff4437 | 74 | * Internal notes: |
mbed_official | 50:a417edff4437 | 75 | * - Initialize the CRC in the Init() function or let users use the separate |
mbed_official | 50:a417edff4437 | 76 | * command function? |
mbed_official | 50:a417edff4437 | 77 | * |
mbed_official | 50:a417edff4437 | 78 | * @param[in] init |
mbed_official | 50:a417edff4437 | 79 | * Pointer to initialization structure used to configure the CRC. |
mbed_official | 50:a417edff4437 | 80 | ******************************************************************************/ |
mbed_official | 50:a417edff4437 | 81 | void CRC_Init(CRC_Init_TypeDef const *init) |
mbed_official | 50:a417edff4437 | 82 | { |
mbed_official | 50:a417edff4437 | 83 | /* Sanity check of bitsPerWord. */ |
mbed_official | 50:a417edff4437 | 84 | EFM_ASSERT(init->bitsPerWord < 16U); |
mbed_official | 50:a417edff4437 | 85 | |
mbed_official | 50:a417edff4437 | 86 | /* Set CRC control configuration parameters such as CRC width, byte and bit |
mbed_official | 50:a417edff4437 | 87 | * bit order, the number of bits per word, inverting input/output, etc. */ |
mbed_official | 50:a417edff4437 | 88 | CRC->CTRL = (uint32_t)init->crcWidth |
mbed_official | 50:a417edff4437 | 89 | | (uint32_t)init->byteReverse |
mbed_official | 50:a417edff4437 | 90 | | (uint32_t)init->inputBitOrder |
mbed_official | 50:a417edff4437 | 91 | | (uint32_t)init->bitReverse |
mbed_official | 50:a417edff4437 | 92 | | ((uint32_t)init->bitsPerWord >> _CRC_CTRL_BITSPERWORD_SHIFT) |
mbed_official | 50:a417edff4437 | 93 | | ((uint32_t)init->inputPadding >> _CRC_CTRL_PADCRCINPUT_SHIFT) |
mbed_official | 50:a417edff4437 | 94 | | ((uint32_t)init->invInput >> _CRC_CTRL_INPUTINV_SHIFT) |
mbed_official | 50:a417edff4437 | 95 | | ((uint32_t)init->invOutput >> _CRC_CTRL_OUTPUTINV_SHIFT); |
mbed_official | 50:a417edff4437 | 96 | |
mbed_official | 50:a417edff4437 | 97 | /* Set CRC polynomial value. */ |
mbed_official | 50:a417edff4437 | 98 | CRC->POLY = init->crcPoly; |
mbed_official | 50:a417edff4437 | 99 | |
mbed_official | 50:a417edff4437 | 100 | /* Load CRC initialization value to CRC_INIT. Please note, that the |
mbed_official | 50:a417edff4437 | 101 | * initialization is not performed here! */ |
mbed_official | 50:a417edff4437 | 102 | CRC->INIT = init->initValue; |
mbed_official | 50:a417edff4437 | 103 | } |
mbed_official | 50:a417edff4437 | 104 | |
mbed_official | 50:a417edff4437 | 105 | |
mbed_official | 50:a417edff4437 | 106 | /***************************************************************************//** |
mbed_official | 50:a417edff4437 | 107 | * @brief |
mbed_official | 50:a417edff4437 | 108 | * Reset CRC registers to the hardware reset state. |
mbed_official | 50:a417edff4437 | 109 | ******************************************************************************/ |
mbed_official | 50:a417edff4437 | 110 | void CRC_Reset(void) |
mbed_official | 50:a417edff4437 | 111 | { |
mbed_official | 50:a417edff4437 | 112 | /* Reset CRC registers to their default value. */ |
mbed_official | 50:a417edff4437 | 113 | CRC->CTRL = _CRC_CTRL_RESETVALUE; |
mbed_official | 50:a417edff4437 | 114 | CRC->POLY = _CRC_POLY_RESETVALUE; |
mbed_official | 50:a417edff4437 | 115 | CRC->INIT = _CRC_INIT_RESETVALUE; |
mbed_official | 50:a417edff4437 | 116 | } |
mbed_official | 50:a417edff4437 | 117 | |
mbed_official | 50:a417edff4437 | 118 | |
mbed_official | 50:a417edff4437 | 119 | /** @} (end addtogroup CRC) */ |
mbed_official | 50:a417edff4437 | 120 | /** @} (end addtogroup EM_Library) */ |
mbed_official | 50:a417edff4437 | 121 | |
mbed_official | 50:a417edff4437 | 122 | #endif /* defined(CRC_COUNT) && (CRC_COUNT > 0) */ |