• 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 <common/bk_include.h>
18 #include <driver/media_types.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 typedef enum
25 {
26 	MODULE_DECODER,
27 	MODULE_WIFI,
28 	MODULE_RECODER,
29 	MODULE_CAPTURE,
30 	MODULE_DISPLAY,
31 } frame_module_t;
32 
33 
34 typedef struct
35 {
36 	uint8_t enable : 1;
37 	uint8_t wifi_register : 1;
38 	uint8_t wifi_lock : 1;
39 	uint8_t decoder_register : 1;
40 	uint8_t decoder_lock : 1;
41 	uint8_t recoder_register : 1;
42 	uint8_t recoder_lock : 1;
43 	uint8_t capture_register : 1;
44 	uint8_t capture_lock : 1;
45 	uint8_t display_register : 1;
46 	uint8_t display_lock : 4;
47 	uint8_t minimal_layout : 1;
48 	void (*wifi_comp_cb)(frame_buffer_t *buffer);
49 	void (*decoder_comp_cb)(frame_buffer_t *buffer);
50 	void (*recoder_comp_cb)(frame_buffer_t *buffer);
51 	void (*capture_comp_cb)(frame_buffer_t *buffer);
52 	uint8_t (*display_comp_cb)(frame_buffer_t *buffer);
53 } frame_buffer_info_t;
54 
55 void frame_buffer_generate_complete(frame_buffer_t *buffer, frame_type_t type);
56 frame_buffer_t *frame_buffer_alloc(frame_type_t type);
57 frame_buffer_t *frame_buffer_get_available_frame(frame_type_t type);
58 void frame_buffer_free_request(frame_buffer_t *buffer, frame_module_t module);
59 void frame_buffer_frame_register(frame_module_t module, void *callback);
60 void frame_buffer_frame_deregister(frame_module_t module);
61 void frame_buffer_init(void);
62 void frame_buffer_deinit(void);
63 bool frame_buffer_get_state(void);
64 void frame_buffer_enable(bool enable);
65 int frame_buffer_set_ppi(media_ppi_t ppi, frame_type_t type);
66 void frame_buffer_push_frame(frame_buffer_t *buffer);
67 void frame_buffer_lock_frame(frame_buffer_t *frame);
68 void frame_buffer_free_frame(frame_buffer_t *buffer);
69 int frame_buffer_display_frame_init(void);
70 
71 
72 #ifdef __cplusplus
73 }
74 #endif
75