NXP's driver library for LPC17xx, ported to mbed's online compiler. Not tested! I had to fix a lot of warings and found a couple of pretty obvious bugs, so the chances are there are more. Original: http://ics.nxp.com/support/documents/microcontrollers/zip/lpc17xx.cmsis.driver.library.zip
include/lpc17xx_rit.h@0:1063a091a062, 2010-02-17 (annotated)
- Committer:
- igorsk
- Date:
- Wed Feb 17 16:22:39 2010 +0000
- Revision:
- 0:1063a091a062
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igorsk | 0:1063a091a062 | 1 | /***********************************************************************//** |
igorsk | 0:1063a091a062 | 2 | * @file : lpc17xx_rit.h |
igorsk | 0:1063a091a062 | 3 | * @brief : Contains all macro definitions and function prototypes |
igorsk | 0:1063a091a062 | 4 | * support for RIT firmware library on LPC17xx |
igorsk | 0:1063a091a062 | 5 | * @version : 1.0 |
igorsk | 0:1063a091a062 | 6 | * @date : 07. May. 2009 |
igorsk | 0:1063a091a062 | 7 | * @author : NguyenCao |
igorsk | 0:1063a091a062 | 8 | ************************************************************************** |
igorsk | 0:1063a091a062 | 9 | * Software that is described herein is for illustrative purposes only |
igorsk | 0:1063a091a062 | 10 | * which provides customers with programming information regarding the |
igorsk | 0:1063a091a062 | 11 | * products. This software is supplied "AS IS" without any warranties. |
igorsk | 0:1063a091a062 | 12 | * NXP Semiconductors assumes no responsibility or liability for the |
igorsk | 0:1063a091a062 | 13 | * use of the software, conveys no license or title under any patent, |
igorsk | 0:1063a091a062 | 14 | * copyright, or mask work right to the product. NXP Semiconductors |
igorsk | 0:1063a091a062 | 15 | * reserves the right to make changes in the software without |
igorsk | 0:1063a091a062 | 16 | * notification. NXP Semiconductors also make no representation or |
igorsk | 0:1063a091a062 | 17 | * warranty that such application will be suitable for the specified |
igorsk | 0:1063a091a062 | 18 | * use without further testing or modification. |
igorsk | 0:1063a091a062 | 19 | **************************************************************************/ |
igorsk | 0:1063a091a062 | 20 | |
igorsk | 0:1063a091a062 | 21 | /* Peripheral group ----------------------------------------------------------- */ |
igorsk | 0:1063a091a062 | 22 | /** @defgroup RIT |
igorsk | 0:1063a091a062 | 23 | * @ingroup LPC1700CMSIS_FwLib_Drivers |
igorsk | 0:1063a091a062 | 24 | * @{ |
igorsk | 0:1063a091a062 | 25 | */ |
igorsk | 0:1063a091a062 | 26 | |
igorsk | 0:1063a091a062 | 27 | #ifndef LPC17XX_RIT_H_ |
igorsk | 0:1063a091a062 | 28 | #define LPC17XX_RIT_H_ |
igorsk | 0:1063a091a062 | 29 | |
igorsk | 0:1063a091a062 | 30 | /* Includes ------------------------------------------------------------------- */ |
igorsk | 0:1063a091a062 | 31 | #include "cmsis.h" |
igorsk | 0:1063a091a062 | 32 | #include "lpc_types.h" |
igorsk | 0:1063a091a062 | 33 | |
igorsk | 0:1063a091a062 | 34 | |
igorsk | 0:1063a091a062 | 35 | #ifdef __cplusplus |
igorsk | 0:1063a091a062 | 36 | extern "C" |
igorsk | 0:1063a091a062 | 37 | { |
igorsk | 0:1063a091a062 | 38 | #endif |
igorsk | 0:1063a091a062 | 39 | |
igorsk | 0:1063a091a062 | 40 | |
igorsk | 0:1063a091a062 | 41 | /* Private Macros ------------------------------------------------------------- */ |
igorsk | 0:1063a091a062 | 42 | /** @defgroup RIT_Private_Macros |
igorsk | 0:1063a091a062 | 43 | * @{ |
igorsk | 0:1063a091a062 | 44 | */ |
igorsk | 0:1063a091a062 | 45 | |
igorsk | 0:1063a091a062 | 46 | /** @defgroup RIT_REGISTER_BIT_DEFINITIONS |
igorsk | 0:1063a091a062 | 47 | * @{ |
igorsk | 0:1063a091a062 | 48 | */ |
igorsk | 0:1063a091a062 | 49 | |
igorsk | 0:1063a091a062 | 50 | /*********************************************************************//** |
igorsk | 0:1063a091a062 | 51 | * Macro defines for RIT control register |
igorsk | 0:1063a091a062 | 52 | **********************************************************************/ |
igorsk | 0:1063a091a062 | 53 | /** Set interrupt flag when the counter value equals the masked compare value */ |
igorsk | 0:1063a091a062 | 54 | #define RIT_CTRL_INTEN ((uint32_t) (1)) |
igorsk | 0:1063a091a062 | 55 | /** Set timer enable clear to 0 when the counter value equals the masked compare value */ |
igorsk | 0:1063a091a062 | 56 | #define RIT_CTRL_ENCLR ((uint32_t) _BIT(1)) |
igorsk | 0:1063a091a062 | 57 | /** Set timer enable on break */ |
igorsk | 0:1063a091a062 | 58 | #define RIT_CTRL_ENBR ((uint32_t) _BIT(2)) |
igorsk | 0:1063a091a062 | 59 | /** Set timer enable */ |
igorsk | 0:1063a091a062 | 60 | #define RIT_CTRL_TEN ((uint32_t) _BIT(3)) |
igorsk | 0:1063a091a062 | 61 | |
igorsk | 0:1063a091a062 | 62 | /** |
igorsk | 0:1063a091a062 | 63 | * @} |
igorsk | 0:1063a091a062 | 64 | */ |
igorsk | 0:1063a091a062 | 65 | |
igorsk | 0:1063a091a062 | 66 | /** |
igorsk | 0:1063a091a062 | 67 | * @} |
igorsk | 0:1063a091a062 | 68 | */ |
igorsk | 0:1063a091a062 | 69 | |
igorsk | 0:1063a091a062 | 70 | |
igorsk | 0:1063a091a062 | 71 | /* Public Types --------------------------------------------------------------- */ |
igorsk | 0:1063a091a062 | 72 | /** @defgroup RIT_Public_Types |
igorsk | 0:1063a091a062 | 73 | * @{ |
igorsk | 0:1063a091a062 | 74 | */ |
igorsk | 0:1063a091a062 | 75 | |
igorsk | 0:1063a091a062 | 76 | /** |
igorsk | 0:1063a091a062 | 77 | * @brief RIT compare configuration structure definition |
igorsk | 0:1063a091a062 | 78 | */ |
igorsk | 0:1063a091a062 | 79 | typedef struct |
igorsk | 0:1063a091a062 | 80 | { |
igorsk | 0:1063a091a062 | 81 | uint32_t CMPVAL; /** Compare Value */ |
igorsk | 0:1063a091a062 | 82 | uint32_t MASKVAL; /** Mask Value */ |
igorsk | 0:1063a091a062 | 83 | uint32_t COUNTVAL; /** Counter Value */ |
igorsk | 0:1063a091a062 | 84 | }RIT_CMP_VAL; |
igorsk | 0:1063a091a062 | 85 | |
igorsk | 0:1063a091a062 | 86 | /*************************** GLOBAL/PUBLIC MACROS ***************************/ |
igorsk | 0:1063a091a062 | 87 | /** Macro to determine if it is valid RIT peripheral */ |
igorsk | 0:1063a091a062 | 88 | #define PARAM_RITx(n) (((uint32_t *)n)==((uint32_t *)LPC_RIT)) |
igorsk | 0:1063a091a062 | 89 | |
igorsk | 0:1063a091a062 | 90 | /** |
igorsk | 0:1063a091a062 | 91 | * @} |
igorsk | 0:1063a091a062 | 92 | */ |
igorsk | 0:1063a091a062 | 93 | |
igorsk | 0:1063a091a062 | 94 | |
igorsk | 0:1063a091a062 | 95 | /* Public Functions ----------------------------------------------------------- */ |
igorsk | 0:1063a091a062 | 96 | /** @defgroup RIT_Public_Functions |
igorsk | 0:1063a091a062 | 97 | * @{ |
igorsk | 0:1063a091a062 | 98 | */ |
igorsk | 0:1063a091a062 | 99 | |
igorsk | 0:1063a091a062 | 100 | void RIT_Init(LPC_RIT_TypeDef *RITx); |
igorsk | 0:1063a091a062 | 101 | void RIT_DeInit(LPC_RIT_TypeDef *RITx); |
igorsk | 0:1063a091a062 | 102 | void RIT_TimerConfig(LPC_RIT_TypeDef *RITx, RIT_CMP_VAL *value); |
igorsk | 0:1063a091a062 | 103 | void RIT_Cmd(LPC_RIT_TypeDef *RITx, FunctionalState NewState); |
igorsk | 0:1063a091a062 | 104 | void RIT_TimerClearCmd(LPC_RIT_TypeDef *RITx, FunctionalState NewState); |
igorsk | 0:1063a091a062 | 105 | void RIT_TimerEnableOnBreakCmd(LPC_RIT_TypeDef *RITx, FunctionalState NewState); |
igorsk | 0:1063a091a062 | 106 | IntStatus RIT_GetIntStatus(LPC_RIT_TypeDef *RITx); |
igorsk | 0:1063a091a062 | 107 | |
igorsk | 0:1063a091a062 | 108 | /** |
igorsk | 0:1063a091a062 | 109 | * @} |
igorsk | 0:1063a091a062 | 110 | */ |
igorsk | 0:1063a091a062 | 111 | |
igorsk | 0:1063a091a062 | 112 | #ifdef __cplusplus |
igorsk | 0:1063a091a062 | 113 | } |
igorsk | 0:1063a091a062 | 114 | #endif |
igorsk | 0:1063a091a062 | 115 | |
igorsk | 0:1063a091a062 | 116 | #endif /* LPC17XX_RIT_H_ */ |
igorsk | 0:1063a091a062 | 117 | |
igorsk | 0:1063a091a062 | 118 | /** |
igorsk | 0:1063a091a062 | 119 | * @} |
igorsk | 0:1063a091a062 | 120 | */ |
igorsk | 0:1063a091a062 | 121 | |
igorsk | 0:1063a091a062 | 122 | /* --------------------------------- End Of File ------------------------------ */ |