From e021688cba70fb76731d32a379e20bee2ac6316a Mon Sep 17 00:00:00 2001
From: Jeffrey Lee <jlee@gitlab.riscosopen.org>
Date: Tue, 17 Dec 2013 21:31:56 +0000
Subject: [PATCH] Fix left/right sound channels being swapped on Pandora

Detail:
  s/PAudio - Change the Pandora audio device over to API version 2 so that we can specify the stereo reverse flag
  s/Audio - Adjust workspace of the audio device used by the other machines so that it's still the same size as the Pandora one. Note that the stereo reverse flag isn't needed - although I can't remember how I'm doing it, it seems there's some TWL feature which I'm making use of on other machines to deal with the stereo reversal there, as the hardware doesn't use VIDC channel order by default
  hdr/Audio - Adjust size of the shared audio device workspace
Admin:
  Tested on Pandora & BB-xM


Version 0.93. Tagged as 'OMAP3-0_93'
---
 VersionNum | 20 ++++++++++----------
 hdr/Audio  |  2 +-
 s/Audio    |  2 ++
 s/PAudio   |  7 ++++++-
 4 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/VersionNum b/VersionNum
index 6118385..b466cbd 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,23 +1,23 @@
-/* (0.92)
+/* (0.93)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  * Last processed by srccommit version: 1.1.
  *
  */
-#define Module_MajorVersion_CMHG        0.92
+#define Module_MajorVersion_CMHG        0.93
 #define Module_MinorVersion_CMHG        
-#define Module_Date_CMHG                15 Dec 2013
+#define Module_Date_CMHG                17 Dec 2013
 
-#define Module_MajorVersion             "0.92"
-#define Module_Version                  92
+#define Module_MajorVersion             "0.93"
+#define Module_Version                  93
 #define Module_MinorVersion             ""
-#define Module_Date                     "15 Dec 2013"
+#define Module_Date                     "17 Dec 2013"
 
-#define Module_ApplicationDate          "15-Dec-13"
+#define Module_ApplicationDate          "17-Dec-13"
 
 #define Module_ComponentName            "OMAP3"
 #define Module_ComponentPath            "castle/RiscOS/Sources/HAL/OMAP3"
 
-#define Module_FullVersion              "0.92"
-#define Module_HelpVersion              "0.92 (15 Dec 2013)"
-#define Module_LibraryVersionInfo       "0:92"
+#define Module_FullVersion              "0.93"
+#define Module_HelpVersion              "0.93 (17 Dec 2013)"
+#define Module_LibraryVersionInfo       "0:93"
diff --git a/hdr/Audio b/hdr/Audio
index 41273cc..13bec9e 100644
--- a/hdr/Audio
+++ b/hdr/Audio
@@ -171,7 +171,7 @@ ST_McBSP3_IRQ * 5
 ; Audio device
                        ^   0, a1
 ; Public bits
-AudioDevice            #   HALDevice_Audio_Size_1
+AudioDevice            #   HALDevice_Audio_Size_2
 ; Private bits
 AudioRegs              #   4 ; L4_McBSP*_Log
 AudioWorkspace         #   4 ; HAL workspace pointer
diff --git a/s/Audio b/s/Audio
index 965e869..b451b8e 100644
--- a/s/Audio
+++ b/s/Audio
@@ -472,6 +472,8 @@ AudioTemplate
         DCD     ratetab         ; Sample rate table
         DCD     AudioSetRate    ; SetRate function
         ASSERT  (.-AudioTemplate) = HALDevice_Audio_Size_1
+        %       16              ; Padding to keep things the same size as the Pandora device struct
+        ASSERT  (.-AudioTemplate) = HALDevice_Audio_Size_2
         DCD     0               ; Filled in during init
         DCD     0               ; Filled in during init
         DCD     0
diff --git a/s/PAudio b/s/PAudio
index 25dffb2..71e9105 100644
--- a/s/PAudio
+++ b/s/PAudio
@@ -295,7 +295,7 @@ AudioTemplate
         DCW     HALDeviceType_Audio + HALDeviceAudio_AudC
         DCW     HALDeviceID_AudC_Pandora
         DCD     HALDeviceBus_Ser + HALDeviceSerBus_IIC
-        DCD     1:SHL:16        ; API version
+        DCD     2:SHL:16        ; API version
         DCD     AudioDesc
         DCD     0               ; Address - N/A
         %       12              ; Reserved
@@ -326,6 +326,11 @@ AudioTemplate
         DCD     ratetab         ; Sample rate table
         DCD     AudioSetRate    ; SetRate function
         ASSERT  (.-AudioTemplate) = HALDevice_Audio_Size_1
+        DCD     0               ; AudioCustomDMAEnable
+        DCD     HALDevice_AudioFlag_StereoReverse
+        DCD     0               ; AudioMinBuffSize
+        DCD     0               ; AudioBuffAlign
+        ASSERT  (.-AudioTemplate) = HALDevice_Audio_Size_2
         DCD     0               ; Filled in during init
         DCD     0               ; Filled in during init
         DCD     0
-- 
GitLab