root/branches/streaming-rework/src/libstreaming/cip.h

Revision 435, 3.6 kB (checked in by pieterpalmers, 17 years ago)

src/devicemanager:
- start OSC server for the device manager

src/devicemanager,
src/iavdevice,
src/libieee1394/configrom:
- inherit from OscNode? to become Osc'able

src/bounce,
src/libstreaming/AmdtpStreamProcessor,
src/libstreaming/AmdtpSlaveStreamProcessor:
- fixed bounce device implementation, now working

src/bebob:
- fixed midi bug

General:
- removed 'intermediate XML'
- removed obsolete tests
- removed obsolete files
- removed obsolete API calls

Line 
1 #ifndef _IEC61883_CIP_PRIVATE_H
2 #define _IEC61883_CIP_PRIVATE_H
3
4 #include <libraw1394/raw1394.h>
5 #include <endian.h>
6 #include <stdint.h>
7
8 #define IEC61883_FMT_DV 0x00
9 #define IEC61883_FMT_AMDTP 0x10
10 #define IEC61883_FMT_MPEG2 0x20
11
12 #define CIP_TRANSFER_DELAY 9000
13
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 #if __BYTE_ORDER == __BIG_ENDIAN
20
21
22 struct iec61883_packet {
23         /* First quadlet */
24         uint8_t dbs      : 8;
25         uint8_t eoh0     : 2;
26         uint8_t sid      : 6;
27
28         uint8_t dbc      : 8;
29         uint8_t fn       : 2;
30         uint8_t qpc      : 3;
31         uint8_t sph      : 1;
32         uint8_t reserved : 2;
33
34         /* Second quadlet */
35         uint8_t fdf      : 8;
36         uint8_t eoh1     : 2;
37         uint8_t fmt      : 6;
38
39         uint16_t syt      : 16;
40
41         unsigned char data[0];
42 };
43
44 #elif __BYTE_ORDER == __LITTLE_ENDIAN
45
46 struct iec61883_packet {
47         /* First quadlet */
48         uint8_t sid      : 6;
49         uint8_t eoh0     : 2;
50         uint8_t dbs      : 8;
51
52         uint8_t reserved : 2;
53         uint8_t sph      : 1;
54         uint8_t qpc      : 3;
55         uint8_t fn       : 2;
56         uint8_t dbc      : 8;
57
58         /* Second quadlet */
59         uint8_t fmt      : 6;
60         uint8_t eoh1     : 2;
61         uint8_t fdf      : 8;
62
63         uint16_t syt      : 16;
64
65         unsigned char data[0];
66 };
67
68 #else
69
70 #error Unknown bitfield type
71
72 #endif
73
74 /*
75  * The TAG value is present in the isochronous header (first quadlet). It
76  * provides a high level label for the format of data carried by the
77  * isochronous packet.
78  */
79
80 #define IEC61883_TAG_WITHOUT_CIP 0 /* CIP header NOT included */
81 #define IEC61883_TAG_WITH_CIP    1 /* CIP header included. */
82 #define IEC61883_TAG_RESERVED1   2 /* Reserved */
83 #define IEC61883_TAG_RESERVED2   3 /* Reserved */
84
85 #define IEC61883_FDF_NODATA   0xFF
86                
87 /* AM824 format definitions. */
88 #define IEC61883_FDF_AM824 0x00
89 #define IEC61883_FDF_AM824_CONTROLLED 0x04
90 #define IEC61883_FDF_SFC_MASK 0x03
91
92 #define IEC61883_AM824_LABEL              0x40
93 #define IEC61883_AM824_LABEL_RAW_24BITS   0x40
94 #define IEC61883_AM824_LABEL_RAW_20BITS   0x41
95 #define IEC61883_AM824_LABEL_RAW_16BITS   0x42
96 #define IEC61883_AM824_LABEL_RAW_RESERVED 0x43
97
98 #define IEC61883_AM824_VBL_24BITS   0x0
99 #define IEC61883_AM824_VBL_20BITS   0x1
100 #define IEC61883_AM824_VBL_16BITS   0x2
101 #define IEC61883_AM824_VBL_RESERVED 0x3
102
103 /* IEC-60958 format definitions. */
104 #define IEC60958_LABEL   0x0
105 #define IEC60958_PAC_B   0x3 /* Preamble Code 'B': Start of channel 1, at
106                               * the start of a data block. */
107 #define IEC60958_PAC_RSV 0x2 /* Preamble Code 'RESERVED' */
108 #define IEC60958_PAC_M   0x1 /* Preamble Code 'M': Start of channel 1 that
109                               * is not at the start of a data block. */
110 #define IEC60958_PAC_W   0x0 /* Preamble Code 'W': start of channel 2. */
111 #define IEC60958_DATA_VALID   0 /* When cleared means data is valid. */
112 #define IEC60958_DATA_INVALID 1 /* When set means data is not suitable for an ADC. */
113
114 struct iec61883_fraction {
115         int integer;
116         int numerator;
117         int denominator;
118 };
119
120 struct iec61883_cip {
121         struct iec61883_fraction cycle_offset;
122         struct iec61883_fraction ticks_per_syt_offset;
123         struct iec61883_fraction ready_samples;
124         struct iec61883_fraction samples_per_cycle;
125         int dbc, dbs;
126         int cycle_count;
127         int cycle_count2;
128         int mode;
129         int syt_interval;
130         int dimension;
131         int rate;
132         int fdf;
133         int format;
134 };
135
136 void
137 iec61883_cip_init(struct iec61883_cip *cip, int format, int fdf,
138                 int rate, int dbs, int syt_interval);
139 void
140 iec61883_cip_set_transmission_mode(struct iec61883_cip *ptz, int mode);
141
142 int
143 iec61883_cip_get_max_packet_size(struct iec61883_cip *ptz);
144
145 int
146 iec61883_cip_fill_header(int node_id, struct iec61883_cip *cip,
147                 struct iec61883_packet *packet);
148
149 int
150 iec61883_cip_fill_header_nodata(int node_id, struct iec61883_cip *cip,
151                 struct iec61883_packet *packet);
152
153 #ifdef __cplusplus
154 }
155 #endif
156
157 #endif
Note: See TracBrowser for help on using the browser.