1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2010 Marcin Bukat
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 ****************************************************************************/
26 #define LCD_BASE_ADDRESS 0xf0000000
28 .section .icode,"ax",@progbits
31 .global lcd_write_command
32 .type lcd_write_command,@function
36 move.w %d0, LCD_BASE_ADDRESS /* data is 1byte but CF uses word
40 .size lcd_write_command,.wc_end-lcd_write_command
44 .global lcd_write_command_e
45 .type lcd_write_command_e,@function
48 lea.l LCD_BASE_ADDRESS, %a0
50 move.l (4, %sp), %d0 /* Command */
52 move.l (8, %sp), %d0 /* Data */
53 move.w %d0, (%a0) /* Write to LCD */
57 .size lcd_write_command_e,.wce_end-lcd_write_command_e
61 .global lcd_write_data
62 .type lcd_write_data,@function
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
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 */
76 btst #0, %d0 /* longwords multiply? */
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*/
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*/
102 .size lcd_write_data,.wd_end-lcd_write_data