1 /*
2  * 1394-Based Digital Camera Control Library
3  *
4  * Platform specific headers
5  *
6  * Written by David Moore <dcm@acm.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22 
23 #ifndef __DC1394_PLATFORM_H__
24 #define __DC1394_PLATFORM_H__
25 
26 #include <stdint.h>
27 #include <dc1394/camera.h>
28 
29 #include "config.h"
30 
31 #ifdef HAVE_MACOSX
32 #include <CoreFoundation/CoreFoundation.h>
33 #endif
34 
35 typedef struct _platform_t platform_t;
36 typedef struct _platform_device_t platform_device_t;
37 typedef struct _platform_camera_t platform_camera_t;
38 
39 typedef struct _platform_device_list_t {
40     platform_t * p;
41     platform_device_t ** devices;
42     int num_devices;
43 } platform_device_list_t;
44 
45 typedef struct _platform_dispatch_t {
46     platform_t * (*platform_new)(void);
47     void (*platform_free)(platform_t *);
48 
49     platform_device_list_t * (*get_device_list)(platform_t *);
50     void (*free_device_list)(platform_device_list_t *);
51     int (*device_get_config_rom)(platform_device_t *, uint32_t *, int *);
52 
53     platform_camera_t * (*camera_new)(platform_t *, platform_device_t *,
54             uint32_t);
55     void (*camera_free)(platform_camera_t *);
56     void (*camera_set_parent)(platform_camera_t *, dc1394camera_t *);
57 
58     dc1394error_t (*camera_read)(platform_camera_t *, uint64_t,
59             uint32_t *, int);
60     dc1394error_t (*camera_write)(platform_camera_t *, uint64_t,
61             const uint32_t *, int);
62 
63     dc1394error_t (*reset_bus)(platform_camera_t *);
64     dc1394error_t (*read_cycle_timer)(platform_camera_t *, uint32_t *,
65             uint64_t *);
66     dc1394error_t (*camera_get_node)(platform_camera_t *, uint32_t *,
67             uint32_t *);
68     dc1394error_t (*camera_print_info)(platform_camera_t *, FILE *);
69     dc1394error_t (*set_broadcast)(platform_camera_t *, dc1394bool_t);
70     dc1394error_t (*get_broadcast)(platform_camera_t *, dc1394bool_t *);
71 
72     dc1394error_t (*capture_setup)(platform_camera_t *, uint32_t, uint32_t);
73     dc1394error_t (*capture_stop)(platform_camera_t *);
74 
75     dc1394error_t (*capture_dequeue)(platform_camera_t *,
76             dc1394capture_policy_t, dc1394video_frame_t **);
77     dc1394error_t (*capture_enqueue)(platform_camera_t *,
78             dc1394video_frame_t *);
79 
80     int (*capture_get_fileno)(platform_camera_t *);
81     dc1394bool_t (*capture_is_frame_corrupt)(platform_camera_t *,
82             dc1394video_frame_t *);
83 
84     dc1394error_t (*iso_set_persist)(platform_camera_t *);
85     dc1394error_t (*iso_allocate_channel)(platform_camera_t *, uint64_t,
86             int *);
87     dc1394error_t (*iso_release_channel)(platform_camera_t *, int);
88     dc1394error_t (*iso_allocate_bandwidth)(platform_camera_t *, int);
89     dc1394error_t (*iso_release_bandwidth)(platform_camera_t *, int);
90     dc1394error_t (*capture_set_callback)(platform_camera_t * , dc1394capture_callback_t , void * );
91 
92 #ifdef HAVE_MACOSX
93     dc1394error_t (*capture_schedule_with_runloop)(platform_camera_t * , CFRunLoopRef , CFStringRef);
94 #else
95     dc1394error_t (*capture_schedule_with_runloop)(platform_camera_t *);
96 
97 #endif
98 
99 } platform_dispatch_t;
100 
101 
102 #endif
103