bool BME280::ReadTrim() { uint8_t ord(0); bool success = true; // Temp. Dig success &= ReadRegister(TEMP_DIG_ADDR, &m_dig[ord], TEMP_DIG_LENGTH); ord += TEMP_DIG_LENGTH; // Pressure Dig success &= ReadRegister(PRESS_DIG_ADDR, &m_dig[ord], PRESS_DIG_LENGTH); ord += PRESS_DIG_LENGTH; // Humidity Dig 1 success &= ReadRegister(HUM_DIG_ADDR1, &m_dig[ord], HUM_DIG_ADDR1_LENGTH); ord += HUM_DIG_ADDR1_LENGTH; // Humidity Dig 2 success &= ReadRegister(HUM_DIG_ADDR2, &m_dig[ord], HUM_DIG_ADDR2_LENGTH); ord += HUM_DIG_ADDR2_LENGTH; #ifdef DEBUG_ON Serial.print("Dig: "); for(int i = 0; i < 32; ++i) { Serial.print(m_dig[i], HEX); Serial.print(" "); } Serial.println(); #endif return success && ord == DIG_LENGTH; }
// devuelve 0 si no es posible acceder a la caracteristica avanzada de base de exposicion QUADLET LeeAddressTimeBase() { const int nACR = 0xF2F00000; //direccion del ACR (Access Control Register) (para todos los features) // Set feature set ID to unlock advanced features. NO ES NECESARIO, SIEMPRE HABILITADO EN CAMARAS BASLER QUADLET Enabled1, Enabled2; WriteRegister(M_sistema, M_DEV0, nACR + 0x00, 0x0030533B); WriteRegister(M_sistema, M_DEV0, nACR + 0x04, 0x73C3F000);//last three zeros represent a timeout value, 000 means always available Enabled1 = ReadRegister(M_sistema, M_DEV0, nACR + 0x00); Enabled2 = ReadRegister(M_sistema, M_DEV0, nACR + 0x04); if (Enabled1 == 0xFFFFFFFF && Enabled2 == 0xFFFFFFFF) return false; // Recuperamos la direccion CSR (Control and Status Register) para el shutter time base feature // Escribimos al Smart Features Inquiry Register (que esta 0x10 despues respecto al ACR) // El Inquiry Register esta ordenado asi: D1 | D3 | D2 | D4[3] | D4[2] | D4[1] | D4[0] | D4[7] | D4[6] | D4[5] | D4[4] // El CSR GUID para el shutter time base es D1:648BE1DA D2:A416 D3:11D8 D4:9B47 00105A5BAE55 WriteRegister(M_sistema, M_DEV0, nACR + 0x10, 0x648BE1DA); WriteRegister(M_sistema, M_DEV0, nACR + 0x14, 0x11D8A416); WriteRegister(M_sistema, M_DEV0, nACR + 0x18, 0x1000479B); WriteRegister(M_sistema, M_DEV0, nACR + 0x1C, 0x55AE5B5A); // Al haber "preguntado" por nuestro CSR GUID, obtenemos la direccion CSR // la direccion estará en el Smart Features Addres Register (desplazado 0x20 del ACR return ReadRegister(M_sistema, M_DEV0, nACR + 0x20); }
/***************************************************************************** Obtiene el valor minimo y maximo (en microsegundos) de la base de exposicion Devuelve false si error *****************************************************************************/ bool GetLimitesBaseExposicion(long& nMin, long&nMax) { if (Address == 0) //Primera vez que se accede al registro avanzado de la base de exposicion { Address = LeeAddressTimeBase(); if (Address == 0) return false; // Leer cabecera (COMPROBACION) if (ReadRegister(M_sistema, M_DEV0, Address + 0) == 0) return false; } // Leer Min QUADLET Value = ReadRegister(M_sistema, M_DEV0, Address + 8); float min = *((float *)&Value); // Leer Max Value = ReadRegister(M_sistema, M_DEV0, Address + 12); float max = *((float *)&Value); nMin = (long)(min * 1000000); nMax = (long)(max * 1000000); return true; }
/***************************************************************************** Modifica la base de exposicion nBaseExposicion - en microsegundos Devuelve true si todo bien *****************************************************************************/ bool ModificaBaseExposicion(int nBaseExposicion) { if (Address == 0) //Primera vez que se accede al registro avanzado de la base de exposicion { Address = LeeAddressTimeBase(); if (Address == 0) return false; // Leer cabecera (COMPROBACION) if (ReadRegister(M_sistema, M_DEV0, Address + 0) == 0) return false; } // Escribir shutter time base float fShutterTimeBase = (float)nBaseExposicion/(float)1000000; QUADLET qTimeBase = *((QUADLET *)&fShutterTimeBase); WriteRegister(M_sistema, M_DEV0, Address + 16, qTimeBase); // Leer shutter time base (COMPROBACION) QUADLET Value = ReadRegister(M_sistema, M_DEV0, Address + 16); float base = *((float *)&Value); base = base * 1000000; ASSERT((int)base == nBaseExposicion); return true; }
int main(void) { WDTCTL = WDTPW | WDTHOLD; // Interrompe o watchdog timer. BCSCTL1 = CALBC1_16MHZ; // Configura o DCO para 16MHz. DCOCTL = CALDCO_16MHZ; BCSCTL2 = BCSCTL2 | DIVS_0; // Configura SMCLK para 16MHz. P2DIR = P2DIR & (~PIN_INT1) & (~PIN_INT2); // Configura pinos INT1 e INT2. P4OUT = P4OUT | PIN_CS_ACC; // Configura pino CS do acelerômetro. P4DIR = P4DIR | PIN_CS_ACC; P3SEL = P3SEL | PIN_MOSI | PIN_MISO | PIN_SCK; // Configura pinos SPI. UCB0CTL0 = UCB0CTL0 | UCSYNC | UCMODE_1 | UCMST | UCMSB | UCCKPH; // Configura SPI. UCB0CTL1 = UCB0CTL1 | UCSSEL_2; UCB0BR0 = 0x08; // SPI Speed = 16MHz/8 = 2MHz // Maximum Speed = 4MHz. UCB0BR1 = 0x00; UCB0CTL1 = UCB0CTL1 & (~UCSWRST); P4OUT = P4OUT & (~PIN_CS_ACC); // Configura acelerômetro. WriteRegister(MCTL, 0x05); if (ReadRegister(MCTL) == 0x05) { P2OUT = ~PIN_LED1 | ~PIN_LED2 | ~PIN_LED3; P2DIR = PIN_LED1 | PIN_LED2 | PIN_LED3; } acc_id = ReadRegister(WHOAMI); while(1); }
bool BME280::ReadData ( int32_t data[SENSOR_DATA_LENGTH] ) { bool success; uint8_t buffer[SENSOR_DATA_LENGTH]; // For forced mode we need to write the mode to BME280 register before reading if (m_settings.mode == Mode_Forced) { WriteSettings(); } // Registers are in order. So we can start at the pressure register and read 8 bytes. success = ReadRegister(PRESS_ADDR, buffer, SENSOR_DATA_LENGTH); for(int i = 0; i < SENSOR_DATA_LENGTH; ++i) { data[i] = static_cast<int32_t>(buffer[i]); } #ifdef DEBUG_ON Serial.print("Data: "); for(int i = 0; i < 8; ++i) { Serial.print(data[i], HEX); Serial.print(" "); } Serial.println(); #endif return success; }
void NRF24L01p::Transmit(uint8_t* data, uint8_t size) { uint8_t reg = 0; reg = ReadRegister(NRF24L01p_REGISTER_ADDRESS_CONFIG); reg &= ~((uint8_t)(0b1<<NRF24L01p_MNEMONIC_CONFIG_PRIM_RX)); //Put the device in TX mode. WriteRegister(NRF24L01p_REGISTER_ADDRESS_CONFIG, reg); CyDelayUs(150); //Wait for the device to switch to TX mode. uint8_t buffer[33] = {0}; buffer[0] = NRF24L01p_INSTRUCTION_W_TX_PAYLOAD_NO_ACK; memcpy(&buffer[1], data, size); NRF24L01p_CS_Write(0); NRF24L01p_SPI_CONTROLLER_PutArray(buffer, size+1); CyDelayUs(10); NRF24L01p_CS_Write(1); NRF24L01p_CE_Write(1); //Make the NRF24L01p transmit the data. CyDelayUs(10); NRF24L01p_CE_Write(0); reg |= 0b1<<NRF24L01p_MNEMONIC_CONFIG_PRIM_RX; //Put the device in RX mode. CyDelayUs(1400); WriteRegister(NRF24L01p_REGISTER_ADDRESS_CONFIG, reg); }
uint8_t cc1101_t::Init() { // ==== GPIO ==== PinSetupOut (CC_GPIO, CC_CS, omPushPull); PinSetupAlterFunc(CC_GPIO, CC_SCK, omPushPull, pudNone, CC_SPI_AF); PinSetupAlterFunc(CC_GPIO, CC_MISO, omPushPull, pudNone, CC_SPI_AF); PinSetupAlterFunc(CC_GPIO, CC_MOSI, omPushPull, pudNone, CC_SPI_AF); IGdo0.Init(ttFalling); //PinSetupAnalog (CC_GPIO, CC_GDO2); // GDO2 not used CsHi(); // ==== SPI ==== // MSB first, master, ClkLowIdle, FirstEdge, Baudrate no more than 6.5MHz ISpi.Setup(boMSB, cpolIdleLow, cphaFirstEdge, sbFdiv16); ISpi.Enable(); // ==== Init CC ==== if(Reset() != OK) { ISpi.Disable(); Uart.Printf("\rCC Rst Fail"); return FAILURE; } // Check if success WriteRegister(CC_PKTLEN, 7); uint8_t Rpl = ReadRegister(CC_PKTLEN); if(Rpl != 7) { ISpi.Disable(); Uart.Printf("\rCC R/W Fail; rpl=%u", Rpl); return FAILURE; } // Proceed with init FlushRxFIFO(); RfConfig(); IGdo0.EnableIrq(IRQ_PRIO_HIGH); return OK; }
void OGNRadio::GetReceivePacket(uint8_t *Packet) { uint8_t i; for(i=8;i<64;i++) Packet[i] = ReadRegister(REG_FIFO); }
uint8_t cc1101_t::ReadFIFO(void *Ptr, int8_t *PRssi) { uint8_t b, *p = (uint8_t*)Ptr; // Check if received successfully b = ReadRegister(CC_PKTSTATUS); // Uart.Printf("St: %X ", b); if(b & 0x80) { // CRC OK // Read FIFO CsLo(); // Start transmission if(BusyWait() != OK) { // Wait for chip to become ready CsHi(); return FAILURE; } ISpi.ReadWriteByte(CC_FIFO|CC_READ_FLAG|CC_BURST_FLAG); // Address with read & burst flags for(uint8_t i=0; i<IPktSz; i++) { // Read bytes b = ISpi.ReadWriteByte(0); *p++ = b; // Uart.Printf(" %X", b); } // Receive two additional info bytes b = ISpi.ReadWriteByte(0); // RSSI ISpi.ReadWriteByte(0); // LQI CsHi(); // End transmission if(PRssi != nullptr) *PRssi = RSSI_dBm(b); return OK; } else return FAILURE; }
bool BackendHelper::DumpAllRegisters(BackendHelper *bh, const soc_desc::node_inst_t& inst, bool ignore_errors) { bool ret = true; if(inst.node().reg().valid()) { soc_word_t val; if(!ReadRegister(inst, val)) { ret = false; if(!ignore_errors) return false; } else if(!bh->WriteRegister(inst, val)) { ret = false; if(!ignore_errors) return false; } } std::vector< soc_desc::node_inst_t > list = inst.children(); for(size_t i = 0; i < list.size(); i++) { if(!DumpAllRegisters(bh, list[i], ignore_errors)) { ret = false; if(!ignore_errors) return false; } } return ret; }
void cs5463spi::CheckStatus() { int count = 0; uint8_t result = 0; uint8_t rx1[4]; memset(rx1, 0x00, sizeof(rx1)); ReadRegister(m_cs5463NumList[status].addr, rx1); for(int y = 3; y >= 1; y--){ uint8_t a = 0x01; uint8_t value = *(rx1 + y); for(int i = 0; i < 8; i++) { if(count == lsd || count == iod || count == vod || count == tod || count == vsag || count == ifault || count == eor || count == vror || count == iror || count == vor || count == ior) { result = value & (a << i); if(result) { std::string msg; msg = "Status: " + m_statusWarn[i]; //TODO change to only report a failure. //m_mySPISysLog->writeMsgLog(msg.c_str()); printf("%s\n", msg.c_str()); } } count++; } count++; } }
//#define CC_PRINT_RX bool CC_t::ReadRX() { uint8_t *p = (uint8_t*)(&RX_Pkt); uint8_t b; uint8_t FifoSize = ReadRegister(CC_RXBYTES); // Get number of bytes in FIFO FifoSize &= 0x7F; // Remove MSB #ifdef CC_PRINT_RX klPrintf("Size: %u ", FifoSize); #endif if(FifoSize == 0) return false; if (FifoSize > (CC_PKT_LEN+2)) FifoSize = CC_PKT_LEN+2; CS_Lo(); // Start transmission BusyWait(); // Wait for chip to become ready ReadWriteByte(CC_FIFO|CC_READ_FLAG|CC_BURST_FLAG); // Address with read & burst flags for (uint8_t i=0; i<FifoSize; i++) { // Read bytes b = ReadWriteByte(0); *p++ = b; #ifdef CC_PRINT_RX klPrintf("0x%u ", b); #endif } CS_Hi(); // End transmission #ifdef CC_PRINT_RX klPrintf("\r"); #endif return true; }
bool NRF24L01p::Receive(uint8_t* data, uint8_t size) { NRF24L01p_CE_Write(1); //Start listening. CyDelay(2); //Give it some time to receive the package. uint8_t status = ReadRegister(NRF24L01p_REGISTER_ADDRESS_STATUS); if(status&(0b1<<NRF24L01p_MNEMONIC_STATUS_RX_DR)) //Check if we received a package. { WriteRegister(NRF24L01p_REGISTER_ADDRESS_STATUS, 0b1<<NRF24L01p_MNEMONIC_STATUS_RX_DR); //Clear the bit that says we received a package. NRF24L01p_CS_Write(0); NRF24L01p_SPI_CONTROLLER_WriteTxData(NRF24L01p_INSTRUCTION_R_RX_PAYLOAD); //Prepare to read the payload. CyDelayUs(5); for(uint8_t c=0; c<size; c++) //Receive the data. { NRF24L01p_SPI_CONTROLLER_WriteTxData(NRF24L01p_INSTRUCTION_NOP); //Sending NOPs all day long. Sending NOPs while I sing this song. CyDelayUs(5); //Give the received data some time to settle in. data[c] = NRF24L01p_SPI_INPUT_REG_ReadRegValue(); } CyDelayUs(10); //TODO: Check why this one is here. NRF24L01p_CS_Write(1); NRF24L01p_CE_Write(0); NRF24L01p_SPI_CONTROLLER_WriteTxData(NRF24L01p_INSTRUCTION_FLUSH_RX); //Clean up any other packets. CyDelayUs(5); return true; } NRF24L01p_CE_Write(0); return false; }
bool BackendHelper::DumpAllRegisters(const QString& filename) { FileIoBackend b(filename, QString::fromStdString(m_soc.GetSoc().name)); BackendHelper bh(&b, m_soc); for(size_t i = 0; i < m_soc.GetSoc().dev.size(); i++) { const soc_dev_t& dev = m_soc.GetSoc().dev[i]; for(size_t j = 0; j < dev.addr.size(); j++) { QString devname = QString::fromStdString(dev.addr[j].name); for(size_t k = 0; k < dev.reg.size(); k++) { const soc_reg_t& reg = dev.reg[k]; for(size_t l = 0; l < reg.addr.size(); l++) { QString regname = QString::fromStdString(reg.addr[l].name); soc_word_t val; if(!ReadRegister(devname, regname, val)) return false; if(!bh.WriteRegister(devname, regname, val)) return false; } } } } return b.Commit(); }
U8 TryRecieveTestPacket( U8 radio ) { //check register for interrupt. if a valid packet is not RXed, return false. U8 status; U8 i; ReadRegister( radio, RFREG_INT_STATUS_2 ); status = ReadRegister( radio, RFREG_INT_STATUS_1 ); if( ( status & (1 << 1) ) == 0 ) return FALSE; //woot! we got a packet! for( i = 0; i < 17; ++i ) ReadRegister( radio, RFREG_FIFO_ACCESS ); return TRUE; }
void OGNRadio::SendPacket(uint8_t *Packet, uint16_t Size, uint16_t Freq, uint8_t TxPower) { uint8_t i; SetTxPower(TxPower); SetFrequency(Freq); WriteRegister(REG_PAYLOADLENGTH, Size); WriteRegister(REG_SYNCCONFIG,RF_SYNC_OFF); WriteRegister(REG_PREAMBLEMSB, 0x00); WriteRegister(REG_PREAMBLELSB, 0x80); ClearIRQFlags(); for(i=0;i<Size;i++) { WriteRegister(REG_FIFO,Packet[i]); } WriteRegister(REG_OPMODE , RF_DATAMODUL_MODULATIONTYPE_FSK | RF_OPMODE_LISTEN_OFF | RF_OPMODE_TRANSMITTER); do {} while( (ReadRegister(REG_IRQFLAGS2) & RF_IRQFLAGS2_PACKETSENT ) != RF_IRQFLAGS2_PACKETSENT); WriteRegister(REG_OPMODE, RF_DATAMODUL_MODULATIONTYPE_FSK | RF_OPMODE_LISTEN_OFF | RF_OPMODE_STANDBY); }
bool cs5463spi::CheckStatusReady(int bit){ uint8_t rx1[4]; memset(rx1, 0x00, sizeof(rx1)); bool bReady = false; //Reads Status Register ReadRegister(m_cs5463NumList[status].addr, rx1); uint8_t a = 0x01; int pos = 0; if(bit == drdy || bit == crdy){ pos = bit - 16; if((rx1[1] & (a << pos))) { // bits are in high byte bReady = true; } } else if(bit == tup) { pos = tup; } if((rx1[3] & (a << pos))) { // bit is in low byte. bReady = true; } return bReady; }
void SetHardwareAttenuator(unsigned char attenuatormode) { unsigned char old_value; old_value = ReadRegister(CONFIG_REG_ADDR); if (attenuatormode != 0) WriteRegister(CONFIG_REG_ADDR, old_value |= HARDWAREATT_SET_FLAG); else WriteRegister(CONFIG_REG_ADDR, old_value &= ~HARDWAREATT_SET_FLAG); }
void SetRadioEnabledState(unsigned char mode) { unsigned char old_value; old_value = ReadRegister(CONFIG_REG_ADDR); if (mode != 0) WriteRegister(CONFIG_REG_ADDR, old_value |= RADIO_ENABLED_FLAG); else WriteRegister(CONFIG_REG_ADDR, old_value &= ~RADIO_ENABLED_FLAG); }
int IsPacketReady(unsigned char* packet, int* packetsize) { unsigned int i; if ((packet == NULL) || (packetsize == NULL)) return 0; // return withour reading NULL pointer means uC reset if write if (GetStatus() & PACKET_READY_FLAG) { // a packet is ready ! *packetsize = ReadRegister(REC_BUFFER_START); // get size of received buffer if (*packetsize > COM_MODULE_MAXSIZE) return 0; // error in transmission. size is too big and impossible for (i = 0; i< *packetsize ; i++) { packet[i] = ReadRegister(REC_BUFFER_START+FIRSTDATA_IN_PACKET_OFFSET+i); } ReadRegister(REC_BUFFER_END); return 1; } for(i=0; i<0x1000; i++); // wait return 0; // no packet ready -> 0 }
void ConfigReadBackTest( U8 radio ) { ReadRegister( radio, RFREG_DEVICE_TYPE ); ReadRegister( radio, RFREG_DEVICE_VERSION ); ReadRegister( radio, RFREG_DEVICE_STATUS ); ReadRegister( radio, RFREG_TX_HEADER_3 ); ReadRegister( radio, RFREG_TX_HEADER_2 ); ReadRegister( radio, RFREG_TX_HEADER_1 ); ReadRegister( radio, RFREG_TX_HEADER_0 ); ReadRegister( radio, RFREG_TX_DATA_RATE_0 ); ReadRegister( radio, RFREG_TX_DATA_RATE_1 ); }
void CC_t::WaitUntilChannelIsBusy() { uint8_t b; for(uint32_t i=0; i<207; i++) { b = ReadRegister(CC_PKTSTATUS); if(b & 0b00010000) break; //Uart.Printf("C"); } //Uart.Printf("\r"); }
uint8_t BaseMapper::ReadRAM(uint16_t addr) { if(_allowRegisterRead && _isReadRegisterAddr[addr]) { return ReadRegister(addr); } else if(_prgPageAccessType[addr >> 8] & MemoryAccessType::Read) { return _prgPages[addr >> 8][(uint8_t)addr]; } else { //assert(false); } return MemoryManager::GetOpenBus();
//Write individual bits of the configure register void RfConfigure(BYTE bitNum, BYTE enable) { BYTE config = 0; config = ReadRegister(CONFIG); if (enable) config |= 1 << bitNum; else config &= ~(1 << bitNum); WriteRegister(CONFIG, config); }
PLUGIN_FUNCTION_ARG1(Open,const char *,device) { Close(); switch (m_eProductID) { case TJIP_TJ560BHANDSET_KEYPAD_HID : WriteRegister(0x0b, 100); // default is 48, now set to 100 ==> period = 100/2 = 50ms // Initialise beeper WriteRegister(0xa, 0x55); // set GIO[3:0] all output as 0b0000 WriteRegister(0x1a, 3); // set GIO[8] to high BYTE value; ReadRegister(0x1a, &value); // read back m_hasBeeper = (value & 0x2) == 0x2; WriteRegister(0x1a, m_hasBeeper ? 1 : 0); // GIO8 as Beeper control output 0 WriteRegister(0xa, 0); // Restore GIO[3:0] setting BYTE reg12, reg13; ReadRegister(0x12, ®12); WriteRegister(0x12, reg12 & 0xdf); // set AUX5 to low ReadRegister(0x13, ®13); WriteRegister(0x13, reg13 | 0x20); // set AUX5 to output WriteRegister(0x12, reg12); // restore original AUX data value WriteRegister(0x13, reg13); // restore original AUX control WriteRegister(0xc, 0); WriteRegister(0xd, 0); WriteRegister(0xe, 0); break; } m_hasDTMF = m_pTjIpSysCall(TJIP_INIT_DTMF_TO_PPG, 0, (void *)device) != 0; TJ_MIXER_OPEN tjMixerOpen; memset(&tjMixerOpen, 0, sizeof(tjMixerOpen)); strncpy(tjMixerOpen.szMixerName, device, sizeof(tjMixerOpen.szMixerName)-1); m_hasMixer = m_pTjIpSysCall(TJIP_OPEN_MIXER, 0, &tjMixerOpen) != 0; return PluginLID_UsesSoundChannel; }
uint8_t OGNRadio::CheckReceive(void) { if((ReadRegister(REG_IRQFLAGS2) & RF_IRQFLAGS2_PAYLOADREADY ) == RF_IRQFLAGS2_PAYLOADREADY) { return 1; } else { return 0; } }
bool BackendHelper::ReadRegisterField(const soc_desc::node_inst_t& inst, const QString& field, soc_word_t& v) { soc_desc::field_ref_t ref = inst.node().reg().field(field.toStdString()); if(!ref.valid()) return false; if(!ReadRegister(inst, v)) return false; v = (v & ref.get()->bitmask()) >> ref.get()->pos; return true; }
/** * Constructor. */ ADIS16448_IMU::ADIS16448_IMU() : m_spi(SPI::Port::kMXP) { m_spi.SetClockRate(1000000); m_spi.SetMSBFirst(); m_spi.SetSampleDataOnFalling(); m_spi.SetClockActiveLow(); m_spi.SetChipSelectActiveLow(); ReadRegister(kRegPROD_ID); // dummy read // Validate the part ID if (ReadRegister(kRegPROD_ID) != 16448) { DriverStation::ReportError("could not find ADIS16448"); return; } // Set IMU internal decimation to 102.4 SPS WriteRegister(kRegSMPL_PRD, 769); // Enable Data Ready (LOW = Good Data) on DIO1 (PWM0 on MXP) WriteRegister(kRegMSC_CTRL, 4); // Configure IMU internal Bartlett filter WriteRegister(kRegSENS_AVG, 1030); m_cmd[0] = kGLOB_CMD; m_cmd[1] = 0; // Configure interrupt on MXP DIO0 m_interrupt.reset(new InterruptSource(10)); m_interrupt->RequestInterrupts(); m_interrupt->SetUpSourceEdge(false, true); // Start monitoring thread m_freed = false; m_task = std::thread(&ADIS16448_IMU::Calculate, this); Calibrate(); //HALReport(HALUsageReporting::kResourceType_ADIS16448, 0); LiveWindow::GetInstance()->AddSensor("ADIS16448_IMU", 0, this); }
bool RegisterContextPOSIXProcessMonitor_arm64::WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value) { unsigned reg_to_write = reg; lldb_private::RegisterValue value_to_write = value; // Check if this is a subregister of a full register. const lldb_private::RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg); if (reg_info->invalidate_regs && (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM)) { lldb_private::RegisterValue full_value; uint32_t full_reg = reg_info->invalidate_regs[0]; const lldb_private::RegisterInfo *full_reg_info = GetRegisterInfoAtIndex(full_reg); // Read the full register. if (ReadRegister(full_reg_info, full_value)) { lldb_private::Error error; lldb::ByteOrder byte_order = GetByteOrder(); uint8_t dst[lldb_private::RegisterValue::kMaxRegisterByteSize]; // Get the bytes for the full register. const uint32_t dest_size = full_value.GetAsMemoryData (full_reg_info, dst, sizeof(dst), byte_order, error); if (error.Success() && dest_size) { uint8_t src[lldb_private::RegisterValue::kMaxRegisterByteSize]; // Get the bytes for the source data. const uint32_t src_size = value.GetAsMemoryData (reg_info, src, sizeof(src), byte_order, error); if (error.Success() && src_size && (src_size < dest_size)) { // Copy the src bytes to the destination. ::memcpy (dst + (reg_info->byte_offset & 0x1), src, src_size); // Set this full register as the value to write. value_to_write.SetBytes(dst, full_value.GetByteSize(), byte_order); value_to_write.SetType(full_reg_info); reg_to_write = full_reg; } } } } ProcessMonitor &monitor = GetMonitor(); return monitor.WriteRegisterValue(m_thread.GetID(), GetRegisterOffset(reg_to_write), GetRegisterName(reg_to_write), value_to_write); }