int main(int argc, char *argv[])
{
    if(argc == 1)
    {
        // interactive mode
        while(1)
        {
            printf("CMU 1394 Digitial Camera Driver: Automatic Driver Installer - Interactive Menu\n");
            printf("  i - Install the driver for all compatible devices\n");
            printf("  u - Delete all device instances presently using the CMU driver\n");
            printf("  T - enable test mode\n");
            printf("  t - disable test mode\n");
            printf("  q - quit\n\nEnter your selection: ");
            char cc = _getch();
            printf("\n\n");
            switch(cc)
            {
                case 'i': installCMUDriver(); break;
                case 'u': uninstallCMUDriver(); break;
				case 'T': setTestMode(true); break;
				case 't': setTestMode(false); break;
                case 'q': printf("Exiting...\n"); return 0;
                default: printf("Unrecognized Command '%c'\n",cc); break;
            }
            printf("\n\n");
        }
    }
    else if(argc == 2)
    {
        if(!strncmp(argv[1],"/i",3))
        {
            return installCMUDriver();
        }
        else if(!strncmp(argv[1],"/u",3))
        {
            return uninstallCMUDriver();
        }
        else if(!strncmp(argv[1],"/teston",8))
        {
            return setTestMode(true);
        }
        else if(!strncmp(argv[1],"/testoff",9))
        {
            return setTestMode(false);
        }
        else
        {
            printf("Unrecognized Argument: '%s'\n",argv[1]);
            // fall through to common print and bail...
        }
    }
    else
    {
        printf("Too Many Arguments: %d",argc);
       // fall through to common print and bail...
    }

    printUsage();
    return -1;
}
EtherPort::EtherPort( PortInit_t *portInit ) :
	CommonPort( portInit )
{
	automotive_profile = portInit->automotive_profile;
	linkUp = portInit->linkUp;
	setTestMode( portInit->testMode );

	pdelay_sequence_id = 0;

	pdelay_started = false;
	pdelay_halted = false;
	sync_rate_interval_timer_started = false;

	duplicate_resp_counter = 0;
	last_invalid_seqid = 0;

	initialLogPdelayReqInterval = portInit->initialLogPdelayReqInterval;
	operLogPdelayReqInterval = portInit->operLogPdelayReqInterval;
	operLogSyncInterval = portInit->operLogSyncInterval;

	if (automotive_profile) {
		setAsCapable( true );

		if (getInitSyncInterval() == LOG2_INTERVAL_INVALID)
			setInitSyncInterval( -5 );     // 31.25 ms
		if (initialLogPdelayReqInterval == LOG2_INTERVAL_INVALID)
			initialLogPdelayReqInterval = 0;  // 1 second
		if (operLogPdelayReqInterval == LOG2_INTERVAL_INVALID)
			operLogPdelayReqInterval = 0;      // 1 second
		if (operLogSyncInterval == LOG2_INTERVAL_INVALID)
			operLogSyncInterval = 0;           // 1 second
	}
	else {
		setAsCapable( false );

		if ( getInitSyncInterval() == LOG2_INTERVAL_INVALID )
			setInitSyncInterval( -3 );       // 125 ms
		if (initialLogPdelayReqInterval == LOG2_INTERVAL_INVALID)
			initialLogPdelayReqInterval = 0;   // 1 second
		if (operLogPdelayReqInterval == LOG2_INTERVAL_INVALID)
			operLogPdelayReqInterval = 0;      // 1 second
		if (operLogSyncInterval == LOG2_INTERVAL_INVALID)
			operLogSyncInterval = 0;           // 1 second
	}

	/*TODO: Add intervals below to a config interface*/
	log_min_mean_pdelay_req_interval = initialLogPdelayReqInterval;

	last_sync = NULL;
	last_pdelay_req = NULL;
	last_pdelay_resp = NULL;
	last_pdelay_resp_fwup = NULL;

	setPdelayCount(0);
	setSyncCount(0);

	if (automotive_profile) {
		if (isGM) {
			avbSyncState = 1;
		}
		else {
			avbSyncState = 2;
		}
		if (getTestMode())
		{
			linkUpCount = 1;  // TODO : really should check the current linkup status http://stackoverflow.com/questions/15723061/how-to-check-if-interface-is-up
			linkDownCount = 0;
		}
		setStationState(STATION_STATE_RESERVED);
	}
}
Example #3
0
void NewAutoPilot::enableTestMode(bool enable)
{
	setTestMode(DRIVEMODE_IDLE);
	testMode = enable;
	if(!testMode) wheels->Stop();
}