diff options
Diffstat (limited to 'firmware/target/arm/as3525/sansa-clipplus')
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c | 66 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h | 26 |
2 files changed, 92 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c new file mode 100644 index 0000000000..66e4de98ed --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 François Dinel | ||
11 | * Copyright (C) 2008-2009 Rafaël Carré | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | #include "config.h" | ||
23 | |||
24 | #include "lcd.h" | ||
25 | #include "system.h" | ||
26 | #include "cpu.h" | ||
27 | |||
28 | void lcd_hw_init(void) | ||
29 | { | ||
30 | CGU_PERI |= CGU_SSP_CLOCK_ENABLE; | ||
31 | |||
32 | SSP_CPSR = AS3525_SSP_PRESCALER; /* OF = 0x10 */ | ||
33 | SSP_CR0 = (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */ | ||
34 | SSP_CR1 = (1<<3) | (1<<1); /* SSP Operation enabled */ | ||
35 | SSP_IMSC = 0; /* No interrupts */ | ||
36 | |||
37 | GPIOA_DIR |= (1<<5); | ||
38 | GPIOB_DIR |= (1<<2) | (1<<7); | ||
39 | GPIOB_PIN(7) = 0; | ||
40 | GPIOA_PIN(5) = (1<<5); | ||
41 | } | ||
42 | |||
43 | void lcd_write_command(int byte) | ||
44 | { | ||
45 | while(SSP_SR & (1<<4)) /* BSY flag */ | ||
46 | ; | ||
47 | |||
48 | GPIOB_PIN(2) = 0; | ||
49 | SSP_DATA = byte; | ||
50 | |||
51 | while(SSP_SR & (1<<4)) /* BSY flag */ | ||
52 | ; | ||
53 | } | ||
54 | |||
55 | void lcd_write_data(const fb_data* p_bytes, int count) | ||
56 | { | ||
57 | GPIOB_PIN(2) = (1<<2); | ||
58 | |||
59 | while (count--) | ||
60 | { | ||
61 | while(!(SSP_SR & (1<<1))) /* wait until transmit FIFO is not full */ | ||
62 | ; | ||
63 | |||
64 | SSP_DATA = *p_bytes++; | ||
65 | } | ||
66 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h new file mode 100644 index 0000000000..753759638e --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008-2009 Rafaël Carré | ||
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 | |||
22 | void lcd_hw_init(void); | ||
23 | static inline void lcd_enable_power(bool onoff) | ||
24 | { | ||
25 | (void) onoff; | ||
26 | } | ||