source: pacpusframework/branches/2.0-beta1/include/PacpusCityVIP/Video/sensor/C1394Camera/1394camapi.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 17.8 KB
Line 
1/*++
2
3Copyright (c) 1998 Microsoft Corporation
4
5Module Name:
6
7 1394camapi.h
8
9Abstract
10
11 Modified from 1394api.h as found in the win2000 DDK
12 The file name has changed to help prevent the use of
13 the original 1394api.h.
14
15Author:
16
17 Peter Binder (pbinder) 4/08/98
18
19Revision History:
20Date Who What
21-------- --------- ------------------------------------------------------------
224/08/98 pbinder birth
238/18/02 cbaker lots of mods, moved structures into 1394common.h, stripped out
24 excess stuff
25--*/
26
27#ifndef __1394_CAMAPI_H__
28#define __1394_CAMAPI_H__
29
30// extern "C" it if necessary (has something to do with calling conventions)
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36// export if compiling, import if using the library
37
38#ifdef MY1394CAMERA_EXPORTS
39#define CAMAPI __declspec(dllexport)
40#else
41#define CAMAPI __declspec(dllimport)
42#endif
43
44// Trace Levels for the DLL
45
46#define DLL_TRACE_ALWAYS -2 // this one is used sparingly for critical debug information
47#define DLL_TRACE_NONE -1
48#define DLL_TRACE_ALL 100
49#define DLL_TRACE_ERROR 0
50#define DLL_TRACE_WARNING 1
51#define DLL_TRACE_CHECK 2
52#define DLL_TRACE_ENTER 5
53#define DLL_TRACE_EXIT 6
54#define DLL_TRACE_VERBOSE 10
55
56////////////////////////////////////////////////////////////////////////
57// The defines/structs below are taken from 1394.h in the windows DDK //
58// These *must* be defined before including 1394common.h //
59// They are redefined here so we don't need 1394.h to use the library //
60////////////////////////////////////////////////////////////////////////
61
62//
63// Definition of flags for AllocateAddressRange Irb
64//
65#define BIG_ENDIAN_ADDRESS_RANGE 1
66
67//
68// Definition of fulAccessType for AllocateAddressRange
69//
70#define ACCESS_FLAGS_TYPE_READ 1
71#define ACCESS_FLAGS_TYPE_WRITE 2
72#define ACCESS_FLAGS_TYPE_LOCK 4
73
74//
75// Definition of fulNotificationOptions for AllocateAddressRange
76//
77#define NOTIFY_FLAGS_NEVER 0
78#define NOTIFY_FLAGS_AFTER_READ 1
79#define NOTIFY_FLAGS_AFTER_WRITE 2
80#define NOTIFY_FLAGS_AFTER_LOCK 4
81
82//
83// Definitions of Lock transaction types
84//
85#define LOCK_TRANSACTION_MASK_SWAP 1
86#define LOCK_TRANSACTION_COMPARE_SWAP 2
87#define LOCK_TRANSACTION_FETCH_ADD 3
88#define LOCK_TRANSACTION_LITTLE_ADD 4
89#define LOCK_TRANSACTION_BOUNDED_ADD 5
90#define LOCK_TRANSACTION_WRAP_ADD 6
91
92//
93// Definition of fulFlags in Async Read/Write/Lock requests
94//
95
96#define ASYNC_FLAGS_NONINCREMENTING 1
97
98//
99// flag instucts the port driver to NOT take an int for checking the status
100// of this transaction. Always return success...
101//
102
103#define ASYNC_FLAGS_NO_STATUS 0x00000002
104
105//
106// Definitions of levels of Host controller information
107//
108#define GET_HOST_UNIQUE_ID 1
109#define GET_HOST_CAPABILITIES 2
110#define GET_POWER_SUPPLIED 3
111#define GET_PHYS_ADDR_ROUTINE 4
112#define GET_HOST_CONFIG_ROM 5
113#define GET_HOST_CSR_CONTENTS 6
114
115//
116// Definitions of capabilities in Host info level 2
117//
118#define HOST_INFO_PACKET_BASED 1
119#define HOST_INFO_STREAM_BASED 2
120#define HOST_INFO_SUPPORTS_ISOCH_STRIPPING 4
121#define HOST_INFO_SUPPORTS_START_ON_CYCLE 8
122#define HOST_INFO_SUPPORTS_RETURNING_ISO_HDR 16
123#define HOST_INFO_SUPPORTS_ISO_HDR_INSERTION 32
124
125//
126// Definitions of Bus Reset flags (used when Bus driver asks Port driver
127// to perform a bus reset)
128//
129#define BUS_RESET_FLAGS_PERFORM_RESET 1
130#define BUS_RESET_FLAGS_FORCE_ROOT 2
131
132//
133// Definitions of flags for GetMaxSpeedBetweenDevices and
134// Get1394AddressFromDeviceObject
135//
136#define USE_LOCAL_NODE 1
137
138//
139// Definition of flags for BusResetNotification Irb
140//
141#define REGISTER_NOTIFICATION_ROUTINE 1
142#define DEREGISTER_NOTIFICATION_ROUTINE 2
143
144//
145// Definitions of Speed flags used throughout 1394 Bus APIs
146//
147#define SPEED_FLAGS_100 0x01
148#define SPEED_FLAGS_200 0x02
149#define SPEED_FLAGS_400 0x04
150#define SPEED_FLAGS_800 0x08
151#define SPEED_FLAGS_1600 0x10
152#define SPEED_FLAGS_3200 0x20
153
154#define SPEED_FLAGS_FASTEST 0x80000000
155
156//
157// Definitions of Isoch Allocate Resources flags
158//
159#define RESOURCE_USED_IN_LISTENING 1
160#define RESOURCE_USED_IN_TALKING 2
161#define RESOURCE_BUFFERS_CIRCULAR 4
162#define RESOURCE_STRIP_ADDITIONAL_QUADLETS 8
163#define RESOURCE_TIME_STAMP_ON_COMPLETION 16
164#define RESOURCE_SYNCH_ON_TIME 32
165#define RESOURCE_USE_PACKET_BASED 64
166
167//
168// Definitions of Isoch Descriptor flags
169//
170#define DESCRIPTOR_SYNCH_ON_SY 0x00000001
171#define DESCRIPTOR_SYNCH_ON_TAG 0x00000002
172#define DESCRIPTOR_SYNCH_ON_TIME 0x00000004
173#define DESCRIPTOR_USE_SY_TAG_IN_FIRST 0x00000008
174#define DESCRIPTOR_TIME_STAMP_ON_COMPLETION 0x00000010
175#define DESCRIPTOR_PRIORITY_TIME_DELIVERY 0x00000020
176#define DESCRIPTOR_HEADER_SCATTER_GATHER 0x00000040
177
178//
179// Definitions of Isoch synchronization flags
180//
181#define SYNCH_ON_SY DESCRIPTOR_SYNCH_ON_SY
182#define SYNCH_ON_TAG DESCRIPTOR_SYNCH_ON_TAG
183#define SYNCH_ON_TIME DESCRIPTOR_SYNCH_ON_TIME
184
185//
186// flags for the SetPortProperties request
187//
188#define SET_LOCAL_HOST_PROPERTIES_NO_CYCLE_STARTS 0x00000001
189#define SET_LOCAL_HOST_PROPERTIES_GAP_COUNT 0x00000002
190#define SET_LOCAL_HOST_PROPERTIES_MODIFY_CROM 0x00000003
191
192//
193// definition of Flags for SET_LOCAL_HOST_PROPERTIES_MODIFY_CROM
194//
195#define SLHP_FLAG_ADD_CROM_DATA 0x01
196#define SLHP_FLAG_REMOVE_CROM_DATA 0x02
197
198//
199// Various Interesting 1394 IEEE 1212 locations
200//
201#define INITIAL_REGISTER_SPACE_HI 0xffff
202//#define INITIAL_REGISTER_SPACE_LO 0xf0000000
203#define TOPOLOGY_MAP_LOCATION 0xf0001000
204#define SPEED_MAP_LOCATION 0xf0002000
205
206//
207// 1394 Cycle Time format
208//
209typedef struct _CYCLE_TIME {
210 ULONG CL_CycleOffset:12; // Bits 0-11
211 ULONG CL_CycleCount:13; // Bits 12-24
212 ULONG CL_SecondCount:7; // Bits 25-31
213} CYCLE_TIME, *PCYCLE_TIME;
214
215//
216// 1394 Node Address format
217//
218typedef struct _NODE_ADDRESS {
219 USHORT NA_Node_Number:6; // Bits 10-15
220 USHORT NA_Bus_Number:10; // Bits 0-9
221} NODE_ADDRESS, *PNODE_ADDRESS;
222
223//
224// 1394 Address Offset format (48 bit addressing)
225//
226typedef struct _ADDRESS_OFFSET {
227 USHORT Off_High;
228 ULONG Off_Low;
229} ADDRESS_OFFSET, *PADDRESS_OFFSET;
230
231//
232// 1394 I/O Address format
233//
234typedef struct _IO_ADDRESS {
235 NODE_ADDRESS IA_Destination_ID;
236 ADDRESS_OFFSET IA_Destination_Offset;
237} IO_ADDRESS, *PIO_ADDRESS;
238
239//
240// 1394 Self ID packet format
241//
242typedef struct _SELF_ID {
243 ULONG SID_Phys_ID:6; // Byte 0 - Bits 0-5
244 ULONG SID_Packet_ID:2; // Byte 0 - Bits 6-7
245 ULONG SID_Gap_Count:6; // Byte 1 - Bits 0-5
246 ULONG SID_Link_Active:1; // Byte 1 - Bit 6
247 ULONG SID_Zero:1; // Byte 1 - Bit 7
248 ULONG SID_Power_Class:3; // Byte 2 - Bits 0-2
249 ULONG SID_Contender:1; // Byte 2 - Bit 3
250 ULONG SID_Delay:2; // Byte 2 - Bits 4-5
251 ULONG SID_Speed:2; // Byte 2 - Bits 6-7
252 ULONG SID_More_Packets:1; // Byte 3 - Bit 0
253 ULONG SID_Initiated_Rst:1; // Byte 3 - Bit 1
254 ULONG SID_Port3:2; // Byte 3 - Bits 2-3
255 ULONG SID_Port2:2; // Byte 3 - Bits 4-5
256 ULONG SID_Port1:2; // Byte 3 - Bits 6-7
257} SELF_ID, *PSELF_ID;
258
259//
260// Additional 1394 Self ID packet format (only used when More bit is on)
261//
262typedef struct _SELF_ID_MORE {
263 ULONG SID_Phys_ID:6; // Byte 0 - Bits 0-5
264 ULONG SID_Packet_ID:2; // Byte 0 - Bits 6-7
265 ULONG SID_PortA:2; // Byte 1 - Bits 0-1
266 ULONG SID_Reserved2:2; // Byte 1 - Bits 2-3
267 ULONG SID_Sequence:3; // Byte 1 - Bits 4-6
268 ULONG SID_One:1; // Byte 1 - Bit 7
269 ULONG SID_PortE:2; // Byte 2 - Bits 0-1
270 ULONG SID_PortD:2; // Byte 2 - Bits 2-3
271 ULONG SID_PortC:2; // Byte 2 - Bits 4-5
272 ULONG SID_PortB:2; // Byte 2 - Bits 6-7
273 ULONG SID_More_Packets:1; // Byte 3 - Bit 0
274 ULONG SID_Reserved3:1; // Byte 3 - Bit 1
275 ULONG SID_PortH:2; // Byte 3 - Bits 2-3
276 ULONG SID_PortG:2; // Byte 3 - Bits 4-5
277 ULONG SID_PortF:2; // Byte 3 - Bits 6-7
278} SELF_ID_MORE, *PSELF_ID_MORE;
279
280//
281// 1394 Topology Map format
282//
283typedef struct _TOPOLOGY_MAP {
284 USHORT TOP_Length; // number of quadlets in map
285 USHORT TOP_CRC; // 16 bit CRC defined by 1212
286 ULONG TOP_Generation; // Generation number
287 USHORT TOP_Node_Count; // Node count
288 USHORT TOP_Self_ID_Count; // Number of Self IDs
289 SELF_ID TOP_Self_ID_Array[1]; // Array of Self IDs
290} TOPOLOGY_MAP, *PTOPOLOGY_MAP;
291
292//
293// 1394 Speed Map format
294//
295typedef struct _SPEED_MAP {
296 USHORT SPD_Length; // number of quadlets in map
297 USHORT SPD_CRC; // 16 bit CRC defined by 1212
298 ULONG SPD_Generation; // Generation number
299 UCHAR SPD_Speed_Code[4032];
300} SPEED_MAP, *PSPEED_MAP;
301
302//
303// Definitions of the structures that correspond to the Host info levels
304//
305typedef struct _GET_LOCAL_HOST_INFO1 {
306 LARGE_INTEGER UniqueId;
307} GET_LOCAL_HOST_INFO1, *PGET_LOCAL_HOST_INFO1;
308
309typedef struct _GET_LOCAL_HOST_INFO2 {
310 ULONG HostCapabilities;
311 ULONG MaxAsyncReadRequest;
312 ULONG MaxAsyncWriteRequest;
313} GET_LOCAL_HOST_INFO2, *PGET_LOCAL_HOST_INFO2;
314
315typedef struct _GET_LOCAL_HOST_INFO3 {
316 ULONG deciWattsSupplied;
317 ULONG Voltage; // x10 -> +3.3 == 33
318 // +5.0 == 50,+12.0 == 120
319 // etc.
320} GET_LOCAL_HOST_INFO3, *PGET_LOCAL_HOST_INFO3;
321
322typedef struct _GET_LOCAL_HOST_INFO4 {
323 PVOID PhysAddrMappingRoutine;
324 PVOID Context;
325} GET_LOCAL_HOST_INFO4, *PGET_LOCAL_HOST_INFO4;
326
327//
328// the caller can set ConfigRomLength to zero, issue the request, which will
329// be failed with STATUS_INVALID_BUFFER_SIZE and the ConfigRomLength will be set
330// by the port driver to the proper length. The caller can then re-issue the request
331// after it has allocated a buffer for the configrom with the correct length
332//
333typedef struct _GET_LOCAL_HOST_INFO5 {
334 PVOID ConfigRom;
335 ULONG ConfigRomLength;
336} GET_LOCAL_HOST_INFO5, *PGET_LOCAL_HOST_INFO5;
337
338typedef struct _GET_LOCAL_HOST_INFO6 {
339 ADDRESS_OFFSET CsrBaseAddress;
340 ULONG CsrDataLength;
341 UCHAR CsrDataBuffer[1];
342} GET_LOCAL_HOST_INFO6, *PGET_LOCAL_HOST_INFO6;
343
344//
345// Definitions of the structures that correspond to the Host info levels
346//
347typedef struct _SET_LOCAL_HOST_PROPS2 {
348 ULONG GapCountLowerBound;
349} SET_LOCAL_HOST_PROPS2, *PSET_LOCAL_HOST_PROPS2;
350
351typedef struct _SET_LOCAL_HOST_PROPS3 {
352 ULONG fulFlags;
353 HANDLE hCromData;
354 ULONG nLength;
355 UCHAR Buffer[1];
356// PMDL Mdl;
357} SET_LOCAL_HOST_PROPS3, *PSET_LOCAL_HOST_PROPS3;
358
359//
360// 1394 Phy Configuration packet format
361//
362typedef struct _PHY_CONFIGURATION_PACKET {
363 ULONG PCP_Phys_ID:6; // Byte 0 - Bits 0-5
364 ULONG PCP_Packet_ID:2; // Byte 0 - Bits 6-7
365 ULONG PCP_Gap_Count:6; // Byte 1 - Bits 0-5
366 ULONG PCP_Set_Gap_Count:1; // Byte 1 - Bit 6
367 ULONG PCP_Force_Root:1; // Byte 1 - Bit 7
368 ULONG PCP_Reserved1:8; // Byte 2 - Bits 0-7
369 ULONG PCP_Reserved2:8; // Byte 3 - Bits 0-7
370 ULONG PCP_Inverse; // Inverse quadlet
371} PHY_CONFIGURATION_PACKET, *PPHY_CONFIGURATION_PACKET;
372
373////////////////////////////////////////////////
374// //
375// End structures and defines from DDK 1394.h //
376// //
377////////////////////////////////////////////////
378
379// be sure to include the version of the header that lives in the same directory
380#include "./1394common.h"
381
382// structures and defines used by the exported C functions:
383
384typedef struct _DEVICE_LIST {
385 CHAR DeviceName[255];
386} DEVICE_LIST, *PDEVICE_LIST;
387
388typedef struct _DEVICE_DATA {
389 ULONG numDevices;
390 DEVICE_LIST deviceList[10];
391} DEVICE_DATA, *PDEVICE_DATA;
392
393#define bswap(value) (((ULONG) (value)) << 24 |\
394 (((ULONG) (value)) & 0x0000FF00) << 8 |\
395 (((ULONG) (value)) & 0x00FF0000) >> 8 |\
396 ((ULONG) (value)) >> 24)
397
398#define bswapw(value) (((USHORT) (value)) << 8 |\
399 (((USHORT) (value)) & 0xff00) >> 8)
400
401//
402// function prototypes
403//
404
405// isochapi.c
406
407ULONG
408CAMAPI
409IsochAllocateBandwidth(
410 HWND hWnd,
411 PSTR szDeviceName,
412 PISOCH_ALLOCATE_BANDWIDTH isochAllocateBandwidth
413 );
414
415ULONG
416CAMAPI
417IsochAllocateChannel(
418 HWND hWnd,
419 PSTR szDeviceName,
420 PISOCH_ALLOCATE_CHANNEL isochAllocateChannel
421 );
422
423ULONG
424CAMAPI
425IsochAllocateResources(
426 HWND hWnd,
427 PSTR szDeviceName,
428 PISOCH_ALLOCATE_RESOURCES isochAllocateResources
429 );
430
431ULONG
432CAMAPI
433IsochFreeBandwidth(
434 HWND hWnd,
435 PSTR szDeviceName,
436 HANDLE hBandwidth
437 );
438
439ULONG
440CAMAPI
441IsochFreeChannel(
442 HWND hWnd,
443 PSTR szDeviceName,
444 ULONG nChannel
445 );
446
447ULONG
448CAMAPI
449IsochFreeResources(
450 HWND hWnd,
451 PSTR szDeviceName,
452 HANDLE hResource
453 );
454
455ULONG
456CAMAPI
457IsochListen(
458 HWND hWnd,
459 PSTR szDeviceName,
460 PISOCH_LISTEN isochListen
461 );
462
463ULONG
464CAMAPI
465IsochQueryCurrentCycleTime(
466 HWND hWnd,
467 PSTR szDeviceName,
468 PCYCLE_TIME CycleTime
469 );
470
471ULONG
472CAMAPI
473IsochQueryResources(
474 HWND hWnd,
475 PSTR szDeviceName,
476 PISOCH_QUERY_RESOURCES isochQueryResources
477 );
478
479ULONG
480CAMAPI
481IsochSetChannelBandwidth(
482 HWND hWnd,
483 PSTR szDeviceName,
484 PISOCH_SET_CHANNEL_BANDWIDTH isochSetChannelBandwidth
485 );
486
487ULONG
488CAMAPI
489IsochStop(
490 HWND hWnd,
491 PSTR szDeviceName,
492 PISOCH_STOP isochStop
493 );
494
495ULONG
496CAMAPI
497IsochTalk(
498 HWND hWnd,
499 PSTR szDeviceName,
500 PISOCH_TALK isochTalk
501 );
502
503// 1394main.c
504
505void
506CAMAPI
507ResetCameraState(
508 PSTR szDeviceName
509 );
510
511DWORD
512CAMAPI
513ReadRegister(
514 PSTR szDeviceName,
515 ULONG ulOffset,
516 PUCHAR bytes
517 );
518
519DWORD
520CAMAPI
521ReadRegisterUL(
522 PSTR szDeviceName,
523 ULONG ulOffset,
524 PULONG pData
525 );
526
527DWORD
528CAMAPI
529WriteRegister(
530 PSTR szDeviceName,
531 ULONG ulOffset,
532 PUCHAR bytes
533 );
534
535DWORD
536CAMAPI
537WriteRegisterUL(
538 PSTR szDeviceName,
539 ULONG ulOffset,
540 ULONG data
541 );
542
543
544DWORD
545CAMAPI
546GetModelName(
547 PSTR szDeviceName,
548 PSTR buffer,
549 ULONG buflen
550 );
551
552DWORD
553CAMAPI
554GetVendorName(
555 PSTR szDeviceName,
556 PSTR buffer,
557 ULONG buflen
558 );
559
560DWORD
561CAMAPI
562GetUniqueID(
563 PSTR szDeviceName,
564 PLARGE_INTEGER pliUniqueID
565 );
566
567DWORD
568CAMAPI
569GetCameraSpecification(
570 PSTR szDeviceName,
571 PCAMERA_SPECIFICATION pSpec
572 );
573
574DWORD
575CAMAPI
576GetCmdrState(
577 PSTR szDeviceName
578 );
579
580DWORD
581CAMAPI
582ResetCmdrState(
583 PSTR szDeviceName
584 );
585
586DWORD
587CAMAPI
588SetCmdrTraceLevel(
589 PSTR szDeviceName,
590 DWORD nlevel
591 );
592
593DWORD
594CAMAPI
595GetDeviceList(
596 PDEVICE_DATA DeviceData
597 );
598
599ULONG
600CAMAPI
601GetCmdrVersion(
602 HWND hWnd,
603 PSTR szDeviceName,
604 PVERSION_DATA Version,
605 BOOL bMatch
606 );
607
608// getmaxspeed was moved from 1394camapi.c into 1394main.c because it was the only function we use from that file
609
610ULONG
611CAMAPI
612GetMaxSpeedBetweenDevices(
613 HWND hWnd,
614 PSTR szDeviceName,
615 PGET_MAX_SPEED_BETWEEN_DEVICES GetMaxSpeedBetweenDevices
616 );
617
618// Opendevice moved out of util.c for similar reasons
619
620HANDLE
621CAMAPI
622OpenDevice(
623 PSTR szDeviceName,
624 BOOL bOverLapped
625 );
626
627// debug.c
628
629void
630CAMAPI
631SetDllTraceLevel(int nlevel);
632
633
634// cap off the extern "C"
635
636#ifdef __cplusplus
637}
638#endif
639
640#endif /* __1394_CAMAPI_H__ */
641
Note: See TracBrowser for help on using the repository browser.