xref: /btstack/port/stm32-wb55xx-nucleo-freertos/Inc/hw_conf.h (revision 0561b2d8d5dba972c7daa57d5e677f7a1327edfd)
1*0561b2d8STREFOU Felix /**
2*0561b2d8STREFOU Felix  ******************************************************************************
3*0561b2d8STREFOU Felix   * File Name          : hw_conf.h
4*0561b2d8STREFOU Felix   * Description        : Hardware configuration file for BLE
5*0561b2d8STREFOU Felix   *                      middleWare.
6*0561b2d8STREFOU Felix   ******************************************************************************
7*0561b2d8STREFOU Felix   * This notice applies to any and all portions of this file
8*0561b2d8STREFOU Felix   * that are not between comment pairs USER CODE BEGIN and
9*0561b2d8STREFOU Felix   * USER CODE END. Other portions of this file, whether
10*0561b2d8STREFOU Felix   * inserted by the user or by software development tools
11*0561b2d8STREFOU Felix   * are owned by their respective copyright owners.
12*0561b2d8STREFOU Felix   *
13*0561b2d8STREFOU Felix   * Copyright (c) 2018 STMicroelectronics International N.V.
14*0561b2d8STREFOU Felix   * All rights reserved.
15*0561b2d8STREFOU Felix   *
16*0561b2d8STREFOU Felix   * Redistribution and use in source and binary forms, with or without
17*0561b2d8STREFOU Felix   * modification, are permitted, provided that the following conditions are met:
18*0561b2d8STREFOU Felix   *
19*0561b2d8STREFOU Felix   * 1. Redistribution of source code must retain the above copyright notice,
20*0561b2d8STREFOU Felix   *    this list of conditions and the following disclaimer.
21*0561b2d8STREFOU Felix   * 2. Redistributions in binary form must reproduce the above copyright notice,
22*0561b2d8STREFOU Felix   *    this list of conditions and the following disclaimer in the documentation
23*0561b2d8STREFOU Felix   *    and/or other materials provided with the distribution.
24*0561b2d8STREFOU Felix   * 3. Neither the name of STMicroelectronics nor the names of other
25*0561b2d8STREFOU Felix   *    contributors to this software may be used to endorse or promote products
26*0561b2d8STREFOU Felix   *    derived from this software without specific written permission.
27*0561b2d8STREFOU Felix   * 4. This software, including modifications and/or derivative works of this
28*0561b2d8STREFOU Felix   *    software, must execute solely and exclusively on microcontroller or
29*0561b2d8STREFOU Felix   *    microprocessor devices manufactured by or for STMicroelectronics.
30*0561b2d8STREFOU Felix   * 5. Redistribution and use of this software other than as permitted under
31*0561b2d8STREFOU Felix   *    this license is void and will automatically terminate your rights under
32*0561b2d8STREFOU Felix   *    this license.
33*0561b2d8STREFOU Felix   *
34*0561b2d8STREFOU Felix   * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
35*0561b2d8STREFOU Felix   * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
36*0561b2d8STREFOU Felix   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
37*0561b2d8STREFOU Felix   * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
38*0561b2d8STREFOU Felix   * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
39*0561b2d8STREFOU Felix   * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40*0561b2d8STREFOU Felix   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41*0561b2d8STREFOU Felix   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
42*0561b2d8STREFOU Felix   * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
43*0561b2d8STREFOU Felix   * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
44*0561b2d8STREFOU Felix   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
45*0561b2d8STREFOU Felix   * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46*0561b2d8STREFOU Felix   *
47*0561b2d8STREFOU Felix   ******************************************************************************
48*0561b2d8STREFOU Felix   */
49*0561b2d8STREFOU Felix 
50*0561b2d8STREFOU Felix /* Define to prevent recursive inclusion -------------------------------------*/
51*0561b2d8STREFOU Felix #ifndef __HW_CONF_H
52*0561b2d8STREFOU Felix #define __HW_CONF_H
53*0561b2d8STREFOU Felix 
54*0561b2d8STREFOU Felix /******************************************************************************
55*0561b2d8STREFOU Felix  * Semaphores
56*0561b2d8STREFOU Felix  * THIS SHALL NO BE CHANGED AS THESE SEMAPHORES ARE USED AS WELL ON THE CM0+
57*0561b2d8STREFOU Felix  *****************************************************************************/
58*0561b2d8STREFOU Felix /* Index of the semaphore used to manage the entry Stop Mode procedure */
59*0561b2d8STREFOU Felix #define CFG_HW_ENTRY_STOP_MODE_SEMID                            4
60*0561b2d8STREFOU Felix 
61*0561b2d8STREFOU Felix /* Index of the semaphore used to access the RCC */
62*0561b2d8STREFOU Felix #define CFG_HW_RCC_SEMID                                        3
63*0561b2d8STREFOU Felix 
64*0561b2d8STREFOU Felix /* Index of the semaphore used to access the FLASH */
65*0561b2d8STREFOU Felix #define CFG_HW_FLASH_SEMID                                      2
66*0561b2d8STREFOU Felix 
67*0561b2d8STREFOU Felix /* Index of the semaphore used to access the PKA */
68*0561b2d8STREFOU Felix #define CFG_HW_PKA_SEMID                                        1
69*0561b2d8STREFOU Felix 
70*0561b2d8STREFOU Felix /* Index of the semaphore used to access the RNG */
71*0561b2d8STREFOU Felix #define CFG_HW_RNG_SEMID                                        0
72*0561b2d8STREFOU Felix 
73*0561b2d8STREFOU Felix /******************************************************************************
74*0561b2d8STREFOU Felix  * HW TIMER SERVER
75*0561b2d8STREFOU Felix  *****************************************************************************/
76*0561b2d8STREFOU Felix /**
77*0561b2d8STREFOU Felix  * The user may define the maximum number of virtual timers supported.
78*0561b2d8STREFOU Felix  * It shall not exceed 255
79*0561b2d8STREFOU Felix  */
80*0561b2d8STREFOU Felix #define CFG_HW_TS_MAX_NBR_CONCURRENT_TIMER  6
81*0561b2d8STREFOU Felix 
82*0561b2d8STREFOU Felix /**
83*0561b2d8STREFOU Felix  * The user may define the priority in the NVIC of the RTC_WKUP interrupt handler that is used to manage the
84*0561b2d8STREFOU Felix  * wakeup timer.
85*0561b2d8STREFOU Felix  * This setting is the preemptpriority part of the NVIC.
86*0561b2d8STREFOU Felix  */
87*0561b2d8STREFOU Felix #define CFG_HW_TS_NVIC_RTC_WAKEUP_IT_PREEMPTPRIO  3
88*0561b2d8STREFOU Felix 
89*0561b2d8STREFOU Felix /**
90*0561b2d8STREFOU Felix  * The user may define the priority in the NVIC of the RTC_WKUP interrupt handler that is used to manage the
91*0561b2d8STREFOU Felix  * wakeup timer.
92*0561b2d8STREFOU Felix  * This setting is the subpriority part of the NVIC. It does not exist on all processors. When it is not supported
93*0561b2d8STREFOU Felix  * on the CPU, the setting is ignored
94*0561b2d8STREFOU Felix  */
95*0561b2d8STREFOU Felix #define CFG_HW_TS_NVIC_RTC_WAKEUP_IT_SUBPRIO  0
96*0561b2d8STREFOU Felix 
97*0561b2d8STREFOU Felix /**
98*0561b2d8STREFOU Felix  *  Define a critical section in the Timer server
99*0561b2d8STREFOU Felix  *  The Timer server does not support the API to be nested
100*0561b2d8STREFOU Felix  *  The  Application shall either:
101*0561b2d8STREFOU Felix  *    a) Ensure this will never happen
102*0561b2d8STREFOU Felix  *    b) Define the critical section
103*0561b2d8STREFOU Felix  *  The default implementations is masking all interrupts using the PRIMASK bit
104*0561b2d8STREFOU Felix  *  The TimerServer driver uses critical sections to avoid context corruption. This is achieved with the macro
105*0561b2d8STREFOU Felix  *  TIMER_ENTER_CRITICAL_SECTION and TIMER_EXIT_CRITICAL_SECTION. When CFG_HW_TS_USE_PRIMASK_AS_CRITICAL_SECTION is set
106*0561b2d8STREFOU Felix  *  to 1, all STM32 interrupts are masked with the PRIMASK bit of the CortexM CPU. It is possible to use the BASEPRI
107*0561b2d8STREFOU Felix  *  register of the CortexM CPU to keep allowed some interrupts with high priority. In that case, the user shall
108*0561b2d8STREFOU Felix  *  re-implement TIMER_ENTER_CRITICAL_SECTION and TIMER_EXIT_CRITICAL_SECTION and shall make sure that no TimerServer
109*0561b2d8STREFOU Felix  *  API are called when the TIMER critical section is entered
110*0561b2d8STREFOU Felix  */
111*0561b2d8STREFOU Felix #define CFG_HW_TS_USE_PRIMASK_AS_CRITICAL_SECTION  1
112*0561b2d8STREFOU Felix 
113*0561b2d8STREFOU Felix /**
114*0561b2d8STREFOU Felix    * This value shall reflect the maximum delay there could be in the application between the time the RTC interrupt
115*0561b2d8STREFOU Felix    * is generated by the Hardware and the time when the  RTC interrupt handler is called. This time is measured in
116*0561b2d8STREFOU Felix    * number of RTCCLK ticks.
117*0561b2d8STREFOU Felix    * A relaxed timing would be 10ms
118*0561b2d8STREFOU Felix    * When the value is too short, the timerserver will not be able to count properly and all timeout may be random.
119*0561b2d8STREFOU Felix    * When the value is too long, the device may wake up more often than the most optimal configuration. However, the
120*0561b2d8STREFOU Felix    * impact on power consumption would be marginal (unless the value selected is extremely too long). It is strongly
121*0561b2d8STREFOU Felix    * recommended to select a value large enough to make sure it is not too short to ensure reliability of the system
122*0561b2d8STREFOU Felix    * as this will have marginal impact on low power mode
123*0561b2d8STREFOU Felix    */
124*0561b2d8STREFOU Felix #define CFG_HW_TS_RTC_HANDLER_MAX_DELAY  ( 10 * (LSI_VALUE/1000) )
125*0561b2d8STREFOU Felix 
126*0561b2d8STREFOU Felix   /**
127*0561b2d8STREFOU Felix    * Interrupt ID in the NVIC of the RTC Wakeup interrupt handler
128*0561b2d8STREFOU Felix    * It shall be type of IRQn_Type
129*0561b2d8STREFOU Felix    */
130*0561b2d8STREFOU Felix #define CFG_HW_TS_RTC_WAKEUP_HANDLER_ID  RTC_WKUP_IRQn
131*0561b2d8STREFOU Felix 
132*0561b2d8STREFOU Felix /******************************************************************************
133*0561b2d8STREFOU Felix  * HW UART
134*0561b2d8STREFOU Felix  *****************************************************************************/
135*0561b2d8STREFOU Felix 
136*0561b2d8STREFOU Felix #define CFG_HW_LPUART1_ENABLED           0
137*0561b2d8STREFOU Felix #define CFG_HW_LPUART1_DMA_TX_SUPPORTED  0
138*0561b2d8STREFOU Felix 
139*0561b2d8STREFOU Felix #define CFG_HW_USART1_ENABLED           0
140*0561b2d8STREFOU Felix #define CFG_HW_USART1_DMA_TX_SUPPORTED  0
141*0561b2d8STREFOU Felix 
142*0561b2d8STREFOU Felix #endif /*__HW_CONF_H */
143*0561b2d8STREFOU Felix 
144*0561b2d8STREFOU Felix /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
145