diff options
| author | Wolfgang Denk <wd@denx.de> | 2008-05-20 16:00:29 +0200 | 
|---|---|---|
| committer | Wolfgang Denk <wd@denx.de> | 2008-05-21 00:14:08 +0200 | 
| commit | 53677ef18e25c97ac613349087c5cb33ae5a2741 (patch) | |
| tree | f947d34d6efaee2401ea0e4c6104ef2f6a0f7ad0 /board/gen860t/beeper.c | |
| parent | 727f63334676e760877d43bfb8f0e9331ac8b101 (diff) | |
| download | olio-uboot-2014.01-53677ef18e25c97ac613349087c5cb33ae5a2741.tar.xz olio-uboot-2014.01-53677ef18e25c97ac613349087c5cb33ae5a2741.zip | |
Big white-space cleanup.
This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).
Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'board/gen860t/beeper.c')
| -rw-r--r-- | board/gen860t/beeper.c | 104 | 
1 files changed, 45 insertions, 59 deletions
| diff --git a/board/gen860t/beeper.c b/board/gen860t/beeper.c index 46fe66ba6..b4c2c8988 100644 --- a/board/gen860t/beeper.c +++ b/board/gen860t/beeper.c @@ -34,7 +34,6 @@   * drives the amplifier input.   */ -  /*   * Initialize beeper-related hardware. Initialize timer 1 for use with   * the beeper. Use 66 Mhz internal clock with prescale of 33 to get @@ -42,66 +41,59 @@   * FIXME: we should really compute the prescale based on the reported   * core clock frequency.   */ -void -init_beeper(void) +void init_beeper (void)  { -    volatile immap_t *immap  = (immap_t *)CFG_IMMR; +	volatile immap_t *immap = (immap_t *) CFG_IMMR;  	immap->im_cpmtimer.cpmt_tgcr &= ~TGCR_RST1 | TGCR_STP1;  	immap->im_cpmtimer.cpmt_tmr1 = ((33 << TMR_PS_SHIFT) & TMR_PS_MSK) -								 | TMR_OM | TMR_FRR | TMR_ICLK_IN_GEN; +		| TMR_OM | TMR_FRR | TMR_ICLK_IN_GEN;  	immap->im_cpmtimer.cpmt_tcn1 = 0;  	immap->im_cpmtimer.cpmt_ter1 = 0xffff;  	immap->im_cpmtimer.cpmt_tgcr |= TGCR_RST1;  } -  /*   * Set beeper frequency.  Max allowed frequency is 2.5 KHz.  This limit   * is mostly arbitrary, but the beeper isn't really much good beyond this   * frequency.   */ -void -set_beeper_frequency(uint frequency) +void set_beeper_frequency (uint frequency)  {  #define FREQ_LIMIT	2500 -    volatile immap_t *immap  = (immap_t *)CFG_IMMR; +	volatile immap_t *immap = (immap_t *) CFG_IMMR;  	/*  	 * Compute timer ticks given desired frequency.  The timer is set up  	 * to count 0.5 uS per tick and it takes two ticks per cycle (Hz).  	 */ -	if (frequency > FREQ_LIMIT) frequency = FREQ_LIMIT; -	frequency = 1000000/frequency; -	immap->im_cpmtimer.cpmt_trr1 = (ushort)frequency; +	if (frequency > FREQ_LIMIT) +		frequency = FREQ_LIMIT; +	frequency = 1000000 / frequency; +	immap->im_cpmtimer.cpmt_trr1 = (ushort) frequency;  } -  /*   * Turn the beeper on   */ -void -beeper_on(void) +void beeper_on (void)  { -    volatile immap_t *immap  = (immap_t *)CFG_IMMR; +	volatile immap_t *immap = (immap_t *) CFG_IMMR;  	immap->im_cpmtimer.cpmt_tgcr &= ~TGCR_STP1;  } -  /*   * Turn the beeper off   */ -void -beeper_off(void) +void beeper_off (void)  { -    volatile immap_t *immap  = (immap_t *)CFG_IMMR; +	volatile immap_t *immap = (immap_t *) CFG_IMMR;  	immap->im_cpmtimer.cpmt_tgcr |= TGCR_STP1;  } -  /*   * Increase or decrease the beeper volume.  Volume can be set   * from off to full in 64 steps.  To increase volume, the output @@ -110,75 +102,71 @@ beeper_off(void)   * change pin mode to tristate) then output a high to go back to   * tristate.   */ -void -set_beeper_volume(int steps) +void set_beeper_volume (int steps)  { -    volatile immap_t *immap  = (immap_t *)CFG_IMMR; +	volatile immap_t *immap = (immap_t *) CFG_IMMR;  	int i;  	if (steps >= 0) {  		for (i = 0; i < (steps >= 64 ? 64 : steps); i++) {  			immap->im_cpm.cp_pbodr &= ~(0x80000000 >> 19); -			udelay(1); +			udelay (1);  			immap->im_cpm.cp_pbodr |= (0x80000000 >> 19); -			udelay(1); +			udelay (1);  		} -	} -	else { +	} else {  		for (i = 0; i > (steps <= -64 ? -64 : steps); i--) {  			immap->im_cpm.cp_pbdat &= ~(0x80000000 >> 19); -			udelay(1); +			udelay (1);  			immap->im_cpm.cp_pbdat |= (0x80000000 >> 19); -			udelay(1); +			udelay (1);  		}  	}  } -  /*   * Check the environment to see if the beeper needs beeping.   * Controlled by a sequence of the form:   * freq/delta volume/on time/off time;... where: - * freq 		= frequency in Hz (0 - 2500) + * freq			= frequency in Hz (0 - 2500)   * delta volume = volume steps up or down (-64 <= vol <= 64)   * on time		= time in mS   * off time		= time in mS   *   * Return 1 on success, 0 on failure   */ -int -do_beeper(char *sequence) +int do_beeper (char *sequence)  {  #define DELIMITER	';' -int args[4]; -int i; -int val; -char *p = sequence; -char *tp; +	int args[4]; +	int i; +	int val; +	char *p = sequence; +	char *tp;  	/*  	 * Parse the control sequence.  This is a really simple parser  	 * without any real error checking.  You can probably blow it  	 * up really easily.  	 */ -	if (*p == '\0' || !isdigit(*p)) { -		printf("%s:%d: null or invalid string (%s)\n", -				__FILE__, __LINE__, p); +	if (*p == '\0' || !isdigit (*p)) { +		printf ("%s:%d: null or invalid string (%s)\n", +			__FILE__, __LINE__, p);  		return 0;  	}  	i = 0;  	while (*p != '\0') {  		while (*p != DELIMITER) { -			if (i > 3) i = 0; -			val = (int) simple_strtol(p, &tp, 0); +			if (i > 3) +				i = 0; +			val = (int) simple_strtol (p, &tp, 0);  			if (tp == p) { -				printf("%s:%d: no digits or bad format\n", -								__FILE__,__LINE__); +				printf ("%s:%d: no digits or bad format\n", +					__FILE__, __LINE__);  				return 0; -			} -			else { +			} else {  				args[i] = val;  			} @@ -195,19 +183,17 @@ char *tp;  		 */  #if 0  		for (i = 0; i < 4; i++) { -			printf("%s:%d:arg %d = %d\n", __FILE__, __LINE__, i, args[i]); +			printf ("%s:%d:arg %d = %d\n", __FILE__, __LINE__, i, +				args[i]);  		} -		printf("\n"); +		printf ("\n");  #endif - -		set_beeper_frequency(args[0]); -		set_beeper_volume(args[1]); -		beeper_on(); -		udelay(1000 * args[2]); -		beeper_off(); -		udelay(1000 * args[3]); +		set_beeper_frequency (args[0]); +		set_beeper_volume (args[1]); +		beeper_on (); +		udelay (1000 * args[2]); +		beeper_off (); +		udelay (1000 * args[3]);  	}  	return 1;  } - -/* vim: set ts=4 sw=4 tw=78: */ |