MIPS: Add some build support for the M14K and also for the PIC32MZ Starter Kit. Still a long way to go
This commit is contained in:
parent
5fd0de547b
commit
2d0589a3cd
@ -35,6 +35,14 @@ config ARCH_MIPS32
|
||||
default n
|
||||
select ARCH_HAVE_VFORK
|
||||
|
||||
config ARCH_MIPS_24KC
|
||||
bool
|
||||
default n
|
||||
|
||||
config ARCH_MIPS_M14K
|
||||
bool
|
||||
default n
|
||||
|
||||
config ARCH_FAMILY
|
||||
string
|
||||
default "mips32" if ARCH_MIPS32
|
||||
|
@ -45,15 +45,6 @@
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
config ARCH_CHIP_PIC32MZ2048ECH
|
||||
bool "PIC32MZ2048ECH"
|
||||
select ARCH_CHIP_PIC32MZEC
|
||||
---help---
|
||||
Microchip PIC32MZ2048ECH (MIPS32)
|
||||
ARCH_CHIP_PIC32MZ1
|
||||
|
||||
config ARCH_CHIP_PIC32MZ2048ECM
|
||||
|
||||
/* Available in 64/100/124/144 pin packages. Description here is specifically
|
||||
* for the 144 pin package (PIC32MZ2048ECH144) and should be reviewed for
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include <arch/pic32mz/chip.h>
|
||||
|
||||
#if defined(CHIP_PIC32MZEC) || defined(CHIP_PIC32MZ2)
|
||||
# include <arch/pic32mz/irq_pic32mzxxxec.h.h>
|
||||
# include <arch/pic32mz/irq_pic32mzxxxec.h>
|
||||
#else
|
||||
# error "Unknown PIC32MZ family
|
||||
#endif
|
||||
|
@ -103,13 +103,23 @@ ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
||||
MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_MIPS_M14K),y)
|
||||
MIPS_MARCH = 24kc
|
||||
MIPS_MPROCESSOR = elf32pic32mx
|
||||
MIPS_MICROMIPS = -mmicromips
|
||||
else
|
||||
MIPS_MARCH = m14k
|
||||
MIPS_MPROCESSOR = elf32pic32mz
|
||||
MIPS_MICROMIPS =
|
||||
endif
|
||||
|
||||
# Generic GNU mip32 toolchain on OS X or Linux
|
||||
# including Pinguino mips-elf toolchain
|
||||
|
||||
ifeq ($(CONFIG_MIPS32_TOOLCHAIN),GNU_ELF)
|
||||
CROSSDEV ?= mips-elf-
|
||||
MAXOPTIMIZATION ?= -O2
|
||||
ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL
|
||||
ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=$(MIPS_MARCH) $(MIPS_MICROMIPS) -EL
|
||||
ARCHPICFLAGS = -fpic -membedded-pic
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
LDSCRIPT = mips-elf-debug.ld
|
||||
@ -121,7 +131,7 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPL)
|
||||
CROSSDEV ?= pic32-
|
||||
# CROSSDEV ?= xc32-
|
||||
MAXOPTIMIZATION ?= -O2
|
||||
ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
|
||||
ARCHCPUFLAGS = -mprocessor=$(MIPS_MPROCESSOR) $(MIPS_MICROMIPS) -mno-float -mlong32 -membedded-data
|
||||
ARCHPICFLAGS = -fpic -membedded-pic
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
LDSCRIPT = xc32-debug.ld
|
||||
@ -136,7 +146,7 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPW)
|
||||
WINTOOL = y
|
||||
endif
|
||||
MAXOPTIMIZATION ?= -O2
|
||||
ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
|
||||
ARCHCPUFLAGS = -mprocessor=$(MIPS_MPROCESSOR) $(MIPS_MICROMIPS) -mno-float -mlong32 -membedded-data
|
||||
ARCHPICFLAGS = -fpic -membedded-pic
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
LDSCRIPT = c32-debug.ld
|
||||
@ -148,7 +158,7 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPL_LITE)
|
||||
CROSSDEV ?= pic32-
|
||||
# CROSSDEV ?= xc32-
|
||||
# MAXOPTIMIZATION ?= -O2
|
||||
ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
|
||||
ARCHCPUFLAGS = -mprocessor=$(MIPS_MPROCESSOR) $(MIPS_MICROMIPS) -mno-float -mlong32 -membedded-data
|
||||
ARCHPICFLAGS = -fpic -membedded-pic
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
LDSCRIPT = xc32-debug.ld
|
||||
@ -163,7 +173,7 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPW_LITE)
|
||||
WINTOOL = y
|
||||
endif
|
||||
# MAXOPTIMIZATION ?= -O2
|
||||
ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
|
||||
ARCHCPUFLAGS = -mprocessor=$(MIPS_MPROCESSOR) $(MIPS_MICROMIPS) -mno-float -mlong32 -membedded-data
|
||||
ARCHPICFLAGS = -fpic -membedded-pic
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
LDSCRIPT = c32-debug.ld
|
||||
@ -174,7 +184,7 @@ endif
|
||||
ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPOPENL)
|
||||
CROSSDEV ?= mypic32-
|
||||
# MAXOPTIMIZATION ?= -O2
|
||||
ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
|
||||
ARCHCPUFLAGS = -mprocessor=$(MIPS_MPROCESSOR) $(MIPS_MICROMIPS) -mno-float -mlong32 -membedded-data
|
||||
ARCHPICFLAGS = -fpic -membedded-pic
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
LDSCRIPT = c32-debug.ld
|
||||
@ -189,7 +199,7 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),PINGUINOW)
|
||||
WINTOOL = y
|
||||
endif
|
||||
MAXOPTIMIZATION ?= -O2
|
||||
ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL
|
||||
ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=$(MIPS_MARCH) $(MIPS_MICROMIPS) -EL
|
||||
ARCHPICFLAGS = -fpic -membedded-pic
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
LDSCRIPT = mips-elf-debug.ld
|
||||
|
@ -430,30 +430,37 @@ endchoice
|
||||
config ARCH_CHIP_PIC32MX1
|
||||
bool
|
||||
default n
|
||||
select ARCH_MIPS_24KC
|
||||
|
||||
config ARCH_CHIP_PIC32MX2
|
||||
bool
|
||||
default n
|
||||
select ARCH_MIPS_24KC
|
||||
|
||||
config ARCH_CHIP_PIC32MX3
|
||||
bool
|
||||
default n
|
||||
select ARCH_MIPS_24KC
|
||||
|
||||
config ARCH_CHIP_PIC32MX4
|
||||
bool
|
||||
default n
|
||||
select ARCH_MIPS_24KC
|
||||
|
||||
config ARCH_CHIP_PIC32MX5
|
||||
bool
|
||||
default n
|
||||
select ARCH_MIPS_24KC
|
||||
|
||||
config ARCH_CHIP_PIC32MX6
|
||||
bool
|
||||
default n
|
||||
select ARCH_MIPS_24KC
|
||||
|
||||
config ARCH_CHIP_PIC32MX7
|
||||
bool
|
||||
default n
|
||||
select ARCH_MIPS_24KC
|
||||
|
||||
config PIC32MX_MVEC
|
||||
bool
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* arch/mips/src/pic32mx/pic32mx-internal.h
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -54,7 +54,7 @@
|
||||
#include "pic32mx-config.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* GPIO settings used in the configport, readport, writeport, etc.
|
||||
*
|
||||
@ -168,7 +168,8 @@ struct pic32mx_dmaregs_s
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
@ -185,7 +186,7 @@ extern "C" {
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN void pic32mx_lowinit(void);
|
||||
void pic32mx_lowinit(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_lowsetup
|
||||
@ -198,7 +199,7 @@ EXTERN void pic32mx_lowinit(void);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef HAVE_SERIAL_CONSOLE
|
||||
EXTERN void pic32mx_consoleinit(void);
|
||||
void pic32mx_consoleinit(void);
|
||||
#else
|
||||
# define pic32mx_consoleinit()
|
||||
#endif
|
||||
@ -212,7 +213,7 @@ EXTERN void pic32mx_consoleinit(void);
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef HAVE_UART_DEVICE
|
||||
EXTERN void pic32mx_uartreset(uintptr_t uart_base);
|
||||
void pic32mx_uartreset(uintptr_t uart_base);
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
@ -224,9 +225,8 @@ EXTERN void pic32mx_uartreset(uintptr_t uart_base);
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef HAVE_UART_DEVICE
|
||||
EXTERN void pic32mx_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
|
||||
unsigned int parity, unsigned int nbits,
|
||||
bool stop2);
|
||||
void pic32mx_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
|
||||
unsigned int parity, unsigned int nbits, bool stop2);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -238,7 +238,7 @@ EXTERN void pic32mx_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN void pic32mx_boardinitialize(void);
|
||||
void pic32mx_boardinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_decodeirq
|
||||
@ -249,7 +249,7 @@ EXTERN void pic32mx_boardinitialize(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN uint32_t *pic32mx_decodeirq(uint32_t *regs);
|
||||
uint32_t *pic32mx_decodeirq(uint32_t *regs);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_exception
|
||||
@ -259,7 +259,7 @@ EXTERN uint32_t *pic32mx_decodeirq(uint32_t *regs);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN uint32_t *pic32mx_exception(uint32_t *regs);
|
||||
uint32_t *pic32mx_exception(uint32_t *regs);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_configgpio
|
||||
@ -273,7 +273,7 @@ EXTERN uint32_t *pic32mx_exception(uint32_t *regs);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN int pic32mx_configgpio(uint16_t cfgset);
|
||||
int pic32mx_configgpio(uint16_t cfgset);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_gpiowrite
|
||||
@ -283,7 +283,7 @@ EXTERN int pic32mx_configgpio(uint16_t cfgset);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN void pic32mx_gpiowrite(uint16_t pinset, bool value);
|
||||
void pic32mx_gpiowrite(uint16_t pinset, bool value);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_gpioread
|
||||
@ -293,7 +293,7 @@ EXTERN void pic32mx_gpiowrite(uint16_t pinset, bool value);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN bool pic32mx_gpioread(uint16_t pinset);
|
||||
bool pic32mx_gpioread(uint16_t pinset);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_gpioirqinitialize
|
||||
@ -306,7 +306,7 @@ EXTERN bool pic32mx_gpioread(uint16_t pinset);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
EXTERN void pic32mx_gpioirqinitialize(void);
|
||||
void pic32mx_gpioirqinitialize(void);
|
||||
#else
|
||||
# define pic32mx_gpioirqinitialize()
|
||||
#endif
|
||||
@ -317,12 +317,12 @@ EXTERN void pic32mx_gpioirqinitialize(void);
|
||||
* Description:
|
||||
* Attach an interrupt service routine to a GPIO interrupt. This will also
|
||||
* reconfigure the pin as an interrupting input. The change notification number is
|
||||
* associated with all interrupt-capabile GPIO pins. The association could,
|
||||
* associated with all interrupt-capable GPIO pins. The association could,
|
||||
* however, differ from part to part and must be provided by the caller.
|
||||
*
|
||||
* When an interrupt occurs, it is due to a change on the GPIO input pin. In that
|
||||
* case, all attached handlers will be called. Each handler must maintain state
|
||||
* and determine if the unlying GPIO input value changed.
|
||||
* and determine if the underlying GPIO input value changed.
|
||||
*
|
||||
* Parameters:
|
||||
* - pinset: GPIO pin configuration
|
||||
@ -337,7 +337,7 @@ EXTERN void pic32mx_gpioirqinitialize(void);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
EXTERN xcpt_t pic32mx_gpioattach(uint32_t pinset, unsigned int cn, xcpt_t handler);
|
||||
xcpt_t pic32mx_gpioattach(uint32_t pinset, unsigned int cn, xcpt_t handler);
|
||||
#else
|
||||
# define pic32mx_gpioattach(p,f) (NULL)
|
||||
#endif
|
||||
@ -351,7 +351,7 @@ EXTERN xcpt_t pic32mx_gpioattach(uint32_t pinset, unsigned int cn, xcpt_t handle
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
EXTERN void pic32mx_gpioirqenable(unsigned int cn);
|
||||
void pic32mx_gpioirqenable(unsigned int cn);
|
||||
#else
|
||||
# define pic32mx_gpioirqenable(irq)
|
||||
#endif
|
||||
@ -365,7 +365,7 @@ EXTERN void pic32mx_gpioirqenable(unsigned int cn);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
EXTERN void pic32mx_gpioirqdisable(unsigned int cn);
|
||||
void pic32mx_gpioirqdisable(unsigned int cn);
|
||||
#else
|
||||
# define pic32mx_gpioirqdisable(irq)
|
||||
#endif
|
||||
@ -379,7 +379,7 @@ EXTERN void pic32mx_gpioirqdisable(unsigned int cn);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_GPIO
|
||||
EXTERN void pic32mx_dumpgpio(uint32_t pinset, const char *msg);
|
||||
void pic32mx_dumpgpio(uint32_t pinset, const char *msg);
|
||||
#else
|
||||
# define pic32mx_dumpgpio(p,m)
|
||||
#endif
|
||||
@ -413,42 +413,38 @@ EXTERN void pic32mx_dumpgpio(uint32_t pinset, const char *msg);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_SPI1
|
||||
EXTERN void pic32mx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
EXTERN uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
void pic32mx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
EXTERN int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool cmd);
|
||||
int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC32MX_SPI2
|
||||
EXTERN void pic32mx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
EXTERN uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
void pic32mx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
EXTERN int pic32mx_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool cmd);
|
||||
int pic32mx_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC32MX_SPI3
|
||||
EXTERN void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
EXTERN uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
EXTERN int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool cmd);
|
||||
int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC32MX_SPI3
|
||||
EXTERN void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
EXTERN uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
EXTERN int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool cmd);
|
||||
int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -464,7 +460,7 @@ EXTERN int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN void pic32mx_dmainitilaize(void);
|
||||
void pic32mx_dmainitilaize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -482,7 +478,7 @@ EXTERN void pic32mx_dmainitilaize(void);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN DMA_HANDLE pic32mx_dmachannel(void);
|
||||
DMA_HANDLE pic32mx_dmachannel(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -498,7 +494,7 @@ EXTERN DMA_HANDLE pic32mx_dmachannel(void);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN void pic32mx_dmafree(DMA_HANDLE handle);
|
||||
void pic32mx_dmafree(DMA_HANDLE handle);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -510,10 +506,8 @@ EXTERN void pic32mx_dmafree(DMA_HANDLE handle);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN int pic32mx_dmarxsetup(DMA_HANDLE handle,
|
||||
uint32_t control, uint32_t config,
|
||||
uint32_t srcaddr, uint32_t destaddr,
|
||||
size_t nbytes);
|
||||
int pic32mx_dmarxsetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
|
||||
uint32_t srcaddr, uint32_t destaddr, size_t nbytes);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -525,7 +519,7 @@ EXTERN int pic32mx_dmarxsetup(DMA_HANDLE handle,
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN int pic32mx_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
|
||||
int pic32mx_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -539,7 +533,7 @@ EXTERN int pic32mx_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *ar
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN void pic32mx_dmastop(DMA_HANDLE handle);
|
||||
void pic32mx_dmastop(DMA_HANDLE handle);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -552,7 +546,7 @@ EXTERN void pic32mx_dmastop(DMA_HANDLE handle);
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
#ifdef CONFIG_DEBUG_DMA
|
||||
EXTERN void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs);
|
||||
void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs);
|
||||
#else
|
||||
# define pic32mx_dmasample(handle,regs)
|
||||
#endif
|
||||
@ -568,8 +562,8 @@ EXTERN void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs)
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
#ifdef CONFIG_DEBUG_DMA
|
||||
EXTERN void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *regs,
|
||||
const char *msg);
|
||||
void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *regs,
|
||||
const char *msg);
|
||||
#else
|
||||
# define pic32mx_dmadump(handle,regs,msg)
|
||||
#endif
|
||||
@ -582,14 +576,14 @@ EXTERN void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *r
|
||||
* If USB is supported and the board supports a pullup via GPIO (for USB software
|
||||
* connect and disconnect), then the board software must provide pic32mx_pullup.
|
||||
* See include/nuttx/usb/usbdev.h for additional description of this method.
|
||||
* Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
|
||||
* Alternatively, if no pull-up GPIO the following can be redefined to be
|
||||
* NULL.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_USBDEV
|
||||
struct usbdev_s;
|
||||
EXTERN int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable);
|
||||
int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -604,7 +598,7 @@ EXTERN int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_USBDEV
|
||||
EXTERN void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -618,8 +612,8 @@ EXTERN void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_USBDEV
|
||||
EXTERN void pic32mx_usbattach(void);
|
||||
EXTERN void pic32mx_usbdetach(void);
|
||||
void pic32mx_usbattach(void);
|
||||
void pic32mx_usbdetach(void);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
|
@ -28,6 +28,7 @@ endchoice
|
||||
config ARCH_CHIP_PIC32MZEC
|
||||
bool
|
||||
default n
|
||||
select ARCH_MIPS_M14K
|
||||
|
||||
config PIC32MZ_MVEC
|
||||
bool
|
||||
|
68
arch/mips/src/pic32mz/Make.defs
Normal file
68
arch/mips/src/pic32mz/Make.defs
Normal file
@ -0,0 +1,68 @@
|
||||
############################################################################
|
||||
# arch/mips/src/pic32mz/Make.defs
|
||||
#
|
||||
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# The start-up, "head", file
|
||||
|
||||
HEAD_ASRC = # pic32mz-head.S
|
||||
|
||||
# Common MIPS files
|
||||
|
||||
CMN_ASRCS = up_syscall0.S vfork.S
|
||||
CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c
|
||||
CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c
|
||||
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_irq.c up_lowputs.c
|
||||
CMN_CSRCS += up_mdelay.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
|
||||
CMN_CSRCS += up_puts.c up_releasepending.c up_releasestack.c
|
||||
CMN_CSRCS += up_reprioritizertr.c up_schedulesigaction.c up_sigdeliver.c
|
||||
CMN_CSRCS += up_stackframe.c up_swint0.c up_udelay.c up_unblocktask.c
|
||||
CMN_CSRCS += up_usestack.c up_vfork.c
|
||||
|
||||
# Configuration dependent common files
|
||||
|
||||
ifneq ($(CONFIG_PIC32MZ_ETHERNET),y)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
CMN_CSRCS += up_etherstub.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_STACKDUMP),y)
|
||||
CMN_CSRCS += up_dumpstate.c
|
||||
endif
|
||||
|
||||
# Required PIC32MZ files
|
||||
|
||||
CHIP_ASRCS =
|
||||
|
||||
# Configuration-dependent PIC32MZ files
|
228
arch/mips/src/pic32mz/pic32mz-dma.h
Normal file
228
arch/mips/src/pic32mz/pic32mz-dma.h
Normal file
@ -0,0 +1,228 @@
|
||||
/************************************************************************************
|
||||
* arch/mips/src/pic32mx/pic32mx-dma.h
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_DMA_H
|
||||
#define __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_DMA_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
typedef FAR void *DMA_HANDLE;
|
||||
typedef void (*dma_callback_t)(DMA_HANDLE handle, void *arg, int result);
|
||||
|
||||
/* The following is used for sampling DMA registers when CONFIG DEBUG_DMA is selected */
|
||||
|
||||
#ifdef CONFIG_DEBUG_DMA
|
||||
struct pic32mx_dmaglobalregs_s
|
||||
{
|
||||
/* Global Registers */
|
||||
#warning "Missing definitions"
|
||||
};
|
||||
|
||||
struct pic32mx_dmachanregs_s
|
||||
{
|
||||
/* Channel Registers */
|
||||
#warning "Missing definitions"
|
||||
};
|
||||
|
||||
struct pic32mx_dmaregs_s
|
||||
{
|
||||
/* Global Registers */
|
||||
|
||||
struct pic32mx_dmaglobalregs_s gbl;
|
||||
|
||||
/* Channel Registers */
|
||||
|
||||
struct pic32mx_dmachanregs_s ch;
|
||||
};
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_dmainitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the GPDMA subsystem.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
void pic32mx_dmainitilaize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_dmachannel
|
||||
*
|
||||
* Description:
|
||||
* Allocate a DMA channel. This function sets aside a DMA channel and gives the
|
||||
* caller exclusive access to the DMA channel.
|
||||
*
|
||||
* Returned Value:
|
||||
* One success, this function returns a non-NULL, void* DMA channel handle. NULL
|
||||
* is returned on any failure. This function can fail only if no DMA channel is
|
||||
* available.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
DMA_HANDLE pic32mx_dmachannel(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_dmafree
|
||||
*
|
||||
* Description:
|
||||
* Release a DMA channel. NOTE: The 'handle' used in this argument must NEVER be
|
||||
* used again until pic32mx_dmachannel() is called again to re-gain a valid handle.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
void pic32mx_dmafree(DMA_HANDLE handle);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_dmasetup
|
||||
*
|
||||
* Description:
|
||||
* Configure DMA for one transfer.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
int pic32mx_dmarxsetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
|
||||
uint32_t srcaddr, uint32_t destaddr, size_t nbytes);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_dmastart
|
||||
*
|
||||
* Description:
|
||||
* Start the DMA transfer
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
int pic32mx_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_dmastop
|
||||
*
|
||||
* Description:
|
||||
* Cancel the DMA. After pic32mx_dmastop() is called, the DMA channel is reset
|
||||
* and pic32mx_dmasetup() must be called before pic32mx_dmastart() can be called
|
||||
* again
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
void pic32mx_dmastop(DMA_HANDLE handle);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_dmasample
|
||||
*
|
||||
* Description:
|
||||
* Sample DMA register contents
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
#ifdef CONFIG_DEBUG_DMA
|
||||
void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs);
|
||||
#else
|
||||
# define pic32mx_dmasample(handle,regs)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mx_dmadump
|
||||
*
|
||||
* Description:
|
||||
* Dump previously sampled DMA register contents
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
#ifdef CONFIG_DEBUG_DMA
|
||||
void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *regs,
|
||||
const char *msg);
|
||||
#else
|
||||
# define pic32mx_dmadump(handle,regs,msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_DMA_H */
|
269
arch/mips/src/pic32mz/pic32mz-gpio.h
Normal file
269
arch/mips/src/pic32mz/pic32mz-gpio.h
Normal file
@ -0,0 +1,269 @@
|
||||
/************************************************************************************
|
||||
* arch/mips/src/pic32mz/pic32mz-gpio.h
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_GPIO_H
|
||||
#define __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_GPIO_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* GPIO settings used in the configport, readport, writeport, etc.
|
||||
*
|
||||
* General encoding:
|
||||
* MMAV IIDR RRRx PPPP
|
||||
*/
|
||||
|
||||
#define GPIO_MODE_SHIFT (14) /* Bits 14-15: I/O mode */
|
||||
#define GPIO_MODE_MASK (3 << GPIO_MODE_SHIFT)
|
||||
# define GPIO_INPUT (0 << GPIO_MODE_SHIFT) /* 00 Normal input */
|
||||
# define GPIO_OUTPUT (2 << GPIO_MODE_SHIFT) /* 10 Normal output */
|
||||
# define GPIO_OPENDRAN (3 << GPIO_MODE_SHIFT) /* 11 Open drain output */
|
||||
|
||||
#if defined(CHIP_PIC32MZ1) || defined(CHIP_PIC32MZ2)
|
||||
#define GPIO_ANALOG_MASK (1 << 13) /* Bit 13: Analog */
|
||||
# define GPIO_ANALOG (1 << 13)
|
||||
# define GPIO_DIGITAL (0)
|
||||
#endif
|
||||
|
||||
#define GPIO_VALUE_MASK (1 << 12) /* Bit 12: Initial output value */
|
||||
# define GPIO_VALUE_ONE (1 << 12)
|
||||
# define GPIO_VALUE_ZERO (0)
|
||||
|
||||
#if defined(CHIP_PIC32MZ1) || defined(CHIP_PIC32MZ2)
|
||||
# define GPIO_PULLUP (1 << 11) /* Bit 11: Change notification pull-up */
|
||||
#endif
|
||||
|
||||
#define GPIO_INT_SHIFT (10) /* Bits 10-11: Interrupt mode */
|
||||
#define GPIO_INT_MASK (3 << GPIO_INT_SHIFT)
|
||||
# define GPIO_INT_NONE (0 << GPIO_INT_SHIFT) /* Bit 00: No interrupt */
|
||||
# define GPIO_INT (1 << GPIO_INT_SHIFT) /* Bit 01: Change notification enable */
|
||||
# define GPIO_PUINT (3 << GPIO_INT_SHIFT) /* Bit 11: Pulled-up interrupt input */
|
||||
|
||||
#if defined(CHIP_PIC32MZ1) || defined(CHIP_PIC32MZ2)
|
||||
# define GPIO_PULLDOWN (1 << 9) /* Bit 11: Change notification pull-down */
|
||||
#endif
|
||||
|
||||
#define GPIO_PORT_SHIFT (5) /* Bits 5-8: Port number */
|
||||
#define GPIO_PORT_MASK (15 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTA (0 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTB (1 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTC (2 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTD (3 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTE (4 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTF (5 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTG (6 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTH (7 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTJ (8 << GPIO_PORT_SHIFT)
|
||||
# define GPIO_PORTK (9 << GPIO_PORT_SHIFT)
|
||||
|
||||
#define GPIO_PIN_SHIFT 0 /* Bits 0-3: GPIO number: 0-15 */
|
||||
#define GPIO_PIN_MASK (15 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN0 (0 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN1 (1 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN2 (2 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN3 (3 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN4 (4 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN5 (5 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN6 (6 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN7 (7 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN8 (8 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN9 (9 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN10 (10 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN11 (11 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN12 (12 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN13 (13 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN14 (14 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN15 (15 << GPIO_PIN_SHIFT)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mz_configgpio
|
||||
*
|
||||
* Description:
|
||||
* Configure a GPIO pin based on bit-encoded description of the pin (the interrupt
|
||||
* will be configured when pic32mz_attach() is called).
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; negated errno on failure.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int pic32mz_configgpio(uint16_t cfgset);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mz_gpiowrite
|
||||
*
|
||||
* Description:
|
||||
* Write one or zero to the selected GPIO pin
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void pic32mz_gpiowrite(uint16_t pinset, bool value);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mz_gpioread
|
||||
*
|
||||
* Description:
|
||||
* Read one or zero from the selected GPIO pin
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
bool pic32mz_gpioread(uint16_t pinset);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mz_gpioirqinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize logic to support a GPIO change notification interrupts. This
|
||||
* function is called internally by the system on power up and should not be
|
||||
* called again.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
void pic32mz_gpioirqinitialize(void);
|
||||
#else
|
||||
# define pic32mz_gpioirqinitialize()
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mz_gpioattach
|
||||
*
|
||||
* Description:
|
||||
* Attach an interrupt service routine to a GPIO interrupt. This will also
|
||||
* reconfigure the pin as an interrupting input. The change notification number is
|
||||
* associated with all interrupt-capable GPIO pins. The association could,
|
||||
* however, differ from part to part and must be provided by the caller.
|
||||
*
|
||||
* When an interrupt occurs, it is due to a change on the GPIO input pin. In that
|
||||
* case, all attached handlers will be called. Each handler must maintain state
|
||||
* and determine if the underlying GPIO input value changed.
|
||||
*
|
||||
* Parameters:
|
||||
* - pinset: GPIO pin configuration
|
||||
* - cn: The change notification number associated with the pin
|
||||
* - handler: Interrupt handler (may be NULL to detach)
|
||||
*
|
||||
* Returns:
|
||||
* The previous value of the interrupt handler function pointer. This value may,
|
||||
* for example, be used to restore the previous handler when multiple handlers are
|
||||
* used.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
xcpt_t pic32mz_gpioattach(uint32_t pinset, unsigned int cn, xcpt_t handler);
|
||||
#else
|
||||
# define pic32mz_gpioattach(p,f) (NULL)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mz_gpioirqenable
|
||||
*
|
||||
* Description:
|
||||
* Enable the interrupt for specified GPIO IRQ
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
void pic32mz_gpioirqenable(unsigned int cn);
|
||||
#else
|
||||
# define pic32mz_gpioirqenable(irq)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mz_gpioirqdisable
|
||||
*
|
||||
* Description:
|
||||
* Disable the interrupt for specified GPIO IRQ
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
void pic32mz_gpioirqdisable(unsigned int cn);
|
||||
#else
|
||||
# define pic32mz_gpioirqdisable(irq)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Function: pic32mz_dumpgpio
|
||||
*
|
||||
* Description:
|
||||
* Dump all GPIO registers associated with the provided base address
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_GPIO
|
||||
void pic32mz_dumpgpio(uint32_t pinset, const char *msg);
|
||||
#else
|
||||
# define pic32mz_dumpgpio(p,m)
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_GPIO_H */
|
161
arch/mips/src/pic32mz/pic32mz-spi.h
Normal file
161
arch/mips/src/pic32mz/pic32mz-spi.h
Normal file
@ -0,0 +1,161 @@
|
||||
/************************************************************************************
|
||||
* arch/mips/src/pic32mz/pic32mz-spi.h
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_SPI_H
|
||||
#define __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_SPI_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: 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 up_spiinitialize()) are provided by common PIC32MZ logic. To use
|
||||
* this common SPI logic on your board:
|
||||
*
|
||||
* 1. Provide logic in pic32mz_boardinitialize() to configure SPI/SSP 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.
|
||||
* 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 up_spiinitialize() in your low level application
|
||||
* initialization logic
|
||||
* 4. The handle returned by up_spiinitialize() 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_PIC32MZ_SPI1
|
||||
void pic32mz_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mz_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC32MZ_SPI2
|
||||
void pic32mz_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mz_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC32MZ_SPI3
|
||||
void pic32mz_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mz_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC32MZ_SPI4
|
||||
void pic32mz_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mz_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC32MZ_SPI5
|
||||
void pic32mz_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mz_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC32MZ_SPI6
|
||||
void pic32mz_spi6select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected);
|
||||
uint8_t pic32mz_spi6status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_SPI_H */
|
128
arch/mips/src/pic32mz/pic32mz-usbdev.h
Normal file
128
arch/mips/src/pic32mz/pic32mz-usbdev.h
Normal file
@ -0,0 +1,128 @@
|
||||
/************************************************************************************
|
||||
* arch/mips/src/pic32mz/pic32mz-usbdev.h
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_USBDEV_H
|
||||
#define __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_USBDEV_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mz_usbpullup
|
||||
*
|
||||
* Description:
|
||||
* If USB is supported and the board supports a pullup via GPIO (for USB software
|
||||
* connect and disconnect), then the board software must provide pic32mz_pullup.
|
||||
* See include/nuttx/usb/usbdev.h for additional description of this method.
|
||||
* Alternatively, if no pull-up GPIO the following can be redefined to be
|
||||
* NULL.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MZ_USBDEV
|
||||
struct usbdev_s;
|
||||
int pic32mz_usbpullup(FAR struct usbdev_s *dev, bool enable);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pic32mz_usbsuspend
|
||||
*
|
||||
* Description:
|
||||
* Board logic must provide the pic32mz_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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MZ_USBDEV
|
||||
void pic32mz_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mz_usbattach and pic32mz_usbdetach
|
||||
*
|
||||
* Description:
|
||||
* The USB stack must be notified when the device is attached or detached by
|
||||
* calling one of these functions.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PIC32MZ_USBDEV
|
||||
void pic32mz_usbattach(void);
|
||||
void pic32mz_usbdetach(void);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_USBDEV_H */
|
@ -50,12 +50,12 @@ fi
|
||||
# location so you will probably have to edit this. You will also have
|
||||
# to edit this if you install a different version of if you install
|
||||
# the Linux PIC32MZ toolchain as well
|
||||
export TOOLCHAIN_PREBIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin":
|
||||
#export TOOLCHAIN_PREBIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin":
|
||||
|
||||
# This is where I have the Pinquino toolchain installed
|
||||
# Careful with the ordering in the PATH variable... there is an incompatible
|
||||
# version of make in this directory too!
|
||||
#export TOOLCHAIN_POSTBIN=:"/cygdrive/c/pinguino-11/compilers/p32/bin"
|
||||
export TOOLCHAIN_POSTBIN=:"/cygdrive/c/pinguino-11/compilers/p32/bin"
|
||||
|
||||
# This is the path to the tools subdirectory
|
||||
export PIC32TOOL_DIR="${WD}/tools/pic32mz"
|
||||
|
@ -38,7 +38,7 @@
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
|
||||
ASRCS =
|
||||
CSRCS = pic32mz_boot.c pic32mz_bringup.c pic32mz_leds.c pic32mz_spi.c
|
||||
CSRCS = pic32mz_boot.c pic32mz_bringup.c pic32mz_spi.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += pic32mz_autoleds.c
|
||||
|
@ -130,7 +130,7 @@
|
||||
|
||||
#define GPIO_LED_1 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTH|GPIO_PIN0)
|
||||
#define GPIO_LED_2 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTH|GPIO_PIN1)
|
||||
#define GPIO_LED_3 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTN|GPIO_PIN2)
|
||||
#define GPIO_LED_3 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTH|GPIO_PIN2)
|
||||
|
||||
/* The PIC32MZ Ethernet Starter kit has 3 user push buttons labelled SW1-3
|
||||
* on the board:
|
||||
|
@ -45,12 +45,10 @@
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "pic32mz-internal.h"
|
||||
#include "pic32mz-ioport.h"
|
||||
#include "pic32mz-gpio.h"
|
||||
#include "pic32mz-starterkit.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
@ -41,12 +41,8 @@
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "pic32mz-internal.h"
|
||||
#include "pic32mz-starterkit.h"
|
||||
|
||||
/************************************************************************************
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
|
||||
#include "pic32mz-internal.h"
|
||||
#include "pic32mz-starterkit.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -47,12 +47,12 @@
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "chip.h"
|
||||
#include "pic32mz-internal.h"
|
||||
|
||||
#include "pic32mz-starterkit.h"
|
||||
|
||||
#if defined(CONFIG_PIC32MZ_SPI1) || defined(CONFIG_PIC32MZ_SPI2) || \
|
||||
defined(CONFIG_PIC32MZ_SPI3) || defined(CONFIG_PIC32MZ_SPI4)
|
||||
defined(CONFIG_PIC32MZ_SPI3) || defined(CONFIG_PIC32MZ_SPI4) || \
|
||||
defined(CONFIG_PIC32MZ_SPI5) || defined(CONFIG_PIC32MZ_SPI6)
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -219,4 +219,48 @@ int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_PIC32MZ_SPI1..4 */
|
||||
#ifdef CONFIG_PIC32MZ_SPI5
|
||||
void pic32mz_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
#warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t pic32mz_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
sspdbg("Returning nothing\n");
|
||||
#warning "Missing logic"
|
||||
return 0;
|
||||
}
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
#warning "Missing logic"
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PIC32MZ_SPI6
|
||||
void pic32mz_spi6select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
#warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t pic32mz_spi6status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
sspdbg("Returning nothing\n");
|
||||
#warning "Missing logic"
|
||||
return 0;
|
||||
}
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
#warning "Missing logic"
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_PIC32MZ_SPI1..6 */
|
||||
|
@ -49,8 +49,7 @@
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "pic32mz-internal.h"
|
||||
#include "pic32mz-ioport.h"
|
||||
#include "pic32mz-gpio.h"
|
||||
#include "pic32mz-starterkit.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
Loading…
Reference in New Issue
Block a user