]> mj.ucw.cz Git - home-hw.git/blob - usb/Src/stm32f1xx_hal_msp.c
Auto: Meditation mode turned off
[home-hw.git] / usb / Src / stm32f1xx_hal_msp.c
1 /**
2   ******************************************************************************
3   * File Name          : stm32f1xx_hal_msp.c
4   * Description        : This file provides code for the MSP Initialization 
5   *                      and de-Initialization codes.
6   ******************************************************************************
7   ** This notice applies to any and all portions of this file
8   * that are not between comment pairs USER CODE BEGIN and
9   * USER CODE END. Other portions of this file, whether 
10   * inserted by the user or by software development tools
11   * are owned by their respective copyright owners.
12   *
13   * COPYRIGHT(c) 2018 STMicroelectronics
14   *
15   * Redistribution and use in source and binary forms, with or without modification,
16   * are permitted provided that the following conditions are met:
17   *   1. Redistributions of source code must retain the above copyright notice,
18   *      this list of conditions and the following disclaimer.
19   *   2. Redistributions in binary form must reproduce the above copyright notice,
20   *      this list of conditions and the following disclaimer in the documentation
21   *      and/or other materials provided with the distribution.
22   *   3. Neither the name of STMicroelectronics nor the names of its contributors
23   *      may be used to endorse or promote products derived from this software
24   *      without specific prior written permission.
25   *
26   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36   *
37   ******************************************************************************
38   */
39 /* Includes ------------------------------------------------------------------*/
40 #include "stm32f1xx_hal.h"
41
42 extern void _Error_Handler(char *, int);
43 /* USER CODE BEGIN 0 */
44
45 /* USER CODE END 0 */
46 /**
47   * Initializes the Global MSP.
48   */
49 void HAL_MspInit(void)
50 {
51   /* USER CODE BEGIN MspInit 0 */
52
53   /* USER CODE END MspInit 0 */
54
55   __HAL_RCC_AFIO_CLK_ENABLE();
56
57   HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
58
59   /* System interrupt init*/
60   /* MemoryManagement_IRQn interrupt configuration */
61   HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0);
62   /* BusFault_IRQn interrupt configuration */
63   HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0);
64   /* UsageFault_IRQn interrupt configuration */
65   HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0);
66   /* SVCall_IRQn interrupt configuration */
67   HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0);
68   /* DebugMonitor_IRQn interrupt configuration */
69   HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0);
70   /* PendSV_IRQn interrupt configuration */
71   HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0);
72   /* SysTick_IRQn interrupt configuration */
73   HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
74
75     /**NOJTAG: JTAG-DP Disabled and SW-DP Enabled 
76     */
77   __HAL_AFIO_REMAP_SWJ_NOJTAG();
78
79   /* USER CODE BEGIN MspInit 1 */
80
81   /* USER CODE END MspInit 1 */
82 }
83
84 void HAL_PCD_MspInit(PCD_HandleTypeDef* hpcd)
85 {
86
87   if(hpcd->Instance==USB)
88   {
89   /* USER CODE BEGIN USB_MspInit 0 */
90
91   /* USER CODE END USB_MspInit 0 */
92     /* Peripheral clock enable */
93     __HAL_RCC_USB_CLK_ENABLE();
94     /* USB interrupt Init */
95     HAL_NVIC_SetPriority(USB_HP_CAN1_TX_IRQn, 15, 0);
96     HAL_NVIC_EnableIRQ(USB_HP_CAN1_TX_IRQn);
97     HAL_NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, 15, 0);
98     HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
99   /* USER CODE BEGIN USB_MspInit 1 */
100
101   /* USER CODE END USB_MspInit 1 */
102   }
103
104 }
105
106 void HAL_PCD_MspDeInit(PCD_HandleTypeDef* hpcd)
107 {
108
109   if(hpcd->Instance==USB)
110   {
111   /* USER CODE BEGIN USB_MspDeInit 0 */
112
113   /* USER CODE END USB_MspDeInit 0 */
114     /* Peripheral clock disable */
115     __HAL_RCC_USB_CLK_DISABLE();
116
117     /* USB interrupt DeInit */
118     HAL_NVIC_DisableIRQ(USB_HP_CAN1_TX_IRQn);
119     HAL_NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn);
120   /* USER CODE BEGIN USB_MspDeInit 1 */
121
122   /* USER CODE END USB_MspDeInit 1 */
123   }
124
125 }
126
127 /* USER CODE BEGIN 1 */
128
129 /* USER CODE END 1 */
130
131 /**
132   * @}
133   */
134
135 /**
136   * @}
137   */
138
139 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/