mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
Add XTI support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2645 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -118,7 +118,7 @@ CONFIG_STR71X_CAN=n
|
|||||||
CONFIG_STR71X_BSPI0=y
|
CONFIG_STR71X_BSPI0=y
|
||||||
CONFIG_STR71X_BSPI1=n
|
CONFIG_STR71X_BSPI1=n
|
||||||
CONFIG_STR71X_HDLC=n
|
CONFIG_STR71X_HDLC=n
|
||||||
CONFIG_STR71X_XTI=n
|
CONFIG_STR71X_XTI=y
|
||||||
CONFIG_STR71X_GPIO0=y
|
CONFIG_STR71X_GPIO0=y
|
||||||
CONFIG_STR71X_GPIO1=y
|
CONFIG_STR71X_GPIO1=y
|
||||||
CONFIG_STR71X_GPIO2=n
|
CONFIG_STR71X_GPIO2=n
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
* UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
|
* UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
|
||||||
* interrupt conflict with TMR1.
|
* interrupt conflict with TMR1.
|
||||||
*/
|
*/
|
||||||
|
#warning "Need to select differnt interrupt pin.. XTI doesn't support this one"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
@@ -90,6 +91,7 @@
|
|||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
#include "str71x_internal.h"
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ENC28J60
|
#ifdef CONFIG_NET_ENC28J60
|
||||||
|
|
||||||
@@ -105,6 +107,10 @@
|
|||||||
# error "Need CONFIG_STR71X_BSPI0 in the configuration"
|
# error "Need CONFIG_STR71X_BSPI0 in the configuration"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_STR71X_XTI
|
||||||
|
# error "Need CONFIG_STR71X_XTI in the configuration"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
|
/* UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
|
||||||
* interrupt conflict with TIM1.
|
* interrupt conflict with TIM1.
|
||||||
*/
|
*/
|
||||||
@@ -123,7 +129,7 @@
|
|||||||
#define ENC28J60_DEVNO 0 /* Only one ENC28J60 */
|
#define ENC28J60_DEVNO 0 /* Only one ENC28J60 */
|
||||||
#define ENC28J60_IRQ 0 /* NEEDED!!!!!!!!!!!!!!!! */
|
#define ENC28J60_IRQ 0 /* NEEDED!!!!!!!!!!!!!!!! */
|
||||||
|
|
||||||
/* Debug ********************************************************************/
|
#warning "Eventually need to fix XTI IRQ number!"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@@ -148,34 +154,42 @@ void up_netinitialize(void)
|
|||||||
|
|
||||||
/* Get the SPI port */
|
/* Get the SPI port */
|
||||||
|
|
||||||
nvdbg("up_netinitialize: Initializing SPI port %d\n", ENC28J60_SPI_PORTNO);
|
nvdbg("Initializing SPI port %d\n", ENC28J60_SPI_PORTNO);
|
||||||
|
|
||||||
spi = up_spiinitialize(ENC28J60_SPI_PORTNO);
|
spi = up_spiinitialize(ENC28J60_SPI_PORTNO);
|
||||||
if (!spi)
|
if (!spi)
|
||||||
{
|
{
|
||||||
ndbg("up_netinitialize: Failed to initialize SPI port %d\n",
|
ndbg("Failed to initialize SPI port %d\n",
|
||||||
ENC28J60_SPI_PORTNO);
|
ENC28J60_SPI_PORTNO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nvdbg("up_netinitialize: Successfully initialized SPI port %d\n",
|
/* Configure the XTI for the ENC28J60 interrupt. */
|
||||||
|
|
||||||
|
ret = str7x_xticonfig(ENC28J60_IRQ, false);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
ndbg("Failed configure interrupt for IRQ %d: %d\n", ENC28J60_IRQ, ret);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nvdbg("Successfully initialized SPI port %d\n",
|
||||||
ENC28J60_SPI_PORTNO);
|
ENC28J60_SPI_PORTNO);
|
||||||
|
|
||||||
/* Bind the SPI port to the ENC28J60 driver */
|
/* Bind the SPI port to the ENC28J60 driver */
|
||||||
|
|
||||||
nvdbg("up_netinitialize: Binding SPI port %d to ENC28J60 device %d\n",
|
nvdbg("Binding SPI port %d to ENC28J60 device %d\n",
|
||||||
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO);
|
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO);
|
||||||
|
|
||||||
#warning "Need to implement IRQ interrupt before we can use this"
|
|
||||||
ret = enc_initialize(spi, ENC28J60_DEVNO, ENC28J60_IRQ);
|
ret = enc_initialize(spi, ENC28J60_DEVNO, ENC28J60_IRQ);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ndbg("up_netinitialize: Failed to bind SPI port %d ENC28J60 device %d: %d\n",
|
ndbg("Failed to bind SPI port %d ENC28J60 device %d: %d\n",
|
||||||
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO, ret);
|
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO, ret);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nvdbg("up_netinitialize: Successfuly bound SPI port %d ENC28J60 device %d\n",
|
nvdbg("Successfuly bound SPI port %d ENC28J60 device %d\n",
|
||||||
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO);
|
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NET_ENC28J60 */
|
#endif /* CONFIG_NET_ENC28J60 */
|
||||||
|
|||||||
Reference in New Issue
Block a user