u32 getNumericValue( char *p ) { crlf(); // must be a number '0x or a nummeric digit if ( ( *p >= '0' ) && ( *p <= '9' ) ) { // it is a nummeric digit if ( ( *(p+1) == 0 ) || *(p+1) == ',' || *(p+1) == 0x20 ) { // Decimal number return atoi( p ); } else if ( (*(p+1) & ~0x20 ) == 'X' ) { uart0BlockingPutch( 'A' ); // Hex number p += 2; // point beyond '0x' // Make sure it is't just '0x' if ( *p ) { int digit[ 4 ]; int i = 0; // First digit if ( -1 == ( digit[ i ] = getHexValue( *p++ ) ) ) { uart0BlockingPutch( 'B' ); return 0xffff; } i++; // digit 2 if ( -1 == ( digit[ i ] = getHexValue( *p++ ) ) ) { // One digit 0x9 uart0BlockingPutch( 'C' ); return digit[ 0 ]; } i++; // digit 3 if ( -1 == ( digit[ i ] = getHexValue( *p++ ) ) ) { // Two digit 0x99 uart0BlockingPutch( 'D' ); return digit[ 0 ] * 16 + digit[ 1 ]; } i++; // digit 4 if ( -1 == ( digit[ i ] = getHexValue( *p++ ) ) ) { // Three digit 0x999 uart0BlockingPutch( 'E' ); return digit[ 0 ] * 256 + digit[ 1 ] * 16 + digit[ 2 ]; } // Four digit 0x9999 uart0BlockingPutch( 'F' ); return ( digit[ 0 ] * 4096 + digit[ 1 ] * 256 + digit[ 2 ] * 16 + digit[ 3 ] ); } else { // it is '0x' uart0BlockingPutch( 'x' ); return 0xffff; } } else { return atoi( p ); } } else { uart0BlockingPutch( 'y' ); return 0xffff; } uart0BlockingPutch( 'z' ); return 0xffff; }
Test::Test(XmlElement *xe,bool &ok, ProductionUnit* unit_) : input (-1), output (-1), num_channels(1), glitchThreshold(4.0f), unit(unit_), requiredTestAdapterProductId(0) // Most tests do not require a specific product ID { XmlElement *temp; temp = xe->getFirstChildElement(); if (temp && temp->isTextElement()) { title = temp->getText(); title = title.trim(); } if (application->testManager->getNumLoops()) { int currentLoop = application->testManager->currentLoop; if (title.isNotEmpty()) { title += String::formatted(" - loop %d/%d", currentLoop + 1, application->testManager->getNumLoops()); } } getIntValue(xe, "input", input); getIntValue(xe, "output", output); getIntValue(xe, "num_channels", num_channels); ok = getIntValue(xe, "sample_rate_check", sample_rate_check); if (!ok) sample_rate_check = 0; ok = getIntValue(xe, "sample_rate", sample_rate); ok &= getFloatValue(xe, "output_amplitude_db", output_amplitude_db); if (sample_rate_check != 0) { minSampleRate = sample_rate_check * 0.80f; maxSampleRate = sample_rate_check * 1.20f; } else { minSampleRate = sample_rate * 0.94f; maxSampleRate = sample_rate * 1.06f; } getFloatValue(xe, "min_sample_rate", minSampleRate); getFloatValue(xe, "max_sample_rate", maxSampleRate); getHexValue(xe, "required_test_adapter_product_id", requiredTestAdapterProductId); // Not required if (ECHOAIO_INTERFACE_MODULE_REV1 == unit_->getAIORevision()) { if (minSampleRate > 144000.0) minSampleRate *= 0.5f; if (maxSampleRate > 144000.0) maxSampleRate *= 0.5f; if (sample_rate > 144000.0) sample_rate *= 0.5f; } output_frequency = 1000.0f; }