21 Commits

Author SHA1 Message Date
Matt Jenkins
ecdf678dac dual sramc 2014-08-27 21:45:25 +01:00
Matt Jenkins
d859d3b71d Imported dual sramc driver
This driver allows you to run two SRAMC devices side-by-side as two
separate rdisk devices.
2014-05-10 21:40:23 +01:00
Matt Jenkins
3409198544 Include new rdisk 2014-05-10 14:05:35 +01:00
Matt Jenkins
d6a6d80d6e Fixed parsing of partition data
The previous method of parsing the prepartition data didn't work right
when you had more than one device.  The new version first finds the
device entry and then parses the partitions from that point on.
2014-04-29 17:31:37 +01:00
Matt Jenkins
07b6681eef Improve configsys option parsing
Up until now all the options in the config system have only been
able to take one word (or one string with no spaces) as a parameter.
This update improves it so it takes everything after the = up until
the end of the line (or the first #) as the parameter.
2014-04-29 13:37:09 +01:00
Serge Vakulenko
1b15bcff49 Fixed bug in assembler: incorrect offset in LUI instruction. 2014-04-24 11:56:01 -07:00
Matt Jenkins
8d5a6f60b1 Merge pull request #15 from alexfru/master
Smaller C: Fix a benign typo
2014-04-22 11:15:46 +01:00
Alexey Frunze
bc98f62608 Fix a benign typo 2014-04-22 02:57:42 -07:00
Matt Jenkins
d3e8eefb58 Merge pull request #14 from alexfru/master
Improve variable initialization in Smaller C
2014-04-21 09:25:32 +01:00
Alexey Frunze
fd04710c23 Fix initialization
In the following
typedef struct S0 { char ac[4]; } T1;
int v26 = (int)&((T1*)0)->ac[3];
int v27 = &((T1*)0)->ac[3];
v27 should be initialized to 3 just as v26.
2014-04-21 01:08:49 -07:00
Alexey Frunze
a0a4e242e6 Improve variable initialization in Smaller C
Improvements:
- support initialization of multidimensional arrays
- support initialization of structures
- support initialization of structures and arrays inside functions
- support static inside functions

Notes:
- Only fully-bracketed (sic) initialization of arrays is supported.
- && and || have been partially replaced with & and | to slightly reduce
code size when self compiling for DOS using -seg16.
2014-04-20 20:59:47 -07:00
Matt Jenkins
557a7f6c8f Merge branch 'master' of github.com:RetroBSD/retrobsd 2014-04-20 20:24:33 +01:00
Matt Jenkins
a7d0838ea8 Created global version variable 2014-04-20 20:24:18 +01:00
Matt Jenkins
8577d7082d Merge pull request #12 from sevan/patch-3
Update README.md
2014-04-19 18:43:52 +01:00
Sevan Janiyan
e9ff914f88 Update README.md
On Mpide 0023-macosx-20130715 the path is /Applications/Mpide.app/Contents/Resources/Java/hardware/tools/avr
not
/Applications/Mpide.app/Contents/Resources/Java/hardware/tools
2014-04-19 18:40:07 +01:00
Matt Jenkins
3ac301cade Improved UECIDE compiler path handling 2014-04-19 18:33:40 +01:00
Matt Jenkins
aabc8d8702 Merge pull request #11 from sevan/patch-2
Update README.md
2014-04-19 18:26:29 +01:00
Matt Jenkins
122d7bc73e Merge pull request #10 from sevan/patch-1
Update Makefile
2014-04-19 18:26:19 +01:00
Sevan Janiyan
660b8c3814 Update README.md
Ties in with https://github.com/RetroBSD/retrobsd/pull/10
2014-04-19 16:19:25 +01:00
Sevan Janiyan
da4d3a3a8f Update Makefile
Add target to build MAX32 kernel with Ethernet Shield support
2014-04-19 15:46:33 +01:00
Matt Jenkins
b5a8255248 Changed %2 to %s in string format 2014-04-19 13:37:42 +01:00
13 changed files with 1522 additions and 1112 deletions

View File

@@ -12,6 +12,7 @@
# Supported boards # Supported boards
# #
MAX32 = sys/pic32/max32/MAX32 MAX32 = sys/pic32/max32/MAX32
MAX32-ETH = sys/pic32/max32-eth/MAX32-ETH
UBW32 = sys/pic32/ubw32/UBW32 UBW32 = sys/pic32/ubw32/UBW32
UBW32UART = sys/pic32/ubw32-uart/UBW32-UART UBW32UART = sys/pic32/ubw32-uart/UBW32-UART
UBW32UARTSDRAM = sys/pic32/ubw32-uart-sdram/UBW32-UART-SDRAM UBW32UARTSDRAM = sys/pic32/ubw32-uart-sdram/UBW32-UART-SDRAM

View File

@@ -40,6 +40,7 @@ TARGET = $(MAXCOLOR) # for the Colour Maximite board
TARGET = $(EXPLORER16) # for the Explorer 16 board TARGET = $(EXPLORER16) # for the Explorer 16 board
TARGET = $(STARTERKIT) # for the PIC32 USB or Ethernet Starter Kit TARGET = $(STARTERKIT) # for the PIC32 USB or Ethernet Starter Kit
TARGET = $(MAX32) # default TARGET = $(MAX32) # default
TARGET = $(MAX32-ETH) # for the chipKIT MAX32 board with Arduino Ethernet shield
TARGET = $(DUINOMITE) # for the Duinomite board with USB console TARGET = $(DUINOMITE) # for the Duinomite board with USB console
TARGET = $(DUINOMITEUART) # for the Duinomite board with UART console TARGET = $(DUINOMITEUART) # for the Duinomite board with UART console
TARGET = $(DUINOMITEE) # for the Duinomite E board with USB console TARGET = $(DUINOMITEE) # for the Duinomite E board with USB console
@@ -89,7 +90,7 @@ on a board used.
#### Max32 board: #### Max32 board:
```shell ```shell
$ cd sys/pic32/ubw32 $ cd sys/pic32/ubw32
$ AVRTOOLS=/Applications/Mpide.app/Contents/Resources/Java/hardware/tools $ AVRTOOLS=/Applications/Mpide.app/Contents/Resources/Java/hardware/tools/avr
$AVRTOOLS/bin/avrdude -C$AVRTOOLS/etc/avrdude.conf -c stk500v2 -p pic32 \ $AVRTOOLS/bin/avrdude -C$AVRTOOLS/etc/avrdude.conf -c stk500v2 -p pic32 \
-P /dev/tty.usbserial-* -b 115200 -v -U flash:w:unix.hex:i -P /dev/tty.usbserial-* -b 115200 -v -U flash:w:unix.hex:i
``` ```

View File

@@ -522,7 +522,7 @@ void startup ()
int fd = mkstemp (tfilename); int fd = mkstemp (tfilename);
if (fd == -1) { if (fd == -1) {
uerror ("cannot create temporary file %2", tfilename); uerror ("cannot create temporary file %s", tfilename);
} else { } else {
close(fd); close(fd);
} }
@@ -1592,13 +1592,15 @@ foff16: expr_flags = 0;
opcode |= offset & 0xffff; opcode |= offset & 0xffff;
break; break;
case FHIGH16: /* high 16-bit byte address */ case FHIGH16: /* high 16-bit byte address */
if (relinfo.flags != RABS) { if (expr_flags & EXPR_HI) {
/* %hi function - assume signed offset */ /* %hi function - assume signed offset */
relinfo.flags |= (expr_flags & EXPR_HI) ? RHIGH16S : RHIGH16; relinfo.flags |= RHIGH16S;
relinfo.offset = offset & 0xffff; relinfo.offset = offset & 0xffff;
offset += 0x8000; offset += 0x8000;
opcode |= offset >> 16;
} else {
opcode |= offset & 0xffff;
} }
opcode |= offset >> 16;
break; break;
case FOFF18: /* 18-bit PC-relative word address */ case FOFF18: /* 18-bit PC-relative word address */
case FAOFF18: case FAOFF18:

View File

@@ -61,7 +61,7 @@ $Binits.o: inits.c; $(CC) $(CFLAGS) -c -I. -o $@ $<
$Binput.o: input.c; $(CC) $(CFLAGS) -c -I. -o $@ $< $Binput.o: input.c; $(CC) $(CFLAGS) -c -I. -o $@ $<
$Blex.o: lex.c; $(CC) $(CFLAGS) -c -I. -o $@ $< $Blex.o: lex.c; $(CC) $(CFLAGS) -c -I. -o $@ $<
$Blist.o: list.c; $(CC) $(CFLAGS) -c -I. -o $@ $< $Blist.o: list.c; $(CC) $(CFLAGS) -c -I. -o $@ $<
$Bmain.o: main.c; $(CC) $(CFLAGS) -DVERSION=\"`svnversion`\" -c -I. -o $@ $< $Bmain.o: main.c; $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -I. -o $@ $<
$Bnull.o: null.c; $(CC) $(CFLAGS) -c -I. -o $@ $< $Bnull.o: null.c; $(CC) $(CFLAGS) -c -I. -o $@ $<
$Boutput.o: output.c; $(CC) $(CFLAGS) -c -I. -o $@ $< $Boutput.o: output.c; $(CC) $(CFLAGS) -c -I. -o $@ $<
$Bprof.o: prof.c; $(CC) $(CFLAGS) -c -I. -o $@ $< $Bprof.o: prof.c; $(CC) $(CFLAGS) -c -I. -o $@ $<

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@ always
file rd_sramc.o file rd_sramc.o
require rdisk require rdisk
define SRAMC_ENABLED YES define SRAMC_ENABLED YES
define SRAMC%0_ENABLED YES
end always end always
option data option data

View File

@@ -6,7 +6,7 @@ S = ../../../tools/configsys/../../sys/kernel
vpath %.c $(M):$(S) vpath %.c $(M):$(S)
vpath %.S $(M):$(S) vpath %.S $(M):$(S)
KERNOBJ += _startup.o adc.o clock.o cons.o devsw.o exception.o glcd.o gpio.o init_main.o init_sysent.o kern_clock.o kern_descrip.o kern_exec.o kern_exit.o kern_fork.o kern_mman.o kern_proc.o kern_prot.o kern_prot2.o kern_resource.o kern_sig.o kern_sig2.o kern_subr.o kern_synch.o kern_sysctl.o kern_time.o machdep.o mem.o oc.o rd_sd.o rdisk.o signal.o spi_bus.o subr_prf.o subr_rmap.o swap.o sys_generic.o sys_inode.o sys_pipe.o sys_process.o syscalls.o sysctl.o tty.o tty_subr.o tty_tty.o ufs_alloc.o ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_mount.o ufs_namei.o ufs_subr.o ufs_syscalls.o ufs_syscalls2.o usb_device.o usb_function_cdc.o usb_uart.o vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o KERNOBJ += _startup.o adc.o clock.o cons.o devsw.o exception.o gpio.o init_main.o init_sysent.o kern_clock.o kern_descrip.o kern_exec.o kern_exit.o kern_fork.o kern_mman.o kern_proc.o kern_prot.o kern_prot2.o kern_resource.o kern_sig.o kern_sig2.o kern_subr.o kern_synch.o kern_sysctl.o kern_time.o machdep.o mem.o oc.o rd_sd.o rd_sramc.o rdisk.o signal.o spi.o spi_bus.o subr_prf.o subr_rmap.o swap.o sys_generic.o sys_inode.o sys_pipe.o sys_process.o syscalls.o sysctl.o tty.o tty_subr.o tty_tty.o uart.o ufs_alloc.o ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_mount.o ufs_namei.o ufs_subr.o ufs_syscalls.o ufs_syscalls2.o vers.o vfs_vnops.o vm_sched.o vm_swap.o vm_swp.o
EXTRA_TARGETS = bootloader EXTRA_TARGETS = bootloader
DEFS += -DADC_ENABLED=YES DEFS += -DADC_ENABLED=YES
@@ -16,11 +16,11 @@ DEFS += -DBL_CRYSTAL=8
DEFS += -DBL_LED_PIN=5 DEFS += -DBL_LED_PIN=5
DEFS += -DBL_LED_PORT=TRISE DEFS += -DBL_LED_PORT=TRISE
DEFS += -DBUS_DIV=1 DEFS += -DBUS_DIV=1
DEFS += -DBUS_KHZ=80000 DEFS += -DBUS_KHZ=120000
DEFS += -DCONSOLE_DEVICE=ttyUSB0 DEFS += -DCONSOLE_DEVICE=tty1
DEFS += -DCPU_IDIV=2 DEFS += -DCPU_IDIV=1
DEFS += -DCPU_KHZ=80000 DEFS += -DCPU_KHZ=120000
DEFS += -DCPU_MUL=20 DEFS += -DCPU_MUL=15
DEFS += -DCPU_ODIV=1 DEFS += -DCPU_ODIV=1
DEFS += -DCRYSTAL=8 DEFS += -DCRYSTAL=8
DEFS += -DDC0_DEBUG=DEVCFG0_DEBUG_DISABLED DEFS += -DDC0_DEBUG=DEVCFG0_DEBUG_DISABLED
@@ -35,8 +35,8 @@ DEFS += -DDC1_POSCMOD=DEVCFG1_POSCMOD_HS
DEFS += -DDC1_SOSC=0 DEFS += -DDC1_SOSC=0
DEFS += -DDC1_WDTEN=0 DEFS += -DDC1_WDTEN=0
DEFS += -DDC1_WDTPS=DEVCFG1_WDTPS_1 DEFS += -DDC1_WDTPS=DEVCFG1_WDTPS_1
DEFS += -DDC2_PLLIDIV=DEVCFG2_FPLLIDIV_2 DEFS += -DDC2_PLLIDIV=DEVCFG2_FPLLIDIV_1
DEFS += -DDC2_PLLMUL=DEVCFG2_FPLLMUL_20 DEFS += -DDC2_PLLMUL=DEVCFG2_FPLLMUL_15
DEFS += -DDC2_PLLODIV=DEVCFG2_FPLLODIV_1 DEFS += -DDC2_PLLODIV=DEVCFG2_FPLLODIV_1
DEFS += -DDC2_UPLL=0 DEFS += -DDC2_UPLL=0
DEFS += -DDC2_UPLLIDIV=DEVCFG2_UPLLIDIV_2 DEFS += -DDC2_UPLLIDIV=DEVCFG2_UPLLIDIV_2
@@ -48,7 +48,6 @@ DEFS += -DDC3_USBID=DEVCFG3_FUSBIDIO
DEFS += -DDC3_USERID=0xffff DEFS += -DDC3_USERID=0xffff
DEFS += -DDC3_VBUSON=DEVCFG3_FVBUSONIO DEFS += -DDC3_VBUSON=DEVCFG3_FVBUSONIO
DEFS += -DFLASH_JUMP=0x9d000000 DEFS += -DFLASH_JUMP=0x9d000000
DEFS += -DGLCD_ENABLED=YES
DEFS += -DGPIO_ENABLED=YES DEFS += -DGPIO_ENABLED=YES
DEFS += -DHID_FEATURE_REPORT_BYTES=2 DEFS += -DHID_FEATURE_REPORT_BYTES=2
DEFS += -DHID_INPUT_REPORT_BYTES=2 DEFS += -DHID_INPUT_REPORT_BYTES=2
@@ -56,24 +55,36 @@ DEFS += -DHID_INT_IN_EP_SIZE=64
DEFS += -DHID_INT_OUT_EP_SIZE=64 DEFS += -DHID_INT_OUT_EP_SIZE=64
DEFS += -DHID_OUTPUT_REPORT_BYTES=2 DEFS += -DHID_OUTPUT_REPORT_BYTES=2
DEFS += -DHID_RPT01_SIZE=29 DEFS += -DHID_RPT01_SIZE=29
DEFS += -DHZ=1000
DEFS += -DKERNEL DEFS += -DKERNEL
DEFS += -DLED_KERNEL_PIN=5 DEFS += -DLED_KERNEL_PIN=5
DEFS += -DLED_KERNEL_PORT=TRISE DEFS += -DLED_KERNEL_PORT=TRISE
DEFS += -DNBUF=8
DEFS += -DNMOUNT=3
DEFS += -DNPROC=25
DEFS += -DOC_ENABLED=YES DEFS += -DOC_ENABLED=YES
DEFS += -DPARTITION="sramc0:sa@2048,fs@6140"
DEFS += -DPIC32MX7 DEFS += -DPIC32MX7
DEFS += -DSD0_CS_PIN=9 DEFS += -DSD0_CS_PIN=9
DEFS += -DSD0_CS_PORT=TRISG DEFS += -DSD0_CS_PORT=TRISG
DEFS += -DSD0_MHZ=20
DEFS += -DSD0_PORT=2 DEFS += -DSD0_PORT=2
DEFS += -DUARTUSB_ENABLED=YES DEFS += -DSPI_ENABLED=YES
DEFS += -DSRAMC0_ENABLED=YES
DEFS += -DSRAMC_ENABLED=YES
DEFS += -DUART1_BAUD=115200
DEFS += -DUART1_ENABLED=YES
DEFS += -DUART2_BAUD=115200
DEFS += -DUART2_ENABLED=YES
DEFS += -DUCB_METER DEFS += -DUCB_METER
DEFS += -DUSB_EP0_BUFF_SIZE=8 DEFS += -DUSB_EP0_BUFF_SIZE=8
DEFS += -DUSB_MAX_EP_NUMBER=3 DEFS += -DUSB_MAX_EP_NUMBER=1
DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3 DEFS += -DUSB_NUM_STRING_DESCRIPTORS=3
LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader.ld LDSCRIPT = ../../../tools/configsys/../../sys/pic32/cfg/bootloader.ld
CONFIG = FUBARINO CONFIG = FUBARINO-UART2CONS-UART1-SRAMC
CONFIGPATH = ../../../tools/configsys CONFIGPATH = ../../../tools/configsys
include ../../../tools/configsys/../../sys/pic32/kernel-post.mk include ../../../tools/configsys/../../sys/pic32/kernel-post.mk

View File

@@ -1,7 +1,7 @@
# chipKIT PIC32 compiler from UECIDE # chipKIT PIC32 compiler from UECIDE
ifdef UECIDE ifdef UECIDE
ifndef GCCPREFIX ifndef GCCPREFIX
GCCPREFIX = ${HOME}/.uecide/compilers/pic32-tools/bin/pic32- GCCPREFIX = ${UECIDE}/compilers/pic32-tools/bin/pic32-
LDFLAGS = -Wl,--oformat=elf32-tradlittlemips LDFLAGS = -Wl,--oformat=elf32-tradlittlemips
endif endif
endif endif

View File

@@ -3,6 +3,7 @@
* *
* This version is for 8MB RAMDISK v.1.1 and compatible * This version is for 8MB RAMDISK v.1.1 and compatible
* Pito 7.4.2014 - PIC32MX PMP bus version * Pito 7.4.2014 - PIC32MX PMP bus version
* Pito 28.4.2014 - Mod for 2 Units
* Under by retrobsd.org used Licence * Under by retrobsd.org used Licence
* No warranties of any kind * No warranties of any kind
* *
@@ -29,23 +30,29 @@
int sw_dkn = -1; /* Statistics slot number */ int sw_dkn = -1; /* Statistics slot number */
// Ramdisk v.1.1. wiring // 8MB Ramdisk v.1.1. wiring
// PMP RAMDISK // PMP RAMDISK
// =================== // ===================
// PMD<D0-D7> D0-D7 // PMD<D0-D7> D0-D7
// PMRD /RD // PMRD /RD
// PMWR /WR // PMWR /WR
// PMA<0> /DATA // PMA<0> /DATA
// PMA<1> 0-Unit0
// PMA<10> 0-Unit1
//#define NDATA (1<<0)
//#define UNIT0 (1<<1)
//#define UNIT1 (1<<10)
// RD and WR pulses duration settings // RD and WR pulses duration settings
// Minimal recommended settings, increase them when unstable // Minimal recommended settings, increase them when unstable
// No warranties of any kind // No warranties of any kind
// for 120MHz clock, 70ns PSRAM, Ramdisk v.1.1. // for 120MHz clock, 70ns PSRAM, 8MB Ramdisk v.1.1.
#define ADR_PULSE 1 #define ADR_PULSE 1
#define WR_PULSE 5 #define WR_PULSE 5
#define RD_PULSE 11 #define RD_PULSE 11
// for 80MHz clock, 70ns PSRAM, Ramdisk v.1.1. // for 80MHz clock, 70ns PSRAM, 8MB Ramdisk v.1.1.
//#define ADR_PULSE 1 //#define ADR_PULSE 1
//#define WR_PULSE 3 //#define WR_PULSE 3
//#define RD_PULSE 8 //#define RD_PULSE 8
@@ -61,35 +68,31 @@ int sw_dkn = -1; /* Statistics slot number */
//#define RD_PULSE 4 //#define RD_PULSE 4
typedef union { typedef union {
unsigned value; unsigned int value;
struct { struct {
unsigned nib1: 4; // lowest nibble unsigned nib1: 4; // lowest nibble
unsigned nib2: 4; unsigned nib2: 4;
unsigned nib3: 4; unsigned nib3: 4;
unsigned nib4: 4; unsigned nib4: 4;
unsigned nib5: 4; unsigned nib5: 4;
unsigned nib6: 4; unsigned nib6: 4;
unsigned nib7: 4; unsigned nib7: 4;
unsigned nib8: 4; // highest nibble unsigned nib8: 4; // highest nibble
}; };
} nybbles ; } nybbles;
/* /*
* Load the 24 bit address to Ramdisk. * Load the 24 bit address to Ramdisk.
* *
*/ */
inline static void inline static void dev_load_address (unsigned int addr)
dev_load_address (addr)
unsigned addr;
{ {
nybbles temp; nybbles temp;
temp.value = addr; temp.value = addr;
while(PMMODE & 0x8000); // Poll - if busy, wait while(PMMODE & 0x8000); // Poll - if busy, wait
PMADDR = 1; // set ADR mode (1) to write the Address
PMMODE = 0b10<<8 | (ADR_PULSE<<2); // full ADR speed PMMODE = 0b10<<8 | (ADR_PULSE<<2); // full ADR speed
PMDIN = temp.nib6; /* write 4 bits */ PMDIN = temp.nib6; /* write 4 bits */
@@ -108,7 +111,6 @@ dev_load_address (addr)
while(PMMODE & 0x8000); // Poll - if busy, wait while(PMMODE & 0x8000); // Poll - if busy, wait
PMDIN = temp.nib1; /* write 4 bits */ PMDIN = temp.nib1; /* write 4 bits */
} }
/* /*
@@ -117,64 +119,82 @@ dev_load_address (addr)
*/ */
int sramc_size ( int unit ) int sramc_size ( int unit )
{ {
return 8192; // 4096 for 4MB ramdisk int srsize;
switch (unit) {
case 0: srsize = 8192; break;
case 1: srsize = 8192; break;
}
return srsize;
} }
/* /*
* Read a block of data. * Read a block of data.
*/ */
inline int sramc_read (int unit, unsigned int blockno, char *data, unsigned int nbytes) inline int sramc_read (int unit, unsigned int blockno, register char *data, register unsigned int nbytes)
{ {
int i;
//DEBUG9("sramc%d: read block %u, length %u bytes, addr %p\n", //printf("sramc%d: rd blockno %u, nbytes %u, addr %p\n", unit, blockno, nbytes, data);
// major(dev), blockno, nbytes, data);
dev_load_address (blockno * DEV_BSIZE);
/* Read data. */
while(PMMODE & 0x8000); // Poll - if busy, wait while(PMMODE & 0x8000); // Poll - if busy, wait
PMADDR = 0; // set DATA mode (0) switch (unit) {
// set Unit address and ADDRESS mode (1)
case 0: PMADDR = 0b10000000001; break;
case 1: PMADDR = 0b00000000011; break;
}
dev_load_address (blockno * DEV_BSIZE);
while(PMMODE & 0x8000); // Poll - if busy, wait
PMMODE = 0b10<<8 | (RD_PULSE<<2); // read slowly PMMODE = 0b10<<8 | (RD_PULSE<<2); // read slowly
PMADDR = PMADDR & 0b10000000010; // set DATA mode
PMDIN; // Read the PMDIN to clear previous data and latch new data PMDIN; // Read the PMDIN to clear previous data and latch new data
for (i=0; i<nbytes; i++) { while (nbytes--) {
while(PMMODE & 0x8000); // Poll - if busy, wait before reading while(PMMODE & 0x8000); // Poll - if busy, wait before reading
*data++ = PMDIN; /* read a byte of data */ *data++ = PMDIN; /* read a byte of data */
} }
while(PMMODE & 0x8000); // Poll - if busy, wait
PMADDR = 0b10000000011; // deselect
return 1; return 1;
} }
/* /*
* Write a block of data. * Write a block of data.
*/ */
inline int sramc_write (int unit, unsigned int blockno, char *data, unsigned int nbytes) inline int sramc_write (int unit, unsigned int blockno, register char *data, register unsigned int nbytes)
{ {
unsigned i;
//DEBUG9("sramc%d: write block %u, length %u bytes, addr %p\n", //printf("sramc%d: wr blockno %u, nbytes %u , addr %p\n", unit, blockno, nbytes, data);
// major(dev), blockno, nbytes, data);
while(PMMODE & 0x8000); // Poll - if busy, wait
switch (unit) {
// set Unit address and ADDRESS mode (1)
case 0: PMADDR = 0b10000000001; break;
case 1: PMADDR = 0b00000000011; break;
}
dev_load_address (blockno * DEV_BSIZE); dev_load_address (blockno * DEV_BSIZE);
/* Write data. */
while (PMMODE & 0x8000); // Poll - if busy, wait while (PMMODE & 0x8000); // Poll - if busy, wait
PMADDR = 0; // set DATA mode (0)
PMMODE = 0b10<<8 | (WR_PULSE<<2); // faster with write PMMODE = 0b10<<8 | (WR_PULSE<<2); // faster with write
for (i=0; i<nbytes; i++) { PMADDR = PMADDR & 0b10000000010; // set DATA mode
while(PMMODE & 0x8000); // Poll - if busy, wait
PMDIN = (*data++); /* write a byte of data */
}
while(nbytes--) {
while(PMMODE & 0x8000); // Poll - if busy, wait
PMDIN = (*data++); /* write a byte of data*/
}
while(PMMODE & 0x8000); // Poll - if busy, wait
PMADDR = 0b10000000011; // deselect
return 1; return 1;
} }
@@ -184,6 +204,8 @@ inline int sramc_write (int unit, unsigned int blockno, char *data, unsigned int
*/ */
void sramc_init (int unit) void sramc_init (int unit)
{ {
// printf("ramdisk%d: init\n",unit);
struct buf *bp; struct buf *bp;
// Initialize PMP hardware // Initialize PMP hardware
@@ -196,31 +218,50 @@ void sramc_init (int unit)
// MODE WAITB WAITM WAITE // MODE WAITB WAITM WAITE
PMMODE = 0b10<<8 | 0 | (14<<2) | 0 ; // Mode2 Master 8bit PMMODE = 0b10<<8 | 0 | (14<<2) | 0 ; // Mode2 Master 8bit
PMAEN = 1; // PMA<0>, use A0 only PMAEN = 0b10000000011; // PMA<>, use A10,A1,A0
PMADDR = 0; // start with DATA mode PMADDR = 0b10000000010; // start with DATA mode
PMCONSET = 1<<15; // PMP enabled PMCONSET = 1<<15; // PMP enabled
asm volatile ("nop"); asm volatile ("nop");
// make a couple of dummy reads - it refreshes the cpld internals a little bit :) // make a couple of dummy reads - it refreshes the cpld internals a little bit :)
while(PMMODE & 0x8000); // Poll - if busy, wait before reading switch (unit) {
PMDIN; /* read a byte of data */
while(PMMODE & 0x8000); // Poll - if busy, wait before reading case 0: PMADDR = 0b10000000000; // start with DATA mode
PMDIN; /* read a byte of data */ while(PMMODE & 0x8000); // Poll - if busy, wait before reading
PMDIN; /* read a byte of data */
while(PMMODE & 0x8000); // Poll - if busy, wait before reading
PMDIN; /* read a byte of data */
bp = prepartition_device("sramc0");
PMADDR = 1; // go with with ADDRESS mode now if(bp) {
DEBUG3("sramc%d: init done\n",unit);
bp = prepartition_device("sramc0");
if(bp)
{
sramc_write(0, 0, bp->b_addr, 512); sramc_write(0, 0, bp->b_addr, 512);
brelse(bp); brelse(bp);
} }
// printf("sramc%d: init done\n",unit);
break;
return;
case 1: PMADDR = 0b00000000010; // start with DATA mode
while(PMMODE & 0x8000); // Poll - if busy, wait before reading
PMDIN; /* read a byte of data */
while(PMMODE & 0x8000); // Poll - if busy, wait before reading
PMDIN; /* read a byte of data */
bp = prepartition_device("sramc1");
if(bp) {
sramc_write(1, 0, bp->b_addr, 512);
brelse(bp);
}
// printf("sramc%d: init done\n",unit);
break;
}
while(PMMODE & 0x8000); // Poll - if busy, wait
PMADDR = 0b10000000011; // go with with ADDRESS mode
} }
/* /*
@@ -228,6 +269,6 @@ void sramc_init (int unit)
*/ */
int sramc_open (int unit) int sramc_open (int unit)
{ {
DEBUG3("sramc%d: open\n",unit); // printf("sramc%d: open done\n",unit);
return 0; return 0;
} }

View File

@@ -44,12 +44,16 @@ int spi_open(unsigned int bus, unsigned int *tris, unsigned int pin)
case 2: case 2:
spi_devices[dno].bus = (struct spireg *)&SPI2CON; spi_devices[dno].bus = (struct spireg *)&SPI2CON;
break; break;
#ifdef SPI3CON
case 3: case 3:
spi_devices[dno].bus = (struct spireg *)&SPI3CON; spi_devices[dno].bus = (struct spireg *)&SPI3CON;
break; break;
#endif
#ifdef SPI4CON
case 4: case 4:
spi_devices[dno].bus = (struct spireg *)&SPI4CON; spi_devices[dno].bus = (struct spireg *)&SPI4CON;
break; break;
#endif
default: default:
return -1; return -1;
} }
@@ -624,11 +628,14 @@ char *spi_name(int dno)
if(spi_devices[dno].bus == (struct spireg *)&SPI2CON) if(spi_devices[dno].bus == (struct spireg *)&SPI2CON)
return "SPI2"; return "SPI2";
#ifdef SPI3CON
if(spi_devices[dno].bus == (struct spireg *)&SPI3CON) if(spi_devices[dno].bus == (struct spireg *)&SPI3CON)
return "SPI3"; return "SPI3";
#endif
#ifdef SPI4CON
if(spi_devices[dno].bus == (struct spireg *)&SPI4CON) if(spi_devices[dno].bus == (struct spireg *)&SPI4CON)
return "SPI4"; return "SPI4";
#endif
return "SPI?"; return "SPI?";
} }

View File

@@ -1,12 +1,15 @@
MACHINE = mips MACHINE = mips
DESTDIR ?= $(TOPSRC) DESTDIR ?= $(TOPSRC)
RELEASE = 0.0
BUILD = $(shell git rev-list HEAD --count)
VERSION = $(RELEASE)-$(BUILD)
# chipKIT PIC32 compiler from UECIDE # chipKIT PIC32 compiler from UECIDE
ifdef UECIDE ifdef UECIDE
ifndef GCCPREFIX ifndef GCCPREFIX
GCCPREFIX = ${HOME}/.uecide/compilers/pic32-tools/bin/pic32- GCCPREFIX = ${UECIDE}/compilers/pic32-tools/bin/pic32-
LDFLAGS = -Wl,--oformat=elf32-tradlittlemips LDFLAGS = -Wl,--oformat=elf32-tradlittlemips
INCLUDES = -I${HOME}/.uecide/compilers/pic32-tools/lib/gcc/pic32mx/4.5.1/include INCLUDES = -I${UECIDE}/compilers/pic32-tools/lib/gcc/pic32mx/4.5.1/include
endif endif
endif endif

View File

@@ -160,11 +160,19 @@ bool config::load(const char *filename)
pos = temp.find("="); pos = temp.find("=");
if(pos>0) if(pos>0)
{ {
stringstream data;
string l,r; string l,r;
l = temp.substr(0,pos); l = temp.substr(0,pos);
uc(l); uc(l);
r = temp.substr(pos+1,temp.size()); r = temp.substr(pos+1,temp.size());
this->instances["GLOBAL"].settings[l] = r; data << r;
while (in >> temp) {
if (temp[0] == '#') {
break;
}
data << " " << temp;
}
this->instances["GLOBAL"].settings[l] = data.str();
this->instances["GLOBAL"].device="GLOBAL"; this->instances["GLOBAL"].device="GLOBAL";
this->instances["GLOBAL"].unit=0; this->instances["GLOBAL"].unit=0;
} }