diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-01-30 09:59:19 +0100 |
---|---|---|
committer | David Sidrane <david_s5@nscdg.com> | 2015-04-07 07:18:45 -1000 |
commit | d7cdf089fa92ef140341811625e3504df4d1259d (patch) | |
tree | 1867efdb01357bc1088bfc0d3b9f344270636721 | |
parent | 87f77cada2439f9260d3cfe99dd5bdeebb77ae0e (diff) | |
download | px4-firmware-d7cdf089fa92ef140341811625e3504df4d1259d.tar.gz px4-firmware-d7cdf089fa92ef140341811625e3504df4d1259d.tar.bz2 px4-firmware-d7cdf089fa92ef140341811625e3504df4d1259d.zip |
Aerocore: board init
-rw-r--r-- | src/drivers/boards/aerocore/aerocore_init.c | 18 |
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); |