Updates/fixes related to ENC28J60, Kconfigs, and fire-stm32v2

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5128 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-09-11 16:50:16 +00:00
parent 870b6511ea
commit 3a0e0aa45b
19 changed files with 135 additions and 223 deletions
+8 -1
View File
@@ -3315,4 +3315,11 @@
require DMA-capable memory. If CONFIG_FAT_DMAMEMORY is defined, require DMA-capable memory. If CONFIG_FAT_DMAMEMORY is defined,
then the FAT FS will use platform-provided DMA memory allocators then the FAT FS will use platform-provided DMA memory allocators
to allocate the block driver I/O buffers. to allocate the block driver I/O buffers.
* CONFIG_NET_ENC28J60 renamed CONFIG_ENC28J60 to be consistent
in all places.
* drivers/enc28j60.c, include/nuttx/net/enc28j60.h, and
olimex-strp711/src/up_enc28j60.c: No longer passes IRQ number
as a parameters. Instead now passes a call table to manage
ENC28J60 GPIO interrupts. That is because GPIO interrupts are
handled in different ways by different MCUs and some do not
support IRQ numbers for GPIO interrupts.
+1 -1
View File
@@ -4963,7 +4963,7 @@ build
<h3>ENC28J60 Ethernet Driver Configuration Settings</h3> <h3>ENC28J60 Ethernet Driver Configuration Settings</h3>
<ul> <ul>
<li> <li>
<code>CONFIG_NET_ENC28J60</code>: Enabled ENC28J60 support <code>CONFIG_ENC28J60</code>: Enabled ENC28J60 support
</li> </li>
<li> <li>
<code>CONFIG_ENC28J60_SPIMODE</code>: Controls the SPI mode <code>CONFIG_ENC28J60_SPIMODE</code>: Controls the SPI mode
+1 -1
View File
@@ -950,7 +950,7 @@ defconfig -- This is a configuration file similar to the Linux
ENC28J60 Ethernet Driver Configuration Settings: ENC28J60 Ethernet Driver Configuration Settings:
CONFIG_NET_ENC28J60 - Enabled ENC28J60 support CONFIG_ENC28J60 - Enabled ENC28J60 support
CONFIG_ENC28J60_SPIMODE - Controls the SPI mode CONFIG_ENC28J60_SPIMODE - Controls the SPI mode
CONFIG_ENC28J60_FREQUENCY - Define to use a different bus frequency CONFIG_ENC28J60_FREQUENCY - Define to use a different bus frequency
CONFIG_ENC28J60_NINTERFACES - Specifies the number of physical ENC28J60 CONFIG_ENC28J60_NINTERFACES - Specifies the number of physical ENC28J60
+4 -4
View File
@@ -256,14 +256,14 @@
* PIN NAME SIGNAL NOTES * PIN NAME SIGNAL NOTES
* --- ------ -------------- ------------------------------------------------------------------- * --- ------ -------------- -------------------------------------------------------------------
* *
* 68 PA9 PA9-US1-TX MAX3232, DB9 D8, Requires CONFIG_STM32_USART1_REMAP * 68 PA9 PA9-US1-TX MAX3232, DB9 D8, Requires !CONFIG_STM32_USART1_REMAP
* 69 PA10 PA10-US1-RX MAX3232, DB9 D8, Requires CONFIG_STM32_USART1_REMAP * 69 PA10 PA10-US1-RX MAX3232, DB9 D8, Requires !CONFIG_STM32_USART1_REMAP
* 25 PA2 PA2-US2-TX MAX3232, DB9 D7, Requires !CONFIG_STM32_USART2_REMAP * 25 PA2 PA2-US2-TX MAX3232, DB9 D7, Requires !CONFIG_STM32_USART2_REMAP
* 26 PA3 PA3-US2-RX MAX3232, DB9 D7, Requires !CONFIG_STM32_USART2_REMAP * 26 PA3 PA3-US2-RX MAX3232, DB9 D7, Requires !CONFIG_STM32_USART2_REMAP
*/ */
#if defined(CONFIG_STM32_USART1) && !defined(CONFIG_STM32_USART1_REMAP) #if defined(CONFIG_STM32_USART1) && defined(CONFIG_STM32_USART1_REMAP)
# errror "USART1 requires CONFIG_STM32_USART1_REMAP=y" # errror "USART1 requires CONFIG_STM32_USART1_REMAP=n"
#endif #endif
#if defined(CONFIG_STM32_USART2) && defined(CONFIG_STM32_USART2_REMAP) #if defined(CONFIG_STM32_USART2) && defined(CONFIG_STM32_USART2_REMAP)
+24 -90
View File
@@ -131,7 +131,7 @@ CONFIG_STM32_I2C1=y
# CONFIG_STM32_IWDG is not set # CONFIG_STM32_IWDG is not set
CONFIG_STM32_PWR=y CONFIG_STM32_PWR=y
CONFIG_STM32_SDIO=y CONFIG_STM32_SDIO=y
# CONFIG_STM32_SPI1 is not set CONFIG_STM32_SPI1=y
# CONFIG_STM32_SPI2 is not set # CONFIG_STM32_SPI2 is not set
# CONFIG_STM32_SPI4 is not set # CONFIG_STM32_SPI4 is not set
# CONFIG_STM32_TIM1 is not set # CONFIG_STM32_TIM1 is not set
@@ -149,12 +149,14 @@ CONFIG_STM32_USART2=y
# CONFIG_STM32_UART5 is not set # CONFIG_STM32_UART5 is not set
CONFIG_STM32_USB=y CONFIG_STM32_USB=y
# CONFIG_STM32_WWDG is not set # CONFIG_STM32_WWDG is not set
CONFIG_STM32_SPI=y
# #
# Alternate Pin Mapping # Alternate Pin Mapping
# #
CONFIG_STM32_USART1_REMAP=y # CONFIG_STM32_USART1_REMAP is not set
# CONFIG_STM32_USART2_REMAP is not set # CONFIG_STM32_USART2_REMAP is not set
# CONFIG_STM32_SPI1_REMAP is not set
# CONFIG_STM32_I2C1_REMAP is not set # CONFIG_STM32_I2C1_REMAP is not set
# CONFIG_STM32_JTAG_DISABLE is not set # CONFIG_STM32_JTAG_DISABLE is not set
CONFIG_STM32_JTAG_FULL_ENABLE=y CONFIG_STM32_JTAG_FULL_ENABLE=y
@@ -163,6 +165,12 @@ CONFIG_STM32_JTAG_FULL_ENABLE=y
# CONFIG_STM32_FORCEPOWER is not set # CONFIG_STM32_FORCEPOWER is not set
# CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set # CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set
#
# SPI Configuration
#
# CONFIG_STM32_SPI_INTERRUPTS is not set
# CONFIG_STM32_SPI_DMA is not set
# #
# SDIO Configuration # SDIO Configuration
# #
@@ -300,71 +308,27 @@ CONFIG_DEV_NULL=y
# CONFIG_DEV_ZERO is not set # CONFIG_DEV_ZERO is not set
# CONFIG_LOOP is not set # CONFIG_LOOP is not set
# CONFIG_RAMDISK is not set # CONFIG_RAMDISK is not set
#
# CAN Driver Options
#
# CONFIG_CAN is not set # CONFIG_CAN is not set
#
# PWM Driver Options
#
# CONFIG_PWM is not set # CONFIG_PWM is not set
#
# I2C Driver Options
#
CONFIG_I2C=y CONFIG_I2C=y
# CONFIG_I2C_SLAVE is not set # CONFIG_I2C_SLAVE is not set
CONFIG_I2C_TRANSFER=y CONFIG_I2C_TRANSFER=y
# CONFIG_I2C_WRITEREAD is not set # CONFIG_I2C_WRITEREAD is not set
CONFIG_I2C_POLLED=y CONFIG_I2C_POLLED=y
# CONFIG_I2C_TRACE is not set # CONFIG_I2C_TRACE is not set
#
# SPI Driver Options
#
CONFIG_SPI=y CONFIG_SPI=y
# CONFIG_SPI_OWNBUS is not set # CONFIG_SPI_OWNBUS is not set
CONFIG_SPI_EXCHANGE=y CONFIG_SPI_EXCHANGE=y
CONFIG_SPI_CMDDATA=y # CONFIG_SPI_CMDDATA is not set
#
# RTC Driver Options
#
CONFIG_RTC=y CONFIG_RTC=y
# CONFIG_RTC_DATETIME is not set # CONFIG_RTC_DATETIME is not set
# CONFIG_RTC_HIRES is not set # CONFIG_RTC_HIRES is not set
# CONFIG_RTC_ALARM is not set # CONFIG_RTC_ALARM is not set
#
# Watchdog Driver Options
#
# CONFIG_WATCHDOG is not set # CONFIG_WATCHDOG is not set
#
# Analog Driver Options
#
# CONFIG_ANALOG is not set # CONFIG_ANALOG is not set
#
# Block-to-Character Driver Support
#
# CONFIG_BCH is not set # CONFIG_BCH is not set
#
# Input device Driver Options
#
# CONFIG_INPUT is not set # CONFIG_INPUT is not set
#
# LCD Driver Options
#
# CONFIG_LCD is not set # CONFIG_LCD is not set
#
# MMCSD Driver Options
#
CONFIG_MMCSD=y CONFIG_MMCSD=y
CONFIG_MMCSD_NSLOTS=1 CONFIG_MMCSD_NSLOTS=1
# CONFIG_MMCSD_READONLY is not set # CONFIG_MMCSD_READONLY is not set
@@ -375,42 +339,23 @@ CONFIG_MMCSD_SPI=y
CONFIG_MMCSD_SPICLOCK=20000000 CONFIG_MMCSD_SPICLOCK=20000000
CONFIG_MMCSD_SDIO=y CONFIG_MMCSD_SDIO=y
# CONFIG_SDIO_MUXBUS is not set # CONFIG_SDIO_MUXBUS is not set
#
# I2C Driver Options
#
# CONFIG_MTD is not set # CONFIG_MTD is not set
CONFIG_NETDEVICES=y
# # CONFIG_NET_DM90x0 is not set
# Network Device Driver Options CONFIG_ENC28J60=y
# CONFIG_ENC28J60_NINTERFACES=1
# CONFIG_NETDEVICES is not set CONFIG_ENC28J60_SPIMODE=2
CONFIG_ENC28J60_FREQUENCY=20000000
# CONFIG_ENC28J60_STATS is not set
# CONFIG_ENC28J60_HALFDUPPLEX is not set
# CONFIG_NET_E1000 is not set
# CONFIG_NET_SLIP is not set # CONFIG_NET_SLIP is not set
# CONFIG_NET_VNET is not set
#
# Pipe Options
#
# CONFIG_PIPES is not set # CONFIG_PIPES is not set
#
# Power Management Options
#
# CONFIG_PM is not set # CONFIG_PM is not set
# CONFIG_POWER is not set # CONFIG_POWER is not set
#
# Sensor Driver Options
#
# CONFIG_SENSORS is not set # CONFIG_SENSORS is not set
#
# Osmocom-bb Sercomm Driver Options
#
# CONFIG_SERCOMM_CONSOLE is not set # CONFIG_SERCOMM_CONSOLE is not set
#
# Serial Driver Options
#
CONFIG_SERIAL=y CONFIG_SERIAL=y
# CONFIG_LOWLEVEL_CONSOLE is not set # CONFIG_LOWLEVEL_CONSOLE is not set
# CONFIG_16550_UART is not set # CONFIG_16550_UART is not set
@@ -441,10 +386,6 @@ CONFIG_USART2_BAUD=115200
CONFIG_USART2_BITS=8 CONFIG_USART2_BITS=8
CONFIG_USART2_PARITY=0 CONFIG_USART2_PARITY=0
CONFIG_USART2_2STOP=0 CONFIG_USART2_2STOP=0
#
# USB Device Driver Options
#
CONFIG_USBDEV=y CONFIG_USBDEV=y
# CONFIG_USBDEV_COMPOSITE is not set # CONFIG_USBDEV_COMPOSITE is not set
# CONFIG_USBDEV_ISOCHRONOUS is not set # CONFIG_USBDEV_ISOCHRONOUS is not set
@@ -468,15 +409,7 @@ CONFIG_USBMSC_PRODUCTID=0x5342
CONFIG_USBMSC_PRODUCTSTR="USBdev Storage" CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
CONFIG_USBMSC_VERSIONNO=0x0399 CONFIG_USBMSC_VERSIONNO=0x0399
CONFIG_USBMSC_REMOVABLE=y CONFIG_USBMSC_REMOVABLE=y
#
# USB Host Driver Options
#
# CONFIG_USBHOST is not set # CONFIG_USBHOST is not set
#
# Wireless Device Driver Options
#
# CONFIG_WIRELESS is not set # CONFIG_WIRELESS is not set
# #
@@ -495,7 +428,7 @@ CONFIG_NET=y
# CONFIG_NET_NOINTS is not set # CONFIG_NET_NOINTS is not set
# CONFIG_NET_MULTIBUFFER is not set # CONFIG_NET_MULTIBUFFER is not set
# CONFIG_NET_IPv6 is not set # CONFIG_NET_IPv6 is not set
CONFIG_NSOCKET_DESCRIPTORS=0 CONFIG_NSOCKET_DESCRIPTORS=16
CONFIG_NET_NACTIVESOCKETS=16 CONFIG_NET_NACTIVESOCKETS=16
CONFIG_NET_SOCKOPTS=y CONFIG_NET_SOCKOPTS=y
CONFIG_NET_BUFSIZE=562 CONFIG_NET_BUFSIZE=562
@@ -512,7 +445,7 @@ CONFIG_NET_UDP_CHECKSUMS=y
CONFIG_NET_UDP_CONNS=8 CONFIG_NET_UDP_CONNS=8
CONFIG_NET_BROADCAST=y CONFIG_NET_BROADCAST=y
CONFIG_NET_ICMP=y CONFIG_NET_ICMP=y
# CONFIG_NET_ICMP_PING is not set CONFIG_NET_ICMP_PING=y
# CONFIG_NET_PINGADDRCONF is not set # CONFIG_NET_PINGADDRCONF is not set
# CONFIG_NET_IGMP is not set # CONFIG_NET_IGMP is not set
CONFIG_NET_STATISTICS=y CONFIG_NET_STATISTICS=y
@@ -532,6 +465,7 @@ CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y CONFIG_FAT_LFN=y
CONFIG_FAT_MAXFNAME=32 CONFIG_FAT_MAXFNAME=32
# CONFIG_FS_FATTIME is not set # CONFIG_FS_FATTIME is not set
# CONFIG_FAT_DMAMEMORY is not set
# CONFIG_FS_RAMMAP is not set # CONFIG_FS_RAMMAP is not set
# CONFIG_NFS is not set # CONFIG_NFS is not set
# CONFIG_FS_NXFFS is not set # CONFIG_FS_NXFFS is not set
+1 -1
View File
@@ -56,7 +56,7 @@ else
CSRCS += up_userleds.c CSRCS += up_userleds.c
endif endif
ifeq ($(CONFIG_NET_ENC28J60),y) ifeq ($(CONFIG_ENC28J60),y)
CSRCS += up_enc28j60.c CSRCS += up_enc28j60.c
endif endif
+3 -3
View File
@@ -191,7 +191,7 @@
* 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
*/ */
#ifndef CONFIG_NET_ENC28J60 #ifndef CONFIG_ENC28J60
# define GPIO_ENC28J60_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\ # define GPIO_ENC28J60_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4) GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#endif #endif
@@ -210,11 +210,11 @@
* 4 PE5 (no name) 10Mbps ENC28J60 Interrupt * 4 PE5 (no name) 10Mbps ENC28J60 Interrupt
*/ */
#if defined(CONFIG_STM32_FSMC) && defined(CONFIG_NET_ENC28J60) #if defined(CONFIG_STM32_FSMC) && defined(CONFIG_ENC28J60)
# warning "TFT LCD and ENCJ2860 shared PE1" # warning "TFT LCD and ENCJ2860 shared PE1"
#endif #endif
#ifdef CONFIG_NET_ENC28J60 #ifdef CONFIG_ENC28J60
# define GPIO_ENC28J60_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\ # define GPIO_ENC28J60_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4) GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
# define GPIO_ENC28J60_RESET (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\ # define GPIO_ENC28J60_RESET (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+10 -8
View File
@@ -193,7 +193,8 @@ static struct pm_callback_s g_ledscb =
* Name: led_clrbits * Name: led_clrbits
* *
* Description: * Description:
* Clear all LEDs to the bit encoded state * Clear all LEDs to the bit encoded state. The LEDs are pulled up and,
* hence, active low.
* *
****************************************************************************/ ****************************************************************************/
@@ -201,17 +202,17 @@ static inline void led_clrbits(unsigned int clrbits)
{ {
if ((clrbits & FIRE_LED1) != 0) if ((clrbits & FIRE_LED1) != 0)
{ {
stm32_gpiowrite(GPIO_LED1, false); stm32_gpiowrite(GPIO_LED1, true);
} }
if ((clrbits & FIRE_LED2) != 0) if ((clrbits & FIRE_LED2) != 0)
{ {
stm32_gpiowrite(GPIO_LED2, false); stm32_gpiowrite(GPIO_LED2, true);
} }
if ((clrbits & FIRE_LED3) != 0) if ((clrbits & FIRE_LED3) != 0)
{ {
stm32_gpiowrite(GPIO_LED3, false); stm32_gpiowrite(GPIO_LED3, true);
} }
} }
@@ -219,7 +220,8 @@ static inline void led_clrbits(unsigned int clrbits)
* Name: led_setbits * Name: led_setbits
* *
* Description: * Description:
* Set all LEDs to the bit encoded state * Set all LEDs to the bit encoded state. The LEDs are pulled up and,
* hence, active low.
* *
****************************************************************************/ ****************************************************************************/
@@ -227,17 +229,17 @@ static inline void led_setbits(unsigned int setbits)
{ {
if ((setbits & FIRE_LED1) != 0) if ((setbits & FIRE_LED1) != 0)
{ {
stm32_gpiowrite(GPIO_LED1, true); stm32_gpiowrite(GPIO_LED1, false);
} }
if ((setbits & FIRE_LED2) != 0) if ((setbits & FIRE_LED2) != 0)
{ {
stm32_gpiowrite(GPIO_LED2, true); stm32_gpiowrite(GPIO_LED2, false);
} }
if ((setbits & FIRE_LED3) != 0) if ((setbits & FIRE_LED3) != 0)
{ {
stm32_gpiowrite(GPIO_LED3, true); stm32_gpiowrite(GPIO_LED3, false);
} }
} }
+16 -15
View File
@@ -63,9 +63,9 @@
#include "chip.h" #include "chip.h"
#include "up_arch.h" #include "up_arch.h"
#include "up_internal.h" #include "up_internal.h"
#include "fire_internal.h" #include "fire-internal.h"
#ifdef CONFIG_NET_ENC28J60 #ifdef CONFIG_ENC28J60
/**************************************************************************** /****************************************************************************
* Definitions * Definitions
@@ -110,9 +110,9 @@ struct stm32_lower_s
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static int up_attach(FAR struct enc_lower_s *lower, xcpt_t handler); static int up_attach(FAR const struct enc_lower_s *lower, xcpt_t handler);
static void up_enable(FAR struct enc_lower_s *lower); static void up_enable(FAR const struct enc_lower_s *lower);
static void up_disable(FAR struct enc_lower_s *lower); static void up_disable(FAR const struct enc_lower_s *lower);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@@ -123,13 +123,15 @@ static void up_disable(FAR struct enc_lower_s *lower);
* the ENC28J60 GPIO interrupt. * the ENC28J60 GPIO interrupt.
*/ */
static const struct enc_lower_s g_enclower = static struct stm32_lower_s g_enclower =
{ {
.lower =
{ {
.attach = up_attach, .attach = up_attach,
.enable = up_enable, .enable = up_enable,
.disable = up_disable .disable = up_disable
} },
.handler = NULL,
}; };
/**************************************************************************** /****************************************************************************
@@ -140,25 +142,25 @@ static const struct enc_lower_s g_enclower =
* Name: struct enc_lower_s methods * Name: struct enc_lower_s methods
****************************************************************************/ ****************************************************************************/
static int up_attach(FAR struct enc_lower_s *lower, xcpt_t handler) static int up_attach(FAR const struct enc_lower_s *lower, xcpt_t handler)
{ {
FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower; FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower;
/* Just save the handler for use when the interrupt is enabled */ /* Just save the handler for use when the interrupt is enabled */
priv-handler = handler; priv->handler = handler;
return OK; return OK;
} }
static void up_enable(FAR struct enc_lower_s *lower) static void up_enable(FAR const struct enc_lower_s *lower)
{ {
FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower; FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower;
DEBUGASSERT(priv->handler); DEBUGASSERT(priv->handler);
(void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, true, true, true, priv-handler); (void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, true, true, true, priv->handler);
} }
static void up_disable(FAR struct enc_lower_s *lower) static void up_disable(FAR const struct enc_lower_s *lower)
{ {
(void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, true, true, true, NULL); (void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, true, true, true, NULL);
} }
@@ -174,7 +176,6 @@ static void up_disable(FAR struct enc_lower_s *lower)
void up_netinitialize(void) void up_netinitialize(void)
{ {
FAR struct spi_dev_s *spi; FAR struct spi_dev_s *spi;
uint16_t reg16;
int ret; int ret;
/* Assumptions: /* Assumptions:
@@ -195,7 +196,7 @@ void up_netinitialize(void)
/* Bind the SPI port to the ENC28J60 driver */ /* Bind the SPI port to the ENC28J60 driver */
ret = enc_initialize(spi, ENC28J60_DEVNO, &g_enclower); ret = enc_initialize(spi, &g_enclower.lower, ENC28J60_DEVNO);
if (ret < 0) if (ret < 0)
{ {
nlldbg("Failed to bind SPI port %d ENC28J60 device %d: %d\n", nlldbg("Failed to bind SPI port %d ENC28J60 device %d: %d\n",
@@ -207,4 +208,4 @@ void up_netinitialize(void)
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO); ENC28J60_SPI_PORTNO, ENC28J60_DEVNO);
} }
#endif /* CONFIG_NET_ENC28J60 */ #endif /* CONFIG_ENC28J60 */
+2 -2
View File
@@ -111,7 +111,7 @@ void weak_function stm32_spiinitialize(void)
/* Configure ENC28J60 SPI1 CS (also RESET and interrupt pins) */ /* Configure ENC28J60 SPI1 CS (also RESET and interrupt pins) */
#ifdef CONFIG_NET_ENC28J60 #ifdef CONFIG_ENC28J60
stm32_configgpio(GPIO_ENC28J60_CS); stm32_configgpio(GPIO_ENC28J60_CS);
stm32_configgpio(GPIO_ENC28J60_RESET); stm32_configgpio(GPIO_ENC28J60_RESET);
stm32_configgpio(GPIO_ENC28J60_INTR); stm32_configgpio(GPIO_ENC28J60_INTR);
@@ -171,7 +171,7 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
} }
else else
#endif #endif
#ifdef CONFIG_NET_ENC28J60 #ifdef CONFIG_ENC28J60
if (devid == SPIDEV_ETHERNET) if (devid == SPIDEV_ETHERNET)
{ {
/* Set the GPIO low to select and high to de-select */ /* Set the GPIO low to select and high to de-select */
+11 -1
View File
@@ -105,18 +105,28 @@ void stm32_ledinit(void)
/**************************************************************************** /****************************************************************************
* Name: stm32_setled * Name: stm32_setled
*
* Description:
* Set one LED to the 'ledon' state. The LEDs are pulled up and, hence,
* active low.
*
****************************************************************************/ ****************************************************************************/
void stm32_setled(int led, bool ledon) void stm32_setled(int led, bool ledon)
{ {
if ((unsigned)led < BOARD_NLEDS) if ((unsigned)led < BOARD_NLEDS)
{ {
stm32_gpiowrite(g_ledcfg[led], ledon); stm32_gpiowrite(g_ledcfg[led], !ledon);
} }
} }
/**************************************************************************** /****************************************************************************
* Name: stm32_setleds * Name: stm32_setleds
*
* Description:
* Set each LED to the bit encoded state. The LEDs are pulled up and,
* hence, active low.
*
****************************************************************************/ ****************************************************************************/
void stm32_setleds(uint8_t ledset) void stm32_setleds(uint8_t ledset)
+2 -2
View File
@@ -2,7 +2,7 @@
# configs/olimes-strp711/nettest/defconfig # configs/olimes-strp711/nettest/defconfig
# #
# Copyright (C) 2010 Gregory Nutt. All rights reserved. # Copyright (C) 2010 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # 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
# modification, are permitted provided that the following conditions # modification, are permitted provided that the following conditions
@@ -235,7 +235,7 @@ CONFIG_FS_ROMFS=n
# #
# ENC28J60 configuration # ENC28J60 configuration
# #
CONFIG_NET_ENC28J60=y CONFIG_ENC28J60=y
#CONFIG_ENC28J60_SPIMODE #CONFIG_ENC28J60_SPIMODE
CONFIG_ENC28J60_FREQUENCY=20000000 CONFIG_ENC28J60_FREQUENCY=20000000
CONFIG_ENC28J60_NINTERFACES=1 CONFIG_ENC28J60_NINTERFACES=1
+3 -3
View File
@@ -1,8 +1,8 @@
############################################################################ ############################################################################
# configs/olimex-strp711/src/Makefile # configs/olimex-strp711/src/Makefile
# #
# Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved. # Copyright (C) 2007-2008, 2010, 2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # 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
# modification, are permitted provided that the following conditions # modification, are permitted provided that the following conditions
@@ -51,7 +51,7 @@ CSRCS = up_spi.c up_leds.c up_buttons.c
ifeq ($(CONFIG_NSH_ARCHINIT),y) ifeq ($(CONFIG_NSH_ARCHINIT),y)
CSRCS += up_nsh.c CSRCS += up_nsh.c
endif endif
ifeq ($(CONFIG_NET_ENC28J60),y) ifeq ($(CONFIG_ENC28J60),y)
CSRCS += up_enc28j60.c CSRCS += up_enc28j60.c
endif endif
COBJS = $(CSRCS:.c=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT))
+6 -6
View File
@@ -95,7 +95,7 @@
#include "up_internal.h" #include "up_internal.h"
#include "str71x_internal.h" #include "str71x_internal.h"
#ifdef CONFIG_NET_ENC28J60 #ifdef CONFIG_ENC28J60
/**************************************************************************** /****************************************************************************
* Definitions * Definitions
@@ -182,17 +182,17 @@ static const struct enc_lower_s g_enclower =
* Name: struct enc_lower_s methods * Name: struct enc_lower_s methods
****************************************************************************/ ****************************************************************************/
static int up_attach(FAR struct enc_lower_s *lower, xcpt_t handler) static int up_attach(FAR const struct enc_lower_s *lower, xcpt_t handler)
{ {
return irq_attach(ENC28J60_IRQ, handler) return irq_attach(ENC28J60_IRQ, handler)
} }
static void up_enable(FAR struct enc_lower_s *lower) static void up_enable(FAR const struct enc_lower_s *lower)
{ {
up_enable_irq(ENC28J60_IRQ); up_enable_irq(ENC28J60_IRQ);
} }
static void up_disable(FAR struct enc_lower_s *lower) static void up_disable(FAR const struct enc_lower_s *lower)
{ {
up_disable_irq(ENC28J60_IRQ); up_disable_irq(ENC28J60_IRQ);
} }
@@ -237,7 +237,7 @@ void up_netinitialize(void)
/* Bind the SPI port to the ENC28J60 driver */ /* Bind the SPI port to the ENC28J60 driver */
ret = enc_initialize(spi, ENC28J60_DEVNO, &g_enclower); ret = enc_initialize(spi, &g_enclower, ENC28J60_DEVNO);
if (ret < 0) if (ret < 0)
{ {
nlldbg("Failed to bind SPI port %d ENC28J60 device %d: %d\n", nlldbg("Failed to bind SPI port %d ENC28J60 device %d: %d\n",
@@ -248,4 +248,4 @@ void up_netinitialize(void)
nllvdbg("Bound SPI port %d to ENC28J60 device %d\n", nllvdbg("Bound SPI port %d to ENC28J60 device %d\n",
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO); ENC28J60_SPI_PORTNO, ENC28J60_DEVNO);
} }
#endif /* CONFIG_NET_ENC28J60 */ #endif /* CONFIG_ENC28J60 */
+4 -4
View File
@@ -1,8 +1,8 @@
/**************************************************************************** /****************************************************************************
* config/olimex-strp711/src/up_spi.c * config/olimex-strp711/src/up_spi.c
* *
* Copyright (C) 2008-2010 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2010,2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * 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
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -155,7 +155,7 @@
* P0.4/S1.MISO P0.4 output 6 5 NET RST * P0.4/S1.MISO P0.4 output 6 5 NET RST
*/ */
#ifdef CONFIG_NET_ENC28J60 #ifdef CONFIG_ENC28J60
/* 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 BSPI1 * interrupt conflict with BSPI1
@@ -981,7 +981,7 @@ FAR struct spi_dev_s *up_spiinitialize(int port)
* reset (also active low) * reset (also active low)
*/ */
#ifdef CONFIG_NET_ENC28J60 #ifdef CONFIG_ENC28J60
reg16 = getreg16(STR71X_GPIO0_PD); reg16 = getreg16(STR71X_GPIO0_PD);
reg16 |= (ENC_GPIO0_CS | ENC_GPIO0_NETRST); reg16 |= (ENC_GPIO0_CS | ENC_GPIO0_NETRST);
putreg16(reg16, STR71X_GPIO0_PD); putreg16(reg16, STR71X_GPIO0_PD);
+20 -62
View File
@@ -27,10 +27,8 @@ config RAMDISK
a block driver that can be mounted as a files system. See a block driver that can be mounted as a files system. See
include/nuttx/ramdisk.h. include/nuttx/ramdisk.h.
comment "CAN Driver Options" menuconfig CAN
bool "CAN Driver Support"
config CAN
bool "CAN Support"
default n default n
---help--- ---help---
This selection enables building of the "upper-half" CAN driver. This selection enables building of the "upper-half" CAN driver.
@@ -65,10 +63,8 @@ config CAN_LOOPBACK
endif endif
comment "PWM Driver Options" menuconfig PWM
bool "PWM Driver Support"
config PWM
bool "PWM Support"
default n default n
---help--- ---help---
This selection enables building of the "upper-half" PWM driver. This selection enables building of the "upper-half" PWM driver.
@@ -86,10 +82,8 @@ config PWM_PULSECOUNT
endif endif
comment "I2C Driver Options" menuconfig I2C
bool "I2C Driver Support"
config I2C
bool "I2C Support"
default n default n
---help--- ---help---
This selection enables building of the "upper-half" I2C driver. This selection enables building of the "upper-half" I2C driver.
@@ -125,10 +119,8 @@ config I2C_NTRACE
default n default n
depends on I2C_TRACE depends on I2C_TRACE
comment "SPI Driver Options" menuconfig SPI
bool "SPI Driver Support"
config SPI
bool "SPI Support"
default n default n
---help--- ---help---
This selection enables building of the "upper-half" SPI driver. This selection enables building of the "upper-half" SPI driver.
@@ -159,10 +151,8 @@ config SPI_CMDDATA
endif endif
comment "RTC Driver Options" menuconfig RTC
bool "RTC Driver Support"
config RTC
bool "RTC Support"
default n default n
---help--- ---help---
This selection enables configuration of a real time clock (RTCdriver. This selection enables configuration of a real time clock (RTCdriver.
@@ -214,9 +204,7 @@ config RTC_ALARM
Enable if the RTC hardware supports setting of an alarm. A callback Enable if the RTC hardware supports setting of an alarm. A callback
function will be executed when the alarm goes off. function will be executed when the alarm goes off.
comment "Watchdog Driver Options" menuconfig WATCHDOG
config WATCHDOG
bool "Watchdog Timer Support" bool "Watchdog Timer Support"
default n default n
---help--- ---help---
@@ -226,8 +214,6 @@ config WATCHDOG
if WATCHDOG if WATCHDOG
endif endif
comment "Analog Driver Options"
menuconfig ANALOG menuconfig ANALOG
bool "Analog Device(ADC/DAC) Support" bool "Analog Device(ADC/DAC) Support"
default n default n
@@ -241,9 +227,7 @@ if ANALOG
source drivers/analog/Kconfig source drivers/analog/Kconfig
endif endif
comment "Block-to-Character Driver Support" menuconfig BCH
config BCH
bool "Block-to-Character (BCH) Support" bool "Block-to-Character (BCH) Support"
default n default n
---help--- ---help---
@@ -256,8 +240,6 @@ if BCH
source drivers/bch/Kconfig source drivers/bch/Kconfig
endif endif
comment "Input device Driver Options"
menuconfig INPUT menuconfig INPUT
bool "Input Device Support" bool "Input Device Support"
default n default n
@@ -270,10 +252,8 @@ if INPUT
source drivers/input/Kconfig source drivers/input/Kconfig
endif endif
comment "LCD Driver Options"
menuconfig LCD menuconfig LCD
bool "LCD Support" bool "LCD Driver Support"
default n default n
select NX_LCDDRIVER select NX_LCDDRIVER
---help--- ---help---
@@ -288,10 +268,8 @@ if LCD
source drivers/lcd/Kconfig source drivers/lcd/Kconfig
endif endif
comment "MMCSD Driver Options"
menuconfig MMCSD menuconfig MMCSD
bool "MMC/SD Support" bool "MMC/SD Driver Support"
default n default n
---help--- ---help---
Support for MMC/SD block drivers. MMC/SD block drivers based on Support for MMC/SD block drivers. MMC/SD block drivers based on
@@ -302,8 +280,6 @@ if MMCSD
source drivers/mmcsd/Kconfig source drivers/mmcsd/Kconfig
endif endif
comment "I2C Driver Options"
menuconfig MTD menuconfig MTD
bool "Memory Technology Device (MTD) Support" bool "Memory Technology Device (MTD) Support"
default n default n
@@ -321,8 +297,6 @@ if MTD
source drivers/mtd/Kconfig source drivers/mtd/Kconfig
endif endif
comment "Network Device Driver Options"
menuconfig NETDEVICES menuconfig NETDEVICES
bool "Network Device Support" bool "Network Device Support"
default n default n
@@ -333,8 +307,6 @@ if NETDEVICES
source drivers/net/Kconfig source drivers/net/Kconfig
endif endif
comment "Pipe Options"
menuconfig PIPES menuconfig PIPES
bool "FIFO and named pipe drivers" bool "FIFO and named pipe drivers"
default n default n
@@ -346,8 +318,6 @@ if PIPES
source drivers/pipes/Kconfig source drivers/pipes/Kconfig
endif endif
comment "Power Management Options"
config PM config PM
bool "Power management (PM) driver interfaces" bool "Power management (PM) driver interfaces"
default n default n
@@ -367,10 +337,8 @@ if POWER
source drivers/power/Kconfig source drivers/power/Kconfig
endif endif
comment "Sensor Driver Options"
menuconfig SENSORS menuconfig SENSORS
bool "Sensors Support" bool "Sensor Device Support"
default n default n
---help--- ---help---
Drivers for various sensors Drivers for various sensors
@@ -379,10 +347,8 @@ if SENSORS
source drivers/sensors/Kconfig source drivers/sensors/Kconfig
endif endif
comment "Osmocom-bb Sercomm Driver Options"
menuconfig SERCOMM_CONSOLE menuconfig SERCOMM_CONSOLE
bool "Osmocom-bb serial console" bool "Osmocom-bb Sercomm Driver Support"
default n default n
---help--- ---help---
Sercomm is the transport used by osmocom-bb that runs on top of serial. Sercomm is the transport used by osmocom-bb that runs on top of serial.
@@ -398,10 +364,8 @@ if SERCOMM
source drivers/sercomm/Kconfig source drivers/sercomm/Kconfig
endif endif
comment "Serial Driver Options"
menuconfig SERIAL menuconfig SERIAL
bool "Serial Support" bool "Serial Driver Support"
default y default y
---help--- ---help---
Front-end character drivers for chip-specific UARTs. This provide Front-end character drivers for chip-specific UARTs. This provide
@@ -412,10 +376,8 @@ if SERIAL
source drivers/serial/Kconfig source drivers/serial/Kconfig
endif endif
comment "USB Device Driver Options"
menuconfig USBDEV menuconfig USBDEV
bool "USB Device Support" bool "USB Device Driver Support"
default n default n
---help--- ---help---
USB device drivers. See also include/nuttx/usb/usbdev.h USB device drivers. See also include/nuttx/usb/usbdev.h
@@ -424,10 +386,8 @@ if USBDEV
source drivers/usbdev/Kconfig source drivers/usbdev/Kconfig
endif endif
comment "USB Host Driver Options"
menuconfig USBHOST menuconfig USBHOST
bool "USB Host Support" bool "USB Host Driver Support"
default n default n
---help--- ---help---
USB host drivers. See also include/nuttx/usb/usbhost.h USB host drivers. See also include/nuttx/usb/usbhost.h
@@ -436,10 +396,8 @@ if USBHOST
source drivers/usbhost/Kconfig source drivers/usbhost/Kconfig
endif endif
comment "Wireless Device Driver Options"
menuconfig WIRELESS menuconfig WIRELESS
bool "Wireless Support" bool "Wireless Device Support"
default n default n
---help--- ---help---
Drivers for various wireless devices. Drivers for various wireless devices.
+3 -3
View File
@@ -1,8 +1,8 @@
############################################################################ ############################################################################
# drivers/net/Make.defs # drivers/net/Make.defs
# #
# Copyright (C) 2007, 2010-2011 Gregory Nutt. All rights reserved. # Copyright (C) 2007, 2010-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # 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
# modification, are permitted provided that the following conditions # modification, are permitted provided that the following conditions
@@ -47,7 +47,7 @@ ifeq ($(CONFIG_NET_CS89x0),y)
CSRCS += cs89x0.c CSRCS += cs89x0.c
endif endif
ifeq ($(CONFIG_NET_ENC28J60),y) ifeq ($(CONFIG_ENC28J60),y)
CSRCS += enc28j60.c CSRCS += enc28j60.c
endif endif
+12 -12
View File
@@ -42,7 +42,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_ENC28J60) #if defined(CONFIG_NET) && defined(CONFIG_ENC28J60)
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
@@ -74,7 +74,7 @@
/* ENC28J60 Configuration Settings: /* ENC28J60 Configuration Settings:
* *
* CONFIG_NET_ENC28J60 - Enabled ENC28J60 support * CONFIG_ENC28J60 - Enabled ENC28J60 support
* CONFIG_ENC28J60_SPIMODE - Controls the SPI mode * CONFIG_ENC28J60_SPIMODE - Controls the SPI mode
* CONFIG_ENC28J60_FREQUENCY - Define to use a different bus frequency * CONFIG_ENC28J60_FREQUENCY - Define to use a different bus frequency
* CONFIG_ENC28J60_NINTERFACES - Specifies the number of physical ENC28J60 * CONFIG_ENC28J60_NINTERFACES - Specifies the number of physical ENC28J60
@@ -172,36 +172,36 @@ struct enc_driver_s
{ {
/* Device control */ /* Device control */
bool bifup; /* true:ifup false:ifdown */ bool bifup; /* true:ifup false:ifdown */
uint8_t bank; /* Currently selected bank */ uint8_t bank; /* Currently selected bank */
uint16_t nextpkt; /* Next packet address */ uint16_t nextpkt; /* Next packet address */
FAR struct enc_lower_s *lower; /* Low-level MCU-specific support */ FAR const struct enc_lower_s *lower; /* Low-level MCU-specific support */
/* Timing */ /* Timing */
WDOG_ID txpoll; /* TX poll timer */ WDOG_ID txpoll; /* TX poll timer */
WDOG_ID txtimeout; /* TX timeout timer */ WDOG_ID txtimeout; /* TX timeout timer */
/* We we don't own the SPI bus, then we cannot do SPI accesses from the /* We we don't own the SPI bus, then we cannot do SPI accesses from the
* interrupt handler. * interrupt handler.
*/ */
#ifndef CONFIG_SPI_OWNBUS #ifndef CONFIG_SPI_OWNBUS
struct work_s work; /* Work queue support */ struct work_s work; /* Work queue support */
#endif #endif
/* This is the contained SPI driver intstance */ /* This is the contained SPI driver intstance */
FAR struct spi_dev_s *spi; FAR struct spi_dev_s *spi;
/* This holds the information visible to uIP/NuttX */ /* This holds the information visible to uIP/NuttX */
struct uip_driver_s dev; /* Interface understood by uIP */ struct uip_driver_s dev; /* Interface understood by uIP */
/* Statistics */ /* Statistics */
#ifdef CONFIG_ENC28J60_STATS #ifdef CONFIG_ENC28J60_STATS
struct enc_stats_s stats; struct enc_stats_s stats;
#endif #endif
}; };
+4 -4
View File
@@ -51,7 +51,7 @@
/* ENC28J60 Configuration Settings: /* ENC28J60 Configuration Settings:
* *
* CONFIG_NET_ENC28J60 - Enabled ENC28J60 support * CONFIG_ENC28J60 - Enabled ENC28J60 support
* CONFIG_ENC28J60_SPIMODE - Controls the SPI mode * CONFIG_ENC28J60_SPIMODE - Controls the SPI mode
* CONFIG_ENC28J60_FREQUENCY - Define to use a different bus frequency * CONFIG_ENC28J60_FREQUENCY - Define to use a different bus frequency
* CONFIG_ENC28J60_NINTERFACES - Specifies the number of physical ENC28J60 * CONFIG_ENC28J60_NINTERFACES - Specifies the number of physical ENC28J60
@@ -89,9 +89,9 @@ struct enc_stats_s
struct enc_lower_s struct enc_lower_s
{ {
int (*attach)(FAR struct enc_lower_s *lower, xcpt_t handler); int (*attach)(FAR const struct enc_lower_s *lower, xcpt_t handler);
void (*enable)(FAR struct enc_lower_s *lower); void (*enable)(FAR const struct enc_lower_s *lower);
void (*disable)(FAR struct enc_lower_s *lower); void (*disable)(FAR const struct enc_lower_s *lower);
}; };
/**************************************************************************** /****************************************************************************