int i2c_read(unsigned char addr, unsigned char reg, unsigned char length, unsigned char *data) { StartTransfer(FALSE); TransmitOneByte((addr<<1) & 0b11111110); TransmitOneByte(reg); StartTransfer(TRUE); TransmitOneByte((addr<<1) | 0b00000001); int i; for(i = 0; i < length; i++) { I2CReceiverEnable(I2C2, TRUE); while(!I2CReceivedDataIsAvailable(I2C2)); if(i == length-1) { I2CAcknowledgeByte(I2C2, FALSE); } else { I2CAcknowledgeByte(I2C2, TRUE); } data[i] = I2CGetByte(I2C2); IdleI2C2(); } StopTransfer(); return 0; }
int demo_start_frame_buffer( demo_t *pdemo ) { if ( pdemo->bVerbose ) { xil_printf("VDMA 0 Initialization\r\n"); } XAxiVdma_Reset(pdemo->paxivdma0, XAXIVDMA_WRITE); XAxiVdma_Reset(pdemo->paxivdma0, XAXIVDMA_READ); WriteSetup(pdemo->paxivdma0, 0x10000000, 0, 1, 1, 0, 0, pdemo->hdmii_width, pdemo->hdmii_height, 2048, 2048); ReadSetup(pdemo->paxivdma0, 0x10000000, 0, 1, 1, 0, 0, pdemo->hdmio_width, pdemo->hdmio_height, 2048, 2048); StartTransfer(pdemo->paxivdma0); if ( pdemo->bVerbose ) { xil_printf("VDMA 1 Initialization\r\n"); } XAxiVdma_Reset(pdemo->paxivdma1, XAXIVDMA_WRITE); XAxiVdma_Reset(pdemo->paxivdma1, XAXIVDMA_READ); WriteSetup(pdemo->paxivdma1, 0x18000000, 0, 1, 1, 0, 0, 1280, 1024, 2048, 2048); ReadSetup(pdemo->paxivdma1, 0x18000000, 0, 1, 1, 0, 0, 1280, 1024, 2048, 2048); StartTransfer(pdemo->paxivdma1); if ( pdemo->bVerbose ) { xil_printf("OSD Initialization (hdmi=0x%02X, cam=0x%02X)\r\n", pdemo->hdmi_alpha, pdemo->cam_alpha); } XOSD_Reset(pdemo->posd); XOSD_RegUpdateEnable(pdemo->posd); XOSD_Enable(pdemo->posd); XOSD_SetScreenSize(pdemo->posd, pdemo->hdmio_width, pdemo->hdmio_height); XOSD_SetBackgroundColor(pdemo->posd, 0x80, 0x80, 0x80); // Layer 0 - HDMI input XOSD_SetLayerPriority(pdemo->posd, 0, XOSD_LAYER_PRIORITY_0); XOSD_SetLayerAlpha(pdemo->posd, 0, 1, pdemo->hdmi_alpha); XOSD_SetLayerDimension(pdemo->posd, 0, 0, 0, pdemo->hdmio_width, pdemo->hdmio_height); // Layer 1 - PYTHON-1300 camera XOSD_SetLayerPriority(pdemo->posd, 1, XOSD_LAYER_PRIORITY_1); XOSD_SetLayerAlpha(pdemo->posd, 1, 1, pdemo->cam_alpha); XOSD_SetLayerDimension(pdemo->posd, 1, 0, 0, 1280, 1024); XOSD_EnableLayer(pdemo->posd, 0); XOSD_EnableLayer(pdemo->posd, 1); return 1; }
void SongSender::SendSongs(const pb::remote::RequestDownloadSongs& request) { Song current_song; if (app_->player()->GetCurrentItem()) { current_song = app_->player()->GetCurrentItem()->Metadata(); } switch (request.download_item()) { case pb::remote::CurrentItem: { if (current_song.is_valid()) { DownloadItem item(current_song, 1, 1); download_queue_.append(item); } break; } case pb::remote::ItemAlbum: if (current_song.is_valid()) { SendAlbum(current_song); } break; case pb::remote::APlaylist: SendPlaylist(request.playlist_id()); break; case pb::remote::Urls: SendUrls(request); break; default: break; } if (transcode_lossless_files_) { TranscodeLosslessFiles(); } else { StartTransfer(); } }
/***************************************************************************//** * @brief * Start a memory to peripheral ping-pong DMA transfer. * * @param[in] channelId * Not used * * @param[in] peripheralSignal * Selects which peripheral/peripheralsignal to use. * * @param[in] dst * Destination (peripheral register) memory address. * * @param[in] src0 * Source memory address of first (ping) buffer. * * @param[in] src1 * Source memory address of second (pong) buffer. * * @param[in] srcInc * Set to true to enable source address increment (increment is according to * @a size parameter). * * @param[in] len * Number if items (of @a size size) to transfer. * * @param[in] size * Item size, byte, halfword or word. * * @param[in] callback * Function to call on dma completion, use NULL if not needed. * * @param[in] cbUserParam * Optional user parameter to feed to the callback function. Use NULL if * not needed. * * @return * @ref ECODE_EMDRV_DMADRV_OK on success. On failure an appropriate * DMADRV @ref Ecode_t is returned. ******************************************************************************/ Ecode_t DMADRV_MemoryPeripheralPingPong( unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst, void *src0, void *src1, bool srcInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam ) { return StartTransfer( dmaModePingPong, dmaDirectionMemToPeripheral, channelId, peripheralSignal, dst, src0, src1, srcInc, len, size, callback, cbUserParam ); }
SongSender::SongSender(Application* app, RemoteClient* client) : app_(app), client_(client), transcoder_(new Transcoder(this, NetworkRemote::kTranscoderSettingPostfix)) { QSettings s; s.beginGroup(NetworkRemote::kSettingsGroup); transcode_lossless_files_ = s.value("convert_lossless", false).toBool(); // Load preset QString last_output_format = s.value("last_output_format", "audio/x-vorbis").toString(); QList<TranscoderPreset> presets = transcoder_->GetAllPresets(); for (int i = 0; i<presets.count(); ++i) { if (last_output_format == presets.at(i).codec_mimetype_) { transcoder_preset_ = presets.at(i); break; } } qLog(Debug) << "Transcoder preset" << transcoder_preset_.codec_mimetype_; connect(transcoder_, SIGNAL(JobComplete(QString, QString, bool)), SLOT(TranscodeJobComplete(QString, QString, bool))); connect(transcoder_, SIGNAL(AllJobsComplete()), SLOT(StartTransfer())); total_transcode_ = 0; }
/***************************************************************************//** * @brief * Start a peripheral to memory ping-pong DMA transfer. * * @param[in] channelId * Not used * * @param[in] peripheralSignal * Selects which peripheral/peripheralsignal to use. * * @param[in] dst0 * Destination memory address of first (ping) buffer. * * @param[in] dst1 * Destination memory address of second (pong) buffer. * * @param[in] src * Source memory (peripheral register) address. * * @param[in] dstInc * Set to true to enable destination address increment (increment is according * to @a size parameter). * * @param[in] len * Number if items (of @a size size) to transfer. * * @param[in] size * Item size, byte, halfword or word. * * @param[in] callback * Function to call on dma completion, use NULL if not needed. * * @param[in] cbUserParam * Optional user parameter to feed to the callback function. Use NULL if * not needed. * * @return * @ref ECODE_EMDRV_DMADRV_OK on success. On failure an appropriate * DMADRV @ref Ecode_t is returned. ******************************************************************************/ Ecode_t DMADRV_PeripheralMemoryPingPong( unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst0, void *dst1, void *src, bool dstInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam ) { return StartTransfer( dmaModePingPong, dmaDirectionPeripheralToMem, channelId, peripheralSignal, dst0, dst1, src, dstInc, len, size, callback, cbUserParam ); }
BOOL I2Csend(UINT8 address, int length, const UINT8* buffer) { BOOL success = TRUE; // Start the transfer for writing data to the LCD. if (StartTransfer(FALSE)) { I2C_7_BIT_ADDRESS SlaveAddress; I2C_FORMAT_7_BIT_ADDRESS(SlaveAddress, address, I2C_WRITE); if (TransmitOneByte(SlaveAddress.byte)) { const char* cp; // Call TransmitOneByte() for each non-null character in the string. // Stop with success set to false if TransmitOneByte() returns failure. int index = 0; while (index < length) { success = TransmitOneByte(*buffer); index++; buffer++; } if (success) { StopTransfer(); } } else { success = FALSE; } } else { success = FALSE; } return success; }
// blocking call starts a rx or tx transaction static DWORD SendRecvData( UINT32 epNum, DWORD dir, UINT8 *pData, UINT32 cbDataLen, DWORD flags ) { DWORD dwStartSec, dwSec; DWORD dwRet; EPTransfer* pTransfer = &m_epTransfers[epNum]; USBDBGMSG(USBDBG_ZONE_FUNC, (L"usbdbg:+SendRecvData. ep%d\r\n", epNum)); dwStartSec = OEMKitlGetSecs(); // start rx or tx transfer StartTransfer(epNum, dir, pData, cbDataLen, flags); // loop until all data sent while(pTransfer->status & USBDBG_TRANSFER_STATUS_INPROGRESS) { UsbRndis_EventHandler(); dwSec = OEMKitlGetSecs(); // timed out sending data? if ((INT32)(dwSec - dwStartSec) > SEND_RECV_TIME_OUT) { USBDBGMSG(USBDBG_ZONE_ERROR, ( L"ERROR!UsbDbg: ep%d dir=%d timed out tx/rx data." L"dwSec=%d, dwStartSec=%d\r\n", epNum, dir, dwSec, dwStartSec)); dwRet = ERROR_TIMEOUT; AbortTransfer(epNum, dir); goto clean; } } if (pTransfer->status & USBDBG_TRANSFER_STATUS_COMPLETE) { dwRet = ERROR_SUCCESS; } else { dwRet = ERROR_IO_INCOMPLETE; } clean: USBDBGMSG(USBDBG_ZONE_FUNC, (L"usbdbg:-SendRecvData. ep%d\r\n", epNum)); return dwRet; }
int i2c_write(unsigned char addr, unsigned char reg, unsigned char length, unsigned char *data) { while( !I2CBusIsIdle(I2C2) ); StartTransfer(FALSE); TransmitOneByte((addr<<1) & 0b11111110); TransmitOneByte(reg); int i; for(i = 0; i < length; i++) { TransmitOneByte(data[i]); } StopTransfer(); return 0; }
//------------------------------------------------------------------------------ // Function: I2C_WriteBlock // Description: Write a block of bytes to the spacifed I2C slave address at the specified offset. // The offset address is one byte (8 bit offset only). // The return code is always 0. There is no indication in case of error. //------------------------------------------------------------------------------ BYTE I2C_WriteBlock(BYTE deviceID, BYTE offset, BYTE buffer, WORD length) { BYTE write_buffer[256]; // memset(write_buffer, 0, sizeof(write_buffer)); WORD count; BOOL Success = TRUE; write_buffer[0] = deviceID; write_buffer[1] = offset; write_buffer[2] = buffer; write_buffer[3] = 0x06; // Start the transfer to write data to the EEPROM if( !StartTransfer(FALSE) ) { while(1); } // Transmit all data count = 0; while( Success && (count < (length + 2)) ) { // Transmit a byte TransmitOneByte(write_buffer[count]); // Advance to the next byte count++; // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged(OVM7690_I2C_BUS)) { Success = FALSE; } } // End the transfer (hang here if an error occured) StopTransfer(); if(!Success) { while(1); } return(0); }
// Called by RndisMin to receive data packets (over EP3 BULK OUT) // DWORD UsbRndis_RecvData( PBYTE pbBuffer, DWORD cbBufSize ) { DWORD cbRecvdData = 0; DWORD epNum = BULKOUT_ENDPT; // data comes in on BULK OUT EP3 DWORD retryCnt = 0; EPTransfer* pTransfer = &m_epTransfers[epNum]; #define RECV_RETRY_COUNT 20 USBDBGMSG(USBDBG_ZONE_FUNC, (L"usbdbg:+UsbRndis_RecvData.\r\n")); // call common events handler if rx in progress while ((pTransfer->status & USBDBG_TRANSFER_STATUS_INPROGRESS) && (retryCnt++ < RECV_RETRY_COUNT)) { UsbRndis_EventHandler(); } if (pTransfer->status & USBDBG_TRANSFER_STATUS_COMPLETE) { // copy to return buffer cbRecvdData = RndisPdd_ProcessRecvdData(pTransfer->pbBuffer, pTransfer->cbTransferred, pbBuffer, cbBufSize); } //clean: // if a transfer is not in progress start next transfer if (!(pTransfer->status & USBDBG_TRANSFER_STATUS_INPROGRESS)) { StartTransfer(epNum, ENDPT_DIR_RX, &m_BulkRxPktBuf[0], sizeof(m_BulkRxPktBuf), 0); } USBDBGMSG(USBDBG_ZONE_FUNC, (L"usbdbg:-UsbRndis_RecvData.\r\n")); return cbRecvdData; }
void i2c_write(I2C_MODULE i2c_id, uint8_t address, uint8_t *data, int len) { uint8_t i2cBuffer[len+1]; int i; i2cBuffer[0] = address | 0x00; memcpy(&i2cBuffer[1], data, len); if (!StartTransfer(i2c_id, FALSE)) { return; } for (i = 0; i < len+1; i++) { if (!TransmitOneByte(i2c_id, i2cBuffer[i])) { break; } } StopTransfer(i2c_id); }
FileTransferWidget::FileTransferWidget(MRIMClient* aClient, FileTransferRequest aReq, QString aLocation, QWidget *parent) : QWidget(parent), m_ui(new Ui::FileTransferWidget), m_req(aReq), m_speedBytes(0), m_client(aClient), m_location(aLocation) { m_ui->setupUi(this); move(MRIMCommonUtils::DesktopCenter(size())); setWindowIcon(MRIMPluginSystem::PluginSystem()->getIcon("save_all")); setWindowTitle(tr("File transfer with: %1").arg(m_req.From)); m_ui->doneLabel->setText("0"); m_ui->statusLabel->setText(tr("Waiting...")); setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_DeleteOnClose, true); if (m_location.length() > 0 && m_req.From.length() > 0) m_transferMode = TM_RECIEVE_CLIENT; else { m_transferMode = TM_SEND_SERVER; } StartTransfer(); }
void SongSender::TranscodeLosslessFiles() { for (DownloadItem item : download_queue_) { // Check only lossless files if (!item.song_.IsFileLossless()) continue; // Add the file to the transcoder QString local_file = item.song_.url().toLocalFile(); transcoder_->AddTemporaryJob(local_file, transcoder_preset_); qLog(Debug) << "transcoding" << local_file; total_transcode_++; } if (total_transcode_ > 0) { transcoder_->Start(); SendTranscoderStatus(); } else { StartTransfer(); } }
void i2c_read(I2C_MODULE i2c_id, uint8_t address, uint8_t *data, uint16_t len) { uint16_t i; if (!StartTransfer(i2c_id, FALSE)) { return; } if (!TransmitOneByte(i2c_id, (address | 0x01))) { return; } for (i = 0; i < len; i++) { if (i < len-1) // send ACK data[i] = ReceiveOneByte(i2c_id, TRUE); else // send NACK data[i] = ReceiveOneByte(i2c_id, FALSE); } StopTransfer(i2c_id); }
//------------------------------------------------------------------------------ // Function: I2C_ReadBlock // Description: Read a block of bytes from the spacifed I2C slave address at the specified offset. // The offset address is one byte (8 bit offset only). // The return code is always 0. There is no indication in case of error. //------------------------------------------------------------------------------ BYTE I2C_ReadBlock(BYTE deviceID, BYTE offset, BYTE *buffer, WORD length) { BYTE write_buffer[2] = {0x00}; BYTE count =0; BOOL Success = TRUE; write_buffer[0] = deviceID; write_buffer[1] = offset; // Start the transfer to write data to the EEPROM if(!StartTransfer(FALSE) ) { while(1); } // Transmit all data count = 0; while( Success && (count < (2)) ) { // Transmit a byte TransmitOneByte(write_buffer[count]); // Advance to the next byte count++; // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged(OVM7690_I2C_BUS)) { Success = FALSE; } } // Start the transfer to read data StartTransfer(TRUE); // Transmit the address with the READ bit set deviceID |= 0x01; TransmitOneByte(deviceID); // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged(OVM7690_I2C_BUS)) { Success = FALSE; } for(count=0;count<length;count++) { // Read the data from the desired address if(Success) { if(I2CReceiverEnable(OVM7690_I2C_BUS, TRUE) == I2C_RECEIVE_OVERFLOW) { Success = FALSE; } else { // while(!I2CReceivedDataIsAvailable(OVM7690_I2C_BUS)); *buffer++ = I2CGetByte(OVM7690_I2C_BUS); } } } // End the transfer (stop here if an error occured) StopTransfer(); return(0); }
void avnet_config_vgap60_video(demo_t *pInstance) { int status; Xil_Out32(XPAR_TCM_RECEIVER_0_S00_AXI_BASEADDR + 0x0000, 0x0001); XCfa_Reset(pInstance->pcfa); XCcm_Reset(pInstance->pccm); XRgb2YCrCb_Reset(pInstance->prgb2ycrcb); XCresample_Reset(pInstance->pcresample); XAxiVdma_Reset(pInstance->paxivdma, XAXIVDMA_WRITE); XAxiVdma_Reset(pInstance->paxivdma, XAXIVDMA_READ); XVtc_Reset(pInstance->pvtc); XOSD_Reset(pInstance->posd); /* CLKWIZ */ Xil_Out32(XPAR_CLK_WIZ_1_BASEADDR + 0x0200, 0x00002203); Xil_Out32(XPAR_CLK_WIZ_1_BASEADDR + 0x0208, 0x0000002D); Xil_Out32(XPAR_CLK_WIZ_1_BASEADDR + 0x025C, 0x00000007); Xil_Out32(XPAR_CLK_WIZ_1_BASEADDR + 0x025C, 0x00000002); status = 0; while (!status) { status = Xil_In32(XPAR_CLK_WIZ_1_BASEADDR + 0x0004); } /* ISERDES Reset Assert */ Xil_Out32(XPAR_TCM_RECEIVER_0_S00_AXI_BASEADDR + 0x0000, 0x0001); /* TCM Initialization */ tca9548_i2c_mux_select(pInstance->piicps, EMBV_IIC_MUX_CAM); // tcm5117pl_get_chip_id(pInstance->piicps); tcm5117pl_init(pInstance->piicps, TCM5117PL_VGAP60); /* CFA */ XCfa_Reset(pInstance->pcfa); XCfa_Enable(pInstance->pcfa); XCfa_SetBayerPhase(pInstance->pcfa, 0x00000001); XCfa_SetActiveSize(pInstance->pcfa, 656, 496); XCfa_RegUpdateEnable(pInstance->pcfa); /* CCM */ XCcm_Reset(pInstance->pccm); XCcm_Enable(pInstance->pccm); XCcm_SetCoefMatrix(pInstance->pccm, &CCM_IDENTITY); XCcm_SetRgbOffset(pInstance->pccm, 0, 0, 0); XCcm_SetActiveSize(pInstance->pccm, 656, 496); XCcm_RegUpdateEnable(pInstance->pccm); /* RGB2YCRCB */ XRgb2YCrCb_Reset(pInstance->prgb2ycrcb); XRgb2YCrCb_Enable(pInstance->prgb2ycrcb); XRgb2YCrCb_Configuration(pInstance->prgb2ycrcb, XRGB_STANDARD_ITU_601_SD, XRGB_TV_16_TO_240, XRGB_DATA_WIDTH_10); XRgb2YCrCb_SetActiveSize(pInstance->prgb2ycrcb, 656, 496); XRgb2YCrCb_RegUpdateEnable(pInstance->prgb2ycrcb); /* CRESAMPLE */ XCresample_Reset(pInstance->pcresample); XCresample_Enable(pInstance->pcresample); XCresample_Configuration(pInstance->pcresample); XCresample_SetActiveSize(pInstance->pcresample, 656, 496); XCresample_RegUpdateEnable(pInstance->pcresample); /* AXIVDMA */ XAxiVdma_Reset(pInstance->paxivdma, XAXIVDMA_WRITE); XAxiVdma_Reset(pInstance->paxivdma, XAXIVDMA_READ); ReadSetup(pInstance->paxivdma, 0x30000000, 2, 0, 1, 1, 0, 0, 656, 496, 2048, 2048); WriteSetup(pInstance->paxivdma, 0x30000000, 2, 0, 1, 1, 0, 0, 656, 496, 2048, 2048); StartTransfer(pInstance->paxivdma); /* VTC */ XVtc_Timing Timing; XVtc_Reset(pInstance->pvtc); XVtc_RegUpdateEnable(pInstance->pvtc); XVtc_Enable(pInstance->pvtc); XVtc_ConvVideoMode2Timing(pInstance->pvtc, XVTC_VMODE_VGA, &Timing); Timing.HSyncPolarity = 1; Timing.VSyncPolarity = 1; XVtc_SetGeneratorTiming(pInstance->pvtc, &Timing); /* OSD */ XOSD_Reset(pInstance->posd); XOSD_RegUpdateEnable(pInstance->posd); XOSD_Enable(pInstance->posd); XOSD_SetScreenSize(pInstance->posd, 656, 496); XOSD_SetBackgroundColor(pInstance->posd, 0x80, 0x80, 0x80); // Layer 0 - Test Pattern Generator XOSD_SetLayerPriority(pInstance->posd, 0, XOSD_LAYER_PRIORITY_0); XOSD_SetLayerAlpha(pInstance->posd, 0, 1, 0xFF); XOSD_SetLayerDimension(pInstance->posd, 0, 0, 0, 656, 496); XOSD_EnableLayer(pInstance->posd, 0); // ISERDES Reset De-Assert Xil_Out32(XPAR_TCM_RECEIVER_0_S00_AXI_BASEADDR + 0x0000, 0x0000); }
/** * * Main function * * This function is the main entry point of the example on DMA core. It sets up * DMA engine to be ready to receive and send frames, and start the transfers. * It waits for the transfer of the specified number of frame sets, and check * for transfer errors. * * @return * - XST_SUCCESS if example finishes successfully * - XST_FAILURE if example fails. * * @note None. * ******************************************************************************/ int vdma_setup(XIntc controller) { Intc = controller; int Status; XAxiVdma_Config *Config; XAxiVdma_FrameCounter FrameCfg; WriteDone = 0; ReadDone = 0; WriteError = 0; ReadError = 0; ReadFrameAddr = READ_ADDRESS_BASE; WriteFrameAddr = WRITE_ADDRESS_BASE; xil_printf("\r\n--- Entering vdma_setup() --- \r\n"); /* The information of the XAxiVdma_Config comes from hardware build. * The user IP should pass this information to the AXI DMA core. */ Config = XAxiVdma_LookupConfig(DMA_DEVICE_ID); if (!Config) { xil_printf( "No video DMA found for ID %d\r\n", DMA_DEVICE_ID); return XST_FAILURE; } /* Initialize DMA engine */ Status = XAxiVdma_CfgInitialize(&AxiVdma, Config, Config->BaseAddress); if (Status != XST_SUCCESS) { xil_printf( "Configuration Initialization failed %d\r\n", Status); return XST_FAILURE; } Status = XAxiVdma_SetFrmStore(&AxiVdma, NUMBER_OF_READ_FRAMES, XAXIVDMA_READ); if (Status != XST_SUCCESS) { xil_printf( "Setting Frame Store Number Failed in Read Channel" " %d\r\n", Status); return XST_FAILURE; } Status = XAxiVdma_SetFrmStore(&AxiVdma, NUMBER_OF_WRITE_FRAMES, XAXIVDMA_WRITE); if (Status != XST_SUCCESS) { xil_printf( "Setting Frame Store Number Failed in Write Channel" " %d\r\n", Status); return XST_FAILURE; } /* Setup frame counter and delay counter for both channels * * This is to monitor the progress of the test only * * WARNING: In free-run mode, interrupts may overwhelm the system. * In that case, it is better to disable interrupts. */ FrameCfg.ReadFrameCount = NUMBER_OF_READ_FRAMES; FrameCfg.WriteFrameCount = NUMBER_OF_WRITE_FRAMES; FrameCfg.ReadDelayTimerCount = DELAY_TIMER_COUNTER; FrameCfg.WriteDelayTimerCount = DELAY_TIMER_COUNTER; Status = XAxiVdma_SetFrameCounter(&AxiVdma, &FrameCfg); if (Status != XST_SUCCESS) { xil_printf( "Set frame counter failed %d\r\n", Status); if(Status == XST_VDMA_MISMATCH_ERROR) xil_printf("DMA Mismatch Error\r\n"); return XST_FAILURE; } /* * Setup your video IP that writes to the memory */ /* Setup the write channel */ Status = WriteSetup(&AxiVdma); if (Status != XST_SUCCESS) { xil_printf( "Write channel setup failed %d\r\n", Status); if(Status == XST_VDMA_MISMATCH_ERROR) xil_printf("DMA Mismatch Error\r\n"); return XST_FAILURE; } /* * Setup your video IP that reads from the memory */ /* Setup the read channel */ Status = ReadSetup(&AxiVdma); if (Status != XST_SUCCESS) { xil_printf( "Read channel setup failed %d\r\n", Status); if(Status == XST_VDMA_MISMATCH_ERROR) xil_printf("DMA Mismatch Error\r\n"); return XST_FAILURE; } Status = SetupIntrSystem(&AxiVdma, READ_INTR_ID, WRITE_INTR_ID); if (Status != XST_SUCCESS) { xil_printf( "Setup interrupt system failed %d\r\n", Status); return XST_FAILURE; } /* Register callback functions */ // XAxiVdma_SetCallBack(&AxiVdma, XAXIVDMA_HANDLER_GENERAL, ReadCallBack, // (void *)&AxiVdma, XAXIVDMA_READ); // // XAxiVdma_SetCallBack(&AxiVdma, XAXIVDMA_HANDLER_ERROR, // ReadErrorCallBack, (void *)&AxiVdma, XAXIVDMA_READ); XAxiVdma_SetCallBack(&AxiVdma, XAXIVDMA_HANDLER_GENERAL, WriteCallBack, (void *)&AxiVdma, XAXIVDMA_WRITE); XAxiVdma_SetCallBack(&AxiVdma, XAXIVDMA_HANDLER_ERROR, WriteErrorCallBack, (void *)&AxiVdma, XAXIVDMA_WRITE); /* Enable your video IP interrupts if needed */ /* Start the DMA engine to transfer */ Status = StartTransfer(&AxiVdma); if (Status != XST_SUCCESS) { if(Status == XST_VDMA_MISMATCH_ERROR) xil_printf("DMA Mismatch Error\r\n"); return XST_FAILURE; } /* Enable DMA read and write channel interrupts * * If interrupts overwhelms the system, please do not enable interrupt */ // XAxiVdma_IntrEnable(&AxiVdma, XAXIVDMA_IXR_FRMCNT_MASK, XAXIVDMA_WRITE); // XAxiVdma_IntrEnable(&AxiVdma, XAXIVDMA_IXR_FRMCNT_MASK, XAXIVDMA_READ); /* Every set of frame buffer finish causes a completion interrupt */ // while ((WriteDone < NUM_TEST_FRAME_SETS) && !ReadError && // (ReadDone < NUM_TEST_FRAME_SETS) && !WriteError) { // /* NOP */ // } // if (ReadError || WriteError) { // xil_printf("Test has transfer error %d/%d\r\n", // ReadError, WriteError); // // Status = XST_FAILURE; // } // else { // xil_printf("Test passed\r\n"); // } xil_printf("\r\n--- Exiting vdma_setup() --- \r\n"); // DisableIntrSystem(READ_INTR_ID, WRITE_INTR_ID); if (Status != XST_SUCCESS) { if(Status == XST_VDMA_MISMATCH_ERROR) xil_printf("DMA Mismatch Error\r\n"); return XST_FAILURE; } return XST_SUCCESS; }
void WriteCommandByte(BYTE command) { switch (command) { case DSP_GET_VERSION: dprintf2(("Command - Get Version")); DSPReadState = FirstVersionByte; break; case DSP_CARD_IDENTIFY: dprintf2(("Command - Identify")); DSPWriteState = CardIdent; break; case DSP_SPEAKER_ON: dprintf2(("Command - Speaker ON")); SetSpeaker(TRUE); Pause(); break; case DSP_SPEAKER_OFF: dprintf2(("Command - Speaker OFF")); SetSpeaker(FALSE); Pause(); break; case DSP_SET_SAMPLE_RATE: DSPWriteState = SetTimeConstant; break; case DSP_SET_BLOCK_SIZE: DSPWriteState = BlockSizeFirstByte; break; case DSP_WRITE: dprintf2(("Command - Write - non Auto")); DSPWriteState = BlockSizeFirstByteWrite; break; case DSP_DIRECT_WAVE_OUT: dprintf2(("Command - Direct output")); DSPWriteState = DirectWaveOut; break; case DSP_WRITE_AUTO: dprintf2(("Command - Write - Auto")); StartTransfer(FALSE, TRUE); break; case DSP_READ: dprintf2(("Command - Read - non Auto")); DSPWriteState = BlockSizeFirstByteRead; break; case DSP_READ_AUTO: dprintf2(("Command - Read - Auto")); StartTransfer(TRUE, TRUE); break; case DSP_HALT_DMA: dprintf2(("Command - Halt DMA")); Pause(); break; case DSP_CONTINUE_DMA: dprintf2(("Command - Continue DMA")); Continue(); break; case DSP_STOP_AUTO: dprintf2(("Command - Stop DMA")); StopAuto(); break; case DSP_GENERATE_INT: dprintf2(("Command - Generate interrupt DMA")); GenerateInterrupt(); break; default: dprintf2(("Unrecognized DSP command %2X", command)); } }
int main(void) { UINT8 i2cData[10]; I2C_7_BIT_ADDRESS SlaveAddress; int Index; int DataSz; UINT32 actualClock; BOOL Acknowledged; BOOL Success = TRUE; UINT8 i2cbyte; // Initialize debug messages (when supported) DBINIT(); // Set the I2C baudrate actualClock = I2CSetFrequency(EEPROM_I2C_BUS, GetPeripheralClock(), I2C_CLOCK_FREQ); if ( abs(actualClock-I2C_CLOCK_FREQ) > I2C_CLOCK_FREQ/10 ) { DBPRINTF("Error: I2C1 clock frequency (%u) error exceeds 10%%.\n", (unsigned)actualClock); } // Enable the I2C bus I2CEnable(EEPROM_I2C_BUS, TRUE); // // Send the data to EEPROM to program one location // // Initialize the data buffer I2C_FORMAT_7_BIT_ADDRESS(SlaveAddress, EEPROM_ADDRESS, I2C_WRITE); i2cData[0] = SlaveAddress.byte; i2cData[1] = 0x05; // EEPROM location to program (high address byte) i2cData[2] = 0x40; // EEPROM location to program (low address byte) i2cData[3] = 0xAA; // Data to write DataSz = 4; // Start the transfer to write data to the EEPROM if( !StartTransfer(FALSE) ) { while(1); } // Transmit all data Index = 0; while( Success && (Index < DataSz) ) { // Transmit a byte if (TransmitOneByte(i2cData[Index])) { // Advance to the next byte Index++; // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged(EEPROM_I2C_BUS)) { DBPRINTF("Error: Sent byte was not acknowledged\n"); Success = FALSE; } } else { Success = FALSE; } } // End the transfer (hang here if an error occured) StopTransfer(); if(!Success) { while(1); } // Wait for EEPROM to complete write process, by polling the ack status. Acknowledged = FALSE; do { // Start the transfer to address the EEPROM if( !StartTransfer(FALSE) ) { while(1); } // Transmit just the EEPROM's address if (TransmitOneByte(SlaveAddress.byte)) { // Check to see if the byte was acknowledged Acknowledged = I2CByteWasAcknowledged(EEPROM_I2C_BUS); } else { Success = FALSE; } // End the transfer (stop here if an error occured) StopTransfer(); if(!Success) { while(1); } } while (Acknowledged != TRUE); // // Read the data back from the EEPROM. // // Initialize the data buffer I2C_FORMAT_7_BIT_ADDRESS(SlaveAddress, EEPROM_ADDRESS, I2C_WRITE); i2cData[0] = SlaveAddress.byte; i2cData[1] = 0x05; // EEPROM location to read (high address byte) i2cData[2] = 0x40; // EEPROM location to read (low address byte) DataSz = 3; // Start the transfer to read the EEPROM. if( !StartTransfer(FALSE) ) { while(1); } // Address the EEPROM. Index = 0; while( Success & (Index < DataSz) ) { // Transmit a byte if (TransmitOneByte(i2cData[Index])) { // Advance to the next byte Index++; } else { Success = FALSE; } // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged(EEPROM_I2C_BUS)) { DBPRINTF("Error: Sent byte was not acknowledged\n"); Success = FALSE; } } // Restart and send the EEPROM's internal address to switch to a read transfer if(Success) { // Send a Repeated Started condition if( !StartTransfer(TRUE) ) { while(1); } // Transmit the address with the READ bit set I2C_FORMAT_7_BIT_ADDRESS(SlaveAddress, EEPROM_ADDRESS, I2C_READ); if (TransmitOneByte(SlaveAddress.byte)) { // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged(EEPROM_I2C_BUS)) { DBPRINTF("Error: Sent byte was not acknowledged\n"); Success = FALSE; } } else { Success = FALSE; } } // Read the data from the desired address if(Success) { if(I2CReceiverEnable(EEPROM_I2C_BUS, TRUE) == I2C_RECEIVE_OVERFLOW) { DBPRINTF("Error: I2C Receive Overflow\n"); Success = FALSE; } else { while(!I2CReceivedDataIsAvailable(EEPROM_I2C_BUS)); i2cbyte = I2CGetByte(EEPROM_I2C_BUS); } } // End the transfer (stop here if an error occured) StopTransfer(); if(!Success) { while(1); } // Validate the data read if( i2cbyte != 0xAA ) { DBPRINTF("Error: Verify failed\n"); } else { DBPRINTF("Success\n"); } // Example complete while(1); }
SongSender::~SongSender() { disconnect(transcoder_, SIGNAL(JobComplete(QString, QString, bool)), this, SLOT(TranscodeJobComplete(QString, QString, bool))); disconnect(transcoder_, SIGNAL(AllJobsComplete()), this, SLOT(StartTransfer())); transcoder_->Cancel(); }
BOOL MPU6050::writeReg(UINT8 regAddress, UINT8 data) { UINT8 i2cData[10]; I2C_7_BIT_ADDRESS SlaveAddress; int Index; int DataSz; BOOL Acknowledged = FALSE; BOOL Success = TRUE; //sprintf(filename, "Starting writeReg().\n"); //putsUART1( filename ); // Initialize the data buffer I2C_FORMAT_7_BIT_ADDRESS(SlaveAddress, this->deviceAddress, I2C_WRITE); i2cData[0] = SlaveAddress.byte; i2cData[1] = regAddress; // Register Address to write i2cData[2] = data; // Data to write DataSz = 3; // Start the transfer if( !StartTransfer(FALSE) ) { Success = FALSE; sprintf( filename, "Error in #1 StartTransfer(): when writing address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } // Transmit all data Index = 0; while( Success && (Index < DataSz) ) { // Transmit a byte if (TransmitOneByte(i2cData[Index++])) { // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged( this->i2cBusId )) { Success = FALSE; sprintf( filename, "Error in #1 I2CByteWasAcknowledged(): when writing address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } } else { Success = FALSE; sprintf( filename, "Error in #1 TransmitOneByte(): when writing address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } } //sprintf(filename, "Before StopTransfer()\n"); //putsUART1( filename ); // End the transfer StopTransfer(); //sprintf(filename, "After StopTransfer()\n"); //putsUART1( filename ); // Wait for device to complete write process, by polling the ack status. while(Acknowledged != TRUE && Success != FALSE) { //sprintf(filename, "Inside the loop\n"); //putsUART1( filename ); // Start the transfer if( StartTransfer(FALSE) ) { // Transmit just the device's address if (TransmitOneByte(SlaveAddress.byte)) { // Check to see if the byte was acknowledged Acknowledged = I2CByteWasAcknowledged( this->i2cBusId ); /*if( !Acknowledged ) { sprintf( filename, "!Acknowledged %u.\n", (unsigned)regAddress ); putsUART1( filename ); }*/ } else { Success = FALSE; sprintf( filename, "Error in #2 TransmitOneByte() - !starttranfer : when writing address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } // End the transfer StopTransfer(); } else { Success = FALSE; sprintf( filename, "Error in #2 StartTransfer(): when writing address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } } //sprintf(filename, "After the loop\n"); //putsUART1( filename ); if( !Success ) { sprintf( filename, "Error in writeReg(): when writing to address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } return Success; }
void AHCIPort::ExecuteSataRequest(sata_request *request, bool isWrite) { FLOW("ExecuteAtaRequest port %d\n", fIndex); StartTransfer(); int prdEntrys; if (request->ccb() && request->ccb()->data_length) { FillPrdTable(fPRDTable, &prdEntrys, PRD_TABLE_ENTRY_COUNT, request->ccb()->sg_list, request->ccb()->sg_count, request->ccb()->data_length); } else if (request->data() && request->size()) { FillPrdTable(fPRDTable, &prdEntrys, PRD_TABLE_ENTRY_COUNT, request->data(), request->size()); } else prdEntrys = 0; FLOW("prdEntrys %d\n", prdEntrys); fCommandList->prdtl_flags_cfl = 0; fCommandList->cfl = 5; // 20 bytes, length in DWORDS memcpy((char *)fCommandTable->cfis, request->fis(), 20); fTestUnitReadyActive = request->is_test_unit_ready(); if (request->is_atapi()) { // ATAPI PACKET is a 12 or 16 byte SCSI command memset((char *)fCommandTable->acmd, 0, 32); memcpy((char *)fCommandTable->acmd, request->ccb()->cdb, request->ccb()->cdb_length); fCommandList->a = 1; } if (isWrite) fCommandList->w = 1; fCommandList->prdtl = prdEntrys; fCommandList->prdbc = 0; if (wait_until_clear(&fRegs->tfd, ATA_BSY | ATA_DRQ, 1000000) < B_OK) { TRACE("ExecuteAtaRequest port %d: device is busy\n", fIndex); ResetPort(); FinishTransfer(); request->abort(); return; } cpu_status cpu = disable_interrupts(); acquire_spinlock(&fSpinlock); fCommandsActive |= 1; fRegs->ci = 1; FlushPostedWrites(); release_spinlock(&fSpinlock); restore_interrupts(cpu); int tfd; status_t status = WaitForTransfer(&tfd, 20000000); FLOW("tfd %#x\n", tfd); FLOW("prdbc %ld\n", fCommandList->prdbc); FLOW("ci 0x%08" B_PRIx32 "\n", fRegs->ci); FLOW("is 0x%08" B_PRIx32 "\n", fRegs->is); FLOW("serr 0x%08" B_PRIx32 "\n", fRegs->serr); /* TRACE("ci 0x%08" B_PRIx32 "\n", fRegs->ci); TRACE("ie 0x%08" B_PRIx32 "\n", fRegs->ie); TRACE("is 0x%08" B_PRIx32 "\n", fRegs->is); TRACE("cmd 0x%08" B_PRIx32 "\n", fRegs->cmd); TRACE("ssts 0x%08" B_PRIx32 "\n", fRegs->ssts); TRACE("sctl 0x%08" B_PRIx32 "\n", fRegs->sctl); TRACE("serr 0x%08" B_PRIx32 "\n", fRegs->serr); TRACE("sact 0x%08" B_PRIx32 "\n", fRegs->sact); TRACE("tfd 0x%08" B_PRIx32 "\n", fRegs->tfd); */ if (fResetPort || status == B_TIMED_OUT) { fResetPort = false; ResetPort(); } size_t bytesTransfered = fCommandList->prdbc; FinishTransfer(); if (status == B_TIMED_OUT) { TRACE("ExecuteAtaRequest port %d: device timeout\n", fIndex); request->abort(); } else { request->finish(tfd, bytesTransfered); } }
void MyByteOut(WORD port, BYTE data) { dprintf3(("Received write to Port %4X, Data %2X", port, data)); switch (port - BasePort) { case RESET_PORT: if (data == 1) { ResetState = Reset1Written; } else { if (ResetState == Reset1Written && data == 0) { ResetState = ResetNotStarted; /* * OK - reset everything */ CloseWaveDevice(); /* * Reset state machines */ DSPReadState = Reset; DSPWriteState = WriteCommand; GetVersionFirst = TRUE; } } break; case WRITE_PORT: /* * Use the state to see if it's data */ switch (DSPWriteState) { case WriteCommand: WriteCommandByte(data); break; case CardIdent: IdentByte = data; DSPReadState = ReadIdent; DSPWriteState = WriteCommand; break; case SetTimeConstant: TimeConstant = (DWORD)data; dprintf2(("Set sampling rate %d", GetSamplingRate())); DSPWriteState = WriteCommand; break; case BlockSizeFirstByte: SBBlockSize = (DWORD)data; DSPWriteState = BlockSizeSecondByte; break; case BlockSizeSecondByte: SBBlockSize = SBBlockSize + ((DWORD)data << 8) + 1; DSPWriteState = WriteCommand; dprintf2(("Block size set to 0x%x", SBBlockSize)); break; case BlockSizeFirstByteWrite: SBBlockSize = (DWORD)data; DSPWriteState = BlockSizeSecondByteWrite; break; case BlockSizeSecondByteWrite: SBBlockSize = SBBlockSize + ((DWORD)data << 8) + 1; DSPWriteState = WriteCommand; StartTransfer(FALSE, FALSE); break; case BlockSizeFirstByteRead: SBBlockSize = (DWORD)data; DSPWriteState = BlockSizeSecondByteRead; break; case BlockSizeSecondByteRead: SBBlockSize = SBBlockSize + ((DWORD)data << 8) + 1; DSPWriteState = WriteCommand; StartTransfer(TRUE, FALSE); break; case DirectWaveOut: case MidiWrite: /* * Just discard for now */ DSPWriteState = WriteCommand; break; } break; } }
void FileTransfer::StartDownload( const RString &sURL, const RString &sDestFile ) { StartTransfer( download, sURL, "", sDestFile ); }
void SendPacket( UINT8* i2cData, int DataSz ) { int Index; UINT32 actualClock; BOOL Acknowledged; BOOL Success = TRUE; UINT8 i2cbyte; // Start the transfer to write data to the EEPROM if( !StartTransfer(FALSE) ) { while(1); } // Transmit all data Index = 0; while( Success && (Index < DataSz) ) { // Transmit a byte if (TransmitOneByte(i2cData[Index])) { // Advance to the next byte Index++; // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged(EEPROM_I2C_BUS)) { DBPRINTF("Error: Sent byte was not acknowledged\n"); Success = FALSE; } } else { Success = FALSE; } } // End the transfer (hang here if an error occured) StopTransfer(); if(!Success) { ErrorHalt(); } // Wait for EEPROM to complete write process, by polling the ack status. Acknowledged = FALSE; do { // Start the transfer to address the EEPROM if( !StartTransfer(FALSE) ) { while(1); } // Transmit just the EEPROM's address if (TransmitOneByte(i2cData[0])) { // Check to see if the byte was acknowledged Acknowledged = I2CByteWasAcknowledged(EEPROM_I2C_BUS); } else { Success = FALSE; } // End the transfer (stop here if an error occured) StopTransfer(); if(!Success) { ErrorHalt(); } } while (Acknowledged != TRUE); // End the transfer (stop here if an error occured) StopTransfer(); if(!Success) { ErrorHalt(); } }
void FileTransfer::StartUpload( const RString &sURL, const RString &sSrcFile, const RString &sDestFile ) { StartTransfer( upload, sURL, sSrcFile, sDestFile ); }
//------------------------------------------------------------------------------ // Function: I2C_ReadBlock // Description: Read a block of bytes from the spacifed I2C slave address at the specified offset. // The offset address is one byte (8 bit offset only). // The return code is always 0. There is no indication in case of error. //------------------------------------------------------------------------------ uint8_t I2C_ReadBlock(uint8_t deviceID, uint8_t offset, uint8_t *buffer, uint16_t length) { uint8_t write_buffer[2] = {0x00}; uint8_t count =0; bool Success = true; write_buffer[0] = deviceID; write_buffer[1] = offset; I2C1CONbits.ACKDT = 0; // Start the transfer to write data to the EEPROM if(!StartTransfer(false) ) { return(1); } // Transmit the address with the READ bit set deviceID |= 0x01; TransmitOneByte(deviceID); // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged(OVM7690_I2C_BUS)) { Success = false; return(1); } for(count=0;count<length;count++) { // Read the data from the desired address if(I2CReceiverEnable(OVM7690_I2C_BUS, true) == I2C_RECEIVE_OVERFLOW) { Success = false; return(1); } else { while(!I2CReceivedDataIsAvailable(OVM7690_I2C_BUS)); *buffer = I2C1RCV; buffer++; if(count == (length-1)) { // I2C1CONbits.ACKDT = 1; I2C1CONSET = 0x20; } I2C1CONbits.ACKEN = 1; // initiate bus acknowledge sequence while(I2C1CONbits.ACKEN == 1); } } // End the transfer (stop here if an error occured) StopTransfer(); return(0); }
int CloHttpCurl::Request() { return StartTransfer(); }
BOOL MPU6050::readReg( UINT8 regAddress, UINT8 &data ) { // Variable declarations UINT8 i2cData[10]; I2C_7_BIT_ADDRESS SlaveAddress; int Index; int DataSz; BOOL Acknowledged; BOOL Success = TRUE; UINT8 i2cbyte; // Initialize the data buffer I2C_FORMAT_7_BIT_ADDRESS(SlaveAddress, this->deviceAddress, I2C_WRITE); i2cData[0] = SlaveAddress.byte; i2cData[1] = regAddress; // MPU6050 data address to read (0x75 = WHO_AM_I which contains 0x68) DataSz = 2; // Start the transfer if( !StartTransfer(FALSE) ) { //while(1); Success = FALSE; sprintf( filename, "Error in #1 StartTransfer(): when reading address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } // Address the device. Index = 0; while( Success & (Index < DataSz) ) { // Transmit a byte if (TransmitOneByte(i2cData[Index])) Index++; else { Success = FALSE; sprintf( filename, "Error in #1 TransmitOneByte(): when reading address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged( this->i2cBusId )) { //DBPRINTF("Error: Sent byte was not acknowledged\n"); Success = FALSE; sprintf( filename, "Error in #1 I2CByteWasAcknowledged(): when reading address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } } // Restart and send the device's internal address to switch to a read transfer if(Success) { // Send a Repeated Started condition if( !StartTransfer(TRUE) ) { //while(1); Success = FALSE; sprintf( filename, "Error in #2 StartTransfer(): when reading address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } // Transmit the address with the READ bit set I2C_FORMAT_7_BIT_ADDRESS(SlaveAddress, this->deviceAddress, I2C_READ); if (TransmitOneByte(SlaveAddress.byte)) { // Verify that the byte was acknowledged if(!I2CByteWasAcknowledged( this->i2cBusId )) { //DBPRINTF("Error: Sent byte was not acknowledged\n"); Success = FALSE; sprintf( filename, "Error in #2 I2CByteWasAcknowledged(): when reading address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } } else { Success = FALSE; sprintf( filename, "Error in #2 TransmitOneByte(): when reading address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } } //i2cbyte = 9; // Read the data from the desired address if(Success) { if(I2CReceiverEnable( this->i2cBusId , TRUE) == I2C_RECEIVE_OVERFLOW) { //DBPRINTF("Error: I2C Receive Overflow\n"); Success = FALSE; sprintf( filename, "Error I2CReceiverEnable(): when reading address %u. I2C Receive Overflow.\n", (unsigned)regAddress ); putsUART1( filename ); } else { while(!I2CReceivedDataIsAvailable( this->i2cBusId )); i2cbyte = I2CGetByte( this->i2cBusId ); } } // End the transfer StopTransfer(); data = i2cbyte; if(!Success) { //mPORTBSetBits(BIT_2); //mPORTBClearBits(BIT_3); sprintf( filename, "Error in readReg(): when reading address %u.\n", (unsigned)regAddress ); putsUART1( filename ); } return Success; }