Macros | Functions | Variables
ystream.c File Reference
#include "yproto.h"
#include "yhash.h"
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdarg.h>
#include <sys/time.h>
Include dependency graph for ystream.c:

Go to the source code of this file.

Macros

#define __FILE_ID__   "ystream"
 
#define DBGLOGOUT(str)   yContext->log(str,YSTRLEN(str))
 
#define LOCATION
 
#define PUSH_LOCATION
 
#define YPERF_ENTER(NAME)
 
#define YPERF_LEAVE(NAME)
 

Functions

static yPrivDeviceStAllocateDevice (void)
 
static int CheckVersionCompatibility (u16 version, const char *serial, char *errmsg)
 
int dbglogf (const char *fileid, int line, const char *fmt,...)
 
static int devCheckAsyncIO (LOCATION yPrivDeviceSt *dev, char *errmsg)
 
static int devCheckIO (LOCATION yPrivDeviceSt *dev, YIOHDL_internal *iohdl, char *errmsg)
 
static void devDeleteAccces (LOCATION yPrivDeviceSt *dev)
 
void devHdlInfo (YUSBDEV hdl, yDeviceSt *infos)
 
static void devInitAccces (LOCATION yPrivDeviceSt *dev)
 
static int devPauseIO (LOCATION yPrivDeviceSt *dev, char *errmsg)
 
static void devReportError (LOCATION yPrivDeviceSt *dev, char *error_to_set)
 
static void devReportErrorFromIdle (LOCATION yPrivDeviceSt *dev, char *error_to_set)
 
static void devStartEnum (LOCATION yPrivDeviceSt *dev)
 
static int devStartIdle (LOCATION yPrivDeviceSt *dev, char *errmsg)
 
static int devStartIO (LOCATION yPrivDeviceSt *dev, char *errmsg)
 
static void devStopEnum (LOCATION yPrivDeviceSt *dev)
 
static void devStopIdle (LOCATION yPrivDeviceSt *dev)
 
static int devStopIO (LOCATION yPrivDeviceSt *dev, char *errmsg)
 
void dumpYPerfEntry (yPerfMon *entry, const char *name)
 
static yPrivDeviceStenuFindDevSlot (yInterfaceSt *iface)
 
static void enuResetDStatus (void)
 
static void enuUpdateDStatus (void)
 
yPrivDeviceStfindDev (const char *str, u32 flags)
 
static yPrivDeviceStfindDevFromDevHdl (YUSBDEV hdl)
 
yPrivDeviceStfindDevFromIOHdl (YIOHDL_internal *iohdl)
 
YUSBDEV findDevHdlFromStr (const char *str)
 
static void FreeDevice (yPrivDeviceSt *dev)
 
int FusionErrmsg (int code, char *errmsg, const char *generr, const char *detailerr)
 
static int StartDevice (yPrivDeviceSt *dev, char *errmsg)
 
static int StopDevice (yPrivDeviceSt *dev, char *errmsg)
 
int vdbglogf (const char *fileid, int line, const char *fmt, va_list args)
 
static void WriteTsamp (FILE *f)
 
static YRETCODE yAckPkt (yInterfaceSt *iface, int pktno, char *errmsg)
 
static void yDispatchNotice (yPrivDeviceSt *dev, USB_Notify_Pkt *notify, int pktsize, int isV2)
 
static int yDispatchReceive (yPrivDeviceSt *dev, u64 blockUntilTime, char *errmsg)
 
static void yDispatchReportV1 (yPrivDeviceSt *dev, u8 *data, int pktsize)
 
static void yDispatchReportV2 (yPrivDeviceSt *dev, u8 *data, int pktsize)
 
int YFOPEN (FILE **f, const char *filename, const char *mode)
 
static int yGetNextPktEx (yPrivDeviceSt *dev, pktItem **pkt_out, u64 blockUntilTime, char *errmsg)
 
static int yPacketSetup (yPrivDeviceSt *dev, char *errmsg)
 
static void yPktQueueDup (pktQueue *q, int expected_pkt_no, const char *file, int line)
 
void yPktQueueFree (pktQueue *q)
 
void yPktQueueInit (pktQueue *q)
 
static int yPktQueueIsEmpty (pktQueue *q, char *errmsg)
 
static YRETCODE yPktQueuePeek (pktQueue *q, pktItem **pkt, char *errmsg)
 
YRETCODE yPktQueuePeekH2D (yInterfaceSt *iface, pktItem **pkt)
 
static YRETCODE yPktQueuePop (pktQueue *q, pktItem **pkt, char *errmsg)
 
YRETCODE yPktQueuePopH2D (yInterfaceSt *iface, pktItem **pkt)
 
YRETCODE yPktQueuePushD2H (yInterfaceSt *iface, const USB_Packet *pkt, char *errmsg)
 
static YRETCODE yPktQueuePushEx (pktQueue *q, const USB_Packet *pkt, char *errmsg)
 
YRETCODE yPktQueuePushH2D (yInterfaceSt *iface, const USB_Packet *pkt, char *errmsg)
 
void yPktQueueSetError (pktQueue *q, YRETCODE code, const char *msg)
 
YRETCODE yPktQueueWaitAndPopD2H (yInterfaceSt *iface, pktItem **pkt, int ms, char *errmsg)
 
static int yPktQueueWaitEmptyH2D (yInterfaceSt *iface, int ms, char *errmsg)
 
void ypUpdateHybrid (const char *serial, Notification_funydx funInfo, const char *funcval)
 
void ypUpdateUSB (const char *serial, const char *funcid, const char *funcname, int funclass, int funydx, const char *funcval)
 
void ypUpdateYdx (int devydx, Notification_funydx funInfo, const char *funcval)
 
static int ySendStart (yPrivDeviceSt *dev, char *errmsg)
 
int ySetErr (int code, char *outmsg, const char *erreur, const char *file, u32 line)
 
static int yStreamFlush (yPrivDeviceSt *dev, char *errmsg)
 
static int yStreamGetTxBuff (yPrivDeviceSt *dev, u8 **data, u8 *maxsize)
 
static int yStreamReceived (yPrivDeviceSt *dev, u8 *stream, u8 **data, u8 *size, u64 blockUntilTime, char *errmsg)
 
static int yStreamReceptionDone (yPrivDeviceSt *dev, char *errmsg)
 
static int yStreamSetup (yPrivDeviceSt *dev, char *errmsg)
 
static void yStreamShutdown (yPrivDeviceSt *dev)
 
static int yStreamTransmit (yPrivDeviceSt *dev, u8 proto, u8 size, char *errmsg)
 
int yUsbClose (YIOHDL_internal *ioghdl, char *errmsg)
 
int yUsbEOF (YIOHDL_internal *ioghdl, char *errmsg)
 
int yUsbFree (yContextSt *ctx, char *errmsg)
 
int yUsbIdle (void)
 
int yUsbInit (yContextSt *ctx, char *errmsg)
 
int yUsbOpen (YIOHDL_internal *ioghdl, const char *device, char *errmsg)
 
int yUsbOpenDevDescr (YIOHDL_internal *ioghdl, yStrRef devdescr, char *errmsg)
 
int yUsbReadBlock (YIOHDL_internal *ioghdl, char *buffer, int len, u64 blockUntil, char *errmsg)
 
int yUsbReadNonBlock (YIOHDL_internal *ioghdl, char *buffer, int len, char *errmsg)
 
void yUSBReleaseAllDevices (void)
 
int yUsbSetIOAsync (YIOHDL_internal *ioghdl, yapiRequestAsyncCallback callback, void *context, char *errmsg)
 
int yUsbTrafficPending (void)
 
YRETCODE yUSBUpdateDeviceList (char *errmsg)
 
int yUsbWrite (YIOHDL_internal *ioghdl, const char *buffer, int writelen, char *errmsg)
 
static void yyFormatConfPkt (pktItem *pkt, u8 conftype)
 
static int yyWaitOnlyConfPkt (yInterfaceSt *iface, u8 cmdtowait, pktItem **rpkt, u32 s_timeout, char *errmsg)
 
YRETCODE yyySendPacket (yInterfaceSt *iface, const USB_Packet *pkt, char *errmsg)
 

Variables

static int dayofs [] = { 0,31,59,90,120,151,181,212,243,273,304,334 }
 
yContextStyContext =NULL
 
char ytracefile [512] =""
 

Macro Definition Documentation

#define __FILE_ID__   "ystream"

Definition at line 40 of file ystream.c.

#define DBGLOGOUT (   str)    yContext->log(str,YSTRLEN(str))

Definition at line 143 of file ystream.c.

#define LOCATION

Definition at line 321 of file ystream.c.

#define PUSH_LOCATION

Definition at line 322 of file ystream.c.

#define YPERF_ENTER (   NAME)

Definition at line 2397 of file ystream.c.

#define YPERF_LEAVE (   NAME)

Definition at line 2398 of file ystream.c.

Function Documentation

static yPrivDeviceSt* AllocateDevice ( void  )
static

Definition at line 2014 of file ystream.c.

static int CheckVersionCompatibility ( u16  version,
const char *  serial,
char *  errmsg 
)
static

Definition at line 1293 of file ystream.c.

int dbglogf ( const char *  fileid,
int  line,
const char *  fmt,
  ... 
)

Definition at line 222 of file ystream.c.

static int devCheckAsyncIO ( LOCATION yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 595 of file ystream.c.

static int devCheckIO ( LOCATION yPrivDeviceSt dev,
YIOHDL_internal iohdl,
char *  errmsg 
)
static

Definition at line 547 of file ystream.c.

static void devDeleteAccces ( LOCATION yPrivDeviceSt dev)
static

Definition at line 330 of file ystream.c.

void devHdlInfo ( YUSBDEV  hdl,
yDeviceSt infos 
)

Definition at line 2334 of file ystream.c.

static void devInitAccces ( LOCATION yPrivDeviceSt dev)
static

Definition at line 325 of file ystream.c.

static int devPauseIO ( LOCATION yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 502 of file ystream.c.

static void devReportError ( LOCATION yPrivDeviceSt dev,
char *  error_to_set 
)
static

Definition at line 683 of file ystream.c.

static void devReportErrorFromIdle ( LOCATION yPrivDeviceSt dev,
char *  error_to_set 
)
static

Definition at line 432 of file ystream.c.

static void devStartEnum ( LOCATION yPrivDeviceSt dev)
static

Definition at line 405 of file ystream.c.

static int devStartIdle ( LOCATION yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 335 of file ystream.c.

static int devStartIO ( LOCATION yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 459 of file ystream.c.

static void devStopEnum ( LOCATION yPrivDeviceSt dev)
static

Definition at line 424 of file ystream.c.

static void devStopIdle ( LOCATION yPrivDeviceSt dev)
static

Definition at line 377 of file ystream.c.

static int devStopIO ( LOCATION yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 644 of file ystream.c.

void dumpYPerfEntry ( yPerfMon entry,
const char *  name 
)

Definition at line 2353 of file ystream.c.

static yPrivDeviceSt* enuFindDevSlot ( yInterfaceSt iface)
static

Definition at line 2000 of file ystream.c.

static void enuResetDStatus ( void  )
static

Definition at line 1981 of file ystream.c.

static void enuUpdateDStatus ( void  )
static

Definition at line 2077 of file ystream.c.

yPrivDeviceSt* findDev ( const char *  str,
u32  flags 
)

Definition at line 2269 of file ystream.c.

static yPrivDeviceSt* findDevFromDevHdl ( YUSBDEV  hdl)
static

Definition at line 2323 of file ystream.c.

yPrivDeviceSt* findDevFromIOHdl ( YIOHDL_internal iohdl)

Definition at line 2310 of file ystream.c.

YUSBDEV findDevHdlFromStr ( const char *  str)

Definition at line 2299 of file ystream.c.

static void FreeDevice ( yPrivDeviceSt dev)
static

Definition at line 2025 of file ystream.c.

int FusionErrmsg ( int  code,
char *  errmsg,
const char *  generr,
const char *  detailerr 
)

Definition at line 112 of file ystream.c.

static int StartDevice ( yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 2036 of file ystream.c.

static int StopDevice ( yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 2068 of file ystream.c.

int vdbglogf ( const char *  fileid,
int  line,
const char *  fmt,
va_list  args 
)

Definition at line 189 of file ystream.c.

static void WriteTsamp ( FILE *  f)
static

Definition at line 147 of file ystream.c.

static YRETCODE yAckPkt ( yInterfaceSt iface,
int  pktno,
char *  errmsg 
)
static

Definition at line 1219 of file ystream.c.

static void yDispatchNotice ( yPrivDeviceSt dev,
USB_Notify_Pkt notify,
int  pktsize,
int  isV2 
)
static

Definition at line 1617 of file ystream.c.

static int yDispatchReceive ( yPrivDeviceSt dev,
u64  blockUntilTime,
char *  errmsg 
)
static

Definition at line 1887 of file ystream.c.

static void yDispatchReportV1 ( yPrivDeviceSt dev,
u8 *  data,
int  pktsize 
)
static

Definition at line 1798 of file ystream.c.

static void yDispatchReportV2 ( yPrivDeviceSt dev,
u8 *  data,
int  pktsize 
)
static

Definition at line 1842 of file ystream.c.

int YFOPEN ( FILE **  f,
const char *  filename,
const char *  mode 
)

Definition at line 130 of file ystream.c.

static int yGetNextPktEx ( yPrivDeviceSt dev,
pktItem **  pkt_out,
u64  blockUntilTime,
char *  errmsg 
)
static

Definition at line 1396 of file ystream.c.

static int yPacketSetup ( yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 1351 of file ystream.c.

static void yPktQueueDup ( pktQueue q,
int  expected_pkt_no,
const char *  file,
int  line 
)
static

Definition at line 1069 of file ystream.c.

void yPktQueueFree ( pktQueue q)

Definition at line 928 of file ystream.c.

void yPktQueueInit ( pktQueue q)

Definition at line 919 of file ystream.c.

static int yPktQueueIsEmpty ( pktQueue q,
char *  errmsg 
)
static

Definition at line 998 of file ystream.c.

static YRETCODE yPktQueuePeek ( pktQueue q,
pktItem **  pkt,
char *  errmsg 
)
static

Definition at line 1016 of file ystream.c.

YRETCODE yPktQueuePeekH2D ( yInterfaceSt iface,
pktItem **  pkt 
)

Definition at line 1160 of file ystream.c.

static YRETCODE yPktQueuePop ( pktQueue q,
pktItem **  pkt,
char *  errmsg 
)
static

Definition at line 1036 of file ystream.c.

YRETCODE yPktQueuePopH2D ( yInterfaceSt iface,
pktItem **  pkt 
)

Definition at line 1176 of file ystream.c.

YRETCODE yPktQueuePushD2H ( yInterfaceSt iface,
const USB_Packet pkt,
char *  errmsg 
)

Definition at line 1097 of file ystream.c.

static YRETCODE yPktQueuePushEx ( pktQueue q,
const USB_Packet pkt,
char *  errmsg 
)
static

Definition at line 944 of file ystream.c.

YRETCODE yPktQueuePushH2D ( yInterfaceSt iface,
const USB_Packet pkt,
char *  errmsg 
)

Definition at line 1145 of file ystream.c.

void yPktQueueSetError ( pktQueue q,
YRETCODE  code,
const char *  msg 
)

Definition at line 985 of file ystream.c.

YRETCODE yPktQueueWaitAndPopD2H ( yInterfaceSt iface,
pktItem **  pkt,
int  ms,
char *  errmsg 
)

Definition at line 1128 of file ystream.c.

static int yPktQueueWaitEmptyH2D ( yInterfaceSt iface,
int  ms,
char *  errmsg 
)
static

Definition at line 1151 of file ystream.c.

void ypUpdateHybrid ( const char *  serial,
Notification_funydx  funInfo,
const char *  funcval 
)

Definition at line 300 of file ystream.c.

void ypUpdateUSB ( const char *  serial,
const char *  funcid,
const char *  funcname,
int  funclass,
int  funydx,
const char *  funcval 
)

Definition at line 255 of file ystream.c.

void ypUpdateYdx ( int  devydx,
Notification_funydx  funInfo,
const char *  funcval 
)

Definition at line 286 of file ystream.c.

static int ySendStart ( yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 1321 of file ystream.c.

int ySetErr ( int  code,
char *  outmsg,
const char *  erreur,
const char *  file,
u32  line 
)

Definition at line 72 of file ystream.c.

static int yStreamFlush ( yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 1558 of file ystream.c.

static int yStreamGetTxBuff ( yPrivDeviceSt dev,
u8 **  data,
u8 *  maxsize 
)
static

Definition at line 1544 of file ystream.c.

static int yStreamReceived ( yPrivDeviceSt dev,
u8 *  stream,
u8 **  data,
u8 *  size,
u64  blockUntilTime,
char *  errmsg 
)
static

Definition at line 1506 of file ystream.c.

static int yStreamReceptionDone ( yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 1537 of file ystream.c.

static int yStreamSetup ( yPrivDeviceSt dev,
char *  errmsg 
)
static

Definition at line 1473 of file ystream.c.

static void yStreamShutdown ( yPrivDeviceSt dev)
static

Definition at line 1605 of file ystream.c.

static int yStreamTransmit ( yPrivDeviceSt dev,
u8  proto,
u8  size,
char *  errmsg 
)
static

Definition at line 1581 of file ystream.c.

int yUsbClose ( YIOHDL_internal ioghdl,
char *  errmsg 
)

Definition at line 2811 of file ystream.c.

int yUsbEOF ( YIOHDL_internal ioghdl,
char *  errmsg 
)

Definition at line 2771 of file ystream.c.

int yUsbFree ( yContextSt ctx,
char *  errmsg 
)

Definition at line 2410 of file ystream.c.

int yUsbIdle ( void  )

Definition at line 2441 of file ystream.c.

int yUsbInit ( yContextSt ctx,
char *  errmsg 
)

Definition at line 2401 of file ystream.c.

int yUsbOpen ( YIOHDL_internal ioghdl,
const char *  device,
char *  errmsg 
)

Definition at line 2566 of file ystream.c.

int yUsbOpenDevDescr ( YIOHDL_internal ioghdl,
yStrRef  devdescr,
char *  errmsg 
)

Definition at line 2553 of file ystream.c.

int yUsbReadBlock ( YIOHDL_internal ioghdl,
char *  buffer,
int  len,
u64  blockUntil,
char *  errmsg 
)

Definition at line 2728 of file ystream.c.

int yUsbReadNonBlock ( YIOHDL_internal ioghdl,
char *  buffer,
int  len,
char *  errmsg 
)

Definition at line 2684 of file ystream.c.

void yUSBReleaseAllDevices ( void  )

Definition at line 2182 of file ystream.c.

int yUsbSetIOAsync ( YIOHDL_internal ioghdl,
yapiRequestAsyncCallback  callback,
void *  context,
char *  errmsg 
)

Definition at line 2602 of file ystream.c.

int yUsbTrafficPending ( void  )

Definition at line 2535 of file ystream.c.

YRETCODE yUSBUpdateDeviceList ( char *  errmsg)

Definition at line 2191 of file ystream.c.

int yUsbWrite ( YIOHDL_internal ioghdl,
const char *  buffer,
int  writelen,
char *  errmsg 
)

Definition at line 2628 of file ystream.c.

static void yyFormatConfPkt ( pktItem pkt,
u8  conftype 
)
static

Definition at line 1280 of file ystream.c.

static int yyWaitOnlyConfPkt ( yInterfaceSt iface,
u8  cmdtowait,
pktItem **  rpkt,
u32  s_timeout,
char *  errmsg 
)
static

Definition at line 1244 of file ystream.c.

YRETCODE yyySendPacket ( yInterfaceSt iface,
const USB_Packet pkt,
char *  errmsg 
)

Definition at line 1199 of file ystream.c.

Variable Documentation

int dayofs[] = { 0,31,59,90,120,151,181,212,243,273,304,334 }
static

Definition at line 145 of file ystream.c.

yContextSt* yContext =NULL

Definition at line 59 of file ystream.c.

char ytracefile[512] =""

Definition at line 64 of file ystream.c.



yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:13