linux/drivers/staging/sm750fb/sm750_accel.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef ACCEL_H__
#define ACCEL_H__

#define HW_ROP2_COPY
#define HW_ROP2_XOR

/* notes: below address are the offset value from de_base_address (0x100000)*/

/* for sm718/750/502 de_base is at mmreg_1mb*/
#define DE_BASE_ADDR_TYPE1
/* for sm712,de_base is at mmreg_32kb */
#define DE_BASE_ADDR_TYPE2
/* for sm722,de_base is at mmreg_0 */
#define DE_BASE_ADDR_TYPE3

/* type1 data port address is at mmreg_0x110000*/
#define DE_PORT_ADDR_TYPE1
/* for sm712,data port address is at mmreg_0 */
#define DE_PORT_ADDR_TYPE2
/* for sm722,data port address is at mmreg_1mb */
#define DE_PORT_ADDR_TYPE3

#define DE_SOURCE
#define DE_SOURCE_WRAP
#define DE_SOURCE_X_K1_SHIFT
#define DE_SOURCE_X_K1_MASK
#define DE_SOURCE_X_K1_MONO_MASK
#define DE_SOURCE_Y_K2_MASK

#define DE_DESTINATION
#define DE_DESTINATION_WRAP
#define DE_DESTINATION_X_SHIFT
#define DE_DESTINATION_X_MASK
#define DE_DESTINATION_Y_MASK

#define DE_DIMENSION
#define DE_DIMENSION_X_SHIFT
#define DE_DIMENSION_X_MASK
#define DE_DIMENSION_Y_ET_MASK

#define DE_CONTROL
#define DE_CONTROL_STATUS
#define DE_CONTROL_PATTERN
#define DE_CONTROL_UPDATE_DESTINATION_X
#define DE_CONTROL_QUICK_START
#define DE_CONTROL_DIRECTION
#define DE_CONTROL_MAJOR
#define DE_CONTROL_STEP_X
#define DE_CONTROL_STEP_Y
#define DE_CONTROL_STRETCH
#define DE_CONTROL_HOST
#define DE_CONTROL_LAST_PIXEL
#define DE_CONTROL_COMMAND_SHIFT
#define DE_CONTROL_COMMAND_MASK
#define DE_CONTROL_COMMAND_BITBLT
#define DE_CONTROL_COMMAND_RECTANGLE_FILL
#define DE_CONTROL_COMMAND_DE_TILE
#define DE_CONTROL_COMMAND_TRAPEZOID_FILL
#define DE_CONTROL_COMMAND_ALPHA_BLEND
#define DE_CONTROL_COMMAND_RLE_STRIP
#define DE_CONTROL_COMMAND_SHORT_STROKE
#define DE_CONTROL_COMMAND_LINE_DRAW
#define DE_CONTROL_COMMAND_HOST_WRITE
#define DE_CONTROL_COMMAND_HOST_READ
#define DE_CONTROL_COMMAND_HOST_WRITE_BOTTOM_UP
#define DE_CONTROL_COMMAND_ROTATE
#define DE_CONTROL_COMMAND_FONT
#define DE_CONTROL_COMMAND_TEXTURE_LOAD
#define DE_CONTROL_ROP_SELECT
#define DE_CONTROL_ROP2_SOURCE
#define DE_CONTROL_MONO_DATA_SHIFT
#define DE_CONTROL_MONO_DATA_MASK
#define DE_CONTROL_MONO_DATA_NOT_PACKED
#define DE_CONTROL_MONO_DATA_8_PACKED
#define DE_CONTROL_MONO_DATA_16_PACKED
#define DE_CONTROL_MONO_DATA_32_PACKED
#define DE_CONTROL_REPEAT_ROTATE
#define DE_CONTROL_TRANSPARENCY_MATCH
#define DE_CONTROL_TRANSPARENCY_SELECT
#define DE_CONTROL_TRANSPARENCY
#define DE_CONTROL_ROP_MASK

/* Pseudo fields. */

#define DE_CONTROL_SHORT_STROKE_DIR_MASK
#define DE_CONTROL_SHORT_STROKE_DIR_225
#define DE_CONTROL_SHORT_STROKE_DIR_135
#define DE_CONTROL_SHORT_STROKE_DIR_315
#define DE_CONTROL_SHORT_STROKE_DIR_45
#define DE_CONTROL_SHORT_STROKE_DIR_270
#define DE_CONTROL_SHORT_STROKE_DIR_90
#define DE_CONTROL_SHORT_STROKE_DIR_180
#define DE_CONTROL_SHORT_STROKE_DIR_0
#define DE_CONTROL_ROTATION_MASK
#define DE_CONTROL_ROTATION_0
#define DE_CONTROL_ROTATION_270
#define DE_CONTROL_ROTATION_90
#define DE_CONTROL_ROTATION_180

#define DE_PITCH
#define DE_PITCH_DESTINATION_SHIFT
#define DE_PITCH_DESTINATION_MASK
#define DE_PITCH_SOURCE_MASK

#define DE_FOREGROUND
#define DE_FOREGROUND_COLOR_MASK

#define DE_BACKGROUND
#define DE_BACKGROUND_COLOR_MASK

#define DE_STRETCH_FORMAT
#define DE_STRETCH_FORMAT_PATTERN_XY
#define DE_STRETCH_FORMAT_PATTERN_Y_SHIFT
#define DE_STRETCH_FORMAT_PATTERN_Y_MASK
#define DE_STRETCH_FORMAT_PATTERN_X_SHIFT
#define DE_STRETCH_FORMAT_PATTERN_X_MASK
#define DE_STRETCH_FORMAT_PIXEL_FORMAT_SHIFT
#define DE_STRETCH_FORMAT_PIXEL_FORMAT_MASK
#define DE_STRETCH_FORMAT_PIXEL_FORMAT_8
#define DE_STRETCH_FORMAT_PIXEL_FORMAT_16
#define DE_STRETCH_FORMAT_PIXEL_FORMAT_32
#define DE_STRETCH_FORMAT_PIXEL_FORMAT_24
#define DE_STRETCH_FORMAT_ADDRESSING_SHIFT
#define DE_STRETCH_FORMAT_ADDRESSING_MASK
#define DE_STRETCH_FORMAT_ADDRESSING_XY
#define DE_STRETCH_FORMAT_ADDRESSING_LINEAR
#define DE_STRETCH_FORMAT_SOURCE_HEIGHT_MASK

#define DE_COLOR_COMPARE
#define DE_COLOR_COMPARE_COLOR_MASK

#define DE_COLOR_COMPARE_MASK
#define DE_COLOR_COMPARE_MASK_MASK

#define DE_MASKS
#define DE_MASKS_BYTE_MASK
#define DE_MASKS_BIT_MASK

#define DE_CLIP_TL
#define DE_CLIP_TL_TOP_MASK
#define DE_CLIP_TL_STATUS
#define DE_CLIP_TL_INHIBIT
#define DE_CLIP_TL_LEFT_MASK

#define DE_CLIP_BR
#define DE_CLIP_BR_BOTTOM_MASK
#define DE_CLIP_BR_RIGHT_MASK

#define DE_MONO_PATTERN_LOW
#define DE_MONO_PATTERN_LOW_PATTERN_MASK

#define DE_MONO_PATTERN_HIGH
#define DE_MONO_PATTERN_HIGH_PATTERN_MASK

#define DE_WINDOW_WIDTH
#define DE_WINDOW_WIDTH_DST_SHIFT
#define DE_WINDOW_WIDTH_DST_MASK
#define DE_WINDOW_WIDTH_SRC_MASK

#define DE_WINDOW_SOURCE_BASE
#define DE_WINDOW_SOURCE_BASE_EXT
#define DE_WINDOW_SOURCE_BASE_CS
#define DE_WINDOW_SOURCE_BASE_ADDRESS_MASK

#define DE_WINDOW_DESTINATION_BASE
#define DE_WINDOW_DESTINATION_BASE_EXT
#define DE_WINDOW_DESTINATION_BASE_CS
#define DE_WINDOW_DESTINATION_BASE_ADDRESS_MASK

#define DE_ALPHA
#define DE_ALPHA_VALUE_MASK

#define DE_WRAP
#define DE_WRAP_X_MASK
#define DE_WRAP_Y_MASK

#define DE_STATUS
#define DE_STATUS_CSC
#define DE_STATUS_2D

/* blt direction */
#define TOP_TO_BOTTOM
#define LEFT_TO_RIGHT
#define BOTTOM_TO_TOP
#define RIGHT_TO_LEFT

void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt);

void sm750_hw_de_init(struct lynx_accel *accel);

int sm750_hw_fillrect(struct lynx_accel *accel,
		      u32 base, u32 pitch, u32 Bpp,
		      u32 x, u32 y, u32 width, u32 height,
		      u32 color, u32 rop);

/**
 * sm750_hm_copyarea
 * @sBase: Address of source: offset in frame buffer
 * @sPitch: Pitch value of source surface in BYTE
 * @sx: Starting x coordinate of source surface
 * @sy: Starting y coordinate of source surface
 * @dBase: Address of destination: offset in frame buffer
 * @dPitch: Pitch value of destination surface in BYTE
 * @Bpp: Color depth of destination surface
 * @dx: Starting x coordinate of destination surface
 * @dy: Starting y coordinate of destination surface
 * @width: width of rectangle in pixel value
 * @height: height of rectangle in pixel value
 * @rop2: ROP value
 */
int sm750_hw_copyarea(struct lynx_accel *accel,
		      unsigned int sBase, unsigned int sPitch,
		      unsigned int sx, unsigned int sy,
		      unsigned int dBase, unsigned int dPitch,
		      unsigned int Bpp, unsigned int dx, unsigned int dy,
		      unsigned int width, unsigned int height,
		      unsigned int rop2);

/**
 * sm750_hw_imageblit
 * @pSrcbuf: pointer to start of source buffer in system memory
 * @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down
 *>-----      and -ive mean button up
 * @startBit: Mono data can start at any bit in a byte, this value should be
 *>-----      0 to 7
 * @dBase: Address of destination: offset in frame buffer
 * @dPitch: Pitch value of destination surface in BYTE
 * @bytePerPixel: Color depth of destination surface
 * @dx: Starting x coordinate of destination surface
 * @dy: Starting y coordinate of destination surface
 * @width: width of rectangle in pixel value
 * @height: height of rectangle in pixel value
 * @fColor: Foreground color (corresponding to a 1 in the monochrome data
 * @bColor: Background color (corresponding to a 0 in the monochrome data
 * @rop2: ROP value
 */
int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
		       u32 srcDelta, u32 startBit, u32 dBase, u32 dPitch,
		       u32 bytePerPixel, u32 dx, u32 dy, u32 width,
		       u32 height, u32 fColor, u32 bColor, u32 rop2);

#endif