1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-03-25 21:30:44 +00:00

Longer timeout for spiSend - intial sd card access takes long time

This commit is contained in:
dschmenk 2016-08-16 08:28:53 -07:00
parent a40a0ba3ad
commit bd3d7de074
4 changed files with 101 additions and 30 deletions

@ -1,25 +1,45 @@
import cmdsys
predef putc, putln, puts, getc, gets
predef call, syscall
predef heapmark, heapallocalign, heapalloc, heaprelease, heapavail
predef memset, memcpy
predef isugt, isuge, isult, isule
predef modload, modexec, modaddr
word MACHID, sysvars
//
// System flags: memory allocator screen holes.
//
const restxt1 = $0001
const restxt2 = $0002
const resxtxt1 = $0004
const resxtxt2 = $0008
const reshgr1 = $0010
const reshgr2 = $0020
const resxhgr1 = $0040
const resxhgr2 = $0080
//
// Module don't free memory
//
const modkeep = $2000
const modinitkeep = $4000
const MACHID_CLOCK = $01
const MACHID_80COL = $02
const MACHID_MEM = $03
const MACHID_48K = $10
const MACHID_64K = $20
const MACHID_128K = $30
const MACHID_MODEL = $C8
const MACHID_II = $00
const MACHID_IIPLUS= $40
const MACHID_IIE = $80
const MACHID_III = $C0
const MACHID_IIC = $88
const MACHID_I = $08
word MACHID
//
// System flags: memory allocator screen holes.
//
const restxt1 = $0001
const restxt2 = $0002
const resxtxt1 = $0004
const resxtxt2 = $0008
const reshgr1 = $0010
const reshgr2 = $0020
const resxhgr1 = $0040
const resxhgr2 = $0080
//
// Module don't free memory
//
const modkeep = $2000
const modinitkeep = $4000
//
// System vars
//
word sysvars
//
// CMD exported functions
//
predef putc, putln, puts, getc, gets
predef call, syscall
predef heapmark, heapallocalign, heapalloc, heaprelease, heapavail
predef memset, memcpy
predef isugt, isuge, isult, isule
predef modload, modexec, modaddr
end

@ -1,5 +1,36 @@
import fileio
//
// Useful ProDOS values
//
// MACHID is defined in cmdsys.plh
// Which slot has a ROM
const SLTBYT = $BF99
// Prefix active
const PFIXPTR = $BF9A
// Memory alocate bitmap
const MEMTABL = $BF58
//
// ProDOS error codes
//
const PRODOS_ERR_OK = $00
const PRODOS_ERR_BAD_CALL_NUM = $01
const PRODOS_ERR_BAD_PARAM_CNT = $04
const PRODOS_ERR_INT_TBL_FULL = $25
const PRODOS_ERR_IO = $27
//
// System I/O buffer for PLASMA. Used when loading modules, free otherwise
//
const sysbuf = $0800
//
// File functions
//
predef getpfx, setpfx, open, close, read, write, create, destroy, newline
//
// Block level I/O functions
//
predef readblock, writeblock
//
// Globally accessible error code
//
byte perr
end

@ -23,12 +23,12 @@ export def setpfx(path)
perr = syscall($C6, @params)
return path
end
export def open(path, buff)
export def open(path, buf)
byte params[6]
params.0 = 3
params:1 = path
params:3 = buff
params:3 = buf
params.5 = 0
perr = syscall($C8, @params)
return params.5
@ -41,23 +41,23 @@ export def close(refnum)
perr = syscall($CC, @params)
return perr
end
export def read(refnum, buff, len)
export def read(refnum, buf, len)
byte params[8]
params.0 = 4
params.1 = refnum
params:2 = buff
params:2 = buf
params:4 = len
params:6 = 0
perr = syscall($CA, @params)
return params:6
end
export def write(refnum, buff, len)
export def write(refnum, buf, len)
byte params[8]
params.0 = 4
params.1 = refnum
params:2 = buff
params:2 = buf
params:4 = len
params:6 = 0
perr = syscall($CB, @params)
@ -95,5 +95,25 @@ export def newline(refnum, emask, nlchar)
perr = syscall($C9, @params)
return perr
end
export def readblock(unit, buf, block)
byte params[6]
params.0 = 3
params.1 = unit
params:2 = buf
params:4 = block
perr = syscall($80, @params)
return perr
end
export def writeblock(unit, buf, block)
byte params[6]
params.0 = 3
params.1 = unit
params:2 = buf
params:4 = block
perr = syscall($81, @params)
return perr
end
done

@ -202,7 +202,7 @@ end
export def spiSend(data)
byte timeout, status
for timeout = 1 to 5
for timeout = 1 to 100 step 10
status = spiXferByte(data)
if status <> SPI_SLAVE_BUSY
return status