Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'patch-1' of https://github.com/jpbonn/milkymist into le…

…dmtrx
  • Loading branch information...
commit b903b25795c20fb335329d5cf570091eafd2216c 2 parents 978b8e2 + 1ca596d
@wpwrak wpwrak authored
View
17 Makefile
@@ -16,16 +16,16 @@ SW_DIRS=${SDK_DIRS} libhpdmc libfpvm libfpvm/x86-linux libfpvm/lm32-linux bios
CORE_DIRS=ac97 bt656cap conbus dmx fmlbrg fmlmeter hpdmc_ddr32 \
memcard pfpu rc5 softusb sysctl tmu2 uart vgafb
-host:
+tools:
make -C ${BASEDIR}/tools
-bios: host
+bios: tools
make -C ${BASEDIR}/software/bios
-bitstream: host
+bitstream: tools
make -C ${BASEDIR}/boards/${BOARD}/synthesis -f Makefile.${SYNTOOL}
-sdk: host
+sdk: tools
for d in $(SDK_DIRS); do make -C ${BASEDIR}/software/$$d || exit 1; done
load-bitstream: bitstream
@@ -35,7 +35,14 @@ docs:
make -C ${BASEDIR}/doc
for d in $(CORE_DIRS); do make -C ${BASEDIR}/cores/$$d/doc || exit 1; done
-.PHONY: clean load-bitstream
+sdk-install: sdk
+ make -C ${BASEDIR}/software/libfpvm install
+ make -C ${BASEDIR}/softusb-input install
+
+tools-install: tools
+ make -C ${BASEDIR}/tools install
+
+.PHONY: clean load-bitstream tools
clean:
make -C ${BASEDIR}/boards/milkymist-one/synthesis -f common.mak clean
make -C ${BASEDIR}/boards/milkymist-one/standby clean
View
65 README
@@ -10,13 +10,11 @@ For the latest releases, documentation, more information, or to buy a Milkymist
[> Directory Structure
/cores/ Cores library, with Verilog sources, test benches and documentation.
- /boards/ Top-level design files, constraint files and Makefiles
- for supported FPGA boards.
- /software/ Software for the SoC: libraries, bootloader and proof-of-concept renderer.
+ /boards/ Top-level design files, constraint files and glue logic.
+ /software/ Basic software for the SoC: libraries + BIOS.
/softusb-input/ AVR firmware to implement input device support on the softusb core.
/doc/ System documentation.
/tools/ Small tools for developers.
- /patches/ Example patches.
[> Building tools
@@ -45,9 +43,9 @@ loading over the serial line (SFL boot) is provided in the /tools/ directory.
[> Credits
-Most of the work is (C) Copyright 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq.
+Most of the work is (C) Copyright 2007-2012 Sebastien Bourdeauducq.
For this work:
- - The hardware design is licensed under GNU GPLv3.
+ - The gateware design is licensed under GNU GPLv3.
See the LICENSE.GPL file for more information.
- The software (software/*) is licensed under GNU GPLv3, except the SDRAM
initialization runtime (libHPDMC) which is under GNU LGPLv3.
@@ -64,15 +62,14 @@ The SoC design uses:
The directory organization and build scripts were inspired by soc-lm32 by the German
hackerspace Das Labor. Some of the UART and timer code also comes from there.
-The software and software library include:
- - the SoftFloat IEC/IEEE Floating-point Arithmetic Package, Release 2,
- written by John R. Hauser. See source files headers for license.
- - fundamental functions library by Jesus Calvino-Fraga. See the LICENSE.LGPL file.
- - line drawing code from the GD library. See the LICENSE.GD file.
+The software and software library include the SoftFloat IEC/IEEE Floating-point
+Arithmetic Package, Release 2, written by John R. Hauser.
+See source files headers for license.
Special thanks to the people who did significant things which made this project possible:
- Wolfgang Spraul and Adam Wang for the manufacturing,
- - Michael Walle for QEMU, UrJTAG and OpenOCD,
+ - Werner Almesberger for USB, MIDI and many other improvements,
+ - Michael Walle for QEMU, UrJTAG and OCD,
- Joachim Steiger for the case design,
- Yanjun Luo for the JTAG daughterboard design,
- Yann Sionneau for his work on RTEMS,
@@ -89,47 +86,3 @@ Special thanks to the people who did significant things which made this project
The mailing list devel at lists dot milkymist dot org is the preferred means of contact.
However, if you wish to contact privately the founder of this project:
E-mail: sebastien at milkymist daaht org
-Phone: +33(0)606644335
-PGP: 0x9277FCF2
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.9 (GNU/Linux)
-
-mQGiBEnPSIoRBADK2T3lN98btWazmH8Wz8YX6ZY38l9ouq5CgucTYWgljUTB6WMI
-P3LPAKjp+LpaeeHC3C9c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MZwCFMSDIhPBBgR
-AgAPBQJJz0iKAhsMBQkJZgGAAAoJEBYXL/WSd/zybSEAniuiaCR/7aYk94u06jiQ
-lRHoJGwiAJ9JnmgPtl71/XVNcFxNQqUxVTOvjg==
-=NnZi
------END PGP PUBLIC KEY BLOCK-----
View
2  boards/milkymist-one/rtl/system.v
@@ -923,7 +923,7 @@ sysctl #(
.ninputs(7),
.noutputs(2),
.clk_freq(`CLOCK_FREQUENCY),
- .systemid(32'h12004D31) /* 1.2.0 final (0) on M1 */
+ .systemid(32'h13004D31) /* 1.3.0 final (0) on M1 */
) sysctl (
.sys_clk(sys_clk),
.sys_rst(sys_rst),
View
2  boards/milkymist-one/synthesis/common.mak
@@ -18,7 +18,7 @@ load: $(BUILDDIR)/system.bit
# Sometimes different options are needed to meet timing
build/system.ncd: build/system.ngd
- cd build && map -ol high -t 2 -w system.ngd
+ cd build && map -ol high -t 20 -w system.ngd
build/system-routed.ncd: build/system.ncd
cd build && par -ol high -w system.ncd system-routed.ncd
View
13 cores/softusb/rtl/softusb.v
@@ -76,8 +76,11 @@ softusb_timer timer(
.io_do(io_dr_timer)
);
+wire [pmem_width-1:0] dbg_pc;
+
softusb_hostif #(
- .csr_addr(csr_addr)
+ .csr_addr(csr_addr),
+ .pmem_width(pmem_width)
) hostif (
.sys_clk(sys_clk),
.sys_rst(sys_rst),
@@ -93,7 +96,9 @@ softusb_hostif #(
.irq(irq),
.io_we(io_we),
- .io_a(io_a)
+ .io_a(io_a),
+
+ .dbg_pc(dbg_pc)
);
softusb_sie sie(
@@ -178,7 +183,9 @@ softusb_navre #(
.io_we(io_we),
.io_a(io_a),
.io_do(io_dw),
- .io_di(io_dr_sie|io_dr_timer)
+ .io_di(io_dr_sie|io_dr_timer),
+
+ .dbg_pc(dbg_pc)
);
endmodule
View
9 cores/softusb/rtl/softusb_hostif.v
@@ -16,7 +16,8 @@
*/
module softusb_hostif #(
- parameter csr_addr = 4'h0
+ parameter csr_addr = 4'h0,
+ parameter pmem_width = 12
) (
input sys_clk,
input sys_rst,
@@ -32,7 +33,9 @@ module softusb_hostif #(
output irq,
input io_we,
- input [5:0] io_a
+ input [5:0] io_a,
+
+ input [pmem_width-1:0] dbg_pc
);
wire csr_selected = csr_a[13:10] == csr_addr;
@@ -48,7 +51,7 @@ always @(posedge sys_clk) begin
if(csr_selected) begin
if(csr_we)
usb_rst0 <= csr_di[0];
- csr_do <= usb_rst0;
+ csr_do <= { dbg_pc, 1'b0 };
end
end
end
View
5 cores/softusb/rtl/softusb_navre.v
@@ -35,7 +35,9 @@ module softusb_navre #(
output reg io_we,
output [5:0] io_a,
output [7:0] io_do,
- input [7:0] io_di
+ input [7:0] io_di,
+
+ output reg [pmem_width-1:0] dbg_pc
);
/* Register file */
@@ -195,6 +197,7 @@ always @(posedge clk) begin
PC_SEL_Z: PC <= pZ - 1;
endcase
end
+ dbg_pc <= PC;
end
reg pmem_selz;
assign pmem_a = rst ?
View
6 cores/vgafb/rtl/vgafb_ctlif.v
@@ -88,9 +88,9 @@ always @(posedge sys_clk) begin
hscan <= 10'd799;
vres <= 10'd480;
- vsync_start <= 10'd491;
- vsync_end <= 10'd493;
- vscan <= 10'd523;
+ vsync_start <= 10'd492;
+ vsync_end <= 10'd494;
+ vscan <= 10'd524;
baseaddress <= {fml_depth{1'b0}};
View
28 softusb-input/Makefile
@@ -1,14 +1,32 @@
SOURCES=crt0.S main.c debug.c crc.c libc.c
+INCLUDES=comloc.h crc.h debug.h host.h io.h libc.h progmem.h sie.h timer.h
-all: softusb-input.bin
+.PHONY: all install upload clean
+
+all: softusb-input.h
+
+softusb-input.elf: $(SOURCES) $(INCLUDES)
+ avr-gcc -o $@ -mmcu=avr2 -mno-interrupts -Os \
+ -Wall -Wstrict-prototypes -Wmissing-prototypes \
+ -Wold-style-declaration -Wold-style-definition \
+ -Wno-char-subscripts \
+ $(SOURCES) $(CFLAGS) -nostdlib -Wl,-T -Wl,navre.ld
%.bin: %.elf
avr-objcopy -O binary $< $@
-softusb-input.elf: $(SOURCES) $(wildcard *.h)
- avr-gcc -o softusb-input.elf -mmcu=avr2 -mno-interrupts -Wall -Os $(SOURCES) $(CFLAGS) -nostdlib -Wl,-T -Wl,navre.ld
+softusb-input.h: softusb-input.bin
+ cat $< | xxd -i - $@
+
+install: softusb-input.h
+ test -n "$(RTEMS_MAKEFILE_PATH)"
+ mkdir -p $(RTEMS_MAKEFILE_PATH)/lib/include
+ cp $< $(RTEMS_MAKEFILE_PATH)/lib/include
-.PHONY: clean
+upload: softusb-input.bin
+ @[ "$(MM_HOST)" ] && [ "$(MM_USER)" ] && [ "$(MM_PW)" ] || \
+ { echo "please define MM_HOST, MM_USER, and MM_PW"; exit 1; }
+ ftp-upload --host $(MM_HOST) --user $(MM_USER) --password $(MM_PW) $<
clean:
- rm -f softusb-input.bin softusb-input.elf
+ rm -f softusb-input.elf softusb-input.bin softusb-input.h
View
5 softusb-input/debug.c
@@ -18,6 +18,7 @@
#include "progmem.h"
#include "host.h"
#include "comloc.h"
+#include "debug.h"
void print_char(char c)
{
@@ -59,13 +60,11 @@ void dump_hex(unsigned char *buf, unsigned char len)
} else {
for(i=0;i<len;i++) {
print_hex(buf[i]);
- if(((i & 0x0f) == 0) && (i != 0))
+ if((i & 0x0f) == 0xf)
print_char('\n');
else
print_char(' ');
}
- if(i & 0x0f)
- print_char('\n');
}
}
View
59 softusb-input/main.c
@@ -27,6 +27,11 @@
#include "host.h"
#include "crc.h"
+#define SETUP_DATA_RETRIES 250 /* <= 255 */
+#define SETUP_END_RETRIES 100 /* <= 255 */
+#define ENUM_RETRIES 4 /* <= 127 */
+#define ENUM_RESETS 3 /* <= 127 */
+
//#define TRIGGER
#ifdef TRIGGER
@@ -101,6 +106,7 @@ struct port_status {
char state;
char full_speed;
char retry_count;
+ char reset_count;
unsigned int unreset_frame;
unsigned char ep0_size;
struct ep_status keyboard;
@@ -298,7 +304,7 @@ static int usb_in(unsigned addr, unsigned char expected_data,
return 0;
timeout:
- print_string(timeout_error);
+// print_string(timeout_error);
return 0;
error:
@@ -347,6 +353,7 @@ static int control_transfer(unsigned char addr, struct setup_packet *p,
char rxlen;
char transferred;
char chunklen;
+ unsigned char retry;
/* generate SETUP token */
make_usb_token(USB_PID_SETUP, addr, setup);
@@ -371,6 +378,7 @@ static int control_transfer(unsigned char addr, struct setup_packet *p,
/* data phase */
transferred = 0;
+ retry = SETUP_DATA_RETRIES;
if(out) {
while(1) {
chunklen = maxlen - transferred;
@@ -384,9 +392,9 @@ static int control_transfer(unsigned char addr, struct setup_packet *p,
memcpy(&usb_buffer[1], payload, chunklen);
usb_crc16(&usb_buffer[1], chunklen, &usb_buffer[chunklen+1]);
rxlen = usb_out(addr, usb_buffer, chunklen+3);
- if(!rxlen)
+ if(!rxlen && retry--)
continue;
- if(rxlen < 0)
+ if(rxlen <= 0)
return -1;
expected_data = toggle(expected_data);
@@ -399,10 +407,10 @@ static int control_transfer(unsigned char addr, struct setup_packet *p,
while(transferred != maxlen) {
rxlen = usb_in(addr, expected_data, usb_buffer,
ep0_size+3);
- if(!rxlen)
+ if(!rxlen && retry--)
continue;
- if(rxlen <0)
- return rxlen;
+ if(rxlen <= 0)
+ return -1;
expected_data = toggle(expected_data);
chunklen = rxlen - 3; /* strip token and CRC */
@@ -417,12 +425,13 @@ static int control_transfer(unsigned char addr, struct setup_packet *p,
}
/* send IN/OUT token in the opposite direction to end transfer */
+ retry = SETUP_END_RETRIES;
retry:
if(out) {
rxlen = usb_in(addr, USB_PID_DATA1, usb_buffer, 11);
- if(!rxlen)
+ if(!rxlen && retry--)
goto retry;
- if(rxlen < 0)
+ if(rxlen <= 0)
return -1;
} else {
/* make DATA1 packet */
@@ -430,9 +439,9 @@ static int control_transfer(unsigned char addr, struct setup_packet *p,
usb_buffer[1] = usb_buffer[2] = 0x00; /* CRC is 0x0000 without data */
rxlen = usb_out(addr, usb_buffer, 3);
- if(!rxlen)
+ if(!rxlen && retry--)
goto retry;
- if(!rxlen < 0)
+ if(rxlen <= 0)
return -1;
}
@@ -544,6 +553,7 @@ static void check_discon(struct port_status *p, char name)
if(discon) {
print_string(disconnect); print_char(name); print_char('\n');
p->state = PORT_STATE_DISCONNECTED;
+ p->reset_count = 0;
p->keyboard.ep = p->mouse.ep = p->midi.ep = 0;
}
}
@@ -615,13 +625,22 @@ static void unsupported(struct port_status *p)
p->state = PORT_STATE_UNSUPPORTED;
}
-static const char retry_exceed[] PROGMEM = "Retry count exceeded, disabling device.\n";
+static const char retry_reset[] PROGMEM =
+ "Retry count exceeded, resetting device.\n";
+static const char retry_exceed[] PROGMEM =
+ "Retry count exceeded, disabling device.\n";
+
static void check_retry(struct port_status *p)
{
- if(p->retry_count++ > 4) {
- print_string(retry_exceed);
- p->state = PORT_STATE_UNSUPPORTED;
+ if(p->retry_count++ <= ENUM_RETRIES)
+ return;
+ if(p->reset_count++ <= ENUM_RESETS) {
+ print_string(retry_reset);
+ p->state = PORT_STATE_DISCONNECTED;
+ return;
}
+ print_string(retry_exceed);
+ p->state = PORT_STATE_UNSUPPORTED;
}
static const char vid[] PROGMEM = "VID: ";
@@ -829,17 +848,17 @@ static void port_service(struct port_status *p, char name)
static const char banner[] PROGMEM = "softusb-input v"VERSION"\n";
-static void sof()
+static void sof(void)
{
unsigned char mask;
unsigned char usb_buffer[3];
mask = 0;
#ifndef TRIGGER
- if(port_a.full_speed && (port_a.state > PORT_STATE_BUS_RESET))
+ if(port_a.full_speed && (port_a.state > PORT_STATE_RESET_WAIT))
mask |= 0x01;
#endif
- if(port_b.full_speed && (port_b.state > PORT_STATE_BUS_RESET))
+ if(port_b.full_speed && (port_b.state > PORT_STATE_RESET_WAIT))
mask |= 0x02;
if(mask != 0) {
wio8(SIE_TX_LOW_SPEED, 0);
@@ -849,7 +868,7 @@ static void sof()
}
}
-static void keepalive()
+static void keepalive(void)
{
unsigned char mask;
@@ -868,7 +887,7 @@ static void keepalive()
}
}
-static void set_rx_speed()
+static void set_rx_speed(void)
{
unsigned char mask;
@@ -878,7 +897,7 @@ static void set_rx_speed()
wio8(SIE_LOW_SPEED, mask);
}
-int main()
+int main(void)
{
unsigned char i;
View
2  softusb-input/navre.ld
@@ -4,7 +4,7 @@ OUTPUT_ARCH(avr:2)
MEMORY
{
text (rx) : ORIGIN = 0, LENGTH = 8K
- data (rw!x) : ORIGIN = 0, LENGTH = 32K
+ data (rw!x) : ORIGIN = 0, LENGTH = 8K
}
SECTIONS
{
View
5 software/include.mak
@@ -2,7 +2,10 @@
#
CROSS_COMPILER=lm32-rtems4.11-
+# Choose a compiler - gcc or clang
+#CC_normal := clang -march=mico32 -ccc-host-triple mico32-elf -ccc-gcc-name lm32-rtems4.11-gcc
CC_normal := $(CROSS_COMPILER)gcc
+
AR_normal := $(CROSS_COMPILER)ar
AS_normal := $(CROSS_COMPILER)as
LD_normal := $(CROSS_COMPILER)ld
@@ -35,7 +38,7 @@ endif
# Toolchain options
#
INCLUDES_NOLIBC ?= -nostdinc -I$(MMDIR)/software/include/base
-INCLUDES = $(INCLUDES_NOLIBC) -I$(MMDIR)/software/include -I$(MMDIR)/tools
+INCLUDES = $(INCLUDES_NOLIBC) -I$(MMDIR) -I$(MMDIR)/software/include -I$(MMDIR)/tools
ASFLAGS = $(INCLUDES) -nostdinc
# later: -Wmissing-prototypes
CFLAGS = -O9 -Wall -Wstrict-prototypes -Wold-style-definition -Wshadow \
View
2  software/include/base/version.h
@@ -1,6 +1,6 @@
#ifndef __VERSION_H
#define __VERSION_H
-#define VERSION "1.2"
+#define VERSION "1.3"
#endif /* __VERSION_H */
View
2  software/libbase/uart.c
@@ -48,6 +48,7 @@ static int force_sync;
void uart_isr(void)
{
unsigned int stat = CSR_UART_STAT;
+ CSR_UART_STAT = stat;
if(stat & UART_STAT_RX_EVT) {
rx_buf[rx_produce] = CSR_UART_RXTX;
@@ -62,7 +63,6 @@ void uart_isr(void)
tx_cts = 1;
}
- CSR_UART_STAT = stat;
irq_ack(IRQ_UART);
}
View
23 software/libfpvm/Makefile
@@ -4,7 +4,7 @@ include $(MMDIR)/software/include.mak
OBJECTS=fpvm.o gfpus.o lnfpus.o pfpu.o
-.PHONY: all clean depend install
+.PHONY: all clean install
all: libfpvm.a
@@ -18,27 +18,6 @@ install: all
mkdir -p $(RTEMS_MAKEFILE_PATH)/lib/include/fpvm
cp ../include/fpvm/* $(RTEMS_MAKEFILE_PATH)/lib/include/fpvm
-depend:
- makedepend -Y -- $(CFLAGS) -- *.c
-
clean:
rm -f $(OBJECTS) libfpvm.a
rm -f .*~ *~ Makefile.bak
-
-# DO NOT DELETE
-
-fpvm.o: ../../software/include/base/version.h
-fpvm.o: ../../software/include/fpvm/is.h ../../software/include/fpvm/fpvm.h
-fpvm.o: ../../software/include/fpvm/ast.h
-gfpus.o: ../../software/include/fpvm/is.h ../../software/include/fpvm/fpvm.h
-gfpus.o: ../../software/include/fpvm/ast.h ../../software/include/fpvm/pfpu.h
-gfpus.o: ../../software/include/fpvm/schedulers.h
-gfpus.o: ../../software/include/hw/pfpu.h ../../software/include/hw/common.h
-lnfpus.o: ../../software/include/fpvm/is.h ../../software/include/fpvm/fpvm.h
-lnfpus.o: ../../software/include/fpvm/ast.h
-lnfpus.o: ../../software/include/fpvm/pfpu.h
-lnfpus.o: ../../software/include/fpvm/schedulers.h
-lnfpus.o: ../../software/include/hw/pfpu.h ../../software/include/hw/common.h
-pfpu.o: ../../software/include/hw/pfpu.h ../../software/include/hw/common.h
-pfpu.o: ../../software/include/fpvm/fpvm.h ../../software/include/fpvm/is.h
-pfpu.o: ../../software/include/fpvm/ast.h ../../software/include/fpvm/pfpu.h
View
13 software/libhal/Makefile
@@ -5,19 +5,16 @@ OBJECTS=brd.o dmx.o font8x16.o mem.o pfpu.o snd.o time.o tmu.o ukb.o usb.o vga.o
all: libhal.a
-libhal.a: $(OBJECTS) softusb-input.h
+libhal.a: $(OBJECTS)
$(AR) clr libhal.a $(OBJECTS)
$(RANLIB) libhal.a
-$(MMDIR)/softusb-input/softusb-input.bin:
+$(MMDIR)/softusb-input/softusb-input.h:
$(MAKE) -C $(MMDIR)/softusb-input
-softusb-input.h: $(MMDIR)/softusb-input/softusb-input.bin
- cat $(MMDIR)/softusb-input/softusb-input.bin | xxd -i - softusb-input.h
-
.PHONY: clean depend $(MMDIR)/softusb-input/softusb-input.bin
-depend: softusb-input.h
+depend: $(MMDIR)/softusb-input/softusb-input.h
makedepend -Y -- $(CFLAGS) -- *.c
clean:
@@ -59,7 +56,7 @@ time.o: ../../software/include/base/stdlib.h
time.o: ../../software/include/base/irq.h ../../software/include/base/board.h
time.o: ../../software/include/hw/sysctl.h ../../software/include/hw/common.h
time.o: ../../software/include/hw/interrupts.h
-time.o: ../../software/include/hal/brd.h ../../software/include/hal/time.h
+time.o: ../../software/include/hal/time.h
tmu.o: ../../software/include/base/stdio.h
tmu.o: ../../software/include/base/stdlib.h ../../software/include/base/irq.h
tmu.o: ../../software/include/base/board.h
@@ -79,7 +76,7 @@ usb.o: ../../software/include/hw/interrupts.h
usb.o: ../../software/include/base/uart.h ../../software/include/base/irq.h
usb.o: ../../software/include/base/stdio.h
usb.o: ../../software/include/base/stdlib.h ../../software/include/hal/usb.h
-usb.o: input-comloc.h softusb-input.h
+usb.o: input-comloc.h ../../softusb-input/softusb-input.h
vga.o: ../../software/include/base/stdio.h
vga.o: ../../software/include/base/stdlib.h
vga.o: ../../software/include/base/string.h
View
5 software/libhal/usb.c
@@ -1,6 +1,6 @@
/*
* Milkymist SoC (Software)
- * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
+ * Copyright (C) 2007, 2008, 2009, 2010, 2012 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
#include "input-comloc.h"
static const unsigned char input_firmware[] = {
-#include "softusb-input.h"
+#include <softusb-input/softusb-input.h>
};
static int debug_enable;
@@ -173,4 +173,3 @@ void usb_isr(void)
keyboard_consume = (keyboard_consume + 1) & 0x07;
}
}
-
View
18 software/libhal/vga.c
@@ -276,9 +276,9 @@ void vga_set_mode(int mode)
CSR_VGA_HSYNC_END = 752;
CSR_VGA_HSCAN = 799;
CSR_VGA_VRES = 480;
- CSR_VGA_VSYNC_START = 491;
- CSR_VGA_VSYNC_END = 493;
- CSR_VGA_VSCAN = 523;
+ CSR_VGA_VSYNC_START = 492;
+ CSR_VGA_VSYNC_END = 494;
+ CSR_VGA_VSCAN = 524;
CSR_VGA_CLKSEL = 0;
break;
case VGA_MODE_800_600: // Pixel clock: 50MHz
@@ -289,9 +289,9 @@ void vga_set_mode(int mode)
CSR_VGA_HSYNC_END = 976;
CSR_VGA_HSCAN = 1040;
CSR_VGA_VRES = 600;
- CSR_VGA_VSYNC_START = 637;
- CSR_VGA_VSYNC_END = 643;
- CSR_VGA_VSCAN = 666;
+ CSR_VGA_VSYNC_START = 636;
+ CSR_VGA_VSYNC_END = 642;
+ CSR_VGA_VSCAN = 665;
CSR_VGA_CLKSEL = 1;
break;
case VGA_MODE_1024_768: // Pixel clock: 65MHz
@@ -302,9 +302,9 @@ void vga_set_mode(int mode)
CSR_VGA_HSYNC_END = 1184;
CSR_VGA_HSCAN = 1344;
CSR_VGA_VRES = 768;
- CSR_VGA_VSYNC_START = 771;
- CSR_VGA_VSYNC_END = 777;
- CSR_VGA_VSCAN = 806;
+ CSR_VGA_VSYNC_START = 772;
+ CSR_VGA_VSYNC_END = 778;
+ CSR_VGA_VSCAN = 807;
CSR_VGA_CLKSEL = 2;
break;
}
View
1  software/update_depend.sh
@@ -2,6 +2,5 @@
make -C libbase depend
make -C libhal depend
-make -C libfpvm depend
make -C libnet depend
make -C bios depend
View
4 tools/Makefile
@@ -10,8 +10,8 @@ makeraw: makeraw.c
$(CC) -O2 -Wall -s -o $@ $< -lgd
install: mkmmimg flterm
- cp mkmmimg /usr/bin
- cp flterm /usr/bin
+ install -d /usr/local/bin
+ install -m755 -t /usr/local/bin $^
.PHONY: clean install
View
11 tools/asm/pfpu
@@ -17,6 +17,11 @@
# -v display the whole session instea of just the results
#
+if [ -z "$MM_HOST" -o -z "$MM_USER" -o -z "$MM_PW" ]; then
+ echo "please define MM_HOST, MM_USER, and MM_PW" 1>&2
+ exit 1
+fi
+
reg="sed 's/^[^#]*# R[0-9]* = //'"
filter="sed '1,/^1:/d;q' | tr -d '\015'"
@@ -30,8 +35,8 @@ done
trap "rm -f _out$$" 0
./pfpuasm "$@" >_out$$ || exit
-nc -i 1 -C -t -v ${M1_HOST:-m1} telnet <<EOF 2>&1 | eval $filter
-${M1_USER:-foo}
-${M1_PW:-bar}
+nc -i 1 -C -t -v $MM_HOST telnet <<EOF 2>&1 | eval $filter
+$MM_USER
+$MM_PW
pfpu `eval $reg _out$$ | sed 's/#.*//' | tr '\012' ' '`
EOF
View
83 tools/flterm.c
@@ -35,6 +35,10 @@
#include <getopt.h>
#include <sfl.h>
+#ifdef __linux__
+#include <linux/serial.h>
+#endif
+
#define DEFAULT_KERNELADR (0x40000000)
#define DEFAULT_CMDLINEADR (0x41000000)
#define DEFAULT_INITRDADR (0x41002000)
@@ -375,7 +379,7 @@ static void gdb_process_packet(int infd, int outfd, int altfd)
}
static void do_terminal(char *serial_port,
- int doublerate, int gdb_passthrough,
+ int baud, int gdb_passthrough,
const char *kernel_image, unsigned int kernel_address,
const char *cmdline, unsigned int cmdline_address,
const char *initrd_image, unsigned int initrd_address,
@@ -390,6 +394,8 @@ static void do_terminal(char *serial_port,
struct pollfd fds[3];
int flags;
int rsp_pending = 0;
+ int c_cflag;
+ int custom_divisor;
/* Open and configure the serial port */
if(log_path != NULL) {
@@ -406,11 +412,41 @@ static void do_terminal(char *serial_port,
return;
}
+ custom_divisor = 0;
+ switch(baud) {
+ case 9600: c_cflag = B9600; break;
+ case 19200: c_cflag = B19200; break;
+ case 38400: c_cflag = B38400; break;
+ case 57600: c_cflag = B57600; break;
+ case 115200: c_cflag = B115200; break;
+ case 230400: c_cflag = B230400; break;
+ default:
+ c_cflag = B38400;
+ custom_divisor = 1;
+ break;
+ }
+
+#ifdef __linux__
+ if(custom_divisor) {
+ struct serial_struct serial_info;
+ ioctl(serialfd, TIOCGSERIAL, &serial_info);
+ serial_info.custom_divisor = serial_info.baud_base / baud;
+ serial_info.flags &= ~ASYNC_SPD_MASK;
+ serial_info.flags |= ASYNC_SPD_CUST;
+ ioctl(serialfd, TIOCSSERIAL, &serial_info);
+ }
+#else
+ if(custom_divisor) {
+ fprintf(stderr, "[FLTERM] baudrate not supported\n");
+ return;
+ }
+#endif
+
/* Thanks to Julien Schmitt (GTKTerm) for figuring out the correct parameters
* to put into that weird struct.
*/
tcgetattr(serialfd, &my_termios);
- my_termios.c_cflag = doublerate ? B230400 : B115200;
+ my_termios.c_cflag = c_cflag;
my_termios.c_cflag |= CS8;
my_termios.c_cflag |= CREAD;
my_termios.c_iflag = IGNPAR | IGNBRK;
@@ -535,7 +571,7 @@ static void do_terminal(char *serial_port,
enum {
OPTION_PORT,
OPTION_GDB_PASSTHROUGH,
- OPTION_DOUBLERATE,
+ OPTION_SPEED,
OPTION_DEBUG,
OPTION_KERNEL,
OPTION_KERNELADR,
@@ -563,9 +599,9 @@ static const struct option options[] = {
.val = OPTION_DEBUG
},
{
- .name = "double-rate",
- .has_arg = 0,
- .val = OPTION_DOUBLERATE
+ .name = "speed",
+ .has_arg = 1,
+ .val = OPTION_SPEED
},
{
.name = "kernel",
@@ -609,7 +645,7 @@ static const struct option options[] = {
static void print_usage()
{
- fprintf(stderr, "Serial boot program for Milkymist SoC - v. 2.2\n");
+ fprintf(stderr, "Serial boot program for Milkymist SoC - v. 2.3\n");
fprintf(stderr, "Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq\n");
fprintf(stderr, "Copyright (C) 2011 Michael Walle\n");
fprintf(stderr, "Copyright (C) 2004 MontaVista Software, Inc\n\n");
@@ -619,7 +655,7 @@ static void print_usage()
fprintf(stderr, "the Free Software Foundation, version 3 of the License.\n\n");
fprintf(stderr, "Usage: flterm --port <port>\n");
- fprintf(stderr, " [--double-rate] [--gdb-passthrough] [--debug]\n");
+ fprintf(stderr, " [--speed <speed>] [--gdb-passthrough] [--debug]\n");
fprintf(stderr, " [--kernel <kernel_image> [--kernel-adr <address>]]\n");
fprintf(stderr, " [--cmdline <cmdline> [--cmdline-adr <address>]]\n");
fprintf(stderr, " [--initrd <initrd_image> [--initrd-adr <address>]]\n");
@@ -634,7 +670,7 @@ int main(int argc, char *argv[])
{
int opt;
char *serial_port;
- int doublerate;
+ int baud;
int gdb_passthrough;
char *kernel_image;
unsigned int kernel_address;
@@ -648,7 +684,7 @@ int main(int argc, char *argv[])
/* Fetch command line arguments */
serial_port = NULL;
- doublerate = 0;
+ baud = 115200;
gdb_passthrough = 0;
kernel_image = NULL;
kernel_address = DEFAULT_KERNELADR;
@@ -667,8 +703,12 @@ int main(int argc, char *argv[])
free(serial_port);
serial_port = strdup(optarg);
break;
- case OPTION_DOUBLERATE:
- doublerate = 1;
+ case OPTION_SPEED:
+ baud = strtoul(optarg, &endptr, 0);
+ if(*endptr != 0) {
+ fprintf(stderr, "[FLTERM] Couldn't parse baudrate\n");
+ return 1;
+ }
break;
case OPTION_DEBUG:
debug = 1;
@@ -682,7 +722,10 @@ int main(int argc, char *argv[])
break;
case OPTION_KERNELADR:
kernel_address = strtoul(optarg, &endptr, 0);
- if(*endptr != 0) kernel_address = 0;
+ if(*endptr != 0) {
+ fprintf(stderr, "[FLTERM] Couldn't parse kernel address\n");
+ return 1;
+ }
break;
case OPTION_CMDLINE:
free(cmdline);
@@ -690,7 +733,10 @@ int main(int argc, char *argv[])
break;
case OPTION_CMDLINEADR:
cmdline_address = strtoul(optarg, &endptr, 0);
- if(*endptr != 0) cmdline_address = 0;
+ if(*endptr != 0) {
+ fprintf(stderr, "[FLTERM] Couldn't parse cmdline address\n");
+ return 1;
+ }
break;
case OPTION_INITRD:
free(initrd_image);
@@ -698,7 +744,10 @@ int main(int argc, char *argv[])
break;
case OPTION_INITRDADR:
initrd_address = strtoul(optarg, &endptr, 0);
- if(*endptr != 0) initrd_address = 0;
+ if(*endptr != 0) {
+ fprintf(stderr, "[FLTERM] Couldn't parse initrd address\n");
+ return 1;
+ }
break;
case OPTION_LOG:
free(log_path);
@@ -708,7 +757,7 @@ int main(int argc, char *argv[])
}
if(serial_port == NULL) {
- print_usage();
+ fprintf(stderr, "[FLTERM] No port given\n");
return 1;
}
@@ -722,7 +771,7 @@ int main(int argc, char *argv[])
tcsetattr(0, TCSANOW, &ntty);
/* Do the bulk of the work */
- do_terminal(serial_port, doublerate, gdb_passthrough,
+ do_terminal(serial_port, baud, gdb_passthrough,
kernel_image, kernel_address,
cmdline, cmdline_address,
initrd_image, initrd_address,
Please sign in to comment.
Something went wrong with that request. Please try again.