ADI iSensor FX3 Firmware  v2.9.4-pub
Firmware for the Analog Devices EVAL-ADIS-FX3 IMU Evaluation Platform. This firmware can be compiled using the Cypress EZ USB Suite IDE
Functions | Variables
StreamFunctions.c File Reference

This file contains all functions used to start/stop data streams from a DUT. More...

#include "StreamFunctions.h"

Functions

void AdiConfigStreamStallTimer ()
 Configures 10MHz timer to control stall time for generic or transfer streams. More...
 
CyU3PReturnStatus_t AdiStopAnyDataStream ()
 This function sets a flag to notify the streaming thread that the user requested to cancel streaming. More...
 
CyBool_t AdiPrintStreamState ()
 This function prints all the stream state variables to the terminal if VERBOSE_MODE is defined. More...
 
CyU3PReturnStatus_t AdiI2CStreamStart ()
 Starts an I2C read stream. More...
 
CyU3PReturnStatus_t AdiI2CStreamFinished ()
 Cleans up an I2C read stream. More...
 
CyU3PReturnStatus_t AdiTransferStreamStart ()
 Starts a protocol agnostic SPI transfer stream. More...
 
CyU3PReturnStatus_t AdiTransferStreamFinished ()
 Cleans up a protocol agnostic transfer stream. More...
 
CyU3PReturnStatus_t AdiRealTimeStreamStart ()
 Starts a real time stream for ADcmXLx021 DUTs. More...
 
CyU3PReturnStatus_t AdiRealTimeStreamFinished ()
 This function cleans up resources allocated for a real time stream. More...
 
CyU3PReturnStatus_t AdiBurstStreamStart ()
 Starts a burst stream for IMU products. More...
 
CyU3PReturnStatus_t AdiBurstStreamFinished ()
 Cleans up resources allocated for a IMU burst stream. More...
 
CyU3PReturnStatus_t AdiGenericStreamStart ()
 Starts a register read/write stream, with options to trigger on a data ready. More...
 
CyU3PReturnStatus_t AdiGenericStreamFinished ()
 This function cleans up after a generic stream and notifies the host that the cancel operation was successful if requested. More...
 
CyU3PReturnStatus_t AdiConfigureDrPin ()
 Configures the data ready pin as an input with edge interrupt triggering enabled. More...
 

Variables

CyU3PEvent EventHandler
 
CyU3PDmaChannel StreamingChannel
 
CyU3PDmaChannel MemoryToSPI
 
CyU3PDmaBuffer_t SpiDmaBuffer
 
BoardState FX3State
 
volatile CyBool_t KillStreamEarly
 
StreamState StreamThreadState
 
uint8_t USBBuffer [4096]
 
uint8_t BulkBuffer [12288]
 

Detailed Description

This file contains all functions used to start/stop data streams from a DUT.

Copyright (c) 2018-2020 Analog Devices, Inc. All Rights Reserved. This software is proprietary to Analog Devices, Inc. and its licensors.

THIS SOFTWARE UTILIZES LIBRARIES DEVELOPED AND MAINTAINED BY CYPRESS INC. THE LICENSE INCLUDED IN THIS REPOSITORY DOES NOT EXTEND TO CYPRESS PROPERTY.

Use of this file is governed by the license agreement included in this repository.

Date
8/1/2019
Author
A. Nolan (alex..nosp@m.nola.nosp@m.n@ana.nosp@m.log..nosp@m.com)
J. Chong (juan..nosp@m.chon.nosp@m.g@ana.nosp@m.log..nosp@m.com)

Function Documentation

◆ AdiBurstStreamFinished()

CyU3PReturnStatus_t AdiBurstStreamFinished ( )

Cleans up resources allocated for a IMU burst stream.

Returns
The status of the cancel operation.

This function cleans up after a burst stream by resetting the SPI port and notifying the host that the cancel operation was successful.

◆ AdiBurstStreamStart()

CyU3PReturnStatus_t AdiBurstStreamStart ( )

Starts a burst stream for IMU products.

Returns
The status of starting a real-time stream.

This function kicks off a burst stream by configuring a pin interrupt on a user-specified pin, configuring the SPI and USB DMAs to handle the incoming data, and enabling the streaming function.It can be configured for "Blackfin" or "ADuC" burst using vendor requests.

◆ AdiConfigStreamStallTimer()

void AdiConfigStreamStallTimer ( )

Configures 10MHz timer to control stall time for generic or transfer streams.

Returns
void

This function sets the timer period and enables the timer interrupt as required for the stream. For stall times less than the min (5 microseconds) the timer threshold is set to one timer tick.

◆ AdiConfigureDrPin()

CyU3PReturnStatus_t AdiConfigureDrPin ( )

Configures the data ready pin as an input with edge interrupt triggering enabled.

Returns
The status of the pin configure operation.

Configures the data ready pin (FX3State.DrPin) as an input, with edge interrupts enabled based on FX3State.DrPolarity. It is advisable to disable the GPIO interrupt vector before calling this function. If you do not, the GPIO ISR may be triggered.

◆ AdiGenericStreamFinished()

CyU3PReturnStatus_t AdiGenericStreamFinished ( )

This function cleans up after a generic stream and notifies the host that the cancel operation was successful if requested.

Returns
The status of the cancel operation.

This function must be explicitly invoked via a vendor command after the PC has finished reading all data from the FX3. This is done to ensure data consistency and prevent a race condition between the FX3 API and the firmware.

◆ AdiGenericStreamStart()

CyU3PReturnStatus_t AdiGenericStreamStart ( )

Starts a register read/write stream, with options to trigger on a data ready.

Returns
The status of starting a generic stream.

This function kicks off a generic data stream by configuring interrupts, SPI, and end points. At the end of the function, the ADI_GENERIC_STREAM_ENABLE flag is set such that the generic streaming thread knows to start producing data.

◆ AdiI2CStreamFinished()

CyU3PReturnStatus_t AdiI2CStreamFinished ( )

Cleans up an I2C read stream.

Returns
A status code indicating the success of the I2C stream clean up.

This function detroys the StreamingChannel DMA which was set up to allow I2C -> USB DMA. It also flushes the relevant endpoint and reconfigures the I2C to operate in register mode.

◆ AdiI2CStreamStart()

CyU3PReturnStatus_t AdiI2CStreamStart ( )

Starts an I2C read stream.

Returns
A status code indicating the success of the I2C stream start.

This function reads the I2C stream start request in from the control endpoint. It parses out the stream parameters from the buffer and configures the Stream DMA channel for I2C -> USB, with an infinite transfer.

◆ AdiPrintStreamState()

CyBool_t AdiPrintStreamState ( )

This function prints all the stream state variables to the terminal if VERBOSE_MODE is defined.

Returns
A status code indicating if the print occurred (returns false if VERBOSE_MODE is not defined).

This function prints a significant amount of data, and as such is fairly slow in VERBOSE_MODE. The return value of this function can be used to determine if the running application firmware is set to verbose mode.

◆ AdiRealTimeStreamFinished()

CyU3PReturnStatus_t AdiRealTimeStreamFinished ( )

This function cleans up resources allocated for a real time stream.

Returns
The status of the cancel operation.

This function cleans up after a real-time stream by resetting the SPI port, triggering the SYNC/RTS pin (if asked to do so), and notifying the host that the cancel operation was successful.

◆ AdiRealTimeStreamStart()

CyU3PReturnStatus_t AdiRealTimeStreamStart ( )

Starts a real time stream for ADcmXLx021 DUTs.

Returns
The status of starting a real-time stream.

This function kicks off a real-time stream by configuring interrupts, SPI, and end points. It also optionally toggles the SYNC/RTS pin if requested. At the end of the function, the bit assigned to enable the capture thread is toggled to signal the streaming thread to start producing data.

◆ AdiStopAnyDataStream()

CyU3PReturnStatus_t AdiStopAnyDataStream ( )

This function sets a flag to notify the streaming thread that the user requested to cancel streaming.

Returns
A status code indicating the success of the function.

This function can be used to stop any stream operation. The variable KillStreamEarly is defined as volatile to prevent any compiler optimizations which may remove it.

◆ AdiTransferStreamFinished()

CyU3PReturnStatus_t AdiTransferStreamFinished ( )

Cleans up a protocol agnostic transfer stream.

Returns
A status code indicating the success of the function.

Resets the streaming endpoint, destroys the DMA channel, and restores the interrupt source states to their standard operating condition. Must be explicitly invoked via a vendor command when all "buffers" or captured, or indirectly via a TransferStream cancel. This function currently just calls the GenericStreamFinished implementation.

◆ AdiTransferStreamStart()

CyU3PReturnStatus_t AdiTransferStreamStart ( )

Starts a protocol agnostic SPI transfer stream.

Returns
A status code indicating the success of the transfer stream start.

This is used to implement the ISpi32Interface. The stream info is read in from EP0 into the USBBuffer. This includes stream parameters and the MOSI data. Any error encountered during stream setup will result in a system reboot, after the error data is logged to flash memory.

Variable Documentation

◆ BulkBuffer

uint8_t BulkBuffer[12288]
extern

Global USB Buffer (Bulk Endpoints)

◆ EventHandler

CyU3PEvent EventHandler
extern

ADI event structure

◆ FX3State

BoardState FX3State
extern

Struct. which stores all run time configurable FX3 settings

◆ KillStreamEarly

volatile CyBool_t KillStreamEarly
extern

Signal data stream thread to kill data capture early (True = kill thread signaled, False = allow execution)

◆ MemoryToSPI

CyU3PDmaChannel MemoryToSPI
extern

DMA channel for reading a memory location into a DMA consumer

◆ SpiDmaBuffer

CyU3PDmaBuffer_t SpiDmaBuffer
extern

DMA buffer structure for SPI transmit

◆ StreamingChannel

CyU3PDmaChannel StreamingChannel
extern

DMA channel for real time streaming (SPI to USB BULK-IN 0x81)

◆ StreamThreadState

StreamState StreamThreadState
extern

Struct of data used to synchronize the data streaming / app threads

◆ USBBuffer

uint8_t USBBuffer[4096]
extern

Global USB Buffer (Control Endpoint)