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
|
/*! \file events.hcc
*
* \section generic This module contains the various actions and events
* that need to be performed.
*
* \section project Project information.
* Project Graphic Equalizer\n
* \author O.M. Schinagl
* \date 20041710
* \version 0.1
*
* \section copyright Copyright
* Copyright ©2004 Koninklijke Philips Electronics N.V. All rights reserved
*
* \section history Change history
* 20041710: O.M. Schinagl\n Initial version
*
*****************************************************************************/
/******** System Includes *************/
#include <stdlib.hch>
#include "pal_master.hch"
/******** Application Includes ********/
#include "configuration.hch"
#include "eventhandler_shared.hch"
#include "events.hch"
#if HAVE_DEBUG
#include "debug.hch"
#endif
/*! \fn void load_preset(unsigned 20 preset_address, unsigned 4 *equalizer_levels);
* \brief This function loads 768 4bits presets into the equalizer_levels
* array pointed to by equalizer_levels.
*
* \param preset_address PL2Ram address where preset to be
* loaded is.
* \param *equalizer_levels Location where to store presets loaded
* from ram.
*
* \return void
* \retval void
*/
void load_preset(unsigned 20 preset_address, unsigned 4 *equalizer_levels) {
macro expr RAM_BANK0 = PalPL2RAMCT(0);
macro expr AW = PalPL2RAMGetMaxAddressWidthCT();
macro expr DW = PalPL2RAMGetMaxDataWidthCT();
unsigned DW data;
unsigned AW address;
unsigned 10 equalizer_index;
address = preset_address;
/*
* PL2Ram needs a clockclycle between the set of an address and read.
* Therefore we set it once here.
*/
PalPL2RAMSetReadAddress(RAM_BANK0, address);
/*
*
*/
for (equalizer_index = 0; equalizer_index != 768; equalizer_index += 2) {
/*
* We've allready set the address hence we can allready
* increase it for next use.
*/
address++;
PalPL2RAMRead(RAM_BANK0, &data);
#if HAVE_DEBUG
print_hex_value(0 @ data[3:0]);print_string(" ");print_hex_value(0 @ data[7:4]);print_eol();
#endif
equalizer_levels[equalizer_index] = data[3:0];
equalizer_levels[equalizer_index +1] = data[7:4];
}
} /* --- load_preset() --- */
/*
* Equalizer lookuptabes.
* TODO: This table is now hardcoded. To ensure full skinability this table
* should be dynamically loaded.
*/
ram unsigned 4 equalizer_table[640] = {15, 15, 15, 15, 15, 14, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0};
ram unsigned 10 equalizer_table_inv[16] = {446, 444, 440, 436, 432, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 384};
|