/************************************************************ 
Copyright (C) 1995-2006 Pumpkin, Inc. and its
Licensor(s). Freely distributable.

$Source: C:\\RCS\\D\\Pumpkin\\Salvo\\Examples\\ARM\\Luminary_LM3S1XX\\Luminary_DK-LM3S1XX\\GCCARM\\Tut\\Tut5\\tut5.c,v $
$Author: aek $
$Revision: 3.1 $
$Date: 2006-05-15 23:53:57-07 $

Support file for tutorial program Tut5. 

************************************************************/

//*****************************************************************************
//
//                  Cortex-M3 SysTick Timer Interrupt Example
//
// Description
// -----------
// This example demonstrates a simple interrupt handler and setting up the
// Cortex-M3 SysTick timer.
//
////////////////////////////////////////////////////////////////////////////////

#include "hw_types.h"
#include "sysctl.h"         /* system control API */
#include "systick.h"        /* system tick timer API */

extern void OSTimer(void);

/* interrupt handler for systick, handler is installed in vector */
/* table in startup.s                                            */
void
SysTick_irq_handler(void)
{
  OSTimer();
}

/*
 * Setup the systick timer to generate the tick interrupts at the required
 * frequency.
 */
void InitSysTickTimer(void)
{
    /* set the system clocking to use xtal at 6 mhz */
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC |
                   SYSCTL_XTAL_6MHZ | SYSCTL_OSC_MAIN);

    /* set the system tick for 100/second, and enable interrupts */
    SysTickPeriodSet(SysCtlClockGet() / 100);
    SysTickEnable();
    SysTickIntEnable();
}
