1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2010 - 2015, Intel Corporation. 5 */ 6 7 #ifndef __IA_CSS_FRAME_H__ 8 #define __IA_CSS_FRAME_H__ 9 10 /* ISP2401 */ 11 #include <ia_css_types.h> 12 13 #include <ia_css_frame_format.h> 14 #include <ia_css_frame_public.h> 15 #include "dma.h" 16 17 /********************************************************************* 18 **** Frame INFO APIs 19 **********************************************************************/ 20 /* @brief Sets the given width and alignment to the frame info 21 * 22 * @param 23 * @param[in] info The info to which parameters would set 24 * @param[in] width The width to be set to info 25 * @param[in] aligned The aligned to be set to info 26 * @return 27 */ 28 void ia_css_frame_info_set_width(struct ia_css_frame_info *info, 29 unsigned int width, 30 unsigned int min_padded_width); 31 32 /* @brief Sets the given format to the frame info 33 * 34 * @param 35 * @param[in] info The info to which parameters would set 36 * @param[in] format The format to be set to info 37 * @return 38 */ 39 void ia_css_frame_info_set_format(struct ia_css_frame_info *info, 40 enum ia_css_frame_format format); 41 42 /* @brief Sets the frame info with the given parameters 43 * 44 * @param 45 * @param[in] info The info to which parameters would set 46 * @param[in] width The width to be set to info 47 * @param[in] height The height to be set to info 48 * @param[in] format The format to be set to info 49 * @param[in] aligned The aligned to be set to info 50 * @return 51 */ 52 void ia_css_frame_info_init(struct ia_css_frame_info *info, 53 unsigned int width, 54 unsigned int height, 55 enum ia_css_frame_format format, 56 unsigned int aligned); 57 58 /* @brief Checks whether 2 frame infos has the same resolution 59 * 60 * @param 61 * @param[in] frame_a The first frame to be compared 62 * @param[in] frame_b The second frame to be compared 63 * @return Returns true if the frames are equal 64 */ 65 bool ia_css_frame_info_is_same_resolution( 66 const struct ia_css_frame_info *info_a, 67 const struct ia_css_frame_info *info_b); 68 69 /* @brief Check the frame info is valid 70 * 71 * @param 72 * @param[in] info The frame attributes to be initialized 73 * @return The error code. 74 */ 75 int ia_css_frame_check_info(const struct ia_css_frame_info *info); 76 77 /********************************************************************* 78 **** Frame APIs 79 **********************************************************************/ 80 81 /* @brief Initialize the plane depending on the frame type 82 * 83 * @param 84 * @param[in] frame The frame attributes to be initialized 85 * @return The error code. 86 */ 87 int ia_css_frame_init_planes(struct ia_css_frame *frame); 88 89 /* @brief Free an array of frames 90 * 91 * @param 92 * @param[in] num_frames The number of frames to be freed in the array 93 * @param[in] **frames_array The array of frames to be removed 94 * @return 95 */ 96 void ia_css_frame_free_multiple(unsigned int num_frames, 97 struct ia_css_frame **frames_array); 98 99 /* @brief Allocate a CSS frame structure of given size in bytes.. 100 * 101 * @param frame The allocated frame. 102 * @param[in] size_bytes The frame size in bytes. 103 * @return The error code. 104 * 105 * Allocate a frame using the given size in bytes. 106 * The frame structure is partially null initialized. 107 */ 108 int ia_css_frame_allocate_with_buffer_size(struct ia_css_frame **frame, 109 const unsigned int size_bytes); 110 111 /* @brief Check whether 2 frames are same type 112 * 113 * @param 114 * @param[in] frame_a The first frame to be compared 115 * @param[in] frame_b The second frame to be compared 116 * @return Returns true if the frames are equal 117 */ 118 bool ia_css_frame_is_same_type( 119 const struct ia_css_frame *frame_a, 120 const struct ia_css_frame *frame_b); 121 122 /* @brief Configure a dma port from frame info 123 * 124 * @param 125 * @param[in] config The DAM port configuration 126 * @param[in] info The frame info 127 * @return 128 */ 129 int ia_css_dma_configure_from_info(struct dma_port_config *config, 130 const struct ia_css_frame_info *info); 131 132 unsigned int ia_css_frame_pad_width(unsigned int width, enum ia_css_frame_format format); 133 134 #endif /* __IA_CSS_FRAME_H__ */ 135