summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2005-06-02 13:45:53 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2005-06-02 13:45:53 +0000
commitb2a4e861dc031f45a2bc74dc1ed1279e5942d057 (patch)
tree32fa49bb781c994a0b92048d74202ca437655c50 /c
parent2005-06-01 Philippe Simons <loki_666@fastmail.fm> (diff)
downloadrtems-b2a4e861dc031f45a2bc74dc1ed1279e5942d057.tar.bz2
2005-06-01 Philippe Simons <loki_666@fastmail.fm>
* Makefile.am: Add s3c2400/lcd/lcd.c, s3c2400/clock/support.c * s3c2400/clock/clockdrv.c: Update to use get_PCLK() * s3c2400/timer/timer.c: Update to use get_PCLK()
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libcpu/arm/ChangeLog6
-rw-r--r--c/src/lib/libcpu/arm/Makefile.am8
-rw-r--r--c/src/lib/libcpu/arm/s3c2400/clock/clockdrv.c8
-rw-r--r--c/src/lib/libcpu/arm/s3c2400/clock/support.c59
-rw-r--r--c/src/lib/libcpu/arm/s3c2400/include/s3c2400.h186
-rw-r--r--c/src/lib/libcpu/arm/s3c2400/lcd/lcd.c156
-rw-r--r--c/src/lib/libcpu/arm/s3c2400/timer/timer.c14
7 files changed, 410 insertions, 27 deletions
diff --git a/c/src/lib/libcpu/arm/ChangeLog b/c/src/lib/libcpu/arm/ChangeLog
index e4f27746cd..7d97ead044 100644
--- a/c/src/lib/libcpu/arm/ChangeLog
+++ b/c/src/lib/libcpu/arm/ChangeLog
@@ -1,3 +1,9 @@
+2005-06-01 Philippe Simons <loki_666@fastmail.fm>
+
+ * Makefile.am: Add s3c2400/lcd/lcd.c, s3c2400/clock/support.c
+ * s3c2400/clock/clockdrv.c: Update to use get_PCLK()
+ * s3c2400/timer/timer.c: Update to use get_PCLK()
+
2005-05-17 Jennifer Averett <jennifer.averett@oarcorp.com>
* at91rm9200/irq/irq.h, mc9328mxl/irq/irq.h, s3c2400/irq/irq.h:
diff --git a/c/src/lib/libcpu/arm/Makefile.am b/c/src/lib/libcpu/arm/Makefile.am
index 04626b5e47..fb76474ff6 100644
--- a/c/src/lib/libcpu/arm/Makefile.am
+++ b/c/src/lib/libcpu/arm/Makefile.am
@@ -96,7 +96,7 @@ include_HEADERS = s3c2400/include/s3c2400.h
## s3c2400/clock
noinst_PROGRAMS += s3c2400/clock.rel
-s3c2400_clock_rel_SOURCES = s3c2400/clock/clockdrv.c
+s3c2400_clock_rel_SOURCES = s3c2400/clock/clockdrv.c s3c2400/clock/support.c
s3c2400_clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
s3c2400_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
@@ -106,6 +106,12 @@ s3c2400_timer_rel_SOURCES = s3c2400/timer/timer.c
s3c2400_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
s3c2400_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+## s3c2400/lcd
+noinst_PROGRAMS += s3c2400/lcd.rel
+s3c2400_lcd_rel_SOURCES = s3c2400/lcd/lcd.c
+s3c2400_lcd_rel_CPPFLAGS = $(AM_CPPLAGS)
+s3c2400_lcd_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
## s3c2400/interrupt
include_HEADERS += s3c2400/irq/irq.h
diff --git a/c/src/lib/libcpu/arm/s3c2400/clock/clockdrv.c b/c/src/lib/libcpu/arm/s3c2400/clock/clockdrv.c
index 2bddd455a9..c77b685a0a 100644
--- a/c/src/lib/libcpu/arm/s3c2400/clock/clockdrv.c
+++ b/c/src/lib/libcpu/arm/s3c2400/clock/clockdrv.c
@@ -77,13 +77,7 @@ rtems_irq_connect_data clock_isr_data = {BSP_INT_TIMER4,
/* set MUX for Timer4 to 1/16 */ \
cr=rTCFG1 & 0xFFF0FFFF; \
rTCFG1=(cr | (3<<16)); \
- /* compute MPLL freq */ \
- m = M_MDIV + 8; \
- p = M_PDIV + 2; \
- s = M_SDIV; \
- freq =(BSP_OSC_FREQ * m) / (p << s); \
- /* PCLK = MPLL/4 */ \
- freq = freq / 4; \
+ freq = get_PCLK(); \
/* set TIMER4 counter, input freq=PLCK/16/16Mhz*/ \
freq = (freq /16)/16; \
rTCNTB4 = ((freq / 1000) * BSP_Configuration.microseconds_per_tick) / 1000; \
diff --git a/c/src/lib/libcpu/arm/s3c2400/clock/support.c b/c/src/lib/libcpu/arm/s3c2400/clock/support.c
new file mode 100644
index 0000000000..a88710b797
--- /dev/null
+++ b/c/src/lib/libcpu/arm/s3c2400/clock/support.c
@@ -0,0 +1,59 @@
+#include <rtems.h>
+#include <bsp.h>
+#include <s3c2400.h>
+
+#define MPLL 0
+#define UPLL 1
+
+/* ------------------------------------------------------------------------- */
+/* NOTE: This describes the proper use of this file.
+ *
+ * BSP_OSC_FREQ should be defined as the input frequency of the PLL.
+ *
+ * get_FCLK(), get_HCLK(), get_PCLK() and get_UCLK() return the clock of
+ * the specified bus in HZ.
+ */
+/* ------------------------------------------------------------------------- */
+
+static uint32_t get_PLLCLK(int pllreg)
+{
+ uint32_t r, m, p, s;
+
+ if (pllreg == MPLL)
+ r = rMPLLCON;
+ else if (pllreg == UPLL)
+ r = rUPLLCON;
+ else
+ return 0;
+
+ m = ((r & 0xFF000) >> 12) + 8;
+ p = ((r & 0x003F0) >> 4) + 2;
+ s = r & 0x3;
+
+ return((BSP_OSC_FREQ * m) / (p << s));
+}
+
+/* return FCLK frequency */
+uint32_t get_FCLK(void)
+{
+ return(get_PLLCLK(MPLL));
+}
+
+/* return HCLK frequency */
+uint32_t get_HCLK(void)
+{
+ return((rCLKDIVN & 0x2) ? get_FCLK()/2 : get_FCLK());
+}
+
+/* return PCLK frequency */
+uint32_t get_PCLK(void)
+{
+ return((rCLKDIVN & 0x1) ? get_HCLK()/2 : get_HCLK());
+}
+
+/* return UCLK frequency */
+uint32_t get_UCLK(void)
+{
+ return(get_PLLCLK(UPLL));
+}
+
diff --git a/c/src/lib/libcpu/arm/s3c2400/include/s3c2400.h b/c/src/lib/libcpu/arm/s3c2400/include/s3c2400.h
index 54e5654659..1eac3e0298 100644
--- a/c/src/lib/libcpu/arm/s3c2400/include/s3c2400.h
+++ b/c/src/lib/libcpu/arm/s3c2400/include/s3c2400.h
@@ -5,8 +5,8 @@
* Based on 24x.h for the Samsung Development Board
************************************************/
-#ifndef __S3C2400_H__
-#define __S3C2400_H__
+#ifndef S3C2400_H_
+#define S3C2400_H_
/* Memory control */
#define rBWSCON (*(volatile unsigned *)0x14000000)
@@ -95,7 +95,7 @@
#define rDP6_7 (*(volatile unsigned *)0x14A00048)
#define rDITHMODE (*(volatile unsigned *)0x14A0004C)
#define rTPAL (*(volatile unsigned *)0x14A00050)
-#define GP32_PALETTE (*(volatile unsigned *)0x14A00400) /* SJS */
+#define GP32_PALETTE (*(volatile unsigned *)0x14A00400) /* SJS */
/* UART */
@@ -426,9 +426,183 @@
rINTPND;\
}
/* Wait until rINTPND is changed for the case that the ISR is very short. */
+
+//////////////////////////////////////////////////////////////////////////////
+// Typedefs //
+//////////////////////////////////////////////////////////////////////////////
+typedef union {
+ struct _reg {
+ unsigned STOP_BIT:1; // Enters STOP mode. This bit isn't be cleared automatically.
+ unsigned SL_IDLE:1; // SL_IDLE mode option. This bit isn't be cleared automatically. To enter SL_IDLE mode, CLKCON register has to be 0xe.
+ unsigned IDLE_BIT:1; // Enters IDLE mode. This bit isn't be cleared automatically.
+ unsigned LCDC:1; // Controls HCLK into LCDC block
+ unsigned USB_host:1; // Controls HCLK into USB host block
+ unsigned USB_device:1; // Controls PCLK into USB device block
+ unsigned PWMTIMER:1; // Controls PCLK into PWMTIMER block
+ unsigned MMC:1; // Controls PCLK into MMC interface block
+ unsigned UART0:1; // Controls PCLK into UART0 block
+ unsigned UART1:1; // Controls PCLK into UART1 block
+ unsigned GPIO:1; // Controls PCLK into GPIO block
+ unsigned RTC:1; // Controls PCLK into RTC control block. Even if this bit is cleared to 0, RTC timer is alive.
+ unsigned ADC:1; // Controls PCLK into ADC block
+ unsigned IIC:1; // Controls PCLK into IIC block
+ unsigned IIS:1; // Controls PCLK into IIS block
+ unsigned SPI:1; // Controls PCLK into SPI block
+ } reg;
+ unsigned long all;
+} CLKCON;
+
+typedef union
+{
+ struct {
+ unsigned ENVID:1; // LCD video output and the logic 1=enable/0=disable.
+ unsigned BPPMODE:4; // 1011 = 8 bpp for TFT, 1100 = 16 bpp for TFT, 1110 = 16 bpp TFT skipmode
+ unsigned PNRMODE:2; // TFT: 3
+ unsigned MMODE:1; // This bit determines the toggle rate of the VM. 0 = Each Frame, 1 = The rate defined by the MVAL
+ unsigned CLKVAL:10; // TFT: VCLK = HCLK / [(CLKVAL+1) x 2] (CLKVAL >= 1)
+ unsigned LINECNT:10; // (read only) These bits provide the status of the line counter. Down count from LINEVAL to 0
+ } reg;
+ unsigned long all;
+} LCDCON1;
+
+typedef union {
+ struct {
+ unsigned VSPW:6; // TFT: Vertical sync pulse width determines the VSYNC pulse's high level width by counting the number of inactive lines.
+ unsigned VFPD:8; // TFT: Vertical front porch is the number of inactive lines at the end of a frame, before vertical synchronization period.
+ unsigned LINEVAL:10; // TFT/STN: These bits determine the vertical size of LCD panel.
+ unsigned VBPD:8; // TFT: Vertical back porch is the number of inactive lines at the start of a frame, after vertical synchronization period.
+ } reg;
+ unsigned long all;
+} LCDCON2;
+
+typedef union {
+ struct {
+ unsigned HFPD:8; // TFT: Horizontal front porch is the number of VCLK periods between the end of active data and the rising edge of HSYNC.
+ unsigned HOZVAL:11; // TFT/STN: These bits determine the horizontal size of LCD panel. 2n bytes.
+ unsigned HBPD:7; // TFT: Horizontal back porch is the number of VCLK periods between the falling edge of HSYNC and the start of active data.
+ } reg;
+ unsigned long all;
+} LCDCON3;
+
+typedef union {
+ struct {
+ unsigned HSPW:8; // TFT: Horizontal sync pulse width determines the HSYNC pulse's high level width by counting the number of the VCLK.
+ unsigned MVAL:8; // STN:
+ unsigned ADDVAL:8; // TFT: Palette Index offset value
+ unsigned PALADDEN:1; // TFT: Palette Index offset enable. 0 = Disable 1 = Enable
+ } reg;
+ unsigned long all;
+} LCDCON4;
+
+typedef union {
+ struct {
+ unsigned HWSWP:1; // STN/TFT: Half-Word swap control bit. 0 = Swap Disable 1 = Swap Enable
+ unsigned BSWP:1; // STN/TFT: Byte swap control bit. 0 = Swap Disable 1 = Swap Enable
+ unsigned ENLEND:1; // TFT: LEND output signal enable/disable. 0 = Disable LEND signal. 1 = Enable LEND signal
+ unsigned RESERVED1:1;
+ unsigned INVENDLINE:1; // TFT: This bit indicates the LEND signal polarity. 0 = normal 1 = inverted
+ unsigned RESERVED2:1;
+ unsigned INVVDEN:1; // TFT: This bit indicates the VDEN signal polarity. 0 = normal 1 = inverted
+ unsigned INVVD:1; // STN/TFT: This bit indicates the VD (video data) pulse polarity. 0 = Normal. 1 = VD is inverted.
+ unsigned INVVFRAME:1; // STN/TFT: This bit indicates the VFRAME/VSYNC pulse polarity. 0 = normal 1 = inverted
+ unsigned INVVLINE:1; // STN/TFT: This bit indicates the VLINE/HSYNC pulse polarity. 0 = normal 1 = inverted
+ unsigned INVVCLK:1; // STN/TFT: This bit controls the polarity of the VCLK active edge. 0 = The video data is fetched at VCLK falling edge. 1 = The video data is fetched at VCLK rising edge
+ unsigned RESERVED3:2;
+ unsigned SELFREF:1; // STN:
+ unsigned SLOWCLKSYNC:1; // STN:
+ unsigned RESERVED4:2; // must be 0
+ unsigned HSTATUS:2; // TFT: Horizontal Status (Read only) 00 = HSYNC 01 = BACK Porch. 10 = ACTIVE 11 = FRONT Porch
+ unsigned VSTATUS:2; // TFT: Vertical Status (Read only). 00 = VSYNC 01 = BACK Porch. 10 = ACTIVE 11 = FRONT Porch
+ } reg;
+ unsigned long all;
+} LCDCON5;
+
+typedef union {
+ struct {
+ unsigned LCDBASEU:21; // For single-scan LCD: These bits indicate A[21:1] of the start address of the LCD frame buffer.
+ unsigned LCDBANK:7; // A[28:22]
+ } reg;
+ unsigned long all;
+} LCDSADDR1;
+
+typedef union {
+ struct {
+ unsigned LCDBASEL:21; // For single scan LCD: These bits indicate A[21:1] of the end address of the LCD frame buffer. LCDBASEL = ((the fame end address) >>1) + 1 = LCDBASEU + (PAGEWIDTH+OFFSIZE)x(LINEVAL+1)
+ } reg;
+ unsigned long all;
+} LCDSADDR2;
+
+typedef union {
+ struct {
+ unsigned PAGEWIDTH:11; // Virtual screen page width(the number of half words) This value defines the width of the view port in the frame
+ unsigned OFFSIZE:11; // Virtual screen offset size(the number of half words) This value defines the difference between the address of the last half word displayed on the previous LCD line and the address of the first half word to be displayed in the new LCD line.
+ } reg;
+ unsigned long all;
+} LCDSADDR3;
+
+//
+//
+//
+
+typedef union {
+ struct {
+ unsigned IISIFENA:1; // IIS interface enable (start)
+ unsigned IISPSENA:1; // IIS prescaler enable
+ unsigned RXCHIDLE:1; // Receive channel idle command
+ unsigned TXCHIDLE:1; // Transmit channel idle command
+ unsigned RXDMAENA:1; // Receive DMA service request enable
+ unsigned TXDMAENA:1; // Transmit DMA service request enable
+ unsigned RXFIFORDY:1; // Receive FIFO ready flag (read only)
+ unsigned TXFIFORDY:1; // Transmit FIFO ready flag (read only)
+ unsigned LRINDEX:1; // Left/right channel index (read only)
+ } reg;
+ unsigned long all;
+} IISCON;
+
+typedef union {
+ struct {
+ unsigned SBCLKFS:2; // Serial bit clock frequency select
+ unsigned MCLKFS:1; // Master clock frequency select
+ unsigned SDBITS:1; // Serial data bit per channel
+ unsigned SIFMT:1; // Serial interface format
+ unsigned ACTLEVCH:1; // Active level pf left/right channel
+ unsigned TXRXMODE:2; // Transmit/receive mode select
+ unsigned MODE:1; // Master/slave mode select
+ } reg;
+ unsigned long all;
+} IISMOD;
+
+typedef union {
+ struct {
+ unsigned PSB:5; // Prescaler control B
+ unsigned PSA:5; // Prescaler control A
+ } reg;
+ unsigned long all;
+} IISPSR;
+
+typedef union {
+ struct {
+ unsigned RXFIFOCNT:4; // (read only)
+ unsigned TXFIFOCNT:4; // (read only)
+ unsigned RXFIFOENA:1; //
+ unsigned TXFIFOENA:1; //
+ unsigned RXFIFOMODE:1; //
+ unsigned TXFIFOMODE:1; //
+ } reg;
+ unsigned long all;
+} IISSFIFCON;
+
+typedef union {
+ struct {
+ unsigned FENTRY:16; //
+ } reg;
+ unsigned long all;
+} IISSFIF;
+
+
#define LCD_WIDTH 240
-#define LCD_HEIGH 320
-#define LCD_ASPECT ((flaot)(LCD_WIDTH/LCD_HEIGHT))
+#define LCD_HEIGHT 320
+#define LCD_ASPECT ((float)(LCD_WIDTH/LCD_HEIGHT))
#define GP32_KEY_SELECT 512
#define GP32_KEY_START 256
@@ -441,4 +615,4 @@
#define GP32_KEY_LEFT 1
#define GP32_KEY_RIGHT 4
-#endif /*__S3C2400_H__*/
+#endif /*S3C2400_H_*/
diff --git a/c/src/lib/libcpu/arm/s3c2400/lcd/lcd.c b/c/src/lib/libcpu/arm/s3c2400/lcd/lcd.c
new file mode 100644
index 0000000000..749dec775f
--- /dev/null
+++ b/c/src/lib/libcpu/arm/s3c2400/lcd/lcd.c
@@ -0,0 +1,156 @@
+#include <rtems.h>
+#include <bsp.h>
+#include <s3c2400.h>
+
+void gp32_setFramebuffer(void *add) {
+ uint32_t addr = (uint32_t) add;
+ uint32_t LCDBANK = addr >> 22;
+ uint32_t LCDBASEU = (addr & 0x3FFFFF) >> 1;
+ uint32_t LCDBASEL;
+ uint16_t OFFSIZE = 0;
+ uint16_t PAGEWIDTH;
+ uint16_t vidmode = ((rLCDCON1>>1) & 15)-8;
+ const uint8_t faktor[]= {15,30,60,120,240};
+
+ LCDBASEL = LCDBASEU + 320*faktor[vidmode];
+ PAGEWIDTH = faktor[vidmode];
+
+ rLCDSADDR1 = (LCDBANK<<21) | (LCDBASEU<<0) ;
+ rLCDSADDR2 = (LCDBASEL<<0) ;
+ rLCDSADDR3 = (OFFSIZE<<11) | (PAGEWIDTH<<0) ;
+}
+
+short gp32_initFramebufferN(void *add,uint32_t bitmode,uint32_t refreshrate) {
+ uint32_t addr = (uint32_t) add;
+ uint32_t GPHCLK = get_HCLK();
+ { uint16_t BPPMODE = 12;
+ uint16_t CLKVAL = 3;
+ uint16_t ENVID = 1;
+ uint16_t MMODE = 0;
+ uint16_t PNRMODE = 3;
+ switch (bitmode) {
+ case 16 : BPPMODE=12; break;
+ case 8 : BPPMODE=11; break;
+ case 4 : BPPMODE=10; break;
+ case 2 : BPPMODE= 9; break;
+ case 1 : BPPMODE= 8; break;
+ default : BPPMODE= 12; break;
+ }
+ /* Get the correct CLKVAL for refreshrate
+ works in all bitmodes now :)
+ */
+ if (refreshrate < 50) refreshrate = 50;
+ if (refreshrate > 120) refreshrate =120;
+ CLKVAL = (GPHCLK/(83385*2*refreshrate))-1;
+ if (CLKVAL == 0) CLKVAL=1;
+ refreshrate = GPHCLK / (83385*2*(CLKVAL+1));
+ rLCDCON1 = (CLKVAL<<8) | (MMODE<<7) | (PNRMODE<<5) | (BPPMODE<<1) | (ENVID<<0) ;
+ }
+ { uint16_t LINEVAL = 320-1;
+ uint16_t VBPD = 1;
+ uint16_t VFPD = 2;
+ uint16_t VSPW = 1;
+ rLCDCON2 = 0;
+ rLCDCON2 = (VBPD<<24) | (LINEVAL<<14) | (VFPD<<6) | (VSPW<<0) ;
+ }
+ { uint16_t HBPD = 6;
+ uint16_t HFPD = 2;
+ uint16_t HOZVAL = 240-1;
+ rLCDCON3 = 0;
+ rLCDCON3 = (HBPD<<19) | (HOZVAL<<8) | (HFPD<<0) ;
+ }
+ { uint16_t ADDVAL = 0;
+ uint16_t HSPW = 4;
+ uint16_t MVAL = 0;
+ uint16_t PALADDEN = 0;
+ rLCDCON4 = 0;
+ rLCDCON4 = (PALADDEN<<24) | (ADDVAL<<16) | (MVAL<<8) | (HSPW<<0) ;
+ }
+ { uint16_t BSWP = 0;
+ uint16_t ENLEND = 0;
+ uint16_t HWSWP = 1;
+ uint16_t INVENDLINE = 0;
+ uint16_t INVVCLK = 1;
+ uint16_t INVVD = 0;
+ uint16_t INVVDEN = 0;
+ uint16_t INVVFRAME = 1;
+ uint16_t INVVLINE = 1;
+ if (bitmode<16) { BSWP=1;HWSWP=0; }
+ rLCDCON5 = 0;
+ rLCDCON5 = (INVVCLK<<10) | (INVVLINE<<9) | (INVVFRAME<<8) | (INVVD<<7) | (INVVDEN<<6)
+ | (INVENDLINE<<4) | (ENLEND<<2) | (BSWP<<1) | (HWSWP<<0) ;
+ }
+ gp32_setFramebuffer((uint32_t*)addr);
+
+return refreshrate;
+}
+
+short gp32_initFramebufferBP(void *add,uint32_t bitmode,uint32_t refreshrate) {
+ uint32_t addr = (uint32_t) add;
+ uint32_t GPHCLK = get_HCLK();
+ { uint16_t BPPMODE = 12;
+ uint16_t CLKVAL = 3;
+ uint16_t ENVID = 1;
+ uint16_t MMODE = 0;
+ uint16_t PNRMODE = 3;
+ switch (bitmode) {
+ case 16 : BPPMODE=12; break;
+ case 8 : BPPMODE=11; break;
+ case 4 : BPPMODE=10; break;
+ case 2 : BPPMODE= 9; break;
+ case 1 : BPPMODE= 8; break;
+ }
+ /* Get the correct CLKVAL for refreshrate
+ works in all bitmodes now :)
+ */
+ if (refreshrate < 50) refreshrate = 50;
+ if (refreshrate > 120) refreshrate =120;
+ CLKVAL = (GPHCLK/(109850*2*refreshrate))-1;
+ if (CLKVAL == 0) CLKVAL=1;
+ refreshrate = GPHCLK / (109850*2*(CLKVAL+1));
+ rLCDCON1 = (CLKVAL<<8) | (MMODE<<7) | (PNRMODE<<5) | (BPPMODE<<1) | (ENVID<<0);
+ }
+ { uint16_t LINEVAL = 320-1;
+ uint16_t VBPD = 8;
+ uint16_t VFPD = 2;
+ uint16_t VSPW = 5;
+ rLCDCON2 = 0;
+ rLCDCON2 = (VBPD<<24) | (LINEVAL<<14) | (VFPD<<6) | (VSPW<<0);
+ }
+ { uint16_t HBPD = 50;
+ uint16_t HFPD = 2;
+ uint16_t HOZVAL = 240-1;
+ rLCDCON3 = 0;
+ rLCDCON3 = (HBPD<<19) | (HOZVAL<<8) | (HFPD<<0);
+ }
+ { uint16_t ADDVAL = 0;
+ uint16_t HSPW = 30;
+ uint16_t MVAL = 0;
+ uint16_t PALADDEN = 0;
+ rLCDCON4 = 0;
+ rLCDCON4 = (PALADDEN<<24) | (ADDVAL<<16) | (MVAL<<8) | (HSPW<<0);
+ }
+ { uint16_t BSWP = 0;
+ uint16_t ENLEND = 0;
+ uint16_t HWSWP = 1;
+ uint16_t INVENDLINE = 0;
+ uint16_t INVVCLK = 1;
+ uint16_t INVVD = 0;
+ uint16_t INVVDEN = 0;
+ uint16_t INVVFRAME = 1;
+ uint16_t INVVLINE = 1;
+ if (bitmode<16) { BSWP=1;HWSWP=0; }
+ rLCDCON5 = 0;
+ rLCDCON5 = (INVVCLK<<10) | (INVVLINE<<9) | (INVVFRAME<<8) | (INVVD<<7) | (INVVDEN<<6)
+ | (INVENDLINE<<4) | (ENLEND<<2) | (BSWP<<1) | (HWSWP<<0);
+ }
+ gp32_setFramebuffer((uint32_t*)addr);
+
+return refreshrate;
+}
+
+void gp32_setPalette( unsigned char pos, uint16_t color) {
+ unsigned long *palette=(unsigned long *)0x14A00400;
+ while ((rLCDCON5>>19) == 2);
+ palette[pos]=color;
+}
diff --git a/c/src/lib/libcpu/arm/s3c2400/timer/timer.c b/c/src/lib/libcpu/arm/s3c2400/timer/timer.c
index abf736e4a9..c738f8fe4c 100644
--- a/c/src/lib/libcpu/arm/s3c2400/timer/timer.c
+++ b/c/src/lib/libcpu/arm/s3c2400/timer/timer.c
@@ -36,9 +36,6 @@ rtems_boolean Timer_driver_Find_average_overhead;
void Timer_initialize( void )
{
uint32_t cr;
- uint32_t m;
- uint32_t p;
- uint32_t s;
/* stop TIMER1*/
cr=rTCON & 0xFFFFF0FF;
@@ -48,17 +45,8 @@ void Timer_initialize( void )
cr=rTCFG1 & 0xFFFFFF0F;
rTCFG1=(cr | (0<<4));
- /* compute MPLL freq */
- m = M_MDIV + 8;
- p = M_PDIV + 2;
- s = M_SDIV;
- g_freq =(BSP_OSC_FREQ * m) / (p << s);
-
- /* PCLK = MPLL/4 */
- g_freq = g_freq / 4;
-
/* input freq=PLCK/2 Mhz*/
- g_freq = g_freq / 2000;
+ g_freq = get_PCLK() / 2000;
rTCNTB1 = 0xFFFF;
/* start TIMER1 with manual reload */