|
1 |
| -/** |
2 |
| - ****************************************************************************** |
3 |
| - * @file uart.c |
4 |
| - * @author WI6LABS, fpistm |
5 |
| - * @brief provide the UART interface |
6 |
| - * |
7 |
| - ****************************************************************************** |
8 |
| - * @attention |
9 |
| - * |
10 |
| - * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
11 |
| - * |
12 |
| - * Redistribution and use in source and binary forms, with or without modification, |
13 |
| - * are permitted provided that the following conditions are met: |
14 |
| - * 1. Redistributions of source code must retain the above copyright notice, |
15 |
| - * this list of conditions and the following disclaimer. |
16 |
| - * 2. Redistributions in binary form must reproduce the above copyright notice, |
17 |
| - * this list of conditions and the following disclaimer in the documentation |
18 |
| - * and/or other materials provided with the distribution. |
19 |
| - * 3. Neither the name of STMicroelectronics nor the names of its contributors |
20 |
| - * may be used to endorse or promote products derived from this software |
21 |
| - * without specific prior written permission. |
22 |
| - * |
23 |
| - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
24 |
| - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
25 |
| - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
26 |
| - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
27 |
| - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
28 |
| - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
29 |
| - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
30 |
| - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
31 |
| - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
32 |
| - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 |
| - * |
34 |
| - ****************************************************************************** |
35 |
| - */ |
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2016-2021, STMicroelectronics |
| 4 | + * All rights reserved. |
| 5 | + * |
| 6 | + * This software component is licensed by ST under BSD 3-Clause license, |
| 7 | + * the "License"; You may not use this file except in compliance with the |
| 8 | + * License. You may obtain a copy of the License at: |
| 9 | + * opensource.org/licenses/BSD-3-Clause |
| 10 | + * |
| 11 | + ******************************************************************************* |
| 12 | + */ |
36 | 13 | #include "core_debug.h"
|
| 14 | +#include "lock_resource.h" |
37 | 15 | #include "uart.h"
|
38 | 16 | #include "Arduino.h"
|
39 | 17 | #include "PinAF_STM32F1.h"
|
@@ -528,6 +506,7 @@ void uart_config_lowpower(serial_t *obj)
|
528 | 506 | /* Ensure HSI clock is enable */
|
529 | 507 | enableClock(HSI_CLOCK);
|
530 | 508 |
|
| 509 | + hsem_lock(CFG_HW_RCC_CRRCR_CCIPR_SEMID, HSEM_LOCK_DEFAULT_RETRY); |
531 | 510 | /* Configure HSI as source clock for low power wakeup clock */
|
532 | 511 | switch (obj->index) {
|
533 | 512 | #if defined(USART1_BASE)
|
@@ -573,6 +552,7 @@ void uart_config_lowpower(serial_t *obj)
|
573 | 552 | break;
|
574 | 553 | #endif
|
575 | 554 | }
|
| 555 | + hsem_unlock(CFG_HW_RCC_CRRCR_CCIPR_SEMID); |
576 | 556 | }
|
577 | 557 | #endif
|
578 | 558 |
|
|
0 commit comments