diff options
Diffstat (limited to 'nuttx')
22 files changed, 118 insertions, 54 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 32da72a42..7b6c41411 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -4486,4 +4486,13 @@ chips. Contributed by Mike Smith (2014-4-01). * configs/zkit-arm-1769/src/up_can.c: Add support for both CAN1 and CAN2. Contributed by M.Kannan (2014-4-01). - + * arch/arm/src/lpc17xx/lpc17_spi.c and lpc17_ssp.c and + configs/olimex-lpc1766stk, nucleus2g, zkit-arm-1769, and + lpcxpresso-lpc1768: The initialization function for both the LPC17xx + SPI and SSP blocks was called up_spinitialize() which is the common API + definition of include/nuttx/spi.h. But this raises a problem when the + MCU has multiple blocks for differ SPI implementatins as does the + LPC17xx (and also as does other architectures like STM32 that have + USARTs that can serve as SPI interfaces as well). These were renamed + to lpc17_spiinitialize() and lpc17_sspinitialize() in this case. + Problem reported by M. Kannan (2014-4-01). diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h b/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h index cd2d10dd2..43bdb27ea 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h @@ -56,7 +56,7 @@ typedef FAR void *DMA_HANDLE; -/* dma_callback_t a function pointer provided to lp17_dmastart. This function is +/* dma_callback_t a function pointer provided to lpc17_dmastart. This function is * called at the completion of the DMA transfer. 'arg' is the same 'arg' value * that was provided when lpc17_dmastart() was called and result indicates the result * of the transfer: Zero indicates a successful tranfers. On failure, a negated diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_spi.c b/nuttx/arch/arm/src/lpc17xx/lpc17_spi.c index d87e6c1ec..75a483591 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_spi.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_spi.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc17xx/lpc17_spi.c * - * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -539,10 +539,10 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw ****************************************************************************/ /**************************************************************************** - * Name: up_spiinitialize + * Name: lpc17_spiinitialize * * Description: - * Initialize the selected SPI port + * Initialize the selected SPI port. * * Input Parameter: * Port number (for hardware that has mutiple SPI interfaces) @@ -552,7 +552,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw * ****************************************************************************/ -FAR struct spi_dev_s *up_spiinitialize(int port) +FAR struct spi_dev_s *lpc17_spiinitialize(int port) { FAR struct lpc17_spidev_s *priv = &g_spidev; irqstate_t flags; diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_spi.h b/nuttx/arch/arm/src/lpc17xx/lpc17_spi.h index e6898aac7..3d4620b52 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_spi.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_spi.h @@ -71,13 +71,29 @@ extern "C" ************************************************************************************/ /************************************************************************************ + * Name: lpc17_spiinitialize + * + * Description: + * Initialize the selected SPI port. + * + * Input Parameter: + * Port number (for hardware that has mutiple SPI interfaces) + * + * Returned Value: + * Valid SPI device structure reference on succcess; a NULL on failure + * + ************************************************************************************/ + +FAR struct spi_dev_s *lpc17_spiinitialize(int port); + +/************************************************************************************ * Name: lpc17_spiselect, lpc17_status, and lpc17_spicmddata * * Description: * These external functions must be provided by board-specific logic. They are * implementations of the select, status, and cmddata methods of the SPI interface * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods - * including up_spiinitialize()) are provided by common LPC17xx logic. To use + * including lpc17_spiinitialize()) are provided by common LPC17xx logic. To use * this common SPI logic on your board: * * 1. Provide logic in lpc17_boardinitialize() to configure SPI chip select pins. @@ -88,9 +104,9 @@ extern "C" * lpc17_spicmddata() functions in your board-specific logic. This function * will perform cmd/data selection operations using GPIOs in the way your * board is configured. - * 3. Add a call to up_spiinitialize() in your low level application + * 3. Add a call to lpc17_spiinitialize() in your low level application * initialization logic - * 4. The handle returned by up_spiinitialize() may then be used to bind the + * 4. The handle returned by lpc17_spiinitialize() may then be used to bind the * SPI driver to higher level logic (e.g., calling mmcsd_spislotinitialize(), * for example, will bind the SPI driver to the SPI MMC/SD driver). * diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c index 331319cc7..81b182e6c 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c @@ -814,10 +814,10 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp1initialize(void) ****************************************************************************/ /**************************************************************************** - * Name: up_spiinitialize + * Name: lpc17_sspinitialize * * Description: - * Initialize the selected SPI port + * Initialize the selected SSP port. * * Input Parameter: * Port number (for hardware that has mutiple SPI interfaces) @@ -827,7 +827,7 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp1initialize(void) * ****************************************************************************/ -FAR struct spi_dev_s *up_spiinitialize(int port) +FAR struct spi_dev_s *lpc17_sspinitialize(int port) { FAR struct lpc17_sspdev_s *priv; uint32_t regval; diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h index edc6846ba..add469661 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h @@ -71,13 +71,29 @@ extern "C" ************************************************************************************/ /************************************************************************************ + * Name: lpc17_sspinitialize + * + * Description: + * Initialize the selected SSP port. + * + * Input Parameter: + * Port number (for hardware that has mutiple SPI interfaces) + * + * Returned Value: + * Valid SPI device structure reference on succcess; a NULL on failure + * + ************************************************************************************/ + +FAR struct spi_dev_s *lpc17_sspinitialize(int port); + +/************************************************************************************ * Name: lpc17_ssp0/ssp1select, lpc17_ssp0/ssp1status, and lpc17_ssp0/ssp1cmddata * * Description: * These external functions must be provided by board-specific logic. They are * implementations of the select, status, and cmddata methods of the SPI interface * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods - * including up_spiinitialize()) are provided by common LPC17xx logic. To use + * including lpc17_sspinitialize()) are provided by common LPC17xx logic. To use * this common SPI logic on your board: * * 1. Provide logic in lpc17_boardinitialize() to configure SSP chip select pins. @@ -88,9 +104,9 @@ extern "C" * lpc17_ssp0/ssp1cmddata() functions in your board-specific logic. These * functions will perform cmd/data selection operations using GPIOs in the way * your board is configured. - * 3. Add a call to up_spiinitialize() in your low level application + * 3. Add a call to lpc17_sspinitialize() in your low level application * initialization logic - * 4. The handle returned by up_spiinitialize() may then be used to bind the + * 4. The handle returned by lpc17_sspinitialize() may then be used to bind the * SSP driver to higher level logic (e.g., calling mmcsd_spislotinitialize(), * for example, will bind the SSP driver to the SPI MMC/SD driver). * diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c index 6165cd9e9..644ac4d17 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c @@ -143,7 +143,7 @@ int nsh_archinitialize(void) /* Get the SSP port */ - ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); + ssp = lpc17_sspinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!ssp) { message("nsh_archinitialize: Failed to initialize SSP port %d\n", diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c index c22b09ceb..709eadcab 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c @@ -123,25 +123,25 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) oleddc_dumpgpio("up_nxdrvinit: After OLED Power/DC setup"); - /* Get the SSI port (configure as a Freescale SPI port) */ + /* Get the SPI1 port (configure as a Freescale SPI port) */ - spi = up_spiinitialize(1); + spi = lpc17_sspinitialize(1); if (!spi) { - glldbg("Failed to initialize SSI port 1\n"); + glldbg("Failed to initialize SPI port 1\n"); } else { - /* Bind the SSI port to the OLED */ + /* Bind the SPI port to the OLED */ dev = ug_initialize(spi, devno); if (!dev) { - glldbg("Failed to bind SSI port 1 to OLED %d: %d\n", devno); + glldbg("Failed to bind SPI port 1 to OLED %d: %d\n", devno); } else { - gllvdbg("Bound SSI port 1 to OLED %d\n", devno); + gllvdbg("Bound SPI port 1 to OLED %d\n", devno); /* And turn the OLED on (dim) */ diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c index 3504d78c7..ff5908753 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c @@ -134,7 +134,7 @@ void weak_function lpc17_sspinitialize(void) * The external functions, lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status * must be provided by board-specific logic. They are implementations of the select * and status methods of the SPI interface defined by struct spi_ops_s (see - * include/nuttx/spi.h). All other methods (including up_spiinitialize()) + * include/nuttx/spi.h). All other methods (including lpc17_sspinitialize()) * are provided by common LPC17xx logic. To use this common SPI logic on your * board: * @@ -143,9 +143,9 @@ void weak_function lpc17_sspinitialize(void) * 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() functions * in your board-specific logic. These functions will perform chip selection * and status operations using GPIOs in the way your board is configured. - * 3. Add a calls to up_spiinitialize() in your low level application + * 3. Add a calls to lpc17_sspinitialize() in your low level application * initialization logic - * 4. The handle returned by up_spiinitialize() may then be used to bind the + * 4. The handle returned by lpc17_sspinitialize() may then be used to bind the * SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_usbmsc.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_usbmsc.c index 937c7857a..542a49a20 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/up_usbmsc.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_usbmsc.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/lpcxpresso-lpc1768/src/up_usbmsc.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Configure and register the LPC17xx MMC/SD SPI block driver. @@ -113,7 +113,7 @@ int usbmsc_archinitialize(void) message("usbmsc_archinitialize: Initializing SPI port %d\n", LPC17XX_MMCSDSPIPORTNO); - spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO); + spi = lpc17_sspinitialize(LPC17XX_MMCSDSPIPORTNO); if (!spi) { message("usbmsc_archinitialize: Failed to initialize SPI port %d\n", diff --git a/nuttx/configs/nucleus2g/src/up_nsh.c b/nuttx/configs/nucleus2g/src/up_nsh.c index 4453d73a1..c19937bdc 100644 --- a/nuttx/configs/nucleus2g/src/up_nsh.c +++ b/nuttx/configs/nucleus2g/src/up_nsh.c @@ -2,7 +2,7 @@ * config/nucleus2g/src/up_nsh.c * arch/arm/src/board/up_nsh.c * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -136,7 +136,7 @@ int nsh_archinitialize(void) /* Get the SSP port */ - ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); + ssp = lpc17_sspinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!ssp) { message("nsh_archinitialize: Failed to initialize SSP port %d\n", diff --git a/nuttx/configs/nucleus2g/src/up_ssp.c b/nuttx/configs/nucleus2g/src/up_ssp.c index 77c07f3eb..435378bba 100644 --- a/nuttx/configs/nucleus2g/src/up_ssp.c +++ b/nuttx/configs/nucleus2g/src/up_ssp.c @@ -137,7 +137,7 @@ void weak_function lpc17_sspinitialize(void) * The external functions, lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status * must be provided by board-specific logic. They are implementations of the select * and status methods of the SPI interface defined by struct spi_ops_s (see - * include/nuttx/spi.h). All other methods (including up_spiinitialize()) + * include/nuttx/spi.h). All other methods (including lpc17_sspinitialize()) * are provided by common LPC17xx logic. To use this common SPI logic on your * board: * @@ -146,9 +146,9 @@ void weak_function lpc17_sspinitialize(void) * 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() functions * in your board-specific logic. These functions will perform chip selection * and status operations using GPIOs in the way your board is configured. - * 3. Add a calls to up_spiinitialize() in your low level application + * 3. Add a calls to lpc17_sspinitialize() in your low level application * initialization logic - * 4. The handle returned by up_spiinitialize() may then be used to bind the + * 4. The handle returned by lpc17_sspinitialize() may then be used to bind the * SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). diff --git a/nuttx/configs/nucleus2g/src/up_usbmsc.c b/nuttx/configs/nucleus2g/src/up_usbmsc.c index f4a533cb6..5da9f948d 100644 --- a/nuttx/configs/nucleus2g/src/up_usbmsc.c +++ b/nuttx/configs/nucleus2g/src/up_usbmsc.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/nucleus2g/src/up_usbmsc.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Configure and register the LPC17xx MMC/SD SPI block driver. @@ -113,7 +113,7 @@ int usbmsc_archinitialize(void) message("usbmsc_archinitialize: Initializing SPI port %d\n", LPC17XX_MMCSDSPIPORTNO); - spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO); + spi = lpc17_sspinitialize(LPC17XX_MMCSDSPIPORTNO); if (!spi) { message("usbmsc_archinitialize: Failed to initialize SPI port %d\n", diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c b/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c index 24ee83f51..1f4b7a813 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c @@ -2,7 +2,7 @@ * config/olimex-lpc1766stk/src/up_lcd.c * arch/arm/src/board/up_lcd.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -207,9 +207,9 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) nokia_blinitialize(); - /* Get the SSP port (configure as a Freescale SPI port) */ + /* Get the SSP0 port (configure as a Freescale SPI port) */ - spi = up_spiinitialize(0); + spi = lpc17_sspinitialize(0); if (!spi) { glldbg("Failed to initialize SSP port 0\n"); diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c b/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c index 00c4be0b7..c18493c94 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c @@ -209,7 +209,7 @@ static int nsh_sdinitialize(void) /* Get the SSP port */ - ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); + ssp = lpc17_sspinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!ssp) { message("nsh_archinitialize: Failed to initialize SSP port %d\n", diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c b/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c index 2c6c613c7..792910a1a 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c @@ -2,7 +2,7 @@ * configs/olimex-lpc1766stk/src/up_ssp.c * arch/arm/src/board/up_ssp.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -258,7 +258,7 @@ void weak_function lpc17_sspinitialize(void) * The external functions, lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status * must be provided by board-specific logic. They are implementations of the select * and status methods of the SPI interface defined by struct spi_ops_s (see - * include/nuttx/spi.h). All other methods (including up_spiinitialize()) + * include/nuttx/spi.h). All other methods (including lpc17_sspinitialize()) * are provided by common LPC17xx logic. To use this common SPI logic on your * board: * @@ -267,9 +267,9 @@ void weak_function lpc17_sspinitialize(void) * 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() functions * in your board-specific logic. These functions will perform chip selection * and status operations using GPIOs in the way your board is configured. - * 3. Add a calls to up_spiinitialize() in your low level application + * 3. Add a calls to lpc17_sspinitialize() in your low level application * initialization logic - * 4. The handle returned by up_spiinitialize() may then be used to bind the + * 4. The handle returned by lpc17_sspinitialize() may then be used to bind the * SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c b/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c index 5f97aff81..e86353a7e 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c @@ -93,7 +93,6 @@ # endif #endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -120,7 +119,7 @@ int usbmsc_archinitialize(void) message("usbmsc_archinitialize: Initializing SPI port %d\n", LPC17XX_MMCSDSPIPORTNO); - spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO); + spi = lpc17_sspinitialize(LPC17XX_MMCSDSPIPORTNO); if (!spi) { message("usbmsc_archinitialize: Failed to initialize SPI port %d\n", diff --git a/nuttx/configs/zkit-arm-1769/src/up_lcd.c b/nuttx/configs/zkit-arm-1769/src/up_lcd.c index d315131ee..c76566674 100644 --- a/nuttx/configs/zkit-arm-1769/src/up_lcd.c +++ b/nuttx/configs/zkit-arm-1769/src/up_lcd.c @@ -85,6 +85,7 @@ # define leddbg(x...) # define ledvdbg(x...) #endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -113,12 +114,13 @@ int up_lcdinitialize(void) lpc17_gpiowrite(ZKITARM_OLED_CS, 1); lpc17_gpiowrite(ZKITARM_OLED_RS, 1); - spi = up_spiinitialize(0); + spi = lpc17_sspinitialize(0); if (!spi) { glldbg("Failed to initialize SSI port 0\n"); return 0; } + lpc17_gpiowrite(ZKITARM_OLED_RST, 0); up_mdelay(1); lpc17_gpiowrite(ZKITARM_OLED_RST, 1); @@ -144,6 +146,7 @@ FAR struct lcd_dev_s *up_lcdgetdev(int lcddev) (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER); return dev; } + return NULL; } diff --git a/nuttx/configs/zkit-arm-1769/src/up_nsh.c b/nuttx/configs/zkit-arm-1769/src/up_nsh.c index 766c46b92..78fddc035 100644 --- a/nuttx/configs/zkit-arm-1769/src/up_nsh.c +++ b/nuttx/configs/zkit-arm-1769/src/up_nsh.c @@ -148,7 +148,7 @@ int nsh_archinitialize(void) /* Get the SSP port */ - ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); + ssp = lpc17_sspinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!ssp) { message("nsh_archinitialize: Failed to initialize SSP port %d\n", diff --git a/nuttx/configs/zkit-arm-1769/src/up_ssp.c b/nuttx/configs/zkit-arm-1769/src/up_ssp.c index 40ca55601..dda71690a 100644 --- a/nuttx/configs/zkit-arm-1769/src/up_ssp.c +++ b/nuttx/configs/zkit-arm-1769/src/up_ssp.c @@ -135,7 +135,7 @@ void weak_function lpc17_sspinitialize(void) * The external functions, lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status * must be provided by board-specific logic. They are implementations of the select * and status methods of the SPI interface defined by struct spi_ops_s (see - * include/nuttx/spi.h). All other methods (including up_spiinitialize()) + * include/nuttx/spi.h). All other methods (including lpc17_sspinitialize()) * are provided by common LPC17xx logic. To use this common SPI logic on your * board: * @@ -144,9 +144,9 @@ void weak_function lpc17_sspinitialize(void) * 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() functions * in your board-specific logic. These functions will perform chip selection * and status operations using GPIOs in the way your board is configured. - * 3. Add a calls to up_spiinitialize() in your low level application + * 3. Add a calls to lpc17_sspinitialize() in your low level application * initialization logic - * 4. The handle returned by up_spiinitialize() may then be used to bind the + * 4. The handle returned by lpc17_sspinitialize() may then be used to bind the * SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). diff --git a/nuttx/configs/zkit-arm-1769/src/up_usbmsc.c b/nuttx/configs/zkit-arm-1769/src/up_usbmsc.c index 2cdfe8603..a6c473efc 100644 --- a/nuttx/configs/zkit-arm-1769/src/up_usbmsc.c +++ b/nuttx/configs/zkit-arm-1769/src/up_usbmsc.c @@ -117,7 +117,7 @@ int usbmsc_archinitialize(void) message("usbmsc_archinitialize: Initializing SPI port %d\n", LPC17XX_MMCSDSPIPORTNO); - spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO); + spi = lpc17_sspinitialize(LPC17XX_MMCSDSPIPORTNO); if (!spi) { message("usbmsc_archinitialize: Failed to initialize SPI port %d\n", diff --git a/nuttx/include/nuttx/spi.h b/nuttx/include/nuttx/spi.h index 6448dc7c5..520874f7b 100644 --- a/nuttx/include/nuttx/spi.h +++ b/nuttx/include/nuttx/spi.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/spi.h * - * Copyright(C) 2008-2012 Gregory Nutt. All rights reserved. + * Copyright(C) 2008-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -418,7 +418,8 @@ struct spi_dev_s #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -429,15 +430,35 @@ extern "C" { * Description: * Initialize the selected SPI port. * + * This is a generic prototype for the SPI initialize logic. Specific + * architectures may support different SPI initialization functions if, + * for example, those architectures support multiple, incompatible SPI + * implementations. In any event, the prototype of those architecture- + * specific initialization functions should be the same as + * up_spiinitialize() + * + * As an example, the LPC17xx family supports an SPI block and several SSP + * blocks that may be programmed to support the SPI function. In this + * case, the LPC17xx architecture supports these two initialization + * functions: + * + * FAR struct spi_dev_s *lpc17_spiinitialize(int port); + * FAR struct spi_dev_s *lpc17_sspinitialize(int port); + * + * Another example would be the STM32 families that support both SPI + * blocks as well as USARTs that can be configured to perform the SPI + * function as well (the STM32 USARTs do not suppor SPI as of this + * writing). + * * Input Parameter: * Port number (for hardware that has mutiple SPI interfaces) * * Returned Value: - * Valid SPI device structre reference on succcess; a NULL on failure + * Valid SPI device structure reference on succcess; a NULL on failure * ****************************************************************************/ -EXTERN FAR struct spi_dev_s *up_spiinitialize(int port); +FAR struct spi_dev_s *up_spiinitialize(int port); #undef EXTERN #if defined(__cplusplus) |