aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2015-01-30 09:59:19 +0100
committerLorenz Meier <lm@inf.ethz.ch>2015-02-11 07:40:58 +0100
commitab27cd9009015fca95597f8ca2c6d4718f27d0c0 (patch)
tree3e5ff891ac04fc418e472b46a16e4711748f9f4a
parentfda4bee0d7a55f1051ea5d87373106a9b9ebf866 (diff)
downloadpx4-firmware-ab27cd9009015fca95597f8ca2c6d4718f27d0c0.tar.gz
px4-firmware-ab27cd9009015fca95597f8ca2c6d4718f27d0c0.tar.bz2
px4-firmware-ab27cd9009015fca95597f8ca2c6d4718f27d0c0.zip
Aerocore: board init
-rw-r--r--src/drivers/boards/aerocore/aerocore_init.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/drivers/boards/aerocore/aerocore_init.c b/src/drivers/boards/aerocore/aerocore_init.c
index 91dbe4b81..6882ca80d 100644
--- a/src/drivers/boards/aerocore/aerocore_init.c
+++ b/src/drivers/boards/aerocore/aerocore_init.c
@@ -1,6 +1,6 @@
/****************************************************************************
*
- * Copyright (C) 2012 PX4 Development Team. All rights reserved.
+ * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -110,6 +110,10 @@ __END_DECLS
* Protected Functions
****************************************************************************/
+#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
+__EXPORT extern void up_cxxinitialize();
+#endif
+
#if defined(CONFIG_FAT_DMAMEMORY)
# if !defined(CONFIG_GRAN) || !defined(CONFIG_FAT_DMAMEMORY)
# error microSD DMA support requires CONFIG_GRAN
@@ -117,12 +121,12 @@ __END_DECLS
static GRAN_HANDLE dma_allocator;
-/*
- * The DMA heap size constrains the total number of things that can be
+/*
+ * The DMA heap size constrains the total number of things that can be
* ready to do DMA at a time.
*
* For example, FAT DMA depends on one sector-sized buffer per filesystem plus
- * one sector-sized buffer per file.
+ * one sector-sized buffer per file.
*
* We use a fundamental alignment / granule size of 64B; this is sufficient
* to guarantee alignment for the largest STM32 DMA burst (16 beats x 32bits).
@@ -137,8 +141,10 @@ dma_alloc_init(void)
sizeof(g_dma_heap),
7, /* 128B granule - must be > alignment (XXX bug?) */
6); /* 64B alignment */
+
if (dma_allocator == NULL) {
message("[boot] DMA allocator setup FAILED");
+
} else {
g_dma_perf = perf_alloc(PC_COUNT, "DMA allocations");
}
@@ -277,11 +283,13 @@ __EXPORT int nsh_archinitialize(void)
/* Configure Sensors on SPI bus #3 */
spi3 = up_spiinitialize(3);
+
if (!spi3) {
message("[boot] FAILED to initialize SPI port 3\n");
board_led_on(LED_AMBER);
return -ENODEV;
}
+
/* Default: 1MHz, 8 bits, Mode 3 */
SPI_SETFREQUENCY(spi3, 10000000);
SPI_SETBITS(spi3, 8);
@@ -294,11 +302,13 @@ __EXPORT int nsh_archinitialize(void)
/* Configure FRAM on SPI bus #4 */
spi4 = up_spiinitialize(4);
+
if (!spi4) {
message("[boot] FAILED to initialize SPI port 4\n");
board_led_on(LED_AMBER);
return -ENODEV;
}
+
/* Default: ~10MHz, 8 bits, Mode 3 */
SPI_SETFREQUENCY(spi4, 10 * 1000 * 1000);
SPI_SETBITS(spi4, 8);