- /* Port-Pins als LCD-Ausgang */
- rPCCON = (rPCCON & 0xFFFFFF00)| 0x000000AA;
- /* Port-Pins als LCD-Ausgang */
- rPDCON = (rPDCON & 0xFFFFFF03)| 0x000000A8;
-#ifdef WITH_VFRAME
- /* mit VFRAME zum Messen */
- rPDCON = (rPDCON & 0xFFFFFF00)| 0x000000AA;
+ int i;
+
+ S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+ S3C24X0_TIMERS * const timers = S3C24X0_GetBase_TIMERS();
+ S3C24X0_LCD * const lcd = S3C24X0_GetBase_LCD();
+
+ /* try to determine display type from the value
+ * defined by pull-ups
+ */
+ gpio->PCUP = (gpio->PCUP & 0xFFF0); /* activate GPC0...GPC3 pullups */
+ gpio->PCCON = (gpio->PCCON & 0xFFFFFF00); /* configure GPC0...GPC3 as inputs */
+ /* allow signals to settle */
+ for (i=0; i<10000; i++) /* udelay isn't working yet at this point! */
+ __asm("NOP");
+ vfd_board_id = (~gpio->PCDAT) & 0x000F; /* read GPC0...GPC3 port pins */
+
+ VFD_DISABLE; /* activate blank for the vfd */
+
+#define NEW_CPLD_CLK
+
+#ifdef NEW_CPLD_CLK
+ if (vfd_board_id) {
+ /* If new board revision, then use PWM 3 as cpld-clock */
+ /* Enable 500 Hz timer for fill level sensor to operate properly */
+ /* Configure TOUT3 as functional pin, disable pull-up */
+ gpio->PDCON &= ~0x30000;
+ gpio->PDCON |= 0x20000;
+ gpio->PDUP |= (1 << 8);
+
+ /* Configure the prescaler */
+ timers->TCFG0 &= ~0xff00;
+ timers->TCFG0 |= 0x0f00;
+
+ /* Select MUX input (divider) for timer3 (1/16) */
+ timers->TCFG1 &= ~0xf000;
+ timers->TCFG1 |= 0x3000;
+
+ /* Enable autoreload and set the counter and compare
+ * registers to values for the 500 Hz clock
+ * (for a given prescaler (15) and divider (16)):
+ * counter = (66000000 / 500) >> 9;
+ */
+ timers->ch[3].TCNTB = 0x101;
+ timers->ch[3].TCMPB = 0x101 / 2;
+
+ /* Start timer */
+ timers->TCON = (timers->TCON | UPDATE3 | RELOAD3) & ~INVERT3;
+ timers->TCON = (timers->TCON | START3) & ~UPDATE3;
+ }