stm32l4xx_hal_exti.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_hal_exti.c
  4. * @author MCD Application Team
  5. * @brief EXTI HAL module driver.
  6. * This file provides firmware functions to manage the following
  7. * functionalities of the Extended Interrupts and events controller (EXTI) peripheral:
  8. * + Initialization and de-initialization functions
  9. * + IO operation functions
  10. *
  11. @verbatim
  12. ==============================================================================
  13. ##### EXTI Peripheral features #####
  14. ==============================================================================
  15. [..]
  16. (+) Each Exti line can be configured within this driver.
  17. (+) Exti line can be configured in 3 different modes
  18. (++) Interrupt
  19. (++) Event
  20. (++) Both of them
  21. (+) Configurable Exti lines can be configured with 3 different triggers
  22. (++) Rising
  23. (++) Falling
  24. (++) Both of them
  25. (+) When set in interrupt mode, configurable Exti lines have two different
  26. interrupts pending registers which allow to distinguish which transition
  27. occurs:
  28. (++) Rising edge pending interrupt
  29. (++) Falling
  30. (+) Exti lines 0 to 15 are linked to gpio pin number 0 to 15. Gpio port can
  31. be selected through multiplexer.
  32. ##### How to use this driver #####
  33. ==============================================================================
  34. [..]
  35. (#) Configure the EXTI line using HAL_EXTI_SetConfigLine().
  36. (++) Choose the interrupt line number by setting "Line" member from
  37. EXTI_ConfigTypeDef structure.
  38. (++) Configure the interrupt and/or event mode using "Mode" member from
  39. EXTI_ConfigTypeDef structure.
  40. (++) For configurable lines, configure rising and/or falling trigger
  41. "Trigger" member from EXTI_ConfigTypeDef structure.
  42. (++) For Exti lines linked to gpio, choose gpio port using "GPIOSel"
  43. member from GPIO_InitTypeDef structure.
  44. (#) Get current Exti configuration of a dedicated line using
  45. HAL_EXTI_GetConfigLine().
  46. (++) Provide exiting handle as parameter.
  47. (++) Provide pointer on EXTI_ConfigTypeDef structure as second parameter.
  48. (#) Clear Exti configuration of a dedicated line using HAL_EXTI_GetConfigLine().
  49. (++) Provide exiting handle as parameter.
  50. (#) Register callback to treat Exti interrupts using HAL_EXTI_RegisterCallback().
  51. (++) Provide exiting handle as first parameter.
  52. (++) Provide which callback will be registered using one value from
  53. EXTI_CallbackIDTypeDef.
  54. (++) Provide callback function pointer.
  55. (#) Get interrupt pending bit using HAL_EXTI_GetPending().
  56. (#) Clear interrupt pending bit using HAL_EXTI_GetPending().
  57. (#) Generate software interrupt using HAL_EXTI_GenerateSWI().
  58. @endverbatim
  59. ******************************************************************************
  60. * @attention
  61. *
  62. * <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
  63. * All rights reserved.</center></h2>
  64. *
  65. * This software component is licensed by ST under BSD 3-Clause license,
  66. * the "License"; You may not use this file except in compliance with the
  67. * License. You may obtain a copy of the License at:
  68. * opensource.org/licenses/BSD-3-Clause
  69. *
  70. ******************************************************************************
  71. */
  72. /* Includes ------------------------------------------------------------------*/
  73. #include "stm32l4xx_hal.h"
  74. /** @addtogroup STM32L4xx_HAL_Driver
  75. * @{
  76. */
  77. /** @addtogroup EXTI
  78. * @{
  79. */
  80. /** MISRA C:2012 deviation rule has been granted for following rule:
  81. * Rule-18.1_b - Medium: Array `EXTICR' 1st subscript interval [0,7] may be out
  82. * of bounds [0,3] in following API :
  83. * HAL_EXTI_SetConfigLine
  84. * HAL_EXTI_GetConfigLine
  85. * HAL_EXTI_ClearConfigLine
  86. */
  87. #ifdef HAL_EXTI_MODULE_ENABLED
  88. /* Private typedef -----------------------------------------------------------*/
  89. /* Private defines ------------------------------------------------------------*/
  90. /** @defgroup EXTI_Private_Constants EXTI Private Constants
  91. * @{
  92. */
  93. #define EXTI_MODE_OFFSET 0x08u /* 0x20: offset between MCU IMR/EMR registers */
  94. #define EXTI_CONFIG_OFFSET 0x08u /* 0x20: offset between MCU Rising/Falling configuration registers */
  95. /**
  96. * @}
  97. */
  98. /* Private macros ------------------------------------------------------------*/
  99. /* Private variables ---------------------------------------------------------*/
  100. /* Private function prototypes -----------------------------------------------*/
  101. /* Exported functions --------------------------------------------------------*/
  102. /** @addtogroup EXTI_Exported_Functions
  103. * @{
  104. */
  105. /** @addtogroup EXTI_Exported_Functions_Group1
  106. * @brief Configuration functions
  107. *
  108. @verbatim
  109. ===============================================================================
  110. ##### Configuration functions #####
  111. ===============================================================================
  112. @endverbatim
  113. * @{
  114. */
  115. /**
  116. * @brief Set configuration of a dedicated Exti line.
  117. * @param hexti Exti handle.
  118. * @param pExtiConfig Pointer on EXTI configuration to be set.
  119. * @retval HAL Status.
  120. */
  121. HAL_StatusTypeDef HAL_EXTI_SetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig)
  122. {
  123. __IO uint32_t *regaddr;
  124. uint32_t regval;
  125. uint32_t linepos;
  126. uint32_t maskline;
  127. uint32_t offset;
  128. /* Check null pointer */
  129. if ((hexti == NULL) || (pExtiConfig == NULL))
  130. {
  131. return HAL_ERROR;
  132. }
  133. /* Check parameters */
  134. assert_param(IS_EXTI_LINE(pExtiConfig->Line));
  135. assert_param(IS_EXTI_MODE(pExtiConfig->Mode));
  136. /* Assign line number to handle */
  137. hexti->Line = pExtiConfig->Line;
  138. /* Compute line register offset and line mask */
  139. offset = ((pExtiConfig->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  140. linepos = (pExtiConfig->Line & EXTI_PIN_MASK);
  141. maskline = (1uL << linepos);
  142. /* Configure triggers for configurable lines */
  143. if ((pExtiConfig->Line & EXTI_CONFIG) != 0x00u)
  144. {
  145. assert_param(IS_EXTI_TRIGGER(pExtiConfig->Trigger));
  146. /* Configure rising trigger */
  147. regaddr = (&EXTI->RTSR1 + (EXTI_CONFIG_OFFSET * offset));
  148. regval = *regaddr;
  149. /* Mask or set line */
  150. if ((pExtiConfig->Trigger & EXTI_TRIGGER_RISING) != 0x00u)
  151. {
  152. regval |= maskline;
  153. }
  154. else
  155. {
  156. regval &= ~maskline;
  157. }
  158. /* Store rising trigger mode */
  159. *regaddr = regval;
  160. /* Configure falling trigger */
  161. regaddr = (&EXTI->FTSR1 + (EXTI_CONFIG_OFFSET * offset));
  162. regval = *regaddr;
  163. /* Mask or set line */
  164. if ((pExtiConfig->Trigger & EXTI_TRIGGER_FALLING) != 0x00u)
  165. {
  166. regval |= maskline;
  167. }
  168. else
  169. {
  170. regval &= ~maskline;
  171. }
  172. /* Store falling trigger mode */
  173. *regaddr = regval;
  174. /* Configure gpio port selection in case of gpio exti line */
  175. if ((pExtiConfig->Line & EXTI_GPIO) == EXTI_GPIO)
  176. {
  177. assert_param(IS_EXTI_GPIO_PORT(pExtiConfig->GPIOSel));
  178. assert_param(IS_EXTI_GPIO_PIN(linepos));
  179. regval = SYSCFG->EXTICR[linepos >> 2u];
  180. regval &= ~(SYSCFG_EXTICR1_EXTI0 << (SYSCFG_EXTICR1_EXTI1_Pos * (linepos & 0x03u)));
  181. regval |= (pExtiConfig->GPIOSel << (SYSCFG_EXTICR1_EXTI1_Pos * (linepos & 0x03u)));
  182. SYSCFG->EXTICR[linepos >> 2u] = regval;
  183. }
  184. }
  185. /* Configure interrupt mode : read current mode */
  186. regaddr = (&EXTI->IMR1 + (EXTI_MODE_OFFSET * offset));
  187. regval = *regaddr;
  188. /* Mask or set line */
  189. if ((pExtiConfig->Mode & EXTI_MODE_INTERRUPT) != 0x00u)
  190. {
  191. regval |= maskline;
  192. }
  193. else
  194. {
  195. regval &= ~maskline;
  196. }
  197. /* Store interrupt mode */
  198. *regaddr = regval;
  199. /* The event mode cannot be configured if the line does not support it */
  200. assert_param(((pExtiConfig->Line & EXTI_EVENT) == EXTI_EVENT) || ((pExtiConfig->Mode & EXTI_MODE_EVENT) != EXTI_MODE_EVENT));
  201. /* Configure event mode : read current mode */
  202. regaddr = (&EXTI->EMR1 + (EXTI_MODE_OFFSET * offset));
  203. regval = *regaddr;
  204. /* Mask or set line */
  205. if ((pExtiConfig->Mode & EXTI_MODE_EVENT) != 0x00u)
  206. {
  207. regval |= maskline;
  208. }
  209. else
  210. {
  211. regval &= ~maskline;
  212. }
  213. /* Store event mode */
  214. *regaddr = regval;
  215. return HAL_OK;
  216. }
  217. /**
  218. * @brief Get configuration of a dedicated Exti line.
  219. * @param hexti Exti handle.
  220. * @param pExtiConfig Pointer on structure to store Exti configuration.
  221. * @retval HAL Status.
  222. */
  223. HAL_StatusTypeDef HAL_EXTI_GetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig)
  224. {
  225. __IO uint32_t *regaddr;
  226. uint32_t regval;
  227. uint32_t linepos;
  228. uint32_t maskline;
  229. uint32_t offset;
  230. /* Check null pointer */
  231. if ((hexti == NULL) || (pExtiConfig == NULL))
  232. {
  233. return HAL_ERROR;
  234. }
  235. /* Check the parameter */
  236. assert_param(IS_EXTI_LINE(hexti->Line));
  237. /* Store handle line number to configuration structure */
  238. pExtiConfig->Line = hexti->Line;
  239. /* Compute line register offset and line mask */
  240. offset = ((pExtiConfig->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  241. linepos = (pExtiConfig->Line & EXTI_PIN_MASK);
  242. maskline = (1uL << linepos);
  243. /* 1] Get core mode : interrupt */
  244. regaddr = (&EXTI->IMR1 + (EXTI_MODE_OFFSET * offset));
  245. regval = *regaddr;
  246. /* Check if selected line is enable */
  247. if ((regval & maskline) != 0x00u)
  248. {
  249. pExtiConfig->Mode = EXTI_MODE_INTERRUPT;
  250. }
  251. else
  252. {
  253. pExtiConfig->Mode = EXTI_MODE_NONE;
  254. }
  255. /* Get event mode */
  256. regaddr = (&EXTI->EMR1 + (EXTI_MODE_OFFSET * offset));
  257. regval = *regaddr;
  258. /* Check if selected line is enable */
  259. if ((regval & maskline) != 0x00u)
  260. {
  261. pExtiConfig->Mode |= EXTI_MODE_EVENT;
  262. }
  263. /* 2] Get trigger for configurable lines : rising */
  264. if ((pExtiConfig->Line & EXTI_CONFIG) != 0x00u)
  265. {
  266. regaddr = (&EXTI->RTSR1 + (EXTI_CONFIG_OFFSET * offset));
  267. regval = *regaddr;
  268. /* Check if configuration of selected line is enable */
  269. if ((regval & maskline) != 0x00u)
  270. {
  271. pExtiConfig->Trigger = EXTI_TRIGGER_RISING;
  272. }
  273. else
  274. {
  275. pExtiConfig->Trigger = EXTI_TRIGGER_NONE;
  276. }
  277. /* Get falling configuration */
  278. regaddr = (&EXTI->FTSR1 + (EXTI_CONFIG_OFFSET * offset));
  279. regval = *regaddr;
  280. /* Check if configuration of selected line is enable */
  281. if ((regval & maskline) != 0x00u)
  282. {
  283. pExtiConfig->Trigger |= EXTI_TRIGGER_FALLING;
  284. }
  285. /* Get Gpio port selection for gpio lines */
  286. if ((pExtiConfig->Line & EXTI_GPIO) == EXTI_GPIO)
  287. {
  288. assert_param(IS_EXTI_GPIO_PIN(linepos));
  289. regval = SYSCFG->EXTICR[linepos >> 2u];
  290. pExtiConfig->GPIOSel = ((regval << (SYSCFG_EXTICR1_EXTI1_Pos * (3uL - (linepos & 0x03u)))) >> 24);
  291. }
  292. else
  293. {
  294. pExtiConfig->GPIOSel = 0x00u;
  295. }
  296. }
  297. else
  298. {
  299. pExtiConfig->Trigger = EXTI_TRIGGER_NONE;
  300. pExtiConfig->GPIOSel = 0x00u;
  301. }
  302. return HAL_OK;
  303. }
  304. /**
  305. * @brief Clear whole configuration of a dedicated Exti line.
  306. * @param hexti Exti handle.
  307. * @retval HAL Status.
  308. */
  309. HAL_StatusTypeDef HAL_EXTI_ClearConfigLine(EXTI_HandleTypeDef *hexti)
  310. {
  311. __IO uint32_t *regaddr;
  312. uint32_t regval;
  313. uint32_t linepos;
  314. uint32_t maskline;
  315. uint32_t offset;
  316. /* Check null pointer */
  317. if (hexti == NULL)
  318. {
  319. return HAL_ERROR;
  320. }
  321. /* Check the parameter */
  322. assert_param(IS_EXTI_LINE(hexti->Line));
  323. /* compute line register offset and line mask */
  324. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  325. linepos = (hexti->Line & EXTI_PIN_MASK);
  326. maskline = (1uL << linepos);
  327. /* 1] Clear interrupt mode */
  328. regaddr = (&EXTI->IMR1 + (EXTI_MODE_OFFSET * offset));
  329. regval = (*regaddr & ~maskline);
  330. *regaddr = regval;
  331. /* 2] Clear event mode */
  332. regaddr = (&EXTI->EMR1 + (EXTI_MODE_OFFSET * offset));
  333. regval = (*regaddr & ~maskline);
  334. *regaddr = regval;
  335. /* 3] Clear triggers in case of configurable lines */
  336. if ((hexti->Line & EXTI_CONFIG) != 0x00u)
  337. {
  338. regaddr = (&EXTI->RTSR1 + (EXTI_CONFIG_OFFSET * offset));
  339. regval = (*regaddr & ~maskline);
  340. *regaddr = regval;
  341. regaddr = (&EXTI->FTSR1 + (EXTI_CONFIG_OFFSET * offset));
  342. regval = (*regaddr & ~maskline);
  343. *regaddr = regval;
  344. /* Get Gpio port selection for gpio lines */
  345. if ((hexti->Line & EXTI_GPIO) == EXTI_GPIO)
  346. {
  347. assert_param(IS_EXTI_GPIO_PIN(linepos));
  348. regval = SYSCFG->EXTICR[linepos >> 2u];
  349. regval &= ~(SYSCFG_EXTICR1_EXTI0 << (SYSCFG_EXTICR1_EXTI1_Pos * (linepos & 0x03u)));
  350. SYSCFG->EXTICR[linepos >> 2u] = regval;
  351. }
  352. }
  353. return HAL_OK;
  354. }
  355. /**
  356. * @brief Register callback for a dedicated Exti line.
  357. * @param hexti Exti handle.
  358. * @param CallbackID User callback identifier.
  359. * This parameter can be one of @arg @ref EXTI_CallbackIDTypeDef values.
  360. * @param pPendingCbfn function pointer to be stored as callback.
  361. * @retval HAL Status.
  362. */
  363. HAL_StatusTypeDef HAL_EXTI_RegisterCallback(EXTI_HandleTypeDef *hexti, EXTI_CallbackIDTypeDef CallbackID, void (*pPendingCbfn)(void))
  364. {
  365. HAL_StatusTypeDef status = HAL_OK;
  366. switch (CallbackID)
  367. {
  368. case HAL_EXTI_COMMON_CB_ID:
  369. hexti->PendingCallback = pPendingCbfn;
  370. break;
  371. default:
  372. status = HAL_ERROR;
  373. break;
  374. }
  375. return status;
  376. }
  377. /**
  378. * @brief Store line number as handle private field.
  379. * @param hexti Exti handle.
  380. * @param ExtiLine Exti line number.
  381. * This parameter can be from 0 to @ref EXTI_LINE_NB.
  382. * @retval HAL Status.
  383. */
  384. HAL_StatusTypeDef HAL_EXTI_GetHandle(EXTI_HandleTypeDef *hexti, uint32_t ExtiLine)
  385. {
  386. /* Check the parameters */
  387. assert_param(IS_EXTI_LINE(ExtiLine));
  388. /* Check null pointer */
  389. if (hexti == NULL)
  390. {
  391. return HAL_ERROR;
  392. }
  393. else
  394. {
  395. /* Store line number as handle private field */
  396. hexti->Line = ExtiLine;
  397. return HAL_OK;
  398. }
  399. }
  400. /**
  401. * @}
  402. */
  403. /** @addtogroup EXTI_Exported_Functions_Group2
  404. * @brief EXTI IO functions.
  405. *
  406. @verbatim
  407. ===============================================================================
  408. ##### IO operation functions #####
  409. ===============================================================================
  410. @endverbatim
  411. * @{
  412. */
  413. /**
  414. * @brief Handle EXTI interrupt request.
  415. * @param hexti Exti handle.
  416. * @retval none.
  417. */
  418. void HAL_EXTI_IRQHandler(EXTI_HandleTypeDef *hexti)
  419. {
  420. __IO uint32_t *regaddr;
  421. uint32_t regval;
  422. uint32_t maskline;
  423. uint32_t offset;
  424. /* Compute line register offset and line mask */
  425. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  426. maskline = (1uL << (hexti->Line & EXTI_PIN_MASK));
  427. /* Get pending bit */
  428. regaddr = (&EXTI->PR1 + (EXTI_CONFIG_OFFSET * offset));
  429. regval = (*regaddr & maskline);
  430. if (regval != 0x00u)
  431. {
  432. /* Clear pending bit */
  433. *regaddr = maskline;
  434. /* Call callback */
  435. if (hexti->PendingCallback != NULL)
  436. {
  437. hexti->PendingCallback();
  438. }
  439. }
  440. }
  441. /**
  442. * @brief Get interrupt pending bit of a dedicated line.
  443. * @param hexti Exti handle.
  444. * @param Edge Specify which pending edge as to be checked.
  445. * This parameter can be one of the following values:
  446. * @arg @ref EXTI_TRIGGER_RISING_FALLING
  447. * This parameter is kept for compatibility with other series.
  448. * @retval 1 if interrupt is pending else 0.
  449. */
  450. uint32_t HAL_EXTI_GetPending(EXTI_HandleTypeDef *hexti, uint32_t Edge)
  451. {
  452. __IO uint32_t *regaddr;
  453. uint32_t regval;
  454. uint32_t linepos;
  455. uint32_t maskline;
  456. uint32_t offset;
  457. /* Check parameters */
  458. assert_param(IS_EXTI_LINE(hexti->Line));
  459. assert_param(IS_EXTI_CONFIG_LINE(hexti->Line));
  460. assert_param(IS_EXTI_PENDING_EDGE(Edge));
  461. /* Compute line register offset and line mask */
  462. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  463. linepos = (hexti->Line & EXTI_PIN_MASK);
  464. maskline = (1uL << linepos);
  465. /* Get pending bit */
  466. regaddr = (&EXTI->PR1 + (EXTI_CONFIG_OFFSET * offset));
  467. /* return 1 if bit is set else 0 */
  468. regval = ((*regaddr & maskline) >> linepos);
  469. return regval;
  470. }
  471. /**
  472. * @brief Clear interrupt pending bit of a dedicated line.
  473. * @param hexti Exti handle.
  474. * @param Edge Specify which pending edge as to be clear.
  475. * This parameter can be one of the following values:
  476. * @arg @ref EXTI_TRIGGER_RISING_FALLING
  477. * This parameter is kept for compatibility with other series.
  478. * @retval None.
  479. */
  480. void HAL_EXTI_ClearPending(EXTI_HandleTypeDef *hexti, uint32_t Edge)
  481. {
  482. __IO uint32_t *regaddr;
  483. uint32_t maskline;
  484. uint32_t offset;
  485. /* Check parameters */
  486. assert_param(IS_EXTI_LINE(hexti->Line));
  487. assert_param(IS_EXTI_CONFIG_LINE(hexti->Line));
  488. assert_param(IS_EXTI_PENDING_EDGE(Edge));
  489. /* compute line register offset and line mask */
  490. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  491. maskline = (1uL << (hexti->Line & EXTI_PIN_MASK));
  492. /* Get pending register address */
  493. regaddr = (&EXTI->PR1 + (EXTI_CONFIG_OFFSET * offset));
  494. /* Clear Pending bit */
  495. *regaddr = maskline;
  496. }
  497. /**
  498. * @brief Generate a software interrupt for a dedicated line.
  499. * @param hexti Exti handle.
  500. * @retval None.
  501. */
  502. void HAL_EXTI_GenerateSWI(EXTI_HandleTypeDef *hexti)
  503. {
  504. __IO uint32_t *regaddr;
  505. uint32_t maskline;
  506. uint32_t offset;
  507. /* Check parameters */
  508. assert_param(IS_EXTI_LINE(hexti->Line));
  509. assert_param(IS_EXTI_CONFIG_LINE(hexti->Line));
  510. /* compute line register offset and line mask */
  511. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  512. maskline = (1uL << (hexti->Line & EXTI_PIN_MASK));
  513. regaddr = (&EXTI->SWIER1 + (EXTI_CONFIG_OFFSET * offset));
  514. *regaddr = maskline;
  515. }
  516. /**
  517. * @}
  518. */
  519. /**
  520. * @}
  521. */
  522. #endif /* HAL_EXTI_MODULE_ENABLED */
  523. /**
  524. * @}
  525. */
  526. /**
  527. * @}
  528. */
  529. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/