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 
16 /*
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful, but
23  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25  * for more details.
26  *
27  * You should have received a copy of the GNU General Public License along
28  * with this program; if not, see <http://www.gnu.org/licenses/>
29  */
30 
31 #include <pios.h>
32 #include "pios_board.h"
33 #include <pios_com_priv.h>
34 #include <pios_tcp_priv.h>
35 #include <openpilot.h>
36 #include <uavobjectsinit.h>
37 #include <pios_thread.h>
38 
39 #include "accels.h"
40 #include "baroaltitude.h"
41 #include "gpsposition.h"
42 #include "gyros.h"
43 #include "gyrosbias.h"
44 #include "hwsparky.h"
45 #include "hwsimulation.h"
46 #include "magnetometer.h"
47 #include "manualcontrolsettings.h"
48 
49 #include "pios_hal.h"
50 #include "pios_rcvr_priv.h"
51 #include "pios_queue.h"
52 
53 void Stack_Change() {
54 }
55 
57  .ip = "0.0.0.0",
58  .port = 9000,
59 };
60 
61 #define PIOS_COM_TELEM_TCP_RX_BUF_LEN 384
62 #define PIOS_COM_TELEM_TCP_TX_BUF_LEN 384
63 #define PIOS_COM_GPS_RX_BUF_LEN 96
64 
68 #include "../../../tests/logfs/unittest_init.c"
69 
71 
72 /*
73  * Board specific number of devices.
74  */
75 
79 
85 void PIOS_Board_Init(void) {
86 
87  /* Delay system */
89 
91  &flash_config, false);
92 
93  if (retval != 0) {
94  fprintf(stderr, "Unable to initialize posix flash driver: %d\n",
95  retval);
96  exit(1);
97  }
98 
99  /* Register the partition table */
101 
103  fprintf(stderr, "Unable to open the settings partition\n");
104 
105  /* Initialize UAVObject libraries */
106  UAVObjectsInitializeAll();
107 
108  /* Initialize the alarms library */
110 
111  HwSimulationInitialize();
112 
113  if (!PIOS_COM_TELEM_USB) {
114  uintptr_t pios_tcp_telem_id;
115 
116  if (PIOS_TCP_Init(&pios_tcp_telem_id, &pios_tcp_telem_cfg)) {
117  PIOS_Assert(0);
118  }
119 
121  &pios_tcp_com_driver, pios_tcp_telem_id,
124  PIOS_Assert(0);
125  }
126  }
127 
128  printf("Completed PIOS_Board_Init\n");
129 }
130 
const struct pios_tcp_cfg pios_tcp_telem_cfg
Definition: pios_board.c:56
Main PiOS header to include all the compiled in PiOS options.
TCP private definitions.
#define NELEMENTS(x)
Definition: pios.h:192
COM private definitions.
uintptr_t pios_com_debug_id
Definition: pios_board.c:76
uintptr_t pios_uavo_settings_fs_id
Definition: pios_board.c:50
#define PIOS_COM_TELEM_USB
Definition: pios_board.h:114
int32_t PIOS_DELAY_Init(void)
Definition: pios_delay.c:98
int32_t PIOS_FLASHFS_Logfs_Init(uintptr_t *fs_id, const struct flashfs_logfs_cfg *cfg, enum pios_flash_partition_labels partition_label)
Initialize the flash object setting FS.
struct pios_flash_posix_cfg flash_config
Definition: unittest_init.c:28
void PIOS_Board_Init()
Definition: pios_board.c:44
uintptr_t pios_posix_flash_id
Definition: unittest_init.c:41
struct flashfs_logfs_cfg flashfs_config_settings
Definition: unittest_init.c:12
#define PIOS_COM_TELEM_TCP_TX_BUF_LEN
Definition: pios_board.c:62
uintptr_t pios_com_telem_usb_id
Definition: pios_board.c:42
int32_t PIOS_TCP_Init(uintptr_t *tcp_id, const struct pios_tcp_cfg *cfg)
int32_t PIOS_COM_Init(uintptr_t *com_id, const struct pios_com_driver *driver, uintptr_t lower_id, uint16_t rx_buffer_len, uint16_t tx_buffer_len)
void PIOS_FLASH_register_partition_table(const struct pios_flash_partition partition_table[], uint8_t num_partitions)
#define PIOS_COM_TELEM_TCP_RX_BUF_LEN
Definition: pios_board.c:61
void Stack_Change(void)
Definition: pios_board.c:53
Includes PiOS and core architecture components.
const char * ip
Definition: pios_tcp_priv.h:52
const struct pios_flash_partition pios_flash_partition_table[]
Definition: unittest_init.c:50
uintptr_t pios_com_openlog_id
Definition: pios_board.c:77
int printf(const char *format,...)
const struct pios_com_driver pios_tcp_com_driver
int32_t AlarmsInitialize(void)
Definition: alarms.c:51
#define PIOS_Assert(test)
Definition: pios_debug.h:52
USART private definitions.
int32_t PIOS_Flash_Posix_Init(uintptr_t *chip_id, const struct pios_flash_posix_cfg *cfg, bool force_recreate)