summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/cam.h
diff options
context:
space:
mode:
Diffstat (limited to 'fw/fe310/eos/cam.h')
-rw-r--r--fw/fe310/eos/cam.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/fw/fe310/eos/cam.h b/fw/fe310/eos/cam.h
new file mode 100644
index 0000000..f61757b
--- /dev/null
+++ b/fw/fe310/eos/cam.h
@@ -0,0 +1,88 @@
+#include <stdint.h>
+
+typedef enum {
+ PIXFORMAT_INVALID = 0,
+ PIXFORMAT_BINARY, // 1BPP/BINARY
+ PIXFORMAT_GRAYSCALE, // 1BPP/GRAYSCALE
+ PIXFORMAT_RGB565, // 2BPP/RGB565
+ PIXFORMAT_YUV422, // 2BPP/YUV422
+ PIXFORMAT_BAYER, // 1BPP/RAW
+ PIXFORMAT_JPEG, // JPEG/COMPRESSED
+} pixformat_t;
+
+typedef enum {
+ FRAMESIZE_INVALID = 0,
+ // C/SIF Resolutions
+ FRAMESIZE_QQCIF, // 88x72
+ FRAMESIZE_QCIF, // 176x144
+ FRAMESIZE_CIF, // 352x288
+ FRAMESIZE_QQSIF, // 88x60
+ FRAMESIZE_QSIF, // 176x120
+ FRAMESIZE_SIF, // 352x240
+ // VGA Resolutions
+ FRAMESIZE_QQQQVGA, // 40x30
+ FRAMESIZE_QQQVGA, // 80x60
+ FRAMESIZE_QQVGA, // 160x120
+ FRAMESIZE_QVGA, // 320x240
+ FRAMESIZE_VGA, // 640x480
+ FRAMESIZE_HQQQVGA, // 60x40
+ FRAMESIZE_HQQVGA, // 120x80
+ FRAMESIZE_HQVGA, // 240x160
+ // FFT Resolutions
+ FRAMESIZE_64X32, // 64x32
+ FRAMESIZE_64X64, // 64x64
+ FRAMESIZE_128X64, // 128x64
+ FRAMESIZE_128X128, // 128x128
+ FRAMESIZE_320X320, // 320x320
+ // Other
+ FRAMESIZE_LCD, // 128x160
+ FRAMESIZE_QQVGA2, // 128x160
+ FRAMESIZE_WVGA, // 720x480
+ FRAMESIZE_WVGA2, // 752x480
+ FRAMESIZE_SVGA, // 800x600
+ FRAMESIZE_XGA, // 1024x768
+ FRAMESIZE_SXGA, // 1280x1024
+ FRAMESIZE_UXGA, // 1600x1200
+ FRAMESIZE_HD, // 1280x720
+ FRAMESIZE_FHD, // 1920x1080
+ FRAMESIZE_QHD, // 2560x1440
+ FRAMESIZE_QXGA, // 2048x1536
+ FRAMESIZE_WQXGA, // 2560x1600
+ FRAMESIZE_WQXGA2, // 2592x1944
+} framesize_t;
+
+typedef enum {
+ GAINCEILING_2X,
+ GAINCEILING_4X,
+ GAINCEILING_8X,
+ GAINCEILING_16X,
+ GAINCEILING_32X,
+ GAINCEILING_64X,
+ GAINCEILING_128X,
+} gainceiling_t;
+
+typedef enum {
+ SDE_NORMAL,
+ SDE_NEGATIVE,
+} sde_t;
+
+extern const int _eos_cam_resolution[][2];
+
+#define IM_LOG2_2(x) (((x) & 0x2ULL) ? ( 2 ) : 1) // NO ({ ... }) !
+#define IM_LOG2_4(x) (((x) & 0xCULL) ? ( 2 + IM_LOG2_2((x) >> 2)) : IM_LOG2_2(x)) // NO ({ ... }) !
+#define IM_LOG2_8(x) (((x) & 0xF0ULL) ? ( 4 + IM_LOG2_4((x) >> 4)) : IM_LOG2_4(x)) // NO ({ ... }) !
+#define IM_LOG2_16(x) (((x) & 0xFF00ULL) ? ( 8 + IM_LOG2_8((x) >> 8)) : IM_LOG2_8(x)) // NO ({ ... }) !
+#define IM_LOG2_32(x) (((x) & 0xFFFF0000ULL) ? (16 + IM_LOG2_16((x) >> 16)) : IM_LOG2_16(x)) // NO ({ ... }) !
+#define IM_LOG2(x) (((x) & 0xFFFFFFFF00000000ULL) ? (32 + IM_LOG2_32((x) >> 32)) : IM_LOG2_32(x)) // NO ({ ... }) !
+
+#define IM_MAX(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
+#define IM_MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
+#define IM_DIV(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _b ? (_a / _b) : 0; })
+#define IM_MOD(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _b ? (_a % _b) : 0; })
+
+void eos_cam_capture(void);
+int eos_cam_capture_done(void);
+void eos_cam_capture_wait(void);
+uint32_t eos_cam_fbuf_size(void);
+void eos_cam_fbuf_read(uint8_t *buffer, uint16_t sz, int first);
+void eos_cam_fbuf_done(void);