mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Thu Sep 18 14:00:17 2014 +0100
Revision:
324:406fd2029f23
Parent:
168:cf9372ac0a74
Synchronized with git revision a73f28e6fbca9559fbed2726410eeb4c0534a4a5

Full URL: https://github.com/mbedmicro/mbed/commit/a73f28e6fbca9559fbed2726410eeb4c0534a4a5/

Extended #476, which does not break ethernet for K64F

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 168:cf9372ac0a74 1 /*
mbed_official 168:cf9372ac0a74 2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
mbed_official 168:cf9372ac0a74 3 * All rights reserved.
mbed_official 168:cf9372ac0a74 4 *
mbed_official 168:cf9372ac0a74 5 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 168:cf9372ac0a74 6 * are permitted provided that the following conditions are met:
mbed_official 168:cf9372ac0a74 7 *
mbed_official 168:cf9372ac0a74 8 * o Redistributions of source code must retain the above copyright notice, this list
mbed_official 168:cf9372ac0a74 9 * of conditions and the following disclaimer.
mbed_official 168:cf9372ac0a74 10 *
mbed_official 168:cf9372ac0a74 11 * o Redistributions in binary form must reproduce the above copyright notice, this
mbed_official 168:cf9372ac0a74 12 * list of conditions and the following disclaimer in the documentation and/or
mbed_official 168:cf9372ac0a74 13 * other materials provided with the distribution.
mbed_official 168:cf9372ac0a74 14 *
mbed_official 168:cf9372ac0a74 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
mbed_official 168:cf9372ac0a74 16 * contributors may be used to endorse or promote products derived from this
mbed_official 168:cf9372ac0a74 17 * software without specific prior written permission.
mbed_official 168:cf9372ac0a74 18 *
mbed_official 168:cf9372ac0a74 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
mbed_official 168:cf9372ac0a74 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
mbed_official 168:cf9372ac0a74 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 168:cf9372ac0a74 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
mbed_official 168:cf9372ac0a74 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
mbed_official 168:cf9372ac0a74 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mbed_official 168:cf9372ac0a74 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
mbed_official 168:cf9372ac0a74 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mbed_official 168:cf9372ac0a74 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
mbed_official 168:cf9372ac0a74 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 168:cf9372ac0a74 29 */
mbed_official 168:cf9372ac0a74 30
mbed_official 168:cf9372ac0a74 31 #include <assert.h>
mbed_official 168:cf9372ac0a74 32 #include "fsl_interrupt_manager.h"
mbed_official 168:cf9372ac0a74 33
mbed_official 168:cf9372ac0a74 34 /*******************************************************************************
mbed_official 168:cf9372ac0a74 35 * Definitions
mbed_official 168:cf9372ac0a74 36 ******************************************************************************/
mbed_official 168:cf9372ac0a74 37
mbed_official 168:cf9372ac0a74 38 /*!
mbed_official 168:cf9372ac0a74 39 * @brief Counter to manage the nested callings of global disable/enable interrupt.
mbed_official 168:cf9372ac0a74 40 */
mbed_official 324:406fd2029f23 41 uint32_t g_interruptDisableCount = 0;
mbed_official 168:cf9372ac0a74 42
mbed_official 168:cf9372ac0a74 43 /*******************************************************************************
mbed_official 168:cf9372ac0a74 44 * Code
mbed_official 168:cf9372ac0a74 45 ******************************************************************************/
mbed_official 168:cf9372ac0a74 46
mbed_official 168:cf9372ac0a74 47 /*FUNCTION**********************************************************************
mbed_official 168:cf9372ac0a74 48 *
mbed_official 324:406fd2029f23 49 * Function Name : INT_SYS_InstallHandler
mbed_official 168:cf9372ac0a74 50 * Description : Install an interrupt handler routine for a given IRQ number
mbed_official 168:cf9372ac0a74 51 * This function will let application to register/replace the interrupt
mbed_official 168:cf9372ac0a74 52 * handler for specified IRQ number. IRQ number is different with Vector
mbed_official 168:cf9372ac0a74 53 * number. IRQ 0 will start from Vector 16 address. Refer to reference
mbed_official 168:cf9372ac0a74 54 * manual for details. Also refer to startup_MKxxxx.s file for each chip
mbed_official 168:cf9372ac0a74 55 * family to find out the default interrut handler for each device. This
mbed_official 168:cf9372ac0a74 56 * function will convert the IRQ number to vector number by adding 16 to
mbed_official 168:cf9372ac0a74 57 * it.
mbed_official 168:cf9372ac0a74 58 *
mbed_official 168:cf9372ac0a74 59 *END**************************************************************************/
mbed_official 324:406fd2029f23 60 void INT_SYS_InstallHandler(IRQn_Type irqNumber, void (*handler)(void))
mbed_official 168:cf9372ac0a74 61 {
mbed_official 324:406fd2029f23 62 #if (defined(KEIL))
mbed_official 324:406fd2029f23 63 extern uint32_t Image$$VECTOR_RAM$$Base[];
mbed_official 324:406fd2029f23 64 #define __VECTOR_RAM Image$$VECTOR_RAM$$Base
mbed_official 324:406fd2029f23 65 #else
mbed_official 324:406fd2029f23 66 extern uint32_t __VECTOR_RAM[];
mbed_official 324:406fd2029f23 67 #endif
mbed_official 324:406fd2029f23 68
mbed_official 324:406fd2029f23 69 /* check IRQ number */
mbed_official 324:406fd2029f23 70 assert(FSL_FEATURE_INTERRUPT_IRQ_MIN <= irqNumber);
mbed_official 324:406fd2029f23 71 assert(irqNumber <= FSL_FEATURE_INTERRUPT_IRQ_MAX);
mbed_official 324:406fd2029f23 72
mbed_official 324:406fd2029f23 73 /* set handler into vector table*/
mbed_official 324:406fd2029f23 74 __VECTOR_RAM[irqNumber + 16] = (uint32_t)handler;
mbed_official 168:cf9372ac0a74 75 }
mbed_official 168:cf9372ac0a74 76
mbed_official 168:cf9372ac0a74 77 /*FUNCTION**********************************************************************
mbed_official 168:cf9372ac0a74 78 *
mbed_official 324:406fd2029f23 79 * Function Name : INT_SYS_EnableIRQGlobal
mbed_official 168:cf9372ac0a74 80 * Description : Enable system interrupt
mbed_official 168:cf9372ac0a74 81 * This function will enable the global interrupt by calling the core API
mbed_official 168:cf9372ac0a74 82 *
mbed_official 168:cf9372ac0a74 83 *END**************************************************************************/
mbed_official 324:406fd2029f23 84 void INT_SYS_EnableIRQGlobal(void)
mbed_official 168:cf9372ac0a74 85 {
mbed_official 168:cf9372ac0a74 86 /* check and update */
mbed_official 324:406fd2029f23 87 if (g_interruptDisableCount > 0)
mbed_official 168:cf9372ac0a74 88 {
mbed_official 324:406fd2029f23 89 g_interruptDisableCount--;
mbed_official 168:cf9372ac0a74 90
mbed_official 324:406fd2029f23 91 if (g_interruptDisableCount > 0)
mbed_official 168:cf9372ac0a74 92 {
mbed_official 168:cf9372ac0a74 93 return;
mbed_official 168:cf9372ac0a74 94 }
mbed_official 168:cf9372ac0a74 95
mbed_official 168:cf9372ac0a74 96 /* call core API to enable the global interrupt*/
mbed_official 168:cf9372ac0a74 97 __enable_irq();
mbed_official 168:cf9372ac0a74 98 }
mbed_official 168:cf9372ac0a74 99 }
mbed_official 168:cf9372ac0a74 100
mbed_official 168:cf9372ac0a74 101 /*FUNCTION**********************************************************************
mbed_official 168:cf9372ac0a74 102 *
mbed_official 324:406fd2029f23 103 * Function Name : INT_SYS_DisableIRQGlobal
mbed_official 168:cf9372ac0a74 104 * Description : Disnable system interrupt
mbed_official 168:cf9372ac0a74 105 * This function will disable the global interrupt by calling the core API
mbed_official 168:cf9372ac0a74 106 *
mbed_official 168:cf9372ac0a74 107 *END**************************************************************************/
mbed_official 324:406fd2029f23 108 void INT_SYS_DisableIRQGlobal(void)
mbed_official 168:cf9372ac0a74 109 {
mbed_official 168:cf9372ac0a74 110 /* call core API to disable the global interrupt*/
mbed_official 168:cf9372ac0a74 111 __disable_irq();
mbed_official 168:cf9372ac0a74 112
mbed_official 168:cf9372ac0a74 113 /* update counter*/
mbed_official 324:406fd2029f23 114 g_interruptDisableCount++;
mbed_official 168:cf9372ac0a74 115 }
mbed_official 168:cf9372ac0a74 116
mbed_official 168:cf9372ac0a74 117 /*******************************************************************************
mbed_official 168:cf9372ac0a74 118 * EOF
mbed_official 168:cf9372ac0a74 119 ******************************************************************************/
mbed_official 168:cf9372ac0a74 120