Source
...
Target
Commits (6)
  • Jeffrey Lee's avatar
    Don't flag 26bit builds as being 32bit compatible · 68427e8a
    Jeffrey Lee authored
    Detail:
      s/Module - Make sure module flags word is 0 when No32bitCode
    Admin:
      Builds, untested
    
    
    Version 1.17. Tagged as 'SharedSnd-1_17'
    68427e8a
  • Jeffrey Lee's avatar
    Expand tabs · 2ab86b5f
    Jeffrey Lee authored
    Detail:
      s/* - Expand all tabs, to avoid space/tab use inconsistencies within some files and to match general ROOL code formatting
    Admin:
      Binary unchanged
    
    
    Version 1.17. Not tagged
    2ab86b5f
  • Jeffrey Lee's avatar
    Use constants from build system · a441d185
    Jeffrey Lee authored
    Detail:
      s/Gets - GET Hdr:Services
      s/Vars - Remove some locally defined constants which we can get from Hdr: instead
      s/Module - SWI base and Service_Sound subreason tokens renamed to match those used in Hdr:
    Admin:
      Binary unchanged
    
    
    Version 1.17. Not tagged
    a441d185
  • Jeffrey Lee's avatar
    Use Entry/EXIT, Push/Pull macros · 89139d90
    Jeffrey Lee authored
    Detail:
      s/* - Code updated to use Entry/EXIT and Push/Pull macros where possible instead of manual STM/LDM. Also add ROUTs for safety (although most routines use named local labels rather than numbered ones). A few obvious cases also fixed to reduce number of regs pushed onto stack.
      A few other changes and fixes of note:
      s/Log - Trim empty, unused installLogDriver routine when doLog is {FALSE}
      s/Module - Add a veneer to swiHandler to deal with 26bit and 26/32bit neutral cases; avoids the need for individual SWI handlers to preserve NZC
      s/SWIs:
      - Remove 26/32bit neutral SWI exit code, now handled by veneers. CLRV on most SWI exits to replace the implicit CLRV from CMP pc,pc.
      - swiHandlerVolume and swiDriverMixer were popping the wrong regs from the stack for most error cases; now fixed via the switch to Entry/EXIT
    Admin:
      Tested on Raspberry Pi
    
    
    Version 1.18. Tagged as 'SharedSnd-1_18'
    89139d90
  • Jeffrey Lee's avatar
    Use PSR manipulation macros. Macroise driver calling. Simplify error checks. · 65377222
    Jeffrey Lee authored
    Detail:
      s/Drivers - Macroise driver calling to reduce amount of duplicate code. Also avoid NOP if storing PC stores PC+8 and not PC+12.
      s/Handler - Use PSR manipulation macros for switching modes and controlling IRQs. Remove redundant IRQ disabling around atomic store of one word in doHandlerCallBack.
      s/Module - Use PSR manipulation macros for switching modes
      s/SWIS - Simplify range checking on handler and driver numbers; treat as unsigned numbers instead of signed.
      s/Vars - Remove local definitions of IRQ flags & SVC mode
    Admin:
      Tested on Raspberry Pi
    
    
    Version 1.19. Tagged as 'SharedSnd-1_19'
    65377222
  • Jeffrey Lee's avatar
    ARMv5E, ARMv6 optimisations · 8287e52c
    Jeffrey Lee authored
    Detail:
      s/FillCode - Buffer fill & mix fragments optimised to use SMULWB/T, PKH, QADD16 and QDADD where possible, resulting in new variants optimised for ARMv5E and ARMv6
      s/Handler - Remove old, unoptimised callback buffer mixing code. Add new optimisated code for ARMv6 (SHADD16)
    Admin:
      Tested on Raspberry Pi, Iyonix
    
    
    Version 1.20. Tagged as 'SharedSnd-1_20'
    8287e52c
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
GBLS Module_ComponentPath GBLS Module_ComponentPath
Module_MajorVersion SETS "1.16" Module_MajorVersion SETS "1.20"
Module_Version SETA 116 Module_Version SETA 120
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "06 Jan 2015" Module_Date SETS "18 Jun 2016"
Module_ApplicationDate SETS "06-Jan-15" Module_ApplicationDate SETS "18-Jun-16"
Module_ComponentName SETS "SharedSnd" Module_ComponentName SETS "SharedSnd"
Module_ComponentPath SETS "bsd/RiscOS/Sources/Audio/SharedSnd" Module_ComponentPath SETS "bsd/RiscOS/Sources/Audio/SharedSnd"
Module_FullVersion SETS "1.16" Module_FullVersion SETS "1.20"
Module_HelpVersion SETS "1.16 (06 Jan 2015)" Module_HelpVersion SETS "1.20 (18 Jun 2016)"
END END
/* (1.16) /* (1.20)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 1.16 #define Module_MajorVersion_CMHG 1.20
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 06 Jan 2015 #define Module_Date_CMHG 18 Jun 2016
#define Module_MajorVersion "1.16" #define Module_MajorVersion "1.20"
#define Module_Version 116 #define Module_Version 120
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "06 Jan 2015" #define Module_Date "18 Jun 2016"
#define Module_ApplicationDate "06-Jan-15" #define Module_ApplicationDate "18-Jun-16"
#define Module_ComponentName "SharedSnd" #define Module_ComponentName "SharedSnd"
#define Module_ComponentPath "bsd/RiscOS/Sources/Audio/SharedSnd" #define Module_ComponentPath "bsd/RiscOS/Sources/Audio/SharedSnd"
#define Module_FullVersion "1.16" #define Module_FullVersion "1.20"
#define Module_HelpVersion "1.16 (06 Jan 2015)" #define Module_HelpVersion "1.20 (18 Jun 2016)"
#define Module_LibraryVersionInfo "1:16" #define Module_LibraryVersionInfo "1:20"
...@@ -33,326 +33,311 @@ ...@@ -33,326 +33,311 @@
; -------------------------------- Driver routines --------------------------- ; -------------------------------- Driver routines ---------------------------
installDefaultDriver MACRO
; The default driver will either be (in order of preference) CallDriver $drivertbl, $entry, $extraregs
; Sound_LinearHandler LCLS regs
; or Sound_ChannelHandler [ "$extraregs"=""
regs SETS "ws"
; This routine looks to see what is available and installs |
; the appropriate driver. regs SETS "$extraregs,ws"
]
Push "lr" Push "$regs" ; Stack ws and any other regs
LDR ws, [$drivertbl, #driver_Parameter] ; Called with ws = parameter
Push "pc" ; Put return address on the stack
MOV pc, $entry ; And call driver install entry
[ NoARMv4
MOV r0, r0
]
Pull "$regs" ; Retrieve ws
MEND
installDefaultDriver ROUT
; The default driver will either be (in order of preference)
; Sound_LinearHandler
; or Sound_ChannelHandler
; This routine looks to see what is available and installs
; the appropriate driver.
Entry
Debug gn,"installDefaultDriver: entered" Debug gn,"installDefaultDriver: entered"
[ doDMI :LAND: ( :LNOT: forceLog) [ doDMI :LAND: ( :LNOT: forceLog)
; See if the DMI is loaded and if so install SharedSound into it's linear handler ; See if the DMI is loaded and if so install SharedSound into it's linear handler
MOV R0,#0 MOV R0,#0
ADR R1,%FT10 ADR R1,%FT10
SWI XOS_SWINumberFromString SWI XOS_SWINumberFromString
BVS installDefaultDriver_NoDMI BVS installDefaultDriver_NoDMI
MOV R0,#3 MOV R0,#3
STR R0,[R12,#work_currentDriver] STR R0,[R12,#work_currentDriver]
BL installDMIDriver BL installDMIDriver
Pull "PC" EXIT
10 10
DCB "PowerWAVE_LinearHandler", 0 ; Name of a SWI from the module DCB "PowerWAVE_LinearHandler", 0 ; Name of a SWI from the module
ALIGN ALIGN
installDefaultDriver_NoDMI installDefaultDriver_NoDMI
] ]
; First see if Sound_LinearHandler exists ; First see if Sound_LinearHandler exists
; This relies on the fact that the old SoundDMA module will respond to all ; This relies on the fact that the old SoundDMA module will respond to all
; SWI's outside its range with a 0 ; SWI's outside its range with a 0
; but the 16 bit SoundDMA will respond with a 1 if 16 bit is on ; but the 16 bit SoundDMA will respond with a 1 if 16 bit is on
MOV r0,#0 MOV r0,#0
[ :LNOT: forceLog [ :LNOT: forceLog
SWI XSound_Mode ; Check configured for 16 Bit support SWI XSound_Mode ; Check configured for 16 Bit support
MOVVS r0,#0 ; if not supported, explicitly say it's log MOVVS r0,#0 ; if not supported, explicitly say it's log
] ]
Debug gn,"Sound mode =", r0 Debug gn,"Sound mode =", r0
CMP r0,#0 ; r0 = 1 If 16 bit support is on CMP r0,#0 ; r0 = 1 If 16 bit support is on
MOVEQ r1,#1 ; Log MOVEQ r1,#1 ; Log
MOVNE r1,#2 ; Linear MOVNE r1,#2 ; Linear
STR r1,[ws,#work_currentDriver] STR r1,[ws,#work_currentDriver]
[ doLog [ doLog
BNE installDefaultDriverNotLog ; 32 bit change BNE installDefaultDriverNotLog ; 32 bit change
BL installLogDriver BL installLogDriver
Pull "pc" EXIT
] ]
installDefaultDriverNotLog installDefaultDriverNotLog
BL installLinearDriver BL installLinearDriver
Pull "pc" EXIT
; ----------- ; -----------
installDriver installDriver ROUT
; Install driver ; Install driver
; r0 = Pointer to driver table, or 0 if it's not really valid ; r0 = Pointer to driver table, or 0 if it's not really valid
; r1 = parameter to pass driver in ws when called ; r1 = parameter to pass driver in ws when called
; r2 = flags ; r2 = flags
; r3 ->Driver name ; r3 ->Driver name
Push "r0-r6,lr" Entry "r0-r6"
BL releaseDriver ; release the currently active driver BL releaseDriver ; release the currently active driver
ADD r6,ws,#work_driverTable ; Get pointer to driver table ADD r6,ws,#work_driverTable ; Get pointer to driver table
STR r0,[r6,#driver_Address] ; Table address STR r0,[r6,#driver_Address] ; Table address
STR r1,[r6,#driver_Parameter] ; Driver ws parameter STR r1,[r6,#driver_Parameter] ; Driver ws parameter
STR r2,[r6,#driver_Flags] STR r2,[r6,#driver_Flags]
ADD r4,r6,#driver_Name ADD r4,r6,#driver_Name
ADD r5,r4,#?driver_Name - 1 ; Buffer end (inclusive) ADD r5,r4,#?driver_Name - 1 ; Buffer end (inclusive)
10 10
LDRB r14,[r3],#1 LDRB r14,[r3],#1
CMP r14,#31 ; Control terminate CMP r14,#31 ; Control terminate
CMPHI r5,r4 ; Check buffer end CMPHI r5,r4 ; Check buffer end
MOVLS r14,#0 MOVLS r14,#0
STRB r14,[r4],#1 STRB r14,[r4],#1
BHI %BT10 BHI %BT10
MVN r0,#0 ; Initialise driver vol to LR = &FFFFFFFF MVN r0,#0 ; Initialise driver vol to LR = &FFFFFFFF
STR r0,[r6,#driver_Volume] STR r0,[r6,#driver_Volume]
BL driverInitialise ; Initialise this driver BL driverInitialise ; Initialise this driver
LDR r0,[r6,#driver_Volume] LDR r0,[r6,#driver_Volume]
MOV r1,r6 ; Driver table MOV r1,r6 ; Driver table
BL driverVolume ; Initialise driver volume BL driverVolume ; Initialise driver volume
Pull "r0-r6,pc" EXIT
; ----------- ; -----------
driverInitialise driverInitialise ROUT
; Initialise a new driver ; Initialise a new driver
; r0 = driver table slot ; r0 = driver table slot
; Return with r0 = 0 if failed ; Return with r0 = 0 if failed
Push "r1-r11,ws,lr" Entry "r1-r11,ws"
ADD r6,ws,#work_driverTable ; driver Table slot ADD r6,ws,#work_driverTable ; driver Table slot
LDR r0,[r6,#driver_Address] LDR r0,[r6,#driver_Address]
LDR r2,[r0,#driverEntry_Install] ; r2 = Call address LDR r2,[r0,#driverEntry_Install] ; r2 = Call address
BL clearCallBackBuffer BL clearCallBackBuffer
ADRL r0,fill ; Main fill call address ADRL r0,fill ; Main fill call address
LDR r1,[ws,#work_privateWord] ; r1 = parameter LDR r1,[ws,#work_privateWord] ; r1 = parameter
Push "ws" ; Stack ws CallDriver r6, r2 ; Call r2 on driver r6
LDR ws,[r6,#driver_Parameter] ; Called with ws = parameter
Push "pc" ; Put return address on the stack
MOV pc,r2 ; And call driver install entry
MOV r0,r0
Pull "ws" ; Retrieve ws
CMP r0,#0 ; = 0 if install failed CMP r0,#0 ; = 0 if install failed
MOVNE r0,#0 MOVNE r0,#0
BLNE newSampleRate ; Get rate and set up sample period & BLNE newSampleRate ; Get rate and set up sample period &
; fractions ; fractions
BL startSound ; Make sure that sound is active BL startSound ; Make sure that sound is active
Pull "r1-r11,ws,pc" EXIT
; ------------ ; ------------
driverCheck driverCheck ROUT
; Call initialise to make sure that the current driver is still active ; Call initialise to make sure that the current driver is still active
Push "r0-r11,ws,lr" Entry "r0-r11,ws"
ADD r6,ws,#work_driverTable ; driver Table slot ADD r6,ws,#work_driverTable ; driver Table slot
LDR r0,[r6,#driver_Address] LDR r0,[r6,#driver_Address]
CMP r0,#0 ; Is there a driver installed? CMP r0,#0 ; Is there a driver installed?
BEQ driverCheckExit BEQ driverCheckExit
LDR r2,[r0,#driverEntry_Install] ; r2 = Call address LDR r2,[r0,#driverEntry_Install] ; r2 = Call address
ADRL r0,fill ; r0 = Handler address ADRL r0,fill ; r0 = Handler address
LDR r1,[ws,#work_privateWord] ; r1 = parameter LDR r1,[ws,#work_privateWord] ; r1 = parameter
Push "ws" ; Stack ws CallDriver r6, r2 ; Call r2 on driver r6
LDR ws,[r6,#driver_Parameter] ; Called with ws = parameter
Push "pc" ; Put return address on the stack
MOV pc,r2 ; And call driver install entry
MOV r0,r0
Pull "ws" ; Retrieve ws
MOV r0,#0 MOV r0,#0
STR r0,[ws,#work_SoundPause] ; Clear the pause flag STR r0,[ws,#work_SoundPause] ; Clear the pause flag
driverCheckExit driverCheckExit
CMP PC,PC ; Clears V flag and checks processor mode CLRV
Pull "r0-r11,ws,pc", EQ ; 32 bit exit EXIT
Pull "r0-r11,ws,pc",, ^ ; 26 bit exit
;------------- ;-------------
releaseDriver releaseDriver ROUT
Push "r0-r11,ws,lr" Entry "r0-r11,ws"
BL stopSound BL stopSound
ADD r0,ws,#work_driverTable ; driver Table slot ADD r0,ws,#work_driverTable ; driver Table slot
LDR r1,[r0,#driver_Address] LDR r1,[r0,#driver_Address]
CMP r1,#0 CMP r1,#0
BEQ releaseDriverExit BEQ releaseDriverExit
LDR r1,[r1,#driverEntry_Remove] LDR r1,[r1,#driverEntry_Remove]
Push "ws" ; Stack ws CallDriver r0, r1 ; Call r1 on driver r0, no other parameters
LDR ws,[r0,#driver_Parameter] ; Get driver's ws
Push "pc" ; Stack return address
MOV pc,r1 ; Call driver, no other parameters
MOV r0,r0
Pull "ws" ; Retrieve ws
; forget the driver we're using ; forget the driver we're using
ADD r0,ws,#work_driverTable ; driver Table slot ADD r0,ws,#work_driverTable ; driver Table slot
MOV r1,#0 MOV r1,#0
STR r1,[r0,#driver_Address] STR r1,[r0,#driver_Address]
releaseDriverExit releaseDriverExit
Pull "r0-r11,ws,pc" EXIT
; ----------------
driverSampleRate
; Call driver sample rate entry
; On entry:
; r0 = 0 to read
; > 0 for sample frequency required
; On exit:
; r0 = current frequency
Push "lr"
; Get or set current frequency
ADD r1,ws,#work_driverTable ; driver Table slot
LDR r2,[r1,#driver_Address]
CMP r2,#0 ; Return 0 for failed
MOVEQ r0,#0
BEQ driverSampleRateExit
LDR r2,[r1,#driver_Address]
LDR r2,[r2,#driverEntry_SampleRate]
Push "ws" ; Stack ws
LDR ws,[r1,#driver_Parameter] ; Get driver's ws
Push "pc" ; Stack return address
MOV pc,r2 ; Call driver, no other parameters
MOV r0,r0
Pull "ws" ; Retrieve ws
; r0 = current frequency
driverSampleRateExit ; ----------------
driverSampleRate ROUT
; Call driver sample rate entry
; On entry:
; r0 = 0 to read
; > 0 for sample frequency required
; On exit:
; r0 = current frequency
Entry
; Get or set current frequency
ADD r1,ws,#work_driverTable ; driver Table slot
LDR r2,[r1,#driver_Address]
Pull "pc" CMP r2,#0 ; Return 0 for failed
MOVEQ r0,#0
BEQ driverSampleRateExit
LDR r2,[r1,#driver_Address]
LDR r2,[r2,#driverEntry_SampleRate]
CallDriver r1, r2 ; Call r2 on driver r1, no other parameters
; r0 = current frequency
driverSampleRateExit
EXIT
; ---------- ; ----------
driverVolume driverVolume ROUT
; Set the new volume for a driver ; Set the new volume for a driver
; On entry: ; On entry:
; r0 = new LR volume ; r0 = new LR volume
; r1 = driver table ; r1 = driver table
; On exit: ; On exit:
; r0 = volume scaling required by handler to achieve this volume ; r0 = volume scaling required by handler to achieve this volume
; So if driver cannot scale volume then r0 = entry value and handler ; So if driver cannot scale volume then r0 = entry value and handler
; will have to do all the work ; will have to do all the work
; If driver can scale then typically it will return &FFFFFFFF to ; If driver can scale then typically it will return &FFFFFFFF to
; tell handler not to scale volume at all ; tell handler not to scale volume at all
Push "r1-r11,ws,lr" Entry "r1-r11,ws"
; Get or set current volume ; Get or set current volume
ADD r1,ws,#work_driverTable ; driver Table slot ADD r1,ws,#work_driverTable ; driver Table slot
LDR r2,[r1,#driver_Address] LDR r2,[r1,#driver_Address]
CMP r2,#0 CMP r2,#0
BEQ driverVolumeExit BEQ driverVolumeExit
LDR r2,[r2,#driverEntry_Volume] ; There may not be an entry LDR r2,[r2,#driverEntry_Volume] ; There may not be an entry
CMP r2,#0 CMP r2,#0
STR r0,[r1,#driver_Volume] ; Store it STR r0,[r1,#driver_Volume] ; Store it
BEQ driverVolumeStore ; Return with r0 as set BEQ driverVolumeStore ; Return with r0 as set
Push "r1,ws" ; Stack ws CallDriver r1, r2, "r1" ; Call r2 on driver r1, no other parameters
LDR ws,[r1,#driver_Parameter] ; Get driver's ws
Push "pc" ; Stack return address
MOV pc,r2 ; Call driver, no other parameters
MOV r0,r0
Pull "r1,ws" ; Retrieve ws
driverVolumeStore driverVolumeStore
Debug gn,"Store scaled driver volume: ", r0 Debug gn,"Store scaled driver volume: ", r0
; r0 = actual volume ; r0 = actual volume
STR r0,[r1,#driver_VolumeScaled] ; The volume to use when scaling handlers STR r0,[r1,#driver_VolumeScaled] ; The volume to use when scaling handlers
driverVolumeExit driverVolumeExit
Pull "r1-r11,ws,pc" EXIT
; ----------- ; -----------
driverMixer driverMixer ROUT
; Call driver's mixer entry ; Call driver's mixer entry
; On entry: ; On entry:
; r0 = Function code, 0 = read, 1 = set ; r0 = Function code, 0 = read, 1 = set
; r1 = mixer number ; r1 = mixer number
; r2 = value if to set ; r2 = value if to set
; r3 = driver pointer ; r3 = driver pointer
; On exit: ; On exit:
; r1 = number of mixers ; r1 = number of mixers
; r2 = current value ; r2 = current value
; r3 = mixer name ; r3 = mixer name
Push "r4-r11,ws,lr" Entry "r4-r11,ws"
CMP r3,#0 CMP r3,#0
BEQ driverMixerExit BEQ driverMixerExit
LDR r4,[r3,#driver_Address] LDR r4,[r3,#driver_Address]
LDR r4,[r4,#driverEntry_Mixer] ; There may not be an entry LDR r4,[r4,#driverEntry_Mixer] ; There may not be an entry
CMP r4,#0 CMP r4,#0
BEQ driverMixerExit ; No mixer entry BEQ driverMixerExit ; No mixer entry
Push "ws" ; Stack ws CallDriver r3, r4 ; Call r4 on driver r3, no other parameters
LDR ws,[r1,#driver_Parameter] ; Get driver's ws
Push "pc" ; Stack return address
MOV pc,r4 ; Call driver, no other parameters
MOV r0,r0
Pull "ws" ; Retrieve ws
driverMixerExit driverMixerExit
Pull "r4-r11,ws,pc" EXIT
END END
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
; routine, or the interface description should be updated ; routine, or the interface description should be updated
fill_silence fill_silence
TST r3,#1 ; If we are being asked to mix, then nothing to do. TST r3,#1 ; If we are being asked to mix, then nothing to do.
MOVNE r1,r2 ; Pretend we filled! MOVNE r1,r2 ; Pretend we filled!
MOVNE r0, r3 ; return the flags too! MOVNE r0, r3 ; return the flags too!
MOVNE PC,R14 MOVNE PC,R14
CMP R1,R2 ; check whether already complete CMP R1,R2 ; check whether already complete
...@@ -79,7 +79,7 @@ fs_lp_small ...@@ -79,7 +79,7 @@ fs_lp_small
ORR R0,R3,#1 ; R0 = flags + MIX set ORR R0,R3,#1 ; R0 = flags + MIX set
MOV PC,R14 MOV PC,R14
; Just fill the buffer with 0s.
; On Entry: ; On Entry:
; r1 = Pointer to buffer to fill ; r1 = Pointer to buffer to fill
; r2 = Pointer to byte after end of buffer to fill ; r2 = Pointer to byte after end of buffer to fill
...@@ -112,7 +112,7 @@ fs_lp_small ...@@ -112,7 +112,7 @@ fs_lp_small
; R (*) = reversed ; R (*) = reversed
; (* = Not yet implemented as the bits can never be set by SharedSound) ; (* = Not yet implemented as the bits can never be set by SharedSound)
fill_data fill_data
STMFD r13!,{r5,r14} Entry "R5"
; How many stereo samples (4 bytes) will this fill routine use? ; How many stereo samples (4 bytes) will this fill routine use?
; We are never going to be asked to fill more than 256K. ; We are never going to be asked to fill more than 256K.
SUBS R2,R2,R1 ; R2 = number of output bytes required. SUBS R2,R2,R1 ; R2 = number of output bytes required.
...@@ -183,7 +183,7 @@ fill_code_table ...@@ -183,7 +183,7 @@ fill_code_table
fill_return fill_return
ORR r0,r3,#1 ; r0 = flags on entry + MIX. ORR r0,r3,#1 ; r0 = flags on entry + MIX.
LDMFD r13!,{r5,PC} EXIT
; -------------------------------------------------------------------------------- ; --------------------------------------------------------------------------------
; OK. Of the 32 cases above, half are muted, so resolve to just one case, leaving 16 others. ; OK. Of the 32 cases above, half are muted, so resolve to just one case, leaving 16 others.
...@@ -220,7 +220,7 @@ ssh_lp0_$name ...@@ -220,7 +220,7 @@ ssh_lp0_$name
UnMakeSpace$name UnMakeSpace$name
ORR r0,r3,#1 ; r0 = flags on entry + MIX. ORR r0,r3,#1 ; r0 = flags on entry + MIX.
LDMFD r13!,{r5,PC} EXIT
MEND MEND
...@@ -239,7 +239,7 @@ sshD_lp0_$name ...@@ -239,7 +239,7 @@ sshD_lp0_$name
UnMakeSpace$name UnMakeSpace$name
ORR r0,r3,#1 ; r0 = flags on entry + MIX. ORR r0,r3,#1 ; r0 = flags on entry + MIX.
LDMFD r13!,{r5,PC} EXIT
MEND MEND
...@@ -289,6 +289,7 @@ sshD_lp0_$name ...@@ -289,6 +289,7 @@ sshD_lp0_$name
AND r14,r9,#&FF000000 ; r14 = integer inc AND r14,r9,#&FF000000 ; r14 = integer inc
LDR R0,[R4],r14,LSR#22 LDR R0,[R4],r14,LSR#22
BIC r9,r9,#&FF000000 ; keep just the fractional bit BIC r9,r9,#&FF000000 ; keep just the fractional bit
[ NoARME
MOV R14,R0,ASR#16 MOV R14,R0,ASR#16
MUL R14,R10,R14 ; R14= LLLLxxxx = Scaled L volume MUL R14,R10,R14 ; R14= LLLLxxxx = Scaled L volume
MOV R0,R0,LSL#16 MOV R0,R0,LSL#16
...@@ -297,6 +298,17 @@ sshD_lp0_$name ...@@ -297,6 +298,17 @@ sshD_lp0_$name
MOV R14,R14,LSR#16 MOV R14,R14,LSR#16
MOV R0,R0,LSR#16 MOV R0,R0,LSR#16
ORR R0,R0,R14,LSL#16 ORR R0,R0,R14,LSL#16
|
SMULWT R14,R10,R0 ; R14 = ssssLLLL (signed)
SMULWB R0,R11,R0 ; R0 = ssssRRRR
[ NoARMv6
MOV R14,R14,LSL #16
MOV R0,R0,LSL #16
ORR R0,R14,R0,LSR #16
|
PKHBT R0,R0,R14,LSL #16 ; R0 = LLLLRRRR
]
]
STR R0,[R1],#4 STR R0,[R1],#4
MEND MEND
...@@ -310,7 +322,9 @@ sshD_lp0_$name ...@@ -310,7 +322,9 @@ sshD_lp0_$name
MACRO MACRO
MakeSpaceML MakeSpaceML
[ NoARMv6
MOV R10,#1<<31 MOV R10,#1<<31
]
MEND MEND
MACRO MACRO
...@@ -321,13 +335,17 @@ sshD_lp0_$name ...@@ -321,13 +335,17 @@ sshD_lp0_$name
LDR R0,[R4],r14,LSR#22 ; R0 = AAAABBBB = Our samples LDR R0,[R4],r14,LSR#22 ; R0 = AAAABBBB = Our samples
LDR R14,[R1] ; R14= CCCCDDDD = Current samples LDR R14,[R1] ; R14= CCCCDDDD = Current samples
BIC R9,R9,#&FF000000 ; keep just the fractional bit BIC R9,R9,#&FF000000 ; keep just the fractional bit
MOV R0,R0,ROR#16 ; R0 = BBBBAAAA [ NoARMv6
MOV R0,R0,ROR#16 ; R0 = BBBBAAAA
ADDS R11,R14,R0,LSL#16 ; T2 = eeeexxxx (where eeee = AAAA+CCCC) ADDS R11,R14,R0,LSL#16 ; T2 = eeeexxxx (where eeee = AAAA+CCCC)
SBCVS R11,R10,#0 ; T2 = EEEExxxx (where EEEE = Clip[AAAA+CCCC]) SBCVS R11,R10,#0 ; T2 = EEEExxxx (where EEEE = Clip[AAAA+CCCC])
ADDS R0,R0,R14,LSL#16 ; R0 = DDDD0000+BBBB000 ADDS R0,R0,R14,LSL#16 ; R0 = DDDD0000+BBBB000
SBCVS R0,R10,#0 ; R0 = FFFF0000 (where FFFF = Clip[DDDD+CCCC]) SBCVS R0,R10,#0 ; R0 = FFFF0000 (where FFFF = Clip[DDDD+CCCC])
AND R11,R11,R10,ASR#15 ; T2 = EEEE0000 AND R11,R11,R10,ASR#15 ; T2 = EEEE0000
ORR R0,R11,R0,LSR#16 ; R0 = EEEEFFFF ORR R0,R11,R0,LSR#16 ; R0 = EEEEFFFF
|
QADD16 R0,R0,R14 ; Signed saturating halfword addition
]
STR R0,[R1],#4 STR R0,[R1],#4
MEND MEND
...@@ -350,10 +368,23 @@ sshD_lp0_$name ...@@ -350,10 +368,23 @@ sshD_lp0_$name
MACRO MACRO
MakeSpaceVML MakeSpaceVML
STMFD r13!,{R7,R12} [ NoARME
MOV R10,#1<<31 MOV r10,R7,LSR#16 ; r10 = Left Vol
MOV R11,r7,LSR#16 ; R11= Left vol BIC r11,r7,r10,LSL#16 ; r11 = Right Vol
BIC R7,r7,R11,LSL#16 ; R7 = Right vol Push "R7,R12"
MOV R12,#1<<31
|
[ NoARMv6
Push "R7,R12"
LDR r12,=&ffff<<15
AND r10,r12,r7,LSR #1 ; r10 = Left Vol
AND r11,r12,r7,LSL #15 ; r11 = Right Vol
|
MOV r10,R7,LSR#16 ; r10 = Left Vol
BIC r11,r7,r10,LSL#16 ; r11 = Right Vol
Push "R12"
]
]
MEND MEND
MACRO MACRO
...@@ -363,24 +394,48 @@ sshD_lp0_$name ...@@ -363,24 +394,48 @@ sshD_lp0_$name
AND R14,R9,#&FF000000 ; r14= integer inc AND R14,R9,#&FF000000 ; r14= integer inc
LDR R0,[R4],r14,LSR#22 ; R0 = AAAABBBB = Our samples LDR R0,[R4],r14,LSR#22 ; R0 = AAAABBBB = Our samples
BIC R9,R9,#&FF000000 ; keep just the fractional bit BIC R9,R9,#&FF000000 ; keep just the fractional bit
[ NoARME
MOV r14,R0,ASR#16 MOV r14,R0,ASR#16
MUL R12,R11,R14 ; R12= AAAAxxxx MUL R7,R10,R14 ; R7 = AAAAxxxx
LDR R14,[R1] ; R14= CCCCDDDD = Current samples LDR R14,[R1] ; R14= CCCCDDDD = Current samples
MOV R0,R0,LSL#16 MOV R0,R0,LSL#16
MOV R0,R0,ASR#16 MOV R0,R0,ASR#16
MUL R0,R7,R0 ; R0 = BBBBxxxx MUL R0,R11,R0 ; R0 = BBBBxxxx
ADDS R12,R14,R12 ; T2 = eeeexxxx (where eeee = AAAA+CCCC) ADDS R7,R14,R7 ; R7 = eeeexxxx (where eeee = AAAA+CCCC)
SBCVS R12,R10,#0 ; T2 = EEEExxxx (where EEEE = Clip[AAAA+CCCC]) SBCVS R7,R12,#0 ; R7 = EEEExxxx (where EEEE = Clip[AAAA+CCCC])
ADDS R0,R0,R14,LSL#16 ; R0 = DDDD0000+BBBB000 ADDS R0,R0,R14,LSL#16 ; R0 = DDDD0000+BBBB000
SBCVS R0,R10,#0 ; R0 = FFFF0000 (where FFFF = Clip[DDDD+CCCC]) SBCVS R0,R12,#0 ; R0 = FFFF0000 (where FFFF = Clip[DDDD+BBBB])
AND R12,R12,R10,ASR#15 ; T2 = EEEE0000 AND R7,R7,R12,ASR#15 ; R7 = EEEE0000
ORR R0,R12,R0,LSR#16 ; R0 = EEEEFFFF ORR R0,R7,R0,LSR#16 ; R0 = EEEEFFFF
|
[ NoARMv6
SMULWT R14,R10,R0 ; R14= AAAAxxxx >> 1
LDR R7,[R1] ; R7 = CCCCDDDD = Current samples
SMULWB R0,R11,R0 ; R0 = BBBBxxxx >> 1
BIC R14,R14,R12,LSR #16 ; R14= AAAA0000 >> 1 (must mask off to avoid potential overflow from interaction with low bits of R7)
QDADD R14,R7,R14 ; R14= EEEExxxx (where EEEE = Clip[AAAA+CCCC])
MOV R7,R7,LSL #16
QDADD R0,R7,R0 ; R0 = FFFFxxxx (where FFFF = Clip[DDDD+BBBB])
AND R14,R14,R12,LSL #1 ; R14= EEEE0000
ORR R0,R14,R0,LSR #16 ; R0 = EEEEFFFF
|
SMULWT R14,R10,R0 ; R14= ssssAAAA
LDR R7,[R1] ; R7 = CCCCDDDD = Current samples
SMULWB R0,R11,R0 ; R0 = ssssBBBB
PKHBT R0,R0,R14,LSL #16 ; R0 = AAAABBBB
QADD16 R0,R0,R7 ; R0 = EEEEFFFF
]
]
STR R0,[R1],#4 STR R0,[R1],#4
MEND MEND
MACRO MACRO
UnMakeSpaceVML UnMakeSpaceVML
LDMFD r13!,{R7,R12} [ NoARMv6
Pull "R7,R12"
|
Pull "R12"
]
MEND MEND
; Fmute = zero fill ; Fmute = zero fill
......
...@@ -57,19 +57,20 @@ ...@@ -57,19 +57,20 @@
GET Hdr:MsgTrans GET Hdr:MsgTrans
GET Hdr:Proc GET Hdr:Proc
GET Hdr:NdrDebug GET Hdr:NdrDebug
GET Hdr:Services
GET VersionAsm GET VersionAsm
GBLS copyRightS GBLS copyRightS
GBLS ackS GBLS ackS
GBLS variantS GBLS variantS
GBLS titleS GBLS titleS
GBLS swiNameS GBLS swiNameS
copyRightS SETS " Expressive Software Projects, Nottingham." copyRightS SETS " Expressive Software Projects, Nottingham."
ackS SETS "Copyright 1995-2002 Expressive Software Projects" ackS SETS "Copyright 1995-2002 Expressive Software Projects"
variantS SETS "" variantS SETS ""
titleS SETS "SharedSound" titleS SETS "SharedSound"
swiNameS SETS "SharedSound" swiNameS SETS "SharedSound"
GBLL forceLog GBLL forceLog
GBLL doLogDirect GBLL doLogDirect
...@@ -78,23 +79,23 @@ swiNameS SETS "SharedSound" ...@@ -78,23 +79,23 @@ swiNameS SETS "SharedSound"
GBLL doCBAI GBLL doCBAI
[ :LNOT::DEF: standalone [ :LNOT::DEF: standalone
GBLL standalone GBLL standalone
standalone SETL {FALSE} standalone SETL {FALSE}
] ]
[ :LNOT::DEF: doLog [ :LNOT::DEF: doLog
GBLL doLog GBLL doLog
doLog SETL {FALSE} doLog SETL {FALSE}
| |
doLog SETL doLog :LAND: standalone ; Uses PC relative workspace! doLog SETL doLog :LAND: standalone ; Uses PC relative workspace!
] ]
forceLog SETL {FALSE} forceLog SETL {FALSE}
doLogDirect SETL {FALSE} doLogDirect SETL {FALSE}
doDMI SETL {TRUE} doDMI SETL {TRUE}
doCallBack SETL {TRUE} doCallBack SETL {TRUE}
doCBAI SETL {FALSE} doCBAI SETL {FALSE}
GBLL debugxc GBLL debugxc
GBLL debugsw GBLL debugsw
GBLL debuggn GBLL debuggn
debug SETL {FALSE} debug SETL {FALSE}
debuggn SETL {FALSE} ; General debug debuggn SETL {FALSE} ; General debug
debugsw SETL {FALSE} ; SWI entries debugsw SETL {FALSE} ; SWI entries
...@@ -102,29 +103,29 @@ debugxc SETL {FALSE} ; Extra commands ...@@ -102,29 +103,29 @@ debugxc SETL {FALSE} ; Extra commands
ws RN 12 ws RN 12
AREA |!!Module$$Code|, CODE, READONLY AREA |!!Module$$Code|, CODE, READONLY
MODULE_START MODULE_START
GET Vars.s GET Vars.s
GET Module.s GET Module.s
GET SWIS.s GET SWIS.s
GET Memory.s GET Memory.s
GET SampleRate.s GET SampleRate.s
GET Volume.s GET Volume.s
GET Drivers.s GET Drivers.s
GET Linear.s GET Linear.s
[ doLog [ doLog
GET Log.s GET Log.s
] ]
[ doDMI [ doDMI
GET PowerWave.s GET PowerWave.s
] ]
GET SoundDrv.s GET SoundDrv.s
GET Handler.s GET Handler.s
GET FillCode.s GET FillCode.s
[ debug [ debug
InsertNDRDebugRoutines InsertNDRDebugRoutines
] ]
END END
This diff is collapsed.
...@@ -26,38 +26,37 @@ ...@@ -26,38 +26,37 @@
; ------------------------- Linear driver -------------------------- ; ------------------------- Linear driver --------------------------
; --------- ; ---------
installLinearDriver installLinearDriver ROUT
; Set up the registers and table for ; Set up the registers and table for
; Sound_LinearHandler and call installDriver ; Sound_LinearHandler and call installDriver
Push "lr" Entry , 32
SUB sp,sp,#32
MOV r0,#32 MOV r0,#32
ADR r1,linearDriverToken ADR r1,linearDriverToken
MOV r2,sp MOV r2,sp
BL msgLookupToken BL msgLookupToken
MOV r3,sp ; Driver name MOV r3,sp ; Driver name
ADD r0,ws,#work_DriverEntryTable ; Get table address ADD r0,ws,#work_DriverEntryTable ; Get table address
ADR r1,linearDriverInstall ; Install entry ADR r1,linearDriverInstall ; Install entry
STR r1,[r0,#driverEntry_Install] STR r1,[r0,#driverEntry_Install]
ADR r1,linearDriverRemove ; Remove entry ADR r1,linearDriverRemove ; Remove entry
STR r1,[r0,#driverEntry_Remove] STR r1,[r0,#driverEntry_Remove]
ADR r1,linearDriverSampleRate ; Sample rate entry ADR r1,linearDriverSampleRate ; Sample rate entry
STR r1,[r0,#driverEntry_SampleRate] STR r1,[r0,#driverEntry_SampleRate]
MOV r1,#0 ; No volume entry MOV r1,#0 ; No volume entry
STR r1,[r0,#driverEntry_Volume] STR r1,[r0,#driverEntry_Volume]
MOV r1,#0 MOV r1,#0
STR r1,[r0,#driverEntry_Mixer] ; No mixer entry STR r1,[r0,#driverEntry_Mixer] ; No mixer entry
LDR r1,[ws,#work_privateWord] ; Parameter LDR r1,[ws,#work_privateWord] ; Parameter
MOV r2,#0 ; Flags MOV r2,#0 ; Flags
Debug gn, "Install linear driver....." Debug gn, "Install linear driver....."
Debug gn, " Table =",r0 Debug gn, " Table =",r0
...@@ -65,131 +64,128 @@ installLinearDriver ...@@ -65,131 +64,128 @@ installLinearDriver
Debug gn, " Flags =",r2 Debug gn, " Flags =",r2
DebugS gn, " Name =",r3 DebugS gn, " Name =",r3
BL installDriver BL installDriver
ADD sp,sp,#32 EXIT
Pull "pc"
linearDriverToken linearDriverToken
DCB "NmLin",0 DCB "NmLin",0
ALIGN ALIGN
; ------ ; ------
linearDriverInstall linearDriverInstall ROUT
; Install driver using Sound_LinearHandler ; Install driver using Sound_LinearHandler
; r0 = Handler address ; r0 = Handler address
; r1 = Parameter to pass ; r1 = Parameter to pass
; ws = parameter for driver ; ws = parameter for driver
; lr already on stack ; lr already on stack
STMDB sp!,{r1-r11,ws} Push "r1-r11,ws"
MOV r5,r0 ; Temorary store r0 and r1 MOV r5,r0 ; Temorary store r0 and r1
MOV r6,r1 MOV r6,r1
MOV r0,#0 ; Get current handler to see if already installed MOV r0,#0 ; Get current handler to see if already installed
SWI XSound_LinearHandler SWI XSound_LinearHandler
CMP r1,r5 ; Same handler? CMP r1,r5 ; Same handler?
CMPEQ r2,r6 ; Same parameter? CMPEQ r2,r6 ; Same parameter?
BEQ linearDriverInstallExit ; Jump out 'cos already there BEQ linearDriverInstallExit ; Jump out 'cos already there
; Now install new driver ; Now install new driver
MOV r0,#1 ; Function code install MOV r0,#1 ; Function code install
MOV r1,r5 ; Address MOV r1,r5 ; Address
MOV r2,r6 ; Parameter MOV r2,r6 ; Parameter
SWI XSound_LinearHandler SWI XSound_LinearHandler
MOV r0,r5 ; Restore r0 if successful MOV r0,r5 ; Restore r0 if successful
MOVVS r0,#0 ; Or 0 if error MOVVS r0,#0 ; Or 0 if error
linearDriverInstallExit linearDriverInstallExit
Pull "r1-r11,ws,pc"
LDMIA sp!,{r1-r11,ws,pc}
; ----------- ; -----------
linearDriverRemove linearDriverRemove ROUT
; Remove driver using Sound_LinearHandler ; Remove driver using Sound_LinearHandler
; lr already on stack ; lr already on stack
STMDB sp!,{r0-r2} Push "r0-r2"
; To remove handler set new handler to 0 ; To remove handler set new handler to 0
MOV r0,#1 ; Function code install MOV r0,#1 ; Function code install
MOV r1,#0 ; Null handler MOV r1,#0 ; Null handler
MOV r2,#0 MOV r2,#0
SWI XSound_LinearHandler SWI XSound_LinearHandler
LDMIA sp!,{r0-r2,pc} Pull "r0-r2,pc"
; ----------- ; -----------
linearDriverSampleRate linearDriverSampleRate ROUT
; Choose rate and/or return current rate ; Choose rate and/or return current rate
; r0 = 0 to read ; r0 = 0 to read
; > 0 to set to r0 = frequency ; > 0 to set to r0 = frequency
; On exit: ; On exit:
; r0 = current frequency ; r0 = current frequency
STMDB sp!,{r1-r11,ws} Push "r1-r11,ws"
CMP r0,#0 CMP r0,#0
BEQ linearDriverSampleRateRead BEQ linearDriverSampleRateRead
; Set the rate to r0 ; Set the rate to r0
; Find the nearest ; Find the nearest
MOV r4,r0 ; r4 = rate required MOV r4,r0 ; r4 = rate required
MOV r0,#0 ; Read number of rates available MOV r0,#0 ; Read number of rates available
SWI XSound_SampleRate ; r1 = number of rates available SWI XSound_SampleRate ; r1 = number of rates available
BVS linearDriverSampleRateFailed BVS linearDriverSampleRateFailed
MOV r5,r1 ; r5 = Upper limit MOV r5,r1 ; r5 = Upper limit
linearDriverSampleRateLoop linearDriverSampleRateLoop
MOV r0,#2 ; Convert from index to rate MOV r0,#2 ; Convert from index to rate
SWI XSound_SampleRate ; r2 = rate SWI XSound_SampleRate ; r2 = rate
BVS linearDriverSampleRateFailed BVS linearDriverSampleRateFailed
CMP r2,r4 CMP r2,r4
BLT linearDriverSampleRateClosest ; Best rate is between r1 and r5 BLT linearDriverSampleRateClosest ; Best rate is between r1 and r5
CMP r1,#1 ; Are there any more rates CMP r1,#1 ; Are there any more rates
MOVNE r5,r1 ; Change upper limit MOVNE r5,r1 ; Change upper limit
MOVNE r6,r2 ; Store upper rate MOVNE r6,r2 ; Store upper rate
SUBNE r1,r1,#1 ; decrement index SUBNE r1,r1,#1 ; decrement index
BNE linearDriverSampleRateLoop ; Try again BNE linearDriverSampleRateLoop ; Try again
linearDriverSampleRateClosest linearDriverSampleRateClosest
; Check for nearest between r1 and r5 ; Check for nearest between r1 and r5
CMP r1,r5 ; No range to check CMP r1,r5 ; No range to check
BEQ linearDriverSampleRateSet BEQ linearDriverSampleRateSet
; r2 = lower rate, r1 = index ; r2 = lower rate, r1 = index
; r6 = upper rate, r5 = index ; r6 = upper rate, r5 = index
SUB r2,r4,r2 SUB r2,r4,r2
SUB r6,r6,r4 SUB r6,r6,r4
CMP r2,r6 ; Who is nearest CMP r2,r6 ; Who is nearest
MOVGT r1,r5 ; If nearest to r6 then set index to r5 MOVGT r1,r5 ; If nearest to r6 then set index to r5
linearDriverSampleRateSet linearDriverSampleRateSet
; Chosen index is r1 ; Chosen index is r1
MOV r0,#3 ; Select rate from index in r1 MOV r0,#3 ; Select rate from index in r1
SWI XSound_SampleRate SWI XSound_SampleRate
BVS linearDriverSampleRateFailed BVS linearDriverSampleRateFailed
linearDriverSampleRateRead linearDriverSampleRateRead
MOV r0,#1 MOV r0,#1
SWI XSound_SampleRate ; Frequency returned in r2 SWI XSound_SampleRate ; Frequency returned in r2
BVS linearDriverSampleRateFailed BVS linearDriverSampleRateFailed
MOV r0,r2 ; Return it in r0 MOV r0,r2 ; Return it in r0
linearDriverSampleRateExit linearDriverSampleRateExit
LDMIA sp!,{r1-r11,ws,pc} Pull "r1-r11,ws,pc"
linearDriverSampleRateFailed linearDriverSampleRateFailed
MOV r0, #0 ; indicates failure MOV r0, #0 ; indicates failure
...@@ -197,4 +193,4 @@ linearDriverSampleRateFailed ...@@ -197,4 +193,4 @@ linearDriverSampleRateFailed
; ----------- ; -----------
END END
This diff is collapsed.
...@@ -25,98 +25,98 @@ ...@@ -25,98 +25,98 @@
; ;
memoryStartVal memoryStartVal
DCD memoryStart DCD memoryStart
;---- ;----
startMem startMem
Push "lr" Entry
LDR r3,memoryStartVal LDR r3,memoryStartVal
MOV r0,#ModHandReason_Claim MOV r0,#ModHandReason_Claim
SWI XOS_Module SWI XOS_Module
Pull "pc", VS ; Flag an error - and don't start module EXIT VS ; Flag an error - and don't start module
STR r2,[ws] STR r2,[ws]
MOV r10,ws ; Use r10 as tempory private word pointer, for sound installation MOV r10,ws ; Use r10 as tempory private word pointer, for sound installation
MOV ws,r2 MOV ws,r2
STR r3,[ws,#work_memSize] STR r3,[ws,#work_memSize]
STR r10,[ws,#work_privateWord] STR r10,[ws,#work_privateWord]
Pull "pc" EXIT
; -------------------------------- Workspace routines ------------------------ ; -------------------------------- Workspace routines ------------------------
initWorkspace initWorkspace ROUT
Push "lr" Entry
; Clear memory ; Clear memory
ADD r1,ws,#:INDEX:work_privateWord + 4 ADD r1,ws,#:INDEX:work_privateWord + 4
LDR r2,memoryStartVal LDR r2,memoryStartVal
ADD r2,r2,ws ADD r2,r2,ws
MOV r0,#0 MOV r0,#0
initWorkspace_Loop initWorkspace_Loop
STR r0,[r1],#4 STR r0,[r1],#4
CMP r1,r2 CMP r1,r2
BCC initWorkspace_Loop BCC initWorkspace_Loop
; Specific values...... ; Specific values......
MOV r0,#0 MOV r0,#0
STR r0,[ws,#work_currentDriver] ; No driver installed yet STR r0,[ws,#work_currentDriver] ; No driver installed yet
STR r0,[ws,#work_SampleFrequency] STR r0,[ws,#work_SampleFrequency]
STR r0,[ws,#work_SamplePeriod] STR r0,[ws,#work_SamplePeriod]
STR r0,[ws,#work_SoundActive] ; No sound currently active STR r0,[ws,#work_SoundActive] ; No sound currently active
STR r0,[ws,#work_ControlWord] ; Control word for Replay STR r0,[ws,#work_ControlWord] ; Control word for Replay
STR r0,[ws,#work_ImmediateHandlers] STR r0,[ws,#work_ImmediateHandlers]
STR r0,[ws,#work_CallBackHandlers] STR r0,[ws,#work_CallBackHandlers]
STR r0,[ws,#work_ProcessHandlers] STR r0,[ws,#work_ProcessHandlers]
; Initialise the fillcode table ; Initialise the fillcode table
MOV r0,#0 MOV r0,#0
ADRL r1,fill_silence ADRL r1,fill_silence
ADRL r2,fill_data ADRL r2,fill_data
ADD lr,ws,#work_FillcodeTable ADD lr,ws,#work_FillcodeTable
STMIA lr,{r0-r2} STMIA lr,{r0-r2}
; .. Initialise handler table by setting handler_Address entries to 0 ; .. Initialise handler table by setting handler_Address entries to 0
ADD r0,ws,#work_handlerTable ; Position of table ADD r0,ws,#work_handlerTable ; Position of table
MOV r1,#handlerMax ; Number in table MOV r1,#handlerMax ; Number in table
MOV r2,#0 MOV r2,#0
initWorkHandlerTableLoop initWorkHandlerTableLoop
STR r2,[r0,#handler_Address] ; Store 0 in handler_Address STR r2,[r0,#handler_Address] ; Store 0 in handler_Address
ADD r0,r0,#handlerTableLen ; Increment to next table entry ADD r0,r0,#handlerTableLen ; Increment to next table entry
SUBS r1,r1,#1 ; Decrement count SUBS r1,r1,#1 ; Decrement count
BNE initWorkHandlerTableLoop ; Branch to start of loop BNE initWorkHandlerTableLoop ; Branch to start of loop
; .. Initialise driver table by setting driver_Address entries to 0 ; .. Initialise driver table by setting driver_Address entries to 0
ADD r0,ws,#work_driverTable ; Position of table ADD r0,ws,#work_driverTable ; Position of table
MOV r1,#driverMax ; Number in table MOV r1,#driverMax ; Number in table
MOV r2,#0 MOV r2,#0
initWorkDriverTableLoop initWorkDriverTableLoop
STR r2,[r0,#driver_Address] ; Store 0 in handler_Address STR r2,[r0,#driver_Address] ; Store 0 in handler_Address
ADD r0,r0,#driverTableLen ; Increment to next table entry ADD r0,r0,#driverTableLen ; Increment to next table entry
SUBS r1,r1,#1 ; Decrement count SUBS r1,r1,#1 ; Decrement count
BNE initWorkDriverTableLoop ; Branch to start of loop BNE initWorkDriverTableLoop ; Branch to start of loop
MOV r0,#0 MOV r0,#0
STR r0,[ws,#work_callBack_Active] STR r0,[ws,#work_callBack_Active]
STR r0,[ws,#work_callBack_Count] STR r0,[ws,#work_callBack_Count]
STR r0,[ws,#work_CallBack_BufferFullCount] STR r0,[ws,#work_CallBack_BufferFullCount]
STR r0,[ws,#work_CallBack_CurrentSoundBuffer] STR r0,[ws,#work_CallBack_CurrentSoundBuffer]
STR r0,[ws,#work_CallBack_CurrentOutBuffer] STR r0,[ws,#work_CallBack_CurrentOutBuffer]
MOV r0,#defaultNumCallBackBuffers MOV r0,#defaultNumCallBackBuffers
STR r0,[ws,#work_CallBack_numCallBackBuffers] STR r0,[ws,#work_CallBack_numCallBackBuffers]
Pull "pc" EXIT
END END
This diff is collapsed.
...@@ -27,39 +27,38 @@ ...@@ -27,39 +27,38 @@
; --------- ; ---------
[ doDMI [ doDMI
installDMIDriver installDMIDriver ROUT
; Set up the registers and table for ; Set up the registers and table for
; PowerWAVE_LinearHandler and call installDriver ; PowerWAVE_LinearHandler and call installDriver
Push "lr" Entry , 32
SUB sp,sp,#32
MOV r0,#32 MOV r0,#32
ADR r1,DMIDriverToken ADR r1,DMIDriverToken
MOV r2,sp MOV r2,sp
BL msgLookupToken BL msgLookupToken
MOV r3,sp ; Driver name MOV r3,sp ; Driver name
ADD R0,R12,#work_DriverEntryTable ; Get table address ADD R0,R12,#work_DriverEntryTable ; Get table address
ADR R1,DMIDriverInstall ; Install entry ADR R1,DMIDriverInstall ; Install entry
STR R1,[R0,#driverEntry_Install] STR R1,[R0,#driverEntry_Install]
ADR R1,DMIDriverRemove ; Remove entry ADR R1,DMIDriverRemove ; Remove entry
STR R1,[R0,#driverEntry_Remove] STR R1,[R0,#driverEntry_Remove]
ADR R1,DMIDriverSampleRate ; Sample rate entry ADR R1,DMIDriverSampleRate ; Sample rate entry
STR R1,[R0,#driverEntry_SampleRate] STR R1,[R0,#driverEntry_SampleRate]
MOV R1,#0 ; No volume entry MOV R1,#0 ; No volume entry
STR R1,[R0,#driverEntry_Volume] STR R1,[R0,#driverEntry_Volume]
MOV R1,#0 MOV R1,#0
STR R1,[R0,#driverEntry_Mixer] ; No mixer entry STR R1,[R0,#driverEntry_Mixer] ; No mixer entry
LDR R1,[R12,#work_privateWord] ; Parameter LDR R1,[R12,#work_privateWord] ; Parameter
MOV R2,#0 ; Flags MOV R2,#0 ; Flags
Debug gn,"Install DMI driver....." Debug gn,"Install DMI driver....."
Debug gn, " Table =",r0 Debug gn, " Table =",r0
...@@ -67,133 +66,132 @@ installDMIDriver ...@@ -67,133 +66,132 @@ installDMIDriver
Debug gn, " Flags =",r2 Debug gn, " Flags =",r2
DebugS gn, " Name =",r3 DebugS gn, " Name =",r3
BL installDriver BL installDriver
ADD sp,sp,#32 EXIT
Pull "PC"
DMIDriverToken DMIDriverToken
DCB "NmPow",0 DCB "NmPow",0
ALIGN ALIGN
; ------ ; ------
DMIDriverInstall DMIDriverInstall ROUT
; Install driver using PowerWAVE_LinearHandler ; Install driver using PowerWAVE_LinearHandler
; R0 = Handler address ; R0 = Handler address
; R1 = Parameter to pass ; R1 = Parameter to pass
; R12 = parameter for driver ; R12 = parameter for driver
; R14 already on stack ; R14 already on stack
STMDB R13!,{R1-R12} Push "R1-R12"
MOV R5,R0 ; Temorary store R0 and R1 MOV R5,R0 ; Temorary store R0 and R1
MOV R6,R1 MOV R6,R1
MOV R0,#0 ; Get current handler to see if already installed MOV R0,#0 ; Get current handler to see if already installed
SWI XPowerWAVE_LinearHandler SWI XPowerWAVE_LinearHandler
Debug gn," Current handler =",r1 Debug gn," Current handler =",r1
CMP R1,R5 ; Same handler? CMP R1,R5 ; Same handler?
CMPEQ R2,R6 ; Same parameter? CMPEQ R2,R6 ; Same parameter?
BEQ DMIDriverInstallExit ; Jump out 'cos already there BEQ DMIDriverInstallExit ; Jump out 'cos already there
Debug gn, " Install new handler =",r5 Debug gn, " Install new handler =",r5
; Now install new driver ; Now install new driver
MOV R0,#1 ; Function code install MOV R0,#1 ; Function code install
MOV R1,R5 ; Address MOV R1,R5 ; Address
MOV R2,R6 ; Parameter MOV R2,R6 ; Parameter
SWI XPowerWAVE_LinearHandler SWI XPowerWAVE_LinearHandler
MOV R0,R5 ; Restore R0 if successful MOV R0,R5 ; Restore R0 if successful
MOVVS R0,#0 ; Or 0 if error MOVVS R0,#0 ; Or 0 if error
DMIDriverInstallExit DMIDriverInstallExit
LDMIA R13!,{R1-R12,PC} Pull "R1-R12,PC"
; ----------- ; -----------
DMIDriverRemove DMIDriverRemove ROUT
; Remove driver using PowerWAVE_LinearHandler ; Remove driver using PowerWAVE_LinearHandler
; R14 already on stack ; R14 already on stack
STMDB R13!,{R0-R2} Push "R0-R2"
; To remove handler set new handler to 0 ; To remove handler set new handler to 0
MOV R0,#1 ; Function code install MOV R0,#1 ; Function code install
MOV R1,#0 ; Null handler MOV R1,#0 ; Null handler
MOV R2,#0 MOV R2,#0
SWI XPowerWAVE_LinearHandler SWI XPowerWAVE_LinearHandler
LDMIA R13!,{R0-R2,PC} Pull "R0-R2,PC"
; ----------- ; -----------
DMIDriverSampleRate DMIDriverSampleRate ROUT
; Choose rate and/or return current rate ; Choose rate and/or return current rate
; R0 = 0 to read ; R0 = 0 to read
; > 0 to set to R0 = frequency ; > 0 to set to R0 = frequency
; On exit: ; On exit:
; R0 = current frequency ; R0 = current frequency
STMDB R13!,{R1-R12} Push "R1-R12"
CMP R0,#0 CMP R0,#0
BEQ DMIDriverSampleRateRead BEQ DMIDriverSampleRateRead
; Set the rate to R0 ; Set the rate to R0
; Find the nearest ; Find the nearest
MOV R4,R0 ; R4 = rate required MOV R4,R0 ; R4 = rate required
MOV R0,#0 ; Read number of rates available MOV R0,#0 ; Read number of rates available
SWI XPowerWAVE_SampleRate ; R1 = number of rates available SWI XPowerWAVE_SampleRate ; R1 = number of rates available
MOV R5,R1 ; R5 = Upper limit MOV R5,R1 ; R5 = Upper limit
DMIDriverSampleRateLoop DMIDriverSampleRateLoop
MOV R0,#2 ; Convert from index to rate MOV R0,#2 ; Convert from index to rate
SWI XPowerWAVE_SampleRate ; R2 = rate SWI XPowerWAVE_SampleRate ; R2 = rate
CMP R2,R4 CMP R2,R4
BLT DMIDriverSampleRateClosest ; Best rate is between R1 and R5 BLT DMIDriverSampleRateClosest ; Best rate is between R1 and R5
CMP R1,#1 ; Are there any more rates CMP R1,#1 ; Are there any more rates
MOVNE R5,R1 ; Change upper limit MOVNE R5,R1 ; Change upper limit
MOVNE R6,R2 ; Store upper rate MOVNE R6,R2 ; Store upper rate
SUBNE R1,R1,#1 ; decrement index SUBNE R1,R1,#1 ; decrement index
BNE DMIDriverSampleRateLoop ; Try again BNE DMIDriverSampleRateLoop ; Try again
DMIDriverSampleRateClosest ; Check for nearest between R1 and R5 DMIDriverSampleRateClosest ; Check for nearest between R1 and R5
CMP R1,R5 ; No range to check CMP R1,R5 ; No range to check
BEQ DMIDriverSampleRateSet BEQ DMIDriverSampleRateSet
; R2 = lower rate, R1 = index ; R2 = lower rate, R1 = index
; R6 = upper rate, R5 = index ; R6 = upper rate, R5 = index
SUB R2,R4,R2 SUB R2,R4,R2
SUB R6,R6,R4 SUB R6,R6,R4
CMP R2,R6 ; Who is nearest CMP R2,R6 ; Who is nearest
MOVGT R1,R5 ; If nearest to R6 then set index to R5 MOVGT R1,R5 ; If nearest to R6 then set index to R5
DMIDriverSampleRateSet DMIDriverSampleRateSet
; Chosen index is R1 ; Chosen index is R1
MOV R0,#3 ; Select rate from index in R1 MOV R0,#3 ; Select rate from index in R1
SWI XPowerWAVE_SampleRate SWI XPowerWAVE_SampleRate
DMIDriverSampleRateRead DMIDriverSampleRateRead
MOV R0,#1 MOV R0,#1
SWI XPowerWAVE_SampleRate ; Frequency returned in R2 SWI XPowerWAVE_SampleRate ; Frequency returned in R2
MOV R0,R2 ; Return it in R0 MOV R0,R2 ; Return it in R0
LDMIA R13!,{R1-R12,PC} Pull "R1-R12,PC"
; ----------- ; -----------
DMIDriverName DMIDriverName
= "PowerWAVE Linear Handler",0 = "PowerWAVE Linear Handler",0
ALIGN ALIGN
] ]
END END
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.