/*********************************************************************
*                SEGGER MICROCONTROLLER GmbH & Co. KG                *
*        Solutions for real time microcontroller applications        *
**********************************************************************
*                                                                    *
*        (c) 2003-2008     SEGGER Microcontroller GmbH & Co KG       *
*                                                                    *
*        Internet: www.segger.com    Support:  support@segger.com    *
*                                                                    *
**********************************************************************

----------------------------------------------------------------------
File    : Startup_LM3S3748.c
Purpose : Standard startup code for Cortex M3 cores and OS.
--------  END-OF-HEADER  ---------------------------------------------
*/

#include "RTOS.h"

/**********************************************************************
*
*       Defines configurable
*
***********************************************************************
*/
/**********************************************************************
*
*       pragmas
*
***********************************************************************
*/
#pragma language=extended   // Enable the IAR extensions for this source file.

/**********************************************************************
*
*       Publics
*
***********************************************************************
*/

/**********************************************************************
*
*       Externals
*
***********************************************************************
*/
extern void ADCIntHandler(void);
extern void __iar_program_start(void);

/**********************************************************************
*
*       Types
*
***********************************************************************
*/
typedef union {
  void (*pfnHandler)(void);
  void * p;
} VECTOR_TABLE_ENTRY;

/**********************************************************************
*
*       Static code
*
***********************************************************************
*/


/*********************************************************************
*
*       _NmiISR
*
*  This is the code that gets called when the processor receives a NMI.
*  This simply enters an infinite loop, preserving the system state
*  for examination by a debugger.
*
*/
static void _NmiISR(void) {
  while(1) {}   // Infinite loop
}

/*********************************************************************
*
*       _FaultISR
*
*  This is the code that gets called when the processor receives
*  a fault interrupt.  This simply enters an infinite loop, preserving
*  the system state for examination by a debugger.
*
*/
static void _FaultISR(void) {
}

/*********************************************************************
*
*       _IntDefaultHandler
*
*  This is the code that gets called when the processor receives
*  an unexpected interrupt.  This simply enters an infinite loop,
*  preserving the system state for examination by a debugger.
*
*/
static void _IntDefaultHandler(void) {
  while(1) {}   // Infinite loop
}

/**********************************************************************
*
*       Public code
*
***********************************************************************
*/

/**********************************************************************
*
*       Vector table
*
***********************************************************************
*/

/**********************************************************************
*
*  The minimal vector table for a Cortex M3.
*  Note that the proper constructs must be placed on this to ensure
*  that it ends up at physical address 0x0000.0000.
*/
#pragma section="CSTACK"
__root const VECTOR_TABLE_ENTRY pfVectors[256] @ ".intvec" = {
    { .p =__sfe("CSTACK") },
                                            // The initial stack pointer
    __iar_program_start,                    // The reset handler
    _NmiISR,                                // The NMI handler
    _FaultISR,                              // The hard fault handler
    _IntDefaultHandler,                     // The MPU fault handler
    _IntDefaultHandler,                     // The bus fault handler
    _IntDefaultHandler,                     // The usage fault handler
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    _IntDefaultHandler,                     // SVCall handler
    _IntDefaultHandler,                     // Debug monitor handler
    0,                                      // Reserved
    OS_Exception,                           // The PendSV handler
    OS_Systick,                             // The SysTick handler
    _IntDefaultHandler,                     // GPIO Port A
    _IntDefaultHandler,                     // GPIO Port B
    _IntDefaultHandler,                     // GPIO Port C
    _IntDefaultHandler,                     // GPIO Port D
    _IntDefaultHandler,                     // GPIO Port E
    _IntDefaultHandler,                     // UART0 Rx and Tx
    _IntDefaultHandler,                     // UART1 Rx and Tx
    _IntDefaultHandler,                     // SSI Rx and Tx
    _IntDefaultHandler,                     // I2C Master and Slave
    _IntDefaultHandler,                     // PWM Fault
    _IntDefaultHandler,                     // PWM Generator 0
    _IntDefaultHandler,                     // PWM Generator 1
    _IntDefaultHandler,                     // PWM Generator 2
    _IntDefaultHandler,                     // Quadrature Encoder
    _IntDefaultHandler,                     // ADC Sequence 0
    _IntDefaultHandler,                     // ADC Sequence 1
    _IntDefaultHandler,                     // ADC Sequence 2
    _IntDefaultHandler,                     // ADC Sequence 3
    _IntDefaultHandler,                     // Watchdog timer
    _IntDefaultHandler,                     // Timer 0 subtimer A
    _IntDefaultHandler,                     // Timer 0 subtimer B
    _IntDefaultHandler,                     // Timer 1 subtimer A
    _IntDefaultHandler,                     // Timer 1 subtimer B
    _IntDefaultHandler,                     // Timer 2 subtimer A
    _IntDefaultHandler,                     // Timer 2 subtimer B
    _IntDefaultHandler,                     // Analog Comparator 0
    _IntDefaultHandler,                     // Analog Comparator 1
    _IntDefaultHandler,                     // Analog Comparator 2
    _IntDefaultHandler,                     // System Control (PLL, OSC, BO)
    _IntDefaultHandler                      // FLASH Control
};

/****** EOF *********************************************************/
