Commits (3)
  • John Ballance's avatar
    Made aware of another product that doesn't provide a sound driver till later. · 9e621a5f
    John Ballance authored
      Module will not then die when initialised
    Detail:
    Admin:
    
    
    Version 1.86. Tagged as 'Sound0HAL-1_86'
    9e621a5f
  • John Ballance's avatar
    Improved startup with transient HAL sound device · 01f225b8
    John Ballance authored
    Detail:
       A previous mod provided a compile time switch to leave SoundDMA present
       even when there was no HAL audio device. This has proved unnecessary,
       so has been removed. Instead, once the HAL device has been made available
       one should rmreinit in order; SoundDMA, SoundChannels, SoundScheduler,
       and then WaveSynth, Percussion, and StringLib. This ensures that the module
       dependant interactions are reinitialised.
       Additionally there was a possibility that if no HAL audio devices were
       available at startup it was possible to get a null pointer error under
       some circumstances.
    Admin:
       tested in iMx6 with other HAL audio devices both enabled and disabled
    
    Version 1.87. Tagged as 'Sound0HAL-1_87'
    01f225b8
  • Jeffrey Lee's avatar
    Allow module initialisation to succeed if there is no audio device present · 0da194ee
    Jeffrey Lee authored
    Detail:
      Since we can cope with audio devices dynamically being added and removed once initialisation is complete, it seems sensible to also cope with the situation where no devices are available on startup.
      s/Sound0 - Rearrange Initialise_Module so that if no device is found on startup, the initial state of the module will be the same as if a device had been found but then went missing: configuration SWIs will continue to function, the next device to appear will automatically be selected as the active device (with sound automatically turning on), and manual Sound_Enable calls will produce an error saying no device is present. These changes should also allow the module to cope with situations where other support modules like DMAManager, RTSupport, or VFPSupport are (temporarily) unavailable on startup.
    Admin:
      Tested on iMX6
    
    
    Version 1.88. Tagged as 'Sound0HAL-1_88'
    0da194ee
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.85"
Module_Version SETA 185
Module_MajorVersion SETS "1.88"
Module_Version SETA 188
Module_MinorVersion SETS ""
Module_Date SETS "12 Jun 2016"
Module_ApplicationDate SETS "12-Jun-16"
Module_Date SETS "04 Aug 2018"
Module_ApplicationDate SETS "04-Aug-18"
Module_ComponentName SETS "Sound0HAL"
Module_ComponentPath SETS "castle/RiscOS/Sources/HWSupport/Sound/Sound0HAL"
Module_FullVersion SETS "1.85"
Module_HelpVersion SETS "1.85 (12 Jun 2016)"
Module_FullVersion SETS "1.88"
Module_HelpVersion SETS "1.88 (04 Aug 2018)"
END
/* (1.85)
/* (1.88)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.85
#define Module_MajorVersion_CMHG 1.88
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 12 Jun 2016
#define Module_Date_CMHG 04 Aug 2018
#define Module_MajorVersion "1.85"
#define Module_Version 185
#define Module_MajorVersion "1.88"
#define Module_Version 188
#define Module_MinorVersion ""
#define Module_Date "12 Jun 2016"
#define Module_Date "04 Aug 2018"
#define Module_ApplicationDate "12-Jun-16"
#define Module_ApplicationDate "04-Aug-18"
#define Module_ComponentName "Sound0HAL"
#define Module_ComponentPath "castle/RiscOS/Sources/HWSupport/Sound/Sound0HAL"
#define Module_FullVersion "1.85"
#define Module_HelpVersion "1.85 (12 Jun 2016)"
#define Module_LibraryVersionInfo "1:85"
#define Module_FullVersion "1.88"
#define Module_HelpVersion "1.88 (04 Aug 2018)"
#define Module_LibraryVersionInfo "1:88"
......@@ -153,6 +153,7 @@ StrongARM SETL {TRUE}
GET Hdr:DMA
GET Hdr:CPU.Arch
GET Hdr:RTSupport
GET Hdr:OsBytes
OPT OptList
OPT OptPage
......@@ -217,7 +218,6 @@ TimingCode SETL {FALSE}
TimingTimer * 1 ; Which HAL timer to use
]
;
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Level0 data structure
......@@ -263,7 +263,8 @@ SoundGain_C # 1 ; value of additional gain as currently compiled into conv code
; Constants
; SC prefix for SoundConstant
SCPeriod * 45 ; default, i.e. 22050 Hz
SCRate * 22050 ; default
SCPeriod * 1000000/SCRate
SCBufferLen * 224 ; 224 bytes/channel (&E0: multiple of 16)
SCLogChannel * 0 ; default log2nchan = 0 -> 1 channel
......@@ -1374,6 +1375,8 @@ Sound0Enable Entry "r1,r4,r11,r12"
; Is DMAManager in use?
MOV r4, r12
LDR r0, [r4, #HALDevice]
TEQ r0, #0
BEQ %ft30 ; no valid hal device
LDR r2, [r0, #HALDevice_Version]
CMP r2, #2:SHL:16 ; API 2+?
LDRHS r2, [r0, #HALDevice_AudioCustomDMAEnable]
......@@ -2168,7 +2171,8 @@ CopySampleRatesToBuffer
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; In r0-r6 trashable
Initialise_Module Entry "r7, r8, r10, r11"
Initialise_Module ROUT
Entry "r7, r8, r10, r11"
LDR r2, [r12]
TEQ r2, #0
......@@ -2243,7 +2247,7 @@ Initialise_Module Entry "r7, r8, r10, r11"
LDR r1, [sp, #2*4] ; pick up physical address into R1
ADD sp, sp, #12 ; release temp space
EXIT VS ; ought never to fail!
MOV r0, #0 ; Semaphore ON (so reenable wakens it)
MOV r0, #&80000000 ; Semaphore off until we've found a device
ADD r1, r1, #SoundDMABufferSize
ADRL r2, ProtoS0S ; address sound0segment prototype
LDMIA r2, {r2,r3,r4,r5,r6,r7,r8}; load it up (from Buff0 onwards)
......@@ -2254,19 +2258,8 @@ Initialise_Module Entry "r7, r8, r10, r11"
STR r0, [r10, #ImagesC_N] ; compacted form, into top of pipeline
STR r0, [r10, #ImagesC_H] ; and for next buffer
; Build device list
BL Initialise_DeviceList
; Set up DMA (+ select default device)
BL Initialise_DMA
[ UseNEON
; Get our VFPSupport context
BLVC Initialise_NEON
]
BVS %FT90
; go fetch 16-bit sound control info from CMOS
MOV r0, #161 ; CMOS read OSBYTE
MOV r0, #OsByte_ReadCMOS
MOV r1, #PrintSoundCMOS ; get extended (VIDC20) sound bits
SWI XOS_Byte ; "won't" fail
......@@ -2275,20 +2268,30 @@ Initialise_Module Entry "r7, r8, r10, r11"
; bit 6:5 form 16-bit sound control value (VIDC20 specific, irrelevant to us)
TST r2, #&80 ; Extract oversample setting
ORRNE r4, r4, #OversampleFlag :SHL: 24
STR r4, [r10, #Config] ; store config, with correct flags in
; Get stereo reverse flag from HAL device
LDR r2, [r12, #HALDevice]
LDR lr, [r2, #HALDevice_Version]
CMP lr, #2:SHL:16
LDRGE lr, [r2, #HALDevice_AudioFlags]
ASSERT AudioFlag_StereoReverse = 1
ASSERT DoReverse = &20
ANDGE lr, lr, #AudioFlag_StereoReverse
ORRGE r4, r4, lr, LSL #5+24
LDR r0, =SCRate*1024
STR r0, [r12, #CurSRValue] ; set sensible CurSRValue for if we find no device on startup
STR r4, [r10, #Config] ; store config, with correct flags in
; Build device list (may fail, but error can be ignored)
BL Initialise_DeviceList
; Set up DMA (+ select default device)
BL Initialise_DMA
[ UseNEON
; Get our VFPSupport context
BLVC Initialise_NEON
]
; If we failed to init, set the flag so that we'll try again later
MOVVS r0, #1
STRVSB r0, [r12, #ReenableFlag]
MVNVS r0, #0
STRVS r0, [r12, #HALSRIndex] ; and flag that we should reprogram the device upon initialisation
; ... else clear semaphore so that Sound0Reenable will actually turn sound on
MOVVC r0, #0
STRVC r0, [r10, #Semaphore]
20 MOV r0, r4, LSR #24 ; get log2nchan + flags byte
MOV r0, r4, LSR #24 ; get log2nchan + flags byte
AND r0, r0, #3 ; get log2nchan alone into r0
LDR r1, [r10, #SoundRMA]
[ :LNOT: UseNEON
......@@ -2302,7 +2305,7 @@ Initialise_Module Entry "r7, r8, r10, r11"
STRB r0, [r10, #Log2nchan_C] ; do same for log2nchan
ORR r2, r2, #SCSoundGain :SHL: 24 ; combine default soundgain into r2
BL compile ; go call compiler to set it all up
30
MOV r6, r4, LSL #16 ; build 16-bit Length (in sample times)
MOV r6, r6, LSR #16
MOV r7, r4, LSR #24 ; build LogChannel count in r7
......@@ -2317,14 +2320,14 @@ Initialise_Module Entry "r7, r8, r10, r11"
MOV r3, #0
MOV r4, #0
SEI SVC32_mode ; IRQ off please
BL Sound0InitConfig ; Configure sample rate & buffer size, taking into account any constraints
BL Sound0InitConfig ; Configure initial sample rate & buffer size
BL Sound0Reenable ; Turn on system
CLI SVC32_mode ; Reenabled IRQs
BVS %FT90 ; May fail, e.g. RTSupport unavailable
MOV r0, #Service_SoundLevel0Alive
MOV r1, #Service_Sound
SWI XOS_ServiceCall
CLRV
EXIT
......