]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/CMSISv2p10_LPC18xx_DriverLib/inc/lpc18xx_sct.h
Slight modification to license blub text in header comments.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / CMSISv2p10_LPC18xx_DriverLib / inc / lpc18xx_sct.h
1 /**********************************************************************\r
2 * $Id$          lpc18xx_sct.h           2011-06-02\r
3 *//**\r
4 * @file         lpc18xx_sct.h\r
5 * @brief        Contains all macro definitions and function prototypes\r
6 *                       support for SCT firmware library on LPC18xx\r
7 * @version      1.0\r
8 * @date         02. June. 2011\r
9 * @author       NXP MCU SW Application Team\r
10 *\r
11 * Copyright(C) 2011, NXP Semiconductor\r
12 * All rights reserved.\r
13 *\r
14 ***********************************************************************\r
15 * Software that is described herein is for illustrative purposes only\r
16 * which provides customers with programming information regarding the\r
17 * products. This software is supplied "AS IS" without any warranties.\r
18 * NXP Semiconductors assumes no responsibility or liability for the\r
19 * use of the software, conveys no license or title under any patent,\r
20 * copyright, or mask work right to the product. NXP Semiconductors\r
21 * reserves the right to make changes in the software without\r
22 * notification. NXP Semiconductors also make no representation or\r
23 * warranty that such application will be suitable for the specified\r
24 * use without further testing or modification.\r
25 **********************************************************************/\r
26 \r
27 /* Peripheral group ----------------------------------------------------------- */\r
28 /** @defgroup SCT SCT (State Configurable Timer)\r
29  * @ingroup LPC1800CMSIS_FwLib_Drivers\r
30  * @{\r
31  */\r
32 \r
33 #ifndef LPC18XX_SCT_H_\r
34 #define LPC18XX_SCT_H_\r
35 \r
36 /* Includes ------------------------------------------------------------------- */\r
37 #include "LPC18xx.h"\r
38 #include "lpc_types.h"\r
39 \r
40 \r
41 #ifdef __cplusplus\r
42 extern "C"\r
43 {\r
44 #endif\r
45 \r
46 /* Private macros ------------------------------------------------------------- */\r
47 /** @defgroup SCT_Private_Macros SCT Private Macros\r
48  * @{\r
49  */\r
50 \r
51 /* -------------------------- BIT DEFINITIONS ----------------------------------- */\r
52 /*********************************************************************//**\r
53  * Macro defines for SCT  configuration register\r
54  **********************************************************************/\r
55 /**  Selects 16/32 bit counter */\r
56 #define SCT_CONFIG_16BIT_COUNTER                0x00000000\r
57 #define SCT_CONFIG_32BIT_COUNTER                0x00000001\r
58 \r
59 /*********************************************************************//**\r
60  * Macro defines for SCT control register\r
61  **********************************************************************/\r
62 /**  Stop low counter */\r
63 #define SCT_CTRL_STOP_L                                 (1<<1)\r
64 /**  Halt low counter */\r
65 #define SCT_CTRL_HALT_L                                 (1<<2)\r
66 /**  Clear low or unified counter */\r
67 #define SCT_CTRL_CLRCTR_L                               (1<<3)\r
68 /**  Direction for low or unified counter */\r
69 #define COUNTUP_TO_LIMIT_THEN_CLEAR_TO_ZERO             0\r
70 #define COUNTUP_TO LIMIT_THEN_COUNTDOWN_TO_ZERO 1\r
71 #define SCT_CTRL_BIDIR_L(x)                             (((x)&0x01)<<4)\r
72 /**  Prescale clock for low or unified counter */\r
73 #define SCT_CTRL_PRE_L(x)                               (((x)&0xFF)<<5)\r
74 \r
75 /**  Stop high counter */\r
76 #define SCT_CTRL_STOP_H                                 (1<<17)\r
77 /**  Halt high counter */\r
78 #define SCT_CTRL_HALT_H                                 (1<<18)\r
79 /**  Clear high counter */\r
80 #define SCT_CTRL_CLRCTR_H                               (1<<19)\r
81 /**  Direction for high counter */\r
82 #define COUNTUP_TO_LIMIT_THEN_CLEAR_TO_ZERO             0\r
83 #define COUNTUP_TO LIMIT_THEN_COUNTDOWN_TO_ZERO 1\r
84 #define SCT_CTRL_BIDIR_H(x)                             (((x)&0x01)<<20)\r
85 /**  Prescale clock for high counter */\r
86 #define SCT_CTRL_PRE_H(x)                               (((x)&0xFF)<<21)\r
87 /*********************************************************************//**\r
88  * Macro defines for SCT Conflict resolution register\r
89 **********************************************************************/\r
90 /**  Define conflict solution */\r
91 #define SCT_RES_NOCHANGE                                (0)\r
92 #define SCT_RES_SET_OUTPUT                              (1)\r
93 #define SCT_RES_CLEAR_OUTPUT                    (2)\r
94 #define SCT_RES_TOGGLE_OUTPUT                   (3)\r
95 \r
96 /* ------------------- CHECK PARAM DEFINITIONS ------------------------- */\r
97 /** Check SCT output number */\r
98 #define PARAM_SCT_OUTPUT_NUM(n)    ((n)<= CONFIG_SCT_nOU )\r
99 \r
100 /** Check SCT counter type */\r
101 #define PARAM_SCT_CONFIG_COUNTER_TYPE(n)    ((n==SCT_CONFIG_16BIT_COUNTER)||(n==SCT_CONFIG_32BIT_COUNTER))\r
102 \r
103 /** Check SCT conflict solution */\r
104 #define PARAM_SCT_RES(n)    ((n==SCT_RES_NOCHANGE)||(n==SCT_RES_SET_OUTPUT)\\r
105                                                                 ||(n==SCT_RES_CLEAR_OUTPUT)||(n==SCT_RES_TOGGLE_OUTPUT))\r
106 \r
107 /** Check SCT event number */\r
108 #define PARAM_SCT_EVENT(n)      ((n) <= 15)\r
109 \r
110 /**\r
111  * @}\r
112  */\r
113 \r
114 \r
115 \r
116 /* Public Functions ----------------------------------------------------------- */\r
117 /** @defgroup SCT_Public_Functions SCT Public Functions\r
118  * @{\r
119  */\r
120 \r
121 void SCT_Config(uint32_t value);\r
122 void SCT_ControlSet(uint32_t value, FunctionalState ena);\r
123 void SCT_ConflictResolutionSet(uint8_t outnum, uint8_t value);\r
124 void SCT_EventFlagClear(uint8_t even_num);\r
125 \r
126 /**\r
127  * @}\r
128  */\r
129 \r
130 \r
131 #ifdef __cplusplus\r
132 }\r
133 #endif\r
134 \r
135 \r
136 #endif /* LPC18XX_SCT_H_ */\r
137 \r
138 /**\r
139  * @}\r
140  */\r
141 \r
142 /* --------------------------------- End Of File ------------------------------ */\r