dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_board.c
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 #include "board_hw_defs.c"
31 #include <pios.h>
32 
34 
40 void PIOS_Board_Init(void)
41 {
42  /* Enable Prefetch Buffer */
43  FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
44 
45  /* Flash 2 wait state */
46  FLASH_SetLatency(FLASH_Latency_2);
47 
48  /* Delay system */
50 
51 #if defined(PIOS_INCLUDE_ANNUNC)
53 #endif /* PIOS_INCLUDE_ANNUNC */
54 
55 #if defined(PIOS_INCLUDE_USB)
56  /* Initialize board specific USB data */
58 
59  /* Activate the HID-only USB configuration */
61 
62  uintptr_t pios_usb_id;
63  if (PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg)) {
64  PIOS_Assert(0);
65  }
66 #if defined(PIOS_INCLUDE_USB_HID) && defined(PIOS_INCLUDE_COM_MSG)
67  uintptr_t pios_usb_hid_id;
68  if (PIOS_USB_HID_Init(&pios_usb_hid_id, &pios_usb_hid_cfg, pios_usb_id)) {
69  PIOS_Assert(0);
70  }
72  PIOS_Assert(0);
73  }
74 #endif /* PIOS_INCLUDE_USB_HID && PIOS_INCLUDE_COM_MSG */
75 
76 #endif /* PIOS_INCLUDE_USB */
77 
78  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);//TODO Tirar
79 }
80 
Main PiOS header to include all the compiled in PiOS options.
int32_t PIOS_USB_HID_Init(uintptr_t *usbhid_id, const struct pios_usb_hid_cfg *cfg, uintptr_t lower_id)
int32_t PIOS_DELAY_Init(void)
Definition: pios_delay.c:98
const struct pios_com_driver pios_usb_hid_com_driver
void PIOS_Board_Init()
Definition: pios_board.c:44
int32_t PIOS_ANNUNC_Init(const struct pios_annunc_cfg *cfg)
int32_t PIOS_USB_DESC_HID_ONLY_Init(void)
uintptr_t pios_com_telem_usb_id
Definition: pios_board.c:42
int32_t PIOS_COM_MSG_Init(uintptr_t *com_id, const struct pios_com_driver *driver, uintptr_t lower_id)
int32_t PIOS_USB_Init(uintptr_t *usb_id, const struct pios_usb_cfg *cfg)
#define PIOS_Assert(test)
Definition: pios_debug.h:52
int32_t PIOS_USB_BOARD_DATA_Init(void)