Marcoen Hirschberg | 48e45f5 | 2008-09-17 23:22:11 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2006 by Greg White |
| 11 | * |
| 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. |
| 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | #include "config.h" |
| 22 | |
| 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" |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame] | 32 | #include "storage.h" |
Marcoen Hirschberg | 48e45f5 | 2008-09-17 23:22:11 +0000 | [diff] [blame] | 33 | #include "disk.h" |
| 34 | #include "font.h" |
Marcoen Hirschberg | 48e45f5 | 2008-09-17 23:22:11 +0000 | [diff] [blame] | 35 | #include "button.h" |
| 36 | #include "panic.h" |
| 37 | #include "power.h" |
| 38 | #include "file.h" |
| 39 | #include "common.h" |
| 40 | #include "rbunicode.h" |
| 41 | #include "usb.h" |
| 42 | #include "qt1106.h" |
Bertrik Sikken | 52ca187 | 2009-10-25 11:31:13 +0000 | [diff] [blame] | 43 | #include "bitmaps/rockboxlogo.h" |
Marcoen Hirschberg | 48e45f5 | 2008-09-17 23:22:11 +0000 | [diff] [blame] | 44 | |
| 45 | #include <stdarg.h> |
| 46 | |
Marcoen Hirschberg | 48e45f5 | 2008-09-17 23:22:11 +0000 | [diff] [blame] | 47 | #define LONG_DELAY 200000 |
| 48 | #define SHORT_DELAY 50000 |
| 49 | #define PAUSE_DELAY 50000 |
| 50 | |
| 51 | static inline void delay(int duration) |
| 52 | { |
| 53 | volatile int i; |
| 54 | for(i=0;i<duration;i++); |
| 55 | } |
| 56 | |
| 57 | |
| 58 | void bl_debug(bool bit) |
| 59 | { |
| 60 | if (bit) |
| 61 | { |
| 62 | PDAT0 ^= (1 << 2); //Toggle backlight |
| 63 | delay(LONG_DELAY); |
| 64 | PDAT0 ^= (1 << 2); //Toggle backlight |
| 65 | delay(LONG_DELAY); |
| 66 | } |
| 67 | else |
| 68 | { |
| 69 | PDAT0 ^= (1 << 2); //Toggle backlight |
| 70 | delay(SHORT_DELAY); |
| 71 | PDAT0 ^= (1 << 2); //Toggle backlight |
| 72 | delay(SHORT_DELAY); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | void bl_debug_count(unsigned int input) |
| 77 | { |
| 78 | unsigned int i; |
| 79 | delay(SHORT_DELAY*3); |
| 80 | for (i = 0; i < input; i++) |
| 81 | { |
| 82 | PDAT0 ^= (1 << 2); //Toggle backlight |
| 83 | delay(SHORT_DELAY); |
| 84 | PDAT0 ^= (1 << 2); //Toggle backlight |
| 85 | delay(2*SHORT_DELAY); |
| 86 | } |
| 87 | } |
| 88 | void bl_debug_int(unsigned int input,unsigned int count) |
| 89 | { |
| 90 | unsigned int i; |
| 91 | for (i = 0; i < count; i++) |
| 92 | { |
| 93 | bl_debug(input>>i & 1); |
| 94 | } |
| 95 | delay(SHORT_DELAY*6); |
| 96 | } |
| 97 | |
| 98 | void main(void) |
| 99 | { |
| 100 | //Set backlight pin to output and enable |
| 101 | int oldval = PCON0; |
| 102 | PCON0 = ((oldval & ~(3 << 4)) | (1 << 4)); |
| 103 | PDAT0 |= (1 << 2); |
| 104 | |
| 105 | //Set PLAY to input |
| 106 | oldval = PCON1; |
| 107 | PCON1 = ((oldval & ~(0xf << 16)) | (0 << 16)); |
| 108 | |
Bertrik Sikken | 52ca187 | 2009-10-25 11:31:13 +0000 | [diff] [blame] | 109 | lcd_bitmap(rockboxlogo, 0, 0, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo); |
| 110 | lcd_init_device(); |
| 111 | |
| 112 | // Wait for play to be pressed |
Marcoen Hirschberg | 48e45f5 | 2008-09-17 23:22:11 +0000 | [diff] [blame] | 113 | while(!(PDAT1 & (1 << 4))); |
| 114 | // Wait for play to be released |
| 115 | while((PDAT1 & (1 << 4))); |
| 116 | PDAT0 ^= (1 << 2); //Toggle backlight |
| 117 | delay(LONG_DELAY); |
| 118 | |
| 119 | //power off |
| 120 | PDAT1&=~(1<<3); |
| 121 | } |
| 122 | |