KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
dreameye.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 dc/maple/dreameye.h
4 Copyright (C) 2005, 2009, 2010 Lawrence Sebald
5
6*/
7
8/** \file dc/maple/dreameye.h
9 \brief Definitions for using the Dreameye Camera device.
10 \ingroup peripherals_camera
11
12 This file contains the definitions needed to access the Maple Camera type
13 device (aka, the Dreameye). Currently, this driver allows you to download
14 the still pictures that are saved on the camera and delete them. It does not
15 allow you to use the camera for video input currently.
16
17 \author Lawrence Sebald
18*/
19
20#ifndef __DC_MAPLE_DREAMEYE_H
21#define __DC_MAPLE_DREAMEYE_H
22
23#include <sys/cdefs.h>
24__BEGIN_DECLS
25
26#include <arch/types.h>
27#include <dc/maple.h>
28
29/** \defgroup peripherals_camera Camera
30 \brief Maple driver for the DreamEye peripheral
31 \ingroup peripherals
32
33 @{
34*/
35
36/** \brief Dreameye status structure.
37
38 This structure contains information about the status of the Camera device
39 and can be fetched with maple_dev_status(). You should not change any of
40 this information, it should all be considered read-only. Most of the fields
41 in here are related to image transfers, and messing with them during a
42 transfer could screw things up.
43
44 \headerfile dc/maple/dreameye.h
45*/
46typedef struct dreameye_state {
47 /** \brief The number of images on the device. */
49
50 /** \brief Is the image_count field valid? */
52
53 /** \brief The number of transfer operations required for the selected
54 image. */
56
57 /** \brief Is an image transferring now? */
59
60 /** \brief Storage for image data. */
62
63 /** \brief The size of the image in bytes. */
65
66 /** \brief The image number currently being transferred. */
69
70/** \brief Get the number of images on the device.
71
72 This constant is used with the MAPLE_COMMAND_GETCOND command to fetch the
73 number of images on the device.
74*/
75#define DREAMEYE_GETCOND_NUM_IMAGES 0x81
76
77/** \brief Get the number of transfers to copy an image.
78
79 This constant is used with the MAPLE_COMMAND_GETCOND command to fetch the
80 number of times a transfer command must be sent to get the image specified.
81*/
82#define DREAMEYE_GETCOND_TRANSFER_COUNT 0x83
83
84/** \brief Get an image from the device.
85
86 This subcommand is used with the MAPLE_COMMAND_CAMCONTROL command to fetch
87 part of image data from the specified image.
88*/
89#define DREAMEYE_SUBCOMMAND_IMAGEREQ 0x04
90
91/** \brief Erase an image from the device.
92
93 This subcommand is used with the MAPLE_COMMAND_CAMCONTROL command to remove
94 an image from the device.
95*/
96#define DREAMEYE_SUBCOMMAND_ERASE 0x05
97
98/** \brief Error return command.
99
100 This subcommand is used by the dreameye with the MAPLE_COMMAND_CAMCONTROL
101 command to indicate an error occurred in a subcommand.
102*/
103#define DREAMEYE_SUBCOMMAND_ERROR 0xFF
104
105/** \brief Continue transferring an image. */
106#define DREAMEYE_IMAGEREQ_CONTINUE 0x00
107
108/** \brief Start transferring an image from its start. */
109#define DREAMEYE_IMAGEREQ_START 0x40
110
111/** \brief Get the number of images on the Dreameye.
112
113 This function fetches the number of saved images on the specified Dreameye
114 device. It can be sent to any of the subdevices of the MAPLE_FUNC_CONTROLLER
115 root device of the Dreameye. When the response comes from the device, the
116 image_count field of the dreameye_state_t for the specified device will have
117 the number of images on the device, and image_count_valid will be set to 1.
118
119 \param dev The device to query.
120 \param block Set to 1 to wait for the Dreameye to respond.
121 \retval MAPLE_EOK On success.
122 \retval MAPLE_ETIMEOUT The command timed out while blocking.
123 \retval MAPLE_EAGAIN Could not send the command to the device, try again.
124*/
126
127/** \brief Transfer an image from the Dreameye.
128
129 This function fetches a single image from the specified Dreameye device.
130 This function will block, and can take a little while to execute. You must
131 use the first subdevice of the MAPLE_FUNC_CONTROLLER root device of the
132 Dreameye as the dev parameter.
133
134 \param dev The device to get an image from.
135 \param image The image number to download.
136 \param data A pointer to a buffer to store things in. This
137 will be allocated by the function and you are
138 responsible for freeing the data when you are done.
139 \param img_sz A pointer to storage for the size of the image, in
140 bytes.
141 \retval MAPLE_EOK On success.
142 \retval MAPLE_EFAIL On error.
143*/
145 int *img_sz);
146
147/** \brief Erase an image from the Dreameye.
148
149 This function erases the specified image from the Dreameye device. This
150 command can be sent to any of the subdevices of the MAPLE_FUNC_CONTROLLER
151 root device of the Dreameye.
152
153 \param dev The device to erase from.
154 \param image The image number to erase (0xFF to erase all).
155 \param block Set to 1 to wait for the Dreameye to respond.
156 \retval MAPLE_EOK On success.
157 \retval MAPLE_EAGAIN Couldn't send the command, try again.
158 \retval MAPLE_ETIMEOUT Timeout on blocking.
159 \retval MAPLE_EINVALID Invalid image number specified.
160*/
161int dreameye_erase_image(maple_device_t *dev, uint8 image, int block);
162
163/* \cond */
164/* Init / Shutdown */
165void dreameye_init(void);
166void dreameye_shutdown(void);
167/* \endcond */
168
169/** @} */
170
171__END_DECLS
172
173#endif /* __DC_MAPLE_DREAMEYE_H */
int dreameye_get_image(maple_device_t *dev, uint8 image, uint8 **data, int *img_sz)
Transfer an image from the Dreameye.
int dreameye_erase_image(maple_device_t *dev, uint8 image, int block)
Erase an image from the Dreameye.
int dreameye_get_image_count(maple_device_t *dev, int block)
Get the number of images on the Dreameye.
unsigned char uint8
8-bit unsigned integer
Definition types.h:35
Maple Bus driver interface.
Dreameye status structure.
Definition dreameye.h:46
int img_transferring
Is an image transferring now?
Definition dreameye.h:58
int image_count
The number of images on the device.
Definition dreameye.h:48
int img_size
The size of the image in bytes.
Definition dreameye.h:64
uint8 img_number
The image number currently being transferred.
Definition dreameye.h:67
int image_count_valid
Is the image_count field valid?
Definition dreameye.h:51
uint8 * img_buf
Storage for image data.
Definition dreameye.h:61
int transfer_count
The number of transfer operations required for the selected image.
Definition dreameye.h:55
One maple device.
Definition maple.h:270
Common integer types.