FreeCalypso > hg > fc-tourmaline
annotate src/g23m-fad/ra/ra_shm.c @ 288:25d3ee009d19
audio tone amplitudes: band-aid fix for FC Luna
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 13 Nov 2021 05:02:57 +0000 |
parents | fa8dc04885d8 |
children |
rev | line source |
---|---|
1
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 +----------------------------------------------------------------------------- |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 | Project : GSM-F&D (8411) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 | Modul : RA_SHM |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 +----------------------------------------------------------------------------- |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 | Copyright 2002 Texas Instruments Berlin, AG |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 | All rights reserved. |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 | |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 | This file is confidential and a trade secret of Texas |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 | Instruments Berlin, AG |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 | The receipt of or possession of this file does not convey |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 | any rights to reproduce or disclose its contents or to |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 | manufacture, use, or sell anything it may describe, in |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 | whole, or in part, without the specific written consent of |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 | Texas Instruments Berlin, AG. |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 +----------------------------------------------------------------------------- |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 | Purpose : This Modul defines the functions for accessing the |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 | shared memory segment between MCU and DSP |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 +----------------------------------------------------------------------------- |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 */ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #ifndef RA_SHM_C |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #define RA_SHM_C |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #endif |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #define ENTITY_RA |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 /*==== INCLUDES ===================================================*/ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #include <string.h> |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "typedefs.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include "pconst.cdg" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #include "vsi.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #include "custom.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 #include "gsm.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #include "cnf_ra.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 #include "prim.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #include "pei.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 #include "tok.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #include "ccdapi.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 #include "ra.h" |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 /*==== CONST ======================================================*/ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 /*==== TYPES ======================================================*/ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 /*==== VARIABLES ==================================================*/ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 /*==== FUNCTIONS ==================================================*/ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 /* |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 +--------------------------------------------------------------------+ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 | PROJECT : GSM-F&D (8411) MODULE : RA_SHM | |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 | STATE : code ROUTINE : shm_set_dsp_buffer | |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 +--------------------------------------------------------------------+ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 PURPOSE : |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 */ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 GLOBAL USHORT shm_set_dsp_buffer(T_FRAME_DESC *data, register USHORT *buffer, USHORT offs, USHORT free) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 register UBYTE *b; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 USHORT len, segment; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 buffer = (USHORT*) ( ( (UBYTE*) buffer ) + offs ); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 /* |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 * write the both segments specified by the frame descriptor data to the DSP mem. |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 */ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 for (segment = 0; segment < 2; segment++) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 /* |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 * limitate the length fields; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 */ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 len = free; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 if (len > data->Len[segment]) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 len = data->Len[segment]; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 if (len) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 data->Len[segment] -= len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 b = data->Adr[segment]; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 memcpy( (UBYTE*) buffer, (UBYTE*) b, (USHORT) len ); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 buffer = (USHORT*) ( ( (UBYTE*) buffer ) + len ); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 free -= len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 offs += len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 return offs; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 GLOBAL U8 shm_set_dsp_buffer_new(T_FD *pFD, USHORT *buffer, U8 offs, U8 free) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 U8 len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 buffer = (USHORT*)(((UBYTE*)buffer) + offs); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 /* |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 * limitate the length fields; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 */ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 len = MINIMUM(free, pFD->len); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 if (len) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 memcpy((UBYTE*)buffer, (UBYTE*)pFD->buf, (USHORT)len); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 buffer = (USHORT*)(((UBYTE*)buffer) + len); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 return len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 /* |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 +--------------------------------------------------------------------+ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 | PROJECT : GSM-F&D (8411) MODULE : RA_SHM | |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 | STATE : code ROUTINE : shm_get_dsp_buffer | |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 +--------------------------------------------------------------------+ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 PURPOSE : |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 */ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 GLOBAL USHORT shm_get_dsp_buffer(T_FRAME_DESC *data, register USHORT *buffer, USHORT bytes_to_read) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 register UBYTE *b; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 USHORT offs = 0; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 USHORT len, segment; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 /* |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 * read the both segments specified by the frame descriptor data from the DSP mem |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 */ |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 for (segment = 0; segment < 2; segment++) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 len = MINIMUM(data->Len[segment], bytes_to_read); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 if (len) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 data->Len[segment] -= len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 b = data->Adr[segment]; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 #ifdef TI_PS_16BIT_CPY |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 api_memcpy((UBYTE*)b, (UBYTE*)buffer, (USHORT)len ); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 #else |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 memcpy((UBYTE*)b, (UBYTE*)buffer, (USHORT)len ); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 #endif |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 buffer = (USHORT*)(((UBYTE*)buffer) + len); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 bytes_to_read -= len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 offs += len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 return offs; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 GLOBAL U8 shm_get_dsp_buffer_new(USHORT *buffer, U8 bytes_to_read, T_FD *pFD) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 U8 len = MINIMUM(pFD->len, bytes_to_read); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 if (len) |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 { |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 pFD->len = len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 #ifdef TI_PS_16BIT_CPY |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 api_memcpy(pFD->buf, (UBYTE*)buffer, len); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 #else |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 memcpy(pFD->buf, (UBYTE*)buffer, len); |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 #endif |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 return len; |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 } |
fa8dc04885d8
src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 |