|
4 | 4 | * SPDX-License-Identifier: Apache-2.0
|
5 | 5 | */
|
6 | 6 |
|
7 |
| - #ifndef SINE_H_ |
8 |
| - #define SINE_H_ |
| 7 | +#ifndef SINE_H_ |
| 8 | +#define SINE_H_ |
9 | 9 |
|
10 |
| -#if CONFIG_NOCACHE_MEMORY |
11 |
| -#define __NOCACHE __attribute__((__section__(".nocache"))) |
12 |
| -#elif defined(CONFIG_DT_DEFINED_NOCACHE) |
13 |
| -#define __NOCACHE __attribute__((__section__(CONFIG_DT_DEFINED_NOCACHE_NAME))) |
14 |
| -#else /* CONFIG_NOCACHE_MEMORY */ |
15 |
| -#define __NOCACHE |
16 |
| -#endif /* CONFIG_NOCACHE_MEMORY */ |
17 |
| - |
18 |
| -unsigned char __16kHz16bit_stereo_sine_pcm[] __NOCACHE; |
19 |
| -unsigned char __16kHz16bit_stereo_sine_pcm[] = { |
| 10 | +/* |
| 11 | + * Keep the PCM data in flash to avoid large RAM usage. |
| 12 | + * If a platform requires DMA-readable RAM buffers, copy |
| 13 | + * chunks of this table into a small nocache TX buffer |
| 14 | + * at runtime instead of keeping the entire table in RAM. |
| 15 | + */ |
| 16 | +static const unsigned char __16kHz16bit_stereo_sine_pcm[] = { |
20 | 17 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x0b, 0x08, 0x0b, 0xbb, 0x15, 0xbb, 0x15, 0xc9, 0x1f, 0xc9,
|
21 | 18 | 0x1f, 0xe4, 0x28, 0xe4, 0x28, 0xc8, 0x30, 0xc8, 0x30, 0x38, 0x37, 0x38, 0x37, 0x03, 0x3c,
|
22 | 19 | 0x03, 0x3c, 0x04, 0x3f, 0x04, 0x3f, 0x25, 0x40, 0x25, 0x40, 0x5d, 0x3f, 0x5d, 0x3f, 0xb1,
|
@@ -444,6 +441,6 @@ unsigned char __16kHz16bit_stereo_sine_pcm[] = {
|
444 | 441 | 0xa3, 0xc0, 0xa3, 0xc0, 0xdb, 0xbf, 0xdb, 0xbf, 0xfc, 0xc0, 0xfc, 0xc0, 0xfd, 0xc3, 0xfd,
|
445 | 442 | 0xc3, 0xc8, 0xc8, 0xc8, 0xc8, 0x38, 0xcf, 0x38, 0xcf, 0x1c, 0xd7, 0x1c, 0xd7, 0x37, 0xe0,
|
446 | 443 | 0x37, 0xe0, 0x45, 0xea, 0x45, 0xea, 0xf8, 0xf4, 0xf8, 0xf4};
|
447 |
| -const unsigned int __16kHz16bit_stereo_sine_pcm_len = sizeof(__16kHz16bit_stereo_sine_pcm); |
| 444 | +static const unsigned int __16kHz16bit_stereo_sine_pcm_len = ARRAY_SIZE(__16kHz16bit_stereo_sine_pcm); |
448 | 445 |
|
449 | 446 | #endif /* SINE_H_ */
|
0 commit comments