URL
https://opencores.org/ocsvn/s6soc/s6soc/trunk
Subversion Repositories s6soc
Compare Revisions
- This comparison shows the changes necessary to convert path
/s6soc/trunk/sw/host
- from Rev 11 to Rev 8
- ↔ Reverse comparison
Rev 11 → Rev 8
/readflash.cpp
File deleted
/llcomms.cpp
File deleted
/deppi.cpp
File deleted
/llcomms.h
File deleted
/zipload.cpp
File deleted
/deppi.h
File deleted
/ttybus.h
File deleted
/ttybus.cpp
File deleted
/flashdrvr.h
2,16 → 2,16
// |
// Filename: flashdrvr.h |
// |
// Project: CMod S6 System on a Chip, ZipCPU demonstration project |
// Project: XuLA2-LX25 System on a Chip |
// |
// Purpose: Flash driver. Encapsulate writing to the flash device. |
// |
// Creator: Dan Gisselquist, Ph.D. |
// Gisselquist Technology, LLC |
// Creator: Dan Gisselquist |
// Gisselquist Tecnology, LLC |
// |
//////////////////////////////////////////////////////////////////////////////// |
// |
// Copyright (C) 2015-2016, Gisselquist Technology, LLC |
// Copyright (C) 2016, Gisselquist Technology, LLC |
// |
// This program is free software (firmware): you can redistribute it and/or |
// modify it under the terms of the GNU General Public License as published |
23,11 → 23,6
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with this program. (It's in the $(ROOT)/doc directory, run make with no |
// target there if the PDF file isn't present.) If not, see |
// <http://www.gnu.org/licenses/> for a copy. |
// |
// License: GPL, v3, as defined and found on www.gnu.org, |
// http://www.gnu.org/licenses/gpl.html |
// |
/regdefs.h
102,35 → 102,34
// RAM memory space |
#define RAMBASE 0x00002000 |
#define MEMWORDS (1<<12) |
#define RAMLEN MEMWORDS |
|
// Flash memory space |
#define SPIFLASH 0x00400000 |
#define FLASHWORDS (1<<22) |
#define CONFIG_ADDRESS 0x00400000 // Main Xilinx configuration (ZipCPU) |
#define ALTCONFIG_ADDRESS 0x440000 // Alternate Xilinx configuration (Debug) |
#define RESET_ADDRESS 0x00480000 // ZipCPU Reset address |
#define SPIFLASH 0x00040000 |
#define FLASHWORDS (1<<18) |
// SDRAM memory space |
#define SDRAMBASE 0x00400000 |
#define SDRAMWORDS (1<<24) |
|
// Interrupt control constants |
#define GIE 0x80000000 // Enable all interrupts |
#define SCOPEN 0x80040004 // Enable WBSCOPE interrupts |
#define ISPIF_EN 0x90001000 // Enable SPI Flash interrupts |
#define ISPIF_DIS 0x10000000 // Disable SPI Flash interrupts |
#define ISPIF_CLR 0x10001000 // Clear pending SPI Flash interrupt |
// #define GIE 0x80000000 // Enable all interrupts |
// #define SCOPEN 0x80080008 // Enable WBSCOPE interrupts |
// #define ISPIF_EN 0x80040004 // Enable SPI Flash interrupts |
// #define ISPIF_DIS 0x00040000 // Disable SPI Flash interrupts |
// #define ISPIF_CLR 0x00000004 // Clear pending SPI Flash interrupt |
|
// Flash control constants |
#define ERASEFLAG 0x80000000 |
#define DISABLEWP 0x10000000 |
|
// Sectors are defined as 64 kB (16 kW) |
#define SZPAGE 64 // 256 bytes |
#define PGLEN 64 // 256 bytes |
#define NPAGES 256 // 64 kB sectors / 256 bytes is ... |
#define SZPAGE 64 |
#define PGLEN 64 |
#define NPAGES 32 |
#define SECTORSZ (NPAGES * SZPAGE) |
#define NSECTORS (FLASHWORDS/SECTORSZ) // 256 sectors |
#define SECTOROF(A) ((A) & (-1<<14)) // 64 kB ea |
#define NSECTORS 256 |
#define SECTOROF(A) ((A) & (-1<<10)) |
#define PAGEOF(A) ((A) & (-1<<6)) |
|
#define RAMLEN MEMWORDS |
|
// Scop definition/sequences |
#define SCOPE_NO_RESET 0x80000000 |
#define SCOPE_TRIGGER (0x08000000|SCOPE_NO_RESET) |
153,7 → 152,5
// #include "deppbus.h" |
|
// typedef DEPPBUS FPGA; |
#include "ttybus.h" |
typedef TTYBUS FPGA; |
|
#endif |
/wbregs.cpp
48,25 → 48,11
#include <signal.h> |
#include <assert.h> |
|
#include "devbus.h" |
|
#ifdef SIMPLE_DEPPBUS |
# include "deppbus.h" |
#else |
# include "llcomms.h" |
# include "deppi.h" |
# include "ttybus.h" |
|
#endif |
|
#include "deppbus.h" |
// #include "port.h" |
#include "regdefs.h" |
|
#ifdef SIMPLE_DEPPBUS |
# define FPGAOPEN(SN) new DEPPBUS(SN); |
#else |
# define FPGAOPEN(SN) new FPGA(new DEPPI(SN)) |
#endif |
typedef DEPPBUS FPGA; |
|
FPGA *m_fpga; |
void closeup(int v) { |
89,6 → 75,10
argv[argn] = argv[argn+skp]; |
} argc -= skp; |
|
char szSel[64]; |
strcpy(szSel, "SN:210282768825"); |
m_fpga = new DEPPBUS(szSel); |
|
signal(SIGSTOP, closeup); |
signal(SIGHUP, closeup); |
|
104,10 → 94,6
if (nm == NULL) |
nm = "no name"; |
|
char szSel[64]; |
strcpy(szSel, "SN:210282768825"); |
m_fpga = FPGAOPEN(szSel); |
|
if (argc < 2) { |
FPGA::BUSW v; |
try { |
/flashdrvr.cpp
40,7 → 40,7
#include <signal.h> |
#include <assert.h> |
|
#include "devbus.h" |
#include "port.h" |
#include "regdefs.h" |
#include "flashdrvr.h" |
|
133,10 → 133,9
// command immediately. As soon as the write completes the read will |
// begin sending commands back. This allows us to recover the lost |
// time between the interrupt and the next command being received. |
flwait(); |
// if ((!HIGH_SPEED)||(!verify_write)) { } |
if (verify_write) { |
// printf("Attempting to verify page\n"); |
if ((!HIGH_SPEED)||(!verify_write)) { |
flwait(); |
} if (verify_write) { |
// NOW VERIFY THE PAGE |
m_fpga->readi(addr, len, buf); |
for(unsigned i=0; i<len; i++) { |
146,7 → 145,7
i, buf[i], data[i], i+addr); |
return false; |
} |
} // printf("\nVerify success\n"); |
} |
} return true; |
} |
|
195,26 → 194,21
continue; // This sector already matches |
|
// Just erase anyway |
if (!need_erase) |
if ((need_erase)&&(!erase_sector(s, verify))) { |
printf("SECTOR ERASE FAILED!\n"); |
return false; |
} else if (!need_erase) |
printf("NO ERASE NEEDED\n"); |
else { |
printf("ERASING SECTOR %08x\n", s); |
if (!erase_sector(s, verify)) { |
printf("SECTOR ERASE FAILED!\n"); |
return false; |
} newv = (s<addr) ? addr : s; |
newv = (s<addr) ? addr : s; |
} |
for(unsigned p=newv; (p<s+SECTORSZ)&&(p<addr+len); p=PAGEOF(p+PGLEN)) { |
unsigned start = p, len = addr+len-start; |
|
// BUT! if we cross page boundaries, we need to clip |
// our results to the page boundary |
if (PAGEOF(start+len-1)!=PAGEOF(start)) |
len = PAGEOF(start+PGLEN)-start; |
if (!write_page(start, len, &data[p-addr], verify)) { |
for(unsigned p=newv; (p<s+SECTORSZ)&&(p<addr+len); p=PAGEOF(p+PGLEN)) |
if (!write_page(p, (p+PGLEN<addr+len) |
?((PAGEOF(p)!=PAGEOF(p+PGLEN-1))?(PAGEOF(p+PGLEN-1)-p):PGLEN) |
:(addr+len-p), &data[p-addr]), verify) { |
printf("WRITE-PAGE FAILED!\n"); |
return false; |
} |
} |
} |
|
/Makefile
1,12 → 1,11
all: |
PROGRAMS := wbregs readflash zipload |
PROGRAMS := wbregs |
all: $(PROGRAMS) |
|
CXX := g++ |
OBJDIR := obj-pc |
# BUSSRCS:= deppbus.cpp regdefs.cpp |
BUSSRCS:= deppi.cpp regdefs.cpp llcomms.cpp ttybus.cpp |
SOURCES:= wbregs.cpp readflash.cpp zipload.cpp flashdrvr.cpp # flashload.cpp/ziprun.cpp |
BUSSRCS:= deppbus.cpp regdefs.cpp |
SOURCES:= wbregs.cpp # flashload.cpp/ziprun.cpp |
ADEPT := ../../../refs/digilent.adept.sdk_2.3.1 |
HEADERS:= deppbus.h devbus.h flashdrvr.h regdefs.h twoc.h |
OBJECTS:= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES))) |
25,15 → 24,9
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS) |
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@ |
|
readflash: $(OBJDIR)/readflash.o $(BUSOBJS) |
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@ |
|
zipload: $(OBJDIR)/zipload.o $(OBJDIR)/flashdrvr.o $(BUSOBJS) |
$(CXX) $(CFLAGS) $^ $(LIBS) -lelf -o $@ |
|
define build-depends |
@echo "Building dependency file(s)" |
@$(CXX) $(CFLAGS) -MM $(SOURCES) $(BUSSRCS) > $(OBJDIR)/xdepends.txt |
@$(CXX) $(CFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt |
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt |
@rm $(OBJDIR)/xdepends.txt |
endef |
/devbus.h
2,7 → 2,7
// |
// Filename: devbus.h |
// |
// Project: CMod S6 System on a Chip, ZipCPU demonstration project |
// Project: XuLA2 board |
// |
// Purpose: The purpose of this file is to document an interface which |
// any device with a bus, whether it be implemented over a UART, |
22,7 → 22,7
// |
//////////////////////////////////////////////////////////////////////////////// |
// |
// Copyright (C) 2015-2016, Gisselquist Technology, LLC |
// Copyright (C) 2015, Gisselquist Technology, LLC |
// |
// This program is free software (firmware): you can redistribute it and/or |
// modify it under the terms of the GNU General Public License as published |
34,11 → 34,6
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with this program. (It's in the $(ROOT)/doc directory, run make with no |
// target there if the PDF file isn't present.) If not, see |
// <http://www.gnu.org/licenses/> for a copy. |
// |
// License: GPL, v3, as defined and found on www.gnu.org, |
// http://www.gnu.org/licenses/gpl.html |
// |