int main(int argc, char **argv) { int fd; unsigned char buf[16]; if ((fd = open("/dev/i2c-1", O_RDWR)) < 0) { fprintf(stderr, "Failed to open i2c bus\n"); return 1; } selectDevice(fd, HMC5883L_I2C_ADDR, "HMC5883L"); writeToDevice(fd, 0x01, 32); writeToDevice(fd, 0x02, 0); for (int i = 0; i < 10000; ++i) { buf[0] = 0x03; if ((write(fd, buf, 1)) != 1) { fprintf(stderr, "Error writing to i2c slave\n"); } if (read(fd, buf, 6) != 6) { fprintf(stderr, "Unable to read from HMC5883L\n"); } else { short x = (buf[0] << 8) | buf[1]; short y = (buf[4] << 8) | buf[5]; short z = (buf[2] << 8) | buf[3]; float angle = atan2(y, x) * 180 / M_PI; printf("x=%d, y=%d, z=%d\n", x, y, z); printf("angle = %0.1f\n\n", angle); } usleep(600 * 1000); } return 0; }
int main(int argc, char **argv) { int fd; unsigned char buf[16]; if ((fd = open("/dev/i2c-1", O_RDWR)) < 0) { // Open port for reading and writing fprintf(stderr, "Failed to open i2c bus\n"); return 1; } /* initialise ADXL345 */ selectDevice(fd, HMC5883L_I2C_ADDR, "HMC5883L"); //writeToDevice(fd, 0x01, 0); writeToDevice(fd, 0x01, 32); writeToDevice(fd, 0x02, 0); for (int i = 0; i < 10000; ++i) { buf[0] = 0x03; if ((write(fd, buf, 1)) != 1) { // Send the register to read from fprintf(stderr, "Error writing to i2c slave\n"); } if (read(fd, buf, 6) != 6) { fprintf(stderr, "Unable to read from HMC5883L\n"); } else { short x = (buf[0] << 8) | buf[1]; short y = (buf[4] << 8) | buf[5]; short z = (buf[2] << 8) | buf[3]; float angle = atan2(y, x) * 180 / 3.14; //for (int b=0; b<6; ++b) //{ // printf("%02x ",buf[b]); //} //printf("\n"); printf("x=%d, y=%d, z=%d\n", x, y, z); printf("angle = %0.1f\n\n", angle); } usleep(50 * 1000); } return 0; }
void RS485::sendPacket(std::shared_ptr<BaseLib::Systems::Packet> packet) { try { if(!packet) { _out.printWarning("Warning: Packet was nullptr."); return; } if(_fileDescriptor->descriptor == -1) throw(BaseLib::Exception("Couldn't write to CRC RS485 device, because the file descriptor is not valid: " + _settings->device)); _lastAction = BaseLib::HelperFunctions::getTime(); if(packet->payload()->size() > 132) { if(_bl->debugLevel >= 2) _out.printError("Tried to send packet with payload larger than 128 bytes. That is not supported."); return; } std::shared_ptr<HMWiredPacket> hmWiredPacket(std::dynamic_pointer_cast<HMWiredPacket>(packet)); if(!hmWiredPacket) return; std::vector<uint8_t> data = hmWiredPacket->byteArray(); writeToDevice(data, true); } catch(const std::exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(BaseLib::Exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
void RS485::sendPacket(std::vector<uint8_t>& rawPacket) { try { if(rawPacket.empty()) { _out.printWarning("Warning: Packet is empty."); return; } if(_fileDescriptor->descriptor == -1) throw(BaseLib::Exception("Couldn't write to RS485 serial device, because the file descriptor is not valid: " + _settings->device)); _lastAction = BaseLib::HelperFunctions::getTime(); if(rawPacket.size() > 132) { if(_bl->debugLevel >= 2) _out.printError("Tried to send packet with payload larger than 128 bytes. That is not supported."); return; } writeToDevice(rawPacket, true); } catch(const std::exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(BaseLib::Exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
void readITG3200(int i2c) { char buf[8]; static int reported = 0; selectDevice(i2c, ITG3200_I2C_ADDR, "ITG3200"); writeToDevice(i2c, "\x1D", 1); if (read(i2c, buf, 6) != 6) { if (!reported) { fprintf(stderr, "Unable to read from ITG3200\n"); reported = 1; } } else { reported = 0; GYRO_ORIENTATION ( ((buf[0]<<8) | buf[1]), ((buf[2]<<8) | buf[3]), ((buf[4]<<8) | buf[5]) ); } }
void readADXL345(int i2c) { char buf[8]; static int reported = 0; selectDevice(i2c, ADXL345_I2C_ADDR, "ADXL345"); writeToDevice(i2c, "\x32", 1); if (read(i2c, buf, 6) != 6) { if (!reported) { fprintf(stderr, "Unable to read from ADXL345\n"); reported = 1; } } else { reported = 0; ACC_ORIENTATION ( ((buf[1]<<8) | buf[0]), ((buf[3]<<8) | buf[2]), ((buf[5]<<8) | buf[4]) ); } }
virtual int_type overflow(int_type c) { if (c != char_traits::eof()) return writeToDevice(char_traits::to_char_type(c)); else return c; }
int TeeStreamBuf::readFromDevice() { if (_pIstr) { int c = _pIstr->get(); if (c != -1) writeToDevice((char) c); return c; } return -1; }
void COC::sendPacket(std::shared_ptr<BaseLib::Systems::Packet> packet) { try { if(!packet) { _out.printWarning("Warning: Packet was nullptr."); return; } if(!_socket) { _out.printError("Error: Couldn't write to COC device, because the device descriptor is not valid: " + _settings->device); return; } if(packet->payload()->size() > 54) { if(_bl->debugLevel >= 2) _out.printError("Error: Tried to send packet larger than 64 bytes. That is not supported."); return; } std::shared_ptr<MAXPacket> maxPacket(std::dynamic_pointer_cast<MAXPacket>(packet)); if(!maxPacket) return; std::string packetHex = packet->hexString(); if(_bl->debugLevel > 3) _out.printInfo("Info: Sending (" + _settings->id + ", WOR: " + (maxPacket->getBurst() ? "yes" : "no") + "): " + packetHex); if(maxPacket->getBurst()) writeToDevice(stackPrefix + "Zs" + packetHex + "\n" + stackPrefix + "Zr\n"); else writeToDevice(stackPrefix + "Zf" + packetHex + "\n" + stackPrefix + "Zr\n"); } catch(const std::exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(BaseLib::Exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
int initI2Cdevices(void) { int i2c; if ((i2c = open("/dev/i2c-0", O_RDWR)) < 0) { perror("Failed to open i2c bus"); exit(1); } /* initialise ADXL345 */ selectDevice(i2c, ADXL345_I2C_ADDR, "ADXL345"); writeToDevice(i2c, "\x2d\x00", 2); writeToDevice(i2c, "\x2d\x10", 2); writeToDevice(i2c, "\x2d\x08", 2); writeToDevice(i2c, "\x31\x00", 2); writeToDevice(i2c, "\x31\x0b", 2); /* initialise ITG3200 */ selectDevice(i2c, ITG3200_I2C_ADDR, "ITG3200"); writeToDevice(i2c, "\x16\b00011000", 2); return i2c; }
/** * Save the text to the given filename * @param filename :: The filename to use * @throws std::runtime_error if the file could not be opened */ void ScriptEditor::saveScript(const QString &filename) { QFile file(filename); if (!file.open(QIODevice::WriteOnly)) { QString msg = QString("Could not open file \"%1\" for writing.").arg(filename); throw std::runtime_error(msg.toAscii().data()); } m_filename = filename; writeToDevice(file); file.close(); setModified(false); }
void IMUReader::initSensors() { /* initialize ADXL345 */ selectDevice(file, ADXL345_I2C_ADDR, "ADXL345"); writeToDevice(file, "\x2d\x00", 2); writeToDevice(file, "\x2d\x10", 2); writeToDevice(file, "\x2d\x08", 2); writeToDevice(file, "\x31\x00", 2); writeToDevice(file, "\x31\x0b", 2); /* initialize HMC5883L */ selectDevice(file, HMC5883L_I2C_ADDR, "HMC5883L"); writeToDevice(file, "\x02\x00", 2); /* initialize ITG3200 */ selectDevice(file, ITG3200_I2C_ADDR, "ITG3200"); //writeToDevice(file, "\x16\b00011000", 2); writeToDevice(file, "\x3E\x00", 2); writeToDevice(file, "\x15\x07", 2); writeToDevice(file, "\x16\x1E", 2); writeToDevice(file, "\x17\x00", 2); }
void LivePlayer::useFeatures() { if(mLastUpdate < playingTime() - 500) { draw("Live stream", true); writeToDevice(&mLastImage); update(); mLastUpdate = playingTime(); if(nbSamples() >= 4*LIVE_PLAYER_WIDTH) cleanOldFeatures(LIVE_PLAYER_WIDTH*1.1); } }
void COC::startListening() { try { _socket = GD::bl->serialDeviceManager.get(_settings->device); if(!_socket) _socket = GD::bl->serialDeviceManager.create(_settings->device, 38400, O_RDWR | O_NOCTTY | O_NDELAY, true, 45); if(!_socket) return; _socket->addEventHandler(this); _socket->openDevice(); if(gpioDefined(2)) { openGPIO(2, false); if(!getGPIO(2)) setGPIO(2, true); closeGPIO(2); } if(gpioDefined(1)) { openGPIO(1, false); if(!getGPIO(1)) { setGPIO(1, false); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); setGPIO(1, true); std::this_thread::sleep_for(std::chrono::milliseconds(2000)); } closeGPIO(1); } writeToDevice(stackPrefix + "X21\n" + stackPrefix + "Zr\n"); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); IPhysicalInterface::startListening(); } catch(const std::exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(BaseLib::Exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
int main(void) { int data; short x, y, z; float xa, ya, za; unsigned char buf[16]; int count, b; if ((file = open(I2CDEV, O_RDWR)) < 0) { printf("Failed to open the bus."); exit(1); } /* initialise ADXL345 */ selectDevice(file, ADXL345_I2C_ADDR, "ADXL345"); writeToDevice(file, "\x2d\x00", 2); writeToDevice(file, "\x2d\x10", 2); writeToDevice(file, "\x2d\x08", 2); writeToDevice(file, "\x31\x00", 2); writeToDevice(file, "\x31\x0b", 2); /* initialise HMC5883L */ selectDevice(file, HMC5883L_I2C_ADDR, "HMC5883L"); writeToDevice(file, "\x02\x00", 2); /* initialise ITG3200 */ selectDevice(file, ITG3200_I2C_ADDR, "ITG3200"); //writeToDevice(file, "\x16\b00011000", 2); writeToDevice(file, "\x3E\x00", 2); writeToDevice(file, "\x15\x07", 2); writeToDevice(file, "\x16\x1E", 2); writeToDevice(file, "\x17\x00", 2); /* initialise BMA180 */ selectDevice(file, BMA180_I2C_ADDR, "BMA180"); writeToDevice(file, "\x10\xB6", 2); // wake up mode writeToDevice(file, "\x0D\x10", 2); // low pass filter while (1) { selectDevice(file, HMC5883L_I2C_ADDR, "HMC5883L"); writeToDevice(file, "\x03", 1); if (read(file, buf, 6) != 6) { printf("Unable to read from HMC5883L\n"); } else { x = buf[1]<<8| buf[0]; y = buf[3]<<8| buf[2]; z = buf[5]<<8| buf[4]; xa = (90.0 / 256.0) * (float) x; ya = (90.0 / 256.0) * (float) y; za = (90.0 / 256.0) * (float) z; //printf("HMC: x=%d, y=%d, z=%d xa=%4.0f ya=%4.0f za=%4.0f\n", x, y, z, xa, ya, za); printf("HMC: x=%d, y=%d, z=%d\n", x, y, z); } selectDevice(file, BMA180_I2C_ADDR, "BMA180"); writeToDevice(file, "\x02", 1); if (read(file, buf, 6) != 6) { printf("Unable to read from BMA180\n"); } else { x = buf[1]<<8| buf[0]; y = buf[3]<<8| buf[2]; z = buf[5]<<8| buf[4]; printf("BMA180: x=%d, y=%d, z=%d\n", x, y, z); } /* selectDevice(file, ADXL345_I2C_ADDR, "ADXL345"); writeToDevice(file, "\x32", 1); if (read(file, buf, 6) != 6) { printf("Unable to read from ADXL345\n"); } else { x = buf[1]<<8| buf[0]; y = buf[3]<<8| buf[2]; z = buf[5]<<8| buf[4]; xa = (90.0 / 256.0) * (float) x; ya = (90.0 / 256.0) * (float) y; za = (90.0 / 256.0) * (float) z; //printf("ADXL %d %d %d, %4.0f %4.0f %4.0f\n", x, y, z, xa, ya, za); printf("ADXL %d %d %d\n", x, y, z); } */ selectDevice(file, ITG3200_I2C_ADDR, "ITG3200"); writeToDevice(file, "\x1D", 1); if (read(file, buf, 6) != 6) { printf("Unable to read from ITG3200\n"); } else { x = buf[0]<<8| buf[1]; y = buf[2]<<8| buf[3]; z = buf[4]<<8| buf[5]; xa = (90.0 / 256.0) * (float) x; ya = (90.0 / 256.0) * (float) y; za = (90.0 / 256.0) * (float) z; //printf("ITG: x=%d, y=%d, z=%d xa=%4.0f ya=%4.0f za=%4.0f\n", x, y, z, xa, ya, za); printf("ITG: x=%d, y=%d, z=%d\n", x, y, z); } usleep(10000); } }
errlHndl_t RtPnor::flush( PNOR::SectionId i_section) { TRACFCOMP(g_trac_pnor, ENTER_MRK"RtPnor::flush"); errlHndl_t l_err = nullptr; do { if (i_section == PNOR::INVALID_SECTION) { TRACFCOMP(g_trac_pnor,"RtPnor::flush: Invalid Section: %d", (int)i_section); /*@ * @errortype * @moduleid PNOR::MOD_RTPNOR_FLUSH * @reasoncode PNOR::RC_INVALID_SECTION * @userdata1 PNOR::SectionId * @devdesc invalid section passed to flush */ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_RTPNOR_FLUSH, PNOR::RC_INVALID_SECTION, i_section, 0,true); break; } size_t l_sizeBytes = iv_TOC[i_section].size; if (l_sizeBytes == 0) { TRACFCOMP(g_trac_pnor,"RtPnor::flush: Section %d" " size is 0", (int)i_section); /*@ * @errortype * @moduleid PNOR::MOD_RTPNOR_FLUSH * @reasoncode PNOR::RC_SECTION_SIZE_IS_ZERO * @userdata1 PNOR::SectionId * @devdesc section size is zero */ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_RTPNOR_FLUSH, PNOR::RC_SECTION_SIZE_IS_ZERO, i_section, 0,true); break; } //get the saved pointers for the partitionName PnorAddrMap_t::iterator l_it = iv_pnorMap.find(i_section); if(l_it == iv_pnorMap.end()) { TRACFCOMP(g_trac_pnor,"RtPnor::flush: section %d has not been read before", i_section); break; } PnorAddrPair_t l_addrPair = l_it->second; uint8_t* l_pWorking = reinterpret_cast<uint8_t*>(l_addrPair.first); uint8_t* l_pClean = reinterpret_cast<uint8_t*>(l_addrPair.second); //ecc bool l_ecc = (iv_TOC[i_section].integrity&FFS_INTEG_ECC_PROTECT) ? true : false; //find the diff between each pointer //write back to pnor what doesn't match TRACFCOMP(g_trac_pnor, "finding diff between working and clean copy..."); for (uint64_t i = 0; i < (l_sizeBytes/PAGESIZE); i++) { if (0 != memcmp(l_pWorking, l_pClean, PAGESIZE)) { TRACFCOMP(g_trac_pnor, "RtPnor::flush: page %d is different," " writing back to pnor", i); l_err = writeToDevice(iv_masterProcId, i_section, i*PAGESIZE,PAGESIZE, l_ecc, l_pWorking); if (l_err) { TRACFCOMP(g_trac_pnor, "RtPnor::flush: writeToDevice failed"); break; } //update the clean copy memcpy(l_pClean, l_pWorking, PAGESIZE); } l_pWorking += PAGESIZE; l_pClean += PAGESIZE; } if (l_err) { TRACFCOMP(g_trac_pnor,"RtPnor::flush: error writing section %d" " back to pnor",(int)i_section); break; } } while (0); TRACFCOMP(g_trac_pnor, EXIT_MRK"RtPnor::flush"); return l_err; }
void IMUReader::readSensors(IMUSensorsData& data, GyroState& gyroState, bool calibration) { short x, y, z; unsigned char buf[16]; selectDevice(file, HMC5883L_I2C_ADDR, "HMC5883L"); writeToDevice(file, "\x03", 1); if (read(file, buf, 6) != 6) { printf("Unable to read from HMC5883L\n"); } else { x = __swab16(*(short*) &buf[0]); z = __swab16(*(short*) &buf[2]); y = __swab16(*(short*) &buf[4]); data.rawCompassX = x; data.rawCompassY = y; data.rawCompassZ = z; } selectDevice(file, ADXL345_I2C_ADDR, "ADXL345"); writeToDevice(file, "\x32", 1); if (read(file, buf, 6) != 6) { printf("Unable to read from ADXL345\n"); } else { x = buf[1] << 8 | buf[0]; y = buf[3] << 8 | buf[2]; z = buf[5] << 8 | buf[4]; data.rawAccelX = x; data.rawAccelY = y; data.rawAccelZ = z; } selectDevice(file, ITG3200_I2C_ADDR, "ITG3200"); writeToDevice(file, "\x1D", 1); if (read(file, buf, 6) != 6) { printf("Unable to read from ITG3200\n"); } else { x = __swab16(*(short*) &buf[0]); y = __swab16(*(short*) &buf[2]); z = __swab16(*(short*) &buf[4]); data.rawGyroX = x; data.rawGyroY = y; data.rawGyroZ = z; if (calibration) { gyroState.offsetX += x; gyroState.offsetY += y; gyroState.offsetZ += z; } } }
errlHndl_t RtPnor::clearSection(PNOR::SectionId i_section) { TRACFCOMP(g_trac_pnor, "RtPnor::clearSection Section id = %d", i_section); errlHndl_t l_errl = nullptr; const uint64_t CLEAR_BYTE = 0xFF; uint8_t* l_buf = new uint8_t[PAGESIZE](); uint8_t* l_eccBuf = nullptr; do { // Flush pages of pnor section we are trying to clear l_errl = flush(i_section); if (l_errl) { TRACFCOMP( g_trac_pnor, ERR_MRK"RtPnor::clearSection: flush() failed on section", i_section); break; } // Get PNOR section info uint64_t l_address = iv_TOC[i_section].flashAddr; uint64_t l_chipSelect = iv_TOC[i_section].chip; uint32_t l_size = iv_TOC[i_section].size; bool l_ecc = iv_TOC[i_section].integrity & FFS_INTEG_ECC_PROTECT; // Number of pages needed to cycle proper ECC // Meaning every 9th page will copy the l_eccBuf at offset 0 const uint64_t l_eccCycleNum = 9; // Boundaries for properly splitting up an ECC page for 4K writes. // Subtract 1 from l_eccCycleNum because we start writing with offset 0 // and add this value 8 times to complete a cycle. const uint64_t l_sizeOfOverlapSection = (PNOR::PAGESIZE_PLUS_ECC - PAGESIZE) / (l_eccCycleNum - 1); // Create clear section buffer memset(l_buf, CLEAR_BYTE, PAGESIZE); // apply ECC to data if needed if(l_ecc) { l_eccBuf = new uint8_t[PNOR::PAGESIZE_PLUS_ECC](); PNOR::ECC::injectECC( reinterpret_cast<uint8_t*>(l_buf), PAGESIZE, reinterpret_cast<uint8_t*>(l_eccBuf) ); l_size = (l_size*9)/8; } // Write clear section page to PNOR for (uint64_t i = 0; i < l_size; i+=PAGESIZE) { if(l_ecc) { // Take (current page) mod (l_eccCycleNum) to get cycle position uint8_t l_bufPos = ( (i/PAGESIZE) % l_eccCycleNum ); uint64_t l_bufOffset = l_sizeOfOverlapSection * l_bufPos; memcpy(l_buf, (l_eccBuf + l_bufOffset), PAGESIZE); } // Set ecc parameter to false to avoid double writes will only write // 4k at a time, even if the section is ecc protected. l_errl = writeToDevice( iv_masterProcId, i_section, (l_address + i), l_chipSelect, false, l_buf); if (l_errl) { TRACFCOMP( g_trac_pnor, ERR_MRK"RtPnor::clearSection: writeToDevice fail: eid=0x%X, rc=0x%X", l_errl->eid(), l_errl->reasonCode()); break; } } if (l_errl) { break; } } while(0); // Free allocated memory if(l_eccBuf) { delete[] l_eccBuf; } delete [] l_buf; return l_errl; }
/** * @brief Message receiver */ void PnorRP::waitForMessage() { TRACFCOMP(g_trac_pnor, "PnorRP::waitForMessage>" ); errlHndl_t l_errhdl = NULL; msg_t* message = NULL; uint8_t* user_addr = NULL; uint8_t* eff_addr = NULL; uint64_t dev_offset = 0; uint64_t chip_select = 0xF; bool needs_ecc = false; int rc = 0; uint64_t status_rc = 0; uint64_t fatal_error = 0; while(1) { status_rc = 0; TRACUCOMP(g_trac_pnor, "PnorRP::waitForMessage> waiting for message" ); message = msg_wait( iv_msgQ ); if( message ) { /* data[0] = virtual address requested * data[1] = address to place contents */ eff_addr = (uint8_t*)message->data[0]; user_addr = (uint8_t*)message->data[1]; //figure out the real pnor offset l_errhdl = computeDeviceAddr( eff_addr, dev_offset, chip_select, needs_ecc ); if( l_errhdl ) { status_rc = -EFAULT; /* Bad address */ } else { switch(message->type) { case( MSG_MM_RP_READ ): l_errhdl = readFromDevice( dev_offset, chip_select, needs_ecc, user_addr, fatal_error ); if( l_errhdl || ( 0 != fatal_error ) ) { status_rc = -EIO; /* I/O error */ } break; case( MSG_MM_RP_WRITE ): l_errhdl = writeToDevice( dev_offset, chip_select, needs_ecc, user_addr ); if( l_errhdl ) { status_rc = -EIO; /* I/O error */ } break; default: TRACFCOMP( g_trac_pnor, "PnorRP::waitForMessage> Unrecognized message type : user_addr=%p, eff_addr=%p, msgtype=%d", user_addr, eff_addr, message->type ); /*@ * @errortype * @moduleid PNOR::MOD_PNORRP_WAITFORMESSAGE * @reasoncode PNOR::RC_INVALID_MESSAGE_TYPE * @userdata1 Message type * @userdata2 Requested Virtual Address * @devdesc PnorRP::waitForMessage> Unrecognized * message type * @custdesc A problem occurred while accessing * the boot flash. */ l_errhdl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_PNORRP_WAITFORMESSAGE, PNOR::RC_INVALID_MESSAGE_TYPE, TO_UINT64(message->type), (uint64_t)eff_addr, true /*Add HB SW Callout*/); l_errhdl->collectTrace(PNOR_COMP_NAME); status_rc = -EINVAL; /* Invalid argument */ } } if( !l_errhdl && msg_is_async(message) ) { TRACFCOMP( g_trac_pnor, "PnorRP::waitForMessage> Unsupported Asynchronous Message : user_addr=%p, eff_addr=%p, msgtype=%d", user_addr, eff_addr, message->type ); /*@ * @errortype * @moduleid PNOR::MOD_PNORRP_WAITFORMESSAGE * @reasoncode PNOR::RC_INVALID_ASYNC_MESSAGE * @userdata1 Message type * @userdata2 Requested Virtual Address * @devdesc PnorRP::waitForMessage> Unrecognized message * type * @custdesc A problem occurred while accessing the boot * flash. */ l_errhdl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_PNORRP_WAITFORMESSAGE, PNOR::RC_INVALID_ASYNC_MESSAGE, TO_UINT64(message->type), (uint64_t)eff_addr, true /*Add HB SW Callout*/); l_errhdl->collectTrace(PNOR_COMP_NAME); status_rc = -EINVAL; /* Invalid argument */ } if( l_errhdl ) { errlCommit(l_errhdl,PNOR_COMP_ID); } /* Expected Response: * data[0] = virtual address requested * data[1] = rc (0 or negative errno value) * extra_data = Specific reason code. */ message->data[1] = status_rc; message->extra_data = reinterpret_cast<void*>(fatal_error); rc = msg_respond( iv_msgQ, message ); if( rc ) { TRACFCOMP(g_trac_pnor, "PnorRP::waitForMessage> Error from msg_respond, giving up : rc=%d", rc ); break; } } } TRACFCOMP(g_trac_pnor, "< PnorRP::waitForMessage" ); }