rp2040: add w5500-evb-pico board configuration
This is copy of raspberrypi-pico with all occurences of raspberrypi replaced by w5500-evb. Only the usbnsh defconfig is available, which is based on the raspberrypi-pico:usbnsh defconfig, but enables the WIZnet W5500 Ethernet chip. TCP/IP for IPv4 and IPv6 is enabled. Signed-off-by: Michael Jung <michael.jung@secore.ly>
This commit is contained in:
parent
9c705828bc
commit
f55145b43c
20 changed files with 2132 additions and 0 deletions
|
@ -1915,6 +1915,16 @@ config ARCH_BOARD_WAVESHARE_RP2040_LCD_1_28
|
|||
This is a port to the Waveshare RP2040 LCD 1.28 board.
|
||||
Support is derived from Raspberry Pi Pico support.
|
||||
|
||||
config ARCH_BOARD_W5500_EVB_PICO
|
||||
bool "WIZnet W5500-EVB-Pico board"
|
||||
depends on ARCH_CHIP_RP2040
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
This is a port to the WIZnet W5500-EVB-Pico board.
|
||||
Support is derived from Raspberry Pi Pico support.
|
||||
|
||||
config ARCH_BOARD_RX65N
|
||||
bool "RX65N renesas board"
|
||||
depends on ARCH_CHIP_R5F565NEDDFC
|
||||
|
@ -3319,6 +3329,7 @@ config ARCH_BOARD
|
|||
default "adafruit-kb2040" if ARCH_BOARD_ADAFRUIT_KB2040
|
||||
default "adafruit-qt-py-rp2040" if ARCH_BOARD_ADAFRUIT_QT_PY_RP2040
|
||||
default "waveshare-rp2040-lcd-1.28" if ARCH_BOARD_WAVESHARE_RP2040_LCD_1_28
|
||||
default "w5500-evb-pico" if ARCH_BOARD_W5500_EVB_PICO
|
||||
default "rx65n" if ARCH_BOARD_RX65N
|
||||
default "rx65n-rsk1mb" if ARCH_BOARD_RX65N_RSK1MB
|
||||
default "rx65n-rsk2mb" if ARCH_BOARD_RX65N_RSK2MB
|
||||
|
|
8
boards/arm/rp2040/w5500-evb-pico/Kconfig
Normal file
8
boards/arm/rp2040/w5500-evb-pico/Kconfig
Normal file
|
@ -0,0 +1,8 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_W5500_EVB_PICO
|
||||
|
||||
endif
|
74
boards/arm/rp2040/w5500-evb-pico/configs/usbnsh/defconfig
Normal file
74
boards/arm/rp2040/w5500-evb-pico/configs/usbnsh/defconfig
Normal file
|
@ -0,0 +1,74 @@
|
|||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_DEV_CONSOLE is not set
|
||||
# CONFIG_LIBC_LONG_LONG is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
# CONFIG_NSH_DISABLE_DATE is not set
|
||||
# CONFIG_NSH_DISABLE_LOSMART is not set
|
||||
# CONFIG_RP2040_UART0 is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="w5500-evb-pico"
|
||||
CONFIG_ARCH_BOARD_W5500_EVB_PICO=y
|
||||
CONFIG_ARCH_CHIP="rp2040"
|
||||
CONFIG_ARCH_CHIP_RP2040=y
|
||||
CONFIG_ARCH_RAMVECTORS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=10450
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_CDCACM=y
|
||||
CONFIG_CDCACM_CONSOLE=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DISABLE_POSIX_TIMERS=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDB_DNSSERVER_IPv4ADDR=0x08080808
|
||||
CONFIG_NETDEV_WORK_THREAD=y
|
||||
CONFIG_NETINIT_DHCPC=y
|
||||
CONFIG_NETINIT_NOMAC=y
|
||||
CONFIG_NET_ETH_PKTSIZE=1516
|
||||
CONFIG_NET_ICMP=y
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_ICMPv6=y
|
||||
CONFIG_NET_ICMPv6_AUTOCONF=y
|
||||
CONFIG_NET_ICMPv6_SOCKET=y
|
||||
CONFIG_NET_IPv6=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_W5500=y
|
||||
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NSH_USBCONSOLE=y
|
||||
CONFIG_RAM_SIZE=270336
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_READLINE_CMD_HISTORY=y
|
||||
CONFIG_RP2040_SPI0=y
|
||||
CONFIG_RP2040_SPI=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_START_DAY=9
|
||||
CONFIG_START_MONTH=2
|
||||
CONFIG_START_YEAR=2021
|
||||
CONFIG_SYSTEM_DHCPC_RENEW6=y
|
||||
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_PING6=y
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_USBDEV=y
|
||||
CONFIG_USBDEV_BUSPOWERED=y
|
172
boards/arm/rp2040/w5500-evb-pico/include/board.h
Normal file
172
boards/arm/rp2040/w5500-evb-pico/include/board.h
Normal file
|
@ -0,0 +1,172 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/include/board.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_BOARD_H
|
||||
#define __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "rp2040_i2cdev.h"
|
||||
#include "rp2040_spidev.h"
|
||||
#include "rp2040_i2sdev.h"
|
||||
|
||||
#include "rp2040_spisd.h"
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
#define MHZ 1000000
|
||||
|
||||
#define BOARD_XOSC_FREQ (12 * MHZ)
|
||||
#define BOARD_PLL_SYS_FREQ (125 * MHZ)
|
||||
#define BOARD_PLL_USB_FREQ (48 * MHZ)
|
||||
|
||||
#define BOARD_REF_FREQ (12 * MHZ)
|
||||
#define BOARD_SYS_FREQ (125 * MHZ)
|
||||
#define BOARD_PERI_FREQ (125 * MHZ)
|
||||
#define BOARD_USB_FREQ (48 * MHZ)
|
||||
#define BOARD_ADC_FREQ (48 * MHZ)
|
||||
#define BOARD_RTC_FREQ 46875
|
||||
|
||||
#define BOARD_UART_BASEFREQ BOARD_PERI_FREQ
|
||||
|
||||
#define BOARD_TICK_CLOCK (1 * MHZ)
|
||||
|
||||
/* GPIO definitions *********************************************************/
|
||||
|
||||
#define BOARD_GPIO_LED_PIN 25
|
||||
#define BOARD_NGPIOOUT 1
|
||||
#define BOARD_NGPIOIN 1
|
||||
#define BOARD_NGPIOINT 1
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs
|
||||
* in any way. The following definitions are used to access individual LEDs.
|
||||
*/
|
||||
|
||||
/* LED index values for use with board_userled() */
|
||||
|
||||
#define BOARD_LED1 0
|
||||
#define BOARD_NLEDS 1
|
||||
|
||||
#define BOARD_LED_GREEN BOARD_LED1
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||
|
||||
/* This LED is not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/rp2040_autoleds.c. The LED is used to encode
|
||||
* OS-related events as follows:
|
||||
*
|
||||
* -------------------- ----------------------------- ------
|
||||
* SYMBOL Meaning LED
|
||||
* -------------------- ----------------------------- ------
|
||||
*/
|
||||
|
||||
#define LED_STARTED 0 /* NuttX has been started OFF */
|
||||
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */
|
||||
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF */
|
||||
#define LED_STACKCREATED 1 /* Idle stack created ON */
|
||||
#define LED_INIRQ 2 /* In an interrupt N/C */
|
||||
#define LED_SIGNAL 2 /* In a signal handler N/C */
|
||||
#define LED_ASSERTION 2 /* An assertion failed N/C */
|
||||
#define LED_PANIC 3 /* The system has crashed FLASH */
|
||||
#undef LED_IDLE /* Not used */
|
||||
|
||||
/* Thus if the LED is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normally. If the LED is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
/* BUTTON definitions *******************************************************/
|
||||
|
||||
#define NUM_BUTTONS 2
|
||||
|
||||
#define BUTTON_USER1 0
|
||||
#define BUTTON_USER2 1
|
||||
#define BUTTON_USER1_BIT (1 << BUTTON_USER1)
|
||||
#define BUTTON_USER2_BIT (1 << BUTTON_USER2)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rp2040_boardearlyinitialize
|
||||
*
|
||||
* Description:
|
||||
* This is mostly a wrapper around the early board initialization code
|
||||
* common to all boards based on the RP2040. This implementation does
|
||||
* additionaly set the board's status LED.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rp2040_boardearlyinitialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rp2040_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* This is a wrapper around the board initialization code common to all
|
||||
* boards based on the RP2040.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rp2040_boardinitialize(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_BOARD_H */
|
76
boards/arm/rp2040/w5500-evb-pico/include/rp2040_i2cdev.h
Normal file
76
boards/arm/rp2040/w5500-evb-pico/include/rp2040_i2cdev.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/include/rp2040_i2cdev.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_I2CDEV_H
|
||||
#define __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_I2CDEV_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_i2cdev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize i2c driver and register the /dev/i2c device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* bus - The RP2040 I2C bus to initialize. 0: I2C0, 1: I2C1. Which ones
|
||||
* are actually available depends on the board configuration.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RP2040_I2C_DRIVER
|
||||
int board_i2cdev_initialize(int bus);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_I2CDEV_H */
|
72
boards/arm/rp2040/w5500-evb-pico/include/rp2040_i2sdev.h
Normal file
72
boards/arm/rp2040/w5500-evb-pico/include/rp2040_i2sdev.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/include/rp2040_i2sdev.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_I2SDEV_H
|
||||
#define __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_I2SDEV_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_i2sdev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize i2s driver and register the /dev/audio/pcm0 device.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RP2040_I2S
|
||||
int board_i2sdev_initialize(int bus);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_I2SDEV_H */
|
69
boards/arm/rp2040/w5500-evb-pico/include/rp2040_spidev.h
Normal file
69
boards/arm/rp2040/w5500-evb-pico/include/rp2040_spidev.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/include/rp2040_spidev.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_SPIDEV_H
|
||||
#define __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_SPIDEV_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_spidev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize spi driver and register the /dev/spi device.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_spidev_initialize(int bus);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_SPIDEV_H */
|
83
boards/arm/rp2040/w5500-evb-pico/include/rp2040_spisd.h
Normal file
83
boards/arm/rp2040/w5500-evb-pico/include/rp2040_spisd.h
Normal file
|
@ -0,0 +1,83 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/include/rp2040_spisd.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_SPISD_H
|
||||
#define __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_SPISD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_spisd_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the SPI-based SD card.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RP2040_SPISD
|
||||
int board_spisd_initialize(int minor, int bus);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_spisd_status
|
||||
*
|
||||
* Description:
|
||||
* Get the status whether SD Card is present or not.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RP2040_SPISD
|
||||
uint8_t board_spisd_status(struct spi_dev_s *dev, uint32_t devid);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_RP2040_W5500_EVB_PICO_INCLUDE_RP2040_SPISD_H */
|
45
boards/arm/rp2040/w5500-evb-pico/scripts/Make.defs
Normal file
45
boards/arm/rp2040/w5500-evb-pico/scripts/Make.defs
Normal file
|
@ -0,0 +1,45 @@
|
|||
############################################################################
|
||||
# boards/arm/rp2040/w5500-evb-pico/scripts/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
include $(TOPDIR)/tools/rp2040/Config.mk
|
||||
include $(TOPDIR)/arch/arm/src/armv6-m/Toolchain.defs
|
||||
|
||||
ifeq ($(CONFIG_RP2040_FLASH_BOOT),y)
|
||||
LDSCRIPT = w5500-evb-pico-flash.ld
|
||||
else
|
||||
LDSCRIPT = w5500-evb-pico-sram.ld
|
||||
endif
|
||||
|
||||
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
|
||||
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
119
boards/arm/rp2040/w5500-evb-pico/scripts/w5500-evb-pico-flash.ld
Normal file
119
boards/arm/rp2040/w5500-evb-pico/scripts/w5500-evb-pico-flash.ld
Normal file
|
@ -0,0 +1,119 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/scripts/w5500-evb-pico-flash.ld
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x10000000, LENGTH = 2048K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 264K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
EXTERN(_vectors)
|
||||
ENTRY(_stext)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.flash_begin : {
|
||||
__flash_binary_start = .;
|
||||
} > flash
|
||||
|
||||
.boot2 : {
|
||||
__boot2_start__ = .;
|
||||
KEEP (*(.boot2))
|
||||
__boot2_end__ = .;
|
||||
} > flash
|
||||
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
.init_section : {
|
||||
_sinit = ABSOLUTE(.);
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
|
||||
KEEP(*(.init_array .ctors))
|
||||
_einit = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} > flash
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} > flash
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
_eronly = ABSOLUTE(.);
|
||||
|
||||
.ram_vectors (COPY) : {
|
||||
*(.ram_vectors)
|
||||
} > sram
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.ram_code.*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
.flash_section : {
|
||||
. = ALIGN(4*1024);
|
||||
*(.flash.*)
|
||||
} > flash
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
105
boards/arm/rp2040/w5500-evb-pico/scripts/w5500-evb-pico-sram.ld
Normal file
105
boards/arm/rp2040/w5500-evb-pico/scripts/w5500-evb-pico-sram.ld
Normal file
|
@ -0,0 +1,105 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/scripts/w5500-evb-pico-sram.ld
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x10000000, LENGTH = 2048K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 264K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
EXTERN(_vectors)
|
||||
ENTRY(_stext)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
rp2040_start.o(.text)
|
||||
. = ALIGN(256);
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
.init_section : {
|
||||
_sinit = ABSOLUTE(.);
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
|
||||
KEEP(*(.init_array .ctors))
|
||||
_einit = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} > sram
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} > sram
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.ram_code.*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
.flash_section : {
|
||||
. = ALIGN(4*1024);
|
||||
*(.flash.*)
|
||||
} > flash
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
43
boards/arm/rp2040/w5500-evb-pico/src/Make.defs
Normal file
43
boards/arm/rp2040/w5500-evb-pico/src/Make.defs
Normal file
|
@ -0,0 +1,43 @@
|
|||
############################################################################
|
||||
# boards/arm/rp2040/w5500-evb-pico/src/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = rp2040_boardinitialize.c
|
||||
CSRCS += rp2040_appinit.c
|
||||
CSRCS += rp2040_bringup.c
|
||||
|
||||
ifeq ($(CONFIG_DEV_GPIO),y)
|
||||
CSRCS += rp2040_gpio.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += rp2040_autoleds.c
|
||||
else
|
||||
CSRCS += rp2040_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += rp2040_buttons.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
76
boards/arm/rp2040/w5500-evb-pico/src/rp2040_appinit.c
Normal file
76
boards/arm/rp2040/w5500-evb-pico/src/rp2040_appinit.c
Normal file
|
@ -0,0 +1,76 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/src/rp2040_appinit.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "rp2040_pico.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value could be such things as a
|
||||
* mode enumeration value, a set of DIP switch switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
/* Board initialization already performed by board_late_initialize() */
|
||||
|
||||
return OK;
|
||||
#else
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
return rp2040_bringup();
|
||||
#endif
|
||||
}
|
167
boards/arm/rp2040/w5500-evb-pico/src/rp2040_autoleds.c
Normal file
167
boards/arm/rp2040/w5500-evb-pico/src/rp2040_autoleds.c
Normal file
|
@ -0,0 +1,167 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/src/rp2040_autoleds.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* There are four LED status indicators located on the EVK Board. The
|
||||
* functions of these LEDs include:
|
||||
*
|
||||
* - Main Power Supply(D3)
|
||||
* Green: DC 5V main supply is normal.
|
||||
* Red: J2 input voltage is over 5.6V.
|
||||
* Off: The board is not powered.
|
||||
* - Reset RED LED(D15)
|
||||
* - OpenSDA LED(D16)
|
||||
* - USER LED(D18)
|
||||
*
|
||||
* Only a single LED, D18, is under software control.
|
||||
*
|
||||
* This LED is not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/rp2040_autoleds.c. The LED is used to encode
|
||||
* OS-related events as follows:
|
||||
*
|
||||
* -------------------- ----------------------- ------
|
||||
* SYMBOL Meaning LED
|
||||
* -------------------- ----------------------- ------
|
||||
*
|
||||
* LED_STARTED 0 NuttX has been started OFF
|
||||
* LED_HEAPALLOCATE 0 Heap has been allocated OFF
|
||||
* LED_IRQSENABLED 0 Interrupts enabled OFF
|
||||
* LED_STACKCREATED 1 Idle stack created ON
|
||||
* LED_INIRQ 2 In an interrupt N/C
|
||||
* LED_SIGNAL 2 In a signal handler N/C
|
||||
* LED_ASSERTION 2 An assertion failed N/C
|
||||
* LED_PANIC 3 The system has crashed FLASH
|
||||
* LED_IDLE Not used
|
||||
*
|
||||
* Thus if the LED is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normally. If the LED is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "arm_internal.h"
|
||||
#include "chip.h"
|
||||
#include "rp2040_gpio.h"
|
||||
|
||||
#include "rp2040_pico.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rp2040_autoled_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize NuttX-controlled LED logic
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIO for output */
|
||||
|
||||
rp2040_gpio_init(GPIO_LED1);
|
||||
rp2040_gpio_setdir(GPIO_LED1, true);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
*
|
||||
* Description:
|
||||
* Turn on the "logical" LED state
|
||||
*
|
||||
* Input Parameters:
|
||||
* led - Identifies the "logical" LED state (see definitions in
|
||||
* include/board.h)
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
bool ledon = true;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
case 0: /* LED Off */
|
||||
ledon = false;
|
||||
break;
|
||||
|
||||
case 2: /* LED No change */
|
||||
return;
|
||||
|
||||
case 1: /* LED On */
|
||||
case 3: /* LED On */
|
||||
break;
|
||||
}
|
||||
|
||||
rp2040_gpio_put(GPIO_LED1, ledon); /* High illuminates */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
*
|
||||
* Description:
|
||||
* Turn off the "logical" LED state
|
||||
*
|
||||
* Input Parameters:
|
||||
* led - Identifies the "logical" LED state (see definitions in
|
||||
* include/board.h)
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
switch (led)
|
||||
{
|
||||
case 0: /* LED Off */
|
||||
case 1: /* LED Off */
|
||||
case 3: /* LED Off */
|
||||
break;
|
||||
|
||||
case 2: /* LED No change */
|
||||
return;
|
||||
}
|
||||
|
||||
rp2040_gpio_put(GPIO_LED1, false); /* High illuminates */
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
|
@ -0,0 +1,87 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/src/rp2040_boardinitialize.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "arm_internal.h"
|
||||
#include "rp2040_gpio.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_COMMON
|
||||
#include "rp2040_common_initialize.h"
|
||||
#endif /* CONFIG_ARCH_BOARD_COMMON */
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rp2040_boardearlyinitialize
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rp2040_boardearlyinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_BOARD_COMMON
|
||||
rp2040_common_earlyinitialize();
|
||||
#endif
|
||||
|
||||
/* --- Place any board specific early initialization here --- */
|
||||
|
||||
/* Set board LED pin */
|
||||
|
||||
rp2040_gpio_init(BOARD_GPIO_LED_PIN);
|
||||
rp2040_gpio_setdir(BOARD_GPIO_LED_PIN, true);
|
||||
rp2040_gpio_put(BOARD_GPIO_LED_PIN, true);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rp2040_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rp2040_boardinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_BOARD_COMMON
|
||||
rp2040_common_initialize();
|
||||
#endif
|
||||
|
||||
/* --- Place any board specific initialization here --- */
|
||||
}
|
88
boards/arm/rp2040/w5500-evb-pico/src/rp2040_bringup.c
Normal file
88
boards/arm/rp2040/w5500-evb-pico/src/rp2040_bringup.c
Normal file
|
@ -0,0 +1,88 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/src/rp2040_bringup.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "rp2040_pico.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_COMMON
|
||||
#include "rp2040_common_bringup.h"
|
||||
#endif /* CONFIG_ARCH_BOARD_COMMON */
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rp2040_bringup
|
||||
****************************************************************************/
|
||||
|
||||
int rp2040_bringup(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_BOARD_COMMON
|
||||
|
||||
int ret = rp2040_common_bringup();
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_BOARD_COMMON */
|
||||
|
||||
/* --- Place any board specific bringup code here --- */
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
/* Register the LED driver */
|
||||
|
||||
ret = userled_lower_initialize("/dev/userleds");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, \
|
||||
"ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INPUT_BUTTONS
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
177
boards/arm/rp2040/w5500-evb-pico/src/rp2040_buttons.c
Normal file
177
boards/arm/rp2040/w5500-evb-pico/src/rp2040_buttons.c
Normal file
|
@ -0,0 +1,177 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/src/rp2040_buttons.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "rp2040_gpio.h"
|
||||
#include "rp2040_pico.h"
|
||||
|
||||
#if defined(CONFIG_ARCH_BUTTONS)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_INPUT_BUTTONS) && !defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
# error "The NuttX Buttons Driver depends on IRQ support to work!\n"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for external w5500-evb-pico buttons. */
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
{
|
||||
GPIO_BTN_USER1, GPIO_BTN_USER2
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_button_initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure the GPIO pins as inputs. And we will use interrupts */
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* Initialize input pin */
|
||||
|
||||
rp2040_gpio_init(g_buttons[i]);
|
||||
|
||||
/* pull-up = false : pull-down = false */
|
||||
|
||||
rp2040_gpio_set_pulls(g_buttons[i], false, false);
|
||||
}
|
||||
|
||||
return NUM_BUTTONS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed. */
|
||||
|
||||
bool released = rp2040_gpio_get(g_buttons[i]);
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns
|
||||
* an 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released. The ID value is
|
||||
* a button enumeration value that uniquely identifies a button resource.
|
||||
* See the BUTTON_* definitions in board.h for the meaning of enumeration
|
||||
* value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
int board_button_irq(int id, xcpt_t irqhandler, void *arg)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
/* The following should be atomic */
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
/* Make sure the interrupt is disabled */
|
||||
|
||||
rp2040_gpio_disable_irq(g_buttons[id]);
|
||||
|
||||
/* Attach the interrupt handler */
|
||||
|
||||
ret = rp2040_gpio_irq_attach(g_buttons[id],
|
||||
RP2040_GPIO_INTR_EDGE_LOW,
|
||||
irqhandler,
|
||||
arg);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: irq_attach() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Enable interruption for this pin */
|
||||
|
||||
rp2040_gpio_enable_irq(g_buttons[id]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
392
boards/arm/rp2040/w5500-evb-pico/src/rp2040_gpio.c
Normal file
392
boards/arm/rp2040/w5500-evb-pico/src/rp2040_gpio.c
Normal file
|
@ -0,0 +1,392 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/src/rp2040_gpio.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/irq.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/ioexpander/gpio.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "arm_internal.h"
|
||||
#include "chip.h"
|
||||
#include "rp2040_gpio.h"
|
||||
|
||||
#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
|
||||
|
||||
/* Output pins. GPIO25 is onboard LED any other outputs could be used.
|
||||
*/
|
||||
|
||||
#define GPIO_OUT1 25
|
||||
|
||||
/* Input pins.
|
||||
*/
|
||||
|
||||
#define GPIO_IN1 6
|
||||
|
||||
/* Interrupt pins.
|
||||
*/
|
||||
|
||||
#define GPIO_IRQPIN1 14
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct rp2040gpio_dev_s
|
||||
{
|
||||
struct gpio_dev_s gpio;
|
||||
uint8_t id;
|
||||
};
|
||||
|
||||
struct rp2040gpint_dev_s
|
||||
{
|
||||
struct rp2040gpio_dev_s rp2040gpio;
|
||||
pin_interrupt_t callback;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#if BOARD_NGPIOOUT > 0
|
||||
static int gpout_read(struct gpio_dev_s *dev, bool *value);
|
||||
static int gpout_write(struct gpio_dev_s *dev, bool value);
|
||||
#endif
|
||||
|
||||
#if BOARD_NGPIOIN > 0
|
||||
static int gpin_read(struct gpio_dev_s *dev, bool *value);
|
||||
#endif
|
||||
|
||||
#if BOARD_NGPIOINT > 0
|
||||
static int gpint_read(struct gpio_dev_s *dev, bool *value);
|
||||
static int gpint_attach(struct gpio_dev_s *dev,
|
||||
pin_interrupt_t callback);
|
||||
static int gpint_enable(struct gpio_dev_s *dev, bool enable);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if BOARD_NGPIOOUT > 0
|
||||
static const struct gpio_operations_s gpout_ops =
|
||||
{
|
||||
.go_read = gpout_read,
|
||||
.go_write = gpout_write,
|
||||
.go_attach = NULL,
|
||||
.go_enable = NULL,
|
||||
};
|
||||
|
||||
/* This array maps the GPIO pins used as OUTPUT */
|
||||
|
||||
static const uint32_t g_gpiooutputs[BOARD_NGPIOOUT] =
|
||||
{
|
||||
GPIO_OUT1
|
||||
};
|
||||
|
||||
static struct rp2040gpio_dev_s g_gpout[BOARD_NGPIOOUT];
|
||||
#endif
|
||||
|
||||
#if BOARD_NGPIOIN > 0
|
||||
static const struct gpio_operations_s gpin_ops =
|
||||
{
|
||||
.go_read = gpin_read,
|
||||
.go_write = NULL,
|
||||
.go_attach = NULL,
|
||||
.go_enable = NULL,
|
||||
};
|
||||
|
||||
/* This array maps the GPIO pins used as INTERRUPT INPUTS */
|
||||
|
||||
static const uint32_t g_gpioinputs[BOARD_NGPIOIN] =
|
||||
{
|
||||
GPIO_IN1
|
||||
};
|
||||
|
||||
static struct rp2040gpio_dev_s g_gpin[BOARD_NGPIOIN];
|
||||
#endif
|
||||
|
||||
#if BOARD_NGPIOINT > 0
|
||||
static const struct gpio_operations_s gpint_ops =
|
||||
{
|
||||
.go_read = gpint_read,
|
||||
.go_write = NULL,
|
||||
.go_attach = gpint_attach,
|
||||
.go_enable = gpint_enable,
|
||||
};
|
||||
|
||||
/* This array maps the GPIO pins used as INTERRUPT INPUTS */
|
||||
|
||||
static const uint32_t g_gpiointinputs[BOARD_NGPIOINT] =
|
||||
{
|
||||
GPIO_IRQPIN1,
|
||||
};
|
||||
|
||||
static struct rp2040gpint_dev_s g_gpint[BOARD_NGPIOINT];
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gpout_read
|
||||
****************************************************************************/
|
||||
|
||||
#if BOARD_NGPIOOUT > 0
|
||||
static int gpout_read(struct gpio_dev_s *dev, bool *value)
|
||||
{
|
||||
struct rp2040gpio_dev_s *rp2040gpio =
|
||||
(struct rp2040gpio_dev_s *)dev;
|
||||
|
||||
DEBUGASSERT(rp2040gpio != NULL && value != NULL);
|
||||
DEBUGASSERT(rp2040gpio->id < BOARD_NGPIOOUT);
|
||||
gpioinfo("Reading...\n");
|
||||
|
||||
*value = rp2040_gpio_get(g_gpiooutputs[rp2040gpio->id]);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gpout_write
|
||||
****************************************************************************/
|
||||
|
||||
static int gpout_write(struct gpio_dev_s *dev, bool value)
|
||||
{
|
||||
struct rp2040gpio_dev_s *rp2040gpio =
|
||||
(struct rp2040gpio_dev_s *)dev;
|
||||
|
||||
DEBUGASSERT(rp2040gpio != NULL);
|
||||
DEBUGASSERT(rp2040gpio->id < BOARD_NGPIOOUT);
|
||||
gpioinfo("Writing %d\n", (int)value);
|
||||
|
||||
rp2040_gpio_put(g_gpiooutputs[rp2040gpio->id], value);
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gpin_read
|
||||
****************************************************************************/
|
||||
|
||||
#if BOARD_NGPIOIN > 0
|
||||
static int gpin_read(struct gpio_dev_s *dev, bool *value)
|
||||
{
|
||||
struct rp2040gpio_dev_s *rp2040gpio =
|
||||
(struct rp2040gpio_dev_s *)dev;
|
||||
|
||||
DEBUGASSERT(rp2040gpio != NULL && value != NULL);
|
||||
DEBUGASSERT(rp2040gpio->id < BOARD_NGPIOIN);
|
||||
gpioinfo("Reading... pin %d\n", (int)g_gpioinputs[rp2040gpio->id]);
|
||||
|
||||
*value = rp2040_gpio_get(g_gpioinputs[rp2040gpio->id]);
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rp2040gpio_interrupt
|
||||
****************************************************************************/
|
||||
|
||||
#if BOARD_NGPIOINT > 0
|
||||
static int rp2040gpio_interrupt(int irq, void *context, void *arg)
|
||||
{
|
||||
struct rp2040gpint_dev_s *rp2040gpint =
|
||||
(struct rp2040gpint_dev_s *)arg;
|
||||
|
||||
DEBUGASSERT(rp2040gpint != NULL && rp2040gpint->callback != NULL);
|
||||
gpioinfo("Interrupt! callback=%p\n", rp2040gpint->callback);
|
||||
|
||||
rp2040gpint->callback(&rp2040gpint->rp2040gpio.gpio,
|
||||
rp2040gpint->rp2040gpio.id);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gpint_read
|
||||
****************************************************************************/
|
||||
|
||||
static int gpint_read(struct gpio_dev_s *dev, bool *value)
|
||||
{
|
||||
struct rp2040gpint_dev_s *rp2040gpint =
|
||||
(struct rp2040gpint_dev_s *)dev;
|
||||
|
||||
DEBUGASSERT(rp2040gpint != NULL && value != NULL);
|
||||
DEBUGASSERT(rp2040gpint->rp2040gpio.id < BOARD_NGPIOINT);
|
||||
gpioinfo("Reading int pin...\n");
|
||||
|
||||
*value = rp2040_gpio_get(g_gpiointinputs[rp2040gpint->rp2040gpio.id]);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gpint_attach
|
||||
****************************************************************************/
|
||||
|
||||
static int gpint_attach(struct gpio_dev_s *dev,
|
||||
pin_interrupt_t callback)
|
||||
{
|
||||
struct rp2040gpint_dev_s *rp2040gpint =
|
||||
(struct rp2040gpint_dev_s *)dev;
|
||||
int irq = g_gpiointinputs[rp2040gpint->rp2040gpio.id];
|
||||
int ret;
|
||||
|
||||
gpioinfo("Attaching the callback\n");
|
||||
|
||||
/* Make sure the interrupt is disabled */
|
||||
|
||||
rp2040_gpio_disable_irq(irq);
|
||||
ret = rp2040_gpio_irq_attach(irq,
|
||||
RP2040_GPIO_INTR_EDGE_LOW,
|
||||
rp2040gpio_interrupt,
|
||||
&g_gpint[rp2040gpint->rp2040gpio.id]);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: gpint_attach() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
gpioinfo("Attach %p\n", callback);
|
||||
rp2040gpint->callback = callback;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gpint_enable
|
||||
****************************************************************************/
|
||||
|
||||
static int gpint_enable(struct gpio_dev_s *dev, bool enable)
|
||||
{
|
||||
struct rp2040gpint_dev_s *rp2040gpint =
|
||||
(struct rp2040gpint_dev_s *)dev;
|
||||
int irq = g_gpiointinputs[rp2040gpint->rp2040gpio.id];
|
||||
|
||||
if (enable)
|
||||
{
|
||||
if (rp2040gpint->callback != NULL)
|
||||
{
|
||||
gpioinfo("Enabling the interrupt\n");
|
||||
|
||||
/* Configure the interrupt for rising edge */
|
||||
|
||||
rp2040_gpio_enable_irq(irq);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gpioinfo("Disable the interrupt\n");
|
||||
rp2040_gpio_disable_irq(irq);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rp2040_dev_gpio_init
|
||||
****************************************************************************/
|
||||
|
||||
int rp2040_dev_gpio_init(void)
|
||||
{
|
||||
int i;
|
||||
int pincount = 0;
|
||||
|
||||
#if BOARD_NGPIOOUT > 0
|
||||
for (i = 0; i < BOARD_NGPIOOUT; i++)
|
||||
{
|
||||
/* Setup and register the GPIO pin */
|
||||
|
||||
g_gpout[i].gpio.gp_pintype = GPIO_OUTPUT_PIN;
|
||||
g_gpout[i].gpio.gp_ops = &gpout_ops;
|
||||
g_gpout[i].id = i;
|
||||
gpio_pin_register(&g_gpout[i].gpio, g_gpiooutputs[i]);
|
||||
|
||||
/* Configure the pins that will be used as output */
|
||||
|
||||
rp2040_gpio_init(g_gpiooutputs[i]);
|
||||
rp2040_gpio_setdir(g_gpiooutputs[i], true);
|
||||
rp2040_gpio_put(g_gpiooutputs[i], false);
|
||||
|
||||
pincount++;
|
||||
}
|
||||
#endif
|
||||
|
||||
pincount = 0;
|
||||
|
||||
#if BOARD_NGPIOIN > 0
|
||||
for (i = 0; i < BOARD_NGPIOIN; i++)
|
||||
{
|
||||
/* Setup and register the GPIO pin */
|
||||
|
||||
g_gpin[i].gpio.gp_pintype = GPIO_INPUT_PIN;
|
||||
g_gpin[i].gpio.gp_ops = &gpin_ops;
|
||||
g_gpin[i].id = i;
|
||||
gpio_pin_register(&g_gpin[i].gpio, g_gpioinputs[i]);
|
||||
|
||||
/* Configure the pins that will be used as INPUT */
|
||||
|
||||
rp2040_gpio_init(g_gpioinputs[i]);
|
||||
|
||||
pincount++;
|
||||
}
|
||||
#endif
|
||||
|
||||
pincount = 0;
|
||||
|
||||
#if BOARD_NGPIOINT > 0
|
||||
for (i = 0; i < BOARD_NGPIOINT; i++)
|
||||
{
|
||||
/* Setup and register the GPIO pin */
|
||||
|
||||
g_gpint[i].rp2040gpio.gpio.gp_pintype = GPIO_INTERRUPT_PIN;
|
||||
g_gpint[i].rp2040gpio.gpio.gp_ops = &gpint_ops;
|
||||
g_gpint[i].rp2040gpio.id = i;
|
||||
gpio_pin_register(&g_gpint[i].rp2040gpio.gpio, g_gpiointinputs[i]);
|
||||
|
||||
/* Configure the pins that will be used as interrupt input */
|
||||
|
||||
rp2040_gpio_init(g_gpiointinputs[i]);
|
||||
|
||||
/* pull-up = false : pull-down = true */
|
||||
|
||||
rp2040_gpio_set_pulls(g_gpiointinputs[i], false, true);
|
||||
|
||||
pincount++;
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif /* CONFIG_DEV_GPIO && !CONFIG_GPIO_LOWER_HALF */
|
53
boards/arm/rp2040/w5500-evb-pico/src/rp2040_pico.h
Normal file
53
boards/arm/rp2040/w5500-evb-pico/src/rp2040_pico.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/src/rp2040_pico.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_RP2040_W5500_EVB_PICO_SRC_RP2040_PICO_H
|
||||
#define __BOARDS_ARM_RP2040_W5500_EVB_PICO_SRC_RP2040_PICO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/* LEDs */
|
||||
|
||||
#define GPIO_LED1 25 /* The board's LED is connected to this pin */
|
||||
|
||||
/* Buttons */
|
||||
|
||||
/* Buttons GPIO pins definition */
|
||||
|
||||
#define GPIO_BTN_USER1 16
|
||||
#define GPIO_BTN_USER2 17
|
||||
|
||||
/* Buttons IRQ definitions */
|
||||
|
||||
#define MIN_IRQBUTTON BUTTON_USER1
|
||||
#define MAX_IRQBUTTON BUTTON_USER2
|
||||
#define NUM_IRQBUTTONS (BUTTON_USER1 - BUTTON_USER2 + 1)
|
||||
|
||||
int rp2040_bringup(void);
|
||||
|
||||
#ifdef CONFIG_DEV_GPIO
|
||||
int rp2040_dev_gpio_init(void);
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_ARM_RP2040_W5500_EVB_PICO_SRC_RP2040_PICO_H */
|
215
boards/arm/rp2040/w5500-evb-pico/src/rp2040_userleds.c
Normal file
215
boards/arm/rp2040/w5500-evb-pico/src/rp2040_userleds.c
Normal file
|
@ -0,0 +1,215 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rp2040/w5500-evb-pico/src/rp2040_userleds.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/power/pm.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "arm_internal.h"
|
||||
#include "chip.h"
|
||||
#include "rp2040_gpio.h"
|
||||
|
||||
#include "rp2040_pico.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This array maps an LED number to GPIO pin configuration */
|
||||
|
||||
static uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||
{
|
||||
GPIO_LED1,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Protototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* LED Power Management */
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void led_pm_notify(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
static int led_pm_prepare(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static struct pm_callback_s g_ledscb =
|
||||
{
|
||||
.notify = led_pm_notify,
|
||||
.prepare = led_pm_prepare,
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_pm_notify
|
||||
*
|
||||
* Description:
|
||||
* Notify the driver of new power state. This callback is called after
|
||||
* all drivers have had the opportunity to prepare for the new power state.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void led_pm_notify(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate)
|
||||
{
|
||||
switch (pmstate)
|
||||
{
|
||||
case(PM_NORMAL):
|
||||
{
|
||||
/* Restore normal LEDs operation */
|
||||
|
||||
board_userled(BOARD_LED, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_IDLE):
|
||||
{
|
||||
/* Entering IDLE mode - Turn leds off */
|
||||
|
||||
board_userled(BOARD_LED, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_STANDBY):
|
||||
{
|
||||
/* Entering STANDBY mode - Logic for PM_STANDBY goes here */
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_SLEEP):
|
||||
{
|
||||
/* Entering SLEEP mode - Logic for PM_SLEEP goes here */
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/* Should not get here */
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_pm_prepare
|
||||
*
|
||||
* Description:
|
||||
* Request the driver to prepare for a new power state. This is a warning
|
||||
* that the system is about to enter into a new power state. The driver
|
||||
* should begin whatever operations that may be required to enter power
|
||||
* state. The driver may abort the state change mode by returning a
|
||||
* non-zero value from the callback function.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int led_pm_prepare(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate)
|
||||
{
|
||||
/* No preparation to change power modes is required by the LEDs driver.
|
||||
* We always accept the state change by returning OK.
|
||||
*/
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_userled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIO for output */
|
||||
|
||||
rp2040_gpio_init(GPIO_LED1);
|
||||
rp2040_gpio_setdir(GPIO_LED1, true);
|
||||
|
||||
return BOARD_NLEDS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if ((unsigned)led < BOARD_NLEDS)
|
||||
{
|
||||
rp2040_gpio_put(g_ledcfg[led], ledon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint32_t ledset)
|
||||
{
|
||||
rp2040_gpio_put(GPIO_LED1, (ledset & BOARD_LED1_BIT));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rp2040_led_pminitialize
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
void rp2040_led_pminitialize(void)
|
||||
{
|
||||
/* Register to receive power management callbacks */
|
||||
|
||||
int ret = pm_register(&g_ledscb);
|
||||
if (ret != OK)
|
||||
{
|
||||
board_autoled_on(LED_ASSERTION);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
Loading…
Reference in a new issue