mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
lcd-ssd1303 (all Clips) : move model specific code in their own files
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25248 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f14bb2287c
commit
91647264f8
8 changed files with 332 additions and 161 deletions
|
@ -1208,7 +1208,8 @@ target/arm/tcc77x/c100/audio-c100.c
|
|||
|
||||
#ifdef SANSA_CLIPPLUS
|
||||
#ifndef SIMULATOR
|
||||
target/arm/as3525/sansa-clip/lcd-ssd1303.c
|
||||
target/arm/as3525/lcd-ssd1303.c
|
||||
target/arm/as3525/sansa-clipplus/lcd-clip-plus.c
|
||||
target/arm/as3525/sansa-clipplus/lcd-as-clip-plus.S
|
||||
target/arm/as3525/sansa-clipplus/button-clip.c
|
||||
target/arm/as3525/sansa-clipplus/backlight-clip.c
|
||||
|
@ -1221,8 +1222,9 @@ target/arm/as3525/sansa-clip/powermgmt-clip.c
|
|||
|
||||
#ifdef SANSA_CLIPV2
|
||||
#ifndef SIMULATOR
|
||||
target/arm/as3525/sansa-clip/lcd-ssd1303.c
|
||||
target/arm/as3525/sansa-clip/lcd-as-clip.S
|
||||
target/arm/as3525/lcd-ssd1303.c
|
||||
target/arm/as3525/sansa-clipv2/lcd-clipv2.c
|
||||
target/arm/as3525/sansa-clip/lcd-as-clip.S /* TODO for clipv2 */
|
||||
target/arm/as3525/sansa-clipv2/button-clip.c
|
||||
target/arm/as3525/sansa-clipv2/backlight-clip.c
|
||||
#ifndef BOOTLOADER
|
||||
|
@ -1234,7 +1236,8 @@ target/arm/as3525/sansa-clip/powermgmt-clip.c
|
|||
|
||||
#ifdef SANSA_CLIP
|
||||
#ifndef SIMULATOR
|
||||
target/arm/as3525/sansa-clip/lcd-ssd1303.c
|
||||
target/arm/as3525/lcd-ssd1303.c
|
||||
target/arm/as3525/sansa-clip/lcd-clip.c
|
||||
target/arm/as3525/sansa-clip/lcd-as-clip.S
|
||||
target/arm/as3525/sansa-clip/button-clip.c
|
||||
target/arm/as3525/sansa-clip/backlight-clip.c
|
||||
|
|
|
@ -22,21 +22,13 @@
|
|||
****************************************************************************/
|
||||
#include "config.h"
|
||||
|
||||
#include "hwcompat.h"
|
||||
#include "kernel.h"
|
||||
#include "lcd.h"
|
||||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
#include "string.h"
|
||||
|
||||
/*** AS3525 specifics ***/
|
||||
#ifdef SANSA_CLIPV2
|
||||
#include "as3525v2.h"
|
||||
#else
|
||||
#include "as3525.h"
|
||||
#endif
|
||||
|
||||
#include "ascodec.h"
|
||||
#include "lcd-clip.h"
|
||||
|
||||
/*** definitions ***/
|
||||
|
||||
|
@ -73,125 +65,6 @@
|
|||
#define LCD_CNTL_HIGHCOL 0x10 /* Upper column address */
|
||||
#define LCD_CNTL_LOWCOL 0x00 /* Lower column address */
|
||||
|
||||
|
||||
static void lcd_hw_init(void)
|
||||
{
|
||||
#if defined(SANSA_CLIP)
|
||||
/* DBOP initialisation, do what OF does */
|
||||
CGU_DBOP = (1<<3) | AS3525_DBOP_DIV;
|
||||
|
||||
GPIOB_AFSEL = 0x08; /* DBOP on pin 3 */
|
||||
GPIOC_AFSEL = 0x0f; /* DBOP on pins 3:0 */
|
||||
|
||||
DBOP_CTRL = 0x51008;
|
||||
DBOP_TIMPOL_01 = 0x6E167;
|
||||
DBOP_TIMPOL_23 = 0xA167E06F;
|
||||
#elif defined(SANSA_CLIPV2)
|
||||
/* DBOP initialisation, do what OF does */
|
||||
CCU_IO |= (1<<12); /* ?? */
|
||||
CGU_DBOP |= /*(1<<3)*/ 0x18 | AS3525_DBOP_DIV;
|
||||
|
||||
DBOP_CTRL = 0x51004;
|
||||
DBOP_TIMPOL_01 = 0x36A12F;
|
||||
DBOP_TIMPOL_23 = 0xE037E037;
|
||||
#elif defined(SANSA_CLIPPLUS)
|
||||
CGU_PERI |= CGU_SSP_CLOCK_ENABLE;
|
||||
|
||||
SSP_CPSR = AS3525_SSP_PRESCALER; /* OF = 0x10 */
|
||||
SSP_CR0 = (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */
|
||||
SSP_CR1 = (1<<3) | (1<<1); /* SSP Operation enabled */
|
||||
SSP_IMSC = 0; /* No interrupts */
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SANSA_CLIP
|
||||
#define LCD_DELAY 1
|
||||
#else /* SANSA_CLIPV2 */
|
||||
#define LCD_DELAY 10
|
||||
#endif
|
||||
|
||||
#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2)
|
||||
void lcd_write_command(int byte)
|
||||
{
|
||||
volatile int i = 0;
|
||||
while(i<LCD_DELAY) i++;
|
||||
|
||||
/* unset D/C# (data or command) */
|
||||
#ifdef SANSA_CLIP
|
||||
GPIOA_PIN(5) = 0;
|
||||
#else /* SANSA_CLIPV2 */
|
||||
GPIOB_PIN(2) = 0;
|
||||
DBOP_TIMPOL_23 = 0xE0370036;
|
||||
#endif
|
||||
|
||||
/* Write command */
|
||||
/* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
|
||||
DBOP_DOUT = (byte << 8) | byte;
|
||||
|
||||
/* While push fifo is not empty */
|
||||
while ((DBOP_STAT & (1<<10)) == 0)
|
||||
;
|
||||
|
||||
#ifdef SANSA_CLIPV2
|
||||
DBOP_TIMPOL_23 = 0xE037E037;
|
||||
#endif
|
||||
}
|
||||
#elif defined(SANSA_CLIPPLUS)
|
||||
void lcd_write_command(int byte)
|
||||
{
|
||||
while(SSP_SR & (1<<4)) /* BSY flag */
|
||||
;
|
||||
|
||||
GPIOB_PIN(2) = 0;
|
||||
SSP_DATA = byte;
|
||||
|
||||
while(SSP_SR & (1<<4)) /* BSY flag */
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2)
|
||||
void lcd_write_data(const fb_data* p_bytes, int count)
|
||||
{
|
||||
volatile int i = 0;
|
||||
while(i<LCD_DELAY) i++;
|
||||
/* set D/C# (data or command) */
|
||||
#ifdef SANSA_CLIP
|
||||
GPIOA_PIN(5) = (1<<5);
|
||||
#else /* SANSA_CLIPV2 */
|
||||
GPIOB_PIN(2) = (1<<2);
|
||||
#endif
|
||||
|
||||
while (count--)
|
||||
{
|
||||
/* Write pixels */
|
||||
/* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
|
||||
DBOP_DOUT = (*p_bytes << 8) | *p_bytes;
|
||||
|
||||
p_bytes++; /* next packed pixels */
|
||||
|
||||
/* Wait if push fifo is full */
|
||||
while ((DBOP_STAT & (1<<6)) != 0);
|
||||
}
|
||||
/* While push fifo is not empty */
|
||||
while ((DBOP_STAT & (1<<10)) == 0);
|
||||
}
|
||||
#elif defined(SANSA_CLIPPLUS)
|
||||
void lcd_write_data(const fb_data* p_bytes, int count)
|
||||
{
|
||||
GPIOB_PIN(2) = (1<<2);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
while(!(SSP_SR & (1<<1))) /* wait until transmit FIFO is not full */
|
||||
;
|
||||
|
||||
SSP_DATA = *p_bytes++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** globals **/
|
||||
|
||||
static bool display_on; /* used by lcd_enable */
|
||||
|
@ -240,21 +113,14 @@ void lcd_enable(bool enable)
|
|||
|
||||
if( (display_on = enable) ) /* simple '=' is not a typo ! */
|
||||
{
|
||||
#ifdef SANSA_CLIP
|
||||
/* Enable DC-DC AS3525 for some Clip v1 that need it */
|
||||
ascodec_write(AS3514_DCDC15, 1);
|
||||
#endif
|
||||
|
||||
lcd_enable_power(enable);
|
||||
lcd_write_command(LCD_SET_DISPLAY_ON);
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
lcd_write_command(LCD_SET_DISPLAY_OFF);
|
||||
|
||||
#ifdef SANSA_CLIP
|
||||
/* Disable DC-DC AS3525 */
|
||||
ascodec_write(AS3514_DCDC15, 0);
|
||||
#endif
|
||||
lcd_enable_power(enable);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,24 +140,6 @@ void lcd_init_device(void)
|
|||
|
||||
lcd_hw_init();
|
||||
|
||||
#if defined(SANSA_CLIP)
|
||||
GPIOA_DIR |= 0x33; /* pins 5:4 and 1:0 out */
|
||||
GPIOB_DIR |= 0x40; /* pin 6 out */
|
||||
|
||||
GPIOA_PIN(1) = (1<<1);
|
||||
GPIOA_PIN(0) = (1<<0);
|
||||
GPIOA_PIN(4) = 0;
|
||||
GPIOB_PIN(6) = (1<<6);
|
||||
#elif defined(SANSA_CLIPV2)
|
||||
GPIOB_DIR |= (1<<2)|(1<<5);
|
||||
GPIOB_PIN(5) = (1<<5);
|
||||
#elif defined(SANSA_CLIPPLUS)
|
||||
GPIOA_DIR |= (1<<5);
|
||||
GPIOB_DIR |= (1<<2) | (1<<7);
|
||||
GPIOB_PIN(7) = 0;
|
||||
GPIOA_PIN(5) = (1<<5);
|
||||
#endif
|
||||
|
||||
/* Set display clock (divide ratio = 1) and oscillator frequency (1) */
|
||||
lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ);
|
||||
lcd_write_command(0x10);
|
89
firmware/target/arm/as3525/sansa-clip/lcd-clip.c
Normal file
89
firmware/target/arm/as3525/sansa-clip/lcd-clip.c
Normal file
|
@ -0,0 +1,89 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 François Dinel
|
||||
* Copyright (C) 2008-2009 Rafaël Carré
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "config.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
|
||||
void lcd_hw_init(void)
|
||||
{
|
||||
/* DBOP initialisation, do what OF does */
|
||||
CGU_DBOP = (1<<3) | AS3525_DBOP_DIV;
|
||||
|
||||
GPIOB_AFSEL = 0x08; /* DBOP on pin 3 */
|
||||
GPIOC_AFSEL = 0x0f; /* DBOP on pins 3:0 */
|
||||
|
||||
DBOP_CTRL = 0x51008;
|
||||
DBOP_TIMPOL_01 = 0x6E167;
|
||||
DBOP_TIMPOL_23 = 0xA167E06F;
|
||||
|
||||
GPIOA_DIR |= 0x33; /* pins 5:4 and 1:0 out */
|
||||
GPIOB_DIR |= 0x40; /* pin 6 out */
|
||||
|
||||
GPIOA_PIN(1) = (1<<1);
|
||||
GPIOA_PIN(0) = (1<<0);
|
||||
GPIOA_PIN(4) = 0;
|
||||
GPIOB_PIN(6) = (1<<6);
|
||||
}
|
||||
|
||||
#define LCD_DELAY 1
|
||||
|
||||
void lcd_write_command(int byte)
|
||||
{
|
||||
volatile int i = 0;
|
||||
while(i<LCD_DELAY) i++;
|
||||
|
||||
/* unset D/C# (data or command) */
|
||||
GPIOA_PIN(5) = 0;
|
||||
|
||||
/* Write command */
|
||||
/* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
|
||||
DBOP_DOUT = (byte << 8) | byte;
|
||||
|
||||
/* While push fifo is not empty */
|
||||
while ((DBOP_STAT & (1<<10)) == 0)
|
||||
;
|
||||
}
|
||||
|
||||
void lcd_write_data(const fb_data* p_bytes, int count)
|
||||
{
|
||||
volatile int i = 0;
|
||||
while(i<LCD_DELAY) i++;
|
||||
|
||||
/* set D/C# (data or command) */
|
||||
GPIOA_PIN(5) = (1<<5);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
/* Write pixels */
|
||||
/* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
|
||||
DBOP_DOUT = (*p_bytes << 8) | *p_bytes;
|
||||
|
||||
p_bytes++; /* next packed pixels */
|
||||
|
||||
/* Wait if push fifo is full */
|
||||
while ((DBOP_STAT & (1<<6)) != 0);
|
||||
}
|
||||
/* While push fifo is not empty */
|
||||
while ((DBOP_STAT & (1<<10)) == 0);
|
||||
}
|
28
firmware/target/arm/as3525/sansa-clip/lcd-clip.h
Normal file
28
firmware/target/arm/as3525/sansa-clip/lcd-clip.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008-2009 Rafaël Carré
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "ascodec.h"
|
||||
|
||||
void lcd_hw_init(void);
|
||||
static inline void lcd_enable_power(bool onoff)
|
||||
{
|
||||
ascodec_write(AS3514_DCDC15, onoff ? 1 : 0);
|
||||
}
|
66
firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c
Normal file
66
firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 François Dinel
|
||||
* Copyright (C) 2008-2009 Rafaël Carré
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "config.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
|
||||
void lcd_hw_init(void)
|
||||
{
|
||||
CGU_PERI |= CGU_SSP_CLOCK_ENABLE;
|
||||
|
||||
SSP_CPSR = AS3525_SSP_PRESCALER; /* OF = 0x10 */
|
||||
SSP_CR0 = (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */
|
||||
SSP_CR1 = (1<<3) | (1<<1); /* SSP Operation enabled */
|
||||
SSP_IMSC = 0; /* No interrupts */
|
||||
|
||||
GPIOA_DIR |= (1<<5);
|
||||
GPIOB_DIR |= (1<<2) | (1<<7);
|
||||
GPIOB_PIN(7) = 0;
|
||||
GPIOA_PIN(5) = (1<<5);
|
||||
}
|
||||
|
||||
void lcd_write_command(int byte)
|
||||
{
|
||||
while(SSP_SR & (1<<4)) /* BSY flag */
|
||||
;
|
||||
|
||||
GPIOB_PIN(2) = 0;
|
||||
SSP_DATA = byte;
|
||||
|
||||
while(SSP_SR & (1<<4)) /* BSY flag */
|
||||
;
|
||||
}
|
||||
|
||||
void lcd_write_data(const fb_data* p_bytes, int count)
|
||||
{
|
||||
GPIOB_PIN(2) = (1<<2);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
while(!(SSP_SR & (1<<1))) /* wait until transmit FIFO is not full */
|
||||
;
|
||||
|
||||
SSP_DATA = *p_bytes++;
|
||||
}
|
||||
}
|
26
firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h
Normal file
26
firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008-2009 Rafaël Carré
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lcd_hw_init(void);
|
||||
static inline void lcd_enable_power(bool onoff)
|
||||
{
|
||||
(void) onoff;
|
||||
}
|
26
firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h
Normal file
26
firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008-2009 Rafaël Carré
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lcd_hw_init(void);
|
||||
static inline void lcd_enable_power(bool onoff)
|
||||
{
|
||||
(void) onoff;
|
||||
}
|
85
firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c
Normal file
85
firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c
Normal file
|
@ -0,0 +1,85 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 François Dinel
|
||||
* Copyright (C) 2008-2009 Rafaël Carré
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "config.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
|
||||
void lcd_hw_init(void)
|
||||
{
|
||||
/* DBOP initialisation, do what OF does */
|
||||
CCU_IO |= (1<<12); /* ?? */
|
||||
CGU_DBOP |= /*(1<<3)*/ 0x18 | AS3525_DBOP_DIV;
|
||||
|
||||
DBOP_CTRL = 0x51004;
|
||||
DBOP_TIMPOL_01 = 0x36A12F;
|
||||
DBOP_TIMPOL_23 = 0xE037E037;
|
||||
|
||||
GPIOB_DIR |= (1<<2)|(1<<5);
|
||||
GPIOB_PIN(5) = (1<<5);
|
||||
}
|
||||
|
||||
#define LCD_DELAY 10
|
||||
|
||||
void lcd_write_command(int byte)
|
||||
{
|
||||
volatile int i = 0;
|
||||
while(i<LCD_DELAY) i++;
|
||||
|
||||
/* unset D/C# (data or command) */
|
||||
GPIOB_PIN(2) = 0;
|
||||
DBOP_TIMPOL_23 = 0xE0370036;
|
||||
|
||||
/* Write command */
|
||||
/* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
|
||||
DBOP_DOUT = (byte << 8) | byte;
|
||||
|
||||
/* While push fifo is not empty */
|
||||
while ((DBOP_STAT & (1<<10)) == 0)
|
||||
;
|
||||
|
||||
DBOP_TIMPOL_23 = 0xE037E037;
|
||||
}
|
||||
|
||||
void lcd_write_data(const fb_data* p_bytes, int count)
|
||||
{
|
||||
volatile int i = 0;
|
||||
while(i<LCD_DELAY) i++;
|
||||
|
||||
/* set D/C# (data or command) */
|
||||
GPIOB_PIN(2) = (1<<2);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
/* Write pixels */
|
||||
/* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
|
||||
DBOP_DOUT = (*p_bytes << 8) | *p_bytes;
|
||||
|
||||
p_bytes++; /* next packed pixels */
|
||||
|
||||
/* Wait if push fifo is full */
|
||||
while ((DBOP_STAT & (1<<6)) != 0);
|
||||
}
|
||||
/* While push fifo is not empty */
|
||||
while ((DBOP_STAT & (1<<10)) == 0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue