-
Notifications
You must be signed in to change notification settings - Fork 0
/
StereoSystem.c
108 lines (82 loc) · 2.24 KB
/
StereoSystem.c
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
#include "Global.h"
struct Cursor* mouse;
bool loadSDCard(alt_up_sd_card_dev* device) {
if((device = alt_up_sd_card_open_dev("/dev/SD_Card")) != NULL) {
if (alt_up_sd_card_is_Present()) {
printf("Card connected.\n");
if (alt_up_sd_card_is_FAT16()) {
printf("FAT16 file system detected.\n");
return true;
} else {
printf("Unknown file system.\n");
}
}
}
return false;
}
void initAnimate(struct Cursor* cursor) {
int timer = 3000000;
IOWR_16DIRECT(TIMESTAMP_BASE, 8, timer & 0xFFFF);
IOWR_16DIRECT(TIMESTAMP_BASE, 12, timer >> 16);
IOWR_16DIRECT(TIMESTAMP_BASE, 4, 0x07);
alt_irq_register(TIMESTAMP_IRQ, cursor, (void*)animate_ISR);
}
void initAudioBuffer() {
int timer = 3000000;
IOWR_16DIRECT(AUDIOBUFFERPROCESS_BASE, 8, timer & 0xFFFF);
IOWR_16DIRECT(AUDIOBUFFERPROCESS_BASE, 12, timer >> 16);
IOWR_16DIRECT(AUDIOBUFFERPROCESS_BASE, 4, 0x08);
alt_irq_register(AUDIOBUFFERPROCESS_IRQ, NULL, (void*)mix_ISR);
}
int main()
{
//SD device initialization
up_dev.device_reference = NULL;
while(!loadSDCard(up_dev.device_reference)) {
printf("SD card is not connected.\n");
}
initVGA();
initAudioDeviceController();
initSoundMixer();
struct CmdScheduler* scheduler = initCmdScheduler();
//Serial device initialization
com = initRS232(scheduler);
initPushKeyController();
initDatabase();
initMemory();
//sync database
update();
//Test VGA Output
/*struct Image* testImg;
while((testImg = loadSDImage("TEST.BMP")) == NULL);
draw(35, 35, testImg);
killImage(testImg);*/
//alt_up_char_buffer_string(char_buffer, "Initialization Completed", 27, 5);
alt_up_pixel_buffer_dma_clear_screen(pixel_buffer, 0);
alt_up_char_buffer_clear(char_buffer);
//graphicTester();
struct Frame* mainFrame = initMainFrame();
mainFrame->drawFrame(mainFrame);
//Test End
mouse = initCursor(10, 100, mainFrame);
//graphicTester();
//drawAllSongsInList(2);
//drawAllSongsInList(2);
/*int i;
struct Frame* b;
for (i = 0; i < 5000; i++){
drawAllSongsInList(2);
//b = initSongInListPanel(mainFrame, 2);
//killSongInListPanel(&b);
printf("Iteration %d\n", i);
}*/
initAudioBuffer();
initAnimate(mouse);
int i = 2;
syncPlay(1, 100, 0);
while(1) {
cmdProcessing(scheduler);
i = soundTester(i);
}
return 0;
}