1 /*
2  * Copyright (c) 2006-2023, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author            Notes
8  * 2023-03-24     spaceman          the first version
9  */
10 
11 #ifndef __DRV_DCMI_H__
12 #define __DRV_DCMI_H__
13 
14 #include <rtthread.h>
15 #include "board.h"
16 
17 #ifdef BSP_USING_DCMI
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define DCMI_DEVICE(dev)              (struct stm32_dcmi *)(dev)
24 
25 #define DCMI_CTRL_CROP                (0x01)
26 #define DCMI_CTRL_TRANSMIT_CONTINUOUS (0x02)
27 #define DCMI_CTRL_TRANSMIT_SNAPSHOT   (0x03)
28 #define DCMI_CTRL_SUSPEND             (0x04)
29 #define DCMI_CTRL_RESUME              (0x05)
30 #define DCMI_CTRL_STOP                (0x06)
31 #define DCMI_CTRL_GET_FPS             (0x07)
32 
33 struct stm32_dcmi {
34     struct rt_device parent;
35 
36     DCMI_HandleTypeDef dcmi_handle;
37     DMA_HandleTypeDef dma_handle;
38 
39     struct rt_semaphore cam_semaphore;
40 };
41 
42 struct stm32_dcmi_cropsize {
43     uint16_t displey_xsize;
44     uint16_t displey_ysize;
45     uint16_t sensor_xsize;
46     uint16_t sensor_ysize;
47 };
48 
49 struct stm32_dcmi_dma_transmitbuffer {
50     uint32_t dma_buffer;
51     uint32_t dma_buffersize;
52 };
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 
58 #endif /* BSP_USING_DCMI */
59 
60 #endif /* __DRV_DCMI_H__ */
61