diff --git a/Makefile.SAMV71 b/Makefile.SAMV71 index 0669f02..f9057ac 100644 --- a/Makefile.SAMV71 +++ b/Makefile.SAMV71 @@ -14,7 +14,7 @@ SRC = hw/ATSAMV71/cstartup.c hw/ATSAMV71/hardware.c hw/ATSAMV71/spi.c hw/ATSAMV7 SRC += hw/ATSAMV71/network/intmath.c hw/ATSAMV71/network/gmac.c hw/ATSAMV71/network/gmacd.c hw/ATSAMV71/network/phy.c hw/ATSAMV71/network/ethd.c SRC += fdd.c firmware.c fpga.c hdd.c main.c menu.c menu-minimig.c menu-8bit.c osd.c state.c syscalls.c user_io.c settings.c data_io.c boot.c idxfile.c config.c tos.c ikbd.c xmodem.c ini_parser.c cue_parser.c mist_cfg.c archie.c pcecd.c neocd.c psx.c arc_file.c font.c utils.c SRC += it6613/HDMI_TX.c it6613/it6613_drv.c it6613/it6613_sys.c it6613/EDID.c it6613/hdmitx_mist.c -SRC += usb/usbdebug.c usb/hub.c usb/xboxusb.c usb/hid.c usb/hidparser.c usb/timer.c usb/asix.c usb/pl2303.c usb/usbrtc.c usb/joymapping.c usb/joystick.c +SRC += usb/usbdebug.c usb/hub.c usb/xboxusb.c usb/hid.c usb/hidparser.c usb/timer.c usb/asix.c usb/pl2303.c usb/usbrtc.c usb/joymapping.c usb/joystick.c usb/storage.c SRC += usb/usb.c usb/max3421e.c usb/usb-max3421e.c #SRC += usb/usb-samv71.c SRC += fat_compat.c @@ -29,8 +29,8 @@ LIBDIR = # Commandline options for each tool. # for ESA11 add -DEMIST -DFLAGS = -I. -Iarch -Icmsis -Iusb -Ihw/ATSAMV71 -DMIST -DCONFIG_HAVE_NVIC -DCONFIG_HAVE_ETH -DCONFIG_HAVE_GMAC -DCONFIG_HAVE_GMAC_QUEUES -DGMAC_QUEUE_COUNT=6 -DCONFIG_ARCH_ARM -DCONFIG_ARCH_ARMV7M -DCONFIG_CHIP_SAMV71 -DCONFIG_PACKAGE_100PIN -DFLAGS += -DFW_ID=\"SIDIUPG\" -DDEFAULT_CORE_NAME=\"SIDI128.RBF\" -DFATFS_NO_TINY -DSD_NO_DIRECT_MODE -DJOY_DB9_MD -DHAVE_QSPI -DHAVE_HDMI -DHAVE_PSX +DFLAGS = -I. -Iarch -Icmsis -Iusb -Ihw/ATSAMV71 -D_GNU_SOURCE -DMIST -DCONFIG_HAVE_NVIC -DCONFIG_HAVE_ETH -DCONFIG_HAVE_GMAC -DCONFIG_HAVE_GMAC_QUEUES -DGMAC_QUEUE_COUNT=6 -DCONFIG_ARCH_ARM -DCONFIG_ARCH_ARMV7M -DCONFIG_CHIP_SAMV71 -DCONFIG_PACKAGE_100PIN +DFLAGS += -DFW_ID=\"SIDIUPG\" -DDEFAULT_CORE_NAME=\"SIDI128.RBF\" -DFATFS_NO_TINY -DSD_NO_DIRECT_MODE -DJOY_DB9_MD -DHAVE_QSPI -DHAVE_HDMI -DHAVE_PSX -DUSB_STORAGE #DFLAGS += -DPROTOTYPE CFLAGS = $(DFLAGS) -march=armv7-m -mtune=cortex-m7 -mthumb -ffunction-sections -fsigned-char -c -g -O2 --std=gnu99 -DVDATE=\"`date +"%y%m%d"`\" CFLAGS += $(CFLAGS-$@) diff --git a/hw/ATSAMV71/component/component_gmac.h b/hw/ATSAMV71/component/component_gmac.h index 7bafb77..1309674 100644 --- a/hw/ATSAMV71/component/component_gmac.h +++ b/hw/ATSAMV71/component/component_gmac.h @@ -151,14 +151,14 @@ typedef struct { __I uint32_t GMAC_PEFRSL; /**< \brief (Gmac Offset: 0x1F8) PTP Peer Event Frame Received Seconds Low Register */ __I uint32_t GMAC_PEFRN; /**< \brief (Gmac Offset: 0x1FC) PTP Peer Event Frame Received Nanoseconds Register */ __I uint32_t Reserved6[128]; - __I uint32_t GMAC_ISRPQ[2]; /**< \brief (Gmac Offset: 0x400) Interrupt Status Register Priority Queue (index = 1) */ - __I uint32_t Reserved7[14]; - __IO uint32_t GMAC_TBQBAPQ[2]; /**< \brief (Gmac Offset: 0x440) Transmit Buffer Queue Base Address Register Priority Queue (index = 1) */ - __I uint32_t Reserved8[14]; - __IO uint32_t GMAC_RBQBAPQ[2]; /**< \brief (Gmac Offset: 0x480) Receive Buffer Queue Base Address Register Priority Queue (index = 1) */ - __I uint32_t Reserved9[6]; - __IO uint32_t GMAC_RBSRPQ[2]; /**< \brief (Gmac Offset: 0x4A0) Receive Buffer Size Register Priority Queue (index = 1) */ - __I uint32_t Reserved10[5]; + __I uint32_t GMAC_ISRPQ[5]; /**< \brief (Gmac Offset: 0x400) Interrupt Status Register Priority Queue (index = 1) */ + __I uint32_t Reserved7[11]; + __IO uint32_t GMAC_TBQBAPQ[5]; /**< \brief (Gmac Offset: 0x440) Transmit Buffer Queue Base Address Register Priority Queue (index = 1) */ + __I uint32_t Reserved8[11]; + __IO uint32_t GMAC_RBQBAPQ[5]; /**< \brief (Gmac Offset: 0x480) Receive Buffer Queue Base Address Register Priority Queue (index = 1) */ + __I uint32_t Reserved9[3]; + __IO uint32_t GMAC_RBSRPQ[5]; /**< \brief (Gmac Offset: 0x4A0) Receive Buffer Size Register Priority Queue (index = 1) */ + __I uint32_t Reserved10[2]; __IO uint32_t GMAC_CBSCR; /**< \brief (Gmac Offset: 0x4BC) Credit-Based Shaping Control Register */ __IO uint32_t GMAC_CBSISQA; /**< \brief (Gmac Offset: 0x4C0) Credit-Based Shaping IdleSlope Register for Queue A */ __IO uint32_t GMAC_CBSISQB; /**< \brief (Gmac Offset: 0x4C4) Credit-Based Shaping IdleSlope Register for Queue B */ @@ -168,12 +168,12 @@ typedef struct { __IO uint32_t GMAC_ST2RPQ[8]; /**< \brief (Gmac Offset: 0x540) Screening Type 2 Register Priority Queue (index = 0..7) */ __I uint32_t Reserved13[12]; __I uint32_t Reserved14[28]; - __O uint32_t GMAC_IERPQ[2]; /**< \brief (Gmac Offset: 0x600) Interrupt Enable Register Priority Queue (index = 1..2) */ - __I uint32_t Reserved15[6]; - __O uint32_t GMAC_IDRPQ[2]; /**< \brief (Gmac Offset: 0x620) Interrupt Disable Register Priority Queue (index = 1..2) */ - __I uint32_t Reserved16[6]; - __IO uint32_t GMAC_IMRPQ[2]; /**< \brief (Gmac Offset: 0x640) Interrupt Mask Register Priority Queue (index = 1..2) */ - __I uint32_t Reserved17[38]; + __O uint32_t GMAC_IERPQ[5]; /**< \brief (Gmac Offset: 0x600) Interrupt Enable Register Priority Queue (index = 1..5) */ + __I uint32_t Reserved15[3]; + __O uint32_t GMAC_IDRPQ[5]; /**< \brief (Gmac Offset: 0x620) Interrupt Disable Register Priority Queue (index = 1..5) */ + __I uint32_t Reserved16[3]; + __IO uint32_t GMAC_IMRPQ[5]; /**< \brief (Gmac Offset: 0x640) Interrupt Mask Register Priority Queue (index = 1..5) */ + __I uint32_t Reserved17[35]; __IO uint32_t GMAC_ST2ER[4]; /**< \brief (Gmac Offset: 0x6E0) Screening Type 2 Ethertype Register (index = 0..3) */ __I uint32_t Reserved18[4]; GmacSt2Cw GMAC_ST2CW[24]; /**< \brief (Gmac Offset: 0x700) Screener Type 2 Compare Registers */ diff --git a/hw/ATSAMV71/hardware.h b/hw/ATSAMV71/hardware.h index bdadaf8..c95e058 100644 --- a/hw/ATSAMV71/hardware.h +++ b/hw/ATSAMV71/hardware.h @@ -127,6 +127,9 @@ along with this program. If not, see . #define USB_LOAD_VAR *(int*)(0x2045F000) #define USB_LOAD_VALUE 12345678 +#define USB_BOOT_VALUE 0x8007F007 +#define USB_BOOT_VAR (*(int*)0x002045F013) + #define DEBUG_MODE_VAR *(int*)(0x2045F008) #define DEBUG_MODE_VALUE 87654321 #define DEBUG_MODE (DEBUG_MODE_VAR == DEBUG_MODE_VALUE) diff --git a/hw/ATSAMV71/mmc.c b/hw/ATSAMV71/mmc.c index c6857f3..ddc563d 100644 --- a/hw/ATSAMV71/mmc.c +++ b/hw/ATSAMV71/mmc.c @@ -262,8 +262,6 @@ unsigned char MMC_Init(void) RAMFUNC static unsigned char MMC_ReadBlocks(unsigned char *buffer, unsigned long lba, unsigned long blocks) { - // check of card has been removed and try to re-initialize it - if(!check_card()) return 0; if(!buffer) return 0; // direct transfer is not supported if (CardType != CARDTYPE_SDHC) // SDHC cards are addressed in sectors not bytes @@ -326,9 +324,6 @@ RAMFUNC unsigned char MMC_ReadMultiple(unsigned long lba, unsigned char *pReadBu static unsigned char MMC_WriteBlocks(unsigned long lba, const unsigned char *pWriteBuffer, unsigned long blocks) { - // check of card has been removed and try to re-initialize it - if(!check_card()) return 0; - XDMAC0->XDMAC_GD = XDMAC_GD_DI0; XDMAC0->XDMAC_CH[DMA_CH_MMC].XDMAC_CC = XDMAC_CC_TYPE_PER_TRAN | XDMAC_CC_MBSIZE_SINGLE @@ -451,8 +446,12 @@ RAMFUNC static unsigned char MMC_WaitTransferEnd() RAMFUNC static unsigned char MMC_WaitReady() { - unsigned long to = GetTimer(500); + unsigned long to; + // check of card has been removed and try to re-initialize it + if(!check_card()) return 0; + + to = GetTimer(500); //wait for data ready status do { MMC_Command(CMD13, RCA << 16, HSMCI_CMDR_RSPTYP_48_BIT | HSMCI_CMDR_MAXLAT);