2013-05-01 23:53:28 +00:00
|
|
|
/*
|
2013-06-15 11:37:22 +00:00
|
|
|
* This file is subject to the terms of the GFX License. If a copy of
|
2013-05-03 14:36:17 +00:00
|
|
|
* the license was not distributed with this file, you can obtain one at:
|
|
|
|
*
|
2013-07-21 20:20:37 +00:00
|
|
|
* http://ugfx.org/license.html
|
2013-05-03 14:36:17 +00:00
|
|
|
*/
|
2013-02-18 07:29:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @file include/gdisp/lld/gdisp_lld.h
|
|
|
|
* @brief GDISP Graphic Driver subsystem low level driver header.
|
|
|
|
*
|
|
|
|
* @addtogroup GDISP
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GDISP_LLD_H
|
|
|
|
#define _GDISP_LLD_H
|
|
|
|
|
|
|
|
#if GFX_USE_GDISP || defined(__DOXYGEN__)
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Error checks. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name GDISP hardware accelerated support
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
/**
|
2013-09-06 02:29:06 +00:00
|
|
|
* @brief Hardware streaming interface is supported.
|
2013-02-18 07:29:08 +00:00
|
|
|
* @details If set to @p FALSE software emulation is used.
|
2013-09-06 02:29:06 +00:00
|
|
|
* @note Either GDISP_HARDWARE_STREAM or GDISP_HARDWARE_DRAWPIXEL must be provided by the driver
|
2013-02-18 07:29:08 +00:00
|
|
|
*/
|
2013-09-06 02:29:06 +00:00
|
|
|
#ifndef GDISP_HARDWARE_STREAM
|
|
|
|
#define GDISP_HARDWARE_STREAM FALSE
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2013-09-06 02:29:06 +00:00
|
|
|
* @brief Hardware streaming requires an explicit end call.
|
|
|
|
* @details If set to @p FALSE if an explicit stream end call is not required.
|
2013-02-18 07:29:08 +00:00
|
|
|
*/
|
2013-09-06 02:29:06 +00:00
|
|
|
#ifndef GDISP_HARDWARE_STREAM_END
|
|
|
|
#define GDISP_HARDWARE_STREAM_END FALSE
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2013-09-06 02:29:06 +00:00
|
|
|
* @brief Hardware accelerated draw pixel.
|
2013-02-18 07:29:08 +00:00
|
|
|
* @details If set to @p FALSE software emulation is used.
|
2013-09-06 02:29:06 +00:00
|
|
|
* @note Either GDISP_HARDWARE_STREAM or GDISP_HARDWARE_DRAWPIXEL must be provided by the driver
|
2013-02-18 07:29:08 +00:00
|
|
|
*/
|
2013-09-06 02:29:06 +00:00
|
|
|
#ifndef GDISP_HARDWARE_DRAWPIXEL
|
|
|
|
#define GDISP_HARDWARE_DRAWPIXEL FALSE
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2013-09-06 02:29:06 +00:00
|
|
|
* @brief Hardware accelerated screen clears.
|
2013-02-18 07:29:08 +00:00
|
|
|
* @details If set to @p FALSE software emulation is used.
|
2013-09-06 02:29:06 +00:00
|
|
|
* @note This clears the entire display surface regardless of the clipping area currently set
|
2013-02-18 07:29:08 +00:00
|
|
|
*/
|
2013-09-06 02:29:06 +00:00
|
|
|
#ifndef GDISP_HARDWARE_CLEARS
|
|
|
|
#define GDISP_HARDWARE_CLEARS FALSE
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2013-09-06 02:29:06 +00:00
|
|
|
* @brief Hardware accelerated rectangular fills.
|
2013-02-18 07:29:08 +00:00
|
|
|
* @details If set to @p FALSE software emulation is used.
|
|
|
|
*/
|
2013-09-06 02:29:06 +00:00
|
|
|
#ifndef GDISP_HARDWARE_FILLS
|
|
|
|
#define GDISP_HARDWARE_FILLS FALSE
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2013-09-06 02:29:06 +00:00
|
|
|
* @brief Hardware accelerated fills from an image.
|
2013-02-18 07:29:08 +00:00
|
|
|
* @details If set to @p FALSE software emulation is used.
|
|
|
|
*/
|
2013-09-06 02:29:06 +00:00
|
|
|
#ifndef GDISP_HARDWARE_BITFILLS
|
|
|
|
#define GDISP_HARDWARE_BITFILLS FALSE
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Hardware accelerated scrolling.
|
|
|
|
* @details If set to @p FALSE there is no support for scrolling.
|
|
|
|
*/
|
|
|
|
#ifndef GDISP_HARDWARE_SCROLL
|
|
|
|
#define GDISP_HARDWARE_SCROLL FALSE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Reading back of pixel values.
|
|
|
|
* @details If set to @p FALSE there is no support for pixel read-back.
|
|
|
|
*/
|
|
|
|
#ifndef GDISP_HARDWARE_PIXELREAD
|
|
|
|
#define GDISP_HARDWARE_PIXELREAD FALSE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The driver supports one or more control commands.
|
|
|
|
* @details If set to @p FALSE there is no support for control commands.
|
|
|
|
*/
|
|
|
|
#ifndef GDISP_HARDWARE_CONTROL
|
|
|
|
#define GDISP_HARDWARE_CONTROL FALSE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The driver supports a non-standard query.
|
|
|
|
* @details If set to @p FALSE there is no support for non-standard queries.
|
|
|
|
*/
|
|
|
|
#ifndef GDISP_HARDWARE_QUERY
|
|
|
|
#define GDISP_HARDWARE_QUERY FALSE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The driver supports a clipping in hardware.
|
|
|
|
* @details If set to @p FALSE there is no support for non-standard queries.
|
2013-09-06 02:29:06 +00:00
|
|
|
* @note If this is defined the driver must perform its own clipping on all calls to
|
|
|
|
* the driver and respond appropriately if a parameter is outside the display area.
|
|
|
|
* @note If this is not defined then the software ensures that all calls to the
|
|
|
|
* driver do not exceed the display area (provided GDISP_NEED_CLIP or GDISP_NEED_VALIDATION
|
|
|
|
* has been set).
|
2013-02-18 07:29:08 +00:00
|
|
|
*/
|
|
|
|
#ifndef GDISP_HARDWARE_CLIP
|
2013-09-06 02:29:06 +00:00
|
|
|
#define GDISP_HARDWARE_CLIP FALSE
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name GDISP software algorithm choices
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name GDISP pixel format choices
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @brief The native pixel format for this device
|
|
|
|
* @note Should be set to one of the following:
|
|
|
|
* GDISP_PIXELFORMAT_RGB565
|
2013-09-06 02:29:06 +00:00
|
|
|
* GDISP_PIXELFORMAT_BGR565
|
2013-02-18 07:29:08 +00:00
|
|
|
* GDISP_PIXELFORMAT_RGB888
|
|
|
|
* GDISP_PIXELFORMAT_RGB444
|
|
|
|
* GDISP_PIXELFORMAT_RGB332
|
|
|
|
* GDISP_PIXELFORMAT_RGB666
|
|
|
|
* GDISP_PIXELFORMAT_CUSTOM
|
|
|
|
* @note If you set GDISP_PIXELFORMAT_CUSTOM you need to also define
|
|
|
|
* color_t, RGB2COLOR(r,g,b), HTML2COLOR(h),
|
|
|
|
* RED_OF(c), GREEN_OF(c), BLUE_OF(c),
|
|
|
|
* COLOR(c) and MASKCOLOR.
|
|
|
|
*/
|
|
|
|
#ifndef GDISP_PIXELFORMAT
|
|
|
|
#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_ERROR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Do pixels require packing for a blit
|
|
|
|
* @note Is only valid for a pixel format that doesn't fill it's datatype. ie formats:
|
|
|
|
* GDISP_PIXELFORMAT_RGB888
|
|
|
|
* GDISP_PIXELFORMAT_RGB444
|
|
|
|
* GDISP_PIXELFORMAT_RGB666
|
|
|
|
* GDISP_PIXELFORMAT_CUSTOM
|
|
|
|
* @note If you use GDISP_PIXELFORMAT_CUSTOM and packed bit fills
|
|
|
|
* you need to also define @p gdispPackPixels(buf,cx,x,y,c)
|
|
|
|
* @note If you are using GDISP_HARDWARE_BITFILLS = FALSE then the pixel
|
|
|
|
* format must not be a packed format as the software blit does
|
|
|
|
* not support packed pixels
|
|
|
|
* @note Very few cases should actually require packed pixels as the low
|
|
|
|
* level driver can also pack on the fly as it is sending it
|
|
|
|
* to the graphics device.
|
|
|
|
*/
|
|
|
|
#ifndef GDISP_PACKED_PIXELS
|
|
|
|
#define GDISP_PACKED_PIXELS FALSE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Do lines of pixels require packing for a blit
|
|
|
|
* @note Ignored if GDISP_PACKED_PIXELS is FALSE
|
|
|
|
*/
|
|
|
|
#ifndef GDISP_PACKED_LINES
|
|
|
|
#define GDISP_PACKED_LINES FALSE
|
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* External declarations. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
2013-09-06 02:29:06 +00:00
|
|
|
typedef struct GDISPDriver {
|
|
|
|
GDISPControl g;
|
2013-02-18 07:29:08 +00:00
|
|
|
|
2013-09-06 02:29:06 +00:00
|
|
|
uint16_t flags;
|
|
|
|
#define GDISP_FLG_INSTREAM 0x0001
|
2013-02-18 07:29:08 +00:00
|
|
|
|
2013-09-06 02:29:06 +00:00
|
|
|
// Multithread Mutex
|
|
|
|
#if GDISP_NEED_MULTITHREAD
|
|
|
|
gfxMutex mutex;
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
|
2013-09-06 02:29:06 +00:00
|
|
|
// Software clipping
|
|
|
|
#if !GDISP_HARDWARE_CLIP && (GDISP_NEED_CLIP || GDISP_NEED_VALIDATION)
|
|
|
|
coord_t clipx0, clipy0;
|
|
|
|
coord_t clipx1, clipy1; /* not inclusive */
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
|
2013-09-06 02:29:06 +00:00
|
|
|
// Driver call parameters
|
|
|
|
struct {
|
|
|
|
coord_t x, y;
|
|
|
|
coord_t cx, cy;
|
|
|
|
coord_t x1, y1;
|
|
|
|
coord_t x2, y2;
|
|
|
|
color_t color;
|
|
|
|
void *ptr;
|
|
|
|
} p;
|
|
|
|
|
|
|
|
// Text rendering parameters
|
2013-02-18 07:29:08 +00:00
|
|
|
#if GDISP_NEED_TEXT
|
2013-09-06 02:29:06 +00:00
|
|
|
struct {
|
|
|
|
font_t font;
|
|
|
|
color_t color;
|
|
|
|
color_t bgcolor;
|
|
|
|
coord_t clipx0, clipy0;
|
|
|
|
coord_t clipx1, clipy1;
|
|
|
|
} t;
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
2013-09-06 02:29:06 +00:00
|
|
|
} GDISPDriver;
|
2013-02-18 07:29:08 +00:00
|
|
|
|
2013-09-06 02:29:06 +00:00
|
|
|
extern GDISPDriver GDISP_DRIVER_STRUCT;
|
2013-02-18 07:29:08 +00:00
|
|
|
|
2013-09-06 02:29:06 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2013-02-18 07:29:08 +00:00
|
|
|
|
2013-09-06 02:29:06 +00:00
|
|
|
bool_t gdisp_lld_init(void);
|
|
|
|
#if GDISP_HARDWARE_STREAM
|
|
|
|
void gdisp_lld_stream_start(void); // Uses p.x,p.y p.cx,p.cy
|
|
|
|
void gdisp_lld_stream_color(void); // Uses p.color
|
|
|
|
#if GDISP_HARDWARE_STREAM_END
|
|
|
|
void gdisp_lld_stream_stop(void); // Uses no parameters
|
|
|
|
#endif
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
2013-09-06 02:29:06 +00:00
|
|
|
#if GDISP_HARDWARE_DRAWPIXEL
|
|
|
|
void gdisp_lld_draw_pixel(void); // Uses p.x,p.y p.color
|
2013-03-10 06:14:32 +00:00
|
|
|
#endif
|
2013-09-06 02:29:06 +00:00
|
|
|
#if GDISP_HARDWARE_CLEARS
|
|
|
|
void gdisp_lld_clear(void); // Uses p.color
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
2013-09-06 02:29:06 +00:00
|
|
|
#if GDISP_HARDWARE_FILLS
|
|
|
|
void gdisp_lld_fill_area(void); // Uses p.x,p.y p.cx,p.cy p.color
|
|
|
|
#endif
|
|
|
|
#if GDISP_HARDWARE_BITFILLS
|
|
|
|
void gdisp_lld_blit_area_ex(void); // Uses p.x,p.y p.cx,p.cy p.x1,p.y1 (=srcx,srcy) p.x2 (=srccx), p.ptr (=buffer)
|
|
|
|
#endif
|
|
|
|
#if GDISP_HARDWARE_PIXELREAD && GDISP_NEED_PIXELREAD
|
|
|
|
color_t gdisp_lld_get_pixel_color(void); // Uses p.x,p.y
|
|
|
|
#endif
|
|
|
|
#if GDISP_HARDWARE_SCROLL && GDISP_NEED_SCROLL
|
|
|
|
void gdisp_lld_vertical_scroll(void); // Uses p.x,p.y p.cx,p.cy, p.y1 (=lines) p.color
|
|
|
|
#endif
|
|
|
|
#if GDISP_HARDWARE_CONTROL && GDISP_NEED_CONTROL
|
|
|
|
void gdisp_lld_control(void); // Uses p.x (=what) p.ptr (=value)
|
|
|
|
#endif
|
|
|
|
#if GDISP_HARDWARE_QUERY && GDISP_NEED_QUERY
|
|
|
|
void *gdisp_lld_query(void); // Uses p.x (=what);
|
|
|
|
#endif
|
|
|
|
#if GDISP_HARDWARE_CLIP && (GDISP_NEED_CLIP || GDISP_NEED_VALIDATION)
|
|
|
|
void gdisp_lld_set_clip(void); // Uses p.x,p.y p.cx,p.cy
|
2013-02-18 07:29:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* GFX_USE_GDISP */
|
|
|
|
|
|
|
|
#endif /* _GDISP_LLD_H */
|
|
|
|
/** @} */
|
|
|
|
|