• 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/dma_types.h>
18 #include <common/bk_err.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #define BK_ERR_JPEG_NOT_INIT    (BK_ERR_JPEG_BASE - 1) /**< JPEG driver not init */
25 
26 typedef uint8_t jpeg_unit_t; /**< jpeg uint id */
27 
28 typedef struct {
29 	uint8_t *rx_buf;      /**< the address of receiving jpeg data */
30 	uint8_t  dma_channel;/**< jpeg encode work mode for transfer data */
31 	uint8_t  yuv_mode;    /**< jpeg module work mode:0/1:jpegencoder/yuv */
32 	uint32_t sys_clk_div; /**< div system clock for jpeg module, div = 1/(1+sys_clk_div) */
33 	uint32_t mclk_div;    /**< div jpeg module clock for MCLK and PCLK, mclk_div:0x00:1/4, 0x01:1/2, 0x10:1/6, 0x11:1/3 */
34 	uint32_t rx_buf_len;  /**< the length for receiving jpeg data */
35 	uint32_t node_len;    /**< dma transfer length */
36 	uint32_t x_pixel;     /**< jpeg encode image resolution for width */
37 	uint32_t y_pixel;     /**< jpeg encode image resolution for height */
38 	dma_isr_t dma_rx_finish_handler; /**< dma transfer finish callback */
39 } jpeg_config_t;
40 
41 typedef struct {
42 	uint32_t x_partial_offset_l;
43 	uint32_t x_partial_offset_r;
44 	uint32_t y_partial_offset_l;
45 	uint32_t y_partial_offset_r;
46 } jpeg_partial_offset_config_t;
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 
52