diff --git a/boards/avr/at32uc3/avr32dev1/README.txt b/boards/avr/at32uc3/avr32dev1/README.txt index 9656eb75e17..663c6d80848 100644 --- a/boards/avr/at32uc3/avr32dev1/README.txt +++ b/boards/avr/at32uc3/avr32dev1/README.txt @@ -34,7 +34,7 @@ The only GPIO pin usage is for LEDs (2) and Buttons (2): PIN 24 PB2 KEY1 PIN 25 PB3 KEY2 -(See boards/avr32dev1/src/avr32dev1.h). And also for +(See boards/avr/at32uc3/avr32dev1/src/avr32dev1.h). And also for crystals (4), JTAG (1), and USB (1): PIN 30 PA11 XIN32 @@ -83,7 +83,7 @@ RS-232 drivers or connectors on board. I use an off-board MAX232 module that I got on eBay (search for MAX232 if you want to find one). I connect the MAX232 board as follows: -In boards/avr32dev/include/board.h: +In boards/avr/at32uc3/avr32dev/include/board.h: #define PINMUX_USART1_RXD PINMUX_USART1_RXD_1 #define PINMUX_USART1_TXD PINMUX_USART1_TXD_1 diff --git a/boards/avr/at32uc3/avr32dev1/include/board.h b/boards/avr/at32uc3/avr32dev1/include/board.h index 799d961ef95..e2983dcfbf4 100644 --- a/boards/avr/at32uc3/avr32dev1/include/board.h +++ b/boards/avr/at32uc3/avr32dev1/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/avr/avr32dev1/include/board.h +/**************************************************************************** + * boards/avr/at32uc3/avr32dev1/include/board.h * * Copyright (C) 2010-2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,27 +31,28 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_AVR_AVR32DEV1_INCLUDE_BOARD_H -#define __BOARDS_AVR_AVR32DEV1_INCLUDE_BOARD_H +#ifndef __BOARDS_AVR_AT32UC3_AVR32DEV1_INCLUDE_BOARD_H +#define __BOARDS_AVR_AT32UC3_AVR32DEV1_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* Oscillator setup: RCOSC, OSC32, OSC0, OSC1. Only RCOSC, OSC0, or PLL0 can drive - * the main clock. +/* Clocking *****************************************************************/ + +/* Oscillator setup: RCOSC, OSC32, OSC0, OSC1. Only RCOSC, OSC0, or PLL0 can + * drive the main clock. */ /* The RCOSC frequency needs to be calibrated! */ @@ -62,7 +63,7 @@ #define AVR32_OSC32STARTUP 3 /* OSC32 startup time in RCOSC periods */ #define AVR32_FOSC0 12000000 /* OSC0 frequency in Hz */ -#define AVR32_OSC0STARTUP 3 /* OSC0 startup time in RCOSC periods. +#define AVR32_OSC0STARTUP 3 /* OSC0 startup time in RCOSC periods. */ /* #define AVR32_FOSC1 12000000 OSC1 frequency: Hz. * #define AVR32_OSC1STARTUP 3 OSC1 startup time in RCOSC periods. @@ -135,12 +136,13 @@ #define AVR32_CPU_CLOCK AVR32_FOSC0 #define AVR32_PBA_CLOCK AVR32_FOSC0 -/* Pin muliplexing selecion *********************************************************/ +/* Pin muliplexing selecion *************************************************/ #define PINMUX_USART1_RXD PINMUX_USART1_RXD_1 #define PINMUX_USART1_TXD PINMUX_USART1_TXD_1 -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ + /* The AVR32DEV1 board has 3 LEDs, two of which can be controlled through GPIO pins */ /* ON OFF */ @@ -154,11 +156,11 @@ #define LED_ASSERTION 2 /* ON ON ON OFF */ #define LED_PANIC 2 /* ON ON ON OFF */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ + /* The AVR32DEV1 board has 3 BUTTONs, two of which can be sensed through GPIO pins. */ #define BUTTON1 1 /* Bit 0: Button 1 */ #define BUTTON2 2 /* Bit 1: Button 2 */ -#endif /* __BOARDS_AVR_AVR32DEV1_INCLUDE_BOARD_H */ - +#endif /* __BOARDS_AVR_AT32UC3_AVR32DEV1_INCLUDE_BOARD_H */ diff --git a/boards/avr/at32uc3/avr32dev1/scripts/Make.defs b/boards/avr/at32uc3/avr32dev1/scripts/Make.defs index 53e3ec9c73a..c1a3e39076e 100644 --- a/boards/avr/at32uc3/avr32dev1/scripts/Make.defs +++ b/boards/avr/at32uc3/avr32dev1/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/avr32dev1/scripts/Make.defs +# boards/avr/at32uc3/avr32dev1/scripts/Make.defs # # Copyright (C) 2010, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/at32uc3/avr32dev1/scripts/avr32dev1.ld b/boards/avr/at32uc3/avr32dev1/scripts/avr32dev1.ld index 91245262a71..4cf242b2182 100644 --- a/boards/avr/at32uc3/avr32dev1/scripts/avr32dev1.ld +++ b/boards/avr/at32uc3/avr32dev1/scripts/avr32dev1.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/avr32dev1/scripts/avr32dev1.ld + * boards/avr/at32uc3/avr32dev1/scripts/avr32dev1.ld * * Copyright (C) 2010, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/avr/at32uc3/avr32dev1/src/Makefile b/boards/avr/at32uc3/avr32dev1/src/Makefile index 88750362fd9..d7e669cca01 100644 --- a/boards/avr/at32uc3/avr32dev1/src/Makefile +++ b/boards/avr/at32uc3/avr32dev1/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/avr32dev1/src/Makefile +# boards/avr/at32uc3/avr32dev1/src/Makefile # # Copyright (C) 2010 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/at32uc3/avr32dev1/src/avr32_boot.c b/boards/avr/at32uc3/avr32dev1/src/avr32_boot.c index 32564b46149..a4e9c7f665d 100644 --- a/boards/avr/at32uc3/avr32dev1/src/avr32_boot.c +++ b/boards/avr/at32uc3/avr32dev1/src/avr32_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/avr/avr32dev1/src/avr32_boot.c +/**************************************************************************** + * boards/avr/at32uc3/avr32dev1/src/avr32_boot.c * * Copyright (C) 2010, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -50,27 +50,28 @@ #include "at32uc3.h" #include "avr32dev1.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: at32uc3_boardinitialize * * Description: - * All AVR32 AT32UC3 architectures must provide the following entry point. This - * entry point is called early in the initialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All AVR32 AT32UC3 architectures must provide the following entry point. + * This entry point is called early in the initialization - after all memory + * has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void at32uc3_boardinitialize(void) { diff --git a/boards/avr/at32uc3/avr32dev1/src/avr32_buttons.c b/boards/avr/at32uc3/avr32dev1/src/avr32_buttons.c index 1bd37b51e67..fc83d97a197 100644 --- a/boards/avr/at32uc3/avr32dev1/src/avr32_buttons.c +++ b/boards/avr/at32uc3/avr32dev1/src/avr32_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/avr32dev1/src/avr32_buttons.c + * boards/avr/at32uc3/avr32dev1/src/avr32_buttons.c * * Copyright (C) 2010-2011, 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -86,7 +86,7 @@ static int board_button_irqx(int irq, xcpt_t irqhandler, void *arg) else { gpio_irqdisable(irq); - } + } } return OK; @@ -102,9 +102,9 @@ static int board_button_irqx(int irq, xcpt_t irqhandler, void *arg) * * 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 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. * ****************************************************************************/ diff --git a/boards/avr/at32uc3/avr32dev1/src/avr32_leds.c b/boards/avr/at32uc3/avr32dev1/src/avr32_leds.c index ef368ed6134..a6c24d6b534 100644 --- a/boards/avr/at32uc3/avr32dev1/src/avr32_leds.c +++ b/boards/avr/at32uc3/avr32dev1/src/avr32_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/avr32dev1/src/avr32_leds.c + * boards/avr/at32uc3/avr32dev1/src/avr32_leds.c * * Copyright (C) 2010, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/avr/at32uc3/avr32dev1/src/avr32dev1.h b/boards/avr/at32uc3/avr32dev1/src/avr32dev1.h index 246f5fadb08..6a53d900641 100644 --- a/boards/avr/at32uc3/avr32dev1/src/avr32dev1.h +++ b/boards/avr/at32uc3/avr32dev1/src/avr32dev1.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/avr/avr32dev1/src/avr32dev1.h +/**************************************************************************** + * boards/avr/at32uc3/avr32dev1/src/avr32dev1.h * * Copyright (C) 2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,24 +31,24 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef _CONFIGS_AVR32DEV1_SRC_AVR32DEV1_H -#define _CONFIGS_AVR32DEV1_SRC_AVR32DEV1_H +#ifndef __BOARDS_AVR_AT32UC3_AVR32DEV1_SRC_AVR32DEV1_H +#define __BOARDS_AVR_AT32UC3_AVR32DEV1_SRC_AVR32DEV1_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include #include "at32uc3_config.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Configuration ********************************************************************/ +/* Configuration ************************************************************/ #if (CONFIG_AVR32_GPIOIRQSETB & 4) == 1 # define CONFIG_AVR32DEV_BUTTON1_IRQ 1 @@ -58,10 +58,12 @@ # define CONFIG_AVR32DEV_BUTTON2_IRQ 1 #endif -/* AVRDEV1 GPIO Pin Definitions *****************************************************/ +/* AVRDEV1 GPIO Pin Definitions *********************************************/ + /* LEDs * - * The AVR32DEV1 board has 3 LEDs, two of which can be controlled through GPIO pins. + * The AVR32DEV1 board has 3 LEDs, + * two of which can be controlled through GPIO pins. * * PIN 13 PA7 LED1 * PIN 14 PA8 LED2 @@ -72,7 +74,8 @@ /* BUTTONs * - * The AVR32DEV1 board has 3 BUTTONs, two of which can be sensed through GPIO pins. + * The AVR32DEV1 board has 3 BUTTONs, + * two of which can be sensed through GPIO pins. * * PIN 24 PB2 KEY1 * PIN 25 PB3 KEY2 @@ -96,19 +99,19 @@ GPIO_PORTB | 3) #endif -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ #endif /* __ASSEMBLY__ */ -#endif /* _CONFIGS_AVR32DEV1_SRC_AVR32DEV1_H */ +#endif /* __BOARDS_AVR_AT32UC3_AVR32DEV1_SRC_AVR32DEV1_H */ diff --git a/boards/avr/at90usb/micropendous3/include/board.h b/boards/avr/at90usb/micropendous3/include/board.h index d3e20baf74f..30ad16608a3 100644 --- a/boards/avr/at90usb/micropendous3/include/board.h +++ b/boards/avr/at90usb/micropendous3/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/micropendous3/include/board.h + * boards/avr/at90usb/micropendous3/include/board.h * include/arch/board/board.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. @@ -34,8 +34,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_MICROPENDOUS3_INCLUDE_BOARD_H -#define __BOARDS_AVR_MICROPENDOUS3_INCLUDE_BOARD_H +#ifndef __BOARDS_AVR_AT90USB_MICROPENDOUS3_INCLUDE_BOARD_H +#define __BOARDS_AVR_AT90USB_MICROPENDOUS3_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -46,15 +46,18 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */ #define BOARD_XTAL_FREQ 16000000 /* 16MHz crystal */ #define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 16MHz */ /* LED definitions **********************************************************/ + /* The Micropendous 3 has no on-board LEDs */ #define LED_STARTED 0 @@ -67,6 +70,7 @@ #define LED_PANIC 7 /* Button definitions *******************************************************/ + /* SW1 = Connects to AT90USBxx RESET pin and is not available to software. * SW2 = Connects (via a pull-up) to PE-2 */ @@ -87,7 +91,8 @@ #ifdef __cplusplus #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -98,4 +103,4 @@ extern "C" { #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_MICROPENDOUS3_INCLUDE_BOARD_H */ +#endif /* __BOARDS_AVR_AT90USB_MICROPENDOUS3_INCLUDE_BOARD_H */ diff --git a/boards/avr/at90usb/micropendous3/scripts/Make.defs b/boards/avr/at90usb/micropendous3/scripts/Make.defs index d1310933f95..adc56bbab4b 100644 --- a/boards/avr/at90usb/micropendous3/scripts/Make.defs +++ b/boards/avr/at90usb/micropendous3/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/micropendous3/scripts/Make.defs +# boards/avr/at90usb/micropendous3/scripts/Make.defs # # Copyright (C) 2011-2012, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/at90usb/micropendous3/scripts/micropendous3.ld b/boards/avr/at90usb/micropendous3/scripts/micropendous3.ld index 2a23e5faedd..0b956d2b9ba 100644 --- a/boards/avr/at90usb/micropendous3/scripts/micropendous3.ld +++ b/boards/avr/at90usb/micropendous3/scripts/micropendous3.ld @@ -1,5 +1,5 @@ -/************************************************************************************** - * boards/avr/micropendous3/scripts/micropendous3.ld +/**************************************************************************** + * boards/avr/at90usb/micropendous3/scripts/micropendous3.ld * * Copyright (C) 2011, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,9 +31,9 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - **************************************************************************************/ + ****************************************************************************/ -/* Memory Regions *********************************************************************/ +/* Memory Regions ***********************************************************/ /* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- --- * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM * | REGISTERS REGISTERS | diff --git a/boards/avr/at90usb/micropendous3/src/Makefile b/boards/avr/at90usb/micropendous3/src/Makefile index efe7d8b07d2..8e78ff4f4f7 100644 --- a/boards/avr/at90usb/micropendous3/src/Makefile +++ b/boards/avr/at90usb/micropendous3/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/micropendous3/src/Makefile +# boards/avr/at90usb/micropendous3/src/Makefile # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/at90usb/micropendous3/src/at90usb_boot.c b/boards/avr/at90usb/micropendous3/src/at90usb_boot.c index c21f4a535c7..62eb57571e0 100644 --- a/boards/avr/at90usb/micropendous3/src/at90usb_boot.c +++ b/boards/avr/at90usb/micropendous3/src/at90usb_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/avr/micropendous3/src/at90usb_boot.c +/**************************************************************************** + * boards/avr/at90usb/micropendous3/src/at90usb_boot.c * * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,32 +49,34 @@ #include "at90usb.h" #include "micropendous3.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: at90usb_boardinitialize * * Description: - * All AT90USB architectures must provide the following entry point. This entry - * point is called early in the initialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All AT90USB architectures must provide the following entry point. + * This entry point is called early in the initialization - after all memory + * has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void at90usb_boardinitialize(void) { - /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak - * function at90usb_spidev_initialize() has been brought into the link. + /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) + * the weak function at90usb_spidev_initialize() has been brought into + * the link. */ #if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2) diff --git a/boards/avr/at90usb/micropendous3/src/micropendous3.h b/boards/avr/at90usb/micropendous3/src/micropendous3.h index cc3e38b96fb..baee646e9d3 100644 --- a/boards/avr/at90usb/micropendous3/src/micropendous3.h +++ b/boards/avr/at90usb/micropendous3/src/micropendous3.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/micropendous3/src/micropendous3.h + * boards/avr/at90usb/micropendous3/src/micropendous3.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_MICROPENDOUS3_SRC_MICROPENDOUS3_H -#define __BOARDS_AVR_MICROPENDOUS3_SRC_MICROPENDOUS3_H +#ifndef __BOARDS_AVR_AT90USB_MICROPENDOUS3_SRC_MICROPENDOUS3_H +#define __BOARDS_AVR_AT90USB_MICROPENDOUS3_SRC_MICROPENDOUS3_H /**************************************************************************** * Included Files @@ -45,6 +45,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /**************************************************************************** @@ -63,30 +64,32 @@ #ifdef __cplusplus #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: at90usb_spidev_initialize * * Description: - * Called to configure SPI chip select GPIO pins for the Micropendous3 board. + * Called to configure SPI chip select GPIO pins for the Micropendous3 + * board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2) EXTERN void weak_function at90usb_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: at90usb_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS EXTERN void at90usb_led_initialize(void); @@ -98,4 +101,4 @@ EXTERN void at90usb_led_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_MICROPENDOUS3_SRC_MICROPENDOUS3_H */ +#endif /* __BOARDS_AVR_AT90USB_MICROPENDOUS3_SRC_MICROPENDOUS3_H */ diff --git a/boards/avr/at90usb/teensy-2.0/include/board.h b/boards/avr/at90usb/teensy-2.0/include/board.h index e21e5ccefe4..37cde75d9d4 100644 --- a/boards/avr/at90usb/teensy-2.0/include/board.h +++ b/boards/avr/at90usb/teensy-2.0/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/teensy-2.0/include/board.h + * boards/avr/at90usb/teensy-2.0/include/board.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_TEENSY_20_INCLUDE_BOARD_H -#define __BOARDS_AVR_TEENSY_20_INCLUDE_BOARD_H +#ifndef __BOARDS_AVR_AT90USB_TEENSY_20_INCLUDE_BOARD_H +#define __BOARDS_AVR_AT90USB_TEENSY_20_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -45,16 +45,20 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */ #define BOARD_XTAL_FREQ 16000000 /* 16MHz crystal */ #define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 16MHz */ /* LED definitions **********************************************************/ + /* The Teensy++ 2.0 has a single on-board LEDs connected to PortD, Pin 6 */ + /* ON OFF */ #define LED_STARTED 0 /* OFF ON (never happens) */ #define LED_HEAPALLOCATE 0 /* OFF ON (never happens) */ @@ -66,6 +70,7 @@ #define LED_PANIC 0 /* OFF ON (1Hz flashing) */ /* Button definitions *******************************************************/ + /* SW1 = Connects to AT90USBxx RESET pin and is not available to software */ /**************************************************************************** @@ -96,4 +101,4 @@ extern "C" #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_TEENSY_20_INCLUDE_BOARD_H */ +#endif /* __BOARDS_AVR_AT90USB_TEENSY_20_INCLUDE_BOARD_H */ diff --git a/boards/avr/at90usb/teensy-2.0/scripts/Make.defs b/boards/avr/at90usb/teensy-2.0/scripts/Make.defs index 55bfe3d0e56..f99f3217160 100644 --- a/boards/avr/at90usb/teensy-2.0/scripts/Make.defs +++ b/boards/avr/at90usb/teensy-2.0/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/teensy-2.0/scripts/Make.defs +# boards/avr/at90usb/teensy-2.0/scripts/Make.defs # # Copyright (C) 2011-2012, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/at90usb/teensy-2.0/scripts/flash.ld b/boards/avr/at90usb/teensy-2.0/scripts/flash.ld index 58de14cff24..59b91c1ae16 100644 --- a/boards/avr/at90usb/teensy-2.0/scripts/flash.ld +++ b/boards/avr/at90usb/teensy-2.0/scripts/flash.ld @@ -1,5 +1,5 @@ /************************************************************************************ - * boards/avr/teensy-2.0/scripts/flash.ld + * boards/avr/at90usb/teensy-2.0/scripts/flash.ld * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/avr/at90usb/teensy-2.0/src/Makefile b/boards/avr/at90usb/teensy-2.0/src/Makefile index bcd9b42a3ee..5ccb91faacc 100644 --- a/boards/avr/at90usb/teensy-2.0/src/Makefile +++ b/boards/avr/at90usb/teensy-2.0/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/teensy-2.0/src/Makefile +# boards/avr/at90usb/teensy-2.0/src/Makefile # # Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c b/boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c index b59e2ff8b89..41e2ccec3d2 100644 --- a/boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c +++ b/boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/teensy-2.0/src/at90usb_appinit.c + * boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c b/boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c index 7d83c365ca4..81c4a7a87eb 100644 --- a/boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c +++ b/boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/avr/teensy-2.0/src/at90usb_boot.c +/**************************************************************************** + * boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c * * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,25 +49,26 @@ #include "at90usb.h" #include "teensy-20.h" -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: at90usb_boardinitialize * * Description: - * All AT90USB architectures must provide the following entry point. This entry - * point is called early in the initialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All AT90USB architectures must provide the following entry point. + * This entry point is called early in the initialization -- after + * all memory has been configured and mapped but before any devices + * have been initialized. * - ************************************************************************************/ + ****************************************************************************/ void at90usb_boardinitialize(void) { #ifdef CONFIG_AVR_SPI - /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak - * function at90usb_spidev_initialize() has been brought into the link. + /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the + * weak function at90usb_spidev_initialize() has been brought into the link. */ if (at90usb_spidev_initialize) diff --git a/boards/avr/at90usb/teensy-2.0/src/at90usb_leds.c b/boards/avr/at90usb/teensy-2.0/src/at90usb_leds.c index e90456ac6b4..08850679dcb 100644 --- a/boards/avr/at90usb/teensy-2.0/src/at90usb_leds.c +++ b/boards/avr/at90usb/teensy-2.0/src/at90usb_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/teensy-2.0/src/at90usb_leds.c + * boards/avr/at90usb/teensy-2.0/src/at90usb_leds.c * * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -100,17 +100,20 @@ void board_autoled_on(int led) switch (led) { case 0: + /* The steady state is OFF */ g_ncoff = true; case 2: + /* Turn the LED off */ PORTD &= ~(1 << 6); break; case 1: + /* The steady state is ON */ PORTD |= (1 << 6); @@ -142,6 +145,7 @@ void board_autoled_off(int led) switch (led) { case 2: + /* If the "no-change" state is OFF, then turn the LED off */ if (g_ncoff) @@ -154,6 +158,7 @@ void board_autoled_off(int led) case 0: case 1: + /* Turn the LED on */ PORTD |= (1 << 6); diff --git a/boards/avr/at90usb/teensy-2.0/src/at90usb_spi.c b/boards/avr/at90usb/teensy-2.0/src/at90usb_spi.c index 9edec085961..f8d5d4fd64e 100644 --- a/boards/avr/at90usb/teensy-2.0/src/at90usb_spi.c +++ b/boards/avr/at90usb/teensy-2.0/src/at90usb_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/avr/teensy-2.0/src/at90usb_spi.c +/**************************************************************************** + * boards/avr/at90usb/teensy-2.0/src/at90usb_spi.c * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -54,9 +54,10 @@ #ifdef CONFIG_AVR_SPI -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* Teensy SPI Connection * * -- ---- -- ------------------------- ------- @@ -80,65 +81,71 @@ #define TEENSY_CD (1 << 4) #define TEENSY_WP (1 << 5) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: at90usb_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the LPC1766-STK. * - ************************************************************************************/ + ****************************************************************************/ void weak_function at90usb_spidev_initialize(void) { - /* The Teensy board has no dedicated SPI devices so we assume that SS is used - * for chip select: + /* The Teensy board has no dedicated SPI devices so we assume that SS is + * used for chip select: * - * "When the SPI is configured as a Master (MSTR in SPCR is set), the user - * can determine the direction of the SS pin. If SS is configured as an - * output, the pin is a general output pin which does not affect the SPI - * system. ... + * "When the SPI is configured as a Master (MSTR in SPCR is set), the + * user can determine the direction of the SS pin. + * If SS is configured as an output, the pin is a general output pin + * which does not affect the SPI system. ... * - * "If SS is configured as an input, it must be held high to ensure Master - * SPI operation. If the SS pin is driven low by peripheral circuitry when - * the SPI is configured as a Master with the SS pin defined as an input, - * the SPI system interprets this as another master selecting the SPI ... + * "If SS is configured as an input, it must be held high to ensure + * Master SPI operation. If the SS pin is driven low by peripheral + * circuitry when the SPI is configured as a Master with the SS pin + * defined as an input, the SPI system interprets this as another + * master selecting the SPI ... */ - DDRB |= TEENSY_CS; /* B0 is an output */ - PORTB |= TEENSY_CS; /* Low de-selects */ - DDRB &= ~(TEENSY_CD | TEENSY_WP); /* B4 and B5 are inputs */ - PORTB |= (TEENSY_CD | TEENSY_WP); /* Pull high */ + DDRB |= TEENSY_CS; /* B0 is an output */ + PORTB |= TEENSY_CS; /* Low de-selects */ + DDRB &= ~(TEENSY_CD | TEENSY_WP); /* B4 and B5 are inputs */ + PORTB |= (TEENSY_CD | TEENSY_WP); /* Pull high */ } -/************************************************************************************ +/**************************************************************************** * Name: avr_spiselect and avr_spistatus * * Description: - * The external functions, avr_spiselect and avr_spistatus must be provided by - * board-specific logic. They are implementations of the select and status methods - * of the SPI interface defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All - * other methods (including avr_spibus_initialize()) are provided by common AVR logic. + * The external functions, avr_spiselect and avr_spistatus must be provided + * by board-specific logic. They are implementations of the select and + * status methods of the SPI interface defined by struct spi_ops_s + * (see include/nuttx/spi/spi.h). + * All other methods (including avr_spibus_initialize()) are provided by + * common AVR logic. * To use this common SPI logic on your board: * - * 1. Provide logic in avr_spidev_initialize() to configure SPI chip select pins. - * 2. Provide avr_spiselect() and avr_spistatus() functions in your board-specific - * logic. These functions will perform chip selection and status operations - * in the way your board is configured. - * 3. Add a calls to at90usb_spidev_initialize() in your low level application - * initialization logic - * 4. The handle returned by avr_spibus_initialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling mmcsd_spislotinitialize(), + * 1. Provide logic in avr_spidev_initialize() to configure SPI + * chip select pins. + * 2. Provide avr_spiselect() and avr_spistatus() functions in your + * board-specific logic. These functions will perform chip selection and + * status operations in the way your board is configured. + * 3. Add a calls to at90usb_spidev_initialize() in your low level + * application initialization logic + * 4. The handle returned by avr_spibus_initialize() may then be used to + * bind the SPI driver to higher level logic + * (e.g., calling mmcsd_spislotinitialize(), * for example, will bind the SPI driver to the SPI MMC/SD driver). * - ************************************************************************************/ + ****************************************************************************/ void avr_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); /* Assert/de-assert the CS pin to the card */ diff --git a/boards/avr/at90usb/teensy-2.0/src/at90usb_usbmsc.c b/boards/avr/at90usb/teensy-2.0/src/at90usb_usbmsc.c index 0702d8ff242..9dbd9c2e7b3 100644 --- a/boards/avr/at90usb/teensy-2.0/src/at90usb_usbmsc.c +++ b/boards/avr/at90usb/teensy-2.0/src/at90usb_usbmsc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/teens-2.0/src/at90usb_usbmsc.c + * boards/avr/at90usb/teens-2.0/src/at90usb_usbmsc.c * * Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -101,7 +101,8 @@ int board_usbmsc_initialize(int port) syslog(LOG_INFO, "Binding SPI port to MMC/SD slot\n"); - ret = mmcsd_spislotinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1, AVR_MMCSDSLOTNO, spi); + ret = mmcsd_spislotinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1, + AVR_MMCSDSLOTNO, spi); if (ret < 0) { syslog(LOG_ERR, "ERROR: mmcsd_spislotinitialize failed: %d\n", ret); diff --git a/boards/avr/at90usb/teensy-2.0/src/teensy-20.h b/boards/avr/at90usb/teensy-2.0/src/teensy-20.h index 8bb2fc38223..7373d6bbd42 100644 --- a/boards/avr/at90usb/teensy-2.0/src/teensy-20.h +++ b/boards/avr/at90usb/teensy-2.0/src/teensy-20.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/teensy-2.0/src/teensy-20.h + * boards/avr/at90usb/teensy-2.0/src/teensy-20.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_TEENSY_20_SRC_TEENSY_H -#define __BOARDS_AVR_TEENSY_20_SRC_TEENSY_H +#ifndef __BOARDS_AVR_AT90USB_TEENSY_20_SRC_TEENSY_H +#define __BOARDS_AVR_AT90USB_TEENSY_20_SRC_TEENSY_H /**************************************************************************** * Included Files @@ -56,25 +56,25 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: at90usb_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the Teensy++ 2.0 board. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_AVR_SPI void weak_function at90usb_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: at90usb_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void at90usb_led_initialize(void); @@ -86,4 +86,4 @@ void at90usb_led_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_TEENSY_20_SRC_TEENSY_H */ +#endif /* __BOARDS_AVR_AT90USB_TEENSY_20_SRC_TEENSY_H */ diff --git a/boards/avr/atmega/amber/include/board.h b/boards/avr/atmega/amber/include/board.h index ef2bc97cbdc..d7ed2a6a17d 100644 --- a/boards/avr/atmega/amber/include/board.h +++ b/boards/avr/atmega/amber/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/amber/include/board.h + * boards/avr/atmega/amber/include/board.h * include/arch/board/board.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. @@ -34,8 +34,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_AMBER_INCLUDE_BOARD_H -#define __BOARDS_AVR_AMBER_INCLUDE_BOARD_H +#ifndef __BOARDS_AVR_ATMEGA_AMBER_INCLUDE_BOARD_H +#define __BOARDS_AVR_ATMEGA_AMBER_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -46,9 +46,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */ #define BOARD_XTAL_FREQ 14745600 /* 14.7456MHz crystal */ @@ -56,6 +58,7 @@ #define BOARD_TOSCK_CLOCK 32768 /* TOSC = 32.768KHz */ /* LED definitions **********************************************************/ + /* The Amber Web Server has a reset switch and four LEDs. The LEDs indicate * the status of power, programming state, Ethernet link status and reset * status (Active). None are available for software use. @@ -86,7 +89,8 @@ #ifdef __cplusplus #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -97,4 +101,4 @@ extern "C" { #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_AMBER_INCLUDE_BOARD_H */ +#endif /* __BOARDS_AVR_ATMEGA_AMBER_INCLUDE_BOARD_H */ diff --git a/boards/avr/atmega/amber/scripts/Make.defs b/boards/avr/atmega/amber/scripts/Make.defs index 0566dae369f..7ebde03ebcd 100644 --- a/boards/avr/atmega/amber/scripts/Make.defs +++ b/boards/avr/atmega/amber/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/amber/scripts/Make.defs +# boards/avr/atmega/amber/scripts/Make.defs # # Copyright (C) 2011-2012, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/atmega/amber/scripts/amber.ld b/boards/avr/atmega/amber/scripts/amber.ld index cb04703f02c..f90b1553b45 100644 --- a/boards/avr/atmega/amber/scripts/amber.ld +++ b/boards/avr/atmega/amber/scripts/amber.ld @@ -1,5 +1,5 @@ -/************************************************************************************** - * boards/avr/amber/scripts/amber.ld +/**************************************************************************** + * boards/avr/atmega/amber/scripts/amber.ld * * Copyright (C) 2011, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,9 +31,10 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - **************************************************************************************/ + ****************************************************************************/ + +/* Memory Regions ***********************************************************/ -/* Memory Regions *********************************************************************/ /* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- --- * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM * | REGISTERS REGISTERS | diff --git a/boards/avr/atmega/amber/src/Makefile b/boards/avr/atmega/amber/src/Makefile index 1ea72fa49f7..af384ec0df9 100644 --- a/boards/avr/atmega/amber/src/Makefile +++ b/boards/avr/atmega/amber/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/amber/src/Makefile +# boards/avr/atmega/amber/src/Makefile # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/atmega/amber/src/amber.h b/boards/avr/atmega/amber/src/amber.h index 772bf4a547f..480d78e3925 100644 --- a/boards/avr/atmega/amber/src/amber.h +++ b/boards/avr/atmega/amber/src/amber.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/amber/src/amber.h + * boards/avr/atmega/amber/src/amber.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_AMBER_SRC_AMBER_H -#define __BOARDS_AVR_AMBER_SRC_AMBER_H +#ifndef __BOARDS_AVR_ATMEGA_AMBER_SRC_AMBER_H +#define __BOARDS_AVR_ATMEGA_AMBER_SRC_AMBER_H /**************************************************************************** * Included Files @@ -45,6 +45,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /**************************************************************************** @@ -69,25 +70,25 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: atmega_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the Amber Web Server. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2) void weak_function atmega_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: atmega_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void atmega_led_initialize(void); @@ -99,4 +100,4 @@ void atmega_led_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_AMBER_SRC_AMBER_H */ +#endif /* __BOARDS_AVR_ATMEGA_AMBER_SRC_AMBER_H */ diff --git a/boards/avr/atmega/amber/src/atmega_boot.c b/boards/avr/atmega/amber/src/atmega_boot.c index 669aabc6ea4..72427431bfc 100644 --- a/boards/avr/atmega/amber/src/atmega_boot.c +++ b/boards/avr/atmega/amber/src/atmega_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/avr/amber/src/atmega_boot.c +/**************************************************************************** + * boards/avr/atmega/amber/src/atmega_boot.c * * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,32 +49,34 @@ #include "atmega.h" #include "amber.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: atmega_boardinitialize * * Description: - * All ATMega architectures must provide the following entry point. This entry - * point is called early in the initialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All ATMega architectures must provide the following entry point. + * This entry point is called early in the initialization - after all memory + * has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void atmega_boardinitialize(void) { - /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak - * function atmega_spidev_initialize() has been brought into the link. + /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) + * the weak function atmega_spidev_initialize() has been brought into + * the link. */ #if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2) diff --git a/boards/avr/atmega/arduino-mega2560/include/board.h b/boards/avr/atmega/arduino-mega2560/include/board.h index 1a138d276dd..a2bf95a6f25 100644 --- a/boards/avr/atmega/arduino-mega2560/include/board.h +++ b/boards/avr/atmega/arduino-mega2560/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/arduino-mega2560/include/board.h + * boards/avr/atmega/arduino-mega2560/include/board.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_ARDUINO_MEGA2560_INCLUDE_BOARD_H -#define __BOARDS_AVR_ARDUINO_MEGA2560_INCLUDE_BOARD_H +#ifndef __BOARDS_AVR_ATMEGA_ARDUINO_MEGA2560_INCLUDE_BOARD_H +#define __BOARDS_AVR_ATMEGA_ARDUINO_MEGA2560_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -45,13 +45,15 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */ -//#define BOARD_XTAL_FREQ 20000000 /* 20MHz crystal */ -//#define BOARD_XTAL_FREQ 16700000 /* 16.7MHz crystal */ +//#define BOARD_XTAL_FREQ 20000000 /* 20MHz crystal */ +//#define BOARD_XTAL_FREQ 16700000 /* 16.7MHz crystal */ #define BOARD_XTAL_FREQ 16000000 /* 16MHz crystal */ #define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 16MHz */ @@ -71,7 +73,8 @@ #ifdef __cplusplus #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -82,4 +85,4 @@ extern "C" { #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_ARDUINO_MEGA2560_INCLUDE_BOARD_H */ +#endif /* __BOARDS_AVR_ATMEGA_ARDUINO_MEGA2560_INCLUDE_BOARD_H */ diff --git a/boards/avr/atmega/arduino-mega2560/scripts/Make.defs b/boards/avr/atmega/arduino-mega2560/scripts/Make.defs index 919436a7114..73e58436432 100644 --- a/boards/avr/atmega/arduino-mega2560/scripts/Make.defs +++ b/boards/avr/atmega/arduino-mega2560/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/arduino-mega2560/scripts/Make.defs +# boards/avr/atmega/arduino-mega2560/scripts/Make.defs # # Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/atmega/arduino-mega2560/scripts/flash.ld b/boards/avr/atmega/arduino-mega2560/scripts/flash.ld index 50746099b0b..a8c3c9d6478 100644 --- a/boards/avr/atmega/arduino-mega2560/scripts/flash.ld +++ b/boards/avr/atmega/arduino-mega2560/scripts/flash.ld @@ -1,5 +1,5 @@ -/******************************************************************************* - * boards/avr/arduino-mega2560/scripts/flash.ld +/**************************************************************************** + * boards/avr/atmega/arduino-mega2560/scripts/flash.ld * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,9 +31,10 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ******************************************************************************/ + ****************************************************************************/ + +/* Memory Regions ***********************************************************/ -/* Memory Regions *************************************************************/ /* ------ ------ ------+------- -- ------ -- ------ --- ------ ----+------- --- * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM * | REGISTERS REGISTERS | diff --git a/boards/avr/atmega/arduino-mega2560/src/Makefile b/boards/avr/atmega/arduino-mega2560/src/Makefile index a33b61cc312..4c8cea3f1bc 100644 --- a/boards/avr/atmega/arduino-mega2560/src/Makefile +++ b/boards/avr/atmega/arduino-mega2560/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/arduino-mega2560/src/Makefile +# boards/avr/atmega/arduino-mega2560/src/Makefile # # Copyright (C) 2015 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/atmega/arduino-mega2560/src/arduino_mega2560.h b/boards/avr/atmega/arduino-mega2560/src/arduino_mega2560.h index 6f4eac534fb..ce285469a85 100644 --- a/boards/avr/atmega/arduino-mega2560/src/arduino_mega2560.h +++ b/boards/avr/atmega/arduino-mega2560/src/arduino_mega2560.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/arduino-mega2560/src/arduino-mega2560.h + * boards/avr/atmega/arduino-mega2560/src/arduino-mega2560.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_ARDUINO_MEGA2560_SRC_ARDUINO_MEGA2560_H -#define __BOARDS_AVR_ARDUINO_MEGA2560_SRC_ARDUINO_MEGA2560_H +#ifndef __BOARDS_AVR_ATMEGA_ARDUINO_MEGA2560_SRC_ARDUINO_MEGA2560_H +#define __BOARDS_AVR_ATMEGA_ARDUINO_MEGA2560_SRC_ARDUINO_MEGA2560_H /**************************************************************************** * Included Files @@ -45,6 +45,7 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /**************************************************************************** @@ -61,17 +62,17 @@ * Public Function Prototypes ****************************************************************************/ -/******************************************************************************* +/**************************************************************************** * Name: atmega_ledinit * * Description: * Configure on-board LEDs if LED support has been selected. * - ******************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void atmega_led_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_ARDUINO_MEGA2560_SRC_ARDUINO_MEGA2560_H */ +#endif /* __BOARDS_AVR_ATMEGA_ARDUINO_MEGA2560_SRC_ARDUINO_MEGA2560_H */ diff --git a/boards/avr/atmega/arduino-mega2560/src/avr_boot.c b/boards/avr/atmega/arduino-mega2560/src/avr_boot.c index 1966b2b337a..8f9bff8b64b 100644 --- a/boards/avr/atmega/arduino-mega2560/src/avr_boot.c +++ b/boards/avr/atmega/arduino-mega2560/src/avr_boot.c @@ -1,5 +1,5 @@ -/****************************************************************************** - * boards/avr/arduino-mega2560/src/avr_boot.c +/**************************************************************************** + * boards/avr/atmega/arduino-mega2560/src/avr_boot.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ******************************************************************************/ + ****************************************************************************/ -/****************************************************************************** +/**************************************************************************** * Included Files - ******************************************************************************/ + ****************************************************************************/ #include @@ -49,19 +49,19 @@ #include "atmega.h" #include "arduino_mega2560.h" -/****************************************************************************** +/**************************************************************************** * Definitions - ******************************************************************************/ + ****************************************************************************/ -/****************************************************************************** +/**************************************************************************** * Private Functions - ******************************************************************************/ + ****************************************************************************/ -/****************************************************************************** +/**************************************************************************** * Public Functions - ******************************************************************************/ + ****************************************************************************/ -/****************************************************************************** +/**************************************************************************** * Name: up_boardinitialize * * Description: @@ -70,7 +70,7 @@ * memory has been configured and mapped but before any devices have been * initialized. * - ******************************************************************************/ + ****************************************************************************/ void atmega_boardinitialize(void) { diff --git a/boards/avr/atmega/arduino-mega2560/src/avr_leds.c b/boards/avr/atmega/arduino-mega2560/src/avr_leds.c index 34cb59d9413..652fb50f4a4 100644 --- a/boards/avr/atmega/arduino-mega2560/src/avr_leds.c +++ b/boards/avr/atmega/arduino-mega2560/src/avr_leds.c @@ -1,5 +1,5 @@ -/****************************************************************************** - * boards/avr/arduino-mega2560/src/avr_leds.c +/**************************************************************************** + * boards/avr/atmega/arduino-mega2560/src/avr_leds.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ******************************************************************************/ + ****************************************************************************/ -/****************************************************************************** +/**************************************************************************** * Included Files - ******************************************************************************/ + ****************************************************************************/ #include diff --git a/boards/avr/atmega/moteino-mega/include/board.h b/boards/avr/atmega/moteino-mega/include/board.h index 524618fb1d3..dc4c84ee1c5 100644 --- a/boards/avr/atmega/moteino-mega/include/board.h +++ b/boards/avr/atmega/moteino-mega/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/moteino-mega/include/board.h + * boards/avr/atmega/moteino-mega/include/board.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_MOTEINO_MEGA_INCLUDE_BOARD_H -#define __BOARDS_AVR_MOTEINO_MEGA_INCLUDE_BOARD_H +#ifndef __BOARDS_AVR_ATMEGA_MOTEINO_MEGA_INCLUDE_BOARD_H +#define __BOARDS_AVR_ATMEGA_MOTEINO_MEGA_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -45,9 +45,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */ #define BOARD_XTAL_FREQ 16000000 /* 16MHz crystal */ @@ -94,4 +96,4 @@ extern "C" #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_MOTEINO_MEGA_INCLUDE_BOARD_H */ +#endif /* __BOARDS_AVR_ATMEGA_MOTEINO_MEGA_INCLUDE_BOARD_H */ diff --git a/boards/avr/atmega/moteino-mega/scripts/Make.defs b/boards/avr/atmega/moteino-mega/scripts/Make.defs index 96973442491..c0b778f960f 100644 --- a/boards/avr/atmega/moteino-mega/scripts/Make.defs +++ b/boards/avr/atmega/moteino-mega/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/moteino-mega/scripts/Make.defs +# boards/avr/atmega/moteino-mega/scripts/Make.defs # # Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/atmega/moteino-mega/scripts/ld.script b/boards/avr/atmega/moteino-mega/scripts/ld.script index f3c3fe1f379..02fba05083c 100644 --- a/boards/avr/atmega/moteino-mega/scripts/ld.script +++ b/boards/avr/atmega/moteino-mega/scripts/ld.script @@ -1,5 +1,5 @@ -/************************************************************************************** - * boards/avr/moteino-mega/scripts/ld.script +/**************************************************************************** + * boards/avr/atmega/moteino-mega/scripts/ld.script * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,9 +31,9 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - **************************************************************************************/ + ****************************************************************************/ -/* Memory Regions *********************************************************************/ +/* Memory Regions ***********************************************************/ /* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- --- * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM * | REGISTERS REGISTERS | diff --git a/boards/avr/atmega/moteino-mega/src/Makefile b/boards/avr/atmega/moteino-mega/src/Makefile index 1707ed7b3f9..8a3929da0f7 100644 --- a/boards/avr/atmega/moteino-mega/src/Makefile +++ b/boards/avr/atmega/moteino-mega/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/avr/moteino-mega/src/Makefile +# boards/avr/atmega/moteino-mega/src/Makefile # # Copyright (C) 2015 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/avr/atmega/moteino-mega/src/avr_boot.c b/boards/avr/atmega/moteino-mega/src/avr_boot.c index f7f33016c8b..4a661d47abf 100644 --- a/boards/avr/atmega/moteino-mega/src/avr_boot.c +++ b/boards/avr/atmega/moteino-mega/src/avr_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/avr/moteino-mega/src/avr_boot.c +/**************************************************************************** + * boards/avr/atmega/moteino-mega/src/avr_boot.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,32 +49,34 @@ #include "atmega.h" #include "moteino_mega.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: atmega_boardinitialize * * Description: - * All ATMega architectures must provide the following entry point. This entry - * point is called early in the initialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All ATMega architectures must provide the following entry point. + * This entry point is called early in the initialization -- after all + * memory has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void atmega_boardinitialize(void) { - /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak - * function atmega_spidev_initialize() has been brought into the link. + /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) + * the weak function atmega_spidev_initialize() has been brought into the + * link. */ #if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2) diff --git a/boards/avr/atmega/moteino-mega/src/avr_leds.c b/boards/avr/atmega/moteino-mega/src/avr_leds.c index 95c307a79ac..5a7f3a1fb3b 100644 --- a/boards/avr/atmega/moteino-mega/src/avr_leds.c +++ b/boards/avr/atmega/moteino-mega/src/avr_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/moteino-mega/src/avr_leds.c + * boards/avr/atmega/moteino-mega/src/avr_leds.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -69,10 +69,10 @@ static bool g_ncoff; void atmega_led_initialize(void) { - /* The MoteinoMEGA's single LED is on Port D, Pin 7. Configure this pin as an - * output and turn it OFF. The "other" side of the LED is onnected to - * ground through a resistor. Therefore, a logic value of 0 should turn - * the LED off. + /* The MoteinoMEGA's single LED is on Port D, Pin 7. + * Configure this pin as an output and turn it OFF. + * The "other" side of the LED is onnected to ground through a resistor. + * Therefore, a logic value of 0 should turn the LED off. */ DDRD |= (1 << 7); @@ -100,17 +100,20 @@ void board_autoled_on(int led) switch (led) { case 0: + /* The steady state is OFF */ g_ncoff = true; case 2: + /* Turn the LED off */ PORTD &= ~(1 << 7); break; case 1: + /* The steady state is ON */ PORTD |= (1 << 7); @@ -142,6 +145,7 @@ void board_autoled_off(int led) switch (led) { case 2: + /* If the "no-change" state is OFF, then turn the LED off */ if (g_ncoff) @@ -154,6 +158,7 @@ void board_autoled_off(int led) case 0: case 1: + /* Turn the LED on */ PORTD |= (1 << 7); diff --git a/boards/avr/atmega/moteino-mega/src/moteino_mega.h b/boards/avr/atmega/moteino-mega/src/moteino_mega.h index 7208c60d631..41e0cae3554 100644 --- a/boards/avr/atmega/moteino-mega/src/moteino_mega.h +++ b/boards/avr/atmega/moteino-mega/src/moteino_mega.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/avr/moteino-mega/src/moteino-mega.h + * boards/avr/atmega/moteino-mega/src/moteino-mega.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_AVR_MOTEINO_MEGA_SRC_MOTEINO_MEGA_H -#define __BOARDS_AVR_MOTEINO_MEGA_SRC_MOTEINO_MEGA_H +#ifndef __BOARDS_AVR_ATMEGA_MOTEINO_MEGA_SRC_MOTEINO_MEGA_H +#define __BOARDS_AVR_ATMEGA_MOTEINO_MEGA_SRC_MOTEINO_MEGA_H /**************************************************************************** * Included Files @@ -45,6 +45,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /**************************************************************************** @@ -69,25 +70,25 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: atmega_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the Amber Web Server. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2) void weak_function atmega_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: atmega_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void atmega_led_initialize(void); @@ -99,4 +100,4 @@ void atmega_led_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_AVR_MOTEINO_MEGA_SRC_MOTEINO_MEGA_H */ +#endif /* __BOARDS_AVR_ATMEGA_MOTEINO_MEGA_SRC_MOTEINO_MEGA_H */ diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/include/board.h b/boards/hc/mcs92s12ne64/demo9s12ne64/include/board.h index 54043e0c387..6eaed5fb1bc 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/include/board.h +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/hc/demo9s12ne64/include/board.h +/**************************************************************************** + * boards/hc/mcs92s12ne64/demo9s12ne64/include/board.h * include/arch/board/board.h * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. @@ -32,38 +32,41 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __ARCH_BOARD_BOARD_H -#define __ARCH_BOARD_BOARD_H +#ifndef __BOARDS_HC_MCS92S12NE64_DEMO9S12NE64_INCLUDE_BOARD_H +#define __BOARDS_HC_MCS92S12NE64_DEMO9S12NE64_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #ifndef __ASSEMBLY__ # include #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + +/* Clocking *****************************************************************/ -/* Clocking *************************************************************************/ /* Frequency of the crystal oscillator */ #define HCS12_OSCCLK 16000000 /* 16MHz */ /* PLL Settings * - * SYNR register controls the multiplication factor of the PLL. If the PLL is on, the - * count in the loop divider (SYNR) register effectively multiplies up the PLL clock - * (PLLCLK) from the reference frequency by 2 x (SYNR+1). PLLCLK will not be below - * the minimum VCO frequency (fSCM). + * SYNR register controls the multiplication factor of the PLL. + * If the PLL is on, the count in the loop divider (SYNR) register effectively + * multiplies up the PLL clock (PLLCLK) from the reference frequency by 2 x + * (SYNR+1). + * PLLCLK will not be below the minimum VCO frequency (fSCM). * - * The REFDV register provides a finer granularity for the PLL multiplier steps. The - * count in the reference divider divides OSCCLK frequency by REFDV + 1. + * The REFDV register provides a finer granularity for the PLL multiplier + * steps. + * The count in the reference divider divides OSCCLK frequency by REFDV + 1. * * PLLCLK = 2 * OSCCLK * (SYNR + 1) / (REFDV + 1) * @@ -75,7 +78,7 @@ #define HCS12_PLLCLK (2*HCS12_OSCCLK*(HCS12_SYNR+1)/(HCS12_REFDV+1)) #define HCS12_BUSCLK (HSC12_PLLCLK/2) -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ /* The DEMO9S12NE64 board has 2 LEDs that we will encode as: */ @@ -88,6 +91,6 @@ #define LED_ASSERTION 2 /* LED1 + LED2 */ #define LED_PANIC 7 /* LED2 + N/C */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ -#endif /* __ARCH_BOARD_BOARD_H */ +#endif /* __BOARDS_HC_MCS92S12NE64_DEMO9S12NE64_INCLUDE_BOARD_H */ diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/Make.defs b/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/Make.defs index d4be853582f..7d565dfce4e 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/Make.defs +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/hc/demo9s12ne64/scripts/Make.defs +# boards/hc/mcs92s12ne64/demo9s12ne64/scripts/Make.defs # # Copyright (C) 2009,2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/demo9s12ne64-banked.ld b/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/demo9s12ne64-banked.ld index 8f1d9f6fc2f..88305440c3b 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/demo9s12ne64-banked.ld +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/demo9s12ne64-banked.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/hc/demo9s12ne64/ostest/demo9s12ne64-banked.ld + * boards/hc/mcs92s12ne64/demo9s12ne64/ostest/demo9s12ne64-banked.ld * * Copyright (C) 2009, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/demo9s12ne64-unbanked.ld b/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/demo9s12ne64-unbanked.ld index 874aeca4a99..bf1be8004c2 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/demo9s12ne64-unbanked.ld +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/scripts/demo9s12ne64-unbanked.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/hc/demo9s12ne64/ostest/demo9s12ne64-banked.ld + * boards/hc/mcs92s12ne64/demo9s12ne64/ostest/demo9s12ne64-banked.ld * * Copyright (C) 2009, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/src/Makefile b/boards/hc/mcs92s12ne64/demo9s12ne64/src/Makefile index 4e8a8203537..c9216a2e719 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/src/Makefile +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/hc/demo9s12ne64/src/Makefile +# boards/hc/mcs92s12ne64/demo9s12ne64/src/Makefile # # Copyright (C) 2009 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/src/demo9s12ne64.h b/boards/hc/mcs92s12ne64/demo9s12ne64/src/demo9s12ne64.h index 928a4ce7c60..47b0c402572 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/src/demo9s12ne64.h +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/src/demo9s12ne64.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/hc/demo9s12ne64/src/demo9s12ne64.h +/**************************************************************************** + * boards/hc/mcs92s12ne64/demo9s12ne64/src/demo9s12ne64.h * * Copyright (C) 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,47 +31,47 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_HC_DEMO9S12NE64_SRC_DEMO9S12NE64_H -#define __BOARDS_HC_DEMO9S12NE64_SRC_DEMO9S12NE64_H +#ifndef __BOARDS_HC_MCS92S12NE64_DEMO9S12NE64_SRC_DEMO9S12NE64_H +#define __BOARDS_HC_MCS92S12NE64_DEMO9S12NE64_SRC_DEMO9S12NE64_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* DEMO9S12NE64 GPIOs ***************************************************************/ +/* DEMO9S12NE64 GPIOs *******************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: hcs12_spidev_initialize * * Description: - * Called to configure SPI chip select GPIO pins for the STM3210E-EVAL board. + * Called to configure SPI chip select GPIO pins for the STM3210E-EVAL board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function hcs12_spidev_initialize(void); #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_HC_DEMO9S12NE64_SRC_DEMO9S12NE64_H */ +#endif /* __BOARDS_HC_MCS92S12NE64_DEMO9S12NE64_SRC_DEMO9S12NE64_H */ diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_appinit.c b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_appinit.c index 790f7a34bca..6abe4ddf21d 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_appinit.c +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/demo9s12ne64/src/m9s12_appinit.c + * boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_appinit.c * * Copyright (C) 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_boot.c b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_boot.c index 3441c8f8548..9004345ea39 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_boot.c +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/hc/demo9s12ne64/src/m9s12_boot.c +/**************************************************************************** + * boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_boot.c * * Copyright (C) 2009, 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -46,32 +46,33 @@ #include "demo9s12ne64.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: hcs12_boardinitialize * * Description: - * All HCS12 architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All HCS12 architectures must provide the following entry point. + * This entry point is called early in the intitialization -- after + * all memory has been configured and mapped but before any + * devices have been initialized. * - ************************************************************************************/ + ****************************************************************************/ void hcs12_boardinitialize(void) { - /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function - * hcs12_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak + * function hcs12_spidev_initialize() has been brought into the link. */ #if defined(CONFIG_INCLUDE_HCS12_ARCH_SPI) diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_buttons.c b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_buttons.c index 97e998320e8..8d39e68c0f7 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_buttons.c +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/hc/demo9s12ne64/src/m9s12_buttons.c + * boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_buttons.c * * Copyright (C) 2009, 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_leds.c b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_leds.c index de2dcc22288..a185a754d79 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_leds.c +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/hc/demo9s12ne64/src/m9s12_leds.c + * boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_leds.c * * Copyright (C) 2009, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_spi.c b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_spi.c index aa76226d377..6cc74ac330c 100644 --- a/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_spi.c +++ b/boards/hc/mcs92s12ne64/demo9s12ne64/src/m9s12_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/hc/demo9s12ne64/src/m9s12_spi.c +/**************************************************************************** + * boards/hc/mcs92s12ne64demo9s12ne64/src/m9s12_spi.c * * Copyright (C) 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -50,17 +50,17 @@ #if defined(CONFIG_HCS12_SPI) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: hcs12_spidev_initialize * * Description: - * Called to configure SPI chip select GPIO pins for the DEMO9S12NE64 board. + * Called to configure SPI chip select GPIO pins for the DEMO9S12NE64 board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function hcs12_spidev_initialize(void) { @@ -73,9 +73,10 @@ void weak_function hcs12_spidev_initialize(void) * The external functions, hcs12_spiselect and hcs12_spistatus must be * provided by board-specific logic. They are implementations of the select * and status methods of the SPI interface defined by struct spi_ops_s (see - * include/nuttx/spi/spi.h). All other methods (including hcs12_spibus_initialize()) - * are provided by common HCS12 logic. To use this common SPI logic on your - * board: + * include/nuttx/spi/spi.h). + * All other methods (including hcs12_spibus_initialize()) are provided by + * common HCS12 logic. + * To use this common SPI logic on your board: * * 1. Provide logic in hcs12_boardinitialize() to configure SPI chip select * pins. @@ -84,8 +85,8 @@ void weak_function hcs12_spidev_initialize(void) * status operations using GPIOs in the way your board is configured. * 3. Add a calls to hcs12_spibus_initialize() in your low level application * initialization logic - * 4. The handle returned by hcs12_spibus_initialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling + * 4. The handle returned by hcs12_spibus_initialize() may then be used to + * bind the SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). * diff --git a/boards/hc/mcs92s12ne64/ne64badge/include/board.h b/boards/hc/mcs92s12ne64/ne64badge/include/board.h index 5ef9741eb0f..a4d80be103f 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/include/board.h +++ b/boards/hc/mcs92s12ne64/ne64badge/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/hc/ne64badge/include/board.h +/**************************************************************************** + * boards/hc/mcs92s12ne64/ne64badge/include/board.h * include/arch/board/board.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. @@ -32,38 +32,41 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __ARCH_BOARD_BOARD_H -#define __ARCH_BOARD_BOARD_H +#ifndef __BOARDS_HC_MCS92S12NE64_NE64BADGE_INCLUDE_BOARD_H +#define __BOARDS_HC_MCS92S12NE64_NE64BADGE_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #ifndef __ASSEMBLY__ # include #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + +/* Clocking *****************************************************************/ -/* Clocking *************************************************************************/ /* Frequency of the crystal oscillator */ #define HCS12_OSCCLK 16000000 /* 16MHz */ /* PLL Settings * - * SYNR register controls the multiplication factor of the PLL. If the PLL is on, the - * count in the loop divider (SYNR) register effectively multiplies up the PLL clock - * (PLLCLK) from the reference frequency by 2 x (SYNR+1). PLLCLK will not be below + * SYNR register controls the multiplication factor of the PLL. + * If the PLL is on, the count in the loop divider (SYNR) register + * effectively multiplies up the PLL clock (PLLCLK) from the reference + * frequency by 2 x (SYNR+1). PLLCLK will not be below * the minimum VCO frequency (fSCM). * - * The REFDV register provides a finer granularity for the PLL multiplier steps. The - * count in the reference divider divides OSCCLK frequency by REFDV + 1. + * The REFDV register provides a finer granularity for the PLL multiplier + * steps. + * The count in the reference divider divides OSCCLK frequency by REFDV + 1. * * PLLCLK = 2 * OSCCLK * (SYNR + 1) / (REFDV + 1) * @@ -75,7 +78,7 @@ #define HCS12_PLLCLK (2*HCS12_OSCCLK*(HCS12_SYNR+1)/(HCS12_REFDV+1)) #define HCS12_BUSCLK (HSC12_PLLCLK/2) -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ /* The NE64 Badge board has 2 red LEDs that we will encode as: */ @@ -89,13 +92,14 @@ #define LED_ASSERTION 2 /* NC ON = In an assertion */ #define LED_PANIC 2 /* NC ON = Oops! We crashed. (flashing) */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ -/* The NE64 badge has 2 switches, one labed SW1 and the other SW2 on the board (but +/* The NE64 badge has 2 switches, + * one labed SW1 and the other SW2 on the board (but * referred to as button1 and button2 in some documentation) */ #define BUTTON1 1 /* Bit 0: SW1 button is depressed */ #define BUTTON2 2 /* Bit 1: SW2 button is depressed */ -#endif /* __ARCH_BOARD_BOARD_H */ +#endif /* __BOARDS_HC_MCS92S12NE64_NE64BADGE_INCLUDE_BOARD_H */ diff --git a/boards/hc/mcs92s12ne64/ne64badge/scripts/Make.defs b/boards/hc/mcs92s12ne64/ne64badge/scripts/Make.defs index b92a52136b7..a6ccdcd84d7 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/scripts/Make.defs +++ b/boards/hc/mcs92s12ne64/ne64badge/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/hc/ne64badge/scripts/Make.defs +# boards/hc/mcs92s12ne64/ne64badge/scripts/Make.defs # # Copyright (C) 2011, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/ne64badge/scripts/ne64badge-banked.ld b/boards/hc/mcs92s12ne64/ne64badge/scripts/ne64badge-banked.ld index 9882ee6f040..5efc8b817b4 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/scripts/ne64badge-banked.ld +++ b/boards/hc/mcs92s12ne64/ne64badge/scripts/ne64badge-banked.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/hc/ne64badge/ostest/ne64badge-banked.ld + * boards/hc/mcs92s12ne64/ne64badge/ostest/ne64badge-banked.ld * * Copyright (C) 2011m, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/ne64badge/scripts/ne64badge-nonbanked.ld b/boards/hc/mcs92s12ne64/ne64badge/scripts/ne64badge-nonbanked.ld index fa5a2116c87..d1ff31f4241 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/scripts/ne64badge-nonbanked.ld +++ b/boards/hc/mcs92s12ne64/ne64badge/scripts/ne64badge-nonbanked.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/hc/ne64badge/ostest/ne64badge-nonbanked.ld + * boards/hc/mcs92s12ne64/ne64badge/ostest/ne64badge-nonbanked.ld * * Copyright (C) 2011, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/ne64badge/src/Makefile b/boards/hc/mcs92s12ne64/ne64badge/src/Makefile index 0495c712d1c..05d6bf68c28 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/src/Makefile +++ b/boards/hc/mcs92s12ne64/ne64badge/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/hc/ne64badge/src/Makefile +# boards/hc/mcs92s12ne64/ne64badge/src/Makefile # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_appinit.c b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_appinit.c index 113525cb78e..77add22a3d2 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_appinit.c +++ b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/ne64badge/src/m9s12_appinit.c + * config/mcs92s12ne64/ne64badge/src/m9s12_appinit.c * * Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_boot.c b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_boot.c index c58452aa609..0f6da5e807a 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_boot.c +++ b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/hc/ne64badge/src/m9s12_boot.c +/**************************************************************************** + * boards/hc/mcs92s12ne64/ne64badge/src/m9s12_boot.c * * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -46,32 +46,33 @@ #include "ne64badge.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: hcs12_boardinitialize * * Description: - * All HCS12 architectures must provide the following entry point. This entry point - * is called early in the initialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All HCS12 architectures must provide the following entry point. + * This entry point is called early in the initialization - after all memory + * has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void hcs12_boardinitialize(void) { - /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function - * hcs12_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak + * function hcs12_spidev_initialize() has been brought into the link. */ #if defined(CONFIG_INCLUDE_HCS12_ARCH_SPI) diff --git a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_buttons.c b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_buttons.c index afaec43c9df..7d712262ac3 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_buttons.c +++ b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/hc/ne64badge/src/m9s12_buttons.c + * boards/hc/mcs92s12ne64/ne64badge/src/m9s12_buttons.c * * Copyright (C) 2011, 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_leds.c b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_leds.c index 0ec4cfb0a22..66a3299f887 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_leds.c +++ b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/hc/ne64badge/src/m9s12_leds.c + * boards/hc/mcs92s12ne64/ne64badge/src/m9s12_leds.c * * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_spi.c b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_spi.c index a9de0706a7d..2e37d1c124c 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_spi.c +++ b/boards/hc/mcs92s12ne64/ne64badge/src/m9s12_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/hc/ne64badge/src/m9s12_spi.c +/**************************************************************************** + * boards/hc/mcs92s12ne64/ne64badge/src/m9s12_spi.c * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -50,17 +50,17 @@ #if defined(CONFIG_HCS12_SPI) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: hcs12_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the NE64 Badge board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function hcs12_spidev_initialize(void) { @@ -73,7 +73,8 @@ void weak_function hcs12_spidev_initialize(void) * The external functions, hcs12_spiselect and hcs12_spistatus must be * provided by board-specific logic. They are implementations of the select * and status methods of the SPI interface defined by struct spi_ops_s (see - * include/nuttx/spi/spi.h). All other methods (including hcs12_spibus_initialize()) + * include/nuttx/spi/spi.h). + * All other methods (including hcs12_spibus_initialize()) * are provided by common HCS12 logic. To use this common SPI logic on your * board: * @@ -84,8 +85,8 @@ void weak_function hcs12_spidev_initialize(void) * status operations using GPIOs in the way your board is configured. * 3. Add a calls to hcs12_spibus_initialize() in your low level application * initialization logic - * 4. The handle returned by hcs12_spibus_initialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling + * 4. The handle returned by hcs12_spibus_initialize() may then be used to + * bind the SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). * diff --git a/boards/hc/mcs92s12ne64/ne64badge/src/ne64badge.h b/boards/hc/mcs92s12ne64/ne64badge/src/ne64badge.h index a57a9ed6208..1060fd0a419 100644 --- a/boards/hc/mcs92s12ne64/ne64badge/src/ne64badge.h +++ b/boards/hc/mcs92s12ne64/ne64badge/src/ne64badge.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/hc/ne64badge/src/ne64badge.h +/**************************************************************************** + * boards/hc/mcs92s12ne64/ne64badge/src/ne64badge.h * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,25 +31,26 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_HC_NE64BADGE_SRC_NE64BADGE_H -#define __BOARDS_HC_NE64BADGE_SRC_NE64BADGE_H +#ifndef __BOARDS_HC_MSC92S12NE64_NE64BADGE_SRC_NE64BADGE_H +#define __BOARDS_HC_MSC92S12NE64_NE64BADGE_SRC_NE64BADGE_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include #include "m9s12.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + +/* NE64BADGE Pin Usage ******************************************************/ -/* NE64BADGE Pin Usage **************************************************************/ /* PIN PIN NAME BOARD SIGNAL NOTES * --- ------------------- -------------- ---------------------- * 44 RESET J3 RESET_L Also to SW3 @@ -163,29 +164,29 @@ * 84 PL0/ACTLED Activity LED yellow */ -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: hcs12_spidev_initialize * * Description: - * Called to configure SPI chip select GPIO pins for the STM3210E-EVAL board. + * Called to configure SPI chip select GPIO pins for the STM3210E-EVAL board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function hcs12_spidev_initialize(void); #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_HC_NE64BADGE_SRC_NE64BADGE_H */ +#endif /* __BOARDS_HC_MSC92S12NE64_NE64BADGE_SRC_NE64BADGE_H */ diff --git a/boards/mips/pic32mx/mirtoo/README.txt b/boards/mips/pic32mx/mirtoo/README.txt index c2fc4db601b..bb95b19b3b2 100644 --- a/boards/mips/pic32mx/mirtoo/README.txt +++ b/boards/mips/pic32mx/mirtoo/README.txt @@ -1,4 +1,4 @@ -boards/mirtoo README +boards/mips/pic32mx/mirtoo README ===================== This README file discusses the port of NuttX to the DTX1-4000L "Mirtoo" module. diff --git a/boards/mips/pic32mx/mirtoo/include/board.h b/boards/mips/pic32mx/mirtoo/include/board.h index 76c6ffa5e9f..72015420c8f 100644 --- a/boards/mips/pic32mx/mirtoo/include/board.h +++ b/boards/mips/pic32mx/mirtoo/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/mirtoo/include/board.h + * boards/mips/pic32mx/mirtoo/include/board.h * include/arch/board/board.h * * Copyright (C) 2012 Gregory Nutt. All rights reserved. @@ -34,8 +34,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_MIRTOO_INCLUDE_BOARD_H -#define __BOARDS_MIPS_MIRTOO_INCLUDE_BOARD_H +#ifndef __BOARDS_MIPS_PIC32MX_MIRTOO_INCLUDE_BOARD_H +#define __BOARDS_MIPS_PIC32MX_MIRTOO_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -49,9 +49,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* The Mirtoo does not use an external crystal but relies instead on the * internal +/- 0.9% FRC clock. That clock has a nomninal frequency of 8MHz. */ @@ -94,6 +96,7 @@ #define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */ /* LED definitions **********************************************************/ + /* The Mirtoo module has 2 user LEDs labeled LED0 and LED1 in the schematics: * * --- ----- -------------------------------------------------------------- @@ -172,4 +175,4 @@ extern "C" #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_MIRTOO_INCLUDE_BOARD_H */ +#endif /* __BOARDS_MIPS_PIC32MX_MIRTOO_INCLUDE_BOARD_H */ diff --git a/boards/mips/pic32mx/mirtoo/scripts/Make.defs b/boards/mips/pic32mx/mirtoo/scripts/Make.defs index 3cfa6d957de..ed7dc3ea666 100644 --- a/boards/mips/pic32mx/mirtoo/scripts/Make.defs +++ b/boards/mips/pic32mx/mirtoo/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/mirtoo/scripts/Make.defs +# boards/mips/pic32m/mirtoo/scripts/Make.defs # # Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -93,9 +93,7 @@ OBJEXT = .o LIBEXT = .a EXEEXT = - HOSTCC = gcc HOSTINCLUDES = -I. HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe HOSTLDFLAGS = - diff --git a/boards/mips/pic32mx/mirtoo/scripts/c32-debug.ld b/boards/mips/pic32mx/mirtoo/scripts/c32-debug.ld index f3894cbda1a..fce43f13f64 100644 --- a/boards/mips/pic32mx/mirtoo/scripts/c32-debug.ld +++ b/boards/mips/pic32mx/mirtoo/scripts/c32-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/mirtoo/scripts/c32-debug.ld + * boards/mips/pic32mx/mirtoo/scripts/c32-debug.ld * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/mirtoo/scripts/c32-release.ld b/boards/mips/pic32mx/mirtoo/scripts/c32-release.ld index e9a6d8caa94..b16ef1c9ed4 100644 --- a/boards/mips/pic32mx/mirtoo/scripts/c32-release.ld +++ b/boards/mips/pic32mx/mirtoo/scripts/c32-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/mirtoo/scripts/c32-release.ld + * boards/mips/pic32mx/mirtoo/scripts/c32-release.ld * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -9,14 +9,14 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. + * used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/mirtoo/scripts/mips-elf-debug.ld b/boards/mips/pic32mx/mirtoo/scripts/mips-elf-debug.ld index 848d92308cd..ad0b8624ab0 100644 --- a/boards/mips/pic32mx/mirtoo/scripts/mips-elf-debug.ld +++ b/boards/mips/pic32mx/mirtoo/scripts/mips-elf-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/mirtoo/scripts/mips-elf-debug.ld + * boards/mips/pic32mx/mirtoo/scripts/mips-elf-debug.ld * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -9,14 +9,14 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. + * used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/mirtoo/scripts/mips-elf-release.ld b/boards/mips/pic32mx/mirtoo/scripts/mips-elf-release.ld index 912b978fe49..9c19639133f 100644 --- a/boards/mips/pic32mx/mirtoo/scripts/mips-elf-release.ld +++ b/boards/mips/pic32mx/mirtoo/scripts/mips-elf-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/mirtoo/scripts/mips-elf-release.ld + * boards/mips/pic32mx/mirtoo/scripts/mips-elf-release.ld * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -9,14 +9,14 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. + * used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/mirtoo/scripts/xc32-debug.ld b/boards/mips/pic32mx/mirtoo/scripts/xc32-debug.ld index 3cc72400d5b..a18931b9e9c 100644 --- a/boards/mips/pic32mx/mirtoo/scripts/xc32-debug.ld +++ b/boards/mips/pic32mx/mirtoo/scripts/xc32-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/mirtoo/scripts/xc32-debug.ld + * boards/mips/pic32mx/mirtoo/scripts/xc32-debug.ld * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -9,14 +9,14 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. + * used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/mirtoo/scripts/xc32-release.ld b/boards/mips/pic32mx/mirtoo/scripts/xc32-release.ld index 24af81c0533..2ca1bf45aad 100644 --- a/boards/mips/pic32mx/mirtoo/scripts/xc32-release.ld +++ b/boards/mips/pic32mx/mirtoo/scripts/xc32-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/mirtoo/scripts/xc32-release.ld + * boards/mips/pic32mx/mirtoo/scripts/xc32-release.ld * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/mirtoo/src/Makefile b/boards/mips/pic32mx/mirtoo/src/Makefile index 865de2837e7..9e2df751742 100644 --- a/boards/mips/pic32mx/mirtoo/src/Makefile +++ b/boards/mips/pic32mx/mirtoo/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/mirtoo/src/Makefile +# boards/mips/pic32mx/mirtoo/src/Makefile # # Copyright (C) 2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mx/mirtoo/src/mirtoo.h b/boards/mips/pic32mx/mirtoo/src/mirtoo.h index fba9ab8bcee..0eecf6db886 100644 --- a/boards/mips/pic32mx/mirtoo/src/mirtoo.h +++ b/boards/mips/pic32mx/mirtoo/src/mirtoo.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/mirtoo/src/mirtoo.h + * boards/mips/pic32mx/mirtoo/src/mirtoo.h * * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_MIRTOO_SRC_MIRTOO_H -#define __BOARDS_MIPS_MIRTOO_SRC_MIRTOO_H +#ifndef __BOARDS_MIPS_PIC32MX_MIRTOO_SRC_MIRTOO_H +#define __BOARDS_MIPS_PIC32MX_MIRTOO_SRC_MIRTOO_H /**************************************************************************** * Included Files @@ -69,25 +69,25 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spi2initialize * * Description: * Called to configure SPI2 chip select GPIO pins for the Mirtoo module. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_PIC32MX_SPI2 void weak_function pic32mx_spi2initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void pic32mx_led_initialize(void); @@ -102,7 +102,9 @@ void pic32mx_led_initialize(void); ****************************************************************************/ #ifdef CONFIG_PIC32MX_ADC + /* int pic32mx_adcinitialize(void); not used */ + #endif #undef EXTERN @@ -111,4 +113,4 @@ void pic32mx_led_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_MIRTOO_SRC_MIRTOO_H */ +#endif /* __BOARDS_MIPS_PIC32MX_MIRTOO_SRC_MIRTOO_H */ diff --git a/boards/mips/pic32mx/mirtoo/src/pic32_adc.c b/boards/mips/pic32mx/mirtoo/src/pic32_adc.c index 142dc2e0c59..e37c8e59eb4 100644 --- a/boards/mips/pic32mx/mirtoo/src/pic32_adc.c +++ b/boards/mips/pic32mx/mirtoo/src/pic32_adc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/mirtoo/src/pic32_adc.c + * boards/mips/pic32mx/mirtoo/src/pic32_adc.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -51,15 +51,17 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* The Mirtoo features a PGA117 amplifier/multipexer that can be configured to * bring any analog signal from PORT0,.. PORT7 to pin 19 of the PIC32MX: * - * --- ------------------------------------------------ ---------------------------- + * --- ------------------------------------------------ --------------------- * PIN PIC32 SIGNAL(s) BOARD SIGNAL/USAGE - * --- ------------------------------------------------ ---------------------------- + * --- ------------------------------------------------ --------------------- * 19 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0 AIN PGA117 Vout - --- ------------------------------------------------ ---------------------------- + * --- ------------------------------------------------ --------------------- * * The PGA117 driver can be enabled by setting the following the nsh * configuration: @@ -68,8 +70,8 @@ * CONFIG_PIC32MX_ADC=y : Enable support the PIC32 ADC driver * CONFIG_ADC_PGA11X=y : Enable support for the PGA117 * - * When CONFIG_PIC32MX_ADC=y is defined, the Mirtoo boot up logic will automatically - * configure pin 18 (AN0) as an analog input. + * When CONFIG_PIC32MX_ADC=y is defined, the Mirtoo boot up logic will + * automatically configure pin 18 (AN0) as an analog input. */ /**************************************************************************** @@ -88,12 +90,15 @@ int pic32mx_adcinitialize(void) { /* Configure the pin 19 as an analog input */ + #warning "Missing logic" /* Initialize the PGA117 amplifier multiplexer */ + #warning "Missing logic" /* Register the ADC device driver */ + #warning "Missing logic" return OK; diff --git a/boards/mips/pic32mx/mirtoo/src/pic32_appinit.c b/boards/mips/pic32mx/mirtoo/src/pic32_appinit.c index 8491f578600..b9d32b38a57 100644 --- a/boards/mips/pic32mx/mirtoo/src/pic32_appinit.c +++ b/boards/mips/pic32mx/mirtoo/src/pic32_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/mirtoo/src/pic32_appinit.c + * boards/mips/pic32mx/mirtoo/src/pic32_appinit.c * * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -61,6 +61,7 @@ ****************************************************************************/ /* Configuration ************************************************************/ + /* Can't support the SST25 device if it SPI2 or SST25 support is not enabled */ #define HAVE_SST25 1 diff --git a/boards/mips/pic32mx/mirtoo/src/pic32_boot.c b/boards/mips/pic32mx/mirtoo/src/pic32_boot.c index a08fa887482..d94b89ae8a3 100644 --- a/boards/mips/pic32mx/mirtoo/src/pic32_boot.c +++ b/boards/mips/pic32mx/mirtoo/src/pic32_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/mirtoo/src/pic32_boot.c +/**************************************************************************** + * boards/mips/pic32mx/mirtoo/src/pic32_boot.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -50,9 +50,9 @@ #include "pic32mx-pps.h" #include "mirtoo.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #define GPIO_U1TX (GPIO_OUTPUT|GPIO_PORTC|GPIO_PIN5) #define GPIO_U1RX (GPIO_INPUT|GPIO_PORTC|GPIO_PIN6) @@ -60,17 +60,18 @@ #define GPIO_U2TX (GPIO_OUTPUT|GPIO_PORTB|GPIO_PIN10) #define GPIO_U2RX (GPIO_INPUT|GPIO_PORTB|GPIO_PIN11) -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_uartinitialize * * Description: - * When mounted on the DTX1-4000L EV-kit1 board, serial output is avaiable through - * an FT230X device via the FUNC0 and FUNC1 module outputs. If CONFIG_PIC32MX_UART2 - * is enabled, the src/pic32_boot will configure the UART2 pins as follows. + * When mounted on the DTX1-4000L EV-kit1 board, serial output is avaiable + * through an FT230X device via the FUNC0 and FUNC1 module outputs. + * If CONFIG_PIC32MX_UART2 is enabled, the src/pic32_boot will configure + * the UART2 pins as follows. * * ---------- ------ ----- ------ ------------------------- * BOARD OUTPUT PIN SIGNAL NOTES @@ -78,8 +79,9 @@ * FT230X RXD FUNC0 RPB11 U2RX UART2 RX (Also PGEC2) * FT230X TXD FUNC1 RPB10 U2TX UART2 TX (Also PGED2) * - * If CONFIG_PIC32MX_UART1 is enabled, the src/pic32_boot will configure the UART - * pins as follows. This will support communictions (via an external RS-232 + * If CONFIG_PIC32MX_UART1 is enabled, + * the src/pic32_boot will configure the UART pins as follows. + * This will support communictions (via an external RS-232 * driver) through X3 pins 4 and 5: * * ---------- ------ ----- ------ ------------------------- @@ -88,13 +90,14 @@ * X3, pin 4 FUNC4 RPBC5 U1TX UART1 TX * X3, pin 5 FUNC5 RPBC6 U1RX UART1 RX * - ************************************************************************************/ + ****************************************************************************/ static inline void pic32mx_uartinitialize(void) { #ifdef CONFIG_PIC32MX_UART2 - /* Make sure that TRIS pins are set correctly. Configure the UART pins as digital - * inputs and outputs first. + + /* Make sure that TRIS pins are set correctly. + * Configure the UART pins as digital inputs and outputs first. */ pic32mx_configgpio(GPIO_U2TX); @@ -107,8 +110,9 @@ static inline void pic32mx_uartinitialize(void) #endif #ifdef CONFIG_PIC32MX_UART1 - /* Make sure that TRIS pins are set correctly. Configure the UART pins as digital - * inputs and outputs first. + + /* Make sure that TRIS pins are set correctly. + * Configure the UART pins as digital inputs and outputs first. */ pic32mx_configgpio(GPIO_U1TX); @@ -121,19 +125,20 @@ static inline void pic32mx_uartinitialize(void) #endif } -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_boardinitialize * * Description: - * All PIC32MX architectures must provide the following entry point. This entry - * point is called early in the intitialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All PIC32MX architectures must provide the following entry point. + * This entry point is called early in the intitialization -- after all + * memory has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void pic32mx_boardinitialize(void) { @@ -141,8 +146,9 @@ void pic32mx_boardinitialize(void) pic32mx_uartinitialize(); - /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak - * function pic32mx_spi2initialize() has been brought into the link. + /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) + * the weak function pic32mx_spi2initialize() has been brought into the + * link. */ #ifdef CONFIG_PIC32MX_SPI2 diff --git a/boards/mips/pic32mx/mirtoo/src/pic32_leds.c b/boards/mips/pic32mx/mirtoo/src/pic32_leds.c index 0dde7667195..1c45175b8ee 100644 --- a/boards/mips/pic32mx/mirtoo/src/pic32_leds.c +++ b/boards/mips/pic32mx/mirtoo/src/pic32_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/mirtoo/src/pic32_leds.c + * boards/mips/pic32mx/mirtoo/src/pic32_leds.c * * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -52,7 +52,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* LED Configuration ********************************************************/ + /* The Mirtoo module has 2 user LEDs labelled LED0 and LED1 in the schematics: * * --- ----- -------------------------------------------------------------- @@ -107,6 +109,7 @@ struct led_setting_s /**************************************************************************** * Private Data ****************************************************************************/ + /* If CONFIG_ARCH_LEDS is defined then NuttX will control the LEDs. The * following structures identified the LED settings for each NuttX LED state. */ diff --git a/boards/mips/pic32mx/mirtoo/src/pic32_spi2.c b/boards/mips/pic32mx/mirtoo/src/pic32_spi2.c index 41571248db9..25ebcd9e86f 100644 --- a/boards/mips/pic32mx/mirtoo/src/pic32_spi2.c +++ b/boards/mips/pic32mx/mirtoo/src/pic32_spi2.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/mirtoo/src/pic32_spi2.c +/**************************************************************************** + * boards/mips/pic32mx/mirtoo/src/pic32_spi2.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -54,18 +54,19 @@ #ifdef CONFIG_PIC32MX_SPI2 -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ /* The Mirtoo module as two on-board SPI devices: * * SST25VF032B - 32-Mbit SPI Serial FLASH * - * PGA117 - Zero drift programmable gain amplifier with MUX. The PGA117 offers 10 - * analog inputs, a four-pin SPI interface with daisy-chain capability, and hardware - * and software shutdown in a TSSOP-20 package. Only 8 of the analog inputs (PORT0-7) - * are used on the Mirtoo module. + * PGA117 - Zero drift programmable gain amplifier with MUX. + * The PGA117 offers 10 analog inputs, a four-pin SPI interface with + * daisy-chain capability, and hardware and software shutdown in a TSSOP-20 + * package. + * Only 8 of the analog inputs (PORT0-7) are used on the Mirtoo module. * * Chip selects: * @@ -92,21 +93,22 @@ #define GPIO_PGA117_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTB|GPIO_PIN7) #define GPIO_SST25VF032B_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTB|GPIO_PIN13) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spi2initialize * * Description: * Called to configure SPI2 chip select GPIO pins for the Mirtoo module. * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mx_spi2initialize(void) { - /* Make sure that TRIS pins are set correctly. Configure the SPI pins as digital + /* Make sure that TRIS pins are set correctly. + * Configure the SPI pins as digital * inputs and outputs first. */ @@ -125,39 +127,44 @@ void weak_function pic32mx_spi2initialize(void) pic32mx_configgpio(GPIO_SST25VF032B_CS); } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spi2select, pic32mx_spi2status, and pic32mx_spi2cmddata * * Description: - * These external functions must be provided by board-specific logic. They are - * implementations of the select, status, and cmddata methods of the SPI interface - * defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All other methods - * including pic32mx_spibus_initialize()) are provided by common PIC32MX logic. To use - * this common SPI logic on your board: + * These external functions must be provided by board-specific logic. + * They are implementations of the select, status, and cmddata methods of + * the SPI interface defined by struct spi_ops_s + * (see include/nuttx/spi/spi.h). + * All other methods including pic32mx_spibus_initialize()) are provided by + * common PIC32MX logic. + * To use this common SPI logic on your board: * - * 1. Provide logic in pic32mx_boardinitialize() to configure SPI chip select - * pins. + * 1. Provide logic in pic32mx_boardinitialize() to configure SPI chip + * select pins. * 2. Provide pic32mx_spiNselect() and pic32mx_spiNstatus() functions - * in your board-specific logic. These functions will perform chip selection - * and status operations using GPIOs in the way your board is configured. + * in your board-specific logic. These functions will perform chip + * selection and status operations using GPIOs in the way your board is + * configured. * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide * pic32mx_spiNcmddata() functions in your board-specific logic. These - * functions will perform cmd/data selection operations using GPIOs in the way - * your board is configured. - * 3. Add a call to pic32mx_spibus_initialize() in your low level application - * initialization logic - * 4. The handle returned by pic32mx_spibus_initialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling + * functions will perform cmd/data selection operations using GPIOs in + * the way your board is configured. + * 3. Add a call to pic32mx_spibus_initialize() in your low level + * application initialization logic + * 4. The handle returned by pic32mx_spibus_initialize() may then be used + * to bind the SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). * - ************************************************************************************/ + ****************************************************************************/ struct spi_dev_s; -void pic32mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); if (devid == SPIDEV_FLASH(0)) { diff --git a/boards/mips/pic32mx/pic32mx-starterkit/README.txt b/boards/mips/pic32mx/pic32mx-starterkit/README.txt index 802e091ebb1..8078d7288b0 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/README.txt +++ b/boards/mips/pic32mx/pic32mx-starterkit/README.txt @@ -1,4 +1,4 @@ -boards/pic32mx-starterkit README +boards/mips/pic32mx/pic32mx-starterkit README =============================== diff --git a/boards/mips/pic32mx/pic32mx-starterkit/include/board.h b/boards/mips/pic32mx/pic32mx-starterkit/include/board.h index 2dede21bd29..b9bfc3b0faa 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/include/board.h +++ b/boards/mips/pic32mx/pic32mx-starterkit/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx-starterkit/include/board.h + * boards/mips/pic32mx/pic32mx-starterkit/include/board.h * include/arch/board/board.h * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. @@ -34,8 +34,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_SURE_PIC32MX_INCLUDE_BOARD_H -#define __BOARDS_MIPS_SURE_PIC32MX_INCLUDE_BOARD_H +#ifndef __BOARDS_MIPS_PIC32MX_PIC32MX_STARTERKIT_INCLUDE_BOARD_H +#define __BOARDS_MIPS_PIC32MX_PIC32MX_STARTERKIT_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -50,9 +50,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Crystal frequencies */ #define BOARD_POSC_FREQ 8000000 /* Primary OSC XTAL frequency (8MHz) */ @@ -104,7 +106,9 @@ #define BOARD_EMAC_MIIM_DIV 32 /* Ideal: 80MHz/32 = 2.5MHz */ /* LED definitions **********************************************************/ + /* LED Configuration ********************************************************/ + /* The PIC32MX Ethernet Starter kit has 3 user LEDs labeled LED1-3 on the * board graphics (but referred to as LED4-6 in the schematic): * @@ -168,6 +172,7 @@ #define LED_NVALUES 6 /* Switch definitions *******************************************************/ + /* The PIC32 starter kit has 3 switches: * * RD7 Switch SW2 (low when closed) @@ -203,4 +208,4 @@ extern "C" #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_SURE_PIC32MX_INCLUDE_BOARD_H */ +#endif /* __BOARDS_MIPS_PIC32MX_PIC32MX-STARTERKIT_INCLUDE_BOARD_H */ diff --git a/boards/mips/pic32mx/pic32mx-starterkit/scripts/Make.defs b/boards/mips/pic32mx/pic32mx-starterkit/scripts/Make.defs index 6dff8148b6e..3ab708d2682 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/scripts/Make.defs +++ b/boards/mips/pic32mx/pic32mx-starterkit/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/pic32mx-starterkit/scripts/Make.defs +# boards/mips/pic32mx/pic32mx-starterkit/scripts/Make.defs # # Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mx/pic32mx-starterkit/scripts/c32-release.ld b/boards/mips/pic32mx/pic32mx-starterkit/scripts/c32-release.ld index 5609fb14695..6733d96075a 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/scripts/c32-release.ld +++ b/boards/mips/pic32mx/pic32mx-starterkit/scripts/c32-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx-starterkit/nsh/c32-release.script + * boards/mips/pic32mx/pic32mx-starterkit/nsh/c32-release.script * * Copyright (C) 2012i, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/pic32mx-starterkit/scripts/mips-release.ld b/boards/mips/pic32mx/pic32mx-starterkit/scripts/mips-release.ld index cd9325761b6..e5354e04760 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/scripts/mips-release.ld +++ b/boards/mips/pic32mx/pic32mx-starterkit/scripts/mips-release.ld @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/pic32mx-starterkit/src/Makefile b/boards/mips/pic32mx/pic32mx-starterkit/src/Makefile index 2b6ffc1d585..04f6f2c17b6 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/src/Makefile +++ b/boards/mips/pic32mx/pic32mx-starterkit/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/pic32mx-starterkit/src/Makefile +# boards/mips/pic32mx/pic32mx-starterkit/src/Makefile # # Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx-starterkit.h b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx-starterkit.h index ba803531b08..462c11b7f7d 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx-starterkit.h +++ b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx-starterkit.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx-starterkit/src/pic32mx-starterkit.h + * boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx-starterkit.h * * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_PIC32MX_STARTERKIT_SRC_PIC32MX_STARTERKIT_H -#define __BOARDS_MIPS_PIC32MX_STARTERKIT_SRC_PIC32MX_STARTERKIT_H +#ifndef __BOARDS_MIPS_PIC32MX_PIC32MX_STARTERKIT_SRC_PIC32MX_STARTERKIT_H +#define __BOARDS_MIPS_PIC32MX_PIC32MX_STARTERKIT_SRC_PIC32MX_STARTERKIT_H /**************************************************************************** * Included Files @@ -45,7 +45,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* The PIC32 starter kit has 3 user LEDs * * RD0 User LED D4 (high illuminates) @@ -90,25 +92,25 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the PCB Logic board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_PIC32MX_SPI2) void weak_function pic32mx_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void pic32mx_led_initialize(void); @@ -120,4 +122,4 @@ void pic32mx_led_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_PIC32MX_STARTERKIT_SRC_PIC32MX_STARTERKIT_H */ +#endif /* __BOARDS_MIPS_PIC32MX_PIC32MX_STARTERKIT_SRC_PIC32MX_STARTERKIT_H */ diff --git a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_appinit.c b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_appinit.c index 12ad25b4b9a..781097f4f86 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_appinit.c +++ b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/pic32mx-starterkit/src/pic32mx_appinit.c + * boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_appinit.c * * Copyright (C) 2011, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -57,7 +57,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* Assume that we have MMC/SD, USB host (and USB device) */ #define NSH_HAVEMMCSD 1 @@ -76,7 +78,7 @@ #ifdef NSH_HAVEMMCSD - /* Make sure that the NSH configuration uses the correct SPI */ +/* Make sure that the NSH configuration uses the correct SPI */ # if !defined(CONFIG_NSH_MMCSDSPIPORTNO) # define CONFIG_NSH_MMCSDSPIPORTNO CONFIG_PIC32MX_MMCSDSPIPORTNO @@ -86,7 +88,7 @@ # define CONFIG_NSH_MMCSDSPIPORTNO CONFIG_PIC32MX_MMCSDSPIPORTNO # endif - /* Make sure that the NSH configuration uses the slot */ +/* Make sure that the NSH configuration uses the slot */ # if !defined(CONFIG_NSH_MMCSDSLOTNO) # define CONFIG_NSH_MMCSDSLOTNO 0 @@ -96,7 +98,7 @@ # define CONFIG_NSH_MMCSDSLOTNO 0 # endif - /* Make sure that the correct SPI is enabled in the configuration */ +/* Make sure that the correct SPI is enabled in the configuration */ # if CONFIG_PIC32MX_MMCSDSPIPORTNO == 1 && !defined(CONFIG_PIC32MX_SPI1) # warning "CONFIG_PIC32MX_SPI1 is not enabled" @@ -184,12 +186,13 @@ static int nsh_waiter(int argc, char *argv[]) struct usbhost_hubport_s *hport; syslog(LOG_INFO, "nsh_waiter: Running\n"); - for (;;) + for (; ; ) { /* Wait for the device to change state */ DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); - syslog(LOG_INFO, "nsh_waiter: %s\n", hport->connected ? "connected" : "disconnected"); + syslog(LOG_INFO, "nsh_waiter: %s\n", + hport->connected ? "connected" : "disconnected"); /* Did we just become connected? */ @@ -286,7 +289,8 @@ static int nsh_usbhostinitialize(void) ret = usbhost_msc_initialize(); if (ret != OK) { - syslog(LOG_ERR, "ERROR: Failed to register the mass storage class: %d\n", ret); + syslog(LOG_ERR, + "ERROR: Failed to register the mass storage class: %d\n", ret); } #endif @@ -296,7 +300,8 @@ static int nsh_usbhostinitialize(void) ret = usbhost_cdcacm_initialize(); if (ret != OK) { - syslog(LOG_ERR, "ERROR: Failed to register the CDC/ACM serial class: %d\n", ret); + syslog(LOG_ERR, + "ERROR: Failed to register the CDC/ACM serial class: %d\n", ret); } #endif diff --git a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_boot.c b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_boot.c index c944dda13bb..9bed1f77dfc 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_boot.c +++ b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/pic32mx-starterkit/src/pic32mx_boot.c +/**************************************************************************** + * boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_boot.c * * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,32 +49,34 @@ #include "pic32mx.h" #include "pic32mx-starterkit.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_boardinitialize * * Description: - * All PIC32MX architectures must provide the following entry point. This entry - * point is called early in the initialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All PIC32MX architectures must provide the following entry point. + * This entry point is called early in the initialization -- after + * all memory has been configured and mapped but before any devices have + * been initialized. * - ************************************************************************************/ + ****************************************************************************/ void pic32mx_boardinitialize(void) { - /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak - * function pic32mx_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) + * the weak function pic32mx_spidev_initialize() has been brought into + * the link. */ #if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \ diff --git a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_leds.c b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_leds.c index b7f841ff839..13630364c65 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_leds.c +++ b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx-starterkit/src/pic32mx_leds.c + * boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_leds.c * * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -57,7 +57,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* LED Configuration ********************************************************/ + /* The PIC32MX Ethernet Starter kit has 3 user LEDs labelled LED1-3 on the * board graphics (but referred to as LED4-6 in the schematic): * @@ -112,6 +114,7 @@ struct led_setting_s /**************************************************************************** * Private Data ****************************************************************************/ + /* If CONFIG_ARCH_LEDS is defined then NuttX will control the LEDs. The * following structures identified the LED settings for each NuttX LED state. */ @@ -217,9 +220,12 @@ void board_userled(int led, bool ledon) #ifndef CONFIG_ARCH_LEDS void board_userled_all(uint8_t ledset) { - board_userled(PIC32MX_STARTERKIT_LED1, (ledset & PIC32MX_STARTERKIT_LED1_BIT) != 0); - board_userled(PIC32MX_STARTERKIT_LED2, (ledset & PIC32MX_STARTERKIT_LED2_BIT) != 0); - board_userled(PIC32MX_STARTERKIT_LED3, (ledset & PIC32MX_STARTERKIT_LED3_BIT) != 0); + board_userled(PIC32MX_STARTERKIT_LED1, + (ledset & PIC32MX_STARTERKIT_LED1_BIT) != 0); + board_userled(PIC32MX_STARTERKIT_LED2, + (ledset & PIC32MX_STARTERKIT_LED2_BIT) != 0); + board_userled(PIC32MX_STARTERKIT_LED3, + (ledset & PIC32MX_STARTERKIT_LED3_BIT) != 0); } #endif diff --git a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_spi.c b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_spi.c index 5cfaa051f36..d6ff36a7787 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_spi.c +++ b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/pic32mx-starterkit/src/pic32mx_spi.c +/**************************************************************************** + * boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_spi.c * * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -54,17 +54,17 @@ #if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \ defined(CONFIG_PIC32MX_SPI3) || defined(CONFIG_PIC32MX_SPI4) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the Sure PIC32MX board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mx_spidev_initialize(void) { @@ -73,40 +73,45 @@ void weak_function pic32mx_spidev_initialize(void) #warning "Missing logic" } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spiNselect, pic32mx_spiNstatus, and pic32mx_spiNcmddata * * Description: - * These external functions must be provided by board-specific logic. They are - * implementations of the select, status, and cmddata methods of the SPI interface - * defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All other methods - * including pic32mx_spibus_initialize()) are provided by common PIC32MX logic. To use - * this common SPI logic on your board: + * These external functions must be provided by board-specific logic. + * They are implementations of the select, status, and cmddata methods of + * the SPI interface defined by struct spi_ops_s + * (see include/nuttx/spi/spi.h). + * All other methods including pic32mx_spibus_initialize()) are provided by + * common PIC32MX logic. + * To use this common SPI logic on your board: * - * 1. Provide logic in pic32mx_boardinitialize() to configure SPI/SSP chip select - * pins. + * 1. Provide logic in pic32mx_boardinitialize() to configure SPI/SSP chip + * select pins. * 2. Provide pic32mx_spiNselect() and pic32mx_spiNstatus() functions - * in your board-specific logic. These functions will perform chip selection - * and status operations using GPIOs in the way your board is configured. + * in your board-specific logic. These functions will perform chip + * selection and status operations using GPIOs in the way your board is + * configured. * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide * pic32mx_spiNcmddata() functions in your board-specific logic. These - * functions will perform cmd/data selection operations using GPIOs in the way - * your board is configured. - * 3. Add a call to pic32mx_spibus_initialize() in your low level application - * initialization logic - * 4. The handle returned by pic32mx_spibus_initialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling + * functions will perform cmd/data selection operations using GPIOs in + * the way your board is configured. + * 3. Add a call to pic32mx_spibus_initialize() in your low level + * application initialization logic + * 4. The handle returned by pic32mx_spibus_initialize() may then be used + * to bind the SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). * - ************************************************************************************/ + ****************************************************************************/ struct spi_dev_s; #ifdef CONFIG_PIC32MX_SPI1 -void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", + (int)devid, selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -126,9 +131,11 @@ int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MX_SPI1 -void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -148,9 +155,11 @@ int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MX_SPI3 -void pic32mx_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mx_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -170,9 +179,11 @@ int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MX_SPI4 -void pic32mx_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mx_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #warning "Missing logic" } diff --git a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_usbdev.c b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_usbdev.c index 4d353650eaa..04862474411 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_usbdev.c +++ b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_usbdev.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/pic32mx-starterkit/src/pic32mx_usbdev.c +/**************************************************************************** + * boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_usbdev.c * * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,12 +49,12 @@ #if defined(CONFIG_PIC32MX_USBDEV) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* - * PIN NAME SIGNAL NOTES - * ---- ------------------------------- -------------- ------------------------------ + ****************************************************************************/ + +/* PIN NAME SIGNAL NOTES + * ---- ------------------------------- -------------- ---------------------- * 20 VBUSON/C1IN+/AN5/CN7/RB5 VBUSON To USB VBUS circuitry * 43 C2IN+/AN3/CN5/RB3 USB_PGOOD Power good (low if bad) */ @@ -62,22 +62,22 @@ #define GPIO_USB_VBUSON (GPIO_INPUT|GPIO_PORTB|GPIO_PIN5) #define GPIO_USB_PGOOD (GPIO_INPUT|GPIO_PORTB|GPIO_PIN3) -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbdevinitialize * * Description: - * Called to configure the mini-A/B J5 on the PIC32 Ethernet Starter Kit for the - * USB device + * Called to configure the mini-A/B J5 on the PIC32 Ethernet Starter Kit + * for the USB device * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mx_usbdevinitialize(void) { @@ -87,44 +87,53 @@ void weak_function pic32mx_usbdevinitialize(void) /* Notes from the Sure Electronics sample code: * - * "The USB specifications require that USB peripheral devices must never source - * current onto the Vbus pin. Additionally, USB peripherals should not source - * current on D+ or D- when the host/hub is not actively powering the Vbus line. + * "The USB specifications require that USB peripheral devices must never + * source current onto the Vbus pin. Additionally, USB peripherals should + * not source current on D+ or D- when the host/hub is not actively + * powering the Vbus line. * When designing a self powered (as opposed to bus powered) USB peripheral - * device, the firmware should make sure not to turn on the USB module and D+ - * or D- pull up resistor unless Vbus is actively powered. Therefore, the - * firmware needs some means to detect when Vbus is being powered by the host. + * device, the firmware should make sure not to turn on the USB module and + * D+ or D- pull up resistor unless Vbus is actively powered. Therefore, + * the firmware needs some means to detect when Vbus is being powered by + * the host. * A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and * can be used to detect when Vbus is high (host actively powering), or low * (host is shut down or otherwise not supplying power). The USB firmware - * can then periodically poll this I/O pin to know when it is okay to turn on - * the USB module/D+/D- pull up resistor. When designing a purely bus powered - * peripheral device, it is not possible to source current on D+ or D- when the - * host is not actively providing power on Vbus. Therefore, implementing this - * bus sense feature is optional. ..." + * can then periodically poll this I/O pin to know when it is okay to turn + * on the USB module/D+/D- pull up resistor. When designing a purely bus + * powered peripheral device, it is not possible to source current on D+ or + * D- when the host is not actively providing power on Vbus. + * Therefore, implementing this bus sense feature is optional. ..." */ #ifdef CONFIG_USBHOST - //pic32mx_configgpio(GPIO_USB_VBUSON); + + /* pic32mx_configgpio(GPIO_USB_VBUSON); */ + #endif - /* "If the host PC sends a GetStatus (device) request, the firmware must respond - * and let the host know if the USB peripheral device is currently bus powered - * or self powered. See chapter 9 in the official USB specifications for details - * regarding this request. If the peripheral device is capable of being both - * self and bus powered, it should not return a hard coded value for this request. - * Instead, firmware should check if it is currently self or bus powered, and - * respond accordingly. If the hardware has been configured like demonstrated - * on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the - * currently selected power source. ..." + /* "If the host PC sends a GetStatus (device) request, the firmware must + * respond and let the host know if the USB peripheral device is currently + * bus powered or self powered. + * See chapter 9 in the official USB specifications for details + * regarding this request. If the peripheral device is capable of being + * both self and bus powered, it should not return a hard coded value for + * this request. + * Instead, firmware should check if it is currently self or bus powered, + * and respond accordingly. + * If the hardware has been configured like demonstrated on the PICDEM FS + * USB Demo Board, an I/O pin can be polled to determine the currently + * selected power source. ..." */ #ifdef CONFIG_USB_PWRSENSE - //pic32mx_configgpio(GPIO_USB_PWRSENSE); + + /* pic32mx_configgpio(GPIO_USB_PWRSENSE); */ + #endif } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbpullup * * Description: @@ -134,7 +143,7 @@ void weak_function pic32mx_usbdevinitialize(void) * of this method. Alternatively, if no pull-up GPIO the following EXTERN * can be redefined to be NULL. * - ************************************************************************************/ + ****************************************************************************/ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) { @@ -143,7 +152,7 @@ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbsuspend * * Description: @@ -152,7 +161,7 @@ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) * suspend mode. This is an opportunity for the board logic to shutdown * clocks, power, etc. while the USB is suspended. * - ************************************************************************************/ + ****************************************************************************/ void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume) { diff --git a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_usbmsc.c b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_usbmsc.c index 7475ccb536f..93b8ac39fb9 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_usbmsc.c +++ b/boards/mips/pic32mx/pic32mx-starterkit/src/pic32mx_usbmsc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx-starterkit/src/up_usbmsc.c + * boards/mips/pic32mx/pic32mx-starterkit/src/up_usbmsc.c * * Copyright (C) 2012, 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -59,12 +59,13 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should * already have been initialized in board_app_initialize() (see - * pic32mx_appinit.c). In this case, there is nothing further to be done here. + * pic32mx_appinit.c). In this case, there is nothing further to be + * done here. */ #ifndef CONFIG_NSH_BUILTIN_APPS # warning "Missing Logic" #endif /* CONFIG_NSH_BUILTIN_APPS */ - return 0; + return 0; } diff --git a/boards/mips/pic32mx/pic32mx7mmb/README.txt b/boards/mips/pic32mx/pic32mx7mmb/README.txt index e420bb6f8e2..879feb0754f 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/README.txt +++ b/boards/mips/pic32mx/pic32mx7mmb/README.txt @@ -1,4 +1,4 @@ -boards/pic32mx7mmb README +boards/mips/pic32mx/pic32mx7mmb README =============================== This README file discusses the port of NuttX to the Mikroelektronika PIC32MX7 diff --git a/boards/mips/pic32mx/pic32mx7mmb/include/board.h b/boards/mips/pic32mx/pic32mx7mmb/include/board.h index 3ae511a691d..16f7bbbabdd 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/include/board.h +++ b/boards/mips/pic32mx/pic32mx7mmb/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx7mmb/include/board.h + * boards/mips/pic32mx/pic32mx7mmb/include/board.h * include/arch/board/board.h * * Copyright (C) 2012 Gregory Nutt. All rights reserved. @@ -34,8 +34,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_MIKROELEKTRONIKA_PIC32MX7MMB_INCLUDE_BOARD_H -#define __BOARDS_MIPS_MIKROELEKTRONIKA_PIC32MX7MMB_INCLUDE_BOARD_H +#ifndef __BOARDS_MIPS_PIC32MX_PIC32MX7MMB_INCLUDE_BOARD_H +#define __BOARDS_MIPS_PIC32MX_PIC32MX7MMB_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -50,9 +50,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Crystal frequencies */ #define BOARD_POSC_FREQ 8000000 /* Primary OSC XTAL frequency (8MHz) */ @@ -108,7 +110,9 @@ #define BOARD_EMAC_MIIM_DIV 32 /* Ideal: 80MHz/32 = 2.5MHz */ /* LED definitions **********************************************************/ + /* LED Configuration ********************************************************/ + /* The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labeled LED0-2 in the * schematics: * @@ -209,4 +213,4 @@ extern "C" #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_MIKROELEKTRONIKA_PIC32MX7MMB_INCLUDE_BOARD_H */ +#endif /* __BOARDS_MIPS_PIC32MX_PIC32MX7MMB_INCLUDE_BOARD_H */ diff --git a/boards/mips/pic32mx/pic32mx7mmb/scripts/Make.defs b/boards/mips/pic32mx/pic32mx7mmb/scripts/Make.defs index 6af7320c176..b45172ad946 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/scripts/Make.defs +++ b/boards/mips/pic32mx/pic32mx7mmb/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/pic32mx7mmb/scripts/Make.defs +# boards/mips/pic32mx/pic32mx7mmb/scripts/Make.defs # # Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mx/pic32mx7mmb/scripts/c32-release.ld b/boards/mips/pic32mx/pic32mx7mmb/scripts/c32-release.ld index d3335e25f60..0c06b7c79fe 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/scripts/c32-release.ld +++ b/boards/mips/pic32mx/pic32mx7mmb/scripts/c32-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx7mmb/scripts/c32-release.ld + * boards/mips/pic32mx/pic32mx7mmb/scripts/c32-release.ld * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/pic32mx7mmb/scripts/mips-release.ld b/boards/mips/pic32mx/pic32mx7mmb/scripts/mips-release.ld index 93e280829db..f5ad73f5e85 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/scripts/mips-release.ld +++ b/boards/mips/pic32mx/pic32mx7mmb/scripts/mips-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx7mmb/scripts/mips-release.ld + * boards/mips/pic32mx/pic32mx7mmb/scripts/mips-release.ld * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/Makefile b/boards/mips/pic32mx/pic32mx7mmb/src/Makefile index 0f161819716..5e3d512d150 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/Makefile +++ b/boards/mips/pic32mx/pic32mx7mmb/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/pic32mx7mmb/src/Makefile +# boards/mips/pic32mx/pic32mx7mmb/src/Makefile # # Copyright (C) 2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_appinit.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_appinit.c index 92913a46eb7..5ad7a13ddad 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_appinit.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/pic32mx7mmb/src/pic32_appinit.c + * boards/mips/pic32mx/pic32mx7mmb/src/pic32_appinit.c * * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_boot.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_boot.c index 106b78b4cdf..2dd0a926aac 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_boot.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/pic32mx7mmb/src/pic32_boot.c +/**************************************************************************** + * boards/mips/pic32mx/pic32mx7mmb/src/pic32_boot.c * * Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,32 +49,34 @@ #include "pic32mx.h" #include "pic32mx7mmb.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_boardinitialize * * Description: - * All PIC32MX architectures must provide the following entry point. This entry - * point is called early in the intitialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All PIC32MX architectures must provide the following entry point. + * This entry point is called early in the intitialization -- after all + * memory has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void pic32mx_boardinitialize(void) { - /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak - * function pic32mx_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) + * the weak function pic32mx_spidev_initialize() has been brought into + * the link. */ #if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \ @@ -85,14 +87,15 @@ void pic32mx_boardinitialize(void) } #endif -/* Initialize the LCD. The LCD initialization function should be called early in the - * boot sequence -- even if the LCD is not enabled. In that case we should - * at a minimum at least disable the LCD backlight. +/* Initialize the LCD. The LCD initialization function should be called early + * in the boot sequence -- even if the LCD is not enabled. + * In that case we should at a minimum at least disable the LCD backlight. */ pic32mx_lcdinitialize(); #ifdef CONFIG_ARCH_LEDS + /* Configure on-board LEDs if LED support has been selected. */ pic32mx_led_initialize(); diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_bringup.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_bringup.c index 0ed0e16ba83..8157a3c886b 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_bringup.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/pic32mx7mmb/src/pic32_bringup.c + * boards/mips/pic32mx/pic32mx7mmb/src/pic32_bringup.c * * Copyright (C) 2012, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -58,7 +58,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* Assume that we have MMC/SD, USB host (and USB device) */ #define NSH_HAVEMMCSD 1 @@ -74,7 +76,7 @@ #ifdef NSH_HAVEMMCSD - /* Make sure that the NSH configuration uses the correct SPI */ +/* Make sure that the NSH configuration uses the correct SPI */ # if !defined(CONFIG_NSH_MMCSDSPIPORTNO) # define CONFIG_NSH_MMCSDSPIPORTNO CONFIG_PIC32MX_MMCSDSPIPORTNO @@ -84,9 +86,9 @@ # define CONFIG_NSH_MMCSDSPIPORTNO CONFIG_PIC32MX_MMCSDSPIPORTNO # endif - /* Make sure that the NSH configuration uses slot 0 (there is only one - * SD slot on the Mikroelektronica PIC32MX7 MMB). - */ +/* Make sure that the NSH configuration uses slot 0 (there is only one + * SD slot on the Mikroelektronica PIC32MX7 MMB). + */ # if !defined(CONFIG_NSH_MMCSDSLOTNO) # define CONFIG_NSH_MMCSDSLOTNO 0 @@ -96,7 +98,7 @@ # define CONFIG_NSH_MMCSDSLOTNO 0 # endif - /* Make sure that the correct SPI is enabled in the configuration */ +/* Make sure that the correct SPI is enabled in the configuration */ # if CONFIG_PIC32MX_MMCSDSPIPORTNO == 1 && !defined(CONFIG_PIC32MX_SPI1) # warning "CONFIG_PIC32MX_SPI1 is not enabled" @@ -184,12 +186,13 @@ static int nsh_waiter(int argc, char *argv[]) struct usbhost_hubport_s *hport; syslog(LOG_INFO, "nsh_waiter: Running\n"); - for (;;) + for (; ; ) { /* Wait for the device to change state */ DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); - syslog(LOG_INFO, "nsh_waiter: %s\n", hport->connected ? "connected" : "disconnected"); + syslog(LOG_INFO, "nsh_waiter: %s\n", + hport->connected ? "connected" : "disconnected"); /* Did we just become connected? */ @@ -297,7 +300,8 @@ static int nsh_usbhostinitialize(void) ret = usbhost_msc_initialize(); if (ret != OK) { - syslog(LOG_ERR, "ERROR: Failed to register the mass storage class: %d\n", ret); + syslog(LOG_ERR, + "ERROR: Failed to register the mass storage class: %d\n", ret); } #endif @@ -307,7 +311,8 @@ static int nsh_usbhostinitialize(void) ret = usbhost_cdcacm_initialize(); if (ret != OK) { - syslog(LOG_ERR, "ERROR: Failed to register the CDC/ACM serial class: %d\n", ret); + syslog(LOG_ERR, + "ERROR: Failed to register the CDC/ACM serial class: %d\n", ret); } #endif diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_leds.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_leds.c index ec732a05447..69be3cf2b21 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_leds.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx7mmb/src/pic32_leds.c + * boards/mips/pic32mx/pic32mx7mmb/src/pic32_leds.c * * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -52,7 +52,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* LED Configuration ********************************************************/ + /* The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labelled LED0-2 in the * schematics: * @@ -115,6 +117,7 @@ struct led_setting_s /**************************************************************************** * Private Data ****************************************************************************/ + /* If CONFIG_ARCH_LEDS is defined then NuttX will control the LEDs. The * following structures identified the LED settings for each NuttX LED state. */ @@ -226,9 +229,12 @@ void board_userled_all(uint8_t ledset) { /* Call board_userled() with ledon == true to illuminated the LED */ - board_userled(PIC32MX_PIC32MX7MMB_LED0, (ledset & PIC32MX_PIC32MX7MMB_LED0_BIT) != 0); - board_userled(PIC32MX_PIC32MX7MMB_LED1, (ledset & PIC32MX_PIC32MX7MMB_LED1_BIT) != 0); - board_userled(PIC32MX_PIC32MX7MMB_LED2, (ledset & PIC32MX_PIC32MX7MMB_LED2_BIT) != 0); + board_userled(PIC32MX_PIC32MX7MMB_LED0, + (ledset & PIC32MX_PIC32MX7MMB_LED0_BIT) != 0); + board_userled(PIC32MX_PIC32MX7MMB_LED1, + (ledset & PIC32MX_PIC32MX7MMB_LED1_BIT) != 0); + board_userled(PIC32MX_PIC32MX7MMB_LED2, + (ledset & PIC32MX_PIC32MX7MMB_LED2_BIT) != 0); } #endif diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_mio283qt2.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_mio283qt2.c index f3932c28e4a..c1a3d88a458 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_mio283qt2.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_mio283qt2.c @@ -1,7 +1,8 @@ -/************************************************************************************** - * boards/mips/pic32mx7mmb/src/pic32_mio283qt2.c +/**************************************************************************** + * boards/mips/pic32mx/pic32mx7mmb/src/pic32_mio283qt2.c * - * Interface definition for the MI0283QT-2 LCD from Multi-Inno Technology Co., Ltd. + * Interface definition for the MI0283QT-2 LCD + * from Multi-Inno Technology Co., Ltd. * This LCD is based on the Himax HX8347-D LCD controller. * * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. @@ -34,11 +35,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - **************************************************************************************/ + ****************************************************************************/ -/************************************************************************************** +/**************************************************************************** * Included Files - **************************************************************************************/ + ****************************************************************************/ #include @@ -60,16 +61,18 @@ #include "pic32mx-pmp.h" #include "pic32mx7mmb.h" -/************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - **************************************************************************************/ -/* Configuration **********************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ #if defined(CONFIG_LCD_MIO283QT2) && !defined(CONFIG_PIC32MX_PMP) # error "CONFIG_PIC32MX_PMP is required to use the LCD" #endif -/* PIC32MX7MMB LCD Hardware Definitions ***********************************************/ +/* PIC32MX7MMB LCD Hardware Definitions *************************************/ + /* --- ---------------------------------- -------------------- ------------------------ * PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS * (Family Data Sheet Table 1-1) (PIC32MX7 Schematic) @@ -124,9 +127,9 @@ #ifdef CONFIG_LCD_MIO283QT2 -/************************************************************************************** +/**************************************************************************** * Private Type Definition - **************************************************************************************/ + ****************************************************************************/ struct pic32mx7mmb_dev_s { @@ -137,9 +140,10 @@ struct pic32mx7mmb_dev_s FAR struct lcd_dev_s *drvr; /* The saved instance of the LCD driver */ }; -/************************************************************************************** +/**************************************************************************** * Private Function Protototypes - **************************************************************************************/ + ****************************************************************************/ + /* Low Level LCD access */ static void pic32mx_select(FAR struct mio283qt2_lcd_s *dev); @@ -151,9 +155,9 @@ static uint16_t pic32mx_read(FAR struct mio283qt2_lcd_s *dev); static void pic32mx_write(FAR struct mio283qt2_lcd_s *dev, uint16_t data); static void pic32mx_backlight(FAR struct mio283qt2_lcd_s *dev, int power); -/************************************************************************************** +/**************************************************************************** * Private Data - **************************************************************************************/ + ****************************************************************************/ /* This is the driver state structure (there is no retained state information) */ @@ -171,17 +175,17 @@ static struct pic32mx7mmb_dev_s g_pic32mx7mmb_lcd = } }; -/************************************************************************************** +/**************************************************************************** * Private Functions - **************************************************************************************/ + ****************************************************************************/ -/************************************************************************************** +/**************************************************************************** * Name: pic32mx_command * * Description: * Configure to write an LCD command * - **************************************************************************************/ + ****************************************************************************/ static void pic32mx_command(FAR struct pic32mx7mmb_dev_s *priv) { @@ -196,13 +200,13 @@ static void pic32mx_command(FAR struct pic32mx7mmb_dev_s *priv) } } -/************************************************************************************** +/**************************************************************************** * Name: pic32mx_data * * Description: * Configure to read or write LCD data * - **************************************************************************************/ + ****************************************************************************/ static void pic32mx_data(FAR struct pic32mx7mmb_dev_s *priv) { @@ -217,26 +221,26 @@ static void pic32mx_data(FAR struct pic32mx7mmb_dev_s *priv) } } -/************************************************************************************** +/**************************************************************************** * Name: pic32mx_data * * Description: * Wait until the PMP is no longer busy * - **************************************************************************************/ + ****************************************************************************/ static void pic32mx_busywait(void) { while ((getreg32(PIC32MX_PMP_MODE) & PMP_MODE_BUSY) != 0); } -/************************************************************************************** +/**************************************************************************** * Name: pic32mx_select * * Description: * Select the LCD device * - **************************************************************************************/ + ****************************************************************************/ static void pic32mx_select(FAR struct mio283qt2_lcd_s *dev) { @@ -253,13 +257,13 @@ static void pic32mx_select(FAR struct mio283qt2_lcd_s *dev) } } -/************************************************************************************** +/**************************************************************************** * Name: pic32mx_deselect * * Description: * De-select the LCD device * - **************************************************************************************/ + ****************************************************************************/ static void pic32mx_deselect(FAR struct mio283qt2_lcd_s *dev) { @@ -276,20 +280,20 @@ static void pic32mx_deselect(FAR struct mio283qt2_lcd_s *dev) } } -/************************************************************************************** +/**************************************************************************** * Name: pic32mx_index * * Description: * Set the index register * - **************************************************************************************/ + ****************************************************************************/ static void pic32mx_index(FAR struct mio283qt2_lcd_s *dev, uint8_t index) { FAR struct pic32mx7mmb_dev_s *priv = (FAR struct pic32mx7mmb_dev_s *)dev; - /* Make sure that the PMP is not busy from the last transaction. Read data is not - * available until the busy bit becomes zero. + /* Make sure that the PMP is not busy from the last transaction. + * Read data is not available until the busy bit becomes zero. */ pic32mx_busywait(); @@ -300,13 +304,13 @@ static void pic32mx_index(FAR struct mio283qt2_lcd_s *dev, uint8_t index) putreg16((uint16_t)index, PIC32MX_PMP_DIN); } -/************************************************************************************** +/**************************************************************************** * Name: pic32mx_read * * Description: * Read LCD data (GRAM data or register contents) * - **************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_MIO283QT2_WRONLY static uint16_t pic32mx_read(FAR struct mio283qt2_lcd_s *dev) @@ -314,8 +318,8 @@ static uint16_t pic32mx_read(FAR struct mio283qt2_lcd_s *dev) FAR struct pic32mx7mmb_dev_s *priv = (FAR struct pic32mx7mmb_dev_s *)dev; uint16_t data; - /* Make sure that the PMP is not busy from the last transaction. Read data is not - * available until the busy bit becomes zero. + /* Make sure that the PMP is not busy from the last transaction. + * Read data is not available until the busy bit becomes zero. */ pic32mx_busywait(); @@ -325,8 +329,8 @@ static uint16_t pic32mx_read(FAR struct mio283qt2_lcd_s *dev) pic32mx_data(priv); data = getreg16(PIC32MX_PMP_DIN); - /* We need to discard the first 16-bits of data that we read and re-read inorder - * to get valid data (that is just the way that the PMP works). + /* We need to discard the first 16-bits of data that we read and re-read + * inorder to get valid data (that is just the way that the PMP works). */ if (!priv->reading) @@ -338,13 +342,13 @@ static uint16_t pic32mx_read(FAR struct mio283qt2_lcd_s *dev) } #endif -/************************************************************************************** +/**************************************************************************** * Name: pic32mx_write * * Description: * Write LCD data (GRAM data or register contents) * - **************************************************************************************/ + ****************************************************************************/ static void pic32mx_write(FAR struct mio283qt2_lcd_s *dev, uint16_t data) { @@ -364,44 +368,44 @@ static void pic32mx_write(FAR struct mio283qt2_lcd_s *dev, uint16_t data) priv->reading = false; } -/************************************************************************************** +/**************************************************************************** * Name: pic32mx_write * * Description: * Write LCD data (GRAM data or register contents) * - **************************************************************************************/ + ****************************************************************************/ static void pic32mx_backlight(FAR struct mio283qt2_lcd_s *dev, int power) { - /* For now, we just control the backlight as a discrete. Pulse width modulation - * would be required to vary the backlight level. A low value turns the backlight - * off. + /* For now, we just control the backlight as a discrete. + * Pulse width modulation would be required to vary the backlight level. + * A low value turns the backlight off. */ pic32mx_gpiowrite(GPIO_LCD_BLED, power > 0); } -/************************************************************************************** +/**************************************************************************** * Public Functions - **************************************************************************************/ + ****************************************************************************/ -/************************************************************************************** +/**************************************************************************** * Name: board_lcd_initialize * * Description: * Initialize the LCD video hardware. The initial state of the LCD is fully - * initialized, display memory cleared, and the LCD ready to use, but with the power - * setting at 0 (full off). + * initialized, display memory cleared, and the LCD ready to use, but with + * the power setting at 0 (full off). * - **************************************************************************************/ + ****************************************************************************/ int board_lcd_initialize(void) { uint32_t regval; - /* Only initialize the driver once. NOTE: The LCD GPIOs were already configured - * by pic32mx_lcdinitialize. + /* Only initialize the driver once. + * NOTE: The LCD GPIOs were already configured by pic32mx_lcdinitialize. */ if (!g_pic32mx7mmb_lcd.drvr) @@ -422,8 +426,12 @@ int board_lcd_initialize(void) * increment, and no interrupts. */ - regval = (PMP_MODE_WAITE_RD(0) | PMP_MODE_WAITM(3) | PMP_MODE_WAITB_1TPB | - PMP_MODE_MODE_MODE2 | PMP_MODE_MODE16 | PMP_MODE_INCM_NONE | + regval = (PMP_MODE_WAITE_RD(0) | + PMP_MODE_WAITM(3) | + PMP_MODE_WAITB_1TPB | + PMP_MODE_MODE_MODE2 | + PMP_MODE_MODE16 | + PMP_MODE_INCM_NONE | PMP_MODE_IRQM_NONE); putreg32(regval, PIC32MX_PMP_MODE); @@ -461,14 +469,14 @@ int board_lcd_initialize(void) return OK; } -/************************************************************************************** +/**************************************************************************** * Name: board_lcd_getdev * * Description: - * Return a a reference to the LCD object for the specified LCD. This allows support - * for multiple LCD devices. + * Return a a reference to the LCD object for the specified LCD. + * This allows support for multiple LCD devices. * - **************************************************************************************/ + ****************************************************************************/ FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) { @@ -476,13 +484,13 @@ FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) return g_pic32mx7mmb_lcd.drvr; } -/************************************************************************************** +/**************************************************************************** * Name: board_lcd_uninitialize * * Description: * Uninitialize the LCD support * - **************************************************************************************/ + ****************************************************************************/ void board_lcd_uninitialize(void) { @@ -513,16 +521,16 @@ void pic32mx_lcdinitialize(void) */ #ifdef CONFIG_LCD_MIO283QT2 - pic32mx_configgpio(GPIO_LCD_RST); - pic32mx_configgpio(GPIO_LCD_CS); - pic32mx_configgpio(GPIO_LCD_BLED); - pic32mx_configgpio(GPIO_LCD_RS); + pic32mx_configgpio(GPIO_LCD_RST); + pic32mx_configgpio(GPIO_LCD_CS); + pic32mx_configgpio(GPIO_LCD_BLED); + pic32mx_configgpio(GPIO_LCD_RS); #else /* Just configure the backlight control as an output and turn off the * backlight for now. */ - pic32mx_configgpio(GPIO_LCD_BLED); + pic32mx_configgpio(GPIO_LCD_BLED); #endif } diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_spi.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_spi.c index e24a0239230..9ef7f2df65e 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_spi.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/pic32mx7mmb/src/pic32_spi.c +/**************************************************************************** + * boards/mips/pic32mx/pic32mx7mmb/src/pic32_spi.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -54,9 +54,10 @@ #if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \ defined(CONFIG_PIC32MX_SPI3) || defined(CONFIG_PIC32MX_SPI4) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* SPI1 and SD Card * * ------ -------- ------------------------- -------------------------------- @@ -75,18 +76,18 @@ #define GPIO_SD_WP (GPIO_INPUT|GPIO_PORTG|GPIO_PIN6) #define GPIO_SD_CD (GPIO_INPUT|GPIO_INT|GPIO_PORTG|GPIO_PIN7) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spidev_initialize * * Description: - * Called to configure SPI chip select GPIO pins for the Mikroelektronka PIC32MX7 - * MMB board. + * Called to configure SPI chip select GPIO pins for the + * Mikroelektronka PIC32MX7 MMB board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mx_spidev_initialize(void) { @@ -99,40 +100,45 @@ void weak_function pic32mx_spidev_initialize(void) #endif } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spiNselect, pic32mx_spiNstatus, and pic32mx_spiNcmddata * * Description: - * These external functions must be provided by board-specific logic. They are - * implementations of the select, status, and cmddata methods of the SPI interface - * defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All other methods - * including pic32mx_spibus_initialize()) are provided by common PIC32MX logic. To use - * this common SPI logic on your board: + * These external functions must be provided by board-specific logic. + * They are implementations of the select, status, and cmddata methods of + * the SPI interface defined by struct spi_ops_s + * (see include/nuttx/spi/spi.h). + * All other methods including pic32mx_spibus_initialize()) are provided + * by common PIC32MX logic. + * To use this common SPI logic on your board: * - * 1. Provide logic in pic32mx_boardinitialize() to configure SPI chip select - * pins. + * 1. Provide logic in pic32mx_boardinitialize() to configure SPI chip + * select pins. * 2. Provide pic32mx_spiNselect() and pic32mx_spiNstatus() functions - * in your board-specific logic. These functions will perform chip selection - * and status operations using GPIOs in the way your board is configured. + * in your board-specific logic. These functions will perform chip + * selection and status operations using GPIOs in the way your board is + * configured. * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide * pic32mx_spiNcmddata() functions in your board-specific logic. These - * functions will perform cmd/data selection operations using GPIOs in the way - * your board is configured. - * 3. Add a call to pic32mx_spibus_initialize() in your low level application - * initialization logic - * 4. The handle returned by pic32mx_spibus_initialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling + * functions will perform cmd/data selection operations using GPIOs in + * the way your board is configured. + * 3. Add a call to pic32mx_spibus_initialize() in your low level + * application initialization logic + * 4. The handle returned by pic32mx_spibus_initialize() may then be used + * to bind the SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). * - ************************************************************************************/ + ****************************************************************************/ struct spi_dev_s; #ifdef CONFIG_PIC32MX_SPI1 -void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); if (devid == SPIDEV_MMCSD(0)) { @@ -174,9 +180,11 @@ int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MX_SPI2 -void pic31mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic31mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -197,9 +205,11 @@ int pic31mx_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MX_SPI3 -void pic32mx_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mx_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -220,9 +230,11 @@ int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MX_SPI4 -void pic32mx_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mx_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #warning "Missing logic" } diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c index e452c50cfa6..38cbf0eccb2 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/pic32mx7mmb/src/pic32_touchscreen.c +/**************************************************************************** + * boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c * * Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -65,11 +65,14 @@ #ifdef CONFIG_INPUT -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ -/* Reference counting is partially implemented, but not needed in the current design. + ****************************************************************************/ + +/* Configuration ************************************************************/ + +/* Reference counting is partially implemented, but not needed in the current + * design. */ #undef CONFIG_TOUCHSCREEN_REFCNT @@ -88,8 +91,8 @@ * Touchscreen data comes in a a very high rate. New touch positions * will only be reported when the X or Y data changes by these thresholds. * This trades reduces data rate for some loss in dragging accuracy. The - * touchscreen is configure for 10-bit values so the raw ranges are 0-1023. So - * for example, if your display is 320x240, then THRESHX=3 and THRESHY=4 + * touchscreen is configure for 10-bit values so the raw ranges are 0-1023. + * So for example, if your display is 320x240, then THRESHX=3 and THRESHY=4 * would correspond to one pixel. Default: 4 */ @@ -101,15 +104,17 @@ # define CONFIG_TOUCHSCREEN_THRESHY 4 #endif -/* Driver support *******************************************************************/ -/* This format is used to construct the /dev/input[n] device driver path. It is - * defined here so that it will be used consistently in all places. +/* Driver support ***********************************************************/ + +/* This format is used to construct the /dev/input[n] device driver path. + * It is defined here so that it will be used consistently in all places. */ #define DEV_FORMAT "/dev/input%d" #define DEV_NAMELEN 16 -/* PIC32MX7MMB Touchscreen Hardware Definitions *************************************/ +/* PIC32MX7MMB Touchscreen Hardware Definitions *****************************/ + /* ----- ------ -------------------- * GPIO ADC IN TFT Signal Name * ----- ------ -------------------- @@ -139,7 +144,8 @@ #define UPPER_THRESHOLD (MAX_ADC-1) #define LOWER_THRESHOLD (1) -/* Delays ***************************************************************************/ +/* Delays *******************************************************************/ + /* All values will be increased by one system timer tick (probably 10MS). */ #define TC_PENUP_POLL_TICKS MSEC2TICK(100) /* IDLE polling rate: 100 MSec */ @@ -148,9 +154,10 @@ #define TC_SAMPLE_TICKS MSEC2TICK(4) /* Delay for A/D sampling: 4 MSec */ #define TC_RESAMPLE_TICKS TC_SAMPLE_TICKS -/************************************************************************************ +/**************************************************************************** * Private Types - ************************************************************************************/ + ****************************************************************************/ + /* This enumeration describes the state of touchscreen state machine */ enum tc_state_e @@ -214,9 +221,9 @@ struct tc_dev_s struct pollfd *fds[CONFIG_TOUCHSCREEN_NPOLLWAITERS]; }; -/************************************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************************************/ + ****************************************************************************/ static void tc_adc_sample(int pin); static uint16_t tc_adc_convert(void); @@ -266,17 +273,19 @@ static const struct file_operations tc_fops = static struct tc_dev_s g_touchscreen; #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ -/************************************************************************************ + ****************************************************************************/ + +/**************************************************************************** * Name: tc_adc_sample * * Description: - * Perform A/D sampling. Time must be allowed betwen the start of sampling + * Perform A/D sampling. + * Time must be allowed betwen the start of sampling * and conversion (approx. 100Ms). * - ************************************************************************************/ + ****************************************************************************/ static void tc_adc_sample(int pin) { @@ -319,18 +328,19 @@ static void tc_adc_sample(int pin) putreg32(ADC_CON1_SAMP, PIC32MX_ADC_CON1SET); } -/************************************************************************************ +/**************************************************************************** * Name: tc_adc_convert * * Description: - * Begin A/D conversion. Time must be allowed betwen the start of sampling + * Begin A/D conversion. + * Time must be allowed betwen the start of sampling * and conversion (approx. 100Ms). * * Assumptions: * 1) All output pins configured as outputs: * 2) Approprite pins are driven high and low * - ************************************************************************************/ + ****************************************************************************/ static uint16_t tc_adc_convert(void) { @@ -358,19 +368,20 @@ static uint16_t tc_adc_convert(void) return (uint16_t)retval; } -/************************************************************************************ +/**************************************************************************** * Name: tc_yminus_sample * * Description: * Initiate sampling on Y- * - ************************************************************************************/ + ****************************************************************************/ static void tc_yminus_sample(void) { /* Configure X- as an input and X+, Y+, and Y- as outputs */ - putreg32(LCD_XPLUS_BIT | LCD_YPLUS_BIT | LCD_YMINUS_BIT, PIC32MX_IOPORTB_TRISCLR); + putreg32(LCD_XPLUS_BIT | LCD_YPLUS_BIT | LCD_YMINUS_BIT, + PIC32MX_IOPORTB_TRISCLR); putreg32(LCD_XMINUS_BIT, PIC32MX_IOPORTB_TRISSET); /* Energize the X plate: Y+ and Y- high, X+ low */ @@ -383,19 +394,20 @@ static void tc_yminus_sample(void) tc_adc_sample(LCD_XMINUS_PIN); } -/************************************************************************************ +/**************************************************************************** * Name: tc_yplus_sample * * Description: * Initiate sampling on Y+ * - ************************************************************************************/ + ****************************************************************************/ static void tc_yplus_sample(void) { /* Configure X+ as an input and X-, Y+, and Y- as outputs */ - putreg32(LCD_XMINUS_BIT | LCD_YPLUS_BIT | LCD_YMINUS_BIT, PIC32MX_IOPORTB_TRISCLR); + putreg32(LCD_XMINUS_BIT | LCD_YPLUS_BIT | LCD_YMINUS_BIT, + PIC32MX_IOPORTB_TRISCLR); putreg32(LCD_XPLUS_BIT, PIC32MX_IOPORTB_TRISSET); /* Energize the X plate: Y+ and Y- High, X- low (X+ is an input) */ @@ -408,19 +420,20 @@ static void tc_yplus_sample(void) tc_adc_sample(LCD_XPLUS_PIN); } -/************************************************************************************ +/**************************************************************************** * Name: tc_xplus_sample * * Description: * Initiate sampling on X+ * - ************************************************************************************/ + ****************************************************************************/ static void tc_xplus_sample(void) { /* Configure Y+ as an input and X+, X-, and Y- as outputs */ - putreg32(LCD_XPLUS_BIT | LCD_XMINUS_BIT | LCD_YMINUS_BIT, PIC32MX_IOPORTB_TRISCLR); + putreg32(LCD_XPLUS_BIT | LCD_XMINUS_BIT | LCD_YMINUS_BIT, + PIC32MX_IOPORTB_TRISCLR); putreg32(LCD_YPLUS_BIT, PIC32MX_IOPORTB_TRISSET); /* Energize the Y plate: X+ and X- high, Y- low (Y+ is an input) */ @@ -433,19 +446,20 @@ static void tc_xplus_sample(void) tc_adc_sample(LCD_YPLUS_PIN); } -/************************************************************************************ +/**************************************************************************** * Name: tc_xminus_sample * * Description: * Initiate sampling on X- * - ************************************************************************************/ + ****************************************************************************/ static void tc_xminus_sample(void) { /* Configure Y- as an input and X+, Y+, and X- as outputs */ - putreg32(LCD_XPLUS_BIT | LCD_XMINUS_BIT | LCD_YPLUS_BIT, PIC32MX_IOPORTB_TRISCLR); + putreg32(LCD_XPLUS_BIT | LCD_XMINUS_BIT | LCD_YPLUS_BIT, + PIC32MX_IOPORTB_TRISCLR); putreg32(LCD_YMINUS_BIT, PIC32MX_IOPORTB_TRISSET); /* Energize the Y plate: X+ and X- high, Y+ low (Y- is an input) */ @@ -488,10 +502,11 @@ static void tc_notify(FAR struct tc_dev_s *priv) nxsem_post(&priv->waitsem); } - /* If there are threads waiting on poll() for touchscreen data to become available, - * then wake them up now. NOTE: we wake up all waiting threads because we - * do not know that they are going to do. If they all try to read the data, - * then some make end up blocking after all. + /* If there are threads waiting on poll() for touchscreen data to become + * available, then wake them up now. NOTE: we wake up all waiting threads + * because we do not know that they are going to do. + * If they all try to read the data, then some make end up blocking after + * all. */ for (i = 0; i < CONFIG_TOUCHSCREEN_NPOLLWAITERS; i++) @@ -526,7 +541,7 @@ static int tc_sample(FAR struct tc_dev_s *priv, * sampled data. */ - memcpy(sample, &priv->sample, sizeof(struct tc_sample_s )); + memcpy(sample, &priv->sample, sizeof(struct tc_sample_s)); /* Now manage state transitions */ @@ -541,11 +556,11 @@ static int tc_sample(FAR struct tc_dev_s *priv, priv->id++; } else if (sample->contact == CONTACT_DOWN) - { + { /* First report -- next report will be a movement */ - priv->sample.contact = CONTACT_MOVE; - } + priv->sample.contact = CONTACT_MOVE; + } priv->penchange = false; ret = OK; @@ -742,9 +757,9 @@ static void tc_worker(FAR void *arg) value = tc_adc_convert(); - /* A converted value at the minimum would mean that we lost the contact - * before all of the conversions were completed. At converted value at - * the maximum value is probably bad too. + /* A converted value at the minimum would mean that we lost the + * contact before all of the conversions were completed. + * At converted value at the maximum value is probably bad too. */ if (!tc_valid_sample(value)) @@ -760,7 +775,8 @@ static void tc_worker(FAR void *arg) { value = MAX_ADC - value; priv->newy = (value + priv->value) >> 1; - iinfo("Y-=%d Y+=%d[%d] Y=%d\n", priv->value, value, MAX_ADC - value, priv->newy); + iinfo("Y-=%d Y+=%d[%d] Y=%d\n", priv->value, + value, MAX_ADC - value, priv->newy); /* Start X+ sampling */ @@ -784,9 +800,9 @@ static void tc_worker(FAR void *arg) value = tc_adc_convert(); - /* A converted value at the minimum would mean that we lost the contact - * before all of the conversions were completed. At converted value at - * the maximum value is probably bad too. + /* A converted value at the minimum would mean that we lost the + * contact before all of the conversions were completed. + * At converted value at the maximum value is probably bad too. */ if (!tc_valid_sample(value)) @@ -826,9 +842,9 @@ static void tc_worker(FAR void *arg) value = tc_adc_convert(); - /* A converted value at the minimum would mean that we lost the contact - * before all of the conversions were completed. At converted value at - * the maximum value is probably bad too. + /* A converted value at the minimum would mean that we lost the + * contact before all of the conversions were completed. + * At converted value at the maximum value is probably bad too. */ if (!tc_valid_sample(value)) @@ -846,7 +862,8 @@ static void tc_worker(FAR void *arg) value = MAX_ADC - value; newx = (value + priv->value) >> 1; - iinfo("X+=%d X-=%d[%d] X=%d\n", priv->value, value, MAX_ADC - value, newx); + iinfo("X+=%d X-=%d[%d] X=%d\n", priv->value, + value, MAX_ADC - value, newx); /* Samples are available */ @@ -864,8 +881,8 @@ static void tc_worker(FAR void *arg) if (priv->state == TC_PENUP) { - /* Ignore if the pen was already down (CONTACT_NONE == pen up and already - * reported. CONTACT_UP == pen up, but not reported) + /* Ignore if the pen was already down (CONTACT_NONE == pen up and + * already reported. CONTACT_UP == pen up, but not reported) */ if (priv->sample.contact != CONTACT_NONE) @@ -898,15 +915,17 @@ static void tc_worker(FAR void *arg) else if (priv->state == TC_PENDOWN) { - /* It is a pen down event. If the last loss-of-contact event has not been - * processed yet, then we have to ignore the pen down event (or else it will - * look like a drag event) + /* It is a pen down event. If the last loss-of-contact event has not + * been processed yet, then we have to ignore the pen down event + * (or else it will look like a drag event) */ if (priv->sample.contact != CONTACT_UP) { - /* Perform a thresholding operation so that the results will be more stable. - * If the difference from the last sample is small, then ignore the event. + /* Perform a thresholding operation so that the results will be + * more stable. + * If the difference from the last sample is small, then ignore + * the event. */ xdiff = (int16_t)priv->sample.x - (int16_t)newx; @@ -924,15 +943,18 @@ static void tc_worker(FAR void *arg) if (xdiff >= CONFIG_TOUCHSCREEN_THRESHX || ydiff >= CONFIG_TOUCHSCREEN_THRESHY) { - /* There is some change above the threshold... Report the change. */ + /* There is some change above the threshold... + * Report the change. + */ priv->sample.x = newx; priv->sample.y = priv->newy; priv->sample.valid = true; - /* If this is the first (acknowledged) penddown report, then report - * this as the first contact. If contact == CONTACT_DOWN, it will be - * set to set to CONTACT_MOVE after the contact is first sampled. + /* If this is the first (acknowledged) penddown report, then + * report this as the first contact. + * If contact == CONTACT_DOWN, it will be set to set to + * CONTACT_MOVE after the contact is first sampled. */ if (priv->sample.contact != CONTACT_MOVE) @@ -1120,7 +1142,7 @@ static ssize_t tc_read(FAR struct file *filep, FAR char *buffer, size_t len) { ret = -EAGAIN; goto errout; - } + } /* Wait for sample data */ @@ -1148,8 +1170,8 @@ static ssize_t tc_read(FAR struct file *filep, FAR char *buffer, size_t len) if (sample.contact == CONTACT_UP) { - /* Pen is now up. Is the positional data valid? This is important to - * know because the release will be sent to the window based on its + /* Pen is now up. Is the positional data valid? This is important to + * know because the release will be sent to the window based on its * last positional data. */ @@ -1169,13 +1191,15 @@ static ssize_t tc_read(FAR struct file *filep, FAR char *buffer, size_t len) { /* First contact */ - report->point[0].flags = TOUCH_DOWN | TOUCH_ID_VALID | TOUCH_POS_VALID; + report->point[0].flags = TOUCH_DOWN | TOUCH_ID_VALID | + TOUCH_POS_VALID; } else /* if (sample->contact == CONTACT_MOVE) */ { /* Movement of the same contact */ - report->point[0].flags = TOUCH_MOVE | TOUCH_ID_VALID | TOUCH_POS_VALID; + report->point[0].flags = TOUCH_MOVE | TOUCH_ID_VALID | + TOUCH_POS_VALID; } } @@ -1326,9 +1350,9 @@ errout: return ret; } -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Name: pic32mx_tsc_setup diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbdev.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbdev.c index 52926a6f7d5..ea429412ea9 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbdev.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbdev.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/pic32mx7mmb/src/pic32_usbdev.c +/**************************************************************************** + * boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbdev.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,12 +49,12 @@ #if defined(CONFIG_PIC32MX_USBDEV) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* - * PIN NAME SIGNAL NOTES - * ---- ------------------------------- -------------- ------------------------------ + ****************************************************************************/ + +/* PIN NAME SIGNAL NOTES + * ---- ------------------------------- -------------- ---------------------- * 20 VBUSON/C1IN+/AN5/CN7/RB5 VBUSON To USB VBUS circuitry * 43 C2IN+/AN3/CN5/RB3 USB_PGOOD Power good (low if bad) */ @@ -62,22 +62,22 @@ #define GPIO_USB_VBUSON (GPIO_INPUT|GPIO_PORTB|GPIO_PIN5) #define GPIO_USB_PGOOD (GPIO_INPUT|GPIO_PORTB|GPIO_PIN3) -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbdevinitialize * * Description: - * Called to configure the mini-A/B J5 on the Mikroelektronika PIC32MX7 MMB for the - * USB device + * Called to configure the mini-A/B J5 on the Mikroelektronika PIC32MX7 MMB + * for the USB device * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mx_usbdevinitialize(void) { @@ -87,44 +87,53 @@ void weak_function pic32mx_usbdevinitialize(void) /* Notes from the Sure Electronics sample code: * - * "The USB specifications require that USB peripheral devices must never source - * current onto the Vbus pin. Additionally, USB peripherals should not source - * current on D+ or D- when the host/hub is not actively powering the Vbus line. + * "The USB specifications require that USB peripheral devices must never + * source current onto the Vbus pin. Additionally, USB peripherals should + * not source current on D+ or D- when the host/hub is not actively + * powering the Vbus line. * When designing a self powered (as opposed to bus powered) USB peripheral - * device, the firmware should make sure not to turn on the USB module and D+ - * or D- pull up resistor unless Vbus is actively powered. Therefore, the - * firmware needs some means to detect when Vbus is being powered by the host. + * device, the firmware should make sure not to turn on the USB module and + * D+ or D- pull up resistor unless Vbus is actively powered. Therefore, + * the firmware needs some means to detect when Vbus is being powered by + * the host. * A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and * can be used to detect when Vbus is high (host actively powering), or low * (host is shut down or otherwise not supplying power). The USB firmware - * can then periodically poll this I/O pin to know when it is okay to turn on - * the USB module/D+/D- pull up resistor. When designing a purely bus powered - * peripheral device, it is not possible to source current on D+ or D- when the - * host is not actively providing power on Vbus. Therefore, implementing this - * bus sense feature is optional. ..." + * can then periodically poll this I/O pin to know when it is okay to turn + * on the USB module/D+/D- pull up resistor. When designing a purely bus + * powered peripheral device, it is not possible to source current on D+ or + * D- when the host is not actively providing power on Vbus. + * Therefore, implementing this bus sense feature is optional. ..." */ #ifdef CONFIG_USBHOST - //pic32mx_configgpio(GPIO_USB_VBUSON); + + /* pic32mx_configgpio(GPIO_USB_VBUSON); */ + #endif - /* "If the host PC sends a GetStatus (device) request, the firmware must respond - * and let the host know if the USB peripheral device is currently bus powered - * or self powered. See chapter 9 in the official USB specifications for details - * regarding this request. If the peripheral device is capable of being both - * self and bus powered, it should not return a hard coded value for this request. - * Instead, firmware should check if it is currently self or bus powered, and - * respond accordingly. If the hardware has been configured like demonstrated - * on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the + /* "If the host PC sends a GetStatus (device) request, the firmware must + * respond and let the host know if the USB peripheral device is currently + * bus powered or self powered. + * See chapter 9 in the official USB specifications for details regarding + * this request. If the peripheral device is capable of being both self + * and bus powered, it should not return a hard coded value for this + * request. + * Instead, firmware should check if it is currently self or bus powered, + * and respond accordingly. + * If the hardware has been configured like demonstrated on the PICDEM FS + * USB Demo Board, an I/O pin can be polled to determine the * currently selected power source. ..." */ #ifdef CONFIG_USB_PWRSENSE - //pic32mx_configgpio(GPIO_USB_PWRSENSE); + + /* pic32mx_configgpio(GPIO_USB_PWRSENSE); */ + #endif } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbpullup * * Description: @@ -134,7 +143,7 @@ void weak_function pic32mx_usbdevinitialize(void) * of this method. Alternatively, if no pull-up GPIO the following EXTERN * can be redefined to be NULL. * - ************************************************************************************/ + ****************************************************************************/ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) { @@ -143,16 +152,17 @@ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbsuspend * * Description: - * Board logic must provide the pic32mx_usbsuspend logic if the USBDEV driver - * is used. This function is called whenever the USB enters or leaves + * Board logic must provide the pic32mx_usbsuspend logic if the USBDEV + * driver is used. + * This function is called whenever the USB enters or leaves * suspend mode. This is an opportunity for the board logic to shutdown * clocks, power, etc. while the USB is suspended. * - ************************************************************************************/ + ****************************************************************************/ void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume) { diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbmsc.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbmsc.c index 5e2df7e823b..e6d442c4cc8 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbmsc.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbmsc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx7mmb/src/pic32_usbmsc.c + * boards/mips/pic32mx/pic32mx7mmb/src/pic32_usbmsc.c * * Copyright (C) 2012, 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -58,7 +58,8 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() (see pic32_appinit.c). + * already have been initialized in board_app_initialize() + * (see pic32_appinit.c). * In this case, there is nothing further to be done here. */ @@ -66,5 +67,5 @@ int board_usbmsc_initialize(int port) # warning "Missing Logic" #endif /* CONFIG_NSH_BUILTIN_APPS */ - return 0; + return 0; } diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32mx7mmb.h b/boards/mips/pic32mx/pic32mx7mmb/src/pic32mx7mmb.h index 58386db4af5..4827003fe14 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32mx7mmb.h +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32mx7mmb.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mx7mmb/src/pic32mx7mmb.h + * boards/mips/pic32mx/pic32mx7mmb/src/pic32mx7mmb.h * * Copyright (C) 2012, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_MIKROELEKTRONIKA_PIC32MX7MMB_SRC_PIC32MX7MMB_H -#define __BOARDS_MIPS_MIKROELEKTRONIKA_PIC32MX7MMB_SRC_PIC32MX7MMB_H +#ifndef __BOARDS_MIPS_PIC32MX_PIC32MX7MMB_SRC_PIC32MX7MMB_H +#define __BOARDS_MIPS_PIC32MX_PIC32MX7MMB_SRC_PIC32MX7MMB_H /**************************************************************************** * Included Files @@ -46,7 +46,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labeled LED0-2 in the * schematics: * @@ -114,7 +116,8 @@ #ifdef __cplusplus #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -200,4 +203,4 @@ int pic32mx_tsc_setup(int minor); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_MIKROELEKTRONIKA_PIC32MX7MMB_SRC_PIC32MX7MMB_H */ +#endif /* __BOARDS_MIPS_PIC32MX_PIC32MX7MMB_SRC_PIC32MX7MMB_H */ diff --git a/boards/mips/pic32mx/sure-pic32mx/README.txt b/boards/mips/pic32mx/sure-pic32mx/README.txt index 9ebebff7630..58f4019a948 100644 --- a/boards/mips/pic32mx/sure-pic32mx/README.txt +++ b/boards/mips/pic32mx/sure-pic32mx/README.txt @@ -1,4 +1,4 @@ -boards/pic32mx README +boards/mips/pic32mx/sure-pic32mx README ===================== This README file discusses the port of NuttX to the "Advanced USB Storage diff --git a/boards/mips/pic32mx/sure-pic32mx/include/board.h b/boards/mips/pic32mx/sure-pic32mx/include/board.h index e60fd5694db..6b9cf9c93d3 100644 --- a/boards/mips/pic32mx/sure-pic32mx/include/board.h +++ b/boards/mips/pic32mx/sure-pic32mx/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/sure-pic32mx/include/board.h + * boards/mips/pic32mx/sure-pic32mx/include/board.h * include/arch/board/board.h * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. @@ -34,8 +34,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_SURE_PIC32MX_INCLUDE_BOARD_H -#define __BOARDS_MIPS_SURE_PIC32MX_INCLUDE_BOARD_H +#ifndef __BOARDS_MIPS_PIC32MX_SURE_PIC32MX_INCLUDE_BOARD_H +#define __BOARDS_MIPS_PIC32MX_SURE_PIC32MX_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -46,9 +46,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Crystal frequencies */ #define BOARD_POSC_FREQ 20000000 /* Primary OSC XTAL frequency (20MHz) */ @@ -97,6 +99,7 @@ #undef BOARD_TIMER1_SOSC /* LED definitions **********************************************************/ + /* The Sure DB_DP11215 PIC32 Storage Demo Board board has five LEDs. One * (D4, lablel "Power") is not controllable by software. Four are * controllable by software: @@ -118,10 +121,10 @@ #define LED_PANIC 5 /* N/C N/C N/C ON N/C N/C N/C OFF */ #define LED_NVALUES 6 -/* The Sure DB-DP11212 PIC32 General Purpose Demo Board does not have any user - * controllable LEDs, but does does have a segment LED display. That display is - * however, obscured by the larger segment display attached to the board and, so, - * is not supported. +/* The Sure DB-DP11212 PIC32 General Purpose Demo Board does not have any + * user controllable LEDs, but does does have a segment LED display. + * That display is however, obscured by the larger segment display attached to + * the board and, so, is not supported. */ /* For distinguishing individual LEDs */ @@ -132,6 +135,7 @@ #define LED_ERROR 3 /* Button Definitions *******************************************************/ + /* The Sure PIC32MX board has three buttons. * * SW1 (SW_UP, left arrow) RB3 Pulled high, Grounded/low when depressed @@ -175,4 +179,4 @@ extern "C" { #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_SURE_PIC32MX_INCLUDE_BOARD_H */ +#endif /* __BOARDS_MIPS_PIC32MX_SURE_PIC32MX_INCLUDE_BOARD_H */ diff --git a/boards/mips/pic32mx/sure-pic32mx/scripts/Make.defs b/boards/mips/pic32mx/sure-pic32mx/scripts/Make.defs index 449175d91d2..29b5efe52a8 100644 --- a/boards/mips/pic32mx/sure-pic32mx/scripts/Make.defs +++ b/boards/mips/pic32mx/sure-pic32mx/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/mips/sure-pic32mx/scripts/Make.defs +# boards/mips/pic32mx/sure-pic32mx/scripts/Make.defs # # Copyright (C) 2011, 2013, 2017-2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mx/sure-pic32mx/scripts/c32-release.ld b/boards/mips/pic32mx/sure-pic32mx/scripts/c32-release.ld index 16bd00ce12b..bdc8040c76a 100644 --- a/boards/mips/pic32mx/sure-pic32mx/scripts/c32-release.ld +++ b/boards/mips/pic32mx/sure-pic32mx/scripts/c32-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/sure-pic32mx/nsh/c32-release.ld + * boards/mips/pic32mx/sure-pic32mx/nsh/c32-release.ld * * Copyright (C) 2011, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -9,14 +9,14 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. + * used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/sure-pic32mx/scripts/mips-release.ld b/boards/mips/pic32mx/sure-pic32mx/scripts/mips-release.ld index 3cb6c4b8dc5..0a8bcb770ae 100644 --- a/boards/mips/pic32mx/sure-pic32mx/scripts/mips-release.ld +++ b/boards/mips/pic32mx/sure-pic32mx/scripts/mips-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/sure-pic32mx/nsh/mips-release.ld + * boards/mips/pic32mx/sure-pic32mx/nsh/mips-release.ld * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/sure-pic32mx/src/Makefile b/boards/mips/pic32mx/sure-pic32mx/src/Makefile index 7ee4153c448..770b0c65453 100644 --- a/boards/mips/pic32mx/sure-pic32mx/src/Makefile +++ b/boards/mips/pic32mx/sure-pic32mx/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sure-pic32mx/src/Makefile +# boards/mips/pic32mx/sure-pic32mx/src/Makefile # # Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_appinit.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_appinit.c index 3bb9398a928..06fabaf0108 100644 --- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_appinit.c +++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sure-pic32mx/src/pic32mx_appinit.c + * boards/mips/pic32mx/sure-pic32mx/src/pic32mx_appinit.c * * Copyright (C) 2011-2013, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -183,12 +183,13 @@ static int nsh_waiter(int argc, char *argv[]) struct usbhost_hubport_s *hport; syslog(LOG_INFO, "nsh_waiter: Running\n"); - for (;;) + for (; ; ) { /* Wait for the device to change state */ DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); - syslog(LOG_INFO, "nsh_waiter: %s\n", hport->connected ? "connected" : "disconnected"); + syslog(LOG_INFO, "nsh_waiter: %s\n", + hport->connected ? "connected" : "disconnected"); /* Did we just become connected? */ @@ -294,7 +295,8 @@ static int nsh_usbhostinitialize(void) ret = usbhost_msc_initialize(); if (ret != OK) { - syslog(LOG_ERR, "ERROR: Failed to register the mass storage class: %d\n", ret); + syslog(LOG_ERR, + "ERROR: Failed to register the mass storage class: %d\n", ret); } #endif @@ -304,7 +306,8 @@ static int nsh_usbhostinitialize(void) ret = usbhost_cdcacm_initialize(); if (ret != OK) { - syslog(LOG_ERR, "ERROR: Failed to register the CDC/ACM serial class: %d\n", ret); + syslog(LOG_ERR, + "ERROR: Failed to register the CDC/ACM serial class: %d\n", ret); } #endif diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_autoleds.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_autoleds.c index d823895a48f..7c2426b29c1 100644 --- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_autoleds.c +++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/sure-pic32mx/src/pic32mx_leds.c + * boards/mips/pic32mx/sure-pic32mx/src/pic32mx_leds.c * * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -59,7 +59,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* LED Configuration ********************************************************/ + /* The Sure PIC32MX board has five LEDs. One (D4, lablel "Power") is not * controllable by software. Four are controllable by software: * diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_boot.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_boot.c index 1d6d2cd6dad..41bec88b688 100644 --- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_boot.c +++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/sure-pic32mx/src/pic32mx_boot.c +/**************************************************************************** + * boards/mips/pic32mx/sure-pic32mx/src/pic32mx_boot.c * * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,32 +49,34 @@ #include "pic32mx.h" #include "sure-pic32mx.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_boardinitialize * * Description: - * All PIC32MX architectures must provide the following entry point. This entry - * point is called early in the intitialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All PIC32MX architectures must provide the following entry point. + * This entry point is called early in the intitialization -- after all + * memory has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void pic32mx_boardinitialize(void) { - /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak - * function pic32mx_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) + * the weak function pic32mx_spidev_initialize() has been brought into + * the link. */ #if defined(CONFIG_PIC32MX_SPI2) diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_buttons.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_buttons.c index 27c0a9d3ddc..f9a0ecf0a9c 100644 --- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_buttons.c +++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/sure-pic32mx/src/pic32mx_buttons.c + * boards/mips/pic32mx/sure-pic32mx/src/pic32mx_buttons.c * * Copyright (C) 2011, 2013-2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -130,10 +130,10 @@ static const uint8_t g_buttoncn[NUM_BUTTONS] = * 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. + * 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. * ****************************************************************************/ @@ -175,35 +175,36 @@ uint32_t board_buttons(void) 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. + * 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 and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. + * 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 and JOYSTICK_*_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_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. + * 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_* and JOYSTICK_* definitions in board.h for the meaning + * of enumeration value. * - * Interrupts are automatically enabled when the button handler is attached and - * automatically disabled when the button handler is detached. + * Interrupts are automatically enabled when the button handler is attached + * and automatically disabled when the button handler is detached. * * When an interrupt occurs, it is due to a change on the GPIO input pin * associated with the button. In that case, all attached change * notification handlers will be called. Each handler must maintain state * and determine if the unlying GPIO button input value changed. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) @@ -213,7 +214,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) if (id < NUM_BUTTONS) { pic32mx_gpioirqdisable(g_buttoncn[id]); - ret = pic32mx_gpioattach(g_buttonset[id], g_buttoncn[id], irqhandler, arg); + ret = pic32mx_gpioattach(g_buttonset[id], g_buttoncn[id], + irqhandler, arg); if (ret >= 0) { pic32mx_gpioirqenable(g_buttoncn[id]); diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c index 7ce49a51e96..c17c4dc7455 100644 --- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c +++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/sure-pic32mx/src/pic32mx_lcd1602.c + * boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c * * This logic supports the connection of an LCD1602 LCD to the PCB Logic * PIC32MX board. The LCD1602 is based on the Hitachi HD44780U LCD @@ -99,6 +99,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_LCD_MAXCONTRAST @@ -153,6 +154,7 @@ struct lcd1602_2 /**************************************************************************** * Private Function Protototypes ****************************************************************************/ + /* Debug */ #ifdef CONFIG_DEBUG_LCD_INFO @@ -184,7 +186,8 @@ static void lcd_action(enum slcdcode_e code, uint8_t count); static ssize_t lcd_read(FAR struct file *, FAR char *, size_t); static ssize_t lcd_write(FAR struct file *, FAR const char *, size_t); static int lcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -static int lcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); +static int lcd_poll(FAR struct file *filep, FAR struct pollfd *fds, + bool setup); /**************************************************************************** * Private Data @@ -304,9 +307,9 @@ static void lcd_brightness(uint8_t brightness) /* Turn the LCD light on */ pic32mx_gpiowrite(GPIO_LCD_LIGHT, true); - NOP;NOP;NOP; + NOP; NOP; NOP; pic32mx_gpiowrite(GPIO_LCD_COMP, true); - NOP;NOP; + NOP; NOP; pic32mx_gpiowrite(GPIO_LCD_PWR, true); } else @@ -501,7 +504,7 @@ static uint8_t lcd_readch(uint8_t row, uint8_t column) * Column 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... 39 * Row 0 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ... 27 * Ro1 1 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f ... 67 - */ + */ addr = column; if (row > 0) @@ -530,7 +533,7 @@ static void lcd_writech(uint8_t ch, uint8_t row, uint8_t column) * Column 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... 39 * Row 0 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ... 27 * Ro1 1 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f ... 67 - */ + */ addr = column; if (row > 0) @@ -582,9 +585,10 @@ static void lcd_action(enum slcdcode_e code, uint8_t count) break; } - /* Otherwise, BACKDEL is like moving the cursor back N characters then doing a - * forward deletion. Decrement the cursor position and fall through. - */ + /* Otherwise, BACKDEL is like moving the cursor back N characters + * then doing a forward deletion. + * Decrement the cursor position and fall through. + */ tmp = (int)g_lcd1602.curcol - count; if (tmp < 0) @@ -912,11 +916,10 @@ static int lcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { switch (cmd) { - /* SLCDIOC_GETATTRIBUTES: Get the attributes of the SLCD * - * argument: Pointer to struct slcd_attributes_s in which values will be - * returned + * argument: Pointer to struct slcd_attributes_s in which values will + * be returned */ case SLCDIOC_GETATTRIBUTES: @@ -944,7 +947,6 @@ static int lcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * returned */ - case SLCDIOC_CURPOS: { FAR struct slcd_curpos_s *curpos = (FAR struct slcd_curpos_s *)((uintptr_t)arg); @@ -1073,6 +1075,7 @@ int up_lcd1602_initialize(void) pic32mx_gpiowrite(GPIO_LCD_E, true); /* Enable transfer */ /* Configure and enable the LCD */ + /* Delay for 4.1MS or more */ up_mdelay(5); @@ -1083,15 +1086,17 @@ int up_lcd1602_initialize(void) * Function set: 5x7 Style | N=2R | DL=8D */ - lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_F5x7 | HD4478OU_FUNC_N1 | HD4478OU_FUNC_DL8D); + lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_F5x7 | + HD4478OU_FUNC_N1 | HD4478OU_FUNC_DL8D); up_udelay(100); /* Delay more than 100uS */ - - lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_F5x7 | HD4478OU_FUNC_N1 | HD4478OU_FUNC_DL8D); + lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_F5x7 | + HD4478OU_FUNC_N1 | HD4478OU_FUNC_DL8D); up_udelay(40); /* Delay more than 40uS */ - lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_F5x7 | HD4478OU_FUNC_N1 | HD4478OU_FUNC_DL8D); + lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_F5x7 | + HD4478OU_FUNC_N1 | HD4478OU_FUNC_DL8D); lcd_waitbusy(); - - lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_F5x7 | HD4478OU_FUNC_N1 | HD4478OU_FUNC_DL8D); + lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_F5x7 | + HD4478OU_FUNC_N1 | HD4478OU_FUNC_DL8D); lcd_waitbusy(); /* Display ON, cursor OFF, blink OFF */ @@ -1103,7 +1108,6 @@ int up_lcd1602_initialize(void) lcd_wrcommand(HD4478OU_CLEAR); /* Clear display */ lcd_waitbusy(); - lcd_wrcommand(HD4478OU_RETURN); /* Return home: AC=0 */ lcd_waitbusy(); diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_spi.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_spi.c index a3d8d203257..f1b44584cc9 100644 --- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_spi.c +++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/sure-pic32mx/src/pic32mx_spi.c +/**************************************************************************** + * boards/mips/pic32mx/sure-pic32mx/src/pic32mx_spi.c * * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -53,13 +53,14 @@ #if defined(CONFIG_PIC32MX_SPI2) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_DBDP11215 -/* The Sure DB_DP11215 PIC32 Storage Demo Board has an SD slot connected on SPI2: +/* The Sure DB_DP11215 PIC32 Storage Demo Board has an SD slot + * connected on SPI2: * * SCK2/PMA5/CN8/RG6 SCK SD connector SCK, FLASH (U1) SCK* * SDI2/PMA4/CN9/RG7 SDI SD connector DO, FLASH (U1) SO* @@ -118,22 +119,22 @@ # define GPIO_SOIC_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTB|GPIO_PIN11) #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the Sure PIC32MX board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mx_spidev_initialize(void) { - /* Configure the SPI2 chip select (CS) GPIO output, and the card detect (CD) and - * write protect (WP) inputs. + /* Configure the SPI2 chip select (CS) GPIO output, and the card detect (CD) + * and write protect (WP) inputs. */ #ifdef PIC32_HAVE_SD @@ -148,35 +149,39 @@ void weak_function pic32mx_spidev_initialize(void) #endif } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spi2select and pic32mx_spi2status * * Description: * The external functions, pic32mx_spi2select and pic32mx_spi2status - * must be provided by board-specific logic. They are implementations of the select - * and status methods of the SPI interface defined by struct spi_ops_s (see - * include/nuttx/spi/spi.h). All other methods (including pic32mx_spibus_initialize()) - * are provided by common PIC32MX logic. To use this common SPI logic on your - * board: + * must be provided by board-specific logic. They are implementations of + * the select and status methods of the SPI interface defined by struct + * spi_ops_s (see include/nuttx/spi/spi.h). + * All other methods (including pic32mx_spibus_initialize()) + * are provided by common PIC32MX logic. + * To use this common SPI logic on your board: * - * 1. Provide logic in pic32mx_boardinitialize() to configure SPI/SPI chip select - * pins. + * 1. Provide logic in pic32mx_boardinitialize() to configure SPI/SPI chip + * select pins. * 2. Provide pic32mx_spi2select() and pic32mx_spi2status() functions - * in your board-specific logic. These functions will perform chip selection - * and status operations using GPIOs in the way your board is configured. - * 3. Add a calls to pic32mx_spibus_initialize() in your low level application - * initialization logic - * 4. The handle returned by pic32mx_spibus_initialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling + * in your board-specific logic. These functions will perform chip + * selection and status operations using GPIOs in the way your board is + * configured. + * 3. Add a calls to pic32mx_spibus_initialize() in your low level + * application initialization logic + * 4. The handle returned by pic32mx_spibus_initialize() may then be used + * to bind the SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_PIC32MX_SPI2 -void pic32mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", + (int)devid, selected ? "assert" : "de-assert"); /* The SD card chip select is pulled high and active low */ diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_usbdev.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_usbdev.c index 2214c19a941..950542ee1cf 100644 --- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_usbdev.c +++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_usbdev.c @@ -1,11 +1,12 @@ -/************************************************************************************ - * boards/mips/sure-pic32mx/src/pic32mx_usbdev.c +/**************************************************************************** + * boards/mips/pic32mx/sure-pic32mx/src/pic32mx_usbdev.c * * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: - * - Sample code and schematics provided with the Sure Electronics PIC32 board. + * - Sample code and schematics provided with the Sure Electronics + * PIC32 board. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,11 +35,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -52,15 +53,17 @@ #if defined(CONFIG_PIC32MX_USBDEV) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* The Sure DB_DP11215 PIC32 Storage Demo Board has a CP2102 PHY that is shared - * between the USB and the UART-to-USB logic. That PHY must be programmed during - * boot up for USB functionality (since the UART-to-USB is not populated). + ****************************************************************************/ + +/* The Sure DB_DP11215 PIC32 Storage Demo Board has a CP2102 PHY that is + * shared between the USB and the UART-to-USB logic. + * That PHY must be programmed during boot up for USB functionality + * (since the UART-to-USB is not populated). * * PIN NAME SIGNAL NOTES - * ---- ------------------------------- -------------- ------------------------------ + * ---- ------------------------------- -------------- ---------------------- * 11 AN5/C1IN+/Vbuson/CN7/RB5 Vbuson/AN5/RB5 To USB VBUS circuitry * 43 U1CTS/SDA1/IC2/INT2/RD9 USB_OPTEN USB PHY * 44 SCL1/IC3/PMCS2/PMA15/INT3/RD10 USB_OPT USB PHY @@ -72,21 +75,22 @@ # define GPIO_USB_OPT (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTD|GPIO_PIN10) #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbdevinitialize * * Description: - * Called to configure the mini-B PHY on the Sure PIC32MX board for the USB device + * Called to configure the mini-B PHY on the Sure PIC32MX board for the USB + * device * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mx_usbdevinitialize(void) { @@ -99,44 +103,51 @@ void weak_function pic32mx_usbdevinitialize(void) /* Notes from the Sure Electronics sample code: * - * "The USB specifications require that USB peripheral devices must never source - * current onto the Vbus pin. Additionally, USB peripherals should not source - * current on D+ or D- when the host/hub is not actively powering the Vbus line. + * "The USB specifications require that USB peripheral devices must never + * source current onto the Vbus pin. Additionally, USB peripherals should + * not source current on D+ or D- when the host/hub is not actively + * powering the Vbus line. * When designing a self powered (as opposed to bus powered) USB peripheral - * device, the firmware should make sure not to turn on the USB module and D+ - * or D- pull up resistor unless Vbus is actively powered. Therefore, the - * firmware needs some means to detect when Vbus is being powered by the host. + * device, the firmware should make sure not to turn on the USB module and + * D+ or D- pull up resistor unless Vbus is actively powered. Therefore, + * the firmware needs some means to detect when Vbus is being powered by + * the host. * A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and * can be used to detect when Vbus is high (host actively powering), or low * (host is shut down or otherwise not supplying power). The USB firmware - * can then periodically poll this I/O pin to know when it is okay to turn on - * the USB module/D+/D- pull up resistor. When designing a purely bus powered - * peripheral device, it is not possible to source current on D+ or D- when the - * host is not actively providing power on Vbus. Therefore, implementing this - * bus sense feature is optional. ..." + * can then periodically poll this I/O pin to know when it is okay to turn + * on the USB module/D+/D- pull up resistor. When designing a purely bus + * powered peripheral device, it is not possible to source current on D+ or + * D- when the host is not actively providing power on Vbus. Therefore, + * implementing this bus sense feature is optional. ..." */ #ifdef CONFIG_USBHOST - //pic32mx_configgpio(GPIO_USB_VBUSON); + + /* pic32mx_configgpio(GPIO_USB_VBUSON); */ + #endif - /* "If the host PC sends a GetStatus (device) request, the firmware must respond - * and let the host know if the USB peripheral device is currently bus powered - * or self powered. See chapter 9 in the official USB specifications for details - * regarding this request. If the peripheral device is capable of being both - * self and bus powered, it should not return a hard coded value for this request. - * Instead, firmware should check if it is currently self or bus powered, and - * respond accordingly. If the hardware has been configured like demonstrated - * on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the - * currently selected power source. ..." + /* "If the host PC sends a GetStatus (device) request, the firmware must + * respond and let the host know if the USB peripheral device is currently + * bus powered or self powered. + * See chapter 9 in the official USB specifications for details regarding + * this request. If the peripheral device is capable of being both self + * and bus powered, it should not return a hard coded value for this + * request. Instead, firmware should check if it is currently self or bus + * powered, and respond accordingly. If the hardware has been configured + * like demonstrated on the PICDEM FS USB Demo Board, an I/O pin can be + * polled to determine the currently selected power source. ..." */ #ifdef CONFIG_USB_PWRSENSE - //pic32mx_configgpio(GPIO_USB_PWRSENSE); + + /* pic32mx_configgpio(GPIO_USB_PWRSENSE); */ + #endif } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbpullup * * Description: @@ -146,7 +157,7 @@ void weak_function pic32mx_usbdevinitialize(void) * of this method. Alternatively, if no pull-up GPIO the following EXTERN * can be redefined to be NULL. * - ************************************************************************************/ + ****************************************************************************/ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) { @@ -155,7 +166,7 @@ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbsuspend * * Description: @@ -164,7 +175,7 @@ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) * suspend mode. This is an opportunity for the board logic to shutdown * clocks, power, etc. while the USB is suspended. * - ************************************************************************************/ + ****************************************************************************/ void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume) { diff --git a/boards/mips/pic32mx/sure-pic32mx/src/sure-pic32mx.h b/boards/mips/pic32mx/sure-pic32mx/src/sure-pic32mx.h index e681c04cc2a..ba64f19d01f 100644 --- a/boards/mips/pic32mx/sure-pic32mx/src/sure-pic32mx.h +++ b/boards/mips/pic32mx/sure-pic32mx/src/sure-pic32mx.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/sure-pic32mx/src/sure-pic32mx.h + * boards/mips/pic32mx/sure-pic32mx/src/sure-pic32mx.h * * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_SURE_PIC32MX_SRC_SURE_PIC32MXL_H -#define __BOARDS_MIPS_SURE_PIC32MX_SRC_SURE_PIC32MXL_H +#ifndef __BOARDS_MIPS_PIC32MX_SURE_PIC32MX_SRC_SURE_PIC32MXL_H +#define __BOARDS_MIPS_PIC32MX_SURE_PIC32MX_SRC_SURE_PIC32MXL_H /**************************************************************************** * Included Files @@ -45,9 +45,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* GPIO Pin Configurations **************************************************/ + /* The Sure PIC32MX board has five LEDs. One (D4, lablel "Power") is not * controllable by software. Four are controllable by software: * @@ -63,7 +65,7 @@ #define GPIO_FLASH_LED (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTF | GPIO_PIN0) #define GPIO_ERROR_LED (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTF | GPIO_PIN1) - /* LCD pin mapping (see boards/sure-pic32mx/README.txt) +/* LCD pin mapping (see boards/sure-pic32mx/README.txt) * * --------------------- ---------- ---------------------------------- * PIC32 Sure JP1 Sure Signal Description @@ -123,42 +125,45 @@ #ifdef __cplusplus #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spidev_initialize * * Description: - * Called to configure SPI chip select GPIO pins for the Sure PIC32MX Logic board. + * Called to configure SPI chip select GPIO pins for the + * Sure PIC32MX Logic board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_PIC32MX_SPI2) void weak_function pic32mx_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbdevinitialize * * Description: - * Called to configure the mini-B PHY on the Sure PIC32MX board for the USB device + * Called to configure the mini-B PHY on the Sure PIC32MX board for the USB + * device * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_PIC32MX_USBDEV) void weak_function pic32mx_usbdevinitialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void pic32mx_led_initialize(void); @@ -170,4 +175,4 @@ void pic32mx_led_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_SURE_PIC32MX_SRC_SURE_PIC32MXL_H */ +#endif /* __BOARDS_MIPS_PIC32MX_SURE_PIC32MX_SRC_SURE_PIC32MXL_H */ diff --git a/boards/mips/pic32mx/ubw32/README.txt b/boards/mips/pic32mx/ubw32/README.txt index b5679e1fbf7..afcfc0c9422 100644 --- a/boards/mips/pic32mx/ubw32/README.txt +++ b/boards/mips/pic32mx/ubw32/README.txt @@ -1,4 +1,4 @@ -boards/ubw32 README +boards/mips/pic32mx/ubw32 README ==================== This README file discusses the port of NuttX to the Sparkfun UBW32 board. diff --git a/boards/mips/pic32mx/ubw32/include/board.h b/boards/mips/pic32mx/ubw32/include/board.h index c4392168776..bc7736cdd18 100644 --- a/boards/mips/pic32mx/ubw32/include/board.h +++ b/boards/mips/pic32mx/ubw32/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/ubw32/include/board.h + * boards/mips/pic32mx/ubw32/include/board.h * include/arch/board/board.h * * Copyright (C) 2012 Gregory Nutt. All rights reserved. @@ -34,8 +34,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_UBW32_INCLUDE_BOARD_H -#define __BOARDS_MIPS_UBW32_INCLUDE_BOARD_H +#ifndef __BOARDS_MIPS_PIC32MX_UBW32_INCLUDE_BOARD_H +#define __BOARDS_MIPS_PIC32MX_UBW32_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -46,9 +46,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Crystal frequencies */ #define BOARD_POSC_FREQ 8000000 /* Primary OSC XTAL frequency (8MHz) */ @@ -91,6 +93,7 @@ #define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */ /* LED definitions **********************************************************/ + /* ----- ----- ------------------------------------------------------------- * LABEL COLOR CONTROL * ----- ----- ------------------------------------------------------------- @@ -115,7 +118,8 @@ #define PIC32MX_UBW32_LED2_BIT (1 << PIC32MX_UBW32_LED2) #define PIC32MX_UBW32_LED3_BIT (1 << PIC32MX_UBW32_LED3) -/* If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as follows: +/* If CONFIG_ARCH_LEDS is defined, + * then NuttX will control these LEDs as follows: * * ON OFF * ------------------------- ---- ---- ---- ---- ---- ---- @@ -184,4 +188,4 @@ extern "C" #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_UBW32_INCLUDE_BOARD_H */ +#endif /* __BOARDS_MIPS_PIC32MX_UBW32_INCLUDE_BOARD_H */ diff --git a/boards/mips/pic32mx/ubw32/scripts/Make.defs b/boards/mips/pic32mx/ubw32/scripts/Make.defs index 09575ac6725..7907dc0201d 100644 --- a/boards/mips/pic32mx/ubw32/scripts/Make.defs +++ b/boards/mips/pic32mx/ubw32/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/mips/ubw32/scripts/Make.defs +# boards/mips/pic32mx/ubw32/scripts/Make.defs # # Copyright (C) 2012, 2017-2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mx/ubw32/scripts/c32-release.ld b/boards/mips/pic32mx/ubw32/scripts/c32-release.ld index 002d6568b30..6551ff54951 100644 --- a/boards/mips/pic32mx/ubw32/scripts/c32-release.ld +++ b/boards/mips/pic32mx/ubw32/scripts/c32-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/ubw32/scripts/c32-release.ld + * boards/mips/pic32mx/ubw32/scripts/c32-release.ld * * Copyright (C) 2012-2013, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -9,14 +9,14 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. + * used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/ubw32/scripts/mips-release.ld b/boards/mips/pic32mx/ubw32/scripts/mips-release.ld index 71893685897..ef18a0222b5 100644 --- a/boards/mips/pic32mx/ubw32/scripts/mips-release.ld +++ b/boards/mips/pic32mx/ubw32/scripts/mips-release.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/ubw32/scripts/mips-release.ld + * boards/mips/pic32mx/ubw32/scripts/mips-release.ld * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -9,14 +9,14 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. + * used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mx/ubw32/src/Makefile b/boards/mips/pic32mx/ubw32/src/Makefile index 12ffe280f63..db5d78527ff 100644 --- a/boards/mips/pic32mx/ubw32/src/Makefile +++ b/boards/mips/pic32mx/ubw32/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/ubw32/src/Makefile +# boards/mips/pic32mx/ubw32/src/Makefile # # Copyright (C) 2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mx/ubw32/src/pic32_boot.c b/boards/mips/pic32mx/ubw32/src/pic32_boot.c index e620a34ad24..061fe2b05f1 100644 --- a/boards/mips/pic32mx/ubw32/src/pic32_boot.c +++ b/boards/mips/pic32mx/ubw32/src/pic32_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/ubw32/src/pic32_boot.c +/**************************************************************************** + * boards/mips/pic32mx/ubw32/src/pic32_boot.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,32 +49,32 @@ #include "pic32mx.h" #include "ubw32.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_boardinitialize * * Description: - * All PIC32MX architectures must provide the following entry point. This entry - * point is called early in the intitialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All PIC32MX architectures must provide the following entry point. This + * entry point is called early in the intitialization - after all memory has + * been configured and mapped but before any devices have been initialized. * - ************************************************************************************/ + ****************************************************************************/ void pic32mx_boardinitialize(void) { - /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak - * function pic32mx_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the + * weak function pic32mx_spidev_initialize() has been brought into the link. */ #if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) diff --git a/boards/mips/pic32mx/ubw32/src/pic32_buttons.c b/boards/mips/pic32mx/ubw32/src/pic32_buttons.c index 3f6e3939765..845c119faba 100644 --- a/boards/mips/pic32mx/ubw32/src/pic32_buttons.c +++ b/boards/mips/pic32mx/ubw32/src/pic32_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/ubw32/src/pic32_buttons.c + * boards/mips/pic32mx/ubw32/src/pic32_buttons.c * * Copyright (C) 2012, 2014-2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -58,6 +58,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* The UBW32 board has three buttons. * * PROGRAM RE7 Pulled high, Grounded/low when depressed @@ -109,10 +110,10 @@ static const uint8_t g_buttoncn[NUM_BUTTONS] = * 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. + * 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. * ****************************************************************************/ @@ -150,34 +151,35 @@ uint32_t board_buttons(void) 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. + * 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. + * 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. + * 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. * - * Interrupts are automatically enabled when the button handler is attached and - * automatically disabled when the button handler is detached. + * Interrupts are automatically enabled when the button handler is attached + * and automatically disabled when the button handler is detached. * * When an interrupt occurs, it is due to a change on the GPIO input pin * associated with the button. In that case, all attached change * notification handlers will be called. Each handler must maintain state * and determine if the unlying GPIO button input value changed. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) @@ -187,7 +189,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) if (id < NUM_BUTTONS) { pic32mx_gpioirqdisable(g_buttoncn[id]); - ret = pic32mx_gpioattach(g_buttonset[id], g_buttoncn[id], irqhandler, arg); + ret = pic32mx_gpioattach(g_buttonset[id], g_buttoncn[id], + irqhandler, arg); if (ret >= 0) { pic32mx_gpioirqenable(g_buttoncn[id]); diff --git a/boards/mips/pic32mx/ubw32/src/pic32_leds.c b/boards/mips/pic32mx/ubw32/src/pic32_leds.c index f9a0a77f0ff..9d0819ae3e9 100644 --- a/boards/mips/pic32mx/ubw32/src/pic32_leds.c +++ b/boards/mips/pic32mx/ubw32/src/pic32_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/ubw32/src/pic32_leds.c + * boards/mips/pic32mx/ubw32/src/pic32_leds.c * * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -56,7 +56,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* LED Configuration ********************************************************/ + /* ----- ----- ------------------------------------------------------------- * LABEL COLOR CONTROL * ----- ----- ------------------------------------------------------------- @@ -67,7 +69,8 @@ * LED3 Yellow RE0, Pulled up. Low value illuminates * PWR Blue Illuminated when 5V is present, not controlled by software * - * If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as follows: + * If CONFIG_ARCH_LEDS is defined, + * then NuttX will control these LEDs as follows: * * ON OFF * ------------------------- ---- ---- ---- ---- ---- ---- @@ -112,6 +115,7 @@ struct led_setting_s /**************************************************************************** * Private Data ****************************************************************************/ + /* If CONFIG_ARCH_LEDS is defined then NuttX will control the LEDs. The * following structures identified the LED settings for each NuttX LED state. */ diff --git a/boards/mips/pic32mx/ubw32/src/pic32_usbdev.c b/boards/mips/pic32mx/ubw32/src/pic32_usbdev.c index 487cfdde988..027e7d9f6ca 100644 --- a/boards/mips/pic32mx/ubw32/src/pic32_usbdev.c +++ b/boards/mips/pic32mx/ubw32/src/pic32_usbdev.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/ubw32/src/pic32_usbdev.c +/**************************************************************************** + * boards/mips/pic32mx/ubw32/src/pic32_usbdev.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,59 +49,64 @@ #if defined(CONFIG_PIC32MX_USBDEV) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbdevinitialize * * Description: * Called to configure the mini-A/B J5 on the UBW32 for the * USB device * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mx_usbdevinitialize(void) { /* Notes from the Sure Electronics sample code: * - * "The USB specifications require that USB peripheral devices must never source - * current onto the Vbus pin. Additionally, USB peripherals should not source - * current on D+ or D- when the host/hub is not actively powering the Vbus line. + * "The USB specifications require that USB peripheral devices must never + * source current onto the Vbus pin. Additionally, USB peripherals should + * not source current on D+ or D- when the host/hub is not actively + * powering the Vbus line. * When designing a self powered (as opposed to bus powered) USB peripheral - * device, the firmware should make sure not to turn on the USB module and D+ - * or D- pull up resistor unless Vbus is actively powered. Therefore, the - * firmware needs some means to detect when Vbus is being powered by the host. + * device, the firmware should make sure not to turn on the USB module and + * D+ or D- pull up resistor unless Vbus is actively powered. Therefore, + * the firmware needs some means to detect when Vbus is being powered by + * the host. * A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and * can be used to detect when Vbus is high (host actively powering), or low * (host is shut down or otherwise not supplying power). The USB firmware - * can then periodically poll this I/O pin to know when it is okay to turn on - * the USB module/D+/D- pull up resistor. When designing a purely bus powered - * peripheral device, it is not possible to source current on D+ or D- when the - * host is not actively providing power on Vbus. Therefore, implementing this - * bus sense feature is optional. ..." + * can then periodically poll this I/O pin to know when it is okay to turn + * on the USB module/D+/D- pull up resistor. When designing a purely bus + * powered peripheral device, it is not possible to source current on D+ or + * D- when the host is not actively providing power on Vbus. + * Therefore, implementing this bus sense feature is optional. ..." */ #ifdef CONFIG_USBHOST #endif - /* "If the host PC sends a GetStatus (device) request, the firmware must respond - * and let the host know if the USB peripheral device is currently bus powered - * or self powered. See chapter 9 in the official USB specifications for details - * regarding this request. If the peripheral device is capable of being both - * self and bus powered, it should not return a hard coded value for this request. - * Instead, firmware should check if it is currently self or bus powered, and - * respond accordingly. If the hardware has been configured like demonstrated - * on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the + /* "If the host PC sends a GetStatus (device) request, the firmware must + * respond and let the host know if the USB peripheral device is currently + * bus powered or self powered. + * See chapter 9 in the official USB specifications for details + * regarding this request. + * If the peripheral device is capable of being both self and bus powered, + * it should not return a hard coded value for this request. + * Instead, firmware should check if it is currently self or bus powered, + * and respond accordingly. + * If the hardware has been configured like demonstrated on the PICDEM FS + * USB Demo Board, an I/O pin can be polled to determine the * currently selected power source. ..." */ @@ -109,7 +114,7 @@ void weak_function pic32mx_usbdevinitialize(void) #endif } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbpullup * * Description: @@ -119,7 +124,7 @@ void weak_function pic32mx_usbdevinitialize(void) * of this method. Alternatively, if no pull-up GPIO the following EXTERN * can be redefined to be NULL. * - ************************************************************************************/ + ****************************************************************************/ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) { @@ -128,7 +133,7 @@ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_usbsuspend * * Description: @@ -137,7 +142,7 @@ int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable) * suspend mode. This is an opportunity for the board logic to shutdown * clocks, power, etc. while the USB is suspended. * - ************************************************************************************/ + ****************************************************************************/ void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume) { diff --git a/boards/mips/pic32mx/ubw32/src/ubw32.h b/boards/mips/pic32mx/ubw32/src/ubw32.h index 2e2f99eb396..b65b151d19c 100644 --- a/boards/mips/pic32mx/ubw32/src/ubw32.h +++ b/boards/mips/pic32mx/ubw32/src/ubw32.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/ubw32/src/ubw32.h + * boards/mips/pic32mx/ubw32/src/ubw32.h * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_UBW32_SRC_UBW32_H -#define __BOARDS_MIPS_UBW32_SRC_UBW32_H +#ifndef __BOARDS_MIPS_PIC32MX_UBW32_SRC_UBW32_H +#define __BOARDS_MIPS_PIC32MX_UBW32_SRC_UBW32_H /**************************************************************************** * Included Files @@ -45,6 +45,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /**************************************************************************** @@ -69,25 +70,25 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the UBW32 board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) void weak_function pic32mx_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void pic32mx_led_initialize(void); @@ -99,4 +100,4 @@ void pic32mx_led_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_UBW32_SRC_UBW32_H */ +#endif /* __BOARDS_MIPS_PIC32MX_UBW32_SRC_UBW32_H */ diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/README.txt b/boards/mips/pic32mz/flipnclick-pic32mz/README.txt index 0033c544b5e..fb895940b2f 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/README.txt +++ b/boards/mips/pic32mz/flipnclick-pic32mz/README.txt @@ -1,4 +1,4 @@ -boards/flipnclick-pic32mz README +boards/mips/pic32mz/flipnclick-pic32mz README =============================== This README file discusses the port of NuttX to the Mikroe Flip&Click diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/include/board.h b/boards/mips/pic32mz/flipnclick-pic32mz/include/board.h index fa1b8c3eebe..4bfe1a2c610 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/include/board.h +++ b/boards/mips/pic32mz/flipnclick-pic32mz/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/flipnclick-pic32mz/include/board.h + * boards/mips/pic32mz/flipnclick-pic32mz/include/board.h * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_FLIPNCLICK_PIC32MZ_INCLUDE_BOARD_H -#define __BOARDS_MIPS_FLIPNCLICK_PIC32MZ_INCLUDE_BOARD_H +#ifndef __BOARDS_MIPS_PIC32MZ_FLIPNCLICK_PIC32MZ_INCLUDE_BOARD_H +#define __BOARDS_MIPS_PIC32MZ_FLIPNCLICK_PIC32MZ_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -49,7 +49,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Clocking *****************************************************************/ + /* REVISIT: The PIC32MZ2048EFH100 is capable of operating at 252MHz */ /* Crystal frequencies @@ -89,6 +91,7 @@ #define BOARD_CPU_CLOCK 200000000 /* CPU clock: 200MHz = (24MHz / 3) * 50 / 2) */ /* Peripheral clocks */ + /* PBCLK1 * Peripherals: OSC2 pin * @@ -173,6 +176,7 @@ #define BOARD_EMAC_MIIM_DIV 40 /* Ideal: 100MHz/40 = 2.5MHz */ /* LED definitions **********************************************************/ + /* There are four LEDs on the top, red side of the board. Only one can be * controlled by software: * @@ -189,6 +193,7 @@ */ #ifdef CONFIG_ARCH_LEDS + /* LED index values for use with board_userled(): */ # define BOARD_LED_A 0 @@ -204,6 +209,7 @@ # define BOARD_LED_C_BIT (1 << BOARD_LED_C) # define BOARD_LED_D_BIT (1 << BOARD_LED_D) #else + /* LED index values for use with board_userled(): */ # define BOARD_LED_L 0 @@ -223,13 +229,15 @@ #endif /* These LEDs are available to the application and are all available to the - * application unless CONFIG_ARCH_LEDS is defined. In that case, the usage by the - * board port is defined in include/board.h and src/sam_autoleds.c. The LEDs are - * used to encode OS-related events as follows: + * application unless CONFIG_ARCH_LEDS is defined. In that case, the usage + * by the board port is defined in include/board.h and src/sam_autoleds.c. + * The LEDs are used to encode OS-related events as follows: * * SYMBOL MEANING LED STATE * L A B C D - * ---------------- ----------------------- --- --- --- --- ---*/ + * ---------------- ----------------------- --- --- --- --- --- + */ + #define LED_STARTED 0 /* NuttX has been started OFF ON OFF OFF OFF */ #define LED_HEAPALLOCATE 1 /* Heap has been allocated OFF OFF ON OFF OFF */ #define LED_IRQSENABLED 2 /* Interrupts enabled OFF OFF OFF ON OFF */ @@ -240,19 +248,22 @@ #define LED_PANIC 4 /* The system has crashed 2Hz N/C N/C N/C N/C */ #undef LED_IDLE /* MCU is is sleep mode ---- Not used ----- */ -/* Thus if LED L is faintly glowing and all other LEDs are off (except LED D which - * was left on but is no longer controlled by NuttX and so may be in any state), - * NuttX has successfully booted and is, apparently, running normally and taking - * interrupts. If any of LEDs A-D are statically set, then NuttX failed to boot - * and the LED indicates the initialization phase where the failure occurred. If - * LED L is flashing at approximately 2Hz, then a fatal error has been detected and - * the system has halted. +/* Thus if LED L is faintly glowing and all other LEDs are off (except LED D + * which was left on but is no longer controlled by NuttX and so may be + * in any state), + * NuttX has successfully booted and is, apparently, running normally and + * taking interrupts. + * If any of LEDs A-D are statically set, then NuttX failed to boot + * and the LED indicates the initialization phase where the failure occurred. + * If LED L is flashing at approximately 2Hz, then a fatal error has been + * detected and the system has halted. * * NOTE: After booting, LEDs A-D are no longer used by the system and may be * controlled the application. */ /* Switch definitions *******************************************************/ + /* The Flip&Click PIC32MZ has 2 user push buttons labeled T1 and T2 on the * white side of the board: * @@ -273,6 +284,7 @@ #define BUTTON_T2_BIT (1 << BUTTON_T2) /* UARTS ********************************************************************/ + /* Convenient U[S]ARTs that may be used as the Serial console include: * * 1) An Arduino Serial Shield. The RX and TX pins are available on the @@ -304,6 +316,7 @@ #define BOARD_U5TX_PPS U5TX_RPD15R /* SPI **********************************************************************/ + /* SPI3 is available on pins D10-D13 of the Arduino Shield connectors where * you would expect then. The SPI connector is configured as follows: * @@ -377,4 +390,4 @@ extern "C" #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_FLIPNCLICK_PIC32MZ_INCLUDE_BOARD_H */ +#endif /* __BOARDS_MIPS_PIC32MZ_FLIPNCLICK_PIC32MZ_INCLUDE_BOARD_H */ diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs index ceadc87c669..dbbcf1732bb 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs +++ b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/flipnclick-pic32mz/scripts/Make.defs +# boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs # # Copyright (C) 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/c32-debug.ld b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/c32-debug.ld index 6805c0228d0..6f54c9b4939 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/c32-debug.ld +++ b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/c32-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/flipnclick-pic32mz/nsh/c32-debug.ld + * boards/mips/pic32mz/flipnclick-pic32mz/nsh/c32-debug.ld * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/mips-debug.ld b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/mips-debug.ld index bd41e6c3f6c..9e24b584fbb 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/mips-debug.ld +++ b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/mips-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/flipnclick-pic32mz/nsh/mips-debug.ld + * boards/mips/pic32mz/flipnclick-pic32mz/nsh/mips-debug.ld * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/pinguino-debug.ld b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/pinguino-debug.ld index 1f04ea0946e..249663a1464 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/pinguino-debug.ld +++ b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/pinguino-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/flipnclick-pic32mz/nsh/mips-debug.ld + * boards/mips/pic32mz/flipnclick-pic32mz/nsh/mips-debug.ld * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/xc32-debug.ld b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/xc32-debug.ld index a62dbe37bd7..28f55b67ba4 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/xc32-debug.ld +++ b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/xc32-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/flipnclick-pic32mz/nsh/mips-debug.ld + * boards/mips/pic32mz/flipnclick-pic32mz/nsh/mips-debug.ld * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/Makefile b/boards/mips/pic32mz/flipnclick-pic32mz/src/Makefile index 9adbdf9a5d3..f6b8de72451 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/Makefile +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/flipnclick-pic32mz/src/Makefile +# boards/mips/pic32mz/flipnclick-pic32mz/src/Makefile # # Copyright (C) 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/flipnclick-pic32mz.h b/boards/mips/pic32mz/flipnclick-pic32mz/src/flipnclick-pic32mz.h index 994ec07e69b..c5c8c64085b 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/flipnclick-pic32mz.h +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/flipnclick-pic32mz.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/flipnclick-pic32mz/src/flipnclick-pic32mz.h + * boards/mips/pic32mz/flipnclick-pic32mz/src/flipnclick-pic32mz.h * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_FLIPNCLICK_PIC32MZ_SRC_FLIPNCLICK_PIC32MZ_H -#define __BOARDS_MIPS_FLIPNCLICK_PIC32MZ_SRC_FLIPNCLICK_PIC32MZ_H +#ifndef __BOARDS_MIPS_PIC32MZ_FLIPNCLICK_PIC32MZ_SRC_FLIPNCLICK_PIC32MZ_H +#define __BOARDS_MIPS_PIC32MZ_FLIPNCLICK_PIC32MZ_SRC_FLIPNCLICK_PIC32MZ_H /**************************************************************************** * Included Files @@ -46,6 +46,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #define HAVE_SSD1306 1 @@ -65,6 +66,7 @@ #endif /* LEDs *********************************************************************/ + /* There are four LEDs on the top, red side of the board. Only one can be * controlled by software: * @@ -236,25 +238,25 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the PCB Logic board. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_PIC32MZ_SPI void weak_function pic32mz_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void pic32mz_led_initialize(void); @@ -291,4 +293,4 @@ FAR struct lcd_dev_s *pic32mz_graphics_setup(unsigned int devno); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_FLIPNCLICK_PIC32MZ_SRC_FLIPNCLICK_PIC32MZ_H */ +#endif /* __BOARDS_MIPS_PIC32MZ_FLIPNCLICK_PIC32MZ_SRC_FLIPNCLICK_PIC32MZ_H */ diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_appinit.c b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_appinit.c index e0e25e002e5..f93352e77a1 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_appinit.c +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/flipnclick-pic32mz/src/pic32mz_appinit.c + * boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_appinit.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_autoleds.c b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_autoleds.c index eb44e72d485..4a96f39e3e0 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_autoleds.c +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/flipnclick-pic32mz/src/pic32mz_leds.c + * boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_leds.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_boot.c b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_boot.c index 657e79bbe23..349754f7244 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_boot.c +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/flipnclick-pic32mz/src/pic32mz_boot.c +/**************************************************************************** + * boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_boot.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -46,24 +46,26 @@ #include "flipnclick-pic32mz.h" -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_boardinitialize * * Description: - * All PIC32MZ architectures must provide the following entry point. This entry - * point is called early in the initialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All PIC32MZ architectures must provide the following entry point. + * This entry point is called early in the initialization -- after all memory + * has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void pic32mz_boardinitialize(void) { - /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak - * function pic32mz_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) + * the weak function pic32mz_spidev_initialize() has been brought into the + * link. */ #ifdef CONFIG_PIC32MZ_SPI diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_bringup.c b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_bringup.c index c24c4cc9ea0..0389e9bb9f2 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_bringup.c +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/flipnclick-pic32mz/src/pic32mz_bringup.c + * boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_bringup.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -67,7 +67,7 @@ int pic32mz_bringup(void) ret = mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { - syslog(LOG_ERR,"ERROR: Failed to mount procfs at /proc: %d\n", + syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); } #endif @@ -77,7 +77,7 @@ int pic32mz_bringup(void) if (pic32mz_graphics_setup(0) == NULL) { - syslog(LOG_ERR,"ERROR: Failed to configure the SSD1306 OLED\n"); + syslog(LOG_ERR, "ERROR: Failed to configure the SSD1306 OLED\n"); } #endif diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_buttons.c b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_buttons.c index ff87c37456b..45c27406ef1 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_buttons.c +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/flipnclick-pic32mz/src/pic32mz_buttons.c + * boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_buttons.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -106,16 +106,16 @@ uint32_t board_buttons(void) for (i = 0; i < NUM_BUTTONS; i++) { - /* A LOW value means that the key is pressed. */ + /* A LOW value means that the key is pressed. */ - bool released = pic32mz_gpioread(g_buttons[i]); + bool released = pic32mz_gpioread(g_buttons[i]); - /* Accumulate the set of depressed (not released) keys */ + /* Accumulate the set of depressed (not released) keys */ - if (!released) - { + if (!released) + { ret |= (1 << i); - } + } } return ret; diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_spi.c b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_spi.c index 3340261ddfb..cd84d421de1 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_spi.c +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/flipnclick-pic32mz/src/pic32mz_spi.c +/**************************************************************************** + * boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_spi.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -54,17 +54,17 @@ #ifdef CONFIG_PIC32MZ_SPI -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the Sure PIC32MZ board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mz_spidev_initialize(void) { @@ -76,40 +76,45 @@ void weak_function pic32mz_spidev_initialize(void) #endif } -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_spiNselect, pic32mz_spiNstatus, and pic32mz_spiNcmddata * * Description: - * These external functions must be provided by board-specific logic. They are - * implementations of the select, status, and cmddata methods of the SPI interface - * defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All other methods - * including pic32mz_spibus_initialize()) are provided by common PIC32MZ logic. To use - * this common SPI logic on your board: + * These external functions must be provided by board-specific logic. + * They are implementations of the select, status, and cmddata methods of + * the SPI interface defined by struct spi_ops_s + * (see include/nuttx/spi/spi.h). + * All other methods including pic32mz_spibus_initialize()) are provided by + * common PIC32MZ logic. + * To use this common SPI logic on your board: * - * 1. Provide logic in pic32mz_boardinitialize() to configure SPI/SPI chip select - * pins. + * 1. Provide logic in pic32mz_boardinitialize() to configure SPI/SPI chip + * select pins. * 2. Provide pic32mz_spiNselect() and pic32mz_spiNstatus() functions - * in your board-specific logic. These functions will perform chip selection - * and status operations using GPIOs in the way your board is configured. + * in your board-specific logic. These functions will perform chip + * selection and status operations using GPIOs in the way your board is + * configured. * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide * pic32mz_spiNcmddata() functions in your board-specific logic. These - * functions will perform cmd/data selection operations using GPIOs in the way - * your board is configured. - * 3. Add a call to pic32mz_spibus_initialize() in your low level application - * initialization logic - * 4. The handle returned by pic32mz_spibus_initialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling + * functions will perform cmd/data selection operations using GPIOs in + * the way your board is configured. + * 3. Add a call to pic32mz_spibus_initialize() in your low level + * application initialization logic + * 4. The handle returned by pic32mz_spibus_initialize() may then be used to + * bind the SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). * - ************************************************************************************/ + ****************************************************************************/ struct spi_dev_s; #ifdef CONFIG_PIC32MZ_SPI1 -void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBC) || \ defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBD) @@ -150,9 +155,11 @@ int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif /* CONFIG_PIC32MZ_SPI1 */ #ifdef CONFIG_PIC32MZ_SPI2 -void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #if defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBA) || \ defined(CONFIG_FLIPNCLICK_PIC32MZ_SSD1306_MBB) @@ -193,9 +200,11 @@ int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif /* CONFIG_PIC32MZ_SPI2 */ #ifdef CONFIG_PIC32MZ_SPI3 -void pic32mz_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); } uint8_t pic32mz_spi3status(FAR struct spi_dev_s *dev, uint32_t devid) @@ -212,9 +221,11 @@ int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif /* CONFIG_PIC32MZ_SPI3 */ #ifdef CONFIG_PIC32MZ_SPI4 -void pic32mz_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); } uint8_t pic32mz_spi4status(FAR struct spi_dev_s *dev, uint32_t devid) @@ -231,9 +242,11 @@ int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif /* CONFIG_PIC32MZ_SPI4 */ #ifdef CONFIG_PIC32MZ_SPI5 -void pic32mz_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); } uint8_t pic32mz_spi5status(FAR struct spi_dev_s *dev, uint32_t devid) @@ -252,9 +265,11 @@ int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif /* CONFIG_PIC32MZ_SPI5 */ #ifdef CONFIG_PIC32MZ_SPI6 -void pic32mz_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -295,8 +310,8 @@ int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #ifdef CONFIG_SPI_CALLBACK #ifdef CONFIG_PIC32MZ_SPI1 -int pic32mz_spi1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, - FAR void *arg) +int pic32mz_spi1register(FAR struct spi_dev_s *dev, + spi_mediachange_t callback, FAR void *arg) { #warning Missing logic return -ENOSYS; @@ -304,8 +319,8 @@ int pic32mz_spi1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #endif /* CONFIG_PIC32MZ_SPI1 */ #ifdef CONFIG_PIC32MZ_SPI2 -int pic32mz_spi2register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, - FAR void *arg) +int pic32mz_spi2register(FAR struct spi_dev_s *dev, + spi_mediachange_t callback, FAR void *arg) { #warning Missing logic return -ENOSYS; @@ -313,8 +328,8 @@ int pic32mz_spi2register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #endif /* CONFIG_PIC32MZ_SPI2 */ #ifdef CONFIG_PIC32MZ_SPI3 -int pic32mz_spi3register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, - FAR void *arg) +int pic32mz_spi3register(FAR struct spi_dev_s *dev, + spi_mediachange_t callback, FAR void *arg) { #warning Missing logic return -ENOSYS; @@ -322,8 +337,8 @@ int pic32mz_spi3register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #endif /* CONFIG_PIC32MZ_SPI3 */ #ifdef CONFIG_PIC32MZ_SPI4 -int pic32mz_spi4register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, - FAR void *arg) +int pic32mz_spi4register(FAR struct spi_dev_s *dev, + spi_mediachange_t callback, FAR void *arg) { #warning Missing logic return -ENOSYS; @@ -331,8 +346,8 @@ int pic32mz_spi4register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #endif /* CONFIG_PIC32MZ_SPI4 */ #ifdef CONFIG_PIC32MZ_SPI5 -int pic32mz_spi5register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, - FAR void *arg) +int pic32mz_spi5register(FAR struct spi_dev_s *dev, + spi_mediachange_t callback, FAR void *arg) { #warning Missing logic return -ENOSYS; @@ -340,8 +355,8 @@ int pic32mz_spi5register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, #endif /* CONFIG_PIC32MZ_SPI5 */ #ifdef CONFIG_PIC32MZ_SPI6 -int pic32mz_spi6register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, - FAR void *arg) +int pic32mz_spi6register(FAR struct spi_dev_s *dev, + spi_mediachange_t callback, FAR void *arg) { #warning Missing logic return -ENOSYS; diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_ssd1306.c b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_ssd1306.c index 47e4b29b6f4..fa7e2fd6679 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_ssd1306.c +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_ssd1306.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/flipnclick-pic32mz/src/pic32mz_ssd1306.c + * boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_ssd1306.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -77,6 +77,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_SPI_CMDDATA diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_userleds.c b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_userleds.c index b16a8ddbd42..0bebb3e68fe 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_userleds.c +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/flipnclick-pic32mz/src/pic32mz_userleds.c + * boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_userleds.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* There are four LEDs on the top, red side of the board. Only one can be * controlled by software: * diff --git a/boards/mips/pic32mz/pic32mz-starterkit/include/board.h b/boards/mips/pic32mz/pic32mz-starterkit/include/board.h index d9397e215d0..5eb342600fd 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/include/board.h +++ b/boards/mips/pic32mz/pic32mz-starterkit/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mz-starterkit/include/board.h + * boards/mips/pic32mz/pic32mz-starterkit/include/board.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_PIC32MZ_STARTERKIT_INCLUDE_BOARD_H -#define __BOARDS_MIPS_PIC32MZ_STARTERKIT_INCLUDE_BOARD_H +#ifndef __BOARDS_MIPS_PIC32MZ_PIC32MZ_STARTERKIT_INCLUDE_BOARD_H +#define __BOARDS_MIPS_PIC32MZ_PIC32MZ_STARTERKIT_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -49,9 +49,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /* Clocking *****************************************************************/ + /* Crystal frequencies * * - A 24 MHz oscillator circuit (Y4) is connected to the on-board @@ -89,6 +91,7 @@ #define BOARD_CPU_CLOCK 200000000 /* CPU clock: 200MHz = (24MHz / 3) * 50 / 2) */ /* Peripheral clocks */ + /* PBCLK1 * Peripherals: OSC2 pin * @@ -173,7 +176,9 @@ #define BOARD_EMAC_MIIM_DIV 40 /* Ideal: 100MHz/40 = 2.5MHz */ /* LED definitions **********************************************************/ + /* LED Configuration ********************************************************/ + /* The PIC32MZ Ethernet Starter kit has 3 user LEDs labelled LED1-3 on the * board: * @@ -227,6 +232,7 @@ #define LED_NVALUES 6 /* Switch definitions *******************************************************/ + /* The PIC32MZ Ethernet Starter kit has 3 user push buttons labelled SW1-3 * on the board: * @@ -251,6 +257,7 @@ #define BUTTON_SW3_BIT (1 << BUTTON_SW3) /* UARTS ********************************************************************/ + /* MEB-II * * By default, the UART1 is configured for the pins used by the MEB-II @@ -312,4 +319,4 @@ extern "C" #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_PIC32MZ_STARTERKIT_INCLUDE_BOARD_H */ +#endif /* __BOARDS_MIPS_PIC32MZ_PIC32MZ_STARTERKIT_INCLUDE_BOARD_H */ diff --git a/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs b/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs index d451dd9a3bb..a60e02c1b8c 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs +++ b/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/mips/pic32mz-starterkit/scripts/Make.defs +# boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs # # Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mz/pic32mz-starterkit/scripts/c32-debug.ld b/boards/mips/pic32mz/pic32mz-starterkit/scripts/c32-debug.ld index dcdac5b1998..b0fc8aa8b66 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/scripts/c32-debug.ld +++ b/boards/mips/pic32mz/pic32mz-starterkit/scripts/c32-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mz-starterkit/nsh/c32-debug.ld + * boards/mips/pic32mz/pic32mz-starterkit/nsh/c32-debug.ld * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mz/pic32mz-starterkit/scripts/mips-debug.ld b/boards/mips/pic32mz/pic32mz-starterkit/scripts/mips-debug.ld index 5886f23cac6..c60babc6876 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/scripts/mips-debug.ld +++ b/boards/mips/pic32mz/pic32mz-starterkit/scripts/mips-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mz-starterkit/nsh/mips-debug.ld + * boards/mips/pic32mz/pic32mz-starterkit/nsh/mips-debug.ld * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mz/pic32mz-starterkit/scripts/pinguino-debug.ld b/boards/mips/pic32mz/pic32mz-starterkit/scripts/pinguino-debug.ld index 21ecb8682a6..5d5b13df2a2 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/scripts/pinguino-debug.ld +++ b/boards/mips/pic32mz/pic32mz-starterkit/scripts/pinguino-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mz-starterkit/nsh/mips-debug.ld + * boards/mips/pic32mz/pic32mz-starterkit/nsh/mips-debug.ld * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mz/pic32mz-starterkit/scripts/xc32-debug.ld b/boards/mips/pic32mz/pic32mz-starterkit/scripts/xc32-debug.ld index d6c8e85537c..34a04b5b41f 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/scripts/xc32-debug.ld +++ b/boards/mips/pic32mz/pic32mz-starterkit/scripts/xc32-debug.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mz-starterkit/nsh/mips-debug.ld + * boards/mips/pic32mz/pic32mz-starterkit/nsh/mips-debug.ld * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -9,14 +9,14 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. + * used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* Memory Regions ***********************************************************/ MEMORY diff --git a/boards/mips/pic32mz/pic32mz-starterkit/src/Makefile b/boards/mips/pic32mz/pic32mz-starterkit/src/Makefile index a997f45ebe9..2758845dbe6 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/src/Makefile +++ b/boards/mips/pic32mz/pic32mz-starterkit/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/pic32mz-starterkit/src/Makefile +# boards/mips/pic32mz/pic32mz-starterkit/src/Makefile # # Copyright (C) 2015 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz-starterkit.h b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz-starterkit.h index b3e1f0efd84..d08b023b36a 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz-starterkit.h +++ b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz-starterkit.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mz-starterkit/src/pic32mz-starterkit.h + * boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz-starterkit.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_MIPS_PIC32MZ_STARTERKIT_SRC_PIC32MZ_STARTERKIT_H -#define __BOARDS_MIPS_PIC32MZ_STARTERKIT_SRC_PIC32MZ_STARTERKIT_H +#ifndef __BOARDS_MIPS_PIC32MZ_PIC32MZ_STARTERKIT_SRC_PIC32MZ_STARTERKIT_H +#define __BOARDS_MIPS_PIC32MZ_PIC32MZ_STARTERKIT_SRC_PIC32MZ_STARTERKIT_H /**************************************************************************** * Included Files @@ -46,7 +46,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* Assume that we have MMC/SD */ #define PIC32MZ_HAVE_MMCSD 1 @@ -78,7 +80,7 @@ #if defined(PIC32MZ_HAVE_MMCSD) && defined(CONFIG_LIB_BOARDCTL) - /* Make sure that the NSH configuration uses the correct SPI */ +/* Make sure that the NSH configuration uses the correct SPI */ # if !defined(CONFIG_NSH_MMCSDSPIPORTNO) # define CONFIG_NSH_MMCSDSPIPORTNO PIC32MZ_MMCSDSPIPORTNO @@ -88,7 +90,7 @@ # define CONFIG_NSH_MMCSDSPIPORTNO PIC32MZ_MMCSDSPIPORTNO # endif - /* Make sure that the NSH configuration uses the slot */ +/* Make sure that the NSH configuration uses the slot */ # if !defined(CONFIG_NSH_MMCSDSLOTNO) # define CONFIG_NSH_MMCSDSLOTNO 0 @@ -98,7 +100,7 @@ # define CONFIG_NSH_MMCSDSLOTNO 0 # endif - /* Make sure that the correct SPI is enabled in the configuration */ +/* Make sure that the correct SPI is enabled in the configuration */ # if PIC32MZ_MMCSDSPIPORTNO == 1 && !defined(CONFIG_PIC32MZ_SPI1) # warning "CONFIG_PIC32MZ_SPI1 is not enabled" @@ -114,7 +116,7 @@ # undef PIC32MZ_HAVE_MMCSD # endif - /* Use the minor number selected in the NSH configuration */ +/* Use the minor number selected in the NSH configuration */ # ifdef CONFIG_NSH_MMCSDMINOR # define PIC32MZ_MMCSDMINOR CONFIG_NSH_MMCSDMINOR @@ -122,6 +124,7 @@ #endif /* LEDs *********************************************************************/ + /* The PIC32 starter kit has 3 user LEDs * * PIN LED Notes @@ -178,25 +181,25 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the PCB Logic board. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_PIC32MZ_SPI void weak_function pic32mz_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void pic32mz_led_initialize(void); @@ -218,4 +221,4 @@ int pic32mz_bringup(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_MIPS_PIC32MZ_STARTERKIT_SRC_PIC32MZ_STARTERKIT_H */ +#endif /* __BOARDS_MIPS_PIC32MZ_PIC32MZ_STARTERKIT_SRC_PIC32MZ_STARTERKIT_H */ diff --git a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_appinit.c b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_appinit.c index 3d128c17e9a..3bce7f7a348 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_appinit.c +++ b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/pic32mz-starterkit/src/pic32mz_appinit.c + * boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_appinit.c * * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_autoleds.c b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_autoleds.c index 2a9158cda03..afd94cdad51 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_autoleds.c +++ b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mz-starterkit/src/pic32mz_leds.c + * boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_leds.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -57,7 +57,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* LED Configuration ********************************************************/ + /* The PIC32MZ Ethernet Starter kit has 3 user LEDs labelled LED1-3 on the * board: * @@ -106,6 +108,7 @@ struct led_setting_s /**************************************************************************** * Private Data ****************************************************************************/ + /* If CONFIG_ARCH_LEDS is defined then NuttX will control the LEDs. The * following structures identified the LED settings for each NuttX LED state. */ diff --git a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_boot.c b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_boot.c index 9accdeabe01..7af4034583a 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_boot.c +++ b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/pic32mz-starterkit/src/pic32mz_boot.c +/**************************************************************************** + * boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_boot.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -46,32 +46,34 @@ #include "pic32mz-starterkit.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_boardinitialize * * Description: - * All PIC32MZ architectures must provide the following entry point. This entry - * point is called early in the initialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All PIC32MZ architectures must provide the following entry point. + * This entry point is called early in the initialization -- after all + * memory has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void pic32mz_boardinitialize(void) { - /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak - * function pic32mz_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) + * the weak function pic32mz_spidev_initialize() has been brought into + * the link. */ #ifdef CONFIG_PIC32MZ_SPI diff --git a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_bringup.c b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_bringup.c index a84121683b8..aaadc9cd10e 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_bringup.c +++ b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/pic32mz-starterkit/src/pic32mz_bringup.c + * boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_bringup.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_buttons.c b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_buttons.c index 0235e30c21f..a2e7619d199 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_buttons.c +++ b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/mips/pic32mz-starterkit/src/pic32mz_buttons.c + * boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_buttons.c * * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -114,16 +114,16 @@ uint32_t board_buttons(void) for (i = 0; i < NUM_BUTTONS; i++) { - /* A LOW value means that the key is pressed. */ + /* A LOW value means that the key is pressed. */ - bool released = pic32mz_gpioread(g_buttons[i]); + bool released = pic32mz_gpioread(g_buttons[i]); - /* Accumulate the set of depressed (not released) keys */ + /* Accumulate the set of depressed (not released) keys */ - if (!released) - { + if (!released) + { ret |= (1 << i); - } + } } return ret; diff --git a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_spi.c b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_spi.c index 98b11c2a209..22fc336eab1 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_spi.c +++ b/boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/mips/pic32mz-starterkit/src/pic32mz_spi.c +/**************************************************************************** + * boards/mips/pic32mz/pic32mz-starterkit/src/pic32mz_spi.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -52,17 +52,17 @@ #ifdef CONFIG_PIC32MZ_SPI -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the Sure PIC32MZ board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function pic32mz_spidev_initialize(void) { @@ -71,40 +71,45 @@ void weak_function pic32mz_spidev_initialize(void) #warning "Missing logic" } -/************************************************************************************ +/**************************************************************************** * Name: pic32mz_spiNselect, pic32mz_spiNstatus, and pic32mz_spiNcmddata * * Description: - * These external functions must be provided by board-specific logic. They are - * implementations of the select, status, and cmddata methods of the SPI interface - * defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All other methods - * including pic32mz_spibus_initialize()) are provided by common PIC32MZ logic. To use - * this common SPI logic on your board: + * These external functions must be provided by board-specific logic. + * They are implementations of the select, status, and cmddata methods of + * the SPI interface defined by struct spi_ops_s + * (see include/nuttx/spi/spi.h). + * All other methods including pic32mz_spibus_initialize()) are provided + * by common PIC32MZ logic. + * To use this common SPI logic on your board: * - * 1. Provide logic in pic32mz_boardinitialize() to configure SPI/SPI chip select - * pins. + * 1. Provide logic in pic32mz_boardinitialize() to configure SPI/SPI chip + * select pins. * 2. Provide pic32mz_spiNselect() and pic32mz_spiNstatus() functions - * in your board-specific logic. These functions will perform chip selection - * and status operations using GPIOs in the way your board is configured. + * in your board-specific logic. These functions will perform chip + * selection and status operations using GPIOs in the way your board is + * configured. * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide - * pic32mz_spiNcmddata() functions in your board-specific logic. These - * functions will perform cmd/data selection operations using GPIOs in the way - * your board is configured. - * 3. Add a call to pic32mz_spibus_initialize() in your low level application - * initialization logic - * 4. The handle returned by pic32mz_spibus_initialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling + * pic32mz_spiNcmddata() functions in your board-specific logic. + * These functions will perform cmd/data selection operations using GPIOs + * in the way your board is configured. + * 3. Add a call to pic32mz_spibus_initialize() in your low level + * application initialization logic + * 4. The handle returned by pic32mz_spibus_initialize() may then be used + * to bind the SPI driver to higher level logic (e.g., calling * mmcsd_spislotinitialize(), for example, will bind the SPI driver to * the SPI MMC/SD driver). * - ************************************************************************************/ + ****************************************************************************/ struct spi_dev_s; #ifdef CONFIG_PIC32MZ_SPI1 -void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", + (int)devid, selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -124,9 +129,11 @@ int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MZ_SPI2 -void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", + (int)devid, selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -146,9 +153,11 @@ int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MZ_SPI3 -void pic32mz_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", + (int)devid, selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -168,9 +177,11 @@ int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MZ_SPI4 -void pic32mz_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", + (int)devid, selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -190,9 +201,11 @@ int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MZ_SPI5 -void pic32mz_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", + (int)devid, selected ? "assert" : "de-assert"); #warning "Missing logic" } @@ -203,7 +216,8 @@ uint8_t pic32mz_spi5status(FAR struct spi_dev_s *dev, uint32_t devid) return 0; } #ifdef CONFIG_SPI_CMDDATA -int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, + bool cmd) { #warning "Missing logic" return 0; @@ -212,9 +226,11 @@ int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif #ifdef CONFIG_PIC32MZ_SPI6 -void pic32mz_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +void pic32mz_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) { - spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); #warning "Missing logic" }