LPC17xx SPI and SSP initialization functions both called up_spiinitialize(); Changed to lpc17_spinitialize() and lpc17_sspinitialize().

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5809 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-04-01 15:02:22 +00:00
parent 971c73c6d3
commit 40a6b0438e
5 changed files with 46 additions and 14 deletions

View File

@ -56,7 +56,7 @@
typedef FAR void *DMA_HANDLE; 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 * 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 * 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 * of the transfer: Zero indicates a successful tranfers. On failure, a negated

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/lpc17xx/lpc17_spi.c * 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> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * 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: * Description:
* Initialize the selected SPI port * Initialize the selected SPI port.
* *
* Input Parameter: * Input Parameter:
* Port number (for hardware that has mutiple SPI interfaces) * 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; FAR struct lpc17_spidev_s *priv = &g_spidev;
irqstate_t flags; irqstate_t flags;

View File

@ -70,6 +70,22 @@ extern "C"
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************
* 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 * Name: lpc17_spiselect, lpc17_status, and lpc17_spicmddata
* *
@ -77,7 +93,7 @@ extern "C"
* These external functions must be provided by board-specific logic. They are * These external functions must be provided by board-specific logic. They are
* implementations of the select, status, and cmddata methods of the SPI interface * 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 * 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: * this common SPI logic on your board:
* *
* 1. Provide logic in lpc17_boardinitialize() to configure SPI chip select pins. * 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 * lpc17_spicmddata() functions in your board-specific logic. This function
* will perform cmd/data selection operations using GPIOs in the way your * will perform cmd/data selection operations using GPIOs in the way your
* board is configured. * 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 * 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(), * SPI driver to higher level logic (e.g., calling mmcsd_spislotinitialize(),
* for example, will bind the SPI driver to the SPI MMC/SD driver). * for example, will bind the SPI driver to the SPI MMC/SD driver).
* *

View File

@ -814,10 +814,10 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp1initialize(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_spiinitialize * Name: lpc17_sspinitialize
* *
* Description: * Description:
* Initialize the selected SPI port * Initialize the selected SSP port.
* *
* Input Parameter: * Input Parameter:
* Port number (for hardware that has mutiple SPI interfaces) * 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; FAR struct lpc17_sspdev_s *priv;
uint32_t regval; uint32_t regval;

View File

@ -70,6 +70,22 @@ extern "C"
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************
* 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 * Name: lpc17_ssp0/ssp1select, lpc17_ssp0/ssp1status, and lpc17_ssp0/ssp1cmddata
* *
@ -77,7 +93,7 @@ extern "C"
* These external functions must be provided by board-specific logic. They are * These external functions must be provided by board-specific logic. They are
* implementations of the select, status, and cmddata methods of the SPI interface * 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 * 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: * this common SPI logic on your board:
* *
* 1. Provide logic in lpc17_boardinitialize() to configure SSP chip select pins. * 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 * lpc17_ssp0/ssp1cmddata() functions in your board-specific logic. These
* functions will perform cmd/data selection operations using GPIOs in the way * functions will perform cmd/data selection operations using GPIOs in the way
* your board is configured. * 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 * 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(), * SSP driver to higher level logic (e.g., calling mmcsd_spislotinitialize(),
* for example, will bind the SSP driver to the SPI MMC/SD driver). * for example, will bind the SSP driver to the SPI MMC/SD driver).
* *