diff options
Diffstat (limited to 'firmware/target/arm/as3525/sansa-fuze/lcd-fuzev1.c')
-rw-r--r-- | firmware/target/arm/as3525/sansa-fuze/lcd-fuzev1.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuzev1.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuzev1.c new file mode 100644 index 0000000000..0c56ee3070 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuzev1.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Dave Chapman | ||
11 | * | ||
12 | * LCD driver for the Sansa Fuze - controller unknown | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | #include "config.h" | ||
24 | |||
25 | #include "cpu.h" | ||
26 | #include "lcd.h" | ||
27 | #include "system.h" | ||
28 | #include "clock-target.h" | ||
29 | #include "dbop-as3525.h" | ||
30 | #include "lcd-fuze.h" | ||
31 | |||
32 | void lcd_write_cmd(int16_t cmd) | ||
33 | { | ||
34 | /* Write register */ | ||
35 | DBOP_TIMPOL_23 = 0xa167006e; | ||
36 | dbop_write_data(&cmd, 1); | ||
37 | |||
38 | int delay = 4; | ||
39 | do { | ||
40 | nop; | ||
41 | } while(delay--); | ||
42 | |||
43 | DBOP_TIMPOL_23 = 0xa167e06f; | ||
44 | } | ||
45 | |||
46 | void lcd_write_reg(int reg, int value) | ||
47 | { | ||
48 | int16_t data = value; | ||
49 | |||
50 | lcd_write_cmd(reg); | ||
51 | dbop_write_data(&data, 1); | ||
52 | } | ||
53 | |||
54 | |||
55 | static void as3525_dbop_init(void) | ||
56 | { | ||
57 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; | ||
58 | |||
59 | DBOP_TIMPOL_01 = 0xe167e167; | ||
60 | DBOP_TIMPOL_23 = 0xe167006e; | ||
61 | |||
62 | /* short count: 16 | output data width: 16 | readstrobe line */ | ||
63 | DBOP_CTRL = (1<<18|1<<12|1<<3); | ||
64 | |||
65 | GPIOB_AFSEL = 0xfc; | ||
66 | GPIOC_AFSEL = 0xff; | ||
67 | |||
68 | DBOP_TIMPOL_23 = 0x6000e; | ||
69 | |||
70 | /* short count: 16|enable write|output data width: 16|read strobe line */ | ||
71 | DBOP_CTRL = (1<<18|1<<16|1<<12|1<<3); | ||
72 | DBOP_TIMPOL_01 = 0x6e167; | ||
73 | DBOP_TIMPOL_23 = 0xa167e06f; | ||
74 | } | ||
75 | |||
76 | |||
77 | void lcd_init_device(void) | ||
78 | { | ||
79 | as3525_dbop_init(); | ||
80 | |||
81 | GPIOA_DIR |= (1<<5|1<<4|1<<3); | ||
82 | GPIOA_PIN(5) = 0; | ||
83 | GPIOA_PIN(3) = (1<<3); | ||
84 | GPIOA_PIN(4) = 0; | ||
85 | GPIOA_PIN(5) = (1<<5); | ||
86 | |||
87 | fuze_display_on(); | ||
88 | } | ||