示例#1
0
Static line_type doCommand(Char *line_)
{
  line_type Result;
  Char line[256];
  Char command[256];
  command_type last_command;
  boolean starts_with_note;
  Char STR1[256], STR3[256];

  strcpy(line, line_);
  if (line[0] == comment && !isAssertion(line))
    return comment_line;
  starts_with_note = maybeMusicLine(line);
  GetNextWord(command, line, blank_, colon_);
  sprintf(STR1, "%c", colon_);
  if (endsWith(command, STR1)) {
    last_command = findCommand(command);
    Result = command_line;
    if (last_command == enable)
      doEnable(line, true);
    else if (last_command == disable)
      doEnable(line, false);
    else if (last_command == range)
      orig_range_line = line_no;
    if (last_command != none) {
      if (mustAppend(last_command) && redefined[(long)last_command])
	sprintf(cline[(long)last_command] + strlen(cline[(long)last_command]),
		"\n%s", line);
      else {
	strcpy(cline[(long)last_command], line);
	if (warn_redefine && redefined[(long)last_command]) {
	  sprintf(STR3, "You have redefined preamble command %s", command);
	  warning(STR3, print);
	}
      }
      if (last_command == start)
	strcpy(start_line, line);
      redefined[(long)last_command] = true;
      return Result;
    }
    Result = colon_line;
    sprintf(STR3, "%s%c %s", command, colon_, line);
    addStyle(STR3);
    orig_style_line[known_styles-1] = line_no;
    return Result;
  } else if (starts_with_note)
    return plain_line;
  else
    return unknown;
  return Result;
}
示例#2
0
void doAdmin(int sock, ControlStruct *p)
{
   char *cp, *cp1, tmpBuf[20];
   int x;

   if (dbg) syslog(LOG_DEBUG, "doAdmin():Enter |%s|", p->buf);
   if (p->passwdMode != 0) 
   {
      doPrivilege(p, "", sock);
   }
   else
   {
      for (cp = p->buf; *cp != '\0' && isspace(*cp); cp++);
      memset(tmpBuf, '\0', sizeof(tmpBuf));
      for (x = 0, cp1 = tmpBuf; *cp != '\0' && !isspace(*cp) && (unsigned)x < sizeof(tmpBuf); x++)
      {
         *(cp1++) = tolower(*cp++);
         *cp1 = '\0';
      }
      if (dbg) syslog(LOG_DEBUG, "doAdmin():Command = |%s|", tmpBuf);
      for (; *cp != '\0' && isspace(*cp); cp++);

      if (dbg) syslog(LOG_DEBUG, "doAdmin():Remainder Command = |%s|", cp);

      if (strcmp(tmpBuf, "enable") == 0)
         doEnable(p, cp);

      else if (strcmp(tmpBuf, "disable") == 0)
         doDisable(p, cp);

      else if (strcmp(tmpBuf, "disconnect") == 0)
         doDisconnect(p, cp);

//      else if (strcmp(tmpBuf, "privilege") == 0)
//         doPrivilege(p, cp, sock);

      else if (strcmp(tmpBuf, "set") == 0)
         doSet(p, cp);

      else if (strcmp(tmpBuf, "help") == 0)
         doHelp(p, cp);

      else if (strcmp(tmpBuf, "show") == 0)
         doShow(p, cp);

      else if (strcmp(tmpBuf, "verbose") == 0)
         p->verbose = (p->verbose == 0) ? 1 : 0;

      else 
      {
         if (p->verbose)
            fputs("Error, Command Not recognized\n", p->fp);
         else
            fputs("904:Command Not recognized\n", p->fp);
      }
   }
   fflush(p->fp);
}
void InspectorProfilerAgent::restore()
{
    if (m_state->getBoolean(ProfilerAgentState::profilerEnabled))
        doEnable();
    resetFrontendProfiles();
    if (long interval = m_state->getLong(ProfilerAgentState::samplingInterval, 0))
        ScriptProfiler::setSamplingInterval(interval);
    if (m_state->getBoolean(ProfilerAgentState::userInitiatedProfiling))
        start();
}
示例#4
0
void GCHD::configureHDMI()
{
	mailWrite( 0x33, VC{0x94, 0x41, 0x37} );
	mailWrite( 0x33, VC{0x94, 0x4a, 0xaf} );
	mailWrite( 0x33, VC{0x94, 0x4b, 0xaf} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb0
	mailWrite( 0x4e, VC{0x00, 0xcc} );
	readDevice0x9DCD(0x94); //EXPECTED 0xb2
	mailWrite( 0x4e, VC{0xab, 0x4c} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb2
	mailWrite( 0x4e, VC{0x00, 0xce} );
	mailWrite( 0x4e, VC{0x1b, 0x33} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb0
	mailWrite( 0x4e, VC{0x00, 0xcc} );
	readDevice0x9DCD(0x88); //EXPECTED 0xb0
	mailWrite( 0x4e, VC{0xb7, 0xce} );
	mailWrite( 0x4e, VC{0xb8, 0xdc} );
	mailWrite( 0x4e, VC{0xb8, 0xcc} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb2
	mailWrite( 0x4e, VC{0x00, 0xce} );
	mailWrite( 0x4e, VC{0x07, 0x38} );
	mailWrite( 0x4e, VC{0x07, 0xc8} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb0
	mailWrite( 0x4e, VC{0x00, 0xcc} );
	mailWrite( 0x4e, VC{0x51, 0x45} );
	readDevice0x9DCD(0x88); //EXPECTED 0xb0
	mailWrite( 0x4e, VC{0xb7, 0xcc} );

	//Do nothing enable. No idea what it really checks
	doEnable( 0x0000, 0x0000); //state 031e->031e, enable 000a->000a
	readDevice0x9DCD(0x3f); //EXPECTED 0xb2
	mailWrite( 0x4e, VC{0x00, 0xce} );
	readDevice0x9DCD(0x3e); //EXPECTED 0xd3
	mailWrite( 0x4e, VC{0x01, 0xad} );
	readDevice0x9DCD(0x3b); //EXPECTED 0xb3
	mailWrite( 0x4e, VC{0x04, 0xcd} );
	mailWrite( 0x4e, VC{0x06, 0xc4} );
	readDevice0x9DCD(0x36); //EXPECTED 0xba
	mailWrite( 0x4e, VC{0x09, 0xe4} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb0
	mailWrite( 0x4e, VC{0x00, 0xcc} );
	readDevice0x9DCD(0x6b); //EXPECTED 0x82
	mailWrite( 0x4e, VC{0x54, 0xec} );
	readDevice0x9DCD(0x93); //EXPECTED 0xb2
	mailWrite( 0x4e, VC{0xac, 0x4c} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb2
	mailWrite( 0x4e, VC{0x00, 0x4c} );
	readDevice0x9DCD(0x3f); //EXPECTED 0x32
	mailWrite( 0x4e, VC{0x00, 0xcc} );
	readDevice0x9DCD(0xf1); //EXPECTED 0xb2
	mailWrite( 0x4e, VC{0xce, 0x4c} );
	readDevice0x9DCD(0xf0); //EXPECTED 0xb2
	mailWrite( 0x4e, VC{0xcf, 0xce} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb2

	unsigned sum6665=0;
	unsigned sum6463=0;
	unsigned countSum6665=0;
	unsigned countSum6463=0;
	double value6665;
	bool rgbBit;

	unsigned iterationCount=0;
	do {
		if(iterationCount >= 10) { //Roughly 2 seconds given usleep below, after firmware load.
			throw runtime_error( "No HDMI signal found.");
		}
		sum6665=0;
		sum6463=0;
		countSum6665=0;
		countSum6463=0;
		//When first read information is bad, and it seems to kick off lock.
		for( unsigned j = 0; j<10; ++j ) { //Read 10 times for average. Probably not at all necessary.
			readHdmiSignalInformation(sum6463, countSum6463, sum6665, countSum6665, rgbBit);
		}
		value6665=((double)sum6665) / countSum6665;

		usleep( 1000000 / 5 ); //1/5th of a second, long enough time for more than 4 frames at low frame rate.
		//Should be enough to lock on.

		iterationCount+=1;
	} while( (iterationCount < 3) || (std::abs( value6665 - 0xad4d )<10.0) );
	//^^^^^ Need to go through loop at least twice, to stabilize read, and value read must not be value
	//gotten when no signal

	Resolution resolution = Resolution::Unknown;
	ScanMode scanMode = ScanMode::Progressive;
	double refreshRate = 0.0;

	if (currentInputSettings_.getResolution() == Resolution::Unknown) {
		double value6463=((double)sum6463) / countSum6463;
		//0xb690
		if(fabs( value6463 - 0xb6d7 )<10.0) { //Allow for error.
			//1080p
			resolution = Resolution::HD1080;
			refreshRate = 60.0;
		} else if(fabs( value6463 - 0xb081 )<10.0) { //0xb123
			//1080i
			resolution = Resolution::HD1080;
			refreshRate = 60.0;
			scanMode = ScanMode::Interlaced;;
		} else if(std::abs( value6463 - 0xb05c )<10.0) { //Allow for error.
			//720p
			resolution = Resolution::HD720;
			refreshRate = 60.0;
		} else if(std::abs( value6463 - 0xb0c1 )<12.0) { //480p is 0xb0bf,
			//576p is 0xb0c3
			//midpoint is 0xb0c1
			//0xba95 is NTSC, bb75 is PAL. Code here has a slight NTSC
			//region bias. ;)
			resolution = Resolution::NTSC;
			refreshRate = 60.0;
			if( std::abs( value6665 - 0xbb75 ) < 10 ) {
				resolution = Resolution::PAL;
				refreshRate = 60.0;
			}
		} else {
			if( passedInputSettings_.getResolution() == Resolution::Unknown ) {
				throw runtime_error( "Mode detection failed, does not appear to be a suported mode for HDMI.");
			}
		}
	}
	if( refreshRate == 0.0 ) {
		switch( passedInputSettings_.getResolution() ) {
			case Resolution::PAL:
				refreshRate=50.0;
				break;
			default:
				refreshRate=60.0;
				break;
		}
	}
	//Merge passed arguments and autodetect information.
	currentInputSettings_.mergeAutodetect( passedInputSettings_, resolution, scanMode, refreshRate );

	//Color space isn't set yet, but that shouldn't be a problem.
	currentTranscoderSettings_.mergeAutodetect( passedTranscoderSettings_, currentInputSettings_ );

	mailWrite( 0x4e, VC{0x00, 0xcc} );

	//Mystery setup difference. May be more appropriate to switch on reading back 0x95 instead of 0x97
	//Based on input resolution.
	switch( currentInputSettings_.getResolution() ) {
		case Resolution::HD1080:
			mailWrite( 0x4e, VC{0xb2, 0xc4} );
			mailWrite( 0x4e, VC{0xb5, 0xd0} );
			break;
		case Resolution::HD720:
			mailWrite( 0x4e, VC{0xb2, 0xcc} );
			mailWrite( 0x4e, VC{0xb5, 0xcc} );
			break;
		case Resolution::NTSC:
		case Resolution::PAL:
			mailWrite( 0x4e, VC{0xb2, 0xcf} );
			mailWrite( 0x4e, VC{0xb5, 0xcc} );
			break;
		case Resolution::Unknown:
			throw std::logic_error( "Error in configuring resolution for HDMI." );
			break;
	}
	mailWrite( 0x4e, VC{0x00, 0xce} );
	mailWrite( 0x4e, VC{0x1b, 0x30} );

	mailWrite( 0x4e, VC{0x1f, 0xdc} );
	readDevice0x9DCD(0x29); //EXPECTED 0xba
	mailWrite( 0x4e, VC{0x1f, 0xcc} );
	readDevice0x9DCD(0x3b); //EXPECTED 0xb3
	mailWrite( 0x4e, VC{0x04, 0xcf} );
	mailWrite( 0x4e, VC{0x04, 0xcd} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb0
	mailWrite( 0x4e, VC{0x00, 0xcc} );
	mailWrite( 0x4e, VC{0x40, 0xcc} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb2
	mailWrite( 0x4e, VC{0x00, 0xcd} );

	mailWrite( 0x4e, VC{0x00, 0xcc} );
	mailWrite( 0x4e, VC{0xb0, 0xe8} );
	mailWrite( 0x4e, VC{0xb1, 0x0c} );
	mailWrite( 0x4e, VC{0xad, 0xc9} );
	readDevice0x9DCD(0x8f); //EXPECTED 0x96
	mailWrite( 0x4e, VC{0xb0, 0xe9} );
	readDevice0x9DCD(0x3f); //EXPECTED 0xb2

	mailWrite( 0x4e, VC{0x00, 0xcc} );
	mailWrite( 0x4e, VC{0xab, 0xcc} );
	mailWrite( 0x33, VC{0x99, 0x89, 0xf5} );
	mailRead( 0x33, 1 ); //EXPECTED {0x82}
	mailWrite( 0x33, VC{0x99, 0x89, 0xfd} );
	mailRead( 0x33, 1 ); //EXPECTED {0x6f}
	mailWrite( 0x33, VC{0x99, 0x89, 0xf5} );
	mailRead( 0x33, 1 ); //EXPECTED {0x82}
	mailWrite( 0x33, VC{0x99, 0x89, 0xfc} );
	mailRead( 0x33, 1 ); //EXPECTED {0x6e}
	mailWrite( 0x33, VC{0x99, 0x89, 0xf3} );
	mailRead( 0x33, 1 ); //EXPECTED {0x6e}
	mailWrite( 0x4c, VC{0x0c, 0x89} );
	mailWrite( 0x33, VC{0x99, 0x89, 0xf5} );
	mailRead( 0x33, 1 ); //EXPECTED {0x82}
	mailWrite( 0x4c, VC{0x0e, 0x65} );
	mailWrite( 0x4c, VC{0x0e, 0x64} );
	configureCommonBlockA();

	configureSetupSubblock();

	mailWrite( 0x33, VC{0x99, 0x89, 0x6b} );
	mailRead( 0x33, 1 ); //EXPECTED {0x6e}
	mailWrite( 0x4c, VC{0xc0, 0x80} );
	mailWrite( 0x4c, VC{0xa2, 0x77} );
	mailWrite( 0x33, VC{0x99, 0x89, 0x58} );
	mailRead( 0x33, 1 ); //EXPECTED {0x91}
	mailWrite( 0x4c, VC{0xc0, 0x77} );

	bool mysteryParameter=false;
	if (currentInputSettings_.getResolution() != Resolution::HD1080) {
		if( currentInputSettings_.getScanMode() == ScanMode::Progressive ) {
			mysteryParameter=true;
		}
	}
	configureCommonBlockB1(mysteryParameter);
	configureCommonBlockB2();
	configureCommonBlockB3();
	configureCommonBlockC();
	readHdmiSignalInformation( sum6463, countSum6463, sum6665, countSum6665, rgbBit);

	if( passedInputSettings_.getColorSpace()==ColorSpace::Unknown ) {
		if( rgbBit ) {
			currentInputSettings_.setColorSpace(ColorSpace::RGB);
		} else {
			currentInputSettings_.setColorSpace(ColorSpace::YUV);
		}
	} else {
		currentInputSettings_.setColorSpace( passedInputSettings_.getColorSpace() );
	}

	mailWrite( 0x4e, VC{0x00, 0xcc} ); //Make sure on right bank for color space configure.
	configureColorSpace();
	transcoderFinalConfigure( currentInputSettings_,  currentTranscoderSettings_ );
	transcoderSetup( currentInputSettings_,  currentTranscoderSettings_ );

	scmd(SCMD_INIT, 0xa0, 0x0000);
	uint16_t state=read_config<uint16_t>(SCMD_STATE_READBACK_REGISTER); //EXPECTED=0x0001
	scmd(SCMD_STATE_CHANGE, 0x00, SCMD_STATE_START);
	completeStateChange(state, SCMD_STATE_START); //EXPECTED 0x0001
	currentInputSettings_.dumpMode();
}
void InspectorProfilerAgent::enable(ErrorString*)
{
    m_state->setBoolean(ProfilerAgentState::profilerEnabled, true);
    doEnable();
}