2005-06-01 Philippe Simons <loki_666@fastmail.fm>

* bsp_specs: Add rules for cpp support
	* include/bsp.h: Add gp32 support fct prototypes
	* console/conio.c: Moved video buffer to 0x0c7ed000
	* startup/bspstart.c: Add some init code, some cleaning...
This commit is contained in:
Joel Sherrill
2005-06-02 13:41:35 +00:00
parent d1747cb216
commit 32cf23b18e
6 changed files with 90 additions and 44 deletions

View File

@@ -1,3 +1,10 @@
2005-06-01 Philippe Simons <loki_666@fastmail.fm>
* bsp_specs: Add rules for cpp support
* include/bsp.h: Add gp32 support fct prototypes
* console/conio.c: Moved video buffer to 0x0c7ed000
* startup/bspstart.c: Add some init code, some cleaning...
2005-05-26 Ralf Corsepius <ralf.corsepius@rtems.org>
* include/bsp.h: New header guard.

View File

@@ -5,19 +5,22 @@
%rename link old_link
*cpp:
%(old_cpp) %{qrtems: -D__embedded__ -DUSE_ENHANCED_INTR_API} -Asystem(embedded)
%(old_cpp) %{qrtems: -D__embedded__ -D__USE_INIT_FINI__ -DUSE_ENHANCED_INTR_API} -Asystem(embedded)
*lib:
%{!qrtems: %(old_lib)} %{qrtems: --start-group \
%{!qrtems_debug: -lrtemsbsp -lrtemscpu} %{qrtems_debug: -lrtemsbsp_g -lrtemscpu_g} \
%{!qrtems: %(old_lib)} %{!nostdlib: %{qrtems: --start-group \
%{!qrtems_debug: -lrtemsbsp -lrtemscpu} \
%{qrtems_debug: -lrtemsbsp_g -lrtemscpu_g} \
-lc -lgcc --end-group \
%{!qnolinkcmds: -T linkcmds%s}}
%{!qnolinkcmds: -T linkcmds%s}}}
*startfile:
%{!qrtems: %(old_startfile)} %{qrtems: \
%{!qrtems_debug: start.o%s crtbegin.o%s} \
%{qrtems_debug: start_g.o%s crtbegin.o%s}}
%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: \
%{!qrtems_debug: start.o%s crti.o%s crtbegin.o%s} \
%{qrtems_debug: start_g.o%s crti.o%s crtbegin.o%s}}}
*link:
%{!qrtems: %(old_link)} %{qrtems: -Qy -dp -Bstatic -N -e _start}
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e _start}
*endfile:
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }

View File

@@ -22,6 +22,7 @@
*---------------------------------------------------------------------------*/
#include <rtems/score/types.h>
#include <s3c2400.h>
#include <bsp.h>
#include <conio.h>
#include <stdio.h>
#include <stdarg.h>
@@ -33,16 +34,14 @@
/*---------------------------------------------------------------------------*
* Defines *
*---------------------------------------------------------------------------*/
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define DEFAULT_FONT_WIDTH 4
#define DEFAULT_FONT_HEIGHT 6
#define W (LCD_WIDTH/DEFAULT_FONT_WIDTH)
#define H (LCD_HEIGHT/DEFAULT_FONT_HEIGHT)
typedef unsigned char Bitmap[LCD_HEIGHT][LCD_WIDTH];
#define GP32_VRAM 0x0c7b4000
#define bg_bitmap (*(Bitmap *)GP32_VRAM)
#define GP32_CONIO_VRAM 0x0c7ed000
#define bg_bitmap (*(Bitmap *)GP32_CONIO_VRAM)
/* color conversion */
#define RGB(r,g,b) ( (r)<<11 | (g)<<6 | (b)<<1 )
@@ -228,17 +227,12 @@ int gpconio_printf(const char *_format, ...)
return r;
}
/*---------------------------------------------------------------------------*
* InitConIO *
*---------------------------------------------------------------------------*/
void InitConIO()
void ShowConIO()
{
uint32_t GPHCLK = 66750000;
unsigned short BPPMODE = 11;
unsigned short CLKVAL = (GPHCLK/(83385*2*60))-1;
uint32_t LCDBANK = GP32_VRAM >> 22;
uint32_t LCDBASEU = (GP32_VRAM & 0x3FFFFF) >> 1;
unsigned short CLKVAL = (get_HCLK()/(83385*2*60))-1;
uint32_t LCDBANK = GP32_CONIO_VRAM >> 22;
uint32_t LCDBASEU = (GP32_CONIO_VRAM & 0x3FFFFF) >> 1;
uint32_t LCDBASEL;
unsigned short OFFSIZE = 0;
unsigned short PAGEWIDTH;
@@ -260,7 +254,16 @@ void InitConIO()
rLCDSADDR1 = (LCDBANK<<21) | (LCDBASEU<<0) ;
rLCDSADDR2 = (LCDBASEL<<0) ;
rLCDSADDR3 = (OFFSIZE<<11) | (PAGEWIDTH<<0) ;
}
/*---------------------------------------------------------------------------*
* InitConIO *
*---------------------------------------------------------------------------*/
void InitConIO()
{
ShowConIO();
gp_initButtons();
gpconio_textattr(0);
gpconio_textcolor(DEF_TEXTCOLOR);

View File

@@ -32,13 +32,34 @@ extern "C" {
extern rtems_configuration_table BSP_Configuration;
void LCD_BREAK();
void gp32_setFramebuffer(void *add);
short gp32_initFramebufferN(void *add, uint32_t bitmode, uint32_t refreshrate);
short gp32_initFramebufferBP(void *add, uint32_t bitmode, uint32_t refreshrate);
#define gp32_initButtons() {rPBCON=0x0;}
#define gp32_getButtons() ( (((~rPEDAT >> 6) & 0x3 )<<8) | (((~rPBDAT >> 8) & 0xFF)<<0) )
/*functions to get the differents s3c2400 clks*/
uint32_t get_FCLK(void);
uint32_t get_HCLK(void);
uint32_t get_PCLK(void);
uint32_t get_UCLK(void);
void gp32_setPalette( unsigned char pos, uint16_t color);
/* What is the input clock freq in hertz? */
#define BSP_OSC_FREQ 12000000 /* 12 MHz oscillator */
#define M_MDIV 81
#define M_MDIV 81 /* FCLK=133Mhz */
#define M_PDIV 2
#define M_SDIV 1
#define M_CLKDIVN 2 /* HCLK=FCLK/2, PCLK=FCLK/2 */
#define REFEN 0x1 /* enable refresh */
#define TREFMD 0x0 /* CBR(CAS before RAS)/auto refresh */
#define Trp 0x0 /* 2 clk */
#define Trc 0x3 /* 7 clk */
#define Tchr 0x2 /* 3 clk */
/* How many serial ports? */
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1

View File

@@ -71,6 +71,9 @@ void gpconio_gotoxy(int _x, int _y);
char gpconio_getch(void);
char gpconio_getch_noblock(void);
void InitConIO();
void ShowConIO();
#ifdef __cplusplus
}

View File

@@ -19,6 +19,7 @@
#include <rtems/libio.h>
#include <rtems/bspIo.h>
#include <s3c2400.h>
#include <conio.h>
/*-------------------------------------------------------------------------+
| Global Variables
@@ -89,6 +90,9 @@ void bsp_pretasking_hook(void)
void bsp_start_default( void )
{
uint32_t cr;
uint32_t pend,last;
uint32_t REFCNT;
int i;
/* If we don't have command line arguments set default program name. */
Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
@@ -100,19 +104,39 @@ void bsp_start_default( void )
Cpu_table.interrupt_stack_size = 4096;
Cpu_table.extra_mpci_receive_server_stack = 0;
/* stop all timers */
/* setup rCLKCON */
/* disable all but IIS,IIC,PWMTIMER and LCD */
rCLKCON=0x6048;
/* stop RTC */
rTICINT=0x0;
/* stop watchdog,ADC and timers */
rWTCON=0x0;
rTCON=0x0;
rADCCON=0x0;
/* disable interrupts */
rINTMOD=0x0;
rINTMSK=BIT_ALLMSK; /* unmasked by drivers */
rSRCPND=BIT_ALLMSK;
/*rSRCPND=BIT_ALLMSK;
rINTMSK=BIT_ALLMSK;
rINTPND=BIT_ALLMSK;
rINTPND=BIT_ALLMSK;*/
for(i=0; i<4; i++) {
pend=rSRCPND;
if(pend == 0 || pend == last)
break;
rSRCPND=pend;
rINTPND=pend;
last=pend;
}
/* setup clocks 133/66/33) */
rCLKDIVN=3;
/* setup clocks */
rCLKDIVN=M_CLKDIVN;
rMPLLCON=((M_MDIV<<12)+(M_PDIV<<4)+M_SDIV);
/* setup rREFRESH */
REFCNT=2048+1-(15.6*get_HCLK()/1000000); /* period=15.6 us, HCLK=66Mhz, (2048+1-15.6*66) */
rREFRESH=((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT);
/* set prescaler for timers 2,3,4 to 16(15+1) */
cr=rTCFG0 & 0xFFFF00FF;
@@ -176,21 +200,6 @@ void bsp_reset(void)
rtems_interrupt_level level;
_CPU_ISR_Disable(level);
printk("bsp_reset.....\n");
ShowConIO();
while(1);
}
void LCD_BREAK()
{
int x,y;
unsigned short color=0;
volatile unsigned char* framebuffer = (unsigned char*) 0x0C7B4000;
while(1) {
for(y = 0; y < 240; y++) {
for(x = 0; x < 320; x++) {
*(framebuffer + (239 - y) + (240 * x)) = color;
}
}
color++;
}
}