• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <driver/media_types.h>
18 #include <driver/dma_types.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 typedef struct {
25 	uint8_t *rxbuf;
26 	uint8_t mem_status;
27 	uint8_t capture_enable;
28 
29 	void (*node_full_handler)(void *curptr, uint32_t newlen, uint8_t is_eof, uint32_t frame_len);
30 	void (*data_end_handler)(void);
31 
32 	uint32_t rxbuf_len;
33 	uint32_t rx_read_len;
34 	uint32_t node_len;
35 	uint32_t frame_id;
36 	uint32_t frame_len;
37 
38 	void (*end_frame_handler)(void *buf, uint32_t frame_len);
39 	void (*frame_capture_handler)(void *buf, uint32_t frame_len);
40 #if CONFIG_GENERAL_DMA
41 	dma_isr_t dma_rx_handler;
42 	uint8_t  dma_channel;
43 #endif
44 } uvc_desc_t;
45 
46 typedef struct {
47 	uint16_t fps;
48 	uint16_t width;
49 	uint16_t height;
50 }uvc_camera_device_t;
51 
52 typedef struct {
53 	uint8_t  type;
54 	uint32_t data;
55 }uvc_msg_t;
56 
57 typedef enum {
58 	UVC_MEM_IDLE,
59 	UVC_MEM_BUSY,
60 	UVC_STATUS_MAX,
61 } uvc_memory_status_t;
62 
63 typedef enum {
64 	UVC_SET_PARAM,
65 	UVC_START,
66 	UVC_STOP,
67 	UVC_EOF,
68 	UVC_CAPTURE,
69 	UVC_EXIT,
70 }uvc_msg_type_t;
71 
72 
73 typedef struct
74 {
75 	uvc_camera_device_t *device;
76 	int (*frame_set_ppi)(media_ppi_t ppi, frame_type_t type);
77 	void (*frame_complete)(frame_buffer_t* buffer);
78 	frame_buffer_t* (*frame_alloc)(void);
79 	void (*uvc_disconnect)(void);
80 } uvc_camera_config_t;
81 
82 
83 #ifdef __cplusplus
84 }
85 #endif
86