2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/lpc17_40_ssp.c
|
2014-02-09 22:56:20 +01:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2014-02-09 22:56:20 +01:00
|
|
|
* Included Files
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2015-05-08 22:43:30 +02:00
|
|
|
#include <nuttx/arch.h>
|
2014-02-09 22:56:20 +01:00
|
|
|
#include <nuttx/spi/spi.h>
|
|
|
|
#ifdef CONFIG_SPI_CALLBACK
|
|
|
|
#include <nuttx/irq.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <arch/board/board.h>
|
|
|
|
|
2020-05-01 03:20:29 +02:00
|
|
|
#include "arm_arch.h"
|
2014-02-09 22:56:20 +01:00
|
|
|
#include "chip.h"
|
2019-07-11 18:50:00 +02:00
|
|
|
#include "lpc17_40_gpio.h"
|
|
|
|
#include "lpc17_40_ssp.h"
|
2014-02-09 22:56:20 +01:00
|
|
|
#include "lpc1766stk.h"
|
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
#if defined(CONFIG_LPC17_40_SSP0) || defined(CONFIG_LPC17_40_SSP1)
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2015-04-08 17:15:17 +02:00
|
|
|
* Pre-processor Definitions
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2014-02-09 22:56:20 +01:00
|
|
|
/* Configuration ************************************************************/
|
|
|
|
|
2015-10-01 19:08:07 +02:00
|
|
|
#undef HAVE_SPI_CALLBACK
|
2014-02-09 22:56:20 +01:00
|
|
|
#ifdef CONFIG_SPI_CALLBACK
|
2019-07-11 18:50:00 +02:00
|
|
|
# ifndef CONFIG_LPC17_40_GPIOIRQ
|
|
|
|
# warning "CONFIG_LPC17_40_GPIOIRQ is required to support CONFIG_SPI_CALLBACK"
|
2015-10-01 19:08:07 +02:00
|
|
|
# else
|
|
|
|
# define HAVE_SPI_CALLBACK 1
|
2014-02-09 22:56:20 +01:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Debug ********************************************************************/
|
2019-08-13 18:08:49 +02:00
|
|
|
|
2014-02-09 22:56:20 +01:00
|
|
|
/* Dump GPIO registers */
|
|
|
|
|
2016-06-15 17:27:52 +02:00
|
|
|
#ifdef CONFIG_DEBUG_GPIO_INFO
|
2019-07-11 18:50:00 +02:00
|
|
|
# define ssp_dumpssp0gpio(m) lpc17_40_dumpgpio(LPC1766STK_LCD_CS, m)
|
|
|
|
# define ssp_dumpssp1gpio(m) lpc17_40_dumpgpio(LPC1766STK_MMC_CS, m)
|
2014-02-09 22:56:20 +01:00
|
|
|
#else
|
|
|
|
# define ssp_dumpssp0gpio(m)
|
|
|
|
# define ssp_dumpssp1gpio(m)
|
|
|
|
#endif
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2014-02-09 22:56:20 +01:00
|
|
|
* Private Types
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
|
|
|
/* This structure describes on media change callback */
|
|
|
|
|
2015-10-01 19:08:07 +02:00
|
|
|
#ifdef HAVE_SPI_CALLBACK
|
2019-07-11 18:50:00 +02:00
|
|
|
struct lpc17_40_mediachange_s
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
|
|
|
spi_mediachange_t callback; /* The media change callback */
|
|
|
|
FAR void *arg; /* Callback argument */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2014-02-09 22:56:20 +01:00
|
|
|
* Private Data
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
|
|
|
/* Registered media change callback */
|
|
|
|
|
2015-10-01 19:08:07 +02:00
|
|
|
#ifdef HAVE_SPI_CALLBACK
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP0
|
|
|
|
static struct lpc17_40_mediachange_s g_ssp0callback;
|
2014-02-09 22:56:20 +01:00
|
|
|
#endif
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP1
|
|
|
|
static struct lpc17_40_mediachange_s g_ssp1callback;
|
2014-02-09 22:56:20 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2014-02-09 22:56:20 +01:00
|
|
|
* Private Functions
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2014-02-09 22:56:20 +01:00
|
|
|
* Name: ssp_cdirqsetup
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Setup to receive a card detection interrupt
|
|
|
|
*
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2015-10-01 19:08:07 +02:00
|
|
|
#if 0 /* #ifdef HAVE_SPI_CALLBACK */
|
2014-02-09 22:56:20 +01:00
|
|
|
static void ssp_cdirqsetup(int irq, xcpt_t irqhandler)
|
|
|
|
{
|
|
|
|
irqstate_t flags;
|
|
|
|
|
|
|
|
/* Disable interrupts until we are done */
|
|
|
|
|
2016-02-13 19:37:46 +01:00
|
|
|
flags = enter_critical_section();
|
2014-02-09 22:56:20 +01:00
|
|
|
|
|
|
|
/* Configure the interrupt. Either attach and enable the new
|
|
|
|
* interrupt or disable and detach the old interrupt handler.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (irqhandler)
|
|
|
|
{
|
|
|
|
/* Attach then enable the new interrupt handler */
|
|
|
|
|
2020-01-02 17:49:34 +01:00
|
|
|
irq_attach(irq, irqhandler, NULL);
|
2014-02-09 22:56:20 +01:00
|
|
|
up_enable_irq(irq);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Disable then detach the old interrupt handler */
|
|
|
|
|
|
|
|
up_disable_irq(irq);
|
2020-01-02 17:49:34 +01:00
|
|
|
irq_detach(irq);
|
2014-02-09 22:56:20 +01:00
|
|
|
}
|
2015-05-08 22:43:30 +02:00
|
|
|
|
2016-02-13 19:37:46 +01:00
|
|
|
leave_critical_section(flags);
|
2014-02-09 22:56:20 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2014-02-09 22:56:20 +01:00
|
|
|
* Name: ssp0/1_cdinterrupt
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle card detection interrupt
|
|
|
|
*
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2015-10-01 19:08:07 +02:00
|
|
|
#if 0 /* ifdef HAVE_SPI_CALLBACK */
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP0
|
2014-02-09 22:56:20 +01:00
|
|
|
static int ssp0_cdinterrupt(int irq, FAR void *context)
|
|
|
|
{
|
|
|
|
/* Invoke the media change callback */
|
|
|
|
|
|
|
|
if (g_ssp0callback.callback)
|
|
|
|
{
|
|
|
|
g_ssp0callback.callback(g_ssp0callback.arg);
|
|
|
|
}
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP1
|
2014-02-09 22:56:20 +01:00
|
|
|
static int ssp1_cdinterrupt(int irq, FAR void *context)
|
|
|
|
{
|
|
|
|
/* Invoke the media change callback */
|
|
|
|
|
|
|
|
if (g_ssp1callback.callback)
|
|
|
|
{
|
|
|
|
g_ssp1callback.callback(g_ssp1callback.arg);
|
|
|
|
}
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2014-02-09 22:56:20 +01:00
|
|
|
* Public Functions
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2016-02-04 17:24:32 +01:00
|
|
|
* Name: lpc1766stk_sspdev_initialize
|
2014-02-09 22:56:20 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called to configure SPI chip select GPIO pins for the LPC1766-STK.
|
|
|
|
*
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2016-02-04 17:24:32 +01:00
|
|
|
void weak_function lpc1766stk_sspdev_initialize(void)
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
2019-08-13 18:08:49 +02:00
|
|
|
/* Configure the SSP0 chip select GPIOs.
|
|
|
|
* Only the Nokia LCD is connected to SSP0
|
|
|
|
*/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP0
|
2014-02-09 22:56:20 +01:00
|
|
|
ssp_dumpssp0gpio("BEFORE SSP0 Initialization");
|
2019-07-11 18:50:00 +02:00
|
|
|
lpc17_40_configgpio(LPC1766STK_LCD_CS);
|
2014-02-09 22:56:20 +01:00
|
|
|
ssp_dumpssp0gpio("AFTER SSP0 Initialization");
|
|
|
|
#endif
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/* Configure SSP1 chip select GPIOs.
|
|
|
|
* Only the SD/MMC card slot is connected to SSP1
|
|
|
|
*/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP1
|
2014-02-09 22:56:20 +01:00
|
|
|
ssp_dumpssp0gpio("BEFORE SSP1 Initialization");
|
2019-07-11 18:50:00 +02:00
|
|
|
lpc17_40_configgpio(LPC1766STK_MMC_CS);
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/* Also configure the SD/MMC power GPIO (but leave power off).
|
|
|
|
* This really has nothing to do with SSP, but does belong with other
|
|
|
|
* SD/MMC GPIO configuration settings.
|
2014-02-09 22:56:20 +01:00
|
|
|
*/
|
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
lpc17_40_configgpio(LPC1766STK_MMC_PWR);
|
2014-02-09 22:56:20 +01:00
|
|
|
ssp_dumpssp0gpio("AFTER SSP1 Initialization");
|
|
|
|
#endif
|
|
|
|
|
2015-10-01 19:08:07 +02:00
|
|
|
#ifdef HAVE_SPI_CALLBACK
|
2014-02-09 22:56:20 +01:00
|
|
|
/* If there were any CD detect pins for the LPC1766-STK, this is where
|
|
|
|
* they would be configured.
|
|
|
|
*/
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2019-07-11 18:50:00 +02:00
|
|
|
* Name: lpc17_40_ssp0/ssp1select and lpc17_40_ssp0/ssp1status
|
2014-02-09 22:56:20 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2019-08-13 18:08:49 +02:00
|
|
|
* The external functions, lpc17_40_ssp0/ssp1select and
|
|
|
|
* lpc17_40_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/spi.h).
|
|
|
|
* All other methods (including lpc17_40_sspbus_initialize())
|
|
|
|
* are provided by common LPC17xx/LPC40xx logic.
|
|
|
|
* To use this common SPI logic on your board:
|
2014-02-09 22:56:20 +01:00
|
|
|
*
|
2019-08-13 18:08:49 +02:00
|
|
|
* 1. Provide logic in lpc17_40_boardinitialize() to configure SPI/SSP chip
|
|
|
|
* select pins.
|
|
|
|
* 2. Provide lpc17_40_ssp0/ssp1select() and lpc17_40_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 lpc17_40_sspbus_initialize() in your low level
|
|
|
|
* application initialization logic
|
|
|
|
* 4. The handle returned by lpc17_40_sspbus_initialize() may then be used
|
|
|
|
* to bind the SPI driver to higher level logic (e.g., calling
|
2014-02-09 22:56:20 +01:00
|
|
|
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
|
|
|
|
* the SPI MMC/SD driver).
|
|
|
|
*
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP0
|
2019-08-13 18:08:49 +02:00
|
|
|
void lpc17_40_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|
|
|
bool selected)
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
2019-08-13 18:08:49 +02:00
|
|
|
spiinfo("devid: %d CS: %s\n", (int)devid,
|
|
|
|
selected ? "assert" : "de-assert");
|
2017-04-29 20:26:52 +02:00
|
|
|
if (devid == SPIDEV_DISPLAY(0))
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
|
|
|
/* Assert/de-assert the CS pin to the card */
|
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
ssp_dumpssp0gpio("lpc17_40_ssp0select() Entry");
|
|
|
|
lpc17_40_gpiowrite(LPC1766STK_LCD_CS, !selected);
|
|
|
|
ssp_dumpssp0gpio("lpc17_40_ssp0select() Exit");
|
2014-02-09 22:56:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
uint8_t lpc17_40_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid)
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
2016-06-15 18:41:13 +02:00
|
|
|
spiinfo("Returning nothing\n");
|
2014-02-09 22:56:20 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP1
|
2019-08-13 18:08:49 +02:00
|
|
|
void lpc17_40_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|
|
|
bool selected)
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
2019-08-13 18:08:49 +02:00
|
|
|
spiinfo("devid: %d CS: %s\n", (int)devid,
|
|
|
|
selected ? "assert" : "de-assert");
|
2017-04-29 20:26:52 +02:00
|
|
|
if (devid == SPIDEV_MMCSD(0))
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
|
|
|
/* Assert/de-assert the CS pin to the card */
|
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
ssp_dumpssp1gpio("lpc17_40_ssp1select() Entry");
|
|
|
|
lpc17_40_gpiowrite(LPC1766STK_MMC_CS, !selected);
|
|
|
|
ssp_dumpssp1gpio("lpc17_40_ssp1select() Exit");
|
2014-02-09 22:56:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
uint8_t lpc17_40_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid)
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
2016-06-15 18:41:13 +02:00
|
|
|
spiinfo("Returning SPI_STATUS_PRESENT\n");
|
2014-02-09 22:56:20 +01:00
|
|
|
return SPI_STATUS_PRESENT;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2019-07-11 18:50:00 +02:00
|
|
|
* Name: lpc17_40_ssp0/1register
|
2014-02-09 22:56:20 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* If the board supports a card detect callback to inform the SPI-based
|
2020-02-23 09:50:23 +01:00
|
|
|
* MMC/SD driver when an SD card is inserted or removed, then
|
2014-02-09 22:56:20 +01:00
|
|
|
* CONFIG_SPI_CALLBACK should be defined and the following function(s) must
|
2020-02-23 09:50:23 +01:00
|
|
|
* must be implemented. These functions implements the registercallback
|
2014-02-09 22:56:20 +01:00
|
|
|
* method of the SPI interface (see include/nuttx/spi/spi.h for details)
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* dev - Device-specific state data
|
2020-02-22 19:31:14 +01:00
|
|
|
* callback - The function to call on the media change
|
2014-02-09 22:56:20 +01:00
|
|
|
* arg - A caller provided value to return with the callback
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* 0 on success; negated errno on failure.
|
|
|
|
*
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2014-02-09 22:56:20 +01:00
|
|
|
|
|
|
|
#ifdef CONFIG_SPI_CALLBACK
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP0
|
2014-02-09 22:56:20 +01:00
|
|
|
/* If there were any CD detect pins on the LPC1766-STK, this is how the
|
|
|
|
* would be configured.
|
|
|
|
*/
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
int lpc17_40_ssp0register(FAR struct spi_dev_s *dev,
|
|
|
|
spi_mediachange_t callback,
|
|
|
|
void *arg)
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
|
|
|
/* Save the callback information */
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
g_ssp0callback.callback = callback;
|
|
|
|
g_ssp0callback.arg = arg;
|
|
|
|
|
|
|
|
/* Setup the interrupt */
|
|
|
|
|
|
|
|
spi_cdirqsetup(LPC1766STK_SPICD_IRQ, ssp0_cdinterrupt);
|
|
|
|
#endif
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-07-11 18:50:00 +02:00
|
|
|
#ifdef CONFIG_LPC17_40_SSP1
|
2019-08-13 18:08:49 +02:00
|
|
|
int lpc17_40_ssp1register(FAR struct spi_dev_s *dev,
|
|
|
|
spi_mediachange_t callback,
|
|
|
|
void *arg)
|
2014-02-09 22:56:20 +01:00
|
|
|
{
|
|
|
|
/* Save the callback information */
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
g_ssp1callback.callback = callback;
|
|
|
|
g_ssp1callback.arg = arg;
|
|
|
|
|
|
|
|
/* Setup the interrupt */
|
|
|
|
|
|
|
|
spi_cdirqsetup(LPC1766STK_SPICD_IRQ, ssp1_cdinterrupt);
|
|
|
|
#endif
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
2019-07-11 18:50:00 +02:00
|
|
|
#endif /* CONFIG_LPC17_40_SSP0 || CONFIG_LPC17_40_SSP1 */
|