forked from bondagit/aes67-linux-daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ravenna-alsa-lkm-arm-32bit.patch
323 lines (312 loc) · 18.7 KB
/
ravenna-alsa-lkm-arm-32bit.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
diff --git a/driver/RTP_audio_stream.c b/driver/RTP_audio_stream.c
index 5a160e4..a5c84e4 100644
--- a/driver/RTP_audio_stream.c
+++ b/driver/RTP_audio_stream.c
@@ -40,6 +40,7 @@
#include "RTP_audio_stream.h"
#include "MTAL_DP.h"
+#include "c_wrapper_lib.h"
#define DEBUG_TRACE(x) MTAL_DP("[RTP Stream] "); MTAL_DP x
#define ASSERT(x) {if(!(x)) { MTAL_DP("Assert in %s line %i\n", __FILE__, __LINE__); }}
@@ -377,7 +378,7 @@ int Create(TRTP_audio_stream* self, TRTP_stream_info* pRTP_stream_info, rtp_audi
// if audio data format was changed we have to mute channels with the proper mute pattern; for now, we always mute
for(us = 0; us < pRTP_stream_info->m_byNbOfChannels; us++)
{
- //MTAL_DP("[%u] m_pvLivesInCircularBuffer[us] = 0x%x buffer length = %u wordlength = %u\n", us, m_pvLivesInCircularBuffer[us], pManager->get_live_in_jitter_buffer_length(pManager->user), m_usAudioEngineSampleWordLength);
+ //MTAL_DP("[%u] m_pvLivesInCircularBuffer[us] = 0x%x buffer length = %u wordlength = %u\n", us, self->m_pvLivesInCircularBuffer[us], pManager->get_live_in_jitter_buffer_length(pManager->user), self->m_usAudioEngineSampleWordLength);
if(self->m_pvLivesInCircularBuffer[us])
{ // mute
@@ -413,7 +414,7 @@ int Destroy(TRTP_audio_stream* self)
unsigned short us;
for(us = 0; us < pRTP_stream_info->m_byNbOfChannels; us++)
{
- //MTAL_DP("[%u] m_pvLivesInCircularBuffer[us] = 0x%x buffer length = %u wordlength = %u\n", us, m_pvLivesInCircularBuffer[us], pManager->get_live_in_jitter_buffer_length(pManager->user), m_usAudioEngineSampleWordLength);
+ //MTAL_DP("[%u] m_pvLivesInCircularBuffer[us] = 0x%x buffer length = %u wordlength = %u\n", us, self->m_pvLivesInCircularBuffer[us], self->m_pManager->get_live_in_jitter_buffer_length(self->m_pManager->user), self->m_usAudioEngineSampleWordLength);
if(self->m_pvLivesInCircularBuffer[us])
{ // mute
@@ -782,7 +783,7 @@ int ProcessRTPAudioPacket(TRTP_audio_stream* self, TRTPPacketBase* pRTPPacketBas
//MTAL_DP("ui32RTPSAC %u perfcounter %I64u\n", ui32RTPSAC, MTAL_LK_GetCounterTime());
// ui32UsedSAC is the first frame SAC when this packet will be used
- ui64UsedSAC = (ui64RTPSAC - (ui64RTPSAC % pManager->get_frame_size(pManager->user)));
+ ui64UsedSAC = (ui64RTPSAC - (CW_ll_modulo(ui64RTPSAC, pManager->get_frame_size(pManager->user))));
i64DeltaSAC = ui64UsedSAC - ui64GlobalSAC;
//MTAL_DP("i64DeltaSAC %I64u playout delay %u, frame size: %u\n", i64DeltaSAC, pRTP_stream_info->m_ui32PlayOutDelay, pManager->get_frame_size(pManager->user));
diff --git a/driver/audio_driver.c b/driver/audio_driver.c
index a04ec21..cb8b056 100644
--- a/driver/audio_driver.c
+++ b/driver/audio_driver.c
@@ -1205,8 +1205,8 @@ static int mr_alsa_audio_pcm_capture_copy_internal( struct snd_pcm_substream *s
{
int ret_pu;
char val = 0xf1;
- __put_user_x(1, val, (unsigned long __user *)src, ret_pu);
- ret_pu = put_user(val, (unsigned long __user *)src);
+ //__put_user_x(1, val, (unsigned long __user *)src, ret_pu);
+ ret_pu = put_user(val, (unsigned char __user *)src);
//put_user(val, (unsigned long __user *)src);
switch(nb_logical_bits)
{
@@ -2758,4 +2758,4 @@ void mr_alsa_audio_card_exit(void)
g_ravenna_peer = NULL;
g_mr_alsa_audio_ops = NULL;
printk(KERN_INFO "leaving mr_alsa_audio_card_exit..\n");
-}
\ No newline at end of file
+}
diff --git a/driver/manager.c b/driver/manager.c
index 5a90eca..8023708 100644
--- a/driver/manager.c
+++ b/driver/manager.c
@@ -1272,10 +1272,10 @@ uint32_t get_live_in_jitter_buffer_offset(void* user, const uint64_t ui64Current
struct TManager* self = (struct TManager*)user;
#if defined(MT_TONE_TEST) || defined (MT_RAMP_TEST) || defined (MTLOOPBACK) || defined (MTTRANSPARENCY_CHECK)
- return (uint32_t)(ui64CurrentSAC % get_live_in_jitter_buffer_length(self));
+ return (uint32_t)CW_ll_modulo(ui64CurrentSAC, get_live_in_jitter_buffer_length(self));
#else
uint32_t live_in_jitter_buffer_length = self->m_alsa_driver_frontend->get_capture_buffer_size_in_frames(self->m_pALSAChip);
- return (uint32_t)(ui64CurrentSAC % live_in_jitter_buffer_length);
+ return (uint32_t)CW_ll_modulo(ui64CurrentSAC, live_in_jitter_buffer_length);
#endif
}
@@ -1298,7 +1298,7 @@ uint32_t get_live_out_jitter_buffer_offset(void* user, const uint64_t ui64Curren
struct TManager* self = (struct TManager*)user;
#if defined(MT_TONE_TEST) || defined (MT_RAMP_TEST) || defined (MTLOOPBACK) || defined (MTTRANSPARENCY_CHECK)
- return (uint32_t)(ui64CurrentSAC % get_live_out_jitter_buffer_length(self));
+ return (uint32_t)CW_ll_modulo(ui64CurrentSAC, get_live_out_jitter_buffer_length(self));
#else
uint32_t offset = self->m_alsa_driver_frontend->get_playback_buffer_offset(self->m_pALSAChip);
const uint32_t sacOffset = (uint32_t)(get_global_SAC(self) - get_frame_size(self) - ui64CurrentSAC);
@@ -1432,9 +1432,9 @@ void AudioFrameTIC(void* user)
{
#if defined(MT_TONE_TEST)
unsigned long p = (self->m_tone_test_phase * self->m_SampleRate) / LUTSampleRate;
- int16_t val16 = LUT[(p + 4 * chIdx) % LUTnbPoints]/* >> 1*/;
+ int16_t val16 = LUT[CW_ll_modulo((p + 4 * chIdx), LUTnbPoints)]/* >> 1*/;
int32_t val24 = val16 << 8;
- self->m_tone_test_phase = (self->m_tone_test_phase + 1) % (LUTnbPoints * 100);
+ self->m_tone_test_phase = CW_ll_modulo((self->m_tone_test_phase + 1), (LUTnbPoints * 100));
#elif defined(MT_RAMP_TEST)
int32_t val24 = self->m_ramp_test_phase;
if(val24 >= 8388608) // 2^23
diff --git a/driver/MTAL_DP.h b/driver/MTAL_DP.h
index 1f0fb89..8aeaba2 100644
--- a/driver/MTAL_DP.h
+++ b/driver/MTAL_DP.h
@@ -129,26 +129,34 @@
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
#include <linux/kern_levels.h>
- #define MTAL_DP(...) MTAL_LK_print(KERN_INFO __VA_ARGS__)
+ #define MTAL_DP(...)
+ //#define MTAL_DP(...) MTAL_LK_print(KERN_INFO __VA_ARGS__)
#define MTAL_DP_EMRG(...) MTAL_LK_print(KERN_EMERG __VA_ARGS__)
#define MTAL_DP_ALERT(...) MTAL_LK_print(KERN_ALERT __VA_ARGS__)
#define MTAL_DP_CRIT(...) MTAL_LK_print(KERN_CRIT __VA_ARGS__)
#define MTAL_DP_ERR(...) MTAL_LK_print(KERN_ERR __VA_ARGS__)
#define MTAL_DP_WARN(...) MTAL_LK_print(KERN_WARNING __VA_ARGS__)
- #define MTAL_DP_NOTICE(...) MTAL_LK_print(KERN_NOTICE __VA_ARGS__)
- #define MTAL_DP_INFO(...) MTAL_LK_print(KERN_INFO __VA_ARGS__)
- #define MTAL_DP_DEBUG(...) MTAL_LK_print(KERN_DEBUG __VA_ARGS__)
+ #define MTAL_DP_NOTICE(...)
+ //#define MTAL_DP_NOTICE(...) MTAL_LK_print(KERN_NOTICE __VA_ARGS__)
+ #define MTAL_DP_INFO(...)
+ //#define MTAL_DP_INFO(...) MTAL_LK_print(KERN_INFO __VA_ARGS__)
+ #define MTAL_DP_DEBUG(...)
+ //#define MTAL_DP_DEBUG(...) MTAL_LK_print(KERN_DEBUG __VA_ARGS__)
#else
//#include <linux/kernel.h>
- #define MTAL_DP(...) MTAL_LK_print("<d>"__VA_ARGS__)
+ #define MTAL_DP(...)
+ //#define MTAL_DP(...) MTAL_LK_print("<d>"__VA_ARGS__)
#define MTAL_DP_EMRG(...) MTAL_LK_print("<>"__VA_ARGS__)
#define MTAL_DP_ALERT(...) MTAL_LK_print("<1>"__VA_ARGS__)
#define MTAL_DP_CRIT(...) MTAL_LK_print("<2>"__VA_ARGS__)
#define MTAL_DP_ERR(...) MTAL_LK_print("<3>"__VA_ARGS__)
#define MTAL_DP_WARN(...) MTAL_LK_print("<4>"__VA_ARGS__)
- #define MTAL_DP_NOTICE(...) MTAL_LK_print("<5>"__VA_ARGS__)
- #define MTAL_DP_INFO(...) MTAL_LK_print("<6>"__VA_ARGS__)
- #define MTAL_DP_DEBUG(...) MTAL_LK_print("<7>"__VA_ARGS__)
+ #define MTAL_DP_NOTICE(...)
+ //#define MTAL_DP_NOTICE(...) MTAL_LK_print("<5>"__VA_ARGS__)
+ #define MTAL_DP_INFO(...)
+ //#define MTAL_DP_INFO(...) MTAL_LK_print("<6>"__VA_ARGS__)
+ #define MTAL_DP_DEBUG(...)
+ //#define MTAL_DP_DEBUG(...) MTAL_LK_print("<7>"__VA_ARGS__)
#endif
diff --git a/driver/MTConvert.c b/driver/MTConvert.c
index c94bc03..c9fdffe 100644
--- a/driver/MTConvert.c
+++ b/driver/MTConvert.c
@@ -1318,10 +1318,10 @@ int MTConvertMappedInt32ToInt16LEInterleave(void** input_buffer, const uint32_t
{
const uint8_t* in = (uint8_t*)input_buffer[ch] + in_pos;
#if defined(MTAL_LINUX) && defined(MTAL_KERNEL)
- __put_user_x(1, in[1], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[1], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[0], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[0], (unsigned char __user *)out);
ret |= ret_pu;
out++;
#else
@@ -1358,10 +1358,10 @@ int MTConvertMappedInt32ToInt16LEInterleave(void** input_buffer, const uint32_t
{
const uint8_t* in = (uint8_t*)input_buffer[ch] + in_pos;
#if defined(MTAL_LINUX) && defined(MTAL_KERNEL)
- __put_user_x(1, in[2], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[2], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[3], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[3], (unsigned char __user *)out);
ret |= ret_pu;
out++;
#else
@@ -1411,13 +1411,13 @@ int MTConvertMappedInt32ToInt24LEInterleave(void** input_buffer, const uint32_t
{
const uint8_t* in = (uint8_t*)input_buffer[ch] + in_pos;
#if defined(MTAL_LINUX) && defined(MTAL_KERNEL)
- __put_user_x(1, in[2], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[2], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[1], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[1], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[0], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[0], (unsigned char __user *)out);
ret |= ret_pu;
out++;
#else
@@ -1457,13 +1457,13 @@ int MTConvertMappedInt32ToInt24LEInterleave(void** input_buffer, const uint32_t
{
const uint8_t* in = (uint8_t*)input_buffer[ch] + in_pos;
#if defined(MTAL_LINUX) && defined(MTAL_KERNEL)
- __put_user_x(1, in[1], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[1], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[2], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[2], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[3], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[3], (unsigned char __user *)out);
ret |= ret_pu;
out++;
#else
@@ -1516,16 +1516,16 @@ int MTConvertMappedInt32ToInt24LE4ByteInterleave(void** input_buffer, const uint
const uint8_t* in = (uint8_t*)input_buffer[ch] + in_pos;
#if defined(MTAL_LINUX) && defined(MTAL_KERNEL)
char zero = 0x00;
- __put_user_x(1, in[2], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[2], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[1], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[1], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[0], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[0], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, zero, (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(zero, (unsigned char __user *)out);
ret |= ret_pu;
out++;
#else
@@ -1568,16 +1568,16 @@ int MTConvertMappedInt32ToInt24LE4ByteInterleave(void** input_buffer, const uint
const uint8_t* in = (uint8_t*)input_buffer[ch] + in_pos;
#if defined(MTAL_LINUX) && defined(MTAL_KERNEL)
char zero = 0x00;
- __put_user_x(1, in[1], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[1], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[2], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[2], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[3], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[3], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, zero, (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(zero, (unsigned char __user *)out);
ret |= ret_pu;
out++;
#else
@@ -1600,16 +1600,16 @@ int MTConvertMappedInt32ToInt24LE4ByteInterleave(void** input_buffer, const uint
const uint8_t* in = (uint8_t*)input_buffer[ch] + in_pos;
#if defined(MTAL_LINUX) && defined(MTAL_KERNEL)
char zero = 0x00;
- __put_user_x(1, in[1], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[1], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[2], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[2], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[3], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[3], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, zero, (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(zero, (unsigned char __user *)out);
ret |= ret_pu;
out++;
#else
@@ -1648,16 +1648,16 @@ int MTConvertMappedInt32ToInt32LEInterleave(void** input_buffer, const uint32_t
{
const uint8_t* in = (uint8_t*)input_buffer[ch] + in_pos;
#if defined(MTAL_LINUX) && defined(MTAL_KERNEL)
- __put_user_x(1, in[3], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[3], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[2], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[2], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[1], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[1], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[0], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[0], (unsigned char __user *)out);
ret |= ret_pu;
out++;
#else
@@ -1699,16 +1699,16 @@ int MTConvertMappedInt32ToInt32LEInterleave(void** input_buffer, const uint32_t
{
const uint8_t* in = (uint8_t*)input_buffer[ch] + in_pos;
#if defined(MTAL_LINUX) && defined(MTAL_KERNEL)
- __put_user_x(1, in[0], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[0], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[1], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[1], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[2], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[2], (unsigned char __user *)out);
ret |= ret_pu;
out++;
- __put_user_x(1, in[3], (unsigned long __user *)out, ret_pu);
+ ret_pu = put_user(in[3], (unsigned char __user *)out);
ret |= ret_pu;
out++;
#else
@@ -1867,6 +1867,7 @@ void MTConvertBigEndianInt16ToMappedInt32DeInterleave( void* input_buffer,
uint32_t i, ch;
const unsigned int stride_in = 2 * nb_channels, stride_out = 4;
const unsigned int out_pos = offset_output_buf * stride_out;
+
for(ch = 0; ch < nb_channels; ++ch)
{
uint8_t* in = (uint8_t*)input_buffer + 2 * ch;