Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Code generated from Atmel Start. |
| 3 | * |
| 4 | * This file will be overwritten when reconfiguring your Atmel Start project. |
| 5 | * Please copy examples or other code you want to keep to a separate file |
| 6 | * to avoid losing it when reconfiguring. |
| 7 | */ |
| 8 | |
| 9 | #include "driver_init.h" |
| 10 | #include <peripheral_clk_config.h> |
| 11 | #include <utils.h> |
| 12 | #include <hal_init.h> |
| 13 | |
Kévin Redon | ccbed0b | 2019-01-24 18:30:26 +0100 | [diff] [blame] | 14 | /*! The buffer size for USART */ |
Kévin Redon | 1f8ecef | 2019-01-31 13:36:12 +0100 | [diff] [blame] | 15 | #define SIM0_BUFFER_SIZE 16 |
| 16 | |
| 17 | /*! The buffer size for USART */ |
| 18 | #define SIM1_BUFFER_SIZE 16 |
| 19 | |
| 20 | /*! The buffer size for USART */ |
| 21 | #define SIM2_BUFFER_SIZE 16 |
| 22 | |
| 23 | /*! The buffer size for USART */ |
| 24 | #define SIM3_BUFFER_SIZE 16 |
| 25 | |
| 26 | /*! The buffer size for USART */ |
| 27 | #define SIM4_BUFFER_SIZE 16 |
| 28 | |
| 29 | /*! The buffer size for USART */ |
| 30 | #define SIM5_BUFFER_SIZE 16 |
| 31 | |
| 32 | /*! The buffer size for USART */ |
| 33 | #define SIM6_BUFFER_SIZE 16 |
| 34 | |
Kévin Redon | 1f8ecef | 2019-01-31 13:36:12 +0100 | [diff] [blame] | 35 | struct usart_async_descriptor SIM0; |
| 36 | struct usart_async_descriptor SIM1; |
| 37 | struct usart_async_descriptor SIM2; |
| 38 | struct usart_async_descriptor SIM3; |
| 39 | struct usart_async_descriptor SIM4; |
| 40 | struct usart_async_descriptor SIM5; |
| 41 | struct usart_async_descriptor SIM6; |
Kévin Redon | ccbed0b | 2019-01-24 18:30:26 +0100 | [diff] [blame] | 42 | |
Kévin Redon | 1f8ecef | 2019-01-31 13:36:12 +0100 | [diff] [blame] | 43 | static uint8_t SIM0_buffer[SIM0_BUFFER_SIZE]; |
| 44 | static uint8_t SIM1_buffer[SIM1_BUFFER_SIZE]; |
| 45 | static uint8_t SIM2_buffer[SIM2_BUFFER_SIZE]; |
| 46 | static uint8_t SIM3_buffer[SIM3_BUFFER_SIZE]; |
| 47 | static uint8_t SIM4_buffer[SIM4_BUFFER_SIZE]; |
| 48 | static uint8_t SIM5_buffer[SIM5_BUFFER_SIZE]; |
| 49 | static uint8_t SIM6_buffer[SIM6_BUFFER_SIZE]; |
Harald Welte | 361ed20 | 2019-02-24 21:15:39 +0100 | [diff] [blame] | 50 | |
| 51 | struct usart_sync_descriptor UART_debug; |
Kévin Redon | ccbed0b | 2019-01-24 18:30:26 +0100 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * \brief USART Clock initialization function |
| 55 | * |
| 56 | * Enables register interface and peripheral clock |
| 57 | */ |
Kévin Redon | 1f8ecef | 2019-01-31 13:36:12 +0100 | [diff] [blame] | 58 | void SIM0_CLOCK_init() |
| 59 | { |
| 60 | |
| 61 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM0_GCLK_ID_CORE, CONF_GCLK_SERCOM0_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 62 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM0_GCLK_ID_SLOW, CONF_GCLK_SERCOM0_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 63 | |
| 64 | hri_mclk_set_APBAMASK_SERCOM0_bit(MCLK); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * \brief USART pinmux initialization function |
| 69 | * |
| 70 | * Set each required pin to USART functionality |
| 71 | */ |
| 72 | void SIM0_PORT_init() |
| 73 | { |
| 74 | |
| 75 | gpio_set_pin_function(SIM0_IO, PINMUX_PA04D_SERCOM0_PAD0); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * \brief USART initialization function |
| 80 | * |
| 81 | * Enables USART peripheral, clocks and initializes USART driver |
| 82 | */ |
| 83 | void SIM0_init(void) |
| 84 | { |
| 85 | SIM0_CLOCK_init(); |
| 86 | usart_async_init(&SIM0, SERCOM0, SIM0_buffer, SIM0_BUFFER_SIZE, (void *)NULL); |
| 87 | SIM0_PORT_init(); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * \brief USART Clock initialization function |
| 92 | * |
| 93 | * Enables register interface and peripheral clock |
| 94 | */ |
| 95 | void SIM1_CLOCK_init() |
| 96 | { |
| 97 | |
| 98 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM1_GCLK_ID_CORE, CONF_GCLK_SERCOM1_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 99 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM1_GCLK_ID_SLOW, CONF_GCLK_SERCOM1_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 100 | |
| 101 | hri_mclk_set_APBAMASK_SERCOM1_bit(MCLK); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * \brief USART pinmux initialization function |
| 106 | * |
| 107 | * Set each required pin to USART functionality |
| 108 | */ |
| 109 | void SIM1_PORT_init() |
| 110 | { |
| 111 | |
| 112 | gpio_set_pin_function(SIM1_IO, PINMUX_PA16C_SERCOM1_PAD0); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * \brief USART initialization function |
| 117 | * |
| 118 | * Enables USART peripheral, clocks and initializes USART driver |
| 119 | */ |
| 120 | void SIM1_init(void) |
| 121 | { |
| 122 | SIM1_CLOCK_init(); |
| 123 | usart_async_init(&SIM1, SERCOM1, SIM1_buffer, SIM1_BUFFER_SIZE, (void *)NULL); |
| 124 | SIM1_PORT_init(); |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * \brief USART Clock initialization function |
| 129 | * |
| 130 | * Enables register interface and peripheral clock |
| 131 | */ |
| 132 | void SIM2_CLOCK_init() |
| 133 | { |
| 134 | |
| 135 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM2_GCLK_ID_CORE, CONF_GCLK_SERCOM2_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 136 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM2_GCLK_ID_SLOW, CONF_GCLK_SERCOM2_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 137 | |
| 138 | hri_mclk_set_APBBMASK_SERCOM2_bit(MCLK); |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * \brief USART pinmux initialization function |
| 143 | * |
| 144 | * Set each required pin to USART functionality |
| 145 | */ |
| 146 | void SIM2_PORT_init() |
| 147 | { |
| 148 | |
| 149 | gpio_set_pin_function(SIM2_IO, PINMUX_PA09D_SERCOM2_PAD0); |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * \brief USART initialization function |
| 154 | * |
| 155 | * Enables USART peripheral, clocks and initializes USART driver |
| 156 | */ |
| 157 | void SIM2_init(void) |
| 158 | { |
| 159 | SIM2_CLOCK_init(); |
| 160 | usart_async_init(&SIM2, SERCOM2, SIM2_buffer, SIM2_BUFFER_SIZE, (void *)NULL); |
| 161 | SIM2_PORT_init(); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * \brief USART Clock initialization function |
| 166 | * |
| 167 | * Enables register interface and peripheral clock |
| 168 | */ |
| 169 | void SIM3_CLOCK_init() |
| 170 | { |
| 171 | |
| 172 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM3_GCLK_ID_CORE, CONF_GCLK_SERCOM3_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 173 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM3_GCLK_ID_SLOW, CONF_GCLK_SERCOM3_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 174 | |
| 175 | hri_mclk_set_APBBMASK_SERCOM3_bit(MCLK); |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * \brief USART pinmux initialization function |
| 180 | * |
| 181 | * Set each required pin to USART functionality |
| 182 | */ |
| 183 | void SIM3_PORT_init() |
| 184 | { |
| 185 | |
| 186 | gpio_set_pin_function(SIM3_IO, PINMUX_PB20C_SERCOM3_PAD0); |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * \brief USART initialization function |
| 191 | * |
| 192 | * Enables USART peripheral, clocks and initializes USART driver |
| 193 | */ |
| 194 | void SIM3_init(void) |
| 195 | { |
| 196 | SIM3_CLOCK_init(); |
| 197 | usart_async_init(&SIM3, SERCOM3, SIM3_buffer, SIM3_BUFFER_SIZE, (void *)NULL); |
| 198 | SIM3_PORT_init(); |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * \brief USART Clock initialization function |
| 203 | * |
| 204 | * Enables register interface and peripheral clock |
| 205 | */ |
| 206 | void SIM4_CLOCK_init() |
| 207 | { |
| 208 | |
| 209 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM4_GCLK_ID_CORE, CONF_GCLK_SERCOM4_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 210 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM4_GCLK_ID_SLOW, CONF_GCLK_SERCOM4_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 211 | |
| 212 | hri_mclk_set_APBDMASK_SERCOM4_bit(MCLK); |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * \brief USART pinmux initialization function |
| 217 | * |
| 218 | * Set each required pin to USART functionality |
| 219 | */ |
| 220 | void SIM4_PORT_init() |
| 221 | { |
| 222 | |
| 223 | gpio_set_pin_function(SIM4_IO, PINMUX_PB08D_SERCOM4_PAD0); |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * \brief USART initialization function |
| 228 | * |
| 229 | * Enables USART peripheral, clocks and initializes USART driver |
| 230 | */ |
| 231 | void SIM4_init(void) |
| 232 | { |
| 233 | SIM4_CLOCK_init(); |
| 234 | usart_async_init(&SIM4, SERCOM4, SIM4_buffer, SIM4_BUFFER_SIZE, (void *)NULL); |
| 235 | SIM4_PORT_init(); |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * \brief USART Clock initialization function |
| 240 | * |
| 241 | * Enables register interface and peripheral clock |
| 242 | */ |
| 243 | void SIM5_CLOCK_init() |
| 244 | { |
| 245 | |
| 246 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM5_GCLK_ID_CORE, CONF_GCLK_SERCOM5_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 247 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM5_GCLK_ID_SLOW, CONF_GCLK_SERCOM5_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 248 | |
| 249 | hri_mclk_set_APBDMASK_SERCOM5_bit(MCLK); |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * \brief USART pinmux initialization function |
| 254 | * |
| 255 | * Set each required pin to USART functionality |
| 256 | */ |
| 257 | void SIM5_PORT_init() |
| 258 | { |
| 259 | |
| 260 | gpio_set_pin_function(SIM5_IO, PINMUX_PB16C_SERCOM5_PAD0); |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * \brief USART initialization function |
| 265 | * |
| 266 | * Enables USART peripheral, clocks and initializes USART driver |
| 267 | */ |
| 268 | void SIM5_init(void) |
| 269 | { |
| 270 | SIM5_CLOCK_init(); |
| 271 | usart_async_init(&SIM5, SERCOM5, SIM5_buffer, SIM5_BUFFER_SIZE, (void *)NULL); |
| 272 | SIM5_PORT_init(); |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * \brief USART Clock initialization function |
| 277 | * |
| 278 | * Enables register interface and peripheral clock |
| 279 | */ |
| 280 | void SIM6_CLOCK_init() |
| 281 | { |
| 282 | |
| 283 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM6_GCLK_ID_CORE, CONF_GCLK_SERCOM6_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 284 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM6_GCLK_ID_SLOW, CONF_GCLK_SERCOM6_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 285 | |
| 286 | hri_mclk_set_APBDMASK_SERCOM6_bit(MCLK); |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * \brief USART pinmux initialization function |
| 291 | * |
| 292 | * Set each required pin to USART functionality |
| 293 | */ |
| 294 | void SIM6_PORT_init() |
| 295 | { |
| 296 | |
| 297 | gpio_set_pin_function(SIM6_IO, PINMUX_PC16C_SERCOM6_PAD0); |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * \brief USART initialization function |
| 302 | * |
| 303 | * Enables USART peripheral, clocks and initializes USART driver |
| 304 | */ |
| 305 | void SIM6_init(void) |
| 306 | { |
| 307 | SIM6_CLOCK_init(); |
| 308 | usart_async_init(&SIM6, SERCOM6, SIM6_buffer, SIM6_BUFFER_SIZE, (void *)NULL); |
| 309 | SIM6_PORT_init(); |
| 310 | } |
| 311 | |
Harald Welte | 361ed20 | 2019-02-24 21:15:39 +0100 | [diff] [blame] | 312 | void UART_debug_PORT_init(void) |
Kévin Redon | 4cd3f7d | 2019-01-24 17:57:13 +0100 | [diff] [blame] | 313 | { |
| 314 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 315 | gpio_set_pin_function(UART_TX, PINMUX_PB30C_SERCOM7_PAD0); |
Kévin Redon | 4cd3f7d | 2019-01-24 17:57:13 +0100 | [diff] [blame] | 316 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 317 | gpio_set_pin_function(UART_RX, PINMUX_PB31C_SERCOM7_PAD1); |
Kévin Redon | 4cd3f7d | 2019-01-24 17:57:13 +0100 | [diff] [blame] | 318 | } |
| 319 | |
Harald Welte | 361ed20 | 2019-02-24 21:15:39 +0100 | [diff] [blame] | 320 | void UART_debug_CLOCK_init(void) |
| 321 | { |
| 322 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_CORE, CONF_GCLK_SERCOM7_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 323 | hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_SLOW, CONF_GCLK_SERCOM7_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); |
| 324 | |
| 325 | hri_mclk_set_APBDMASK_SERCOM7_bit(MCLK); |
| 326 | } |
| 327 | |
Kévin Redon | 4cd3f7d | 2019-01-24 17:57:13 +0100 | [diff] [blame] | 328 | void UART_debug_init(void) |
| 329 | { |
| 330 | UART_debug_CLOCK_init(); |
Harald Welte | 361ed20 | 2019-02-24 21:15:39 +0100 | [diff] [blame] | 331 | usart_sync_init(&UART_debug, SERCOM7, (void *)NULL); |
Kévin Redon | 4cd3f7d | 2019-01-24 17:57:13 +0100 | [diff] [blame] | 332 | UART_debug_PORT_init(); |
| 333 | } |
| 334 | |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 335 | void USB_DEVICE_INSTANCE_PORT_init(void) |
| 336 | { |
| 337 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 338 | gpio_set_pin_direction(USBUP_D_N, |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 339 | // <y> Pin direction |
| 340 | // <id> pad_direction |
| 341 | // <GPIO_DIRECTION_OFF"> Off |
| 342 | // <GPIO_DIRECTION_IN"> In |
| 343 | // <GPIO_DIRECTION_OUT"> Out |
| 344 | GPIO_DIRECTION_OUT); |
| 345 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 346 | gpio_set_pin_level(USBUP_D_N, |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 347 | // <y> Initial level |
| 348 | // <id> pad_initial_level |
| 349 | // <false"> Low |
| 350 | // <true"> High |
| 351 | false); |
| 352 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 353 | gpio_set_pin_pull_mode(USBUP_D_N, |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 354 | // <y> Pull configuration |
| 355 | // <id> pad_pull_config |
| 356 | // <GPIO_PULL_OFF"> Off |
| 357 | // <GPIO_PULL_UP"> Pull-up |
| 358 | // <GPIO_PULL_DOWN"> Pull-down |
| 359 | GPIO_PULL_OFF); |
| 360 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 361 | gpio_set_pin_function(USBUP_D_N, |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 362 | // <y> Pin function |
| 363 | // <id> pad_function |
| 364 | // <i> Auto : use driver pinmux if signal is imported by driver, else turn off function |
| 365 | // <PINMUX_PA24H_USB_DM"> Auto |
| 366 | // <GPIO_PIN_FUNCTION_OFF"> Off |
| 367 | // <GPIO_PIN_FUNCTION_A"> A |
| 368 | // <GPIO_PIN_FUNCTION_B"> B |
| 369 | // <GPIO_PIN_FUNCTION_C"> C |
| 370 | // <GPIO_PIN_FUNCTION_D"> D |
| 371 | // <GPIO_PIN_FUNCTION_E"> E |
| 372 | // <GPIO_PIN_FUNCTION_F"> F |
| 373 | // <GPIO_PIN_FUNCTION_G"> G |
| 374 | // <GPIO_PIN_FUNCTION_H"> H |
| 375 | // <GPIO_PIN_FUNCTION_I"> I |
| 376 | // <GPIO_PIN_FUNCTION_J"> J |
| 377 | // <GPIO_PIN_FUNCTION_K"> K |
| 378 | // <GPIO_PIN_FUNCTION_L"> L |
| 379 | // <GPIO_PIN_FUNCTION_M"> M |
| 380 | // <GPIO_PIN_FUNCTION_N"> N |
| 381 | PINMUX_PA24H_USB_DM); |
| 382 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 383 | gpio_set_pin_direction(USBUP_D_P, |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 384 | // <y> Pin direction |
| 385 | // <id> pad_direction |
| 386 | // <GPIO_DIRECTION_OFF"> Off |
| 387 | // <GPIO_DIRECTION_IN"> In |
| 388 | // <GPIO_DIRECTION_OUT"> Out |
| 389 | GPIO_DIRECTION_OUT); |
| 390 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 391 | gpio_set_pin_level(USBUP_D_P, |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 392 | // <y> Initial level |
| 393 | // <id> pad_initial_level |
| 394 | // <false"> Low |
| 395 | // <true"> High |
| 396 | false); |
| 397 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 398 | gpio_set_pin_pull_mode(USBUP_D_P, |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 399 | // <y> Pull configuration |
| 400 | // <id> pad_pull_config |
| 401 | // <GPIO_PULL_OFF"> Off |
| 402 | // <GPIO_PULL_UP"> Pull-up |
| 403 | // <GPIO_PULL_DOWN"> Pull-down |
| 404 | GPIO_PULL_OFF); |
| 405 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 406 | gpio_set_pin_function(USBUP_D_P, |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 407 | // <y> Pin function |
| 408 | // <id> pad_function |
| 409 | // <i> Auto : use driver pinmux if signal is imported by driver, else turn off function |
| 410 | // <PINMUX_PA25H_USB_DP"> Auto |
| 411 | // <GPIO_PIN_FUNCTION_OFF"> Off |
| 412 | // <GPIO_PIN_FUNCTION_A"> A |
| 413 | // <GPIO_PIN_FUNCTION_B"> B |
| 414 | // <GPIO_PIN_FUNCTION_C"> C |
| 415 | // <GPIO_PIN_FUNCTION_D"> D |
| 416 | // <GPIO_PIN_FUNCTION_E"> E |
| 417 | // <GPIO_PIN_FUNCTION_F"> F |
| 418 | // <GPIO_PIN_FUNCTION_G"> G |
| 419 | // <GPIO_PIN_FUNCTION_H"> H |
| 420 | // <GPIO_PIN_FUNCTION_I"> I |
| 421 | // <GPIO_PIN_FUNCTION_J"> J |
| 422 | // <GPIO_PIN_FUNCTION_K"> K |
| 423 | // <GPIO_PIN_FUNCTION_L"> L |
| 424 | // <GPIO_PIN_FUNCTION_M"> M |
| 425 | // <GPIO_PIN_FUNCTION_N"> N |
| 426 | PINMUX_PA25H_USB_DP); |
| 427 | } |
| 428 | |
| 429 | /* The USB module requires a GCLK_USB of 48 MHz ~ 0.25% clock |
| 430 | * for low speed and full speed operation. */ |
| 431 | #if (CONF_GCLK_USB_FREQUENCY > (48000000 + 48000000 / 400)) || (CONF_GCLK_USB_FREQUENCY < (48000000 - 48000000 / 400)) |
| 432 | #warning USB clock should be 48MHz ~ 0.25% clock, check your configuration! |
| 433 | #endif |
| 434 | |
| 435 | void USB_DEVICE_INSTANCE_CLOCK_init(void) |
| 436 | { |
| 437 | |
| 438 | hri_gclk_write_PCHCTRL_reg(GCLK, USB_GCLK_ID, CONF_GCLK_USB_SRC | GCLK_PCHCTRL_CHEN); |
| 439 | hri_mclk_set_AHBMASK_USB_bit(MCLK); |
| 440 | hri_mclk_set_APBBMASK_USB_bit(MCLK); |
| 441 | } |
| 442 | |
| 443 | void USB_DEVICE_INSTANCE_init(void) |
| 444 | { |
| 445 | USB_DEVICE_INSTANCE_CLOCK_init(); |
| 446 | usb_d_init(); |
| 447 | USB_DEVICE_INSTANCE_PORT_init(); |
| 448 | } |
| 449 | |
| 450 | void system_init(void) |
| 451 | { |
| 452 | init_mcu(); |
| 453 | |
Harald Welte | 092494e | 2019-02-24 10:33:40 +0100 | [diff] [blame] | 454 | // GPIO on PA02 |
| 455 | |
| 456 | // Set pin direction to input |
| 457 | gpio_set_pin_direction(SIM4_INT, GPIO_DIRECTION_IN); |
| 458 | |
| 459 | gpio_set_pin_pull_mode(SIM4_INT, |
| 460 | // <y> Pull configuration |
| 461 | // <id> pad_pull_config |
| 462 | // <GPIO_PULL_OFF"> Off |
| 463 | // <GPIO_PULL_UP"> Pull-up |
| 464 | // <GPIO_PULL_DOWN"> Pull-down |
| 465 | GPIO_PULL_OFF); |
| 466 | |
| 467 | gpio_set_pin_function(SIM4_INT, GPIO_PIN_FUNCTION_OFF); |
| 468 | |
| 469 | // GPIO on PA03 |
| 470 | |
| 471 | // Set pin direction to input |
| 472 | gpio_set_pin_direction(SIM5_INT, GPIO_DIRECTION_IN); |
| 473 | |
| 474 | gpio_set_pin_pull_mode(SIM5_INT, |
| 475 | // <y> Pull configuration |
| 476 | // <id> pad_pull_config |
| 477 | // <GPIO_PULL_OFF"> Off |
| 478 | // <GPIO_PULL_UP"> Pull-up |
| 479 | // <GPIO_PULL_DOWN"> Pull-down |
| 480 | GPIO_PULL_OFF); |
| 481 | |
| 482 | gpio_set_pin_function(SIM5_INT, GPIO_PIN_FUNCTION_OFF); |
| 483 | |
Kévin Redon | 6a8295c | 2019-01-30 18:58:44 +0100 | [diff] [blame] | 484 | // GPIO on PA11 |
| 485 | |
| 486 | gpio_set_pin_direction(SIMCLK_20MHZ, |
| 487 | // <y> Pin direction |
| 488 | // <id> pad_direction |
| 489 | // <GPIO_DIRECTION_OFF"> Off |
| 490 | // <GPIO_DIRECTION_IN"> In |
| 491 | // <GPIO_DIRECTION_OUT"> Out |
| 492 | GPIO_DIRECTION_OUT); |
| 493 | |
| 494 | gpio_set_pin_level(SIMCLK_20MHZ, |
| 495 | // <y> Initial level |
| 496 | // <id> pad_initial_level |
| 497 | // <false"> Low |
| 498 | // <true"> High |
| 499 | false); |
| 500 | |
| 501 | gpio_set_pin_pull_mode(SIMCLK_20MHZ, |
| 502 | // <y> Pull configuration |
| 503 | // <id> pad_pull_config |
| 504 | // <GPIO_PULL_OFF"> Off |
| 505 | // <GPIO_PULL_UP"> Pull-up |
| 506 | // <GPIO_PULL_DOWN"> Pull-down |
| 507 | GPIO_PULL_OFF); |
| 508 | |
| 509 | gpio_set_pin_function(SIMCLK_20MHZ, |
| 510 | // <y> Pin function |
| 511 | // <id> pad_function |
| 512 | // <i> Auto : use driver pinmux if signal is imported by driver, else turn off function |
| 513 | // <GPIO_PIN_FUNCTION_OFF"> Auto |
| 514 | // <GPIO_PIN_FUNCTION_OFF"> Off |
| 515 | // <GPIO_PIN_FUNCTION_A"> A |
| 516 | // <GPIO_PIN_FUNCTION_B"> B |
| 517 | // <GPIO_PIN_FUNCTION_C"> C |
| 518 | // <GPIO_PIN_FUNCTION_D"> D |
| 519 | // <GPIO_PIN_FUNCTION_E"> E |
| 520 | // <GPIO_PIN_FUNCTION_F"> F |
| 521 | // <GPIO_PIN_FUNCTION_G"> G |
| 522 | // <GPIO_PIN_FUNCTION_H"> H |
| 523 | // <GPIO_PIN_FUNCTION_I"> I |
| 524 | // <GPIO_PIN_FUNCTION_J"> J |
| 525 | // <GPIO_PIN_FUNCTION_K"> K |
| 526 | // <GPIO_PIN_FUNCTION_L"> L |
| 527 | // <GPIO_PIN_FUNCTION_M"> M |
| 528 | // <GPIO_PIN_FUNCTION_N"> N |
| 529 | GPIO_PIN_FUNCTION_M); |
| 530 | |
| 531 | // GPIO on PA20 |
| 532 | |
| 533 | // Set pin direction to input |
| 534 | gpio_set_pin_direction(VB0, GPIO_DIRECTION_IN); |
| 535 | |
| 536 | gpio_set_pin_pull_mode(VB0, |
| 537 | // <y> Pull configuration |
| 538 | // <id> pad_pull_config |
| 539 | // <GPIO_PULL_OFF"> Off |
| 540 | // <GPIO_PULL_UP"> Pull-up |
| 541 | // <GPIO_PULL_DOWN"> Pull-down |
| 542 | GPIO_PULL_OFF); |
| 543 | |
| 544 | gpio_set_pin_function(VB0, GPIO_PIN_FUNCTION_OFF); |
| 545 | |
| 546 | // GPIO on PA21 |
| 547 | |
| 548 | // Set pin direction to input |
| 549 | gpio_set_pin_direction(VB1, GPIO_DIRECTION_IN); |
| 550 | |
| 551 | gpio_set_pin_pull_mode(VB1, |
| 552 | // <y> Pull configuration |
| 553 | // <id> pad_pull_config |
| 554 | // <GPIO_PULL_OFF"> Off |
| 555 | // <GPIO_PULL_UP"> Pull-up |
| 556 | // <GPIO_PULL_DOWN"> Pull-down |
| 557 | GPIO_PULL_OFF); |
| 558 | |
| 559 | gpio_set_pin_function(VB1, GPIO_PIN_FUNCTION_OFF); |
| 560 | |
| 561 | // GPIO on PA22 |
| 562 | |
| 563 | // Set pin direction to input |
| 564 | gpio_set_pin_direction(VB2, GPIO_DIRECTION_IN); |
| 565 | |
| 566 | gpio_set_pin_pull_mode(VB2, |
| 567 | // <y> Pull configuration |
| 568 | // <id> pad_pull_config |
| 569 | // <GPIO_PULL_OFF"> Off |
| 570 | // <GPIO_PULL_UP"> Pull-up |
| 571 | // <GPIO_PULL_DOWN"> Pull-down |
| 572 | GPIO_PULL_OFF); |
| 573 | |
| 574 | gpio_set_pin_function(VB2, GPIO_PIN_FUNCTION_OFF); |
| 575 | |
| 576 | // GPIO on PA23 |
| 577 | |
| 578 | // Set pin direction to input |
| 579 | gpio_set_pin_direction(VB3, GPIO_DIRECTION_IN); |
| 580 | |
| 581 | gpio_set_pin_pull_mode(VB3, |
| 582 | // <y> Pull configuration |
| 583 | // <id> pad_pull_config |
| 584 | // <GPIO_PULL_OFF"> Off |
| 585 | // <GPIO_PULL_UP"> Pull-up |
| 586 | // <GPIO_PULL_DOWN"> Pull-down |
| 587 | GPIO_PULL_OFF); |
| 588 | |
| 589 | gpio_set_pin_function(VB3, GPIO_PIN_FUNCTION_OFF); |
| 590 | |
Harald Welte | 092494e | 2019-02-24 10:33:40 +0100 | [diff] [blame] | 591 | // GPIO on PB02 |
| 592 | |
| 593 | gpio_set_pin_level(SCL2, |
| 594 | // <y> Initial level |
| 595 | // <id> pad_initial_level |
| 596 | // <false"> Low |
| 597 | // <true"> High |
| 598 | false); |
| 599 | |
| 600 | // Set pin direction to output |
| 601 | gpio_set_pin_direction(SCL2, GPIO_DIRECTION_OUT); |
| 602 | |
| 603 | gpio_set_pin_function(SCL2, GPIO_PIN_FUNCTION_OFF); |
| 604 | |
| 605 | // GPIO on PB03 |
| 606 | |
| 607 | gpio_set_pin_level(SDA2, |
| 608 | // <y> Initial level |
| 609 | // <id> pad_initial_level |
| 610 | // <false"> Low |
| 611 | // <true"> High |
| 612 | false); |
| 613 | |
| 614 | // Set pin direction to output |
| 615 | gpio_set_pin_direction(SDA2, GPIO_DIRECTION_OUT); |
| 616 | |
| 617 | gpio_set_pin_function(SDA2, GPIO_PIN_FUNCTION_OFF); |
| 618 | |
| 619 | // GPIO on PB04 |
| 620 | |
| 621 | // Set pin direction to input |
| 622 | gpio_set_pin_direction(SIM6_INT, GPIO_DIRECTION_IN); |
| 623 | |
| 624 | gpio_set_pin_pull_mode(SIM6_INT, |
| 625 | // <y> Pull configuration |
| 626 | // <id> pad_pull_config |
| 627 | // <GPIO_PULL_OFF"> Off |
| 628 | // <GPIO_PULL_UP"> Pull-up |
| 629 | // <GPIO_PULL_DOWN"> Pull-down |
| 630 | GPIO_PULL_OFF); |
| 631 | |
| 632 | gpio_set_pin_function(SIM6_INT, GPIO_PIN_FUNCTION_OFF); |
| 633 | |
| 634 | // GPIO on PB05 |
| 635 | |
| 636 | // Set pin direction to input |
| 637 | gpio_set_pin_direction(SIM7_INT, GPIO_DIRECTION_IN); |
| 638 | |
| 639 | gpio_set_pin_pull_mode(SIM7_INT, |
| 640 | // <y> Pull configuration |
| 641 | // <id> pad_pull_config |
| 642 | // <GPIO_PULL_OFF"> Off |
| 643 | // <GPIO_PULL_UP"> Pull-up |
| 644 | // <GPIO_PULL_DOWN"> Pull-down |
| 645 | GPIO_PULL_OFF); |
| 646 | |
| 647 | gpio_set_pin_function(SIM7_INT, GPIO_PIN_FUNCTION_OFF); |
| 648 | |
| 649 | // GPIO on PB06 |
| 650 | |
| 651 | gpio_set_pin_level(SCL3, |
| 652 | // <y> Initial level |
| 653 | // <id> pad_initial_level |
| 654 | // <false"> Low |
| 655 | // <true"> High |
| 656 | false); |
| 657 | |
| 658 | // Set pin direction to output |
| 659 | gpio_set_pin_direction(SCL3, GPIO_DIRECTION_OUT); |
| 660 | |
| 661 | gpio_set_pin_function(SCL3, GPIO_PIN_FUNCTION_OFF); |
| 662 | |
| 663 | // GPIO on PB07 |
| 664 | |
| 665 | gpio_set_pin_level(SDA3, |
| 666 | // <y> Initial level |
| 667 | // <id> pad_initial_level |
| 668 | // <false"> Low |
| 669 | // <true"> High |
| 670 | false); |
| 671 | |
| 672 | // Set pin direction to output |
| 673 | gpio_set_pin_direction(SDA3, GPIO_DIRECTION_OUT); |
| 674 | |
| 675 | gpio_set_pin_function(SDA3, GPIO_PIN_FUNCTION_OFF); |
| 676 | |
| 677 | // GPIO on PB14 |
| 678 | |
| 679 | gpio_set_pin_level(SCL1, |
| 680 | // <y> Initial level |
| 681 | // <id> pad_initial_level |
| 682 | // <false"> Low |
| 683 | // <true"> High |
| 684 | false); |
| 685 | |
| 686 | // Set pin direction to output |
| 687 | gpio_set_pin_direction(SCL1, GPIO_DIRECTION_OUT); |
| 688 | |
| 689 | gpio_set_pin_function(SCL1, GPIO_PIN_FUNCTION_OFF); |
| 690 | |
| 691 | // GPIO on PB15 |
| 692 | |
| 693 | gpio_set_pin_level(SDA1, |
| 694 | // <y> Initial level |
| 695 | // <id> pad_initial_level |
| 696 | // <false"> Low |
| 697 | // <true"> High |
| 698 | false); |
| 699 | |
| 700 | // Set pin direction to output |
| 701 | gpio_set_pin_direction(SDA1, GPIO_DIRECTION_OUT); |
| 702 | |
| 703 | gpio_set_pin_function(SDA1, GPIO_PIN_FUNCTION_OFF); |
| 704 | |
Kévin Redon | 3c045b2 | 2019-02-26 19:52:02 +0100 | [diff] [blame] | 705 | // GPIO on PB30 |
| 706 | |
| 707 | gpio_set_pin_direction(UART_TX, |
| 708 | // <y> Pin direction |
| 709 | // <id> pad_direction |
| 710 | // <GPIO_DIRECTION_OFF"> Off |
| 711 | // <GPIO_DIRECTION_IN"> In |
| 712 | // <GPIO_DIRECTION_OUT"> Out |
| 713 | GPIO_DIRECTION_OUT); |
| 714 | |
| 715 | gpio_set_pin_level(UART_TX, |
| 716 | // <y> Initial level |
| 717 | // <id> pad_initial_level |
| 718 | // <false"> Low |
| 719 | // <true"> High |
| 720 | false); |
| 721 | |
| 722 | gpio_set_pin_pull_mode(UART_TX, |
| 723 | // <y> Pull configuration |
| 724 | // <id> pad_pull_config |
| 725 | // <GPIO_PULL_OFF"> Off |
| 726 | // <GPIO_PULL_UP"> Pull-up |
| 727 | // <GPIO_PULL_DOWN"> Pull-down |
| 728 | GPIO_PULL_OFF); |
| 729 | |
| 730 | gpio_set_pin_function(UART_TX, |
| 731 | // <y> Pin function |
| 732 | // <id> pad_function |
| 733 | // <i> Auto : use driver pinmux if signal is imported by driver, else turn off function |
| 734 | // <GPIO_PIN_FUNCTION_OFF"> Auto |
| 735 | // <GPIO_PIN_FUNCTION_OFF"> Off |
| 736 | // <GPIO_PIN_FUNCTION_A"> A |
| 737 | // <GPIO_PIN_FUNCTION_B"> B |
| 738 | // <GPIO_PIN_FUNCTION_C"> C |
| 739 | // <GPIO_PIN_FUNCTION_D"> D |
| 740 | // <GPIO_PIN_FUNCTION_E"> E |
| 741 | // <GPIO_PIN_FUNCTION_F"> F |
| 742 | // <GPIO_PIN_FUNCTION_G"> G |
| 743 | // <GPIO_PIN_FUNCTION_H"> H |
| 744 | // <GPIO_PIN_FUNCTION_I"> I |
| 745 | // <GPIO_PIN_FUNCTION_J"> J |
| 746 | // <GPIO_PIN_FUNCTION_K"> K |
| 747 | // <GPIO_PIN_FUNCTION_L"> L |
| 748 | // <GPIO_PIN_FUNCTION_M"> M |
| 749 | // <GPIO_PIN_FUNCTION_N"> N |
| 750 | GPIO_PIN_FUNCTION_H); |
| 751 | |
Harald Welte | 092494e | 2019-02-24 10:33:40 +0100 | [diff] [blame] | 752 | // GPIO on PC00 |
| 753 | |
| 754 | // Set pin direction to input |
| 755 | gpio_set_pin_direction(SIM0_INT, GPIO_DIRECTION_IN); |
| 756 | |
| 757 | gpio_set_pin_pull_mode(SIM0_INT, |
| 758 | // <y> Pull configuration |
| 759 | // <id> pad_pull_config |
| 760 | // <GPIO_PULL_OFF"> Off |
| 761 | // <GPIO_PULL_UP"> Pull-up |
| 762 | // <GPIO_PULL_DOWN"> Pull-down |
| 763 | GPIO_PULL_OFF); |
| 764 | |
| 765 | gpio_set_pin_function(SIM0_INT, GPIO_PIN_FUNCTION_OFF); |
| 766 | |
| 767 | // GPIO on PC01 |
| 768 | |
| 769 | // Set pin direction to input |
| 770 | gpio_set_pin_direction(SIM1_INT, GPIO_DIRECTION_IN); |
| 771 | |
| 772 | gpio_set_pin_pull_mode(SIM1_INT, |
| 773 | // <y> Pull configuration |
| 774 | // <id> pad_pull_config |
| 775 | // <GPIO_PULL_OFF"> Off |
| 776 | // <GPIO_PULL_UP"> Pull-up |
| 777 | // <GPIO_PULL_DOWN"> Pull-down |
| 778 | GPIO_PULL_OFF); |
| 779 | |
| 780 | gpio_set_pin_function(SIM1_INT, GPIO_PIN_FUNCTION_OFF); |
| 781 | |
| 782 | // GPIO on PC02 |
| 783 | |
| 784 | // Set pin direction to input |
| 785 | gpio_set_pin_direction(SIM2_INT, GPIO_DIRECTION_IN); |
| 786 | |
| 787 | gpio_set_pin_pull_mode(SIM2_INT, |
| 788 | // <y> Pull configuration |
| 789 | // <id> pad_pull_config |
| 790 | // <GPIO_PULL_OFF"> Off |
| 791 | // <GPIO_PULL_UP"> Pull-up |
| 792 | // <GPIO_PULL_DOWN"> Pull-down |
| 793 | GPIO_PULL_OFF); |
| 794 | |
| 795 | gpio_set_pin_function(SIM2_INT, GPIO_PIN_FUNCTION_OFF); |
| 796 | |
| 797 | // GPIO on PC03 |
| 798 | |
| 799 | // Set pin direction to input |
| 800 | gpio_set_pin_direction(SIM3_INT, GPIO_DIRECTION_IN); |
| 801 | |
| 802 | gpio_set_pin_pull_mode(SIM3_INT, |
| 803 | // <y> Pull configuration |
| 804 | // <id> pad_pull_config |
| 805 | // <GPIO_PULL_OFF"> Off |
| 806 | // <GPIO_PULL_UP"> Pull-up |
| 807 | // <GPIO_PULL_DOWN"> Pull-down |
| 808 | GPIO_PULL_OFF); |
| 809 | |
| 810 | gpio_set_pin_function(SIM3_INT, GPIO_PIN_FUNCTION_OFF); |
| 811 | |
Kévin Redon | 6a8295c | 2019-01-30 18:58:44 +0100 | [diff] [blame] | 812 | // GPIO on PC14 |
| 813 | |
| 814 | // Set pin direction to input |
| 815 | gpio_set_pin_direction(SWITCH, GPIO_DIRECTION_IN); |
| 816 | |
| 817 | gpio_set_pin_pull_mode(SWITCH, |
| 818 | // <y> Pull configuration |
| 819 | // <id> pad_pull_config |
| 820 | // <GPIO_PULL_OFF"> Off |
| 821 | // <GPIO_PULL_UP"> Pull-up |
| 822 | // <GPIO_PULL_DOWN"> Pull-down |
| 823 | GPIO_PULL_OFF); |
| 824 | |
| 825 | gpio_set_pin_function(SWITCH, GPIO_PIN_FUNCTION_OFF); |
| 826 | |
Harald Welte | 092494e | 2019-02-24 10:33:40 +0100 | [diff] [blame] | 827 | // GPIO on PC15 |
| 828 | |
| 829 | // Set pin direction to input |
Kévin Redon | 3c045b2 | 2019-02-26 19:52:02 +0100 | [diff] [blame] | 830 | gpio_set_pin_direction(MUX_STAT, GPIO_DIRECTION_IN); |
Harald Welte | 092494e | 2019-02-24 10:33:40 +0100 | [diff] [blame] | 831 | |
Kévin Redon | 3c045b2 | 2019-02-26 19:52:02 +0100 | [diff] [blame] | 832 | gpio_set_pin_pull_mode(MUX_STAT, |
Harald Welte | 092494e | 2019-02-24 10:33:40 +0100 | [diff] [blame] | 833 | // <y> Pull configuration |
| 834 | // <id> pad_pull_config |
| 835 | // <GPIO_PULL_OFF"> Off |
| 836 | // <GPIO_PULL_UP"> Pull-up |
| 837 | // <GPIO_PULL_DOWN"> Pull-down |
| 838 | GPIO_PULL_OFF); |
| 839 | |
Kévin Redon | 3c045b2 | 2019-02-26 19:52:02 +0100 | [diff] [blame] | 840 | gpio_set_pin_function(MUX_STAT, GPIO_PIN_FUNCTION_OFF); |
Harald Welte | 092494e | 2019-02-24 10:33:40 +0100 | [diff] [blame] | 841 | |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 842 | // GPIO on PC26 |
Kévin Redon | 5908a5c | 2019-01-24 18:45:23 +0100 | [diff] [blame] | 843 | |
Kévin Redon | 6a8295c | 2019-01-30 18:58:44 +0100 | [diff] [blame] | 844 | gpio_set_pin_level(USER_LED, |
Kévin Redon | 5908a5c | 2019-01-24 18:45:23 +0100 | [diff] [blame] | 845 | // <y> Initial level |
| 846 | // <id> pad_initial_level |
| 847 | // <false"> Low |
| 848 | // <true"> High |
Kévin Redon | 4e39b01 | 2019-01-30 15:55:58 +0100 | [diff] [blame] | 849 | false); |
Kévin Redon | 5908a5c | 2019-01-24 18:45:23 +0100 | [diff] [blame] | 850 | |
| 851 | // Set pin direction to output |
Kévin Redon | 6a8295c | 2019-01-30 18:58:44 +0100 | [diff] [blame] | 852 | gpio_set_pin_direction(USER_LED, GPIO_DIRECTION_OUT); |
Kévin Redon | 5908a5c | 2019-01-24 18:45:23 +0100 | [diff] [blame] | 853 | |
Kévin Redon | 6a8295c | 2019-01-30 18:58:44 +0100 | [diff] [blame] | 854 | gpio_set_pin_function(USER_LED, GPIO_PIN_FUNCTION_OFF); |
Kévin Redon | 5908a5c | 2019-01-24 18:45:23 +0100 | [diff] [blame] | 855 | |
Harald Welte | 092494e | 2019-02-24 10:33:40 +0100 | [diff] [blame] | 856 | // GPIO on PC27 |
| 857 | |
| 858 | gpio_set_pin_level(SCL4, |
| 859 | // <y> Initial level |
| 860 | // <id> pad_initial_level |
| 861 | // <false"> Low |
| 862 | // <true"> High |
| 863 | false); |
| 864 | |
| 865 | // Set pin direction to output |
| 866 | gpio_set_pin_direction(SCL4, GPIO_DIRECTION_OUT); |
| 867 | |
| 868 | gpio_set_pin_function(SCL4, GPIO_PIN_FUNCTION_OFF); |
| 869 | |
| 870 | // GPIO on PC28 |
| 871 | |
| 872 | gpio_set_pin_level(SDA4, |
| 873 | // <y> Initial level |
| 874 | // <id> pad_initial_level |
| 875 | // <false"> Low |
| 876 | // <true"> High |
| 877 | false); |
| 878 | |
| 879 | // Set pin direction to output |
| 880 | gpio_set_pin_direction(SDA4, GPIO_DIRECTION_OUT); |
| 881 | |
| 882 | gpio_set_pin_function(SDA4, GPIO_PIN_FUNCTION_OFF); |
| 883 | |
Kévin Redon | 1f8ecef | 2019-01-31 13:36:12 +0100 | [diff] [blame] | 884 | SIM0_init(); |
| 885 | SIM1_init(); |
| 886 | SIM2_init(); |
| 887 | SIM3_init(); |
| 888 | SIM4_init(); |
| 889 | SIM5_init(); |
| 890 | SIM6_init(); |
Harald Welte | 361ed20 | 2019-02-24 21:15:39 +0100 | [diff] [blame] | 891 | |
Kévin Redon | 4cd3f7d | 2019-01-24 17:57:13 +0100 | [diff] [blame] | 892 | UART_debug_init(); |
| 893 | |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 894 | USB_DEVICE_INSTANCE_init(); |
| 895 | } |