as3525: use DMA for recording
[kugel-rb.git] / bootloader / meizu_m6sp.c
blob064d3fc8df94e34cb35ebae81f91ae3518f5b44d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 by Greg White
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include "config.h"
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include "inttypes.h"
26 #include "string.h"
27 #include "cpu.h"
28 #include "system.h"
29 #include "lcd.h"
30 #include "kernel.h"
31 #include "thread.h"
32 #include "storage.h"
33 #include "fat.h"
34 #include "disk.h"
35 #include "font.h"
36 #include "button.h"
37 #include "panic.h"
38 #include "power.h"
39 #include "file.h"
40 #include "common.h"
41 #include "rbunicode.h"
42 #include "usb.h"
43 #include "qt1106.h"
44 #include "bitmaps/rockboxlogo.h"
46 #include <stdarg.h>
48 char version[] = APPSVERSION;
49 #define LONG_DELAY 200000
50 #define SHORT_DELAY 50000
51 #define PAUSE_DELAY 50000
53 static inline void delay(int duration)
55 volatile int i;
56 for(i=0;i<duration;i++);
60 void bl_debug(bool bit)
62 if (bit)
64 PDAT0 ^= (1 << 2); //Toggle backlight
65 delay(LONG_DELAY);
66 PDAT0 ^= (1 << 2); //Toggle backlight
67 delay(LONG_DELAY);
69 else
71 PDAT0 ^= (1 << 2); //Toggle backlight
72 delay(SHORT_DELAY);
73 PDAT0 ^= (1 << 2); //Toggle backlight
74 delay(SHORT_DELAY);
78 void bl_debug_count(unsigned int input)
80 unsigned int i;
81 delay(SHORT_DELAY*3);
82 for (i = 0; i < input; i++)
84 PDAT0 ^= (1 << 2); //Toggle backlight
85 delay(SHORT_DELAY);
86 PDAT0 ^= (1 << 2); //Toggle backlight
87 delay(2*SHORT_DELAY);
90 void bl_debug_int(unsigned int input,unsigned int count)
92 unsigned int i;
93 for (i = 0; i < count; i++)
95 bl_debug(input>>i & 1);
97 delay(SHORT_DELAY*6);
100 void main(void)
102 //Set backlight pin to output and enable
103 int oldval = PCON0;
104 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
105 PDAT0 |= (1 << 2);
107 //Set PLAY to input
108 oldval = PCON1;
109 PCON1 = ((oldval & ~(0xf << 16)) | (0 << 16));
111 lcd_bitmap(rockboxlogo, 0, 0, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo);
112 lcd_init_device();
114 // Wait for play to be pressed
115 while(!(PDAT1 & (1 << 4)));
116 // Wait for play to be released
117 while((PDAT1 & (1 << 4)));
118 PDAT0 ^= (1 << 2); //Toggle backlight
119 delay(LONG_DELAY);
121 //power off
122 PDAT1&=~(1<<3);