1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
/*
$Id: eph_priv.h,v 2.9 2000/07/14 06:35:39 crosser Exp $
*/
/*
Copyright (c) 1997,1998 Eugene G. Crosser
Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support)
You may distribute and/or use for any purpose modified or unmodified
copies of this software if you preserve the copyright notice above.
THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE
USE OF THIS SOFTWARE.
*/
/*
$Log: eph_priv.h,v $
Revision 2.9 2000/07/14 06:35:39 crosser
reportedly some models return CAN instead of DC1
Revision 2.8 2000/05/09 13:20:54 crosser
configure read() with alarm() better.
Address signed vs. unsigned arguments
other cleanups to make most notorious compilers happy
Revision 2.7 1999/01/17 09:50:55 crosser
increase WRT*DELAYs
Revision 2.6 1998/12/06 08:40:34 crosser
chnage iniitimeout for Nikon
Revision 2.5 1998/10/18 13:18:27 crosser
Put RCS logs and I.D. into the source
Revision 2.4 1998/08/28 22:01:48 crosser
increase INITTIMEOUT to suite Nikon CP900
Revision 2.3 1998/08/01 12:30:50 crosser
flushinput function
Revision 2.2 1998/01/27 21:52:55 crosser
delays for smart multi-chunk writes
Revision 2.1 1998/01/18 02:16:45 crosser
DOS support
Revision 2.0 1998/01/02 19:20:11 crosser
Added support for Win32
Revision 1.3 1997/11/03 23:25:11 crosser
add immediate session finish command
Revision 1.2 1997/09/12 09:42:35 crosser
skip possible NULs prior to `camera signature'
Revision 1.1 1997/08/17 08:59:54 crosser
Initial revision
*/
#ifndef _EPH_PRIV_H
#define _EPH_PRIV_H
#include <sys/types.h>
#define RETRIES 3
#ifdef USE_VMIN_AND_VTIME
#define INITTIMEOUT 1700000L
#define DATATIMEOUT 1100000L
#define BIGDATATIMEOUT 1500000L
#define ACKTIMEOUT 1100000L
#define BIGACKTIMEOUT 1100000L
#define EODTIMEOUT 1100000L
#define CMDTIMEOUT 15000000L
#else
#define INITTIMEOUT 3000000L
#define DATATIMEOUT 200000L
#define BIGDATATIMEOUT 1500000L
#define ACKTIMEOUT 400000L
#define BIGACKTIMEOUT 800000L
#define EODTIMEOUT 400000L
#define CMDTIMEOUT 15000000L
#endif
/* Bruce and others say that adding 1ms delay before all writes is good.
I think that they should rather be fine-tuned. */
#if 1
#define WRTPKTDELAY 1250L
#define WRTCMDDELAY 1250L
#define WRTPRMDELAY 1500L
#define WRTDELAY 2000L
#else
#define WRTPKTDELAY 250L
#define WRTCMDDELAY 250L
#define WRTPRMDELAY 500L
#define WRTDELAY 1000L
#endif
#define SPEEDCHGDELAY 100000L
#define SKIPNULS 200
#define ACK 0x06
#define DC1 0x11
#define NAK 0x15
/*#define NAK 0x11*/
#define CAN 0x18
#define CMD_SETINT 0
#define CMD_GETINT 1
#define CMD_ACTION 2
#define CMD_SETVAR 3
#define CMD_GETVAR 4
#define PKT_CMD 0x1b
#define PKT_DATA 0x02
#define PKT_LAST 0x03
#define SEQ_INITCMD 0x53
#define SEQ_CMD 0x43
#ifndef O_NDELAY
#define O_NDELAY O_NONBLOCK
#endif
typedef struct _eph_pkthdr {
unsigned char typ;
unsigned char seq;
} eph_pkthdr;
size_t eph_readt(eph_iob *iob,char *buf,size_t length,long timeout_usec,int *rc);
void eph_error(eph_iob *iob,int err,char *fmt,...);
int eph_flushinput(eph_iob *iob);
void eph_writeinit(eph_iob *iob);
void eph_writeack(eph_iob *iob);
void eph_writenak(eph_iob *iob);
int eph_waitack(eph_iob *iob,long timeout_usec);
int eph_waitcomplete(eph_iob *iob);
int eph_waitsig(eph_iob *iob);
int eph_waiteot(eph_iob *iob);
int eph_writepkt(eph_iob *iob,int typ,int seq,char *data,size_t length);
int eph_writecmd(eph_iob *iob,char *data,size_t length);
int eph_writeicmd(eph_iob *iob,char *data,size_t length);
int eph_readpkt(eph_iob *iob,eph_pkthdr *pkthdr,char *buf,size_t *length,long timeout_usec);
int eph_setispeed(eph_iob *iob,long val);
#endif
|