Exemple #1
0
//--------------------------------------------------------------------------
// Module:
//  BurninSerialPortTest
//
///   This function is used to transmit data via the RS232 port. It assumes
///   that a loop-back to the receive pin of the RS232 is connected. The test
///   will fail if no data is received "ERR_NO_SERIAL_CHAR_RX" or if the byte
///   transmitted <> byte received "ERR_INVALID_SERIAL_CHAR".  The variable
///   uart_counter is incremented after every successful test so that different
///   values are transmitted and received through the RS232 port.
///
//--------------------------------------------------------------------------
static void BurninSerialPortTest (void)
{
    UINT_16 rxChar = (UINT_16)EOF;	/* Needs to be UINT_16 instead of a CHAR to avoid
									   a problem when 0xff is transmitted and EOF(-1)
									   is returned */

    BOOLEAN character_received;

    static UINT_8 txChar = 255;

    Timer *tm;

    /* Transmit uart_counter value to RS-232 port*/
    while (!SC_PutChar ((CHAR)txChar));

    /* Wait for character for no more than 1 second */
    character_received = FALSE;
    tm = TM_Allocate (0, NULL);
    while (TM_GetExpiredTime (tm) < 1000)
    {
        rxChar = SC_GetChar();
        /* EOF is returned if there is no character in the serial receive
           buffer */
        if (rxChar != (UINT_16)EOF)
        {
            character_received = TRUE;
            break;
        }
    }
    TM_Free (tm);

    /* Verify; set burnin_error_code if TX <> RX or timeout */
    if ((character_received == TRUE) && ((UINT_8)rxChar != txChar))
    {
        burnin_error_code = ERR_INVALID_SERIAL_CHAR;
    }
    else if (character_received == FALSE)
    {
        burnin_error_code = ERR_NO_SERIAL_CHAR_RX;
    }
    /* Update the transmit character for the next go of this test */
    txChar++;
}
Exemple #2
0
static int SC_Find(dboolean forceupper)
{
    char c = 0;
    int i = 0;
    dboolean comment = false;
    dboolean havetoken = false;
    dboolean string = false;

    memset(sc_parser.token, 0, 256);

    while(SC_ReadTokens())
    {
        c = SC_GetChar();

        if(c == '/')
            comment = true;

        if(comment == false)
        {
            if(c == '"')
            {
                if(!string)
                {
                    string = true;
                    continue;
                }
                else if(havetoken)
                    return true;
            }

            if(!string)
            {
                if(c > ' ')
                {
                    havetoken = true;
                    sc_parser.token[i++] =
                        forceupper ? toupper(c) : c;
                }
                else if(havetoken)
                    return true;
            }
            else
            {
                if(c >= ' ')
                {
                    havetoken = true;
                    sc_parser.token[i++] =
                        forceupper ? toupper(c) : c;
                }
            }
        }

        if(c == '\n')
        {
            sc_parser.linepos++;
            sc_parser.rowpos = 1;
            comment = false;
            if(string)
                sc_parser.token[i++] = c;
        }
    }

    return false;
}
Exemple #3
0
//--------------------------------------------------------------------------
// Module:
//  BurninAnalogTests
//
///   This function tests all of the analog inputs by setting the analog 
///   output voltages, which are wrapped back into the analog inputs, to
///   known values and then verifying the analog input ADC readings.
///
//--------------------------------------------------------------------------
static void BurninAnalogTests (void)
{
	//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	// For some reason, the analog tests fail at high temperature (above 60 C)
	// when the static keyword is removed. The static keyword ensures that the 
	// structure gets copied to RAM at startup, but w/o it, the structure is 
	// maintained in FLASH... yet another HiDAC mystery!!!!
	//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    static const BurninAlog_t alogBurnTest[] =
    {
		// Tolerance is +/- 5% (51 quanta from 10 bit ADC (0 - 1023 quanta)
        {
            &burninDAC[0], 2400, &burninDAC[1], 1000,
            632 - 51, 632 + 51, ANALOGIN_04, 0xC0
        },
        {
            &burninDAC[0], 1000, &burninDAC[1], 2400,
            381 - 51, 381 + 51, ANALOGIN_04, 0xC1
        },
        {
            &burninDAC[0], 2400, &burninDAC[1], 1000,
            632 - 51, 632 + 51, ANALOGIN_05, 0xC2
        },
        {
            &burninDAC[0], 1000, &burninDAC[1], 2400,
            381 - 51, 381 + 51, ANALOGIN_05, 0xC3
        },
        {
            &burninDAC[0], 2400, &burninDAC[1], 1000,
            531 - 51, 531 + 51, ANALOGIN_06, 0xC4
        },
        {
            &burninDAC[0], 1000, &burninDAC[1], 2400,
            121 - 51, 121 + 51, ANALOGIN_06, 0xC5
        },
        {
            &burninDAC[2], 2400, &burninDAC[3], 1000,
            531 - 51, 531 + 51, ANALOGIN_07, 0xC6
        },
        {
            &burninDAC[2], 1000, &burninDAC[3], 2400,
            121 - 51, 121 + 51, ANALOGIN_07, 0xC7
        },
        {
            &burninDAC[2], 1000, &burninDAC[3], 2400,
            491 - 51, 491 + 51, ANALOGIN_08, 0xC8
        },
        {
            &burninDAC[2], 2400, &burninDAC[3], 1000,
            729 - 51, 729 + 51, ANALOGIN_08, 0xC9
        },
        {
            &burninDAC[2], 1000, &burninDAC[3], 2400,
            491 - 51, 491 + 51, ANALOGIN_09, 0xCA
        },
        {
            &burninDAC[2], 2400, &burninDAC[3], 1000,
            729 - 51, 729 + 51, ANALOGIN_09, 0xCB
        },
        {
            &burninDAC[4], 5000, &burninDAC[5], 1000,
            795 - 51, 795 + 51, ANALOGIN_11, 0xCC
        },
        {
            &burninDAC[4], 1000, &burninDAC[5], 5000,
            108 - 51, 108 + 51, ANALOGIN_11, 0xCD
        },
        {
            &burninDAC[4], 5000, &burninDAC[5], 1000,
            795 - 51, 795 + 51, ANALOGIN_12, 0xCE
        },
        {
            &burninDAC[4], 1000, &burninDAC[5], 5000,
            108 - 51, 108 + 51, ANALOGIN_12, 0xCF
        },
        {
            &burninDAC[4], 5000, &burninDAC[5], 1000,
            795 - 51, 795 + 51, ANALOGIN_13, 0xD0
        },
        {
            &burninDAC[4], 1000, &burninDAC[5], 5000,
            108 - 51, 108 + 51, ANALOGIN_13, 0xD1
        },
        {
            &burninDAC[6], 2400, &burninDAC[7], 1000,
            632 - 51, 632 + 51, ANALOGIN_00, 0xD2
        },
        {
            &burninDAC[6], 1000, &burninDAC[7], 2400,
            381 - 51, 381 + 51, ANALOGIN_00, 0xD3
        },
        {
            &burninDAC[6], 2400, &burninDAC[7], 1000,
            632 - 51, 632 + 51, ANALOGIN_01, 0xD4
        },
        {
            &burninDAC[6], 1000, &burninDAC[7], 2400,
            381 - 51, 381 + 51, ANALOGIN_01, 0xD5
        },
        {
            &burninDAC[6], 2400, &burninDAC[7], 1000,
            632 - 51, 632 + 51, ANALOGIN_02, 0xD6
        },
        {
            &burninDAC[6], 1000, &burninDAC[7], 2400,
            381 - 51, 381 + 51, ANALOGIN_02, 0xD7
        },
        {
            &burninDAC[6], 2400, &burninDAC[7], 1000,
            632 - 51, 632 + 51, ANALOGIN_03, 0xD8
        },
        {
            &burninDAC[6], 1000, &burninDAC[7], 2400,
            381 - 51, 381 + 51, ANALOGIN_03, 0xD9
        },
    };

    INT_32 analog_value;
    UINT_16 index = 0;
    const BurninAlog_t *ptr;


    while (index < sizeof (alogBurnTest) / sizeof (BurninAlog_t))
    {

        CHAR str[50];
		UINT_16 max, min;
		INT_16 dacP, dacN;

        ptr = &alogBurnTest[index];

		dacP = ptr->pValue;
		dacN = ptr->nValue;

        * (ptr->pAddr) = dacP;
        * (ptr->nAddr) = dacN;

		max = ptr->validHi;
		min = ptr->validLo;

        GiveSettleTime();

        analog_value = AI_GetDataValueADC (ptr->a2dId);

        sprintf (str, "AlogTest %u", index);
		strcat(failureStr, str);
        SC_PutsAlways (str);
        sprintf (str, " inVal =  %u -- ", analog_value);
		strcat(failureStr, str);
		SC_PutsAlways (str);
        sprintf (str, "[Min,Max] = [%u , %u] -- ", min,max);
        strcat(failureStr, str);
		SC_PutsAlways (str);
		sprintf (str, "DAC = [%d , %d] \n\r", dacP,dacN);
		strcat(failureStr, str);
        SC_PutsAlways (str);

        if (analog_value < min || analog_value > max)
        {
            burnin_error_code = ptr->errCode;
			consecutiveFailureCount++;
			SC_PutsAlways ("********Above Analog Test Failed*********\n\r");
#ifdef HALT_TEST
			SC_PutsAlways ("Hit any key to continue\n\r");
			SC_FlushStream(RX_STREAM);
			while (SC_GetChar() == EOF)
			{}
#endif
#ifndef CONTINUOUS
			return;
#endif
        }

        index++;
    }

	ZeroAnalogOutputs();

    /*****************************/
    /* Check +/- 15 volt supplies and the VDRIVE */
    if (Get15VoltBad() & PLUS_15_BAD_MASK)
    {
        burnin_error_code = PS_PLUS_15_ERR;
		consecutiveFailureCount++;
        return;
    }

    if (Get15VoltBad() & MINUS_15_BAD_MASK)
    {
        burnin_error_code = PS_MINUS_15_ERR;
		consecutiveFailureCount++;
		return;
    }

	// Check VDrive status
    if (!(DI_GetCurrent(DIGIN_BANK0) & 0x0001))
    {
        burnin_error_code = VDRIVE_PLUS_15_ERR;
		consecutiveFailureCount++;
        return;
    }
    /*****************************/


    /*****************************/
    /* Make sure Battery voltage is between 34 & 38 volts
       Since the B+ range at the A/D input +/-50 volts
       The desired quantized values can be calculated as follows

        Q = ((Volts - (-50)) / (50 - -50)) * 1024

    	So, for 34 volts, the A/D quanta is 860
            for 38 volts, the A/D quanta is 901

        */

    analog_value = AI_GetDataValueADC (BATTERY_VOLTAGE);
    if ((analog_value < 860) || (analog_value > 917))
    {
        burnin_error_code = BATTERY_VOLTAGE_ERR;
		consecutiveFailureCount++;
        return;
    }

}