URL
https://opencores.org/ocsvn/eco32/eco32/trunk
Subversion Repositories eco32
Compare Revisions
- This comparison shows the changes necessary to convert path
/eco32/trunk
- from Rev 231 to Rev 232
- ↔ Reverse comparison
Rev 231 → Rev 232
/disk/tools/fs-EOS32/mkfs/root.fsys
16,6 → 16,7
dmpmbr.bin ---644 2 1 ../../stdalone/dmpmbr.bin |
mkpart.bin ---644 2 1 ../../stdalone/mkpart.bin |
shpart.bin ---644 2 1 ../../stdalone/shpart.bin |
dactest.bin ---644 2 1 ../../stdalone/dactest.bin |
eos32.bin ---644 2 1 ../../../os-bin/EOS32/eos32.bin |
$ |
bin d--755 2 1 |
/stdalone/dactest/dactest.s
0,0 → 1,51
; |
; dactest.s -- play samples |
; |
|
.set dba,0xF0500000 ; DAC base address |
.set tos,0xC0020000 ; top of stack |
|
; get some addresses listed in the load map |
.export start |
.export main |
.export out |
|
; these labels are defined in the data file |
.import samples |
.import endsmpl |
|
; minimal execution environment |
start: |
add $29,$0,tos ; setup stack |
jal main ; do useful work |
start1: |
j start1 ; halt by looping |
|
; main program |
main: |
sub $29,$29,12 ; create stack frame |
stw $31,$29,0 ; save return register |
stw $16,$29,4 ; save register variable |
stw $17,$29,8 ; save register variable |
add $16,$0,samples ; pointer to samples |
add $17,$0,endsmpl ; pointer to end of samples |
loop: |
ldw $4,$16,0 ; get sample |
jal out ; output to DAC |
add $16,$16,4 ; bump pointer |
bne $16,$17,loop ; next sample |
stop: |
ldw $31,$29,0 ; restore return register |
ldw $16,$29,4 ; restore register variable |
add $29,$29,12 ; release stack frame |
jr $31 ; return |
|
; output a sample (2 * 16 bit) to the DAC |
out: |
add $8,$0,dba ; set I/O base address |
out1: |
ldw $9,$8,0 ; get DAC status |
and $9,$9,1 ; value needed? |
beq $9,$0,out1 ; no - wait |
stw $4,$8,0 ; send sample |
jr $31 ; return |
/stdalone/dactest/genbell.c
0,0 → 1,88
/* |
* genbell.c -- 2-operator bell sound |
*/ |
|
|
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <math.h> |
|
|
#define NUM_SEC 8 /* duration */ |
|
#define CLK 50000000 /* clock rate */ |
#define DIV 1024 /* clock divisor */ |
#define SAMPLE_RATE (CLK / DIV) /* in samples/sec */ |
|
#define PI M_PI |
|
|
void prolog(void) { |
printf("\t.export\tsamples\n"); |
printf("\t.export\tendsmpl\n"); |
printf("\n"); |
printf("samples:\n"); |
} |
|
|
void epilog(void) { |
printf("endsmpl:\n"); |
} |
|
|
void wrtsample(short sample) { |
static int n = 0; |
unsigned w = (((unsigned) sample << 16) & 0xFFFF0000) | |
(((unsigned) sample << 0) & 0x0000FFFF); |
if (n % 4 == 0) { |
printf("\t.word\t"); |
n = 0; |
} |
printf("0x%08X", w); |
if (n % 4 == 3) { |
printf("\n"); |
} else { |
printf(", "); |
} |
n++; |
} |
|
|
int main(int argc, char *argv[]) { |
double f0; |
int n, m; |
double a, alpha; |
double b, beta; |
double t; |
double modAmpl; |
double modulator; |
double carrAmpl; |
double carrier; |
short sample; |
int i; |
|
if (argc != 1) { |
printf("usage: %s\n", argv[0]); |
exit(1); |
} |
f0 = 49.0; |
n = 5; |
m = 7; |
a = 16000.0; |
alpha = 0.6140; |
b = 10.0; |
beta = 0.4605; |
prolog(); |
for (i = 0; i < NUM_SEC * SAMPLE_RATE; i++) { |
t = i * (1.0 / SAMPLE_RATE); |
modAmpl = b * exp(-beta * t); |
modulator = modAmpl * sin(2.0 * PI * m * f0 * t); |
carrAmpl = a * exp(-alpha * t); |
carrier = carrAmpl * sin(2.0 * PI * n * f0 * t + modulator); |
sample = floor(carrier + 0.5); |
wrtsample(sample); |
} |
epilog(); |
return 0; |
} |
/stdalone/dactest/Makefile
0,0 → 1,50
# |
# Makefile for "dactest", a program for testing the audio DAC |
# |
|
BUILD = ../../build |
|
SRC1 = dactest.s |
OBJ1 = dactest.o |
SRC2 = bell.s |
OBJ2 = bell.o |
BIN = dactest.bin |
MAP = dactest.map |
EXO = dactest.exo |
|
.PHONY: all install run clean |
|
all: $(BIN) $(EXO) |
|
install: $(BIN) $(EXO) |
mkdir -p $(BUILD)/stdalone |
cp $(BIN) $(BUILD)/stdalone |
cp $(MAP) $(BUILD)/stdalone |
cp $(EXO) $(BUILD)/stdalone |
|
run: $(BIN) |
$(BUILD)/bin/sim -i -t 1 -l $(BIN) -a 0x10000 |
|
$(EXO): $(BIN) |
$(BUILD)/bin/bin2exo -S2 0x10000 $(BIN) $(EXO) |
|
$(BIN): $(OBJ1) $(OBJ2) |
$(BUILD)/bin/ld -h -rc 0xC0010000 \ |
-m $(MAP) -o $(BIN) $(OBJ1) $(OBJ2) |
|
$(OBJ1): $(SRC1) |
$(BUILD)/bin/as -o $(OBJ1) $(SRC1) |
|
$(OBJ2): $(SRC2) |
$(BUILD)/bin/as -o $(OBJ2) $(SRC2) |
|
$(SRC2): genbell |
./genbell >$(SRC2) |
|
genbell: genbell.c |
gcc -m32 -g -Wall -o genbell genbell.c -lm |
|
clean: |
rm -f genbell $(SRC2) $(OBJ2) |
rm -f $(OBJ1) $(BIN) $(MAP) $(EXO) |
rm -f *~ |
/stdalone/Makefile
6,7 → 6,7
BUILD = ../build |
|
DIRS = hello hello2 bottles memsize memtest onetask twotasks-1 \ |
twotasks-2 dskchk dskchk2 wrtmbr dmpmbr mkpart shpart |
twotasks-2 dskchk dskchk2 wrtmbr dmpmbr mkpart shpart dactest |
|
.PHONY: all install clean |
|