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 12
- ↔ Reverse comparison
Rev 11 → Rev 12
/buildsamples.cpp
0,0 → 1,103
//////////////////////////////////////////////////////////////////////////////// |
// |
// Filename: buildsamples.cpp |
// |
// Project: CMod S6 System on a Chip, ZipCPU demonstration project |
// |
// Purpose: |
// |
// Creator: Dan Gisselquist, Ph.D. |
// Gisselquist Technology, LLC |
// |
//////////////////////////////////////////////////////////////////////////////// |
// |
// Copyright (C) 2015-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 |
// by the Free Software Foundation, either version 3 of the License, or (at |
// your option) any later version. |
// |
// This program is distributed in the hope that it will be useful, but WITHOUT |
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or |
// 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 |
// |
// |
//////////////////////////////////////////////////////////////////////////////// |
// |
// |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
|
#define SLEN 512 |
#define ILEN (SLEN/2) |
|
int main(int argc, char **argv) { |
FILE *fp, *legal; |
|
char cbuf[SLEN]; |
short sbuf[SLEN]; |
int nread = 0, nr; |
|
fp = fopen(argv[1], "rb"); |
if (!fp) { |
fprintf(stderr, "Could not open %s for reading\n", argv[1]); |
exit(EXIT_FAILURE); |
} |
|
/* |
legal = fopen("../legal.txt", "r"); |
if (!legal) |
legal = fopen("../../legal.txt", "r"); |
*/ |
legal = NULL; |
if (legal) { |
while(fgets(cbuf, SLEN, legal)) { |
if (strncmp(cbuf, "// Filename:", 12)==0) |
printf("// Filename:\tsamples.c\n"); |
else printf("%s", cbuf); |
} fclose(legal); |
} else { |
printf("// This file should be copyrighted but I can't find\n"); |
printf("// the copyright statement.\n//\n"); |
} |
|
printf( |
"// This file is computer generated--DO NOT EDIT IT! The generator file can\n" |
"// be found in trunk/sw/host/%s\n" |
"//\n" |
"//\n" |
"#ifndef\tSOUND_DATA_H\n" |
"#define\tSOUND_DATA_H\n\n" |
"const\tint\tsound_data[] = {\n", __FILE__); |
|
while((nr = fread(sbuf, sizeof(short), SLEN, fp))>0) { |
int pos = 0; |
nread += nr; |
while(pos < nr) { |
printf("\t"); |
for(int i=0; (pos<((nr+1)&-2))&&(i<8); i+=2) { |
int iv = (sbuf[pos]<<16)|(sbuf[pos+1] & 0x0ffff); |
printf("0x%08x, ", iv); |
pos+=2; |
} printf("\n"); |
} |
} printf("\t0\n};\n"); |
|
printf("\n\n" |
"#define\tNSAMPLES\t%d\n" |
"#define\tNSAMPLE_WORDS\t%d\n" |
"\n\n#endif\n", nread, 1+((nread+1)>>1)); |
|
} |
|
/regdefs.h
114,9 → 114,9
// 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 ISPIF_EN 0x88000800 // Enable SPI Flash interrupts |
#define ISPIF_DIS 0x08000000 // Disable SPI Flash interrupts |
#define ISPIF_CLR 0x08000800 // Clear pending SPI Flash interrupt |
|
// Flash control constants |
#define ERASEFLAG 0x80000000 |
/Makefile
1,5 → 1,45
################################################################################ |
## |
## Filename: Makefile (sw/host) |
## |
## Project: CMod S6 System on a Chip, ZipCPU demonstration project |
## |
## Purpose: Supports the building of the various host (i.e. PC) software |
## that will be used to support the Cmod S6 board. None of this |
## software will actually run on the board, but it may be used for |
## communicating with and configuring the board. |
## |
## Creator: Dan Gisselquist, Ph.D. |
## Gisselquist Technology, LLC |
## |
################################################################################ |
## |
## Copyright (C) 2015-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 |
## by the Free Software Foundation, either version 3 of the License, or (at |
## your option) any later version. |
## |
## This program is distributed in the hope that it will be useful, but WITHOUT |
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or |
## 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 |
## |
## |
################################################################################ |
## |
## |
all: |
PROGRAMS := wbregs readflash zipload |
PROGRAMS := wbregs readflash zipload buildsamples |
all: $(PROGRAMS) |
|
CXX := g++ |
31,6 → 71,9
zipload: $(OBJDIR)/zipload.o $(OBJDIR)/flashdrvr.o $(BUSOBJS) |
$(CXX) $(CFLAGS) $^ $(LIBS) -lelf -o $@ |
|
buildsamples: buildsamples.cpp |
$(CXX) $(CFLAGS) $^ -o $@ |
|
define build-depends |
@echo "Building dependency file(s)" |
@$(CXX) $(CFLAGS) -MM $(SOURCES) $(BUSSRCS) > $(OBJDIR)/xdepends.txt |