lpc-field

Template project for programming NXP's LPC1768 MCUs
git clone git://git.mdnr.space/lpc-field
Log | Files | Refs | README | LICENSE

lpc17xx_systick.h (4137B)


      1 /**********************************************************************
      2 * $Id$		lpc17xx_systick.h				2010-05-21
      3 *//**
      4 * @file		lpc17xx_systick.h
      5 * @brief	Contains all macro definitions and function prototypes
      6 * 			support for SYSTICK firmware library on LPC17xx
      7 * @version	2.0
      8 * @date		21. May. 2010
      9 * @author	NXP MCU SW Application Team
     10 *
     11 * Copyright(C) 2010, NXP Semiconductor
     12 * All rights reserved.
     13 *
     14 ***********************************************************************
     15 * Software that is described herein is for illustrative purposes only
     16 * which provides customers with programming information regarding the
     17 * products. This software is supplied "AS IS" without any warranties.
     18 * NXP Semiconductors assumes no responsibility or liability for the
     19 * use of the software, conveys no license or title under any patent,
     20 * copyright, or mask work right to the product. NXP Semiconductors
     21 * reserves the right to make changes in the software without
     22 * notification. NXP Semiconductors also make no representation or
     23 * warranty that such application will be suitable for the specified
     24 * use without further testing or modification.
     25 * Permission to use, copy, modify, and distribute this software and its
     26 * documentation is hereby granted, under NXP Semiconductors'
     27 * relevant copyright in the software, without fee, provided that it
     28 * is used in conjunction with NXP Semiconductors microcontrollers.  This
     29 * copyright, permission, and disclaimer notice must appear in all copies of
     30 * this code.
     31 **********************************************************************/
     32 
     33 /* Peripheral group ----------------------------------------------------------- */
     34 /** @defgroup SYSTICK SYSTICK (System Tick)
     35  * @ingroup LPC1700CMSIS_FwLib_Drivers
     36  * @{
     37  */
     38 
     39 #ifndef LPC17XX_SYSTICK_H_
     40 #define LPC17XX_SYSTICK_H_
     41 
     42 /* Includes ------------------------------------------------------------------- */
     43 #include "LPC17xx.h"
     44 #include "lpc_types.h"
     45 
     46 
     47 #ifdef __cplusplus
     48 extern "C"
     49 {
     50 #endif
     51 
     52 
     53 /* Private Macros ------------------------------------------------------------- */
     54 /** @defgroup SYSTICK_Private_Macros SYSTICK Private Macros
     55  * @{
     56  */
     57 /*********************************************************************//**
     58  * Macro defines for System Timer Control and status (STCTRL) register
     59  **********************************************************************/
     60 #define ST_CTRL_ENABLE		((uint32_t)(1<<0))
     61 #define ST_CTRL_TICKINT		((uint32_t)(1<<1))
     62 #define ST_CTRL_CLKSOURCE	((uint32_t)(1<<2))
     63 #define ST_CTRL_COUNTFLAG	((uint32_t)(1<<16))
     64 
     65 /*********************************************************************//**
     66  * Macro defines for System Timer Reload value (STRELOAD) register
     67  **********************************************************************/
     68 #define ST_RELOAD_RELOAD(n)		((uint32_t)(n & 0x00FFFFFF))
     69 
     70 /*********************************************************************//**
     71  * Macro defines for System Timer Current value (STCURRENT) register
     72  **********************************************************************/
     73 #define ST_RELOAD_CURRENT(n)	((uint32_t)(n & 0x00FFFFFF))
     74 
     75 /*********************************************************************//**
     76  * Macro defines for System Timer Calibration value (STCALIB) register
     77  **********************************************************************/
     78 #define ST_CALIB_TENMS(n)		((uint32_t)(n & 0x00FFFFFF))
     79 #define ST_CALIB_SKEW			((uint32_t)(1<<30))
     80 #define ST_CALIB_NOREF			((uint32_t)(1<<31))
     81 
     82 #define CLKSOURCE_EXT			((uint32_t)(0))
     83 #define CLKSOURCE_CPU			((uint32_t)(1))
     84 
     85 /**
     86  * @}
     87  */
     88 
     89 
     90 /* Public Functions ----------------------------------------------------------- */
     91 /** @defgroup SYSTICK_Public_Functions SYSTICK Public Functions
     92  * @{
     93  */
     94 
     95 void SYSTICK_InternalInit(uint32_t time);
     96 void SYSTICK_ExternalInit(uint32_t freq, uint32_t time);
     97 
     98 void SYSTICK_Cmd(FunctionalState NewState);
     99 void SYSTICK_IntCmd(FunctionalState NewState);
    100 uint32_t SYSTICK_GetCurrentValue(void);
    101 void SYSTICK_ClearCounterFlag(void);
    102 
    103 /**
    104  * @}
    105  */
    106 
    107 
    108 #ifdef __cplusplus
    109 }
    110 #endif
    111 
    112 
    113 #endif /* LPC17XX_SYSTICK_H_ */
    114 
    115 /**
    116  * @}
    117  */
    118 
    119 /* --------------------------------- End Of File ------------------------------ */