Commit dd79dd09 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Improvements to audio FIFOing

hdr/Audio: split AudioChannels to allow new AudioDMASize field to differentiate OMAP4430 v 4460.
Audio.s: handle FIFO underflow events of the audio stream, differentiate FIFO sizes for OMAP4430 v 4460.
SDMA.s: add prefetch flag in DMA control for audio channel
Submission from Willi Theiss.

Version 0.34. Tagged as 'OMAP4-0_34'
parent e5d37ea0
/* (0.33)
/* (0.34)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.33
#define Module_MajorVersion_CMHG 0.34
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 14 Apr 2014
#define Module_Date_CMHG 22 Apr 2014
#define Module_MajorVersion "0.33"
#define Module_Version 33
#define Module_MajorVersion "0.34"
#define Module_Version 34
#define Module_MinorVersion ""
#define Module_Date "14 Apr 2014"
#define Module_Date "22 Apr 2014"
#define Module_ApplicationDate "14-Apr-14"
#define Module_ApplicationDate "22-Apr-14"
#define Module_ComponentName "OMAP4"
#define Module_ComponentPath "castle/RiscOS/Sources/HAL/OMAP4"
#define Module_FullVersion "0.33"
#define Module_HelpVersion "0.33 (14 Apr 2014)"
#define Module_LibraryVersionInfo "0:33"
#define Module_FullVersion "0.34"
#define Module_HelpVersion "0.34 (22 Apr 2014)"
#define Module_LibraryVersionInfo "0:34"
......@@ -327,7 +327,8 @@ AudioRegs # 4 ; L4_McPDM_Log
AudioWorkspace # 4 ; HAL workspace pointer
AudioMode # 1 ; Softcopy of LPPLLCTL register
AudioMono # 1 ; flag (mono or stereo)
AudioChannels # 2 ; McPDM channel mask
AudioDMASize # 1 ; max. FIFO size (used for DMA)
AudioChannels # 1 ; McPDM channel mask
AudioChipCache # 48 ; Softcopy of Audio chip register
Audio_DeviceSize * :INDEX: @
......
......@@ -180,8 +180,7 @@ AUDIO_POWER_PIN * 127
AUDIO_POWER_DELAY * (50*1024) ; ~51 ms
; interrupt mask for use with McPDM downlink channel
;MCPDM_IRQ_DN_MASK * (MCPDM_IRQ_DN_EMPTY + MCPDM_IRQ_DN_FULL)
MCPDM_IRQ_DN_MASK * (MCPDM_IRQ_DN_FULL)
MCPDM_IRQ_DN_MASK * (MCPDM_IRQ_DN_EMPTY + MCPDM_IRQ_DN_FULL)
; flag for using only supported sample rates
GBLL AllSampleRates
......@@ -340,9 +339,21 @@ Audio_Init
ORR a2, a2, #MCPDM_DN_OFFSET_DN_OFST_RX2_EN
ORR a2, a3, a2
STR a2, [v3, #MCPDM_DN_OFFSET]
; configure downlink threshold
MOV a2, #(8 - 1)
; configure downlink threshold (differentiate between OMAP4460 and OMAP4430)
LDR a1, L4_Core_Log
ADD a1, a1, #(L4_SYSCTRL_GENERAL_CORE - L4_Core)
LDR a2, [a1, #CONTROL_ID_CODE]
UBFX a1, a2, #12, #16 ; HAWKEYE field
MOV v1, #HAWKEYE_OMAP4460_ES10
CMP a1, v1
MOVEQ a2, #(8 - 1)
MOVNE a2, #1
STR a2, [v3, #MCPDM_FIFO_CTRL_DN]
; remember usable FIFO size
MOVEQ a2, #8
MOVNE a2, #16
ADD a3, v4, #:INDEX: AudioDMASize
STRB a2, [a3]
30
......@@ -441,7 +452,8 @@ AudioTemplate
DCD 0 ; AudioWorkspace: filled in during init
DCB 0 ; AudioMode
DCB 0 ; AudioMono
DCW 0 ; AudioChannels
DCB 0 ; AudioDMASize
DCB 0 ; AudioChannels
% 48 ; AudioChipCache
ALIGN
......@@ -521,7 +533,7 @@ AudioActivate
CMP a4, #0
MOVNE a4, #(MCPDM_CTRL_PDM_DN1_EN)
MOVEQ a4, #(MCPDM_CTRL_PDM_DN1_EN + MCPDM_CTRL_PDM_DN2_EN)
STRH a4, AudioChannels
STRB a4, AudioChannels
STRB a3, AudioMode
BL SetCodecMode
10 LDMDB v1!,{a3-a4}
......@@ -566,12 +578,10 @@ PreEnable
; McPDM has at most 16 FIFO entries; 1 entry contains 2 channels (stereo)
; packet size is handled in element numbers
LDR a3, AudioWorkspace
; remark: setting threshold to 1 and using all FIFO entries does not work on OMAP4460
; it works on OMAP4430 (better than everything else)
LDRB a4, AudioMono
CMP a4, #0
MOVEQ a4, #(8 * 2) ; stereo mode
MOVNE a4, #(8 * 1) ; mono mode (R is copy of L)
LDRB a4, AudioDMASize
MOVEQ a4, a4, LSL #1 ; double it for stereo
STR a4, [a3, #:INDEX: DMAPktSz_Audio]
MOV pc, lr
......@@ -587,7 +597,7 @@ PostEnable
]
Push "a1"
LDR v1, AudioRegs
LDRH v2, AudioChannels
LDRB v2, AudioChannels
; set McPDM Downlink path to reset state
; omap_mcpdm_reset_playback(1)
......@@ -701,7 +711,7 @@ IRQHandle
DebugReg a2,"IRQHandle: IRQSTATUS="
Pull "sb,lr"
]
[ {TRUE} ;{FALSE}
[ {FALSE}
; Just clear the IRQ and ask for an audio reset
LDR a3, AudioRegs
MVN a2, #0
......@@ -721,11 +731,16 @@ IRQHandle
BIC a2, a2, #MCPDM_DL_CHANNELS
ORR a2, a2, #MCPDM_CTRL_SW_DN_RST ; reset downlink path
STR a2, [a3, #MCPDM_CTRL]
LDRH a1, AudioChannels
ORR a2, a2, a1 ; reenable channels
STR a2, [a3, #MCPDM_CTRL]
BIC a2, a2, #MCPDM_CTRL_SW_DN_RST ; release reset
STR a2, [a3, #MCPDM_CTRL]
; prepare some data in FIFO (to avoid underflow)
MOV a2, #0
STR a2, [a3, #MCPDM_DN_DATA]
STR a2, [a3, #MCPDM_DN_DATA]
LDR a2, [a3, #MCPDM_CTRL]
LDRB a1, AudioChannels
ORR a2, a2, a1 ; reenable channels
STR a2, [a3, #MCPDM_CTRL]
MOV a1, #0
MOV pc, lr
]
......@@ -747,7 +762,7 @@ AudioSetRate
CMP a4, #0
MOVNE a4, #(MCPDM_CTRL_PDM_DN1_EN)
MOVEQ a4, #(MCPDM_CTRL_PDM_DN1_EN + MCPDM_CTRL_PDM_DN2_EN)
STRH a4, AudioChannels
STRB a4, AudioChannels
STRB a3, AudioMode
BL SetCodecMode
EXIT
......
......@@ -624,7 +624,7 @@ SDMASetOptions
CMP a3, #0
; FS = BS = 1 ==> packet transfer; higher priority (R + W)
ORRNE ip, ip, #(DMA4_CCR_FS + DMA4_CCR_READ_PRIORITY)
ORRNE ip, ip, #DMA4_CCR_BS
ORRNE ip, ip, #(DMA4_CCR_BS + DMA4_CCR_PREFETCH)
ORRNE ip, ip, #DMA4_CCR_WRITE_PRIORITY
10
STR ip, [a4, #DMA4_CCRi]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment