Skip to content

Commit

Permalink
move files around
Browse files Browse the repository at this point in the history
  • Loading branch information
zwizwa committed Aug 3, 2014
1 parent 3ec94b9 commit 82e1e32
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 63 deletions.
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -38,8 +38,8 @@ all-modules: planet-version.txt

pic18:
$(RACO_MAKE) arm/arm.rkt
$(RACO_MAKE) pic18.rkt
$(RACO_MAKE) pic18-dtc.rkt
$(RACO_MAKE) pic18/pic18.rkt
$(RACO_MAKE) pic18/pic18-dtc.rkt
$(RACO_MAKE) pic18/sim.rkt
$(RACO_MAKE) live.rkt
$(RACO_MAKE) staaplc.rkt
Expand Down
5 changes: 4 additions & 1 deletion app/synth-1220-8.fm
Expand Up @@ -41,7 +41,10 @@ macro
: init-board
TRISB 1 low
TRISB 2 low ;
: application mainloop ;
: application
interpreter
\ mainloop
;
forth

load monitor-serial.f
Expand Down
15 changes: 10 additions & 5 deletions app/synth/core.f
Expand Up @@ -228,10 +228,11 @@

: isr
OSCF-flag ' fixed do-isr

OSC0-flag ' osc0 do-isr
OSC1-flag ' osc1 do-isr
OSC2-flag ' osc2 do-isr


reset \ fallthrough

Expand Down Expand Up @@ -282,21 +283,26 @@
\ the fixed rate interrupt by default runs at FOSC/256, which is 7812
\ Hz. this increments a 32bit timer that can be used for control
\ sync. use PER2 to set the frequency to FOSC/(PER2+1)


: fixed
dup WREG subwf \ 0 stc
dup tick0 ++!
dup tick1 ++!
dup tick2 ++!
tick3 ++! ;


tick3 ++!
fixed-tick invoke ; \ add custom RT clocked state machines

\ set fixed-tick after calling init-timers and before engine-on
2variable fixed-tick
: fixed-tick-reset
fixed-tick -> ;

\ enable everything except the global interrupt flags which are used
\ to switch the synth on/off

: init-timers
fixed-tick-reset

INTCON2 TMR0IP high \ TMR0: high priority
IPR1 TMR1IP high
Expand Down Expand Up @@ -368,7 +374,6 @@




\ FIXME: programming enables interrupts
: _engine-on
: engine-on
Expand Down
2 changes: 2 additions & 0 deletions live/comm-uart.rkt
Expand Up @@ -83,6 +83,8 @@

)





;; FIXME: re-enable pk2 support through external console interface.
Expand Down
6 changes: 3 additions & 3 deletions live/commands.rkt
Expand Up @@ -68,9 +68,9 @@
((2) (apply w args))
(else (error-wordsize))))

(define (>tw) (byte/word >t _>t))
(define (tw>) (byte/word t> _t>))
(define (s) (byte/word ts _ts))
(define (>tw a) (byte/word >t _>t a))
(define (tw>) (byte/word t> _t>))
(define (s) (byte/word ts _ts))

;; Print dictionaries
(define-values (code-words
Expand Down
31 changes: 15 additions & 16 deletions pic18/busuart.f
@@ -1,7 +1,7 @@
\ #lang staapl/pic18 \ -*- forth -*-
\ provide-all

\ master-slave half-duplex uart
\ master-slave half-duplex uart on RA4
\ single line with pullup resistor
\ master provides start bit and transmits 0xFF (all release) as idle / poll
\ slave syncs to start bit and can pull data bits low
Expand All @@ -10,12 +10,10 @@
staapl pic18/compose-macro
staapl pic18/route



macro
: tris TRISB 7 ;
: lat LATB 7 ;
: port PORTB 7 ;
: tris TRISA 4 ;
: lat LATA 4 ;
: port PORTA 4 ;
: LOW tris low ;
: HIZ tris high ;
: bit out . in . ;
Expand Down Expand Up @@ -52,18 +50,19 @@
\ Difference between master and slave is who generates the start bit.
\ Slave will sync on 1->0 edge and clock the machine 20 times.


macro
: tick | start |
: start LOW ; \ slave
\ : start HIZ ; \ slave
forth

: tick
state+ route
' start i nop \ start bit
byte \ out, in, repeated 8 times
HIZ nop \ stop bit

start nop \ start bit
byte \ out, in, repeated 8 times
HIZ nop \ stop bit
\ fallthrough
state-reset
start
tick ;
\ instantiate one of these
: tick-master ' LOW tick ;
: tick-slave ' HIZ tick ;
forth

2 changes: 1 addition & 1 deletion pic18/dtc-forth-unit.rkt
Expand Up @@ -3,7 +3,7 @@
"../macro.rkt"
"../label-sig.rkt"
"dtc.rkt"
(only-in "../pic18.rkt" ;; Tie into the full pic18 compiler.
(only-in "pic18.rkt" ;; Tie into the full pic18 compiler.
macro/<<
macro/dw>
label:allot
Expand Down
2 changes: 1 addition & 1 deletion pic18/lang.rkt
Expand Up @@ -10,7 +10,7 @@
(rename-out (pic18-module-begin #%module-begin))
(except-out (all-from-out racket/base) #%module-begin))

(require/provide "../pic18.rkt")
(require/provide "pic18.rkt")

;; PIC18 Forth use the normal Forth module compiler with a library
;; path set to find the appropriate .f files.
Expand Down
2 changes: 1 addition & 1 deletion pic18/live-dtc.rkt
Expand Up @@ -7,7 +7,7 @@
"../live.rkt" ;; toplevel interaction
"../code.rkt" ;; target code registry
"../port/ihex.rkt" ;; write-ihex
"../pic18-dtc.rkt" ;; pic18 dtc compiler
"pic18-dtc.rkt" ;; pic18 dtc compiler
)

;; Change outer interpreter to use on-target 16bit DTC.
Expand Down
2 changes: 1 addition & 1 deletion pic18/live.rkt
Expand Up @@ -7,6 +7,6 @@
"../live.rkt" ;; toplevel interaction
"../code.rkt" ;; target code registry
"../port/ihex.rkt" ;; write-ihex
"../pic18.rkt" ;; base language
"pic18.rkt" ;; base language
)

18 changes: 9 additions & 9 deletions pic18-dtc.rkt → pic18/pic18-dtc.rkt
Expand Up @@ -3,20 +3,20 @@
;; Threaded Forth for PIC18.

(require
"tools.rkt"
"ns.rkt"
"macro.rkt"
"../tools.rkt"
"../ns.rkt"
"../macro.rkt"
(only-in "pic18.rkt"
target-byte-address))

(require/provide
"../asm.rkt"
"asm.rkt"
"pic18/asm.rkt"
"pic18/dtc.rkt"
"pic18/double-math.rkt"
"coma/macro-forth.rkt"
"coma/macro-forth-sig.rkt"
"pic18/dtc-forth-unit.rkt")
"dtc.rkt"
"double-math.rkt"
"../coma/macro-forth.rkt"
"../coma/macro-forth-sig.rkt"
"dtc-forth-unit.rkt")

(provide
(all-defined-out)
Expand Down
40 changes: 20 additions & 20 deletions pic18-unlinked.rkt → pic18/pic18-unlinked.rkt
Expand Up @@ -4,54 +4,54 @@


(require
"tools.rkt")
"../tools.rkt")

(require/provide
"tools.rkt"
"../tools.rkt"

;; Concatenative macro languge.
"coma/macro.rkt"
"../coma/macro.rkt"


;; ASSEMBLER
"../asm.rkt"
"asm.rkt"
"pic18/asm.rkt"



;; LANGUAGE

;; Generic interfaces + implementations
"sig.rkt" ;; generic language
"../sig.rkt" ;; generic language

"coma/comma-unit.rkt" ;; comma^
"coma/code-unit.rkt" ;; code^
"control/control-unit.rkt" ;; control^
"comp/compiler-unit.rkt" ;; jump^
"label-sig.rkt"
"label-unit.rkt"
"../coma/comma-unit.rkt" ;; comma^
"../coma/code-unit.rkt" ;; code^
"../control/control-unit.rkt" ;; control^
"../comp/compiler-unit.rkt" ;; jump^
"../label-sig.rkt"
"../label-unit.rkt"

;; PIC18 interfaces + implementations
"pic18/pic18-macro-unit.rkt"
"pic18/pic18-control-unit.rkt"
"pic18/sig.rkt" ;; pic18 language
"pic18-macro-unit.rkt"
"pic18-control-unit.rkt"
"sig.rkt" ;; pic18 language


;; COMPILER + ASSEMBLER
"pic18/pic18-compiler-unit.rkt"
"pic18-compiler-unit.rkt"


;; FORTH SYNTAX
"coma/macro-forth-sig.rkt"
"coma/macro-forth-unit.rkt"
"coma/macro-forth.rkt" ;; rpn prefix parsing words bound to macro.ss
"../coma/macro-forth-sig.rkt"
"../coma/macro-forth-unit.rkt"
"../coma/macro-forth.rkt" ;; rpn prefix parsing words bound to macro.ss
;; "pic18/forth.rkt" ;; PIC18 specific

;; TARGET CODE HANDLING
"code.rkt"
"../code.rkt"

;; SHALLOW COROUTINES
"pic18/scr-unit.rkt"
"scr-unit.rkt"

)

Expand Down
6 changes: 3 additions & 3 deletions pic18.rkt → pic18/pic18.rkt
Expand Up @@ -2,10 +2,10 @@

;; Macro Forth for PIC18.

(require "tools.rkt")
(require "../tools.rkt")
(require/provide
"pic18-unlinked.rkt" ;; All PIC18 code, not linked.
"pic18/pic18-const-unit.rkt" ;; Chip-specific config.
"pic18-unlinked.rkt" ;; All PIC18 code, not linked.
"pic18-const-unit.rkt" ;; Chip-specific config.
)

(provide (all-defined-out))
Expand Down

0 comments on commit 82e1e32

Please sign in to comment.