Debian Codegraph @

camlibs/toshiba/pdrm11/pdrm11.h

raw
1 /* pdrm11.h -- interfaces directly with the camera
2 *
3 * Copyright 2003 David Hogue <[email protected]>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
19 */
20
21 #ifndef CAMLIBS_TOSHIBA_PDRM11_PDRM11_H
22 #define CAMLIBS_TOSHIBA_PDRM11_PDRM11_H
23
24 #include "config.h"
25 #include <gphoto2/gphoto2.h>
26 #include <stdint.h>
27
28 /* once in a while a gp_port command will fail and then work on a
29 * second try this tries to run the command twice and returns the
30 * error code if it fails the second time */
31 #define CHECK(result) { \
32 int res; \
33 res = result; \
34 if (res < 0) { \
35 res = result; \
36 if (res < 0) { \
37 GP_DEBUG("%s--%d: %s returned 0x%x", __FILE__, __LINE__, #result, res); \
38 return res; \
39 } \
40 } \
41 }
42
43 #define CHECK_AND_FREE(result, buf) { \
44 int res; \
45 res = result; \
46 if (res < 0) { \
47 res = result; \
48 if (res < 0) { \
49 GP_DEBUG("%s--%d: %s returned 0x%x", __FILE__, __LINE__, #result, res); \
50 free (buf); \
51 return res; \
52 } \
53 } \
54 }
55
56
57 #define PDRM11_CMD_INIT1 htole16( 0x1f40 )
58 #define PDRM11_CMD_INIT2 htole16( 0x1f30 )
59 #define PDRM11_CMD_GET_PIC htole16( 0x9300 )
60 #define PDRM11_CMD_GET_THUMB htole16( 0x9b00 )
61 #define PDRM11_CMD_GET_INFO htole16( 0xad00 )
62 #define PDRM11_CMD_SELECT_PIC2 htole16( 0xae00 )
63 #define PDRM11_CMD_SELECT_PIC1 htole16( 0xb200 )
64 #define PDRM11_CMD_GET_NUMPICS htole16( 0xb600 )
65 #define PDRM11_CMD_GET_FILENAME htole16( 0xb900 )
66 #define PDRM11_CMD_GET_FILESIZE htole16( 0xb900 )
67 #define PDRM11_CMD_DELETE htole16( 0xba40 )
68 #define PDRM11_CMD_ZERO htole16( 0xbf01 ) /* not sure what this is, but it almost always returns 00 00 */
69 #define PDRM11_CMD_READY htole16( 0xd000 )
70 #define PDRM11_CMD_GET_THUMBSIZE htole16( 0xe600 )
71 #define PDRM11_CMD_PING1 htole16( 0xd700 )
72 #define PDRM11_CMD_PING2 htole16( 0xd800 )
73 #define PDRM11_CMD_PING3 htole16( 0xd701 )
74 #define PDRM11_TYPE_JPEG 1
75 #define PDRM11_TYPE_TIFF 2
76
77
78 int pdrm11_init(GPPort *port);
79 int pdrm11_get_file(CameraFilesystem *fs, const char *filename, CameraFileType type,
80 CameraFile *file, GPPort *port, uint16_t picNum);
81 int pdrm11_get_filenames(GPPort *port, CameraList *list);
82 int pdrm11_delete_file(GPPort *port, int picNum);
83
84
85
86 #endif /* !defined(CAMLIBS_TOSHIBA_PDRM11_PDRM11_H) */