From fc4a178573f053238c8fb72621744cbe8da4c526 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 2 May 2010 21:58:00 +0000 Subject: [PATCH] Add XTI support git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2645 42af7a65-404d-4744-a932-0658087f49c3 --- configs/olimex-strp711/nettest/defconfig | 2 +- configs/olimex-strp711/src/up_enc28j60.c | 30 +++++++++++++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/configs/olimex-strp711/nettest/defconfig b/configs/olimex-strp711/nettest/defconfig index 80c48d7ac7..256f816654 100755 --- a/configs/olimex-strp711/nettest/defconfig +++ b/configs/olimex-strp711/nettest/defconfig @@ -118,7 +118,7 @@ CONFIG_STR71X_CAN=n CONFIG_STR71X_BSPI0=y CONFIG_STR71X_BSPI1=n CONFIG_STR71X_HDLC=n -CONFIG_STR71X_XTI=n +CONFIG_STR71X_XTI=y CONFIG_STR71X_GPIO0=y CONFIG_STR71X_GPIO1=y CONFIG_STR71X_GPIO2=n diff --git a/configs/olimex-strp711/src/up_enc28j60.c b/configs/olimex-strp711/src/up_enc28j60.c index cc285a3dc1..8d80e4d346 100755 --- a/configs/olimex-strp711/src/up_enc28j60.c +++ b/configs/olimex-strp711/src/up_enc28j60.c @@ -71,6 +71,7 @@ * UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60 * interrupt conflict with TMR1. */ +#warning "Need to select differnt interrupt pin.. XTI doesn't support this one" /**************************************************************************** * Included Files @@ -90,6 +91,7 @@ #include "chip.h" #include "up_arch.h" #include "up_internal.h" +#include "str71x_internal.h" #ifdef CONFIG_NET_ENC28J60 @@ -105,6 +107,10 @@ # error "Need CONFIG_STR71X_BSPI0 in the configuration" #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 * interrupt conflict with TIM1. */ @@ -123,7 +129,7 @@ #define ENC28J60_DEVNO 0 /* Only one ENC28J60 */ #define ENC28J60_IRQ 0 /* NEEDED!!!!!!!!!!!!!!!! */ -/* Debug ********************************************************************/ +#warning "Eventually need to fix XTI IRQ number!" /**************************************************************************** * Private Data @@ -148,34 +154,42 @@ void up_netinitialize(void) /* 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); if (!spi) { - ndbg("up_netinitialize: Failed to initialize SPI port %d\n", + ndbg("Failed to initialize SPI port %d\n", ENC28J60_SPI_PORTNO); 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); /* 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); -#warning "Need to implement IRQ interrupt before we can use this" ret = enc_initialize(spi, ENC28J60_DEVNO, ENC28J60_IRQ); 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); 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); } #endif /* CONFIG_NET_ENC28J60 */