]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/CMSISv2p10_LPC18xx_DriverLib/src/lpc18xx_sct.c
Slight modification to license blub text in header comments.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / CMSISv2p10_LPC18xx_DriverLib / src / lpc18xx_sct.c
1 /**********************************************************************\r
2 * $Id$          lpc18xx_sct.c           2011-06-02\r
3 *//**\r
4 * @file         lpc18xx_sct.c\r
5 * @brief        Contains all functions support for SCT firmware library on LPC18xx\r
6 * @version      1.0\r
7 * @date         02. June. 2011\r
8 * @author       NXP MCU SW Application Team\r
9 *\r
10 * Copyright(C) 2011, NXP Semiconductor\r
11 * All rights reserved.\r
12 *\r
13 ***********************************************************************\r
14 * Software that is described herein is for illustrative purposes only\r
15 * which provides customers with programming information regarding the\r
16 * products. This software is supplied "AS IS" without any warranties.\r
17 * NXP Semiconductors assumes no responsibility or liability for the\r
18 * use of the software, conveys no license or title under any patent,\r
19 * copyright, or mask work right to the product. NXP Semiconductors\r
20 * reserves the right to make changes in the software without\r
21 * notification. NXP Semiconductors also make no representation or\r
22 * warranty that such application will be suitable for the specified\r
23 * use without further testing or modification.\r
24 **********************************************************************/\r
25 \r
26 /* Peripheral group ----------------------------------------------------------- */\r
27 /** @addtogroup SCT\r
28  * @{\r
29  */\r
30 \r
31 /* Includes ------------------------------------------------------------------- */\r
32 #include "lpc18xx_sct.h"\r
33 \r
34 /* If this source file built with example, the LPC18xx FW library configuration\r
35  * file in each example directory ("lpc18xx_libcfg.h") must be included,\r
36  * otherwise the default FW library configuration file must be included instead\r
37  */\r
38 #ifdef __BUILD_WITH_EXAMPLE__\r
39 #include "lpc18xx_libcfg.h"\r
40 #else\r
41 #include "lpc18xx_libcfg_default.h"\r
42 #endif /* __BUILD_WITH_EXAMPLE__ */\r
43 \r
44 \r
45 #ifdef _SCT\r
46 \r
47 /* Public Functions ----------------------------------------------------------- */\r
48 /** @addtogroup SCT_Public_Functions\r
49  * @{\r
50  */\r
51 \r
52 /*********************************************************************//**\r
53  * @brief               Select 16/32 bit SCT counter\r
54  * @param[in]   value   configuration value for SCT\r
55  *                                      - SCT_CONFIG_16BIT_COUNTER      :16-bit counter\r
56  *                                      - SCT_CONFIG_32BIT_COUNTER      :32-bit counter\r
57  * @return              None\r
58  **********************************************************************/\r
59 void SCT_Config(uint32_t value)\r
60 {\r
61         CHECK_PARAM(PARAM_SCT_CONFIG_COUNTER_TYPE(value));\r
62 \r
63         LPC_SCT->CONFIG = value;\r
64 }\r
65 \r
66 /*********************************************************************//**\r
67 * @brief                Setting SCT control\r
68 * @param[in]    value   setting value\r
69 * @param[in]    ena     Enable/disable status\r
70 *                                       - ENABLE\r
71 *                                       - DISABLE\r
72 * @return               None\r
73 **********************************************************************/\r
74 void SCT_ControlSet(uint32_t value, FunctionalState ena)\r
75 {\r
76         uint32_t tem;\r
77 \r
78         CHECK_PARAM(PARAM_FUNCTIONALSTATE(ena));\r
79 \r
80         tem = LPC_SCT->CTRL_U;\r
81 \r
82         if(ena == ENABLE)\r
83         {\r
84                 tem |= value;\r
85         }\r
86         else\r
87         {\r
88                 tem &= (~value);\r
89         }\r
90 \r
91         LPC_SCT->CTRL_U = tem;\r
92 \r
93 }\r
94 \r
95 /*********************************************************************//**\r
96 * @brief                Set start mode for ADC\r
97 * @param[in]    outnum  number of SCT output, should be: 0..15\r
98 * @param[in]    value   solution value, should be\r
99 *                                       - SCT_RES_NOCHANGE                      :No change\r
100 *                                       - SCT_RES_SET_OUTPUT            :Set output\r
101 *                                       - SCT_RES_CLEAR_OUTPUT          :Clear output\r
102 *                                       - SCT_RES_TOGGLE_OUTPUT         :Toggle output\r
103 * @return               None\r
104 *********************************************************************/\r
105 void SCT_ConflictResolutionSet(uint8_t outnum, uint8_t value)\r
106 {\r
107         uint32_t tem;\r
108 \r
109         CHECK_PARAM(PARAM_SCT_OUTPUT_NUM(outnum));\r
110         CHECK_PARAM(PARAM_SCT_RES(value));\r
111 \r
112         tem = LPC_SCT->RES;\r
113         tem &= ~(0x03 << (2*outnum));\r
114         tem |= (value << (2*outnum));\r
115         LPC_SCT->RES = tem;\r
116 }\r
117 \r
118 /*********************************************************************//**\r
119 * @brief                Clear SCT event generating interrupt request\r
120 * @param[in]    even_num        SCT event number, should be: 0..15\r
121 * @return               None\r
122 *********************************************************************/\r
123 void SCT_EventFlagClear(uint8_t even_num)\r
124 {\r
125         CHECK_PARAM(PARAM_SCT_EVENT(even_num));\r
126 \r
127         LPC_SCT->EVFLAG = (1 << (even_num));\r
128 }\r
129 /**\r
130  * @}\r
131  */\r
132 \r
133 #endif /* _SCT */\r
134 \r
135 /**\r
136  * @}\r
137  */\r
138 \r
139 /* --------------------------------- End Of File ------------------------------ */\r
140 \r