int main( void ) { avr_init(); pulse_init(); puts( "$Id: tach.c,v 2.0 2002/09/22 02:10:18 tramm Exp $" ); putnl(); while( 1 ) { puthex( high_bits ); puthex( time() ); putc( ':' ); puthexs( pulse_0 ); putc( ' ' ); puthexs( pulse_1 ); putnl(); pulse_1 = pulse_0 = 0; msleep( 8192 ); } return 0; }
/**************************************************************************** * nand_bch_ecc_flip_bit - Routine to flip an errored bit * * PURPOSE: * This is a helper routine that flips the bit (0 -> 1 or 1 -> 0) of the * errored bit specified * * PARAMETERS: * datap - Container that holds the 512 byte data * errorLocation - Location of the bit that needs to be flipped * * RETURNS: * None ****************************************************************************/ static void nand_bcm_umi_bch_ecc_flip_bit(uint8_t *datap, int errorLocation) { int locWithinAByte = (errorLocation & REG_UMI_BCH_ERR_LOC_BYTE) >> 0; int locWithinAWord = (errorLocation & REG_UMI_BCH_ERR_LOC_WORD) >> 3; int locWithinAPage = (errorLocation & REG_UMI_BCH_ERR_LOC_PAGE) >> 5; uint8_t errorByte = 0; uint8_t byteMask = 1 << locWithinAByte; /* BCH uses big endian, need to change the location * bits to little endian */ locWithinAWord = 3 - locWithinAWord; errorByte = datap[locWithinAPage * sizeof(uint32_t) + locWithinAWord]; #ifdef BOOT0_BUILD puthexs("\nECC Correct Offset: ", locWithinAPage * sizeof(uint32_t) + locWithinAWord); puthexs(" errorByte:", errorByte); puthex8(" Bit: ", locWithinAByte); #endif if (errorByte & byteMask) { /* bit needs to be cleared */ errorByte &= ~byteMask; } else { /* bit needs to be set */ errorByte |= byteMask; } /* write back the value with the fixed bit */ datap[locWithinAPage * sizeof(uint32_t) + locWithinAWord] = errorByte; }
int main( void ) { int cycle_count = 0; uint8_t servo_pos = 0; avr_init(); adc_init( 0x70 ); puts( "$Id: sweep.c,v 2.0 2002/09/22 02:10:18 tramm Exp $" ); putnl(); while( 1 ) { accel_task( adc_task ); if( ++cycle_count % 32 ) continue; puthex( high_bits ); puthex( time() ); putc( ':' ); puts( " Ax=" ); puthex( a_x ); puts( " Ay=" ); puthex( a_y ); puts( " pos=" ); puthexs( servo_pos ); servo_set( 0, servo_pos ); servo_set( 1, servo_pos ); servo_set( 2, servo_pos ); servo_set( 3, servo_pos ); servo_set( 4, servo_pos ); servo_set( 5, servo_pos ); servo_set( 6, servo_pos ); servo_set( 7, servo_pos ); servo_pos += 8; putnl(); } return 0; }