summaryrefslogtreecommitdiff
path: root/software/idm
diff options
context:
space:
mode:
Diffstat (limited to 'software/idm')
-rw-r--r--software/idm/idm.asm38
1 files changed, 16 insertions, 22 deletions
diff --git a/software/idm/idm.asm b/software/idm/idm.asm
index 0782613..cb4ffcd 100644
--- a/software/idm/idm.asm
+++ b/software/idm/idm.asm
@@ -145,7 +145,9 @@ int_adc
movf TMP,w
movwf INDFW
incf TMP,f
+ movlb .0
call wbuf_next
+ bcf INT
goto int_fsr_norestore
;; void sspInterrupt()
@@ -180,15 +182,25 @@ int_spi
int_spi_0
btfss CMD_READ
retfie
+ movlb .0
call rbuf_next
- movf INDFR,w
btfss UNDERRUN
+ goto int_spi_0_loadnext
+ bsf INT
+ goto int_fsr_norestore
+
+int_spi_0_loadnext
+ movlb .4
+ movf INDFR,w
+ ;; incf TMP,f
+ ;; movf TMP,w
movwf SSP1BUF
goto int_fsr_norestore
int_spi_r
movf INDFR,w
btfss UNDERRUN
+ ;; movf TMP,w
movwf SSP1BUF
clrf CMDS
bsf CMD_READ
@@ -204,7 +216,7 @@ int_fsr_norestore
movwf FSR1H_SHAD
movf FSR1L,w
movwf FSR1L_SHAD
- retfie
+ retfie
;; -------------------------------------
;; SUBROUTINES
@@ -225,15 +237,10 @@ buf_init
movwf FSRRL
bcf OVERRUN
bsf UNDERRUN
-
- movf BSR,w
- clrf BSR
- bsf INT
if DEBUG == 1
bcf DBG1
bsf DBG2
endif
- movwf BSR
return
;; -------------------
@@ -254,13 +261,9 @@ wbuf_next
inc_fsr FSRW,FSRWH,FSRWL
bcf UNDERRUN
- movf BSR,w
- clrf BSR
- bcf INT
if DEBUG == 1
bcf DBG2
endif
- movwf BSR
movf FSRRH,w
xorwf FSRWH,w
@@ -272,10 +275,7 @@ endif
return
bsf OVERRUN
if DEBUG == 1
- movf BSR,w
- clrf BSR
bsf DBG1
- movwf BSR
endif
return
@@ -298,10 +298,7 @@ rbuf_next
inc_fsr FSRR,FSRRH,FSRRL
bcf OVERRUN
if DEBUG == 1
- movf BSR,w
- clrf BSR
bcf DBG1
- movwf BSR
endif
movf FSRWH,w
@@ -313,13 +310,9 @@ endif
btfss STATUS,Z
return
bsf UNDERRUN
- movf BSR,w
- clrf BSR
- bsf INT
if DEBUG == 1
bsf DBG2
endif
- movwf BSR
return
;; -------------------------------------
@@ -335,7 +328,7 @@ init
;; BANK 4
movlb .4
- movlw b'01000000'
+ movlw b'01000000' ; SMP=0,CKE=1
movwf SSP1STAT
movlw b'00010000'
movwf SSP1CON3
@@ -380,6 +373,7 @@ endif
movwf INTCON
bcf FILTER_EN
+ bsf INT
call buf_init
clrf CMDS
clrf TMP