summaryrefslogtreecommitdiff
path: root/bootloader/meizu_m6sl.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/meizu_m6sl.c')
-rw-r--r--bootloader/meizu_m6sl.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/bootloader/meizu_m6sl.c b/bootloader/meizu_m6sl.c
new file mode 100644
index 0000000000..3bafd79e34
--- /dev/null
+++ b/bootloader/meizu_m6sl.c
@@ -0,0 +1,84 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Greg White
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "config.h"
20
21#include <stdlib.h>
22#include <stdio.h>
23#include "inttypes.h"
24#include "string.h"
25#include "cpu.h"
26#include "system.h"
27#include "lcd.h"
28#include "kernel.h"
29#include "thread.h"
30#include "ata.h"
31#include "fat.h"
32#include "disk.h"
33#include "font.h"
34#include "adc.h"
35#include "backlight.h"
36#include "backlight-target.h"
37#include "button.h"
38#include "panic.h"
39#include "power.h"
40#include "file.h"
41#include "common.h"
42#include "rbunicode.h"
43#include "usb.h"
44
45#include <stdarg.h>
46
47char version[] = APPSVERSION;
48
49void main(void)
50{
51 //Set backlight pin to output and enable
52 int oldval = PCON0;
53 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
54 PDAT0 |= (1 << 2);
55
56 //Set PLAY to input
57 oldval = PCON1;
58 PCON1 = ((oldval & ~(0xf << 16)) | (0 << 16));
59
60 //Set the piezo pins to output
61 oldval = PCON5;
62 PCON5 = ((oldval & ~((0xf << 4) | (0xf << 8))) | ((1 << 0) | (1 << 4)));
63 PDAT5 &= ~((1 << 1) | (1 << 2)); //should not be needed
64
65 PDAT5 |= (1 << 1); //Toggle piezo +
66
67 //toggle backlight on PLAY
68 while(true)
69 {
70 // Wait for play to be pressed
71 while(!(PDAT1 & (1 << 4)))
72 {
73 }
74
75 PDAT5 ^= (1 << 1); //Toggle piezo +
76 PDAT0 ^= (1 << 2); //Toggle packlight
77
78 // Wait for play to be released
79 while(PDAT1 & (1 << 4))
80 {
81 }
82 }
83}
84