cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

dm644x_ccdc.h (4399B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3 * Copyright (C) 2006-2009 Texas Instruments Inc
      4 */
      5#ifndef _DM644X_CCDC_H
      6#define _DM644X_CCDC_H
      7#include <media/davinci/ccdc_types.h>
      8#include <media/davinci/vpfe_types.h>
      9
     10/* enum for No of pixel per line to be avg. in Black Clamping*/
     11enum ccdc_sample_length {
     12	CCDC_SAMPLE_1PIXELS,
     13	CCDC_SAMPLE_2PIXELS,
     14	CCDC_SAMPLE_4PIXELS,
     15	CCDC_SAMPLE_8PIXELS,
     16	CCDC_SAMPLE_16PIXELS
     17};
     18
     19/* enum for No of lines in Black Clamping */
     20enum ccdc_sample_line {
     21	CCDC_SAMPLE_1LINES,
     22	CCDC_SAMPLE_2LINES,
     23	CCDC_SAMPLE_4LINES,
     24	CCDC_SAMPLE_8LINES,
     25	CCDC_SAMPLE_16LINES
     26};
     27
     28/* enum for Alaw gamma width */
     29enum ccdc_gamma_width {
     30	CCDC_GAMMA_BITS_15_6,	/* use bits 15-6 for gamma */
     31	CCDC_GAMMA_BITS_14_5,
     32	CCDC_GAMMA_BITS_13_4,
     33	CCDC_GAMMA_BITS_12_3,
     34	CCDC_GAMMA_BITS_11_2,
     35	CCDC_GAMMA_BITS_10_1,
     36	CCDC_GAMMA_BITS_09_0	/* use bits 9-0 for gamma */
     37};
     38
     39/* returns the highest bit used for the gamma */
     40static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
     41{
     42	return 15 - width;
     43}
     44
     45enum ccdc_data_size {
     46	CCDC_DATA_16BITS,
     47	CCDC_DATA_15BITS,
     48	CCDC_DATA_14BITS,
     49	CCDC_DATA_13BITS,
     50	CCDC_DATA_12BITS,
     51	CCDC_DATA_11BITS,
     52	CCDC_DATA_10BITS,
     53	CCDC_DATA_8BITS
     54};
     55
     56/* returns the highest bit used for this data size */
     57static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
     58{
     59	return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
     60}
     61
     62/* structure for ALaw */
     63struct ccdc_a_law {
     64	/* Enable/disable A-Law */
     65	unsigned char enable;
     66	/* Gamma Width Input */
     67	enum ccdc_gamma_width gamma_wd;
     68};
     69
     70/* structure for Black Clamping */
     71struct ccdc_black_clamp {
     72	unsigned char enable;
     73	/* only if bClampEnable is TRUE */
     74	enum ccdc_sample_length sample_pixel;
     75	/* only if bClampEnable is TRUE */
     76	enum ccdc_sample_line sample_ln;
     77	/* only if bClampEnable is TRUE */
     78	unsigned short start_pixel;
     79	/* only if bClampEnable is TRUE */
     80	unsigned short sgain;
     81	/* only if bClampEnable is FALSE */
     82	unsigned short dc_sub;
     83};
     84
     85/* structure for Black Level Compensation */
     86struct ccdc_black_compensation {
     87	/* Constant value to subtract from Red component */
     88	char r;
     89	/* Constant value to subtract from Gr component */
     90	char gr;
     91	/* Constant value to subtract from Blue component */
     92	char b;
     93	/* Constant value to subtract from Gb component */
     94	char gb;
     95};
     96
     97/* Structure for CCDC configuration parameters for raw capture mode passed
     98 * by application
     99 */
    100struct ccdc_config_params_raw {
    101	/* data size value from 8 to 16 bits */
    102	enum ccdc_data_size data_sz;
    103	/* Structure for Optional A-Law */
    104	struct ccdc_a_law alaw;
    105	/* Structure for Optical Black Clamp */
    106	struct ccdc_black_clamp blk_clamp;
    107	/* Structure for Black Compensation */
    108	struct ccdc_black_compensation blk_comp;
    109};
    110
    111
    112#ifdef __KERNEL__
    113#include <linux/io.h>
    114/* Define to enable/disable video port */
    115#define FP_NUM_BYTES		4
    116/* Define for extra pixel/line and extra lines/frame */
    117#define NUM_EXTRAPIXELS		8
    118#define NUM_EXTRALINES		8
    119
    120/* settings for commonly used video formats */
    121#define CCDC_WIN_PAL     {0, 0, 720, 576}
    122/* ntsc square pixel */
    123#define CCDC_WIN_VGA	{0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
    124
    125/* Structure for CCDC configuration parameters for raw capture mode */
    126struct ccdc_params_raw {
    127	/* pixel format */
    128	enum ccdc_pixfmt pix_fmt;
    129	/* progressive or interlaced frame */
    130	enum ccdc_frmfmt frm_fmt;
    131	/* video window */
    132	struct v4l2_rect win;
    133	/* field id polarity */
    134	enum vpfe_pin_pol fid_pol;
    135	/* vertical sync polarity */
    136	enum vpfe_pin_pol vd_pol;
    137	/* horizontal sync polarity */
    138	enum vpfe_pin_pol hd_pol;
    139	/* interleaved or separated fields */
    140	enum ccdc_buftype buf_type;
    141	/*
    142	 * enable to store the image in inverse
    143	 * order in memory(bottom to top)
    144	 */
    145	unsigned char image_invert_enable;
    146	/* configurable parameters */
    147	struct ccdc_config_params_raw config_params;
    148};
    149
    150struct ccdc_params_ycbcr {
    151	/* pixel format */
    152	enum ccdc_pixfmt pix_fmt;
    153	/* progressive or interlaced frame */
    154	enum ccdc_frmfmt frm_fmt;
    155	/* video window */
    156	struct v4l2_rect win;
    157	/* field id polarity */
    158	enum vpfe_pin_pol fid_pol;
    159	/* vertical sync polarity */
    160	enum vpfe_pin_pol vd_pol;
    161	/* horizontal sync polarity */
    162	enum vpfe_pin_pol hd_pol;
    163	/* enable BT.656 embedded sync mode */
    164	int bt656_enable;
    165	/* cb:y:cr:y or y:cb:y:cr in memory */
    166	enum ccdc_pixorder pix_order;
    167	/* interleaved or separated fields  */
    168	enum ccdc_buftype buf_type;
    169};
    170#endif
    171#endif				/* _DM644X_CCDC_H */