Add lcd driver (N35, T35 and A70).
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@272 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
f1d2ac8598
commit
b6d91f6f3b
|
@ -50,10 +50,12 @@ if rtconfig.RT_USING_RTGUI:
|
||||||
src_drv += ['touch.c', 'key.c']
|
src_drv += ['touch.c', 'key.c']
|
||||||
|
|
||||||
if rtconfig.RT_USING_RTGUI:
|
if rtconfig.RT_USING_RTGUI:
|
||||||
if rtconfig.RT_USING_LCD_TYPE == 'PNL_AT070TN84':
|
if rtconfig.RT_USING_LCD_TYPE == 'PNL_A70':
|
||||||
src_drv += ['lcd_at070.c']
|
src_drv += ['lcd_a70.c']
|
||||||
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_NEC320240':
|
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_N35':
|
||||||
src_drv += ['lcd.c']
|
src_drv += ['lcd_n35.c']
|
||||||
|
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_T35':
|
||||||
|
src_drv += ['lcd_t35.c']
|
||||||
|
|
||||||
if rtconfig.RT_USING_DEMO_GUI:
|
if rtconfig.RT_USING_DEMO_GUI:
|
||||||
src_drv += ['gui_init.c','demo_gui.c','info.c']
|
src_drv += ['gui_init.c','demo_gui.c','info.c']
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
Target (RT-Thread Debug), 0x0004 // Tools: 'ARM-ADS'
|
Target (RT-Thread Debug), 0x0004 // Tools: 'ARM-ADS'
|
||||||
|
|
||||||
|
|
||||||
|
ExtF <E:\Projects\opensvn\rt-thread\google\bsp\mini2440\startup.c> 118,127,0,{ 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,113,2,0,0,32,1,0,0 }
|
||||||
|
|
||||||
TARGOPT 1, (RT-Thread Debug)
|
TARGOPT 1, (RT-Thread Debug)
|
||||||
ADSCLK=12000000
|
ADSCLK=12000000
|
||||||
|
@ -32,7 +33,7 @@ TARGOPT 1, (RT-Thread Debug)
|
||||||
OPTKEY 0,(JLTDLG)()
|
OPTKEY 0,(JLTDLG)()
|
||||||
OPTKEY 0,(DLGDARM)((113=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(102=-1,-1,-1,-1,0)(103=-1,-1,-1,-1,0)(104=-1,-1,-1,-1,0)(105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0)(108=-1,-1,-1,-1,0)(109=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(112=-1,-1,-1,-1,0))
|
OPTKEY 0,(DLGDARM)((113=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(102=-1,-1,-1,-1,0)(103=-1,-1,-1,-1,0)(104=-1,-1,-1,-1,0)(105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0)(108=-1,-1,-1,-1,0)(109=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(112=-1,-1,-1,-1,0))
|
||||||
OPTKEY 0,(ARMDBGFLAGS)(-T5F)
|
OPTKEY 0,(ARMDBGFLAGS)(-T5F)
|
||||||
OPTMM 1,2,(uart0.uart_device)
|
OPTMM 1,2,(0)
|
||||||
OPTDF 0x86
|
OPTDF 0x86
|
||||||
OPTLE <>
|
OPTLE <>
|
||||||
OPTLC <>
|
OPTLC <>
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
#include "dm9000.h"
|
#include "dm9000.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Davicom DM9000EP driver
|
||||||
|
*/
|
||||||
|
|
||||||
// #define DM9000_DEBUG 1
|
// #define DM9000_DEBUG 1
|
||||||
#if DM9000_DEBUG
|
#if DM9000_DEBUG
|
||||||
#define DM9000_TRACE rt_kprintf
|
#define DM9000_TRACE rt_kprintf
|
||||||
|
@ -591,6 +595,10 @@ void rt_hw_dm9000_init()
|
||||||
dm9000_device.parent.eth_tx = rt_dm9000_tx;
|
dm9000_device.parent.eth_tx = rt_dm9000_tx;
|
||||||
|
|
||||||
eth_device_init(&(dm9000_device.parent), "e0");
|
eth_device_init(&(dm9000_device.parent), "e0");
|
||||||
|
|
||||||
|
/* instal interrupt */
|
||||||
|
rt_hw_interrupt_install(INTADC, rt_touch_handler, RT_NULL);
|
||||||
|
rt_hw_interrupt_umask(INTADC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dm9000a(void)
|
void dm9000a(void)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#ifndef __DM9000_H__
|
#ifndef __DM9000_H__
|
||||||
#define __DM9000_H__
|
#define __DM9000_H__
|
||||||
|
|
||||||
#define DM9000_IO_BASE 0x6C000000
|
#define DM9000_IO_BASE 0x20000300
|
||||||
#define DM9000_DATA_BASE 0x6C000008
|
#define DM9000_DATA_BASE 0x20000304
|
||||||
|
|
||||||
#define DM9000_IO (*((volatile rt_uint16_t *) 0x6C000000)) // CMD = 0
|
#define DM9000_IO (*((volatile rt_uint16_t *) DM9000_IO_BASE)) // CMD = 0
|
||||||
#define DM9000_DATA (*((volatile rt_uint16_t *) 0x6C000008)) // CMD = 1
|
#define DM9000_DATA (*((volatile rt_uint16_t *) DM9000_DATA_BASE)) // CMD = 1
|
||||||
|
|
||||||
#define DM9000_inb(r) (*(volatile rt_uint8_t *)r)
|
#define DM9000_inb(r) (*(volatile rt_uint8_t *)r)
|
||||||
#define DM9000_outb(r, d) (*(volatile rt_uint8_t *)r = d)
|
#define DM9000_outb(r, d) (*(volatile rt_uint8_t *)r = d)
|
||||||
|
|
|
@ -176,8 +176,7 @@ void LcdBkLtSet(rt_uint32_t HiRatio)
|
||||||
}
|
}
|
||||||
GPBCON = GPBCON & (~(3<<2)) | (2<<2) ;
|
GPBCON = GPBCON & (~(3<<2)) | (2<<2) ;
|
||||||
|
|
||||||
if( HiRatio > 100 )
|
if( HiRatio > 100 ) HiRatio = 100 ;
|
||||||
HiRatio = 100 ;
|
|
||||||
|
|
||||||
TCON = TCON & (~(0xf<<8)) ; // clear manual update bit, stop Timer1
|
TCON = TCON & (~(0xf<<8)) ; // clear manual update bit, stop Timer1
|
||||||
|
|
||||||
|
@ -194,38 +193,12 @@ void LcdBkLtSet(rt_uint32_t HiRatio)
|
||||||
TCON = TCON & (~(0xf<<8)) | (0x0d<<8) ;
|
TCON = TCON & (~(0xf<<8)) | (0x0d<<8) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
rt_uint16_t color2index565(rt_uint32_t color)
|
|
||||||
{
|
|
||||||
int r,g,b;
|
|
||||||
|
|
||||||
r = (color>> (0+3)) & 0x1f;
|
|
||||||
g = (color>> (8+2)) & 0x3f;
|
|
||||||
b = (color>>(16+3)) & 0x1f;
|
|
||||||
|
|
||||||
return (rt_uint16_t)(b+(g<<5)+(r<<11));
|
|
||||||
}
|
|
||||||
|
|
||||||
rt_uint32_t index2color565(int index)
|
|
||||||
{
|
|
||||||
unsigned int r,g,b;
|
|
||||||
|
|
||||||
r = index & 0x1f;
|
|
||||||
g = (index>>5) & 0x3f;
|
|
||||||
b = ((unsigned)index >> 11) & 0x1f;
|
|
||||||
|
|
||||||
r = r * 255 / 31;
|
|
||||||
g = g * 255 / 63;
|
|
||||||
b = b * 255 / 31;
|
|
||||||
|
|
||||||
return r + (g<<8) + (((rt_uint32_t)b)<<16);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RT_USING_RTGUI
|
#ifdef RT_USING_RTGUI
|
||||||
|
|
||||||
#include <rtgui/driver.h>
|
#include <rtgui/driver.h>
|
||||||
#include <rtgui/color.h>
|
#include <rtgui/color.h>
|
||||||
|
|
||||||
void rt_hw_lcd_update()
|
void rt_hw_lcd_update(rtgui_rect_t *rect)
|
||||||
{
|
{
|
||||||
/* nothing */
|
/* nothing */
|
||||||
}
|
}
|
||||||
|
@ -235,25 +208,31 @@ rt_uint8_t * rt_hw_lcd_get_framebuffer(void)
|
||||||
return (rt_uint8_t *)_rt_hw_framebuffer;
|
return (rt_uint8_t *)_rt_hw_framebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rt_hw_lcd_set_pixel(rtgui_color_t *c, int x, int y)
|
void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
|
||||||
{
|
{
|
||||||
if (x < SCR_XSIZE_TFT_240320 && y < SCR_YSIZE_TFT_240320)
|
if (x < SCR_XSIZE_TFT_240320 && y < SCR_YSIZE_TFT_240320)
|
||||||
{
|
{
|
||||||
_rt_hw_framebuffer[(y)][(x)] = color2index565(*c);
|
_rt_hw_framebuffer[(y)][(x)] = rtgui_color_to_565p(*c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rt_hw_lcd_get_pixel(rtgui_color_t *c, int x, int y)
|
void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
|
||||||
{
|
{
|
||||||
|
if (x < SCR_XSIZE_TFT_240320 && y < SCR_YSIZE_TFT_240320)
|
||||||
|
{
|
||||||
|
*c = rtgui_color_from_565p(_rt_hw_framebuffer[(y)][(x)]);
|
||||||
|
}
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rt_hw_lcd_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
|
void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y)
|
||||||
{
|
{
|
||||||
rt_uint32_t idx;
|
rt_uint32_t idx;
|
||||||
rt_uint16_t color;
|
rt_uint16_t color;
|
||||||
|
|
||||||
color = color2index565(*c);
|
/* get color pixel */
|
||||||
|
color = rtgui_color_to_565p(*c);
|
||||||
|
|
||||||
for (idx = x1; idx < x2; idx ++)
|
for (idx = x1; idx < x2; idx ++)
|
||||||
{
|
{
|
||||||
|
@ -261,12 +240,13 @@ void rt_hw_lcd_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rt_hw_lcd_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
|
void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t y2)
|
||||||
{
|
{
|
||||||
rt_uint32_t idy;
|
rt_uint32_t idy;
|
||||||
rt_uint16_t color;
|
rt_uint16_t color;
|
||||||
|
|
||||||
color = color2index565(*c);
|
/* get color pixel */
|
||||||
|
color = rtgui_color_to_565p(*c);
|
||||||
|
|
||||||
for (idy = y1; idy < y2; idy ++)
|
for (idy = y1; idy < y2; idy ++)
|
||||||
{
|
{
|
||||||
|
@ -274,6 +254,11 @@ void rt_hw_lcd_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y)
|
||||||
|
{
|
||||||
|
rt_memcpy((void*)&_rt_hw_framebuffer[y][x1], pixels, (x2 - x1) * 2);
|
||||||
|
}
|
||||||
|
|
||||||
struct rtgui_graphic_driver _rtgui_lcd_driver =
|
struct rtgui_graphic_driver _rtgui_lcd_driver =
|
||||||
{
|
{
|
||||||
"lcd",
|
"lcd",
|
||||||
|
@ -285,7 +270,8 @@ struct rtgui_graphic_driver _rtgui_lcd_driver =
|
||||||
rt_hw_lcd_set_pixel,
|
rt_hw_lcd_set_pixel,
|
||||||
rt_hw_lcd_get_pixel,
|
rt_hw_lcd_get_pixel,
|
||||||
rt_hw_lcd_draw_hline,
|
rt_hw_lcd_draw_hline,
|
||||||
rt_hw_lcd_draw_vline
|
rt_hw_lcd_draw_vline,
|
||||||
|
rt_hw_lcd_draw_raw_hline
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "finsh.h"
|
#include "finsh.h"
|
||||||
|
@ -294,26 +280,25 @@ void hline(rt_uint32_t c, int x1, int x2, int y)
|
||||||
rtgui_color_t color = (rtgui_color_t)c;
|
rtgui_color_t color = (rtgui_color_t)c;
|
||||||
rt_hw_lcd_draw_hline(&color, x1, x2, y);
|
rt_hw_lcd_draw_hline(&color, x1, x2, y);
|
||||||
}
|
}
|
||||||
|
FINSH_FUNCTION_EXPORT(hline, draw a hline);
|
||||||
|
|
||||||
void vline(rt_uint32_t c, int x, int y1, int y2)
|
void vline(rt_uint32_t c, int x, int y1, int y2)
|
||||||
{
|
{
|
||||||
rtgui_color_t color = (rtgui_color_t)c;
|
rtgui_color_t color = (rtgui_color_t)c;
|
||||||
rt_hw_lcd_draw_vline(&color, x, y1, y2);
|
rt_hw_lcd_draw_vline(&color, x, y1, y2);
|
||||||
}
|
}
|
||||||
|
FINSH_FUNCTION_EXPORT(vline, draw a vline);
|
||||||
|
|
||||||
void dump_vline(int x, int y1, int y2)
|
void clear()
|
||||||
{
|
{
|
||||||
rt_uint32_t idy;
|
int y;
|
||||||
|
|
||||||
for (idy = y1; idy < y2; idy ++)
|
for (y = 0; y < 320; y ++)
|
||||||
{
|
{
|
||||||
rt_kprintf("0x%04x ", _rt_hw_framebuffer[idy][x]);
|
rt_hw_lcd_draw_hline((rtgui_color_t*)&white, 0, 239, y);
|
||||||
|
|
||||||
if ((idy + 1) % 8 == 0)
|
|
||||||
rt_kprintf("\n");
|
|
||||||
}
|
}
|
||||||
rt_kprintf("\n");
|
|
||||||
}
|
}
|
||||||
|
FINSH_FUNCTION_EXPORT(clear, clear screen);
|
||||||
|
|
||||||
void rt_hw_lcd_init()
|
void rt_hw_lcd_init()
|
||||||
{
|
{
|
||||||
|
@ -335,6 +320,7 @@ void rt_hw_lcd_init()
|
||||||
LCDSADDR1=(((rt_uint32_t)_rt_hw_framebuffer>>22)<<21)|M5D((rt_uint32_t)_rt_hw_framebuffer>>1);
|
LCDSADDR1=(((rt_uint32_t)_rt_hw_framebuffer>>22)<<21)|M5D((rt_uint32_t)_rt_hw_framebuffer>>1);
|
||||||
LCDSADDR2=M5D( ((rt_uint32_t)_rt_hw_framebuffer+(SCR_XSIZE_TFT_240320*LCD_YSIZE_TFT_240320*2))>>1 );
|
LCDSADDR2=M5D( ((rt_uint32_t)_rt_hw_framebuffer+(SCR_XSIZE_TFT_240320*LCD_YSIZE_TFT_240320*2))>>1 );
|
||||||
LCDSADDR3=(((SCR_XSIZE_TFT_240320-LCD_XSIZE_TFT_240320)/1)<<11)|(LCD_XSIZE_TFT_240320/1);
|
LCDSADDR3=(((SCR_XSIZE_TFT_240320-LCD_XSIZE_TFT_240320)/1)<<11)|(LCD_XSIZE_TFT_240320/1);
|
||||||
|
|
||||||
LCDINTMSK|=(3);
|
LCDINTMSK|=(3);
|
||||||
LPCSEL &= (~7) ;
|
LPCSEL &= (~7) ;
|
||||||
TPAL=0;
|
TPAL=0;
|
||||||
|
@ -345,14 +331,6 @@ void rt_hw_lcd_init()
|
||||||
|
|
||||||
/* add lcd driver into graphic driver */
|
/* add lcd driver into graphic driver */
|
||||||
rtgui_graphic_driver_add(&_rtgui_lcd_driver);
|
rtgui_graphic_driver_add(&_rtgui_lcd_driver);
|
||||||
|
|
||||||
/* finsh debug */
|
|
||||||
finsh_syscall_append("vline", (syscall_func)vline);
|
|
||||||
finsh_syscall_append("hline", (syscall_func)hline);
|
|
||||||
finsh_syscall_append("dump_vline", (syscall_func)dump_vline);
|
|
||||||
|
|
||||||
extern void rtgui_topwin_dump();
|
|
||||||
finsh_syscall_append("wins", (syscall_func)rtgui_topwin_dump);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
* found in the file LICENSE in this distribution or at
|
* found in the file LICENSE in this distribution or at
|
||||||
* http://openlab.rt-thread.com/license/LICENSE
|
* http://www.rt-thread.org/license/LICENSE
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -17,9 +17,5 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
void rt_hw_lcd_init();
|
void rt_hw_lcd_init();
|
||||||
void rt_hw_lcd_set_pixel(rtgui_color_t *c, int x, int y);
|
|
||||||
void rt_hw_lcd_draw_hline(rtgui_color_t *c, int x1, int x2, int y);
|
|
||||||
void rt_hw_lcd_draw_vline(rtgui_color_t *c, int x, int y1, int y2);
|
|
||||||
void rt_hw_lcd_update(rtgui_rect_t* rect);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,374 +0,0 @@
|
||||||
/*
|
|
||||||
* File : lcd.c
|
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
|
||||||
*
|
|
||||||
* The license and distribution terms for this file may be
|
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://openlab.rt-thread.com/license/LICENSE
|
|
||||||
*
|
|
||||||
* Change Logs:
|
|
||||||
* Date Author Notes
|
|
||||||
* 2007-11-17 Yi.Qiu
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup mini2440
|
|
||||||
*/
|
|
||||||
/*@{*/
|
|
||||||
|
|
||||||
#include <rtthread.h>
|
|
||||||
#include <s3c24x0.h>
|
|
||||||
|
|
||||||
#define MVAL (13)
|
|
||||||
#define MVAL_USED (0) //0=each frame 1=rate by MVAL
|
|
||||||
#define INVVDEN (1) //0=normal 1=inverted
|
|
||||||
#define BSWP (0) //Byte swap control
|
|
||||||
#define HWSWP (1) //Half word swap control
|
|
||||||
|
|
||||||
#define M5D(n) ((n) & 0x1fffff) // To get lower 21bits
|
|
||||||
|
|
||||||
//TFT 800480
|
|
||||||
#define LCD_XSIZE_TFT_800480 (800)
|
|
||||||
#define LCD_YSIZE_TFT_800480 (480)
|
|
||||||
|
|
||||||
#define SCR_XSIZE_TFT_800480 (800)
|
|
||||||
#define SCR_YSIZE_TFT_800480 (480)
|
|
||||||
|
|
||||||
//TFT 800480
|
|
||||||
#define HOZVAL_TFT_800480 (LCD_XSIZE_TFT_800480-1)
|
|
||||||
#define LINEVAL_TFT_800480 (LCD_YSIZE_TFT_800480-1)
|
|
||||||
|
|
||||||
//Timing parameter for innolux 7" AT070TN84
|
|
||||||
#define VBPD_800480 (25) //垂直同步信号的后肩
|
|
||||||
#define VFPD_800480 (5) //垂直同步信号的前肩
|
|
||||||
#define VSPW_800480 (1) //垂直同步信号的脉宽
|
|
||||||
|
|
||||||
#define HBPD_800480 (15)//67 //水平同步信号的后肩
|
|
||||||
#define HFPD_800480 (40) //水平同步信号的前肩
|
|
||||||
#define HSPW_800480 (31) //水平同步信号的脉宽
|
|
||||||
|
|
||||||
#define CLKVAL_TFT_800480 (4)
|
|
||||||
|
|
||||||
#define GPB1_TO_OUT() (GPBUP &= 0xfffd, GPBCON &= 0xfffffff3, GPBCON |= 0x00000004)
|
|
||||||
#define GPB1_TO_1() (GPBDAT |= 0x0002)
|
|
||||||
#define GPB1_TO_0() (GPBDAT &= 0xfffd)
|
|
||||||
|
|
||||||
#define RT_HW_LCD_WIDTH LCD_XSIZE_TFT_800480
|
|
||||||
#define RT_HW_LCD_HEIGHT SCR_YSIZE_TFT_800480
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON1_CLKVAL(x) ((x) << 8)
|
|
||||||
#define S3C2410_LCDCON1_MMODE (1<<7)
|
|
||||||
#define S3C2410_LCDCON1_DSCAN4 (0<<5)
|
|
||||||
#define S3C2410_LCDCON1_STN4 (1<<5)
|
|
||||||
#define S3C2410_LCDCON1_STN8 (2<<5)
|
|
||||||
#define S3C2410_LCDCON1_TFT (3<<5)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON1_STN1BPP (0<<1)
|
|
||||||
#define S3C2410_LCDCON1_STN2GREY (1<<1)
|
|
||||||
#define S3C2410_LCDCON1_STN4GREY (2<<1)
|
|
||||||
#define S3C2410_LCDCON1_STN8BPP (3<<1)
|
|
||||||
#define S3C2410_LCDCON1_STN12BPP (4<<1)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON1_TFT1BPP (8<<1)
|
|
||||||
#define S3C2410_LCDCON1_TFT2BPP (9<<1)
|
|
||||||
#define S3C2410_LCDCON1_TFT4BPP (10<<1)
|
|
||||||
#define S3C2410_LCDCON1_TFT8BPP (11<<1)
|
|
||||||
#define S3C2410_LCDCON1_TFT16BPP (12<<1)
|
|
||||||
#define S3C2410_LCDCON1_TFT24BPP (13<<1)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON1_ENVID (1)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON1_MODEMASK 0x1E
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON2_VBPD(x) ((x) << 24)
|
|
||||||
#define S3C2410_LCDCON2_LINEVAL(x) ((x) << 14)
|
|
||||||
#define S3C2410_LCDCON2_VFPD(x) ((x) << 6)
|
|
||||||
#define S3C2410_LCDCON2_VSPW(x) ((x) << 0)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF)
|
|
||||||
#define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >> 6) & 0xFF)
|
|
||||||
#define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >> 0) & 0x3F)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON3_HBPD(x) ((x) << 19)
|
|
||||||
#define S3C2410_LCDCON3_WDLY(x) ((x) << 19)
|
|
||||||
#define S3C2410_LCDCON3_HOZVAL(x) ((x) << 8)
|
|
||||||
#define S3C2410_LCDCON3_HFPD(x) ((x) << 0)
|
|
||||||
#define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F)
|
|
||||||
#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON4_MVAL(x) ((x) << 8)
|
|
||||||
#define S3C2410_LCDCON4_HSPW(x) ((x) << 0)
|
|
||||||
#define S3C2410_LCDCON4_WLH(x) ((x) << 0)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >> 0) & 0xFF)
|
|
||||||
|
|
||||||
#define S3C2410_LCDCON5_BPP24BL (1<<12)
|
|
||||||
#define S3C2410_LCDCON5_FRM565 (1<<11)
|
|
||||||
#define S3C2410_LCDCON5_INVVCLK (1<<10)
|
|
||||||
#define S3C2410_LCDCON5_INVVLINE (1<<9)
|
|
||||||
#define S3C2410_LCDCON5_INVVFRAME (1<<8)
|
|
||||||
#define S3C2410_LCDCON5_INVVD (1<<7)
|
|
||||||
#define S3C2410_LCDCON5_INVVDEN (1<<6)
|
|
||||||
#define S3C2410_LCDCON5_INVPWREN (1<<5)
|
|
||||||
#define S3C2410_LCDCON5_INVLEND (1<<4)
|
|
||||||
#define S3C2410_LCDCON5_PWREN (1<<3)
|
|
||||||
#define S3C2410_LCDCON5_ENLEND (1<<2)
|
|
||||||
#define S3C2410_LCDCON5_BSWP (1<<1)
|
|
||||||
#define S3C2410_LCDCON5_HWSWP (1<<0)
|
|
||||||
|
|
||||||
#define LCDCON1_VALUE S3C2410_LCDCON1_TFT16BPP | \
|
|
||||||
S3C2410_LCDCON1_TFT | \
|
|
||||||
S3C2410_LCDCON1_CLKVAL(CLKVAL_TFT_800480)
|
|
||||||
|
|
||||||
#define LCDCON2_VALUE S3C2410_LCDCON2_VBPD(VBPD_800480) | \
|
|
||||||
S3C2410_LCDCON2_LINEVAL(LINEVAL_TFT_800480) | \
|
|
||||||
S3C2410_LCDCON2_VFPD(VFPD_800480) | \
|
|
||||||
S3C2410_LCDCON2_VSPW(VSPW_800480)
|
|
||||||
|
|
||||||
#define LCDCON3_VALUE S3C2410_LCDCON3_HBPD(HBPD_800480) | \
|
|
||||||
S3C2410_LCDCON3_HOZVAL(HOZVAL_TFT_800480) | \
|
|
||||||
S3C2410_LCDCON3_HFPD(HFPD_800480)
|
|
||||||
|
|
||||||
#define LCDCON4_VALUE S3C2410_LCDCON4_MVAL(MVAL) | \
|
|
||||||
S3C2410_LCDCON4_HSPW(HSPW_800480)
|
|
||||||
|
|
||||||
#define LCDCON5_VALUE S3C2410_LCDCON5_FRM565 | \
|
|
||||||
S3C2410_LCDCON5_INVVLINE | \
|
|
||||||
S3C2410_LCDCON5_INVVFRAME | \
|
|
||||||
S3C2410_LCDCON5_PWREN | \
|
|
||||||
S3C2410_LCDCON5_HWSWP
|
|
||||||
|
|
||||||
#define S3C2410_LCDINT_FRSYNC (1<<1)
|
|
||||||
|
|
||||||
volatile rt_uint16_t _rt_hw_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
|
|
||||||
|
|
||||||
void lcd_power_enable(int invpwren,int pwren)
|
|
||||||
{
|
|
||||||
/* GPG4 is setted as LCD_PWREN */
|
|
||||||
GPGUP=(GPGUP&(~(1<<4)))|(1<<4); /* Pull-up disable */
|
|
||||||
GPGCON=(GPGCON&(~(3<<8)))|(3<<8); /* GPG4=LCD_PWREN */
|
|
||||||
GPGDAT = GPGDAT | (1<<4) ;
|
|
||||||
|
|
||||||
/* Enable LCD POWER ENABLE Function */
|
|
||||||
LCDCON5=(LCDCON5&(~(1<<3)))|(pwren<<3); /* PWREN */
|
|
||||||
LCDCON5=(LCDCON5&(~(1<<5)))|(invpwren<<5); /* INVPWREN */
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcd_envid_on_off(int onoff)
|
|
||||||
{
|
|
||||||
if(onoff==1)
|
|
||||||
/*ENVID=ON*/
|
|
||||||
LCDCON1|=1;
|
|
||||||
else
|
|
||||||
/*ENVID Off*/
|
|
||||||
LCDCON1 =LCDCON1 & 0x3fffe;
|
|
||||||
}
|
|
||||||
|
|
||||||
//********************** BOARD LCD backlight ****************************
|
|
||||||
void LcdBkLtSet(rt_uint32_t HiRatio)
|
|
||||||
{
|
|
||||||
#define FREQ_PWM1 1000
|
|
||||||
|
|
||||||
if(!HiRatio)
|
|
||||||
{
|
|
||||||
GPBCON = GPBCON & (~(3<<2)) | (1<<2) ; //GPB1设置为output
|
|
||||||
GPBDAT &= ~(1<<1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GPBCON = GPBCON & (~(3<<2)) | (2<<2) ;
|
|
||||||
|
|
||||||
if( HiRatio > 100 )
|
|
||||||
HiRatio = 100 ;
|
|
||||||
|
|
||||||
TCON = TCON & (~(0xf<<8)) ; // clear manual update bit, stop Timer1
|
|
||||||
|
|
||||||
TCFG0 &= 0xffffff00; // set Timer 0&1 prescaler 0
|
|
||||||
TCFG0 |= 15; //prescaler = 15+1
|
|
||||||
|
|
||||||
TCFG1 &= 0xffffff0f; // set Timer 1 MUX 1/16
|
|
||||||
TCFG1 |= 0x00000030; // set Timer 1 MUX 1/16
|
|
||||||
|
|
||||||
TCNTB1 = ( 100000000>>8 )/FREQ_PWM1; //if set inverter off, when TCNT2<=TCMP2, TOUT is high, TCNT2>TCMP2, TOUT is low
|
|
||||||
TCMPB1 = ( TCNTB1*(100-HiRatio))/100 ; //if set inverter on, when TCNT2<=TCMP2, TOUT is low, TCNT2>TCMP2, TOUT is high
|
|
||||||
|
|
||||||
TCON = TCON & (~(0xf<<8)) | (0x0e<<8) ;
|
|
||||||
TCON = TCON & (~(0xf<<8)) | (0x0d<<8) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
rt_uint16_t color2index565(rt_uint32_t color)
|
|
||||||
{
|
|
||||||
int r,g,b;
|
|
||||||
|
|
||||||
r = (color>> (0+3)) & 0x1f;
|
|
||||||
g = (color>> (8+2)) & 0x3f;
|
|
||||||
b = (color>>(16+3)) & 0x1f;
|
|
||||||
|
|
||||||
return (rt_uint16_t)(b+(g<<5)+(r<<11));
|
|
||||||
}
|
|
||||||
|
|
||||||
rt_uint32_t index2color565(int index)
|
|
||||||
{
|
|
||||||
unsigned int r,g,b;
|
|
||||||
|
|
||||||
r = index & 0x1f;
|
|
||||||
g = (index>>5) & 0x3f;
|
|
||||||
b = ((unsigned)index >> 11) & 0x1f;
|
|
||||||
|
|
||||||
r = r * 255 / 31;
|
|
||||||
g = g * 255 / 63;
|
|
||||||
b = b * 255 / 31;
|
|
||||||
|
|
||||||
return r + (g<<8) + (((rt_uint32_t)b)<<16);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RT_USING_RTGUI
|
|
||||||
|
|
||||||
#include <rtgui/driver.h>
|
|
||||||
#include <rtgui/color.h>
|
|
||||||
|
|
||||||
void rt_hw_lcd_update(rtgui_rect_t* rect)
|
|
||||||
{
|
|
||||||
/* nothing */
|
|
||||||
}
|
|
||||||
|
|
||||||
rt_uint8_t * rt_hw_lcd_get_framebuffer(void)
|
|
||||||
{
|
|
||||||
return (rt_uint8_t *)_rt_hw_framebuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
|
|
||||||
{
|
|
||||||
if (x < SCR_XSIZE_TFT_800480 && y < SCR_YSIZE_TFT_800480)
|
|
||||||
{
|
|
||||||
_rt_hw_framebuffer[(y)][(x)] = color2index565(*c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
|
|
||||||
{
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y)
|
|
||||||
{
|
|
||||||
rt_uint32_t idx;
|
|
||||||
rt_uint16_t color;
|
|
||||||
|
|
||||||
color = color2index565(*c);
|
|
||||||
|
|
||||||
for (idx = x1; idx < x2; idx ++)
|
|
||||||
{
|
|
||||||
_rt_hw_framebuffer[y][idx] = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t y2)
|
|
||||||
{
|
|
||||||
rt_uint32_t idy;
|
|
||||||
rt_uint16_t color;
|
|
||||||
|
|
||||||
color = color2index565(*c);
|
|
||||||
|
|
||||||
for (idy = y1; idy < y2; idy ++)
|
|
||||||
{
|
|
||||||
_rt_hw_framebuffer[idy][x] = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct rtgui_graphic_driver _rtgui_lcd_driver =
|
|
||||||
{
|
|
||||||
"lcd",
|
|
||||||
2,
|
|
||||||
800,
|
|
||||||
480,
|
|
||||||
rt_hw_lcd_update,
|
|
||||||
rt_hw_lcd_get_framebuffer,
|
|
||||||
rt_hw_lcd_set_pixel,
|
|
||||||
rt_hw_lcd_get_pixel,
|
|
||||||
rt_hw_lcd_draw_hline,
|
|
||||||
rt_hw_lcd_draw_vline
|
|
||||||
};
|
|
||||||
|
|
||||||
#include "finsh.h"
|
|
||||||
void hline(rt_uint32_t c, int x1, int x2, int y)
|
|
||||||
{
|
|
||||||
rtgui_color_t color = (rtgui_color_t)c;
|
|
||||||
rt_hw_lcd_draw_hline(&color, x1, x2, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void vline(rt_uint32_t c, int x, int y1, int y2)
|
|
||||||
{
|
|
||||||
rtgui_color_t color = (rtgui_color_t)c;
|
|
||||||
rt_hw_lcd_draw_vline(&color, x, y1, y2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dump_vline(int x, int y1, int y2)
|
|
||||||
{
|
|
||||||
rt_uint32_t idy;
|
|
||||||
|
|
||||||
for (idy = y1; idy < y2; idy ++)
|
|
||||||
{
|
|
||||||
rt_kprintf("0x%04x ", _rt_hw_framebuffer[idy][x]);
|
|
||||||
|
|
||||||
if ((idy + 1) % 8 == 0)
|
|
||||||
rt_kprintf("\n");
|
|
||||||
}
|
|
||||||
rt_kprintf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void rt_hw_lcd_init(void)
|
|
||||||
{
|
|
||||||
int x,y;
|
|
||||||
|
|
||||||
GPB1_TO_OUT();
|
|
||||||
GPB1_TO_1();
|
|
||||||
|
|
||||||
GPCUP = 0x00000000;
|
|
||||||
GPCCON = 0xaaaa02a9;
|
|
||||||
|
|
||||||
GPDUP = 0x00000000;
|
|
||||||
GPDCON = 0xaaaaaaaa;
|
|
||||||
|
|
||||||
LCDCON1 = LCDCON1_VALUE;
|
|
||||||
LCDCON2 = LCDCON2_VALUE;
|
|
||||||
LCDCON3 = LCDCON3_VALUE;
|
|
||||||
LCDCON4 = LCDCON4_VALUE;
|
|
||||||
LCDCON5 = LCDCON5_VALUE;
|
|
||||||
|
|
||||||
LCDSADDR1=(((rt_uint32_t)_rt_hw_framebuffer>>22)<<21)|M5D((rt_uint32_t)_rt_hw_framebuffer>>1);
|
|
||||||
LCDSADDR2=M5D( ((rt_uint32_t)_rt_hw_framebuffer+(SCR_XSIZE_TFT_800480*LCD_YSIZE_TFT_800480*2))>>1 );
|
|
||||||
LCDSADDR3=(((SCR_XSIZE_TFT_800480-LCD_XSIZE_TFT_800480)/1)<<11)|(LCD_XSIZE_TFT_800480/1);
|
|
||||||
LCDINTMSK|=(3);
|
|
||||||
LPCSEL &= (~7) ;
|
|
||||||
TPAL=0;
|
|
||||||
|
|
||||||
LcdBkLtSet( 70 ) ;
|
|
||||||
lcd_power_enable(0, 1);
|
|
||||||
lcd_envid_on_off(1);
|
|
||||||
|
|
||||||
/* clear framebuffer */
|
|
||||||
/* rt_memset((void *)_rt_hw_framebuffer, 0, LCD_XSIZE_TFT_800480*LCD_YSIZE_TFT_800480*2); */
|
|
||||||
for(y = 0; y < 480; y ++)
|
|
||||||
for(x = 0; x < 800; x++)
|
|
||||||
_rt_hw_framebuffer[y][x] = 0x0000;
|
|
||||||
|
|
||||||
/* add lcd driver into graphic driver */
|
|
||||||
rtgui_graphic_driver_add(&_rtgui_lcd_driver);
|
|
||||||
|
|
||||||
/* finsh debug */
|
|
||||||
finsh_syscall_append("vline", (syscall_func)vline);
|
|
||||||
finsh_syscall_append("hline", (syscall_func)hline);
|
|
||||||
finsh_syscall_append("dump_vline", (syscall_func)dump_vline);
|
|
||||||
|
|
||||||
/*
|
|
||||||
extern void rtgui_topwin_dump();
|
|
||||||
finsh_syscall_append("wins", (syscall_func)rtgui_topwin_dump);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*@}*/
|
|
|
@ -94,7 +94,7 @@
|
||||||
/* using DFS support */
|
/* using DFS support */
|
||||||
#define RT_USING_DFS
|
#define RT_USING_DFS
|
||||||
#define RT_USING_DFS_EFSL
|
#define RT_USING_DFS_EFSL
|
||||||
/* #define RT_USING_DFS_YAFFS2 */
|
#define RT_USING_DFS_YAFFS2
|
||||||
|
|
||||||
#define RT_USING_WORKDIR
|
#define RT_USING_WORKDIR
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ RT_USING_LWIP = False
|
||||||
RT_USING_RTGUI = True
|
RT_USING_RTGUI = True
|
||||||
|
|
||||||
# panel options
|
# panel options
|
||||||
# 'PNL_AT070TN84','PNL_NEC320240'
|
# 'PNL_A70','PNL_N35', 'PNL_T35'
|
||||||
RT_USING_LCD_TYPE = 'PNL_AT070TN84'
|
RT_USING_LCD_TYPE = 'PNL_T35'
|
||||||
|
|
||||||
# rtgui demo options
|
# rtgui demo options
|
||||||
RT_USING_DEMO_GUI = True
|
RT_USING_DEMO_GUI = True
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
* found in the file LICENSE in this distribution or at
|
* found in the file LICENSE in this distribution or at
|
||||||
* http://openlab.rt-thread.com/license/LICENSE
|
* http://www.rt-thread.org/license/LICENSE
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
* 2007-12-02 Yi.Qiu the first version
|
* 2007-12-02 Yi.Qiu the first version
|
||||||
|
* 2010-01-01 Bernard Modify for mini2440
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sdcard.h"
|
#include "sdcard.h"
|
||||||
|
@ -75,6 +76,7 @@ static int sd_cmd_end(int cmd, int be_resp)
|
||||||
{
|
{
|
||||||
rt_kprintf("CMD%d:SDICSTA=0x%x, SDIRSP0=0x%x\n",
|
rt_kprintf("CMD%d:SDICSTA=0x%x, SDIRSP0=0x%x\n",
|
||||||
cmd, SDICSTA, SDIRSP0);
|
cmd, SDICSTA, SDIRSP0);
|
||||||
|
|
||||||
SDICSTA=finish0;
|
SDICSTA=finish0;
|
||||||
if(((finish0&0x400)==0x400))
|
if(((finish0&0x400)==0x400))
|
||||||
return RT_ERROR;
|
return RT_ERROR;
|
||||||
|
@ -120,6 +122,7 @@ static void sd_cmd0(void)
|
||||||
SDICCON=(1<<8)|0x40;
|
SDICCON=(1<<8)|0x40;
|
||||||
|
|
||||||
sd_cmd_end(0, 0);
|
sd_cmd_end(0, 0);
|
||||||
|
SDICSTA=0x800; /* Clear cmd_end(no rsp) */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,14 +181,15 @@ RECMDD7:
|
||||||
*/
|
*/
|
||||||
static void sd_setbus(void)
|
static void sd_setbus(void)
|
||||||
{
|
{
|
||||||
SET_BUS:
|
do
|
||||||
|
{
|
||||||
sd_cmd55();
|
sd_cmd55();
|
||||||
|
|
||||||
SDICARG=1<<1;
|
SDICARG = 1<<1; /* 4bit bus */
|
||||||
SDICCON=(0x1<<9)|(0x1<<8)|0x46;
|
SDICCON=(0x1<<9)|(0x1<<8)|0x46; /* sht_resp, wait_resp, start, CMD55 */
|
||||||
|
}while (sd_cmd_end(6, 1) == RT_ERROR);
|
||||||
|
|
||||||
if(sd_cmd_end(6, 1) == RT_ERROR)
|
SDICSTA=0xa00; /* Clear cmd_end(with rsp) */
|
||||||
goto SET_BUS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -263,10 +267,10 @@ rt_uint8_t sd_init(void)
|
||||||
/* Important notice for MMC test condition */
|
/* Important notice for MMC test condition */
|
||||||
/* Cmd & Data lines must be enabled by pull up resister */
|
/* Cmd & Data lines must be enabled by pull up resister */
|
||||||
SDIPRE = PCLK/(INICLK)-1;
|
SDIPRE = PCLK/(INICLK)-1;
|
||||||
SDICON=1;
|
SDICON = (1<<4) | 1; // Type B, clk enable
|
||||||
SDIFSTA = SDIFSTA | (1<<16);
|
SDIFSTA = SDIFSTA | (1<<16);
|
||||||
SDIBSIZE = 0x200;
|
SDIBSIZE = 0x200; /* 512byte per one block */
|
||||||
SDIDTIMER=0x7fffff;
|
SDIDTIMER=0x7fffff; /* timeout count */
|
||||||
|
|
||||||
/* Wait 74SDCLK for MMC card */
|
/* Wait 74SDCLK for MMC card */
|
||||||
for(i=0; i<0x1000; i++);
|
for(i=0; i<0x1000; i++);
|
||||||
|
@ -279,6 +283,7 @@ rt_uint8_t sd_init(void)
|
||||||
goto RECMD2;
|
goto RECMD2;
|
||||||
}
|
}
|
||||||
rt_kprintf("MMC check end!!\n");
|
rt_kprintf("MMC check end!!\n");
|
||||||
|
|
||||||
/* Check SD card OCR */
|
/* Check SD card OCR */
|
||||||
if(sd_ocr() == RT_EOK)
|
if(sd_ocr() == RT_EOK)
|
||||||
{
|
{
|
||||||
|
@ -292,18 +297,21 @@ rt_uint8_t sd_init(void)
|
||||||
|
|
||||||
RECMD2:
|
RECMD2:
|
||||||
SDICARG = 0x0;
|
SDICARG = 0x0;
|
||||||
SDICCON=(0x1<<10)|(0x1<<9)|(0x1<<8)|0x42;
|
SDICCON = (0x1<<10)|(0x1<<9)|(0x1<<8)|0x42; /* lng_resp, wait_resp, start, CMD2 */
|
||||||
if(sd_cmd_end(2, 1) == RT_ERROR)
|
if(sd_cmd_end(2, 1) == RT_ERROR)
|
||||||
goto RECMD2;
|
goto RECMD2;
|
||||||
|
|
||||||
|
SDICSTA = 0xa00; /* Clear cmd_end(with rsp) */
|
||||||
|
|
||||||
RECMD3:
|
RECMD3:
|
||||||
SDICARG=0<<16;
|
SDICARG = 0<<16; /* CMD3(MMC:Set RCA, SD:Ask RCA-->SBZ) */
|
||||||
SDICCON=(0x1<<9)|(0x1<<8)|0x43;
|
SDICCON = (0x1<<9)|(0x1<<8)|0x43; /* sht_resp, wait_resp, start, CMD3 */
|
||||||
if(sd_cmd_end(3, 1) == RT_ERROR)
|
if(sd_cmd_end(3, 1) == RT_ERROR)
|
||||||
goto RECMD3;
|
goto RECMD3;
|
||||||
|
SDICSTA=0xa00; /* Clear cmd_end(with rsp) */
|
||||||
|
|
||||||
RCA = (SDIRSP0 & 0xffff0000 )>>16;
|
RCA = (SDIRSP0 & 0xffff0000 )>>16;
|
||||||
SDIPRE=(PCLK/(SDCLK*2))-1;
|
SDIPRE=(PCLK/(SDCLK*2))-1; /* Normal clock=25MHz */
|
||||||
if( SDIRSP0 & (0x1e00!=0x600) )
|
if( SDIRSP0 & (0x1e00!=0x600) )
|
||||||
goto RECMD3;
|
goto RECMD3;
|
||||||
|
|
||||||
|
@ -543,6 +551,9 @@ void rt_hw_sdcard_init()
|
||||||
char dname[4];
|
char dname[4];
|
||||||
char sname[8];
|
char sname[8];
|
||||||
|
|
||||||
|
GPEUP = 0xf83f; // SDCMD, SDDAT[3:0] => PU En.
|
||||||
|
GPECON = 0xaaaaaaaa; // SDCMD, SDDAT[3:0]
|
||||||
|
|
||||||
if (sd_init() == RT_EOK)
|
if (sd_init() == RT_EOK)
|
||||||
{
|
{
|
||||||
/* get the first sector to read partition table */
|
/* get the first sector to read partition table */
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <s3c24x0.h>
|
#include <s3c24x0.h>
|
||||||
|
|
||||||
#define INICLK 300000
|
#define INICLK 300000
|
||||||
#define SDCLK 24000000
|
#define SDCLK 24000000 //PCLK=49.392MHz
|
||||||
#define MMCCLK 15000000
|
#define MMCCLK 15000000 //PCLK=49.392MHz
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,13 @@
|
||||||
* 2008-07-14 Bernard modify the heap memory init parameter
|
* 2008-07-14 Bernard modify the heap memory init parameter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtthread.h>
|
|
||||||
#include <rthw.h>
|
#include <rthw.h>
|
||||||
|
#include <rtthread.h>
|
||||||
|
|
||||||
#include <s3c24x0.h>
|
#include <s3c24x0.h>
|
||||||
|
#ifdef RT_USING_FINSH
|
||||||
|
#include <finsh.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void rt_hw_interrupt_init(void);
|
extern void rt_hw_interrupt_init(void);
|
||||||
extern void rt_hw_board_init(void);
|
extern void rt_hw_board_init(void);
|
||||||
|
|
Loading…
Reference in New Issue