From patchwork Mon Dec 28 22:49:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "kevin.morfitt@fearnside-systems.co.uk" X-Patchwork-Id: 71698 X-Patchwork-Delegate: promsoft@gmail.com Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 2EEC03F6D1 for ; Mon, 28 Dec 2009 23:48:17 +0100 (CET) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 08C93C9601BC for ; Mon, 28 Dec 2009 23:48:17 +0100 (CET) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.9) for (single-drop); Mon, 28 Dec 2009 23:48:17 +0100 (CET) Received: from murder (svr19.m-online.net [192.168.3.147]) by backend2 (Cyrus v2.2.12) with LMTPA; Mon, 28 Dec 2009 23:48:01 +0100 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.pop.m-online.net (Cyrus v2.2.13) with LMTPA; Mon, 28 Dec 2009 23:48:00 +0100 Received: from scanner-4.m-online.net (scanner-4.m-online.net [192.168.1.18]) by mail.m-online.net (Postfix) with ESMTP id A56EC200167; Mon, 28 Dec 2009 23:48:00 +0100 (CET) Received: from mxin-1.m-online.net ([192.168.6.164]) by scanner-4.m-online.net (scanner-4.m-online.net [192.168.1.18]) (amavisd-new, port 10026) with ESMTP id 08190-04; Mon, 28 Dec 2009 23:47:57 +0100 (CET) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-1.m-online.net (Postfix) with ESMTP id 88CF746C0B8; Mon, 28 Dec 2009 23:47:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A1CB3280AF; Mon, 28 Dec 2009 23:47:45 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RDE4IsyPsx5d; Mon, 28 Dec 2009 23:47:45 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ABD38280B1; Mon, 28 Dec 2009 23:47:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5BA94280AD for ; Mon, 28 Dec 2009 23:47:31 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JWhLp-oHhNQr for ; Mon, 28 Dec 2009 23:47:28 +0100 (CET) Received: from hp17.hostpapa.com (hp17.hostpapa.com [67.220.225.50]) by theia.denx.de (Postfix) with ESMTP id 0613C280AC for ; Mon, 28 Dec 2009 23:47:26 +0100 (CET) Received: from cpc1-basf5-0-0-cust771.nott.cable.ntl.com ([86.1.175.4] helo=[192.168.1.102]) by hp17.hostpapa.com with esmtpa (Exim 4.69) (envelope-from ) id 1NPOMz-0006kj-HR for u-boot@lists.denx.de; Mon, 28 Dec 2009 22:47:25 +0000 Message-ID: <4B3935E7.30605@fearnside-systems.co.uk> Date: Mon, 28 Dec 2009 22:49:11 +0000 From: "kevin.morfitt@fearnside-systems.co.uk" User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: U-Boot ML X-Enigmail-Version: 0.96.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hp17.hostpapa.com X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fearnside-systems.co.uk X-Source: X-Source-Args: X-Source-Dir: Subject: [U-Boot] [PATCH ARM 1/4] s3c24x0 white-space clean-up part 1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list Reply-To: kevin.morfitt@fearnside-systems.co.uk List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net Cleans up white-space in the s3c24x0 files, including removing any dead code but excluding code style or line length changes. Due to the size of the changes this change is split into two patches. Signed-off-by: Kevin Morfitt --- checkpatch.pl reports no white-space errors. board/mpl/vcma9/vcma9.h | 38 +- board/trab/trab_fkt.c | 970 +++++++++++++++++++++++------------------------ board/trab/tsc2000.c | 183 +++++---- board/trab/tsc2000.h | 16 +- board/trab/vfd.c | 476 +++++++++++++---------- 5 files changed, 857 insertions(+), 826 deletions(-) diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h index 94fd2fa..e1ec1fe 100644 --- a/board/mpl/vcma9/vcma9.h +++ b/board/mpl/vcma9/vcma9.h @@ -27,8 +27,7 @@ #include -extern int mem_test(unsigned long start, unsigned long ramsize,int mode); - +extern int mem_test(unsigned long start, unsigned long ramsize, int mode); void print_vcma9_info(void); #if defined(CONFIG_CMD_NAND) @@ -69,13 +68,12 @@ static inline void NF_SetCE(NFCE_STATE s) struct s3c2410_nand * const nand = s3c2410_get_base_nand(); switch (s) { - case NFCE_LOW: - nand->NFCONF &= ~(1<<11); - break; - - case NFCE_HIGH: - nand->NFCONF |= (1<<11); - break; + case NFCE_LOW: + nand->NFCONF &= ~(1 << 11); + break; + case NFCE_HIGH: + nand->NFCONF |= (1 << 11); + break; } } @@ -83,7 +81,7 @@ static inline void NF_WaitRB(void) { struct s3c2410_nand * const nand = s3c2410_get_base_nand(); - while (!(nand->NFSTAT & (1<<0))); + while (!(nand->NFSTAT & (1 << 0))); } static inline void NF_Write(u8 data) @@ -97,34 +95,34 @@ static inline u8 NF_Read(void) { struct s3c2410_nand * const nand = s3c2410_get_base_nand(); - return(nand->NFDATA); + return (nand->NFDATA); } static inline void NF_Init_ECC(void) { struct s3c2410_nand * const nand = s3c2410_get_base_nand(); - nand->NFCONF |= (1<<12); + nand->NFCONF |= (1 << 12); } static inline u32 NF_Read_ECC(void) { struct s3c2410_nand * const nand = s3c2410_get_base_nand(); - return(nand->NFECC); + return (nand->NFECC); } #endif /* VCMA9 PLD regsiters */ typedef struct { - u8 ID; - u8 NIC; - u8 CAN; - u8 MISC; - u8 GPCD; - u8 BOARD; - u8 SDRAM; + u8 ID; + u8 NIC; + u8 CAN; + u8 MISC; + u8 GPCD; + u8 BOARD; + u8 SDRAM; } /*__attribute__((__packed__))*/ VCMA9_PLD; #define VCMA9_PLD_BASE 0x2C000100 diff --git a/board/trab/trab_fkt.c b/board/trab/trab_fkt.c index 2df9a04..8ca532d 100644 --- a/board/trab/trab_fkt.c +++ b/board/trab/trab_fkt.c @@ -40,122 +40,122 @@ /* max time to wait for touch is pressed */ #ifndef CONFIG_TOUCH_WAIT_PRESSED -#define TOUCH_TIMEOUT 5 +#define TOUCH_TIMEOUT 5 #endif /* !CONFIG_TOUCH_WAIT_PRESSED */ /* assignment of CPU internal ADC channels with TRAB hardware */ -#define VCC5V 2 -#define VCC12V 3 +#define VCC5V 2 +#define VCC12V 3 /* CPLD-Register for controlling TRAB hardware functions */ -#define CPLD_BUTTONS ((volatile unsigned long *)0x04020000) -#define CPLD_FILL_LEVEL ((volatile unsigned long *)0x04008000) -#define CPLD_ROTARY_SWITCH ((volatile unsigned long *)0x04018000) -#define CPLD_RS485_RE ((volatile unsigned long *)0x04028000) +#define CPLD_BUTTONS ((volatile unsigned long *)0x04020000) +#define CPLD_FILL_LEVEL ((volatile unsigned long *)0x04008000) +#define CPLD_ROTARY_SWITCH ((volatile unsigned long *)0x04018000) +#define CPLD_RS485_RE ((volatile unsigned long *)0x04028000) /* timer configuration bits for buzzer and PWM */ #define START2 (1 << 12) -#define UPDATE2 (1 << 13) -#define INVERT2 (1 << 14) -#define RELOAD2 (1 << 15) +#define UPDATE2 (1 << 13) +#define INVERT2 (1 << 14) +#define RELOAD2 (1 << 15) #define START3 (1 << 16) -#define UPDATE3 (1 << 17) -#define INVERT3 (1 << 18) -#define RELOAD3 (1 << 19) +#define UPDATE3 (1 << 17) +#define INVERT3 (1 << 18) +#define RELOAD3 (1 << 19) #define PCLK 66000000 -#define BUZZER_FREQ 1000 /* frequency in Hz */ -#define PWM_FREQ 500 +#define BUZZER_FREQ 1000 /* frequency in Hz */ +#define PWM_FREQ 500 /* definitions of I2C EEPROM device address */ -#define I2C_EEPROM_DEV_ADDR 0x54 +#define I2C_EEPROM_DEV_ADDR 0x54 /* definition for touch panel calibration points */ -#define CALIB_TL 0 /* calibration point in (T)op (L)eft corner */ -#define CALIB_DR 1 /* calibration point in (D)own (R)ight corner */ +#define CALIB_TL 0 /* calibration point in (T)op (L)eft corner */ +#define CALIB_DR 1 /* calibration point in (D)own (R)ight corner */ /* EEPROM address map */ -#define SERIAL_NUMBER 8 -#define TOUCH_X0 52 -#define TOUCH_Y0 54 -#define TOUCH_X1 56 -#define TOUCH_Y1 58 -#define CRC16 60 +#define SERIAL_NUMBER 8 +#define TOUCH_X0 52 +#define TOUCH_Y0 54 +#define TOUCH_X1 56 +#define TOUCH_Y1 58 +#define CRC16 60 /* EEPROM stuff */ -#define EEPROM_MAX_CRC_BUF 64 +#define EEPROM_MAX_CRC_BUF 64 /* RS485 stuff */ -#define RS485_MAX_RECEIVE_BUF_LEN 100 +#define RS485_MAX_RECEIVE_BUF_LEN 100 /* Bit definitions for ADCCON */ -#define ADC_ENABLE_START 0x1 -#define ADC_READ_START 0x2 -#define ADC_STDBM 0x4 -#define ADC_INP_AIN0 (0x0 << 3) -#define ADC_INP_AIN1 (0x1 << 3) -#define ADC_INP_AIN2 (0x2 << 3) -#define ADC_INP_AIN3 (0x3 << 3) -#define ADC_INP_AIN4 (0x4 << 3) -#define ADC_INP_AIN5 (0x5 << 3) -#define ADC_INP_AIN6 (0x6 << 3) -#define ADC_INP_AIN7 (0x7 << 3) -#define ADC_PRSCEN 0x4000 -#define ADC_ECFLG 0x8000 +#define ADC_ENABLE_START 0x1 +#define ADC_READ_START 0x2 +#define ADC_STDBM 0x4 +#define ADC_INP_AIN0 (0x0 << 3) +#define ADC_INP_AIN1 (0x1 << 3) +#define ADC_INP_AIN2 (0x2 << 3) +#define ADC_INP_AIN3 (0x3 << 3) +#define ADC_INP_AIN4 (0x4 << 3) +#define ADC_INP_AIN5 (0x5 << 3) +#define ADC_INP_AIN6 (0x6 << 3) +#define ADC_INP_AIN7 (0x7 << 3) +#define ADC_PRSCEN 0x4000 +#define ADC_ECFLG 0x8000 /* function test functions */ -int do_dip (void); -int do_info (void); -int do_vcc5v (void); -int do_vcc12v (void); -int do_buttons (void); -int do_fill_level (void); -int do_rotary_switch (void); -int do_pressure (void); -int do_v_bat (void); -int do_vfd_id (void); -int do_buzzer (char **); -int do_led (char **); -int do_full_bridge (char **); -int do_dac (char **); -int do_motor_contact (void); -int do_motor (char **); -int do_pwm (char **); -int do_thermo (char **); -int do_touch (char **); -int do_rs485 (char **); -int do_serial_number (char **); -int do_crc16 (void); -int do_power_switch (void); -int do_gain (char **); -int do_eeprom (char **); +int do_dip(void); +int do_info(void); +int do_vcc5v(void); +int do_vcc12v(void); +int do_buttons(void); +int do_fill_level(void); +int do_rotary_switch(void); +int do_pressure(void); +int do_v_bat(void); +int do_vfd_id(void); +int do_buzzer(char **); +int do_led(char **); +int do_full_bridge(char **); +int do_dac(char **); +int do_motor_contact(void); +int do_motor(char **); +int do_pwm(char **); +int do_thermo(char **); +int do_touch(char **); +int do_rs485(char **); +int do_serial_number(char **); +int do_crc16(void); +int do_power_switch(void); +int do_gain(char **); +int do_eeprom(char **); /* helper functions */ -static void adc_init (void); -static int adc_read (unsigned int channel); -static void print_identifier (void); +static void adc_init(void); +static int adc_read(unsigned int channel); +static void print_identifier(void); #ifdef CONFIG_TOUCH_WAIT_PRESSED -static void touch_wait_pressed (void); +static void touch_wait_pressed(void); #else -static int touch_check_pressed (void); +static int touch_check_pressed(void); #endif /* CONFIG_TOUCH_WAIT_PRESSED */ -static void touch_read_x_y (int *x, int *y); -static int touch_write_clibration_values (int calib_point, int x, int y); -static int rs485_send_line (const char *data); -static int rs485_receive_chars (char *data, int timeout); +static void touch_read_x_y(int *x, int *y); +static int touch_write_clibration_values(int calib_point, int x, int y); +static int rs485_send_line(const char *data); +static int rs485_receive_chars(char *data, int timeout); static unsigned short updcrc(unsigned short icrc, unsigned char *icp, unsigned int icnt); #if defined(CONFIG_CMD_I2C) -static int trab_eeprom_read (char **argv); -static int trab_eeprom_write (char **argv); -int i2c_write_multiple (uchar chip, uint addr, int alen, uchar *buffer, - int len); -int i2c_read_multiple ( uchar chip, uint addr, int alen, uchar *buffer, - int len); +static int trab_eeprom_read(char **argv); +static int trab_eeprom_write(char **argv); +int i2c_write_multiple(uchar chip, uint addr, int alen, uchar *buffer, + int len); +int i2c_read_multiple(uchar chip, uint addr, int alen, uchar *buffer, + int len); #endif /* @@ -163,152 +163,145 @@ int i2c_read_multiple ( uchar chip, uint addr, int alen, uchar *buffer, * test. */ -int trab_fkt (int argc, char *argv[]) +int trab_fkt(int argc, char *argv[]) { int i; app_startup(argv); - if (get_version () != XF_VERSION) { - printf ("Wrong XF_VERSION. Please re-compile with actual " - "u-boot sources\n"); - printf ("Example expects ABI version %d\n", XF_VERSION); - printf ("Actual U-Boot ABI version %d\n", (int)get_version()); + if (get_version() != XF_VERSION) { + printf("Wrong XF_VERSION. Please re-compile with actual " + "u-boot sources\n"); + printf("Example expects ABI version %d\n", XF_VERSION); + printf("Actual U-Boot ABI version %d\n", (int)get_version()); return 1; } - debug ("argc = %d\n", argc); + debug("argc = %d\n", argc); - for (i=0; i<=argc; ++i) { - debug ("argv[%d] = \"%s\"\n", i, argv[i] ? argv[i] : ""); + for (i = 0; i <= argc; ++i) { + debug("argv[%d] = \"%s\"\n", i, argv[i] ? argv[i] : ""); } - adc_init (); + adc_init(); switch (argc) { - case 0: case 1: break; - case 2: - if (strcmp (argv[1], "info") == 0) { - return (do_info ()); + if (strcmp(argv[1], "info") == 0) { + return (do_info()); } - if (strcmp (argv[1], "dip") == 0) { - return (do_dip ()); + if (strcmp(argv[1], "dip") == 0) { + return (do_dip()); } - if (strcmp (argv[1], "vcc5v") == 0) { - return (do_vcc5v ()); + if (strcmp(argv[1], "vcc5v") == 0) { + return (do_vcc5v()); } - if (strcmp (argv[1], "vcc12v") == 0) { - return (do_vcc12v ()); + if (strcmp(argv[1], "vcc12v") == 0) { + return (do_vcc12v()); } - if (strcmp (argv[1], "buttons") == 0) { - return (do_buttons ()); + if (strcmp(argv[1], "buttons") == 0) { + return (do_buttons()); } - if (strcmp (argv[1], "fill_level") == 0) { - return (do_fill_level ()); + if (strcmp(argv[1], "fill_level") == 0) { + return (do_fill_level()); } - if (strcmp (argv[1], "rotary_switch") == 0) { - return (do_rotary_switch ()); + if (strcmp(argv[1], "rotary_switch") == 0) { + return (do_rotary_switch()); } - if (strcmp (argv[1], "pressure") == 0) { - return (do_pressure ()); + if (strcmp(argv[1], "pressure") == 0) { + return (do_pressure()); } - if (strcmp (argv[1], "v_bat") == 0) { - return (do_v_bat ()); + if (strcmp(argv[1], "v_bat") == 0) { + return (do_v_bat()); } - if (strcmp (argv[1], "vfd_id") == 0) { - return (do_vfd_id ()); + if (strcmp(argv[1], "vfd_id") == 0) { + return (do_vfd_id()); } - if (strcmp (argv[1], "motor_contact") == 0) { - return (do_motor_contact ()); + if (strcmp(argv[1], "motor_contact") == 0) { + return (do_motor_contact()); } - if (strcmp (argv[1], "crc16") == 0) { - return (do_crc16 ()); + if (strcmp(argv[1], "crc16") == 0) { + return (do_crc16()); } - if (strcmp (argv[1], "power_switch") == 0) { - return (do_power_switch ()); + if (strcmp(argv[1], "power_switch") == 0) { + return (do_power_switch()); } break; - case 3: - if (strcmp (argv[1], "full_bridge") == 0) { - return (do_full_bridge (argv)); + if (strcmp(argv[1], "full_bridge") == 0) { + return (do_full_bridge(argv)); } - if (strcmp (argv[1], "dac") == 0) { - return (do_dac (argv)); + if (strcmp(argv[1], "dac") == 0) { + return (do_dac(argv)); } - if (strcmp (argv[1], "motor") == 0) { - return (do_motor (argv)); + if (strcmp(argv[1], "motor") == 0) { + return (do_motor(argv)); } - if (strcmp (argv[1], "pwm") == 0) { - return (do_pwm (argv)); + if (strcmp(argv[1], "pwm") == 0) { + return (do_pwm(argv)); } - if (strcmp (argv[1], "thermo") == 0) { - return (do_thermo (argv)); + if (strcmp(argv[1], "thermo") == 0) { + return (do_thermo(argv)); } - if (strcmp (argv[1], "touch") == 0) { - return (do_touch (argv)); + if (strcmp(argv[1], "touch") == 0) { + return (do_touch(argv)); } - if (strcmp (argv[1], "serial_number") == 0) { - return (do_serial_number (argv)); + if (strcmp(argv[1], "serial_number") == 0) { + return (do_serial_number(argv)); } - if (strcmp (argv[1], "buzzer") == 0) { - return (do_buzzer (argv)); + if (strcmp(argv[1], "buzzer") == 0) { + return (do_buzzer(argv)); } - if (strcmp (argv[1], "gain") == 0) { - return (do_gain (argv)); + if (strcmp(argv[1], "gain") == 0) { + return (do_gain(argv)); } break; - case 4: - if (strcmp (argv[1], "led") == 0) { - return (do_led (argv)); + if (strcmp(argv[1], "led") == 0) { + return (do_led(argv)); } - if (strcmp (argv[1], "rs485") == 0) { - return (do_rs485 (argv)); + if (strcmp(argv[1], "rs485") == 0) { + return (do_rs485(argv)); } - if (strcmp (argv[1], "serial_number") == 0) { - return (do_serial_number (argv)); + if (strcmp(argv[1], "serial_number") == 0) { + return (do_serial_number(argv)); } break; - case 5: - if (strcmp (argv[1], "eeprom") == 0) { - return (do_eeprom (argv)); + if (strcmp(argv[1], "eeprom") == 0) { + return (do_eeprom(argv)); } break; - case 6: - if (strcmp (argv[1], "eeprom") == 0) { - return (do_eeprom (argv)); + if (strcmp(argv[1], "eeprom") == 0) { + return (do_eeprom(argv)); } break; - default: break; } - printf ("Usage:\n ...\n"); + printf("Usage:\n ...\n"); return 1; } -void hang (void) +void hang(void) { - puts ("### ERROR ### Please RESET the board ###\n"); + puts("### ERROR ### Please RESET the board ###\n"); for (;;); } -int do_info (void) +int do_info(void) { - printf ("Stand-alone application for TRAB board function test\n"); - printf ("Built: %s at %s\n", U_BOOT_DATE, U_BOOT_TIME); + printf("Stand-alone application for TRAB board function test\n"); + printf("Built: %s at %s\n", U_BOOT_DATE, U_BOOT_TIME); return 0; } -int do_dip (void) +int do_dip(void) { unsigned int result = 0; int adc_val; @@ -327,8 +320,8 @@ int do_dip (void) for (i = 7; i > 3; i--) { - if ((adc_val = adc_read (i)) == -1) { - printf ("Channel %d could not be read\n", i); + if ((adc_val = adc_read(i)) == -1) { + printf("Channel %d could not be read\n", i); return 1; } @@ -338,11 +331,11 @@ int do_dip (void) * Set trigger at halve that value. */ if (adc_val < 368) - result |= (1 << (i-4)); + result |= (1 << (i - 4)); } /* print result to console */ - print_identifier (); + print_identifier(); for (i = 0; i < 4; i++) { if ((result & (1 << i)) == 0) printf("0"); @@ -354,15 +347,14 @@ int do_dip (void) return 0; } - -int do_vcc5v (void) +int do_vcc5v(void) { int result; /* VCC5V is connected to channel 2 */ - if ((result = adc_read (VCC5V)) == -1) { - printf ("VCC5V could not be read\n"); + if ((result = adc_read(VCC5V)) == -1) { + printf("VCC5V could not be read\n"); return 1; } @@ -371,22 +363,21 @@ int do_vcc5v (void) * floating point support. VCC5V is connected over an resistor divider: * VCC5V=ADCval*2,5V/1023*(10K+30K)/10K. */ - print_identifier (); - printf ("%d", (result & 0x3FF)* 10 / 1023); - printf (".%d", ((result & 0x3FF)* 10 % 1023)* 10 / 1023); - printf ("%d V\n", (((result & 0x3FF) * 10 % 1023 ) * 10 % 1023) - * 10 / 1024); + print_identifier(); + printf("%d", (result & 0x3FF) * 10 / 1023); + printf(".%d", ((result & 0x3FF) * 10 % 1023) * 10 / 1023); + printf("%d V\n", (((result & 0x3FF) * 10 % 1023) * 10 % 1023) + * 10 / 1024); return 0; } - -int do_vcc12v (void) +int do_vcc12v(void) { int result; - if ((result = adc_read (VCC12V)) == -1) { - printf ("VCC12V could not be read\n"); + if ((result = adc_read(VCC12V)) == -1) { + printf("VCC12V could not be read\n"); return 1; } @@ -395,35 +386,35 @@ int do_vcc12v (void) * floating point support. VCC5V is connected over an resistor divider: * VCC12V=ADCval*2,5V/1023*(30K+270K)/30K. */ - print_identifier (); - printf ("%d", (result & 0x3FF)* 25 / 1023); - printf (".%d V\n", ((result & 0x3FF)* 25 % 1023) * 10 / 1023); + print_identifier(); + printf("%d", (result & 0x3FF) * 25 / 1023); + printf(".%d V\n", ((result & 0x3FF) * 25 % 1023) * 10 / 1023); return 0; } -static int adc_read (unsigned int channel) +static int adc_read(unsigned int channel) { - int j = 1000; /* timeout value for wait loop in us */ + int j = 1000; /* timeout value for wait loop in us */ int result; struct s3c2400_adc *padc; padc = s3c2400_get_base_adc(); channel &= 0x7; - padc->ADCCON &= ~ADC_STDBM; /* select normal mode */ - padc->ADCCON &= ~(0x7 << 3); /* clear the channel bits */ + padc->ADCCON &= ~ADC_STDBM; /* select normal mode */ + padc->ADCCON &= ~(0x7 << 3); /* clear the channel bits */ padc->ADCCON |= ((channel << 3) | ADC_ENABLE_START); while (j--) { if ((padc->ADCCON & ADC_ENABLE_START) == 0) break; - udelay (1); + udelay(1); } if (j == 0) { printf("%s: ADC timeout\n", __FUNCTION__); - padc->ADCCON |= ADC_STDBM; /* select standby mode */ + padc->ADCCON |= ADC_STDBM; /* select standby mode */ return -1; } @@ -431,27 +422,26 @@ static int adc_read (unsigned int channel) padc->ADCCON |= ADC_STDBM; /* select standby mode */ - debug ("%s: channel %d, result[DIGIT]=%d\n", __FUNCTION__, - (padc->ADCCON >> 3) & 0x7, result); + debug("%s: channel %d, result[DIGIT]=%d\n", __FUNCTION__, + (padc->ADCCON >> 3) & 0x7, result); /* * Wait for ADC to be ready for next conversion. This delay value was * estimated, because the datasheet does not specify a value. */ - udelay (1000); + udelay(1000); return (result); } - -static void adc_init (void) +static void adc_init(void) { struct s3c2400_adc *padc; padc = s3c2400_get_base_adc(); - padc->ADCCON &= ~(0xff << 6); /* clear prescaler bits */ - padc->ADCCON |= ((65 << 6) | ADC_PRSCEN); /* set prescaler */ + padc->ADCCON &= ~(0xff << 6); /* clear prescaler bits */ + padc->ADCCON |= ((65 << 6) | ADC_PRSCEN); /* set prescaler */ /* * Wait some time to avoid problem with very first call of @@ -459,22 +449,21 @@ static void adc_init (void) * value is 0. Perhaps because the * adjustment of prescaler takes * some clock cycles? */ - udelay (1000); + udelay(1000); return; } - -int do_buttons (void) +int do_buttons(void) { int result; int i; result = *CPLD_BUTTONS; /* read CPLD */ - debug ("%s: cpld_taster (32 bit) %#x\n", __FUNCTION__, result); + debug("%s: cpld_taster (32 bit) %#x\n", __FUNCTION__, result); /* print result to console */ - print_identifier (); + print_identifier(); for (i = 16; i <= 19; i++) { if ((result & (1 << i)) == 0) printf("0"); @@ -486,7 +475,7 @@ int do_buttons (void) } -int do_power_switch (void) +int do_power_switch(void) { int result; @@ -498,21 +487,20 @@ int do_power_switch (void) /* signal GPE7 from power switch is low active: 0=on , 1=off */ result = ((gpio->PEDAT & (1 << 7)) == (1 << 7)) ? 0 : 1; - print_identifier (); + print_identifier(); printf("%d\n", result); return 0; } - -int do_fill_level (void) +int do_fill_level(void) { int result; result = *CPLD_FILL_LEVEL; /* read CPLD */ - debug ("%s: cpld_fuellstand (32 bit) %#x\n", __FUNCTION__, result); + debug("%s: cpld_fuellstand (32 bit) %#x\n", __FUNCTION__, result); /* print result to console */ - print_identifier (); + print_identifier(); if ((result & (1 << 16)) == 0) printf("0\n"); else @@ -520,8 +508,7 @@ int do_fill_level (void) return 0; } - -int do_rotary_switch (void) +int do_rotary_switch(void) { int result; /* @@ -532,12 +519,13 @@ int do_rotary_switch (void) */ result = *CPLD_ROTARY_SWITCH; /* read CPLD */ - debug ("%s: cpld_inc (32 bit) %#x\n", __FUNCTION__, result); + debug("%s: cpld_inc (32 bit) %#x\n", __FUNCTION__, result); - *CPLD_ROTARY_SWITCH |= (3 << 16); /* clear direction bits in CPLD */ + /* clear direction bits in CPLD */ + *CPLD_ROTARY_SWITCH |= (3 << 16); /* print result to console */ - print_identifier (); + print_identifier(); if ((result & (1 << 16)) == (1 << 16)) printf("R"); if ((result & (1 << 17)) == (1 << 17)) @@ -551,8 +539,7 @@ int do_rotary_switch (void) return 0; } - -int do_vfd_id (void) +int do_vfd_id(void) { int i; long int pcup_old, pccon_old; @@ -564,17 +551,20 @@ int do_vfd_id (void) pcup_old = gpio->PCUP; pccon_old = gpio->PCCON; - gpio->PCUP = (gpio->PCUP & 0xFFF0); /* activate GPC0...GPC3 pull-ups */ - gpio->PCCON = (gpio->PCCON & 0xFFFFFF00); /* configure GPC0...GPC3 as - * inputs */ - udelay (10); /* allow signals to settle */ - vfd_board_id = (~gpio->PCDAT) & 0x000F; /* read GPC0...GPC3 port pins */ + /* activate GPC0...GPC3 pull-ups */ + gpio->PCUP = (gpio->PCUP & 0xFFF0); + /* configure GPC0...GPC3 as inputs */ + gpio->PCCON = (gpio->PCCON & 0xFFFFFF00); + + udelay(10); /* allow signals to settle */ + /* read GPC0...GPC3 port pins */ + vfd_board_id = (~gpio->PCDAT) & 0x000F; gpio->PCCON = pccon_old; gpio->PCUP = pcup_old; /* print vfd_board_id to console */ - print_identifier (); + print_identifier(); for (i = 0; i < 4; i++) { if ((vfd_board_id & (1 << i)) == 0) printf("0"); @@ -585,7 +575,7 @@ int do_vfd_id (void) return 0; } -int do_buzzer (char **argv) +int do_buzzer(char **argv) { int counter; @@ -605,8 +595,8 @@ int do_buzzer (char **argv) timers->ch[2].TCNTB = counter; timers->ch[2].TCMPB = counter / 2; - if (strcmp (argv[2], "on") == 0) { - debug ("%s: frequency: %d\n", __FUNCTION__, + if (strcmp(argv[2], "on") == 0) { + debug("%s: frequency: %d\n", __FUNCTION__, BUZZER_FREQ); /* configure pin GPD7 as TOUT2 */ @@ -619,7 +609,7 @@ int do_buzzer (char **argv) timers->TCON = (timers->TCON | START2) & ~UPDATE2; return (0); } - else if (strcmp (argv[2], "off") == 0) { + else if (strcmp(argv[2], "off") == 0) { /* stop */ timers->TCON &= ~(START2 | RELOAD2); @@ -630,12 +620,11 @@ int do_buzzer (char **argv) return (0); } - printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); return 1; } - -int do_led (char **argv) +int do_led(char **argv) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); @@ -648,107 +637,97 @@ int do_led (char **argv) gpio->PDCON |= ((0x1 << 8) | 0x1); switch (simple_strtoul(argv[2], NULL, 10)) { - case 0: case 1: break; - case 2: - if (strcmp (argv[3], "on") == 0) + if (strcmp(argv[3], "on") == 0) gpio->PCDAT |= (1 << 14); else gpio->PCDAT &= ~(1 << 14); return 0; - case 3: - if (strcmp (argv[3], "on") == 0) + if (strcmp(argv[3], "on") == 0) gpio->PCDAT |= (1 << 15); else gpio->PCDAT &= ~(1 << 15); return 0; - case 4: - if (strcmp (argv[3], "on") == 0) + if (strcmp(argv[3], "on") == 0) gpio->PDDAT |= (1 << 0); else gpio->PDDAT &= ~(1 << 0); return 0; - case 5: - if (strcmp (argv[3], "on") == 0) + if (strcmp(argv[3], "on") == 0) gpio->PDDAT |= (1 << 4); else gpio->PDDAT &= ~(1 << 4); return 0; - default: break; - } - printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); return 1; } - -int do_full_bridge (char **argv) +int do_full_bridge(char **argv) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); /* configure PD5 and PD6 as output */ - gpio->PDCON &= ~((0x3 << 5*2) | (0x3 << 6*2)); - gpio->PDCON |= ((0x1 << 5*2) | (0x1 << 6*2)); + gpio->PDCON &= ~((0x3 << 5 * 2) | (0x3 << 6 * 2)); + gpio->PDCON |= ((0x1 << 5 * 2) | (0x1 << 6 * 2)); - if (strcmp (argv[2], "+") == 0) { - gpio->PDDAT |= (1 << 5); - gpio->PDDAT |= (1 << 6); - return 0; + if (strcmp(argv[2], "+") == 0) { + gpio->PDDAT |= (1 << 5); + gpio->PDDAT |= (1 << 6); + return 0; } - else if (strcmp (argv[2], "-") == 0) { + else if (strcmp(argv[2], "-") == 0) { gpio->PDDAT &= ~(1 << 5); gpio->PDDAT |= (1 << 6); return 0; } - else if (strcmp (argv[2], "off") == 0) { + else if (strcmp(argv[2], "off") == 0) { gpio->PDDAT &= ~(1 << 5); gpio->PDDAT &= ~(1 << 6); return 0; } - printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); return 1; } /* val must be in [0, 4095] */ -static inline unsigned long tsc2000_to_uv (u16 val) +static inline unsigned long tsc2000_to_uv(u16 val) { return ((250000 * val) / 4096) * 10; } - -int do_dac (char **argv) +int do_dac(char **argv) { int brightness; /* initialize SPI */ - tsc2000_spi_init (); + tsc2000_spi_init(); - if (((brightness = simple_strtoul (argv[2], NULL, 10)) < 0) || - (brightness > 255)) { - printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); + if (((brightness = simple_strtoul(argv[2], NULL, 10)) < 0) || + (brightness > 255)) { + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); return 1; } - tsc2000_write(TSC2000_REG_DACCTL, 0x0); /* Power up DAC */ + tsc2000_write(TSC2000_REG_DACCTL, 0x0); /* Power up DAC */ tsc2000_write(TSC2000_REG_DAC, brightness & 0xff); return 0; } - -int do_v_bat (void) +int do_v_bat(void) { unsigned long ret, res; /* initialize SPI */ - spi_init (); + spi_init(); tsc2000_write(TSC2000_REG_ADC, 0x1836); @@ -759,39 +738,37 @@ int do_v_bat (void) res = (tsc2000_to_uv(ret) + 1250) / 2500; res += (ERROR_BATTERY * res) / 1000; - print_identifier (); - printf ("%ld", (res / 100)); - printf (".%ld", ((res % 100) / 10)); - printf ("%ld V\n", (res % 10)); + print_identifier(); + printf("%ld", (res / 100)); + printf(".%ld", ((res % 100) / 10)); + printf("%ld V\n", (res % 10)); return 0; } - -int do_pressure (void) +int do_pressure(void) { /* initialize SPI */ - spi_init (); + spi_init(); tsc2000_write(TSC2000_REG_ADC, 0x2436); /* now wait for data available */ adc_wait_conversion_done(); - print_identifier (); - printf ("%d\n", tsc2000_read(TSC2000_REG_AUX2)); + print_identifier(); + printf("%d\n", tsc2000_read(TSC2000_REG_AUX2)); return 0; } - -int do_motor_contact (void) +int do_motor_contact(void) { int result; result = *CPLD_FILL_LEVEL; /* read CPLD */ - debug ("%s: cpld_fuellstand (32 bit) %#x\n", __FUNCTION__, result); + debug("%s: cpld_fuellstand (32 bit) %#x\n", __FUNCTION__, result); /* print result to console */ - print_identifier (); + print_identifier(); if ((result & (1 << 17)) == 0) printf("0\n"); else @@ -799,7 +776,7 @@ int do_motor_contact (void) return 0; } -int do_motor (char **argv) +int do_motor(char **argv) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); @@ -807,30 +784,30 @@ int do_motor (char **argv) gpio->PGCON &= ~(0x3 << 0); gpio->PGCON |= (0x1 << 0); - if (strcmp (argv[2], "on") == 0) { + if (strcmp(argv[2], "on") == 0) { gpio->PGDAT &= ~(1 << 0); return 0; } - if (strcmp (argv[2], "off") == 0) { + if (strcmp(argv[2], "off") == 0) { gpio->PGDAT |= (1 << 0); return 0; } - printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); return 1; } -static void print_identifier (void) +static void print_identifier(void) { - printf ("## FKT: "); + printf("## FKT: "); } -int do_pwm (char **argv) +int do_pwm(char **argv) { int counter; struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); struct s3c24x0_timers * const timers = s3c24x0_get_base_timers(); - if (strcmp (argv[2], "on") == 0) { + if (strcmp(argv[2], "on") == 0) { /* configure pin GPD8 as TOUT3 */ gpio->PDCON &= ~(0x3 << 8*2); gpio->PDCON |= (0x2 << 8*2); @@ -853,7 +830,7 @@ int do_pwm (char **argv) timers->TCON = (timers->TCON | START3) & ~UPDATE3; return 0; } - if (strcmp (argv[2], "off") == 0) { + if (strcmp(argv[2], "off") == 0) { /* stop timer */ timers->TCON &= ~(START2 | RELOAD2); @@ -864,176 +841,172 @@ int do_pwm (char **argv) gpio->PDDAT &= ~(1 << 8); return 0; } - printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); return 1; } - -int do_thermo (char **argv) +int do_thermo(char **argv) { - int channel, res; + int channel, res; - tsc2000_reg_init (); + tsc2000_reg_init(); - if (strcmp (argv[2], "all") == 0) { + if (strcmp(argv[2], "all") == 0) { int i; for (i=0; i <= 15; i++) { res = tsc2000_read_channel(i); - print_identifier (); - printf ("c%d: %d\n", i, res); + print_identifier(); + printf("c%d: %d\n", i, res); } return 0; } - channel = simple_strtoul (argv[2], NULL, 10); + channel = simple_strtoul(argv[2], NULL, 10); res = tsc2000_read_channel(channel); - print_identifier (); - printf ("%d\n", res); - return 0; /* return OK */ + print_identifier(); + printf("%d\n", res); + return 0; /* return OK */ } - -int do_touch (char **argv) +int do_touch(char **argv) { - int x, y; + int x, y; - if (strcmp (argv[2], "tl") == 0) { + if (strcmp(argv[2], "tl") == 0) { #ifdef CONFIG_TOUCH_WAIT_PRESSED touch_wait_pressed(); #else { int i; for (i = 0; i < (TOUCH_TIMEOUT * 1000); i++) { - if (touch_check_pressed ()) { + if (touch_check_pressed()) { break; } - udelay (1000); /* pause 1 ms */ + udelay(1000); /* pause 1 ms */ } } if (!touch_check_pressed()) { - print_identifier (); - printf ("error: touch not pressed\n"); + print_identifier(); + printf("error: touch not pressed\n"); return 1; } #endif /* CONFIG_TOUCH_WAIT_PRESSED */ - touch_read_x_y (&x, &y); + touch_read_x_y(&x, &y); - print_identifier (); - printf ("x=%d y=%d\n", x, y); - return touch_write_clibration_values (CALIB_TL, x, y); + print_identifier(); + printf("x=%d y=%d\n", x, y); + return touch_write_clibration_values(CALIB_TL, x, y); } - else if (strcmp (argv[2], "dr") == 0) { + else if (strcmp(argv[2], "dr") == 0) { #ifdef CONFIG_TOUCH_WAIT_PRESSED touch_wait_pressed(); #else { int i; for (i = 0; i < (TOUCH_TIMEOUT * 1000); i++) { - if (touch_check_pressed ()) { + if (touch_check_pressed()) { break; } - udelay (1000); /* pause 1 ms */ + udelay(1000); /* pause 1 ms */ } } if (!touch_check_pressed()) { - print_identifier (); - printf ("error: touch not pressed\n"); + print_identifier(); + printf("error: touch not pressed\n"); return 1; } #endif /* CONFIG_TOUCH_WAIT_PRESSED */ - touch_read_x_y (&x, &y); + touch_read_x_y(&x, &y); - print_identifier (); - printf ("x=%d y=%d\n", x, y); + print_identifier(); + printf("x=%d y=%d\n", x, y); - return touch_write_clibration_values (CALIB_DR, x, y); + return touch_write_clibration_values(CALIB_DR, x, y); } - return 1; /* not "tl", nor "dr", so return error */ + return 1; /* not "tl", nor "dr", so return error */ } - #ifdef CONFIG_TOUCH_WAIT_PRESSED -static void touch_wait_pressed (void) +static void touch_wait_pressed(void) { while (!(tsc2000_read(TSC2000_REG_ADC) & TC_PSM)); } #else -static int touch_check_pressed (void) +static int touch_check_pressed(void) { return (tsc2000_read(TSC2000_REG_ADC) & TC_PSM); } #endif /* CONFIG_TOUCH_WAIT_PRESSED */ -static int touch_write_clibration_values (int calib_point, int x, int y) +static int touch_write_clibration_values(int calib_point, int x, int y) { #if defined(CONFIG_CMD_I2C) int x_verify = 0; int y_verify = 0; - tsc2000_reg_init (); + tsc2000_reg_init(); if (calib_point == CALIB_TL) { - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1, - (unsigned char *)&x, 2)) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1, + (unsigned char *)&x, 2)) { return 1; } - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1, - (unsigned char *)&y, 2)) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1, + (unsigned char *)&y, 2)) { return 1; } /* verify written values */ - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1, - (unsigned char *)&x_verify, 2)) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1, + (unsigned char *)&x_verify, 2)) { return 1; } - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1, - (unsigned char *)&y_verify, 2)) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1, + (unsigned char *)&y_verify, 2)) { return 1; } if ((y != y_verify) || (x != x_verify)) { - print_identifier (); - printf ("error: verify error\n"); + print_identifier(); + printf("error: verify error\n"); return 1; } - return 0; /* no error */ + return 0; /* no error */ } else if (calib_point == CALIB_DR) { - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1, - (unsigned char *)&x, 2)) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1, + (unsigned char *)&x, 2)) { return 1; - } - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1, - (unsigned char *)&y, 2)) { + } + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1, + (unsigned char *)&y, 2)) { return 1; } /* verify written values */ - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1, - (unsigned char *)&x_verify, 2)) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1, + (unsigned char *)&x_verify, 2)) { return 1; } - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1, - (unsigned char *)&y_verify, 2)) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1, + (unsigned char *)&y_verify, 2)) { return 1; } if ((y != y_verify) || (x != x_verify)) { - print_identifier (); - printf ("error: verify error\n"); + print_identifier(); + printf("error: verify error\n"); return 1; } return 0; } return 1; #else - printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write " - "to EEPROM\n"); + printf("No I2C support enabled (CONFIG_CMD_I2C), could not write " + "to EEPROM\n"); return (1); #endif } - -static void touch_read_x_y (int *px, int *py) +static void touch_read_x_y(int *px, int *py) { tsc2000_write(TSC2000_REG_ADC, DEFAULT_ADC | TC_AD0 | TC_AD1); adc_wait_conversion_done(); @@ -1044,64 +1017,61 @@ static void touch_read_x_y (int *px, int *py) *py = tsc2000_read(TSC2000_REG_Y); } - -int do_rs485 (char **argv) +int do_rs485(char **argv) { int timeout; char data[RS485_MAX_RECEIVE_BUF_LEN]; - if (strcmp (argv[2], "send") == 0) { - return (rs485_send_line (argv[3])); + if (strcmp(argv[2], "send") == 0) { + return (rs485_send_line(argv[3])); } - else if (strcmp (argv[2], "receive") == 0) { + else if (strcmp(argv[2], "receive") == 0) { timeout = simple_strtoul(argv[3], NULL, 10); - if (rs485_receive_chars (data, timeout) != 0) { - print_identifier (); - printf ("## nothing received\n"); + if (rs485_receive_chars(data, timeout) != 0) { + print_identifier(); + printf("## nothing received\n"); return (1); } else { - print_identifier (); - printf ("%s\n", data); + print_identifier(); + printf("%s\n", data); return (0); } } - printf ("%s: unknown command %s\n", __FUNCTION__, argv[2]); - return (1); /* unknown command, return error */ + printf("%s: unknown command %s\n", __FUNCTION__, argv[2]); + return (1); /* unknown command, return error */ } - -static int rs485_send_line (const char *data) +static int rs485_send_line(const char *data) { - rs485_init (); - trab_rs485_enable_tx (); - rs485_puts (data); - rs485_putc ('\n'); + rs485_init(); + trab_rs485_enable_tx(); + rs485_puts(data); + rs485_putc('\n'); return (0); } - -static int rs485_receive_chars (char *data, int timeout) +static int rs485_receive_chars(char *data, int timeout) { int i; int receive_count = 0; - rs485_init (); - trab_rs485_enable_rx (); + rs485_init(); + trab_rs485_enable_rx(); /* test every 1 ms for received characters to avoid a receive FIFO * overrun (@ 38.400 Baud) */ for (i = 0; i < (timeout * 1000); i++) { - while (rs485_tstc ()) { + while (rs485_tstc()) { if (receive_count >= RS485_MAX_RECEIVE_BUF_LEN-1) break; - *data++ = rs485_getc (); + *data++ = rs485_getc(); receive_count++; } - udelay (1000); /* pause 1 ms */ + udelay(1000); /* pause 1 ms */ } - *data = '\0'; /* terminate string */ + *data = '\0'; /* terminate string */ if (receive_count == 0) return (1); @@ -1109,71 +1079,69 @@ static int rs485_receive_chars (char *data, int timeout) return (0); } - -int do_serial_number (char **argv) +int do_serial_number(char **argv) { #if defined(CONFIG_CMD_I2C) unsigned int serial_number; - if (strcmp (argv[2], "read") == 0) { - if (i2c_read (I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1, - (unsigned char *)&serial_number, 4)) { - printf ("could not read from eeprom\n"); + if (strcmp(argv[2], "read") == 0) { + if (i2c_read(I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1, + (unsigned char *)&serial_number, 4)) { + printf("could not read from eeprom\n"); return (1); } - print_identifier (); - printf ("%08d\n", serial_number); + print_identifier(); + printf("%08d\n", serial_number); return (0); } - else if (strcmp (argv[2], "write") == 0) { + else if (strcmp(argv[2], "write") == 0) { serial_number = simple_strtoul(argv[3], NULL, 10); - if (i2c_write (I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1, + if (i2c_write(I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1, (unsigned char *)&serial_number, 4)) { - printf ("could not write to eeprom\n"); + printf("could not write to eeprom\n"); return (1); } return (0); } - printf ("%s: unknown command %s\n", __FUNCTION__, argv[2]); - return (1); /* unknown command, return error */ + printf("%s: unknown command %s\n", __FUNCTION__, argv[2]); + return (1); /* unknown command, return error */ #else - printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write " - "to EEPROM\n"); + printf("No I2C support enabled (CONFIG_CMD_I2C), could not write " + "to EEPROM\n"); return (1); #endif } -int do_crc16 (void) +int do_crc16(void) { #if defined(CONFIG_CMD_I2C) int crc; unsigned char buf[EEPROM_MAX_CRC_BUF]; - if (i2c_read (I2C_EEPROM_DEV_ADDR, 0, 1, buf, 60)) { - printf ("could not read from eeprom\n"); + if (i2c_read(I2C_EEPROM_DEV_ADDR, 0, 1, buf, 60)) { + printf("could not read from eeprom\n"); return (1); } - crc = 0; /* start value of crc calculation */ - crc = updcrc (crc, buf, 60); + crc = 0; /* start value of crc calculation */ + crc = updcrc(crc, buf, 60); - print_identifier (); - printf ("crc16=%#04x\n", crc); + print_identifier(); + printf("crc16=%#04x\n", crc); - if (i2c_write (I2C_EEPROM_DEV_ADDR, CRC16, 1, (unsigned char *)&crc, - sizeof (crc))) { - printf ("could not read from eeprom\n"); + if (i2c_write(I2C_EEPROM_DEV_ADDR, CRC16, 1, (unsigned char *)&crc, + sizeof(crc))) { + printf("could not read from eeprom\n"); return (1); } return (0); #else - printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write " - "to EEPROM\n"); + printf("No I2C support enabled (CONFIG_CMD_I2C), could not write " + "to EEPROM\n"); return (1); #endif } - /* * Calculate, intelligently, the CRC of a dataset incrementally given a * buffer full at a time. @@ -1188,52 +1156,52 @@ int do_crc16 (void) * Compile with -DMAKETAB to print values for crctab to stdout */ - /* the CRC polynomial. This is used by XMODEM (almost CCITT). - * If you change P, you must change crctab[]'s initial value to what is - * printed by initcrctab() - */ -#define P 0x1021 +/* the CRC polynomial. This is used by XMODEM (almost CCITT). + * If you change P, you must change crctab[]'s initial value to what is + * printed by initcrctab() + */ +#define P 0x1021 - /* number of bits in CRC: don't change it. */ -#define W 16 +/* number of bits in CRC: don't change it. */ +#define W 16 - /* this the number of bits per char: don't change it. */ -#define B 8 +/* this the number of bits per char: don't change it. */ +#define B 8 static unsigned short crctab[1< 3)) { - printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); return 1; } - tsc2000_set_range (range); + tsc2000_set_range(range); return (0); } - -int do_eeprom (char **argv) +int do_eeprom(char **argv) { #if defined(CONFIG_CMD_I2C) - if (strcmp (argv[2], "read") == 0) { - return (trab_eeprom_read (argv)); + if (strcmp(argv[2], "read") == 0) { + return (trab_eeprom_read(argv)); } - else if (strcmp (argv[2], "write") == 0) { - return (trab_eeprom_write (argv)); + else if (strcmp(argv[2], "write") == 0) { + return (trab_eeprom_write(argv)); } - printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]); return (1); #else - printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write " - "to EEPROM\n"); + printf("No I2C support enabled (CONFIG_CMD_I2C), could not write " + "to EEPROM\n"); return (1); #endif } #if defined(CONFIG_CMD_I2C) -static int trab_eeprom_read (char **argv) +static int trab_eeprom_read(char **argv) { int i; int len; @@ -1294,44 +1260,43 @@ static int trab_eeprom_read (char **argv) long int value = 0; uchar *buffer; - buffer = (uchar *) &value; - addr = simple_strtoul (argv[3], NULL, 10); + buffer = (uchar *)&value; + addr = simple_strtoul(argv[3], NULL, 10); addr &= 0xfff; - len = simple_strtoul (argv[4], NULL, 10); + len = simple_strtoul(argv[4], NULL, 10); if ((len < 1) || (len > 4)) { - printf ("%s: invalid parameter %s\n", __FUNCTION__, - argv[4]); + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[4]); return (1); } for (i = 0; i < len; i++) { - if (i2c_read (I2C_EEPROM_DEV_ADDR, addr+i, 1, buffer+i, 1)) { - printf ("%s: could not read from i2c device %#x" - ", addr %d\n", __FUNCTION__, - I2C_EEPROM_DEV_ADDR, addr); + if (i2c_read(I2C_EEPROM_DEV_ADDR, addr+i, 1, buffer+i, 1)) { + printf("%s: could not read from i2c device %#x" + ", addr %d\n", __FUNCTION__, + I2C_EEPROM_DEV_ADDR, addr); return (1); } } - print_identifier (); - if (strcmp (argv[5], "-") == 0) { + print_identifier(); + if (strcmp(argv[5], "-") == 0) { if (len == 1) - printf ("%d\n", (signed char) value); + printf("%d\n", (signed char)value); else if (len == 2) - printf ("%d\n", (signed short int) value); + printf("%d\n", (signed short int)value); else - printf ("%ld\n", value); + printf("%ld\n", value); } else { if (len == 1) - printf ("%d\n", (unsigned char) value); + printf("%d\n", (unsigned char)value); else if (len == 2) - printf ("%d\n", (unsigned short int) value); + printf("%d\n", (unsigned short int)value); else - printf ("%ld\n", (unsigned long int) value); + printf("%ld\n", (unsigned long int)value); } return (0); } -static int trab_eeprom_write (char **argv) +static int trab_eeprom_write(char **argv) { int i; int len; @@ -1339,77 +1304,74 @@ static int trab_eeprom_write (char **argv) long int value = 0; uchar *buffer; - buffer = (uchar *) &value; - addr = simple_strtoul (argv[3], NULL, 10); + buffer = (uchar *)&value; + addr = simple_strtoul(argv[3], NULL, 10); addr &= 0xfff; - len = simple_strtoul (argv[4], NULL, 10); + len = simple_strtoul(argv[4], NULL, 10); if ((len < 1) || (len > 4)) { - printf ("%s: invalid parameter %s\n", __FUNCTION__, - argv[4]); + printf("%s: invalid parameter %s\n", __FUNCTION__, argv[4]); return (1); } - value = simple_strtol (argv[5], NULL, 10); - debug ("value=%ld\n", value); + value = simple_strtol(argv[5], NULL, 10); + debug("value=%ld\n", value); for (i = 0; i < len; i++) { - if (i2c_write (I2C_EEPROM_DEV_ADDR, addr+i, 1, buffer+i, 1)) { - printf ("%s: could not write to i2c device %d" - ", addr %d\n", __FUNCTION__, - I2C_EEPROM_DEV_ADDR, addr); + if (i2c_write(I2C_EEPROM_DEV_ADDR, addr+i, 1, buffer+i, 1)) { + printf("%s: could not write to i2c device %d" + ", addr %d\n", __FUNCTION__, + I2C_EEPROM_DEV_ADDR, addr); return (1); } #if 0 - printf ("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i=" - "%#x+%d=%p=%#x \n",I2C_EEPROM_DEV_ADDR_DEV_ADDR , addr, - i, addr+i, 1, buffer, i, buffer+i, *(buffer+i)); + printf("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i=" + "%#x+%d=%p=%#x \n", I2C_EEPROM_DEV_ADDR_DEV_ADDR , addr, + i, addr+i, 1, buffer, i, buffer+i, *(buffer+i)); #endif - udelay (30000); /* wait for EEPROM ready */ + udelay(30000); /* wait for EEPROM ready */ } return (0); } -int i2c_write_multiple (uchar chip, uint addr, int alen, - uchar *buffer, int len) +int i2c_write_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len) { int i; if (alen != 1) { - printf ("%s: addr len other than 1 not supported\n", - __FUNCTION__); + printf("%s: addr len other than 1 not supported\n", + __FUNCTION__); return (1); } for (i = 0; i < len; i++) { - if (i2c_write (chip, addr+i, alen, buffer+i, 1)) { - printf ("%s: could not write to i2c device %d" - ", addr %d\n", __FUNCTION__, chip, addr); + if (i2c_write(chip, addr+i, alen, buffer+i, 1)) { + printf("%s: could not write to i2c device %d" + ", addr %d\n", __FUNCTION__, chip, addr); return (1); } #if 0 - printf ("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i=" - "%#x+%d=%p=\"%.1s\"\n", chip, addr, i, addr+i, - alen, buffer, i, buffer+i, buffer+i); + printf("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i=" + "%#x+%d=%p=\"%.1s\"\n", chip, addr, i, addr+i, + alen, buffer, i, buffer+i, buffer+i); #endif - udelay (30000); + udelay(30000); } return (0); } -int i2c_read_multiple ( uchar chip, uint addr, int alen, - uchar *buffer, int len) +int i2c_read_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len) { int i; if (alen != 1) { - printf ("%s: addr len other than 1 not supported\n", - __FUNCTION__); + printf("%s: addr len other than 1 not supported\n", + __FUNCTION__); return (1); } for (i = 0; i < len; i++) { - if (i2c_read (chip, addr+i, alen, buffer+i, 1)) { - printf ("%s: could not read from i2c device %#x" - ", addr %d\n", __FUNCTION__, chip, addr); + if (i2c_read(chip, addr+i, alen, buffer+i, 1)) { + printf("%s: could not read from i2c device %#x" + ", addr %d\n", __FUNCTION__, chip, addr); return (1); } } diff --git a/board/trab/tsc2000.c b/board/trab/tsc2000.c index 5890624..27d90b2 100644 --- a/board/trab/tsc2000.c +++ b/board/trab/tsc2000.c @@ -34,14 +34,14 @@ #include "Pt1000_temp_data.h" /* helper function */ -#define abs(value) (((value) < 0) ? ((value)*-1) : (value)) +#define abs(value) (((value) < 0) ? ((value)*-1) : (value)) /* * Maximal allowed deviation between two immediate meassurments of an analog - * thermo channel. 1 DIGIT = 0.0276 °C. This is used to filter sporadic + * thermo channel. 1 DIGIT = 0.0276 degC. This is used to filter sporadic * "jumps" in measurment. */ -#define MAX_DEVIATION 18 /* unit: DIGITs of adc; 18 DIGIT = 0.5 °C */ +#define MAX_DEVIATION 18 /* unit: DIGITs of adc; 18 DIGIT = 0.5 degC */ void tsc2000_spi_init(void) { @@ -57,10 +57,12 @@ void tsc2000_spi_init(void) CLR_CS_TOUCH(); - spi->ch[0].SPPRE = 0x1F; /* Baud-rate ca. 514kHz */ - spi->ch[0].SPPIN = 0x01; /* SPI-MOSI holds Level after last bit */ - spi->ch[0].SPCON = 0x1A; /* Polling, Prescaler, Master, CPOL=0, - CPHA=1 */ + /* Baud-rate ca. 514kHz */ + spi->ch[0].SPPRE = 0x1F; + /* SPI-MOSI holds Level after last bit */ + spi->ch[0].SPPIN = 0x01; + /* Polling, Prescaler, Master, CPOL=0, CPHA=1 */ + spi->ch[0].SPCON = 0x1A; /* Dummy byte ensures clock to be low. */ for (i = 0; i < 10; i++) { @@ -69,15 +71,14 @@ void tsc2000_spi_init(void) spi_wait_transmit_done(); } - void spi_wait_transmit_done(void) { struct s3c24x0_spi * const spi = s3c24x0_get_base_spi(); - while (!(spi->ch[0].SPSTA & 0x01)); /* wait until transfer is done */ + /* wait until transfer is done */ + while (!(spi->ch[0].SPSTA & 0x01)); } - void tsc2000_write(unsigned short reg, unsigned short data) { struct s3c24x0_spi * const spi = s3c24x0_get_base_spi(); @@ -97,8 +98,7 @@ void tsc2000_write(unsigned short reg, unsigned short data) CLR_CS_TOUCH(); } - -unsigned short tsc2000_read (unsigned short reg) +unsigned short tsc2000_read(unsigned short reg) { unsigned short command, data; struct s3c24x0_spi * const spi = s3c24x0_get_base_spi(); @@ -121,106 +121,128 @@ unsigned short tsc2000_read (unsigned short reg) return (spi->ch[0].SPRDAT & 0x0FF) | (data << 8); } - -void tsc2000_set_mux (unsigned int channel) +void tsc2000_set_mux(unsigned int channel) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); - CLR_MUX1_ENABLE; CLR_MUX2_ENABLE; - CLR_MUX3_ENABLE; CLR_MUX4_ENABLE; + CLR_MUX1_ENABLE; + CLR_MUX2_ENABLE; + CLR_MUX3_ENABLE; + CLR_MUX4_ENABLE; switch (channel) { case 0: - CLR_MUX0; CLR_MUX1; + CLR_MUX0; + CLR_MUX1; SET_MUX1_ENABLE; break; case 1: - SET_MUX0; CLR_MUX1; + SET_MUX0; + CLR_MUX1; SET_MUX1_ENABLE; break; case 2: - CLR_MUX0; SET_MUX1; + CLR_MUX0; + SET_MUX1; SET_MUX1_ENABLE; break; case 3: - SET_MUX0; SET_MUX1; + SET_MUX0; + SET_MUX1; SET_MUX1_ENABLE; break; case 4: - CLR_MUX0; CLR_MUX1; + CLR_MUX0; + CLR_MUX1; SET_MUX2_ENABLE; break; case 5: - SET_MUX0; CLR_MUX1; + SET_MUX0; + CLR_MUX1; SET_MUX2_ENABLE; break; case 6: - CLR_MUX0; SET_MUX1; + CLR_MUX0; + SET_MUX1; SET_MUX2_ENABLE; break; case 7: - SET_MUX0; SET_MUX1; + SET_MUX0; + SET_MUX1; SET_MUX2_ENABLE; break; case 8: - CLR_MUX0; CLR_MUX1; + CLR_MUX0; + CLR_MUX1; SET_MUX3_ENABLE; break; case 9: - SET_MUX0; CLR_MUX1; + SET_MUX0; + CLR_MUX1; SET_MUX3_ENABLE; break; case 10: - CLR_MUX0; SET_MUX1; + CLR_MUX0; + SET_MUX1; SET_MUX3_ENABLE; break; case 11: - SET_MUX0; SET_MUX1; + SET_MUX0; + SET_MUX1; SET_MUX3_ENABLE; break; case 12: - CLR_MUX0; CLR_MUX1; + CLR_MUX0; + CLR_MUX1; SET_MUX4_ENABLE; break; case 13: - SET_MUX0; CLR_MUX1; + SET_MUX0; + CLR_MUX1; SET_MUX4_ENABLE; break; case 14: - CLR_MUX0; SET_MUX1; + CLR_MUX0; + SET_MUX1; SET_MUX4_ENABLE; break; case 15: - SET_MUX0; SET_MUX1; + SET_MUX0; + SET_MUX1; SET_MUX4_ENABLE; break; default: - CLR_MUX0; CLR_MUX1; + CLR_MUX0; + CLR_MUX1; } } - -void tsc2000_set_range (unsigned int range) +void tsc2000_set_range(unsigned int range) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); switch (range) { case 1: - CLR_SEL_TEMP_V_0; SET_SEL_TEMP_V_1; - CLR_SEL_TEMP_V_2; CLR_SEL_TEMP_V_3; + CLR_SEL_TEMP_V_0; + SET_SEL_TEMP_V_1; + CLR_SEL_TEMP_V_2; + CLR_SEL_TEMP_V_3; break; case 2: - CLR_SEL_TEMP_V_0; CLR_SEL_TEMP_V_1; - CLR_SEL_TEMP_V_2; SET_SEL_TEMP_V_3; + CLR_SEL_TEMP_V_0; + CLR_SEL_TEMP_V_1; + CLR_SEL_TEMP_V_2; + SET_SEL_TEMP_V_3; break; case 3: - SET_SEL_TEMP_V_0; CLR_SEL_TEMP_V_1; - SET_SEL_TEMP_V_2; CLR_SEL_TEMP_V_3; + SET_SEL_TEMP_V_0; + CLR_SEL_TEMP_V_1; + SET_SEL_TEMP_V_2; + CLR_SEL_TEMP_V_3; break; } } - -u16 tsc2000_read_channel (unsigned int channel) +u16 tsc2000_read_channel(unsigned int channel) { u16 res; @@ -228,21 +250,20 @@ u16 tsc2000_read_channel (unsigned int channel) udelay(20 * TSC2000_DELAY_BASE); tsc2000_write(TSC2000_REG_ADC, 0x2036); - adc_wait_conversion_done (); + adc_wait_conversion_done(); res = tsc2000_read(TSC2000_REG_AUX1); return res; } - -s32 tsc2000_contact_temp (void) +s32 tsc2000_contact_temp(void) { long adc_pt1000, offset; long u_pt1000; long contact_temp; long temp1, temp2; - tsc2000_reg_init (); - tsc2000_set_range (3); + tsc2000_reg_init(); + tsc2000_set_range(3); /* * Because of sporadic "jumps" in the measured adc values every @@ -251,37 +272,37 @@ s32 tsc2000_contact_temp (void) * measurement, because it is very unlikely that a successive third * measurement goes also wrong. */ - temp1 = tsc2000_read_channel (14); - temp2 = tsc2000_read_channel (14); + temp1 = tsc2000_read_channel(14); + temp2 = tsc2000_read_channel(14); if (abs(temp2 - temp1) < MAX_DEVIATION) adc_pt1000 = temp2; else { - printf ("%s: read adc value (channel 14) exceeded max allowed " - "deviation: %d * 0.0276 °C\n", - __FUNCTION__, MAX_DEVIATION); - printf ("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n", - temp1, temp2); - adc_pt1000 = tsc2000_read_channel (14); - printf ("use (third read) adc value: adc_pt1000 = " - "%ld DIGITs\n", adc_pt1000); + printf("%s: read adc value (channel 14) exceeded max allowed " + "deviation: %d * 0.0276 degC\n", + __FUNCTION__, MAX_DEVIATION); + printf("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n", + temp1, temp2); + adc_pt1000 = tsc2000_read_channel(14); + printf("use (third read) adc value: adc_pt1000 = " + "%ld DIGITs\n", adc_pt1000); } - debug ("read channel 14 (pt1000 adc value): %ld\n", adc_pt1000); + debug("read channel 14 (pt1000 adc value): %ld\n", adc_pt1000); - temp1 = tsc2000_read_channel (15); - temp2 = tsc2000_read_channel (15); + temp1 = tsc2000_read_channel(15); + temp2 = tsc2000_read_channel(15); if (abs(temp2 - temp1) < MAX_DEVIATION) offset = temp2; else { - printf ("%s: read adc value (channel 15) exceeded max allowed " - "deviation: %d * 0.0276 °C\n", - __FUNCTION__, MAX_DEVIATION); - printf ("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n", - temp1, temp2); - offset = tsc2000_read_channel (15); - printf ("use (third read) adc value: offset = %ld DIGITs\n", - offset); + printf("%s: read adc value (channel 15) exceeded max allowed " + "deviation: %d * 0.0276 degC\n", + __FUNCTION__, MAX_DEVIATION); + printf("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n", + temp1, temp2); + offset = tsc2000_read_channel(15); + printf("use (third read) adc value: offset = %ld DIGITs\n", + offset); } - debug ("read channel 15 (offset): %ld\n", offset); + debug("read channel 15 (offset): %ld\n", offset); /* * Formula for calculating voltage drop on PT1000 resistor: u_pt1000 = @@ -291,21 +312,19 @@ s32 tsc2000_contact_temp (void) * u-boot, because this could cause only a very small error (< 1%). */ u_pt1000 = (101750 * (adc_pt1000 - offset)) / 10; - debug ("u_pt1000: %ld\n", u_pt1000); + debug("u_pt1000: %ld\n", u_pt1000); if (tsc2000_interpolate(u_pt1000, Pt1000_temp_table, &contact_temp) == -1) { - printf ("%s: error interpolating PT1000 vlaue\n", - __FUNCTION__); + printf("%s: error interpolating PT1000 vlaue\n", __FUNCTION__); return (-1000); } - debug ("contact_temp: %ld\n", contact_temp); + debug("contact_temp: %ld\n", contact_temp); return contact_temp; } - -void tsc2000_reg_init (void) +void tsc2000_reg_init(void) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); @@ -330,7 +349,6 @@ void tsc2000_reg_init (void) tsc2000_set_range(0); } - int tsc2000_interpolate(long value, long data[][2], long *result) { int i; @@ -348,17 +366,16 @@ int tsc2000_interpolate(long value, long data[][2], long *result) /* To prevent overflow we have to store the intermediate result in 'long long'. - */ + */ - val = ((unsigned long long)(data[i][1] - data[i-1][1]) - * (unsigned long long)(value - data[i-1][0])); - do_div(val, (data[i][0] - data[i-1][0])); - *result = data[i-1][1] + val; + val = ((unsigned long long)(data[i][1] - data[i - 1][1]) * + (unsigned long long)(value - data[i - 1][0])); + do_div(val, (data[i][0] - data[i - 1][0])); + *result = data[i - 1][1] + val; return 0; } - void adc_wait_conversion_done(void) { while (!(tsc2000_read(TSC2000_REG_ADC) & (1 << 14))); diff --git a/board/trab/tsc2000.h b/board/trab/tsc2000.h index 0b6253f..c7ec0bd 100644 --- a/board/trab/tsc2000.h +++ b/board/trab/tsc2000.h @@ -114,18 +114,17 @@ #define ERROR_BATTERY 220 /* must be adjusted, if R68 is changed on TRAB */ void tsc2000_write(unsigned short, unsigned short); -unsigned short tsc2000_read (unsigned short); -u16 tsc2000_read_channel (unsigned int); -void tsc2000_set_mux (unsigned int); -void tsc2000_set_range (unsigned int); -void tsc2000_reg_init (void); -s32 tsc2000_contact_temp (void); -void spi_wait_transmit_done (void); +unsigned short tsc2000_read(unsigned short); +u16 tsc2000_read_channel(unsigned int); +void tsc2000_set_mux(unsigned int); +void tsc2000_set_range(unsigned int); +void tsc2000_reg_init(void); +s32 tsc2000_contact_temp(void); +void spi_wait_transmit_done(void); void tsc2000_spi_init(void); int tsc2000_interpolate(long value, long data[][2], long *result); void adc_wait_conversion_done(void); - static inline void SET_CS_TOUCH(void) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); @@ -133,7 +132,6 @@ static inline void SET_CS_TOUCH(void) gpio->PDDAT &= 0x5FF; } - static inline void CLR_CS_TOUCH(void) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); diff --git a/board/trab/vfd.c b/board/trab/vfd.c index b7eb8cc..550d1e8 100644 --- a/board/trab/vfd.c +++ b/board/trab/vfd.c @@ -50,7 +50,7 @@ DECLARE_GLOBAL_DATA_PTR; /************************************************************************/ #ifndef PAGE_SIZE -#define PAGE_SIZE 4096 +#define PAGE_SIZE 4096 #endif #define ROT 0x09 @@ -58,8 +58,8 @@ DECLARE_GLOBAL_DATA_PTR; #define VIOLETT 0X0D /* MAGIC */ -#define FRAME_BUF_SIZE ((256*4*56)/8) -#define frame_buf_offs 4 +#define FRAME_BUF_SIZE ((256*4*56)/8) +#define frame_buf_offs 4 /* defines for starting Timer3 as CPLD-Clk */ #define START3 (1 << 16) @@ -72,8 +72,8 @@ DECLARE_GLOBAL_DATA_PTR; #define VFD_ENABLE (*(volatile uchar *)0x04038000=0x0001) /* Supported VFD Types */ -#define VFD_TYPE_T119C 1 /* Noritake T119C VFD */ -#define VFD_TYPE_MN11236 2 +#define VFD_TYPE_T119C 1 /* Noritake T119C VFD */ +#define VFD_TYPE_MN11236 2 /*#define NEW_CPLD_CLK*/ @@ -95,75 +95,87 @@ void init_grid_ctrl(void) /* * clear frame buffer (logical clear => set to "black") */ - memset ((void *)(gd->fb_base), 0, FRAME_BUF_SIZE); + memset((void *)(gd->fb_base), 0, FRAME_BUF_SIZE); switch (gd->vfd_type) { case VFD_TYPE_T119C: - for (display=0; display<4; display++) { - for(grid_cycle=0; grid_cycle<56; grid_cycle++) { - bit = grid_cycle * 256 * 4 + - (grid_cycle + 200) * 4 + - frame_buf_offs + display; - /* wrap arround if offset (see manual S3C2400) */ - if (bit>=FRAME_BUF_SIZE*8) - bit = bit - (FRAME_BUF_SIZE * 8); - adr = gd->fb_base + (bit/32) * 4 + (3 - (bit%32) / 8); - bit_nr = bit % 8; - bit_nr = (bit_nr > 3) ? bit_nr-4 : bit_nr+4; - temp=(*(volatile unsigned char*)(adr)); - temp |= (1<=FRAME_BUF_SIZE*8) - bit = bit-(FRAME_BUF_SIZE*8); - adr = gd->fb_base+(bit/32)*4+(3-(bit%32)/8); - bit_nr = bit%8; - bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4; - temp=(*(volatile unsigned char*)(adr)); - temp |= (1<= FRAME_BUF_SIZE * 8) + bit = bit - (FRAME_BUF_SIZE * 8); + adr = gd->fb_base + (bit / 32) * 4 + + (3 - (bit % 32) / 8); + bit_nr = bit % 8; + bit_nr = (bit_nr > 3) ? bit_nr - 4 : bit_nr + 4; + temp = (*(volatile unsigned char *)(adr)); + temp |= (1 << bit_nr); + (*(volatile unsigned char *)(adr)) = temp; + + if (grid_cycle < 55) + bit = grid_cycle * 256 * 4 + + (grid_cycle + 201) * 4 + + frame_buf_offs + display; + else + /* grid nr. 0 */ + bit = grid_cycle * 256 * 4 + 200 * 4 + + frame_buf_offs + display - 4; + /* wrap around if offset (see manual S3C2400) */ + if (bit >= FRAME_BUF_SIZE * 8) + bit = bit - (FRAME_BUF_SIZE * 8); + adr = + gd->fb_base + (bit / 32) * 4 + + (3 - (bit % 32) / 8); + bit_nr = bit % 8; + bit_nr = (bit_nr > 3) ? bit_nr - 4 : bit_nr + 4; + temp = (*(volatile unsigned char *)(adr)); + temp |= (1 << bit_nr); + (*(volatile unsigned char *)(adr)) = temp; + } } - } - break; + break; case VFD_TYPE_MN11236: - for (display=0; display<4; display++) { - for (grid_cycle=0; grid_cycle<38; grid_cycle++) { - bit = grid_cycle * 256 * 4 + - (253 - grid_cycle) * 4 + - frame_buf_offs + display; - /* wrap arround if offset (see manual S3C2400) */ - if (bit>=FRAME_BUF_SIZE*8) - bit = bit - (FRAME_BUF_SIZE * 8); - adr = gd->fb_base + (bit/32) * 4 + (3 - (bit%32) / 8); - bit_nr = bit % 8; - bit_nr = (bit_nr > 3) ? bit_nr-4 : bit_nr+4; - temp=(*(volatile unsigned char*)(adr)); - temp |= (1<=FRAME_BUF_SIZE*8) - bit = bit-(FRAME_BUF_SIZE*8); - adr = gd->fb_base+(bit/32)*4+(3-(bit%32)/8); - bit_nr = bit%8; - bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4; - temp=(*(volatile unsigned char*)(adr)); - temp |= (1<= FRAME_BUF_SIZE * 8) + bit = bit - (FRAME_BUF_SIZE * 8); + adr = gd->fb_base + (bit / 32) * 4 + + (3 - (bit % 32) / 8); + bit_nr = bit % 8; + bit_nr = (bit_nr > 3) ? bit_nr - 4 : bit_nr + 4; + temp = (*(volatile unsigned char *)(adr)); + temp |= (1 << bit_nr); + (*(volatile unsigned char *)(adr)) = temp; + + if (grid_cycle < 37) + bit = grid_cycle * 256 * 4 + + (252 - grid_cycle) * + 4 + frame_buf_offs + display; + + /* wrap around if offset (see manual S3C2400) */ + if (bit >= FRAME_BUF_SIZE * 8) + bit = bit - (FRAME_BUF_SIZE * 8); + adr = + gd->fb_base + (bit / 32) * 4 + + (3 - (bit % 32) / 8); + bit_nr = bit % 8; + bit_nr = (bit_nr > 3) ? bit_nr - 4 : bit_nr + 4; + temp = (*(volatile unsigned char *)(adr)); + temp |= (1 << bit_nr); + (*(volatile unsigned char *)(adr)) = temp; + } } - } - break; + break; default: - printf ("Warning: unknown display type\n"); - break; + printf("Warning: unknown display type\n"); + break; } } @@ -179,63 +191,91 @@ void create_vfd_table(void) switch (gd->vfd_type) { case VFD_TYPE_T119C: - for(y=0; y<=17; y++) { /* Line */ - for(x=0; x<=111; x++) { /* Column */ - for(display=0; display <=3; display++) { - - /* Display 0 blue pixels */ - vfd_table[x][y][0][display][0] = - (x==0) ? y*16+display - : (x%4)*4+y*16+((x-1)/2)*1024+display; - /* Display 0 red pixels */ - vfd_table[x][y][1][display][0] = - (x==0) ? y*16+512+display - : (x%4)*4+y*16+((x-1)/2)*1024+512+display; - } + for (y = 0; y <= 17; y++) { /* Line */ + for (x = 0; x <= 111; x++) { /* Column */ + for (display = 0; display <= 3; display++) { + /* Display 0 blue pixels */ + vfd_table[x][y][0][display][0] = + (x == 0) ? + y * 16 + display : + (x % 4) * 4 + y * 16 + + ((x - 1) / 2) * 1024 + display; + /* Display 0 red pixels */ + vfd_table[x][y][1][display][0] = + (x == 0) ? + y * 16 + 512 + display : + (x % 4) * 4 + y * 16 + + ((x - 1) / 2) * 1024 + 512 + + display; + } + } } - } - break; + break; case VFD_TYPE_MN11236: - for(y=0; y<=17; y++) { /* Line */ - for(x=0; x<=111; x++) { /* Column */ - for(display=0; display <=3; display++) { - - vfd_table[x][y][0][display][0]=0; - vfd_table[x][y][0][display][1]=0; - vfd_table[x][y][1][display][0]=0; - vfd_table[x][y][1][display][1]=0; - - switch (x%6) { - case 0: x_abcdef=0; break; /* a -> a */ - case 1: x_abcdef=2; break; /* b -> c */ - case 2: x_abcdef=4; break; /* c -> e */ - case 3: x_abcdef=5; break; /* d -> f */ - case 4: x_abcdef=3; break; /* e -> d */ - case 5: x_abcdef=1; break; /* f -> b */ - } - - /* blue pixels */ - vfd_table[x][y][0][display][0] = - (x>1) ? x_abcdef*4+((x-1)/3)*1024+y*48+display - : x_abcdef*4+ 0+y*48+display; - /* blue pixels */ - if (x>1 && (x-1)%3) - vfd_table[x][y][0][display][1] = x_abcdef*4+((x-1)/3+1)*1024+y*48+display; - - /* red pixels */ - vfd_table[x][y][1][display][0] = - (x>1) ? x_abcdef*4+24+((x-1)/3)*1024+y*48+display - : x_abcdef*4+24+ 0+y*48+display; - /* red pixels */ - if (x>1 && (x-1)%3) - vfd_table[x][y][1][display][1] = x_abcdef*4+24+((x-1)/3+1)*1024+y*48+display; - } + for (y = 0; y <= 17; y++) { /* Line */ + for (x = 0; x <= 111; x++) { /* Column */ + for (display = 0; display <= 3; display++) { + vfd_table[x][y][0][display][0] = 0; + vfd_table[x][y][0][display][1] = 0; + vfd_table[x][y][1][display][0] = 0; + vfd_table[x][y][1][display][1] = 0; + + switch (x % 6) { + case 0: + x_abcdef = 0; + break; /* a -> a */ + case 1: + x_abcdef = 2; + break; /* b -> c */ + case 2: + x_abcdef = 4; + break; /* c -> e */ + case 3: + x_abcdef = 5; + break; /* d -> f */ + case 4: + x_abcdef = 3; + break; /* e -> d */ + case 5: + x_abcdef = 1; + break; /* f -> b */ + } + + /* blue pixels */ + vfd_table[x][y][0][display][0] = + (x > 1) ? + x_abcdef * 4 + ((x - 1) / 3) * + 1024 + y * 48 + display : + x_abcdef * 4 + 0 + y * 48 + + display; + /* blue pixels */ + if (x > 1 && (x - 1) % 3) + vfd_table[x][y][0][display][1] = + x_abcdef * 4 + + ((x - 1) / 3 + 1) * 1024 + + y * 48 + display; + + /* red pixels */ + vfd_table[x][y][1][display][0] = + (x > 1) ? + x_abcdef * 4 + 24 + + ((x - 1) / 3) * 1024 + y * 48 + + display : + x_abcdef * 4 + 24 + 0 + y * + 48 + display; + /* red pixels */ + if (x > 1 && (x - 1) % 3) + vfd_table[x][y][1][display][1] = + x_abcdef * 4 + 24 + + ((x - 1) / 3 + 1) * 1024 + + y * 48 + display; + } + } } - } - break; + break; default: - /* do nothing */ - return; + /* do nothing */ + return; } /* @@ -243,31 +283,40 @@ void create_vfd_table(void) * bit-number within the byte * from table with bit-numbers within the total framebuffer */ - for(y=0;y<18;y++) { - for(x=0;x<112;x++) { - for(color=0;color<2;color++) { - for(display=0;display<4;display++) { - for(entry=0;entry<2;entry++) { - unsigned long adr = gd->fb_base; - unsigned int bit_nr = 0; - - pixel = vfd_table[x][y][color][display][entry] + frame_buf_offs; - /* - * wrap arround if offset - * (see manual S3C2400) - */ - if (pixel>=FRAME_BUF_SIZE*8) - pixel = pixel-(FRAME_BUF_SIZE*8); - adr = gd->fb_base+(pixel/32)*4+(3-(pixel%32)/8); - bit_nr = pixel%8; - bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4; - - adr_vfd_table[x][y][color][display][entry] = adr; - bit_vfd_table[x][y][color][display][entry] = bit_nr; + for (y = 0; y < 18; y++) { + for (x = 0; x < 112; x++) { + for (color = 0; color < 2; color++) { + for (display = 0; display < 4; display++) { + for (entry = 0; entry < 2; entry++) { + unsigned long adr = gd->fb_base; + unsigned int bit_nr = 0; + + pixel = vfd_table[x][y][color] + [display][entry] + + frame_buf_offs; + /* + * wrap arround if offset + * (see manual S3C2400) + */ + if (pixel >= FRAME_BUF_SIZE * 8) + pixel = pixel - + (FRAME_BUF_SIZE * 8); + adr = gd->fb_base + + (pixel / 32) * 4 + + (3 - (pixel % 32) / 8); + bit_nr = pixel % 8; + bit_nr = (bit_nr > 3) ? + bit_nr - 4 : + bit_nr + 4; + + adr_vfd_table[x][y][color] + [display][entry] = adr; + bit_vfd_table[x][y][color] + [display][entry] = bit_nr; + } + } } - } } - } } } @@ -281,7 +330,7 @@ void set_vfd_pixel(unsigned char x, unsigned char y, ulong adr; unsigned char bit_nr, temp; - if (! gd->vfd_type) { + if (!gd->vfd_type) { /* Unknown type. */ return; } @@ -290,14 +339,14 @@ void set_vfd_pixel(unsigned char x, unsigned char y, adr = adr_vfd_table[x][y][color][display][0]; /* Pixel-Eintrag Nr. 1 */ bit_nr = bit_vfd_table[x][y][color][display][0]; - temp=(*(volatile unsigned char*)(adr)); + temp = (*(volatile unsigned char *)(adr)); if (value) - temp |= (1< 0; height -= 18) - { + for (; height > 0; height -= 18) { if (height > 18) y = 18; else y = height; - for (; y > 0; y--) - { - for (x = 0; x < width; x += 2) - { + for (; y > 0; y--) { + for (x = 0; x < width; x += 2) { temp = *adr++; - set_vfd_pixel(x, y-1, 0, display, 0); - set_vfd_pixel(x, y-1, 1, display, 0); + set_vfd_pixel(x, y - 1, 0, display, 0); + set_vfd_pixel(x, y - 1, 1, display, 0); if ((temp >> 4) == BLAU) - set_vfd_pixel(x, y-1, 0, display, 1); + set_vfd_pixel(x, y - 1, 0, display, 1); else if ((temp >> 4) == ROT) - set_vfd_pixel(x, y-1, 1, display, 1); - else if ((temp >> 4) == VIOLETT) - { - set_vfd_pixel(x, y-1, 0, display, 1); - set_vfd_pixel(x, y-1, 1, display, 1); + set_vfd_pixel(x, y - 1, 1, display, 1); + else if ((temp >> 4) == VIOLETT) { + set_vfd_pixel(x, y - 1, 0, display, 1); + set_vfd_pixel(x, y - 1, 1, display, 1); } - set_vfd_pixel(x+1, y-1, 0, display, 0); - set_vfd_pixel(x+1, y-1, 1, display, 0); + set_vfd_pixel(x + 1, y - 1, 0, display, 0); + set_vfd_pixel(x + 1, y - 1, 1, display, 0); if ((temp & 0x0F) == BLAU) - set_vfd_pixel(x+1, y-1, 0, display, 1); + set_vfd_pixel(x + 1, y - 1, 0, + display, 1); else if ((temp & 0x0F) == ROT) - set_vfd_pixel(x+1, y-1, 1, display, 1); - else if ((temp & 0x0F) == VIOLETT) - { - set_vfd_pixel(x+1, y-1, 0, display, 1); - set_vfd_pixel(x+1, y-1, 1, display, 1); + set_vfd_pixel(x + 1, y - 1, 1, + display, 1); + else if ((temp & 0x0F) == VIOLETT) { + set_vfd_pixel(x + 1, y - 1, 0, + display, 1); + set_vfd_pixel(x + 1, y - 1, 1, + display, 1); } } } @@ -354,7 +402,7 @@ void transfer_pic(int display, unsigned char *adr, int height, int width) * This function initializes VFD clock that is needed for the CPLD that * manages the keyboard. */ -int vfd_init_clocks (void) +int vfd_init_clocks(void) { int i; @@ -365,21 +413,26 @@ int vfd_init_clocks (void) /* 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 */ + /* activate GPC0...GPC3 pullups */ + gpio->PCUP = (gpio->PCUP & 0xFFF0); + /* configure GPC0...GPC3 as inputs */ + gpio->PCCON = (gpio->PCCON & 0xFFFFFF00); /* allow signals to settle */ - for (i=0; i<10000; i++) /* udelay isn't working yet at this point! */ + /* udelay isn't working yet at this point! */ + for (i = 0; i < 10000; i++) __asm__("NOP"); - vfd_board_id = (~gpio->PCDAT) & 0x000F; /* read GPC0...GPC3 port pins */ + /* read GPC0...GPC3 port pins */ + vfd_board_id = (~gpio->PCDAT) & 0x000F; - VFD_DISABLE; /* activate blank for the vfd */ + VFD_DISABLE; /* activate blank for the vfd */ -#define NEW_CPLD_CLK +#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 */ + /* 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; @@ -443,8 +496,8 @@ int drv_vfd_init(void) debug("Detecting Revison of WA4-VFD: ID=0x%X\n", vfd_board_id); switch (vfd_board_id) { - case 0: /* board revision < Rev.200 */ - if ((tmp = getenv ("vfd_type")) == NULL) { + case 0: /* board revision < Rev.200 */ + if ((tmp = getenv("vfd_type")) == NULL) { break; } if (strcmp(tmp, "T119C") == 0) { @@ -460,22 +513,21 @@ int drv_vfd_init(void) default: /* default to MN11236, data inverted */ gd->vfd_type = VFD_TYPE_MN11236; vfd_inv_data = 1; - setenv ("vfd_type", "MN11236"); + setenv("vfd_type", "MN11236"); } - debug ("VFD type: %s%s\n", - (gd->vfd_type == VFD_TYPE_T119C) ? "T119C" : - (gd->vfd_type == VFD_TYPE_MN11236) ? "MN11236" : - "unknown", - vfd_inv_data ? ", inverted data" : ""); + debug("VFD type: %s%s\n", + (gd->vfd_type == VFD_TYPE_T119C) ? "T119C" : + (gd->vfd_type == VFD_TYPE_MN11236) ? "MN11236" : + "unknown", vfd_inv_data ? ", inverted data" : ""); gd->fb_base = gd->fb_base; create_vfd_table(); init_grid_ctrl(); - for (palette=0; palette < 16; palette++) - (*(volatile unsigned int*)(PALETTE+(palette*4)))=palette; - for (palette=16; palette < 256; palette++) - (*(volatile unsigned int*)(PALETTE+(palette*4)))=0x00; + for (palette = 0; palette < 16; palette++) + (*(volatile unsigned int *)(PALETTE + (palette * 4))) = palette; + for (palette = 16; palette < 256; palette++) + (*(volatile unsigned int *)(PALETTE + (palette * 4))) = 0x00; /* * Hinweis: Der Framebuffer ist um genau ein Nibble verschoben @@ -490,9 +542,9 @@ int drv_vfd_init(void) lcd->LCDSADDR1 = gd->fb_base >> 1; /* frame buffer endadr */ lcd->LCDSADDR2 = (gd->fb_base + FRAME_BUF_SIZE) >> 1; - lcd->LCDSADDR3 = ((256/4)); + lcd->LCDSADDR3 = ((256 / 4)); lcd->LCDCON2 = 0x000DC000; - if(gd->vfd_type == VFD_TYPE_MN11236) + if (gd->vfd_type == VFD_TYPE_MN11236) lcd->LCDCON2 = 37 << 14; /* MN11236: 38 lines */ else lcd->LCDCON2 = 55 << 14; /* T119C: 56 lines */ @@ -504,21 +556,24 @@ int drv_vfd_init(void) lcd->LCDCON5 = 0x00000440; /* Port pins as LCD output */ - gpio->PCCON = (gpio->PCCON & 0xFFFFFF00)| 0x000000AA; - gpio->PDCON = (gpio->PDCON & 0xFFFFFF03)| 0x000000A8; - - /* Synchronize VFD enable with LCD controller to avoid flicker */ - lcd->LCDCON1 = 0x00000B75; /* Start LCD-Controller */ - while((lcd->LCDCON5 & 0x180000)!=0x100000); /* Wait for end of VSYNC */ - while((lcd->LCDCON5 & 0x060000)!=0x040000); /* Wait for next HSYNC */ - while((lcd->LCDCON5 & 0x060000)==0x040000); - while((lcd->LCDCON5 & 0x060000)!=0x000000); - if(gd->vfd_type) + gpio->PCCON = (gpio->PCCON & 0xFFFFFF00) | 0x000000AA; + gpio->PDCON = (gpio->PDCON & 0xFFFFFF03) | 0x000000A8; + + /* Synchronize VFD enable with LCD controller to avoid flicker */ + /* Start LCD-Controller */ + lcd->LCDCON1 = 0x00000B75; + /* Wait for end of VSYNC */ + while ((lcd->LCDCON5 & 0x180000) != 0x100000); + /* Wait for next HSYNC */ + while ((lcd->LCDCON5 & 0x060000) != 0x040000); + while ((lcd->LCDCON5 & 0x060000) == 0x040000); + while ((lcd->LCDCON5 & 0x060000) != 0x000000); + if (gd->vfd_type) VFD_ENABLE; - debug ("LCDSADDR1: %lX\n", lcd->LCDSADDR1); - debug ("LCDSADDR2: %lX\n", lcd->LCDSADDR2); - debug ("LCDSADDR3: %lX\n", lcd->LCDSADDR3); + debug("LCDSADDR1: %lX\n", lcd->LCDSADDR1); + debug("LCDSADDR2: %lX\n", lcd->LCDSADDR2); + debug("LCDSADDR3: %lX\n", lcd->LCDSADDR3); return 0; } @@ -527,13 +582,13 @@ int drv_vfd_init(void) * Disable VFD: should be run before resetting the system: * disable VM, enable pull-up */ -void disable_vfd (void) +void disable_vfd(void) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); VFD_DISABLE; gpio->PDCON &= ~0xC; - gpio->PDUP &= ~0x2; + gpio->PDUP &= ~0x2; } /************************************************************************/ @@ -546,14 +601,15 @@ void disable_vfd (void) * * Note that this is running from ROM, so no write access to global data. */ -ulong vfd_setmem (ulong addr) +ulong vfd_setmem(ulong addr) { ulong size; /* Round up to nearest full page */ size = (FRAME_BUF_SIZE + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); - debug ("Reserving %ldk for VFD Framebuffer at: %08lx\n", size>>10, addr); + debug("Reserving %ldk for VFD Framebuffer at: %08lx\n", + size >> 10, addr); return (size); } @@ -562,7 +618,7 @@ ulong vfd_setmem (ulong addr) * Calculate fb size for VIDEOLFB_ATAG. Size returned contains fb, * descriptors and palette areas. */ -ulong calc_fbsize (void) +ulong calc_fbsize(void) { return FRAME_BUF_SIZE; }