summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S')
-rw-r--r--firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S103
1 files changed, 103 insertions, 0 deletions
diff --git a/firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S b/firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S
new file mode 100644
index 0000000000..add9f694de
--- /dev/null
+++ b/firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S
@@ -0,0 +1,103 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id:$
9 *
10 * Copyright (C) 2010 Marcin Bukat
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#include "config.h"
23#include "cpu.h"
24
25
26#define LCD_BASE_ADDRESS 0xf0000000
27
28 .section .icode,"ax",@progbits
29
30 .align 2
31 .global lcd_write_command
32 .type lcd_write_command,@function
33
34lcd_write_command:
35 move.l (4, %sp), %d0
36 move.w %d0, LCD_BASE_ADDRESS /* data is 1byte but CF uses word
37 * transfers only */
38 rts
39.wc_end:
40 .size lcd_write_command,.wc_end-lcd_write_command
41
42
43 .align 2
44 .global lcd_write_command_e
45 .type lcd_write_command_e,@function
46
47lcd_write_command_e:
48 lea.l LCD_BASE_ADDRESS, %a0
49
50 move.l (4, %sp), %d0 /* Command */
51 move.w %d0, (%a0)
52 move.l (8, %sp), %d0 /* Data */
53 move.w %d0, (%a0) /* Write to LCD */
54
55 rts
56.wce_end:
57 .size lcd_write_command_e,.wce_end-lcd_write_command_e
58
59
60 .align 2
61 .global lcd_write_data
62 .type lcd_write_data,@function
63
64/* PIXELFORMAT = VERTICAL_INTERLEAVED
65 * this means that data is packed verticaly in 8 pixels columns
66 * first byte is lsb of 2bit color in column
67 * second byte is msb of 2bit color in column
68 * so one word of data equals 8 pixels i 2bits color depth packed
69 * verticaly
70 */
71lcd_write_data:
72 movem.l (4, %sp), %a0 /* Data pointer */
73 move.l (8, %sp), %d0 /* Length i in words */
74 lea LCD_BASE_ADDRESS+2, %a1 /* LCD data port address */
75
76 btst #0, %d0 /* longwords multiply? */
77 beq .l_write
78
79.w_write:
80 move.w (%a0)+, %d1 /* load data 3 cycles*/
81 move.w %d1, (%a1) /* first byte 1 cycle*/
82 lsr.l #8, %d1 /* load second byte 1 cycle*/
83 move.w %d1, (%a1) /* transfer 1 cycle*/
84 subq.l #1, %d0 /* decrement counter 1 cycle*/
85 beq .write_end
86
87.l_write:
88 move.l (%a0)+, %d1 /* load data 2 cycles*/
89 swap %d1 /* 1 cycle */
90 move.w %d1, (%a1) /* first byte 1 cycle*/
91 lsr.l #8, %d1 /* 1 cycle */
92 move.w %d1, (%a1) /* second byte 1 cycle*/
93 lsr.l #8, %d1 /* 1 cycle */
94 move.w %d1, (%a1) /* third byte 1 cycle*/
95 lsr.l #8, %d1 /* 1 cycle */
96 move.w %d1, (%a1) /* forth byte 1 cycle*/
97 subq.l #2, %d0 /* decrement counter 1 cycle*/
98 bne .l_write
99
100.write_end:
101 rts
102 .size lcd_write_data,.wd_end-lcd_write_data
103