diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/components/video/camera/receiver/fsl_camera_receiver.h')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/components/video/camera/receiver/fsl_camera_receiver.h | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/components/video/camera/receiver/fsl_camera_receiver.h b/lib/chibios-contrib/ext/mcux-sdk/components/video/camera/receiver/fsl_camera_receiver.h new file mode 100644 index 000000000..0c1fad6f8 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/components/video/camera/receiver/fsl_camera_receiver.h | |||
@@ -0,0 +1,170 @@ | |||
1 | /* | ||
2 | * Copyright 2017 NXP | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef _FSL_CAMERA_RECEIVER_H_ | ||
10 | #define _FSL_CAMERA_RECEIVER_H_ | ||
11 | |||
12 | #include "fsl_common.h" | ||
13 | #include "fsl_camera.h" | ||
14 | |||
15 | /******************************************************************************* | ||
16 | * Definitions | ||
17 | ******************************************************************************/ | ||
18 | typedef struct _camera_receiver_operations camera_receiver_operations_t; | ||
19 | |||
20 | /*! @brief Camera receiver handle. */ | ||
21 | typedef struct _camera_receiver_handle | ||
22 | { | ||
23 | void *resource; | ||
24 | const camera_receiver_operations_t *ops; | ||
25 | void *privateData; | ||
26 | } camera_receiver_handle_t; | ||
27 | |||
28 | /*! | ||
29 | * @brief Camera receiver callback when new frame received. | ||
30 | * | ||
31 | * Callback function executes when new frame received successfully, the status | ||
32 | * kStatus_Success is passed to upper layer. | ||
33 | */ | ||
34 | typedef void (*camera_receiver_callback_t)(camera_receiver_handle_t *handle, status_t status, void *userData); | ||
35 | |||
36 | /*! @brief Camera receiver operations. */ | ||
37 | struct _camera_receiver_operations | ||
38 | { | ||
39 | status_t (*init)(camera_receiver_handle_t *handle, | ||
40 | const camera_config_t *config, | ||
41 | camera_receiver_callback_t callback, | ||
42 | void *userData); /*!< Init the receiver. */ | ||
43 | status_t (*deinit)(camera_receiver_handle_t *handle); /*!< Deinit the receiver. */ | ||
44 | status_t (*start)(camera_receiver_handle_t *handle); /*!< Start the receiver. */ | ||
45 | status_t (*stop)(camera_receiver_handle_t *handle); /*!< Stop the receiver. */ | ||
46 | status_t (*submitEmptyBuffer)(camera_receiver_handle_t *handle, uint32_t buffer); /*!< Submit the empty | ||
47 | frame buffer to receiver | ||
48 | buffer queue. */ | ||
49 | status_t (*getFullBuffer)(camera_receiver_handle_t *handle, uint32_t *buffer); /*!< Get the full-filled | ||
50 | frame buffer from | ||
51 | the receiver buffer queue. */ | ||
52 | status_t (*init_ext)(camera_receiver_handle_t *handle, | ||
53 | const camera_config_t *config, | ||
54 | const void *specialConfig, | ||
55 | camera_receiver_callback_t callback, | ||
56 | void *userData); /*!< Init the receiver with specific configuration. */ | ||
57 | }; | ||
58 | |||
59 | /******************************************************************************* | ||
60 | * API | ||
61 | ******************************************************************************/ | ||
62 | |||
63 | #if defined(__cplusplus) | ||
64 | extern "C" { | ||
65 | #endif | ||
66 | |||
67 | /*! | ||
68 | * @brief Initializes the camera receiver with user defined configuration. | ||
69 | * | ||
70 | * @param handle Camera receiver handle. | ||
71 | * @param config Pointer to the user-defined configuration structure. | ||
72 | * @param callback Callback when new frame received. | ||
73 | * @param userData Parameter of the callback. | ||
74 | * @return Returns @ref kStatus_Success if initialize success, otherwise returns | ||
75 | * error code. | ||
76 | */ | ||
77 | static inline status_t CAMERA_RECEIVER_Init(camera_receiver_handle_t *handle, | ||
78 | const camera_config_t *config, | ||
79 | camera_receiver_callback_t callback, | ||
80 | void *userData) | ||
81 | { | ||
82 | return handle->ops->init(handle, config, callback, userData); | ||
83 | } | ||
84 | |||
85 | /*! | ||
86 | * @brief Initializes the camera receiver with user defined configuration. | ||
87 | * | ||
88 | * This is an externed API of @ref CAMERA_RECEIVER_Init, it allow upper layer to | ||
89 | * pass in receiver specific configuration. In this case, the | ||
90 | * @ref CAMERA_RECEIVER_Init uses default specific configuration. | ||
91 | * | ||
92 | * @param handle Camera receiver handle. | ||
93 | * @param config Pointer to the user-defined configuration structure. | ||
94 | * @param specialConfig Pointer to the receiver specific configuration. | ||
95 | * @param callback Callback when new frame received. | ||
96 | * @param userData Parameter of the callback. | ||
97 | * @return Returns @ref kStatus_Success if initialize success, otherwise returns | ||
98 | * error code. | ||
99 | */ | ||
100 | static inline status_t CAMERA_RECEIVER_InitExt(camera_receiver_handle_t *handle, | ||
101 | const camera_config_t *config, | ||
102 | const void *specialConfig, | ||
103 | camera_receiver_callback_t callback, | ||
104 | void *userData) | ||
105 | { | ||
106 | return handle->ops->init_ext(handle, config, specialConfig, callback, userData); | ||
107 | } | ||
108 | |||
109 | /*! | ||
110 | * @brief Deinitialize the camera receiver. | ||
111 | * | ||
112 | * @param handle Camera receiver handle. | ||
113 | * @return Returns @ref kStatus_Success if success, otherwise returns error code. | ||
114 | */ | ||
115 | static inline status_t CAMERA_RECEIVER_Deinit(camera_receiver_handle_t *handle) | ||
116 | { | ||
117 | return handle->ops->deinit(handle); | ||
118 | } | ||
119 | |||
120 | /*! | ||
121 | * @brief Start the camera receiver to save input frame to frame buffer queue. | ||
122 | * | ||
123 | * @param handle Camera receiver handle. | ||
124 | * @return Returns @ref kStatus_Success if success, otherwise returns error code. | ||
125 | */ | ||
126 | static inline status_t CAMERA_RECEIVER_Start(camera_receiver_handle_t *handle) | ||
127 | { | ||
128 | return handle->ops->start(handle); | ||
129 | } | ||
130 | |||
131 | /*! | ||
132 | * @brief Stop the camera receiver from saving input frame to frame buffer queue. | ||
133 | * | ||
134 | * @param handle Camera receiver handle. | ||
135 | * @return Returns @ref kStatus_Success if success, otherwise returns error code. | ||
136 | */ | ||
137 | static inline status_t CAMERA_RECEIVER_Stop(camera_receiver_handle_t *handle) | ||
138 | { | ||
139 | return handle->ops->stop(handle); | ||
140 | } | ||
141 | |||
142 | /*! | ||
143 | * @brief Submit the empty frame buffer to the camera receiver buffer queue. | ||
144 | * | ||
145 | * @param handle Camera receiver handle. | ||
146 | * @param buffer The empty frame buffer to submit. | ||
147 | * @return Returns @ref kStatus_Success if success, otherwise returns error code. | ||
148 | */ | ||
149 | static inline status_t CAMERA_RECEIVER_SubmitEmptyBuffer(camera_receiver_handle_t *handle, uint32_t buffer) | ||
150 | { | ||
151 | return handle->ops->submitEmptyBuffer(handle, buffer); | ||
152 | } | ||
153 | |||
154 | /*! | ||
155 | * @brief Get the full frame buffer from the camera receiver buffer queue. | ||
156 | * | ||
157 | * @param handle Camera receiver handle. | ||
158 | * @param buffer The empty frame buffer address. | ||
159 | * @return Returns @ref kStatus_Success if success, otherwise returns error code. | ||
160 | */ | ||
161 | static inline status_t CAMERA_RECEIVER_GetFullBuffer(camera_receiver_handle_t *handle, uint32_t *buffer) | ||
162 | { | ||
163 | return handle->ops->getFullBuffer(handle, buffer); | ||
164 | } | ||
165 | |||
166 | #if defined(__cplusplus) | ||
167 | } | ||
168 | #endif | ||
169 | |||
170 | #endif /* _FSL_CAMERA_RECEIVER_H_ */ | ||