r_wm_api.h 78.7 KB
Newer Older
hu's avatar
hu committed
1 2 3 4
/*
****************************************************************************
PROJECT : WM driver
FILE    : $Id: r_wm_api.h 15479 2018-01-11 14:04:31Z florian.zimmermann $
5
============================================================================
hu's avatar
hu committed
6 7 8 9 10 11
DESCRIPTION
Driver for the Window Manager
============================================================================
                            C O P Y R I G H T
============================================================================
                       Copyright (c) 2016
12 13
                                  by
                       Renesas Electronics (Europe) GmbH.
hu's avatar
hu committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
                           Arcadiastrasse 10
                          D-40472 Duesseldorf
                               Germany
                          All rights reserved.
============================================================================

DISCLAIMER

LICENSEE has read, understood and accepted the terms and conditions defined in
the license agreement, especially the usage rights. In any case, it is
LICENSEE's responsibility to make sure that any user of the software complies
with the terms and conditions of the signed license agreement.

***************************************************************************
*/


#ifndef R_WM_API_H
#define R_WM_API_H

34 35
#include "r_ddb_api.h"

hu's avatar
hu committed
36 37 38 39 40 41
#ifdef __cplusplus
extern "C" {
#endif

/***********************************************************
  Title: WM API
42

hu's avatar
hu committed
43 44
  WM (Window Manager) API.

45
  WM controls VDCE and SPEA drivers via WM support functions,
hu's avatar
hu committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
  and WM doesn't accesses H/W register directly.

  An application using Window Manager API should include the following header files.

  * r_typedefs.h
  * r_ddb_api.h
  * r_wm_api.h
  * r_cdi_api.h (by default. It can be customiszed. Please see <R_WM_Sys_Heap_Set>.)

*/

/***********************************************************
  Constants: API Version

  High and Low number of the API version

  - R_WM_VERSION_HI
  - R_WM_VERSION_LO
*/

#define R_WM_VERSION_HI  1
#define R_WM_VERSION_LO  19


/***********************************************************
  Section: Global Types
*/

74

hu's avatar
hu committed
75 76 77 78 79
/***********************************************************
  Enum: r_wm_Error_t

  Description:
  WM driver error code.
80

hu's avatar
hu committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
  If an error occurs these enumerations give information about the
  reason.

*/

typedef enum
{
    R_WM_ERR_OK                                                     = 0,
    R_WM_ERR_NG                                                     = 1,
    R_WM_ERR_RANGE_WM                                               = 2,
    R_WM_ERR_PARAM_INCORRECT                                        = 3,
    R_WM_UNIT_LOCKED                                                = 4,
    R_WM_UNIT_NOTLOCKED                                             = 5,
    R_WM_ERR_NO_PHYS_WINDOW                                         = 6,
    R_WM_ERR_MALLOC_FAILED                                          = 7,
    R_WM_ERR_FREE_FAILED                                            = 8,
    R_WM_ERR_EVENT_FAILED                                           = 9,
    R_WM_ERR_VOUT                                                   = 10,
    R_WM_ERR_NOT_DISABLED                                           = 11,
    R_WM_ERR_NOT_DELETED                                            = 12,
    R_WM_ERR_COLORFMT                                               = 13,
    R_WM_ERR_VIN                                                    = 14,
    R_WM_ERR_NOT_SPRITE_WINDOW                                      = 15,
    R_WM_ERR_DISPLAY_TIMING_SET                                     = 16,
    R_WM_ERR_INVALID_WM_UNIT                                        = 17,
    R_WM_ERR_DEV_DEINIT_FAILED                                      = 18,
    R_WM_ERR_NULL_PTR_ARGUMENT                                      = 19,
    R_WM_ERR_SPRITE_NOT_FOUND                                       = 20,
    R_WM_ERR_SYS_LAYER_INIT_FAILURE                                 = 21,
    R_WM_ERR_NOT_CLUT_WIN_FMT                                       = 22,
    R_WM_ERR_NO_SUCH_WINDOW                                         = 23,
    R_WM_ERR_COULD_NOT_ENABLE_SCREEN                                = 24,
    R_WM_ERR_COULD_NOT_DISABLE_SCREEN                               = 25,
    R_WM_ERR_COULD_NOT_SET_SCREEN_BG_COLOR                          = 26,
    R_WM_ERR_COULD_NOT_REGISTER_EVENT                               = 27,
    R_WM_ERR_NOT_FB_WINDOW                                          = 28,
    R_WM_ERR_SYNC_MODE_NOT_POSSIBLE                                 = 29,
    R_WM_ERR_SYS_WIN_ALPHA_SET_FAILED                               = 30,
    R_WM_ERR_SYS_WIN_DELETE_ALL_SPRITES_FAILED                      = 31,
    R_WM_ERR_NOT_SUITABLE_CAPTURE_WINDOW                            = 32,
    R_WM_ERR_COULD_NOT_WRITE_MSG_QUEUE                              = 33,
    R_WM_ERR_SYS_CAPTURE_CREATE_FAILED                              = 34,
    R_WM_ERR_SYS_CAPTURE_DELETE_FAILED                              = 35,
    R_WM_ERR_SYS_CAPTURE_ENABLE_FAILED                              = 36,
    R_WM_ERR_CAPTURE_UNIT_COUNT_EXCEEDED                            = 37,
    R_WM_ERR_VOUT_INTERNAL                                          = 38,
    R_WM_ERR_SCREEN_TIMING_NOT_SET                                  = 39,
    R_WM_ERR_NOT_INITIALIZED                                        = 40,
    R_WM_ERR_NOT_UNINITIALIZED                                      = 41,
    R_WM_ERR_COLOR_KEYING_NOT_SUPPORTED_FOR_LAYER                   = 42,
    R_WM_ERR_ADDRESS_ALIGNMENT                                      = 43,
    R_WM_ERR_DISPLAY_OUTPUT_FORMAT_SET                              = 44,
    R_WM_ERR_SYS_WIN_SWAP_FAILED                                    = 45,
    R_WM_ERR_SYS_WIN_DELETE_FAILED                                  = 46,
    R_WM_ERR_SYS_WIN_EXTERNAL_BUF_SET_FAILED                        = 47,
    R_WM_ERR_SYS_WIN_CREATE_FAILED                                  = 48,
    R_WM_ERR_SYS_WIN_MOVE_FAILED                                    = 49,
    R_WM_ERR_SYS_WIN_GEOMETRY_SET_FAILED                            = 50,
    R_WM_ERR_WIN_SWAP_FAILED                                        = 51,
    R_WM_ERR_SPEA_INTERNAL                                          = 52,
    R_WM_ERR_SYS_WIN_FLAG_UPDATE_FAILED                             = 53,
    R_WM_ERR_COULD_NOT_SET_SCREEN_COLOR_CURVE                       = 54,
    R_WM_ERR_COULD_NOT_SET_SCREEN_GAMMA                             = 55,
    R_WM_ERR_NOT_SUPPORTED                                          = 56,

    R_WM_ERR_LAST
} r_wm_Error_t;


/***********************************************************
  Enum: r_wm_MsgId_t

  Description:
  The type is used to specify the messages, which are processed by the window manager.

  Members:

  see also <r_wm_Msg_t>.

*/

typedef enum
{
    R_WM_MSG_SCREEN_ENABLE,             /* 0 */
    R_WM_MSG_SCREEN_BG_COLOR_SET,
    R_WM_MSG_SCREEN_COLOR_CURVE_SET,
    R_WM_MSG_SCREEN_GAMMA_SET,

    R_WM_MSG_WIN_CREATE,                /* 4 */
    R_WM_MSG_WIN_DELETE,
    R_WM_MSG_WIN_ENABLE,
    R_WM_MSG_WIN_MOVE,
    R_WM_MSG_WIN_RESIZE,
    R_WM_MSG_WIN_COLOR_FMT_SET,
    R_WM_MSG_WIN_ALPHA_SET,             /* 10 */
    R_WM_MSG_WIN_PREMULT_ALPHA_ENABLE,
    R_WM_MSG_WIN_CLUT_SET,
    R_WM_MSG_WIN_EXTERNAL_BUF_SET,
    R_WM_MSG_WIN_COLOR_KEY_ENABLE,
    R_WM_MSG_WIN_FLAGS_UPDATE,
    R_WM_MSG_WIN_PAINT,
    R_WM_MSG_WIN_DELETE_ALL_SPRITES,
    R_WM_MSG_WIN_SWAP,

    R_WM_MSG_SPRITE_CREATE,             /* 19 */
    R_WM_MSG_SPRITE_DELETE,
    R_WM_MSG_SPRITE_ENABLE,
    R_WM_MSG_SPRITE_MOVE,
    R_WM_MSG_SPRITE_BUF_SET,
190

hu's avatar
hu committed
191 192 193
    R_WM_MSG_CAPT_CREATE,               /* 24 */
    R_WM_MSG_CAPT_DELETE,
    R_WM_MSG_CAPT_ENABLE,
194

hu's avatar
hu committed
195 196 197 198 199 200 201 202 203 204 205
    R_WM_MSG_EOF,
    R_WM_MSG_VBLANK,

    R_WM_MSG_LAST
} r_wm_MsgId_t;


/***********************************************************
  Enum: r_wm_WinMode_t

  Description:
206 207 208 209
  A window can be supported by hardware or in can be managed by software;
  see also the chapter <WM Window functions>.
  A parameter of this type is used by the application to specify,
  if it wants to create a window with hardware support,
hu's avatar
hu committed
210 211 212 213 214 215 216 217
  software support or if the application does not care.

  Members:
    R_WM_WINMODE_FB    - The window is a normal framebuffer window
    R_WM_WINMODE_SPRITES  - The window is a sprite-hosting window

  Note:
  this type is not used.
218
  Instead <R_WM_DEV_*> indicates the type of the WM device
hu's avatar
hu committed
219 220 221 222 223 224 225 226 227 228 229 230 231
*/

typedef enum
{
    R_WM_WINMODE_FB,
    R_WM_WINMODE_SPRITES
} r_wm_WinMode_t;


/***********************************************************
  Enum: r_wm_WinStatus_t

  Description:
232
  Each window has a flag specifying its status.
hu's avatar
hu committed
233
  If required, additional status could be added.
234

hu's avatar
hu committed
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
  Members:
    R_WM_WINSTATUS_NOTINITIALIZED - The window has not been created.
    R_WM_WINSTATUS_DISABLED       - The window is invisible on the screen.
    R_WM_WINSTATUS_ENABLED        - The window is visible on the screen.
*/

typedef enum
{
    R_WM_WINSTATUS_NOT_INITIALIZED = 0,
    R_WM_WINSTATUS_DISABLED,
    R_WM_WINSTATUS_ENABLED
} r_wm_WinStatus_t;


/***********************************************************
  Enum: r_wm_WinBufStatus_t

  Description:
253 254 255
  A window might have more than one buffer.
  For this case there is a status flag for each buffer.
  The flag can be used to identify, if a buffer can be used for
hu's avatar
hu committed
256 257 258 259 260
  drawing operations or if it is ready to be switched to the screen etc.

  Members:
    R_WM_WINBUF_FREE                - The buffer can be used for rendering operations and it is not visible on the screen.
                                      The next free buffer must be requested by <R_WM_WindowNewDrawBufGet>.
261
    R_WM_WINBUF_RENDER_STARTED      - Drawing operations have been started on the buffer.
hu's avatar
hu committed
262 263
                                      This state of a buffer is switched to R_WM_WINBUF_RENDER_FINISHED
    R_WM_WINBUF_RENDER_FINISHED     - The drawing operations in the buffer have been completed and the buffer is ready to be displayed.
264

hu's avatar
hu committed
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
    R_WM_WINBUF_ON_SCREEN           - The buffer is scheduled to be transferred to the screen, or it is already on the screen.

*/

typedef enum
{
    R_WM_WINBUF_FREE = 0,
    R_WM_WINBUF_RENDER_STARTED,
    R_WM_WINBUF_RENDER_FINISHED,
    R_WM_WINBUF_ON_SCREEN,
} r_wm_WinBufStatus_t;

/***********************************************************
  Enum: r_wm_WinBufAllocMode_t

  Description:
  The buffers can be allocated internally by the WM or externally by the application.

  Members:
  R_WM_WINBUF_ALLOC_EXTERNAL   -   The application allocates the buffers. <R_WM_WindowCreate> will not allocate them.
                                        The application does not need to allocate the buffers before it calls <R_WM_WindowCreate>.
                                        The buffers can be set later with <r_wm_WindowExternalBufSet>.

  R_WM_WINBUF_ALLOC_INTERNAL   -   If buffers should be allocated internally by WM then the function <R_WM_WindowCreate>
                                        allocates the buffers and sets the pointer Buffer in <r_wm_Window_t>.

*/

typedef enum
{
    R_WM_WINBUF_ALLOC_EXTERNAL,
    R_WM_WINBUF_ALLOC_INTERNAL
} r_wm_WinBufAllocMode_t;


/***********************************************************
  typedef: r_wm_WinBuffer_t

  Description:
  The type is used to specify data and status of each frame-buffer of a window.

  Struct members:
    Data   - This pointer specifies the address of the bitmap data.
    Status - The parameter specifies the status of the buffer; see also <r_wm_WinBufStatus_t>.
*/

typedef struct
{
    void*                  Data;
    r_wm_WinBufStatus_t    Status;
} r_wm_WinBuffer_t;


/***********************************************************
  Enum: r_wm_WinColorFmt_t

  Description:
322
  A parameter of this type specifies the colour mode of a window.
hu's avatar
hu committed
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353

  Members:
  (A)RGB(w)xyz - The value specifies the number of bits for each colour and the alpha channel.

  supported color modes :
  (code)
  R_WM_COLORFMT_RGB565              16bit                   rrrrrggggggbbbbb
  R_WM_COLORFMT_ARGB1555            16bit                   arrrrrgggggbbbbb
  R_WM_COLORFMT_ARGB4444            16bit                   aaaarrrrggggbbbb
  R_WM_COLORFMT_RGB0444             16bit                   ----rrrrggggbbbb
  R_WM_COLORFMT_RGB0888             32bit   --------rrrrrrrrggggggggbbbbbbbb
  R_WM_COLORFMT_ARGB8888            32bit   aaaaaaaarrrrrrrrggggggggbbbbbbbb
  R_WM_COLORFMT_RGBA5551            16bit                   rrrrrgggggbbbbba
  R_WM_COLORFMT_RGBA4444            16bit                   rrrrggggbbbbaaaa
  R_WM_COLORFMT_RGBA8888            32bit   rrrrrrrrggggggggbbbbbbbbaaaaaaaa
  R_WM_COLORFMT_CLUT8               8 bit   8-bit (256 colors) color-lookup index
  R_WM_COLORFMT_CLUT4               4 bit   4-bit (16 colors) color-lookup index
  R_WM_COLORFMT_CLUT1               1 bit   1-bit (2 colors) color lookup index
  R_WM_COLORFMT_RLE24ARGB8888,
  R_WM_COLORFMT_RLE18ARGB8888,
  R_WM_COLORFMT_RLE24RGB0888,
  R_WM_COLORFMT_RLE18RGB0888,
  R_WM_COLORFMT_RLE8CLUT8,
  R_WM_COLORFMT_RLE8CLUT4,
  R_WM_COLORFMT_RLE8CLUT1,

                                    In digital domain, YUV is named YCbCr
  R_WM_COLORFMT_YCBCR_444,          32bit   --------vvvvvvvvyyyyyyyyuuuuuuuu

                                    Due to chroma subsampling, two pixels share their u and v data
                                    32bit   |<-  pixel 2  ->|<-  pixel 1 ->|
354
  R_WM_COLORFMT_YCBCR_422,          16bit   uuuuuuuuyyyyyyyy vvvvvvvvyyyyyyyy
hu's avatar
hu committed
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
  R_WM_COLORFMT_YUV_YUYV,           16bit   vvvvvvvvyyyyyyyy uuuuuuuuyyyyyyyy YCbCr 422 mode, variation
  R_WM_COLORFMT_YUV_UYVY,           16bit   yyyyyyyyvvvvvvvv yyyyyyyyuuuuuuuu YCbCr 422 mode, variation
  R_WM_COLORFMT_YUV_YVYU,           16bit   uuuuuuuuyyyyyyyy vvvvvvvvyyyyyyyy YCbCr 422 mode, equal to YCBCR_422
  R_WM_COLORFMT_YUV_VYUY,           16bit   yyyyyyyyuuuuuuuu yyyyyyyyvvvvvvvv YCbCr 422 mode, variation
  (end)

  Note:
  Not all displays support all formats.
*/

typedef enum
{
    R_WM_COLORFMT_RGB565,
    R_WM_COLORFMT_ARGB1555,
    R_WM_COLORFMT_ARGB4444,
    R_WM_COLORFMT_RGB0444,
    R_WM_COLORFMT_RGB0888,
    R_WM_COLORFMT_ARGB8888,
    R_WM_COLORFMT_RGBA5551,
    R_WM_COLORFMT_RGBA4444,
    R_WM_COLORFMT_RGBA8888,
    R_WM_COLORFMT_CLUT8,
    R_WM_COLORFMT_CLUT4,
    R_WM_COLORFMT_CLUT1,
    R_WM_COLORFMT_RLE24ARGB8888,
    R_WM_COLORFMT_RLE18ARGB8888,
    R_WM_COLORFMT_RLE24RGB0888,
    R_WM_COLORFMT_RLE18RGB0888,
    R_WM_COLORFMT_RLE8CLUT8,
    R_WM_COLORFMT_RLE8CLUT4,
    R_WM_COLORFMT_RLE8CLUT1,
    R_WM_COLORFMT_YCBCR_422,
    R_WM_COLORFMT_YCBCR_444,
    R_WM_COLORFMT_YUV_YUYV,
    R_WM_COLORFMT_YUV_UYVY,
    R_WM_COLORFMT_YUV_YVYU,
    R_WM_COLORFMT_YUV_VYUY,
    R_WM_COLORFMT_LAST
} r_wm_WinColorFmt_t;


/***********************************************************
  Enum: r_wm_OutColorFmt_t

  Description:
400
  A parameter of this type specifies the colour mode of the video output.
hu's avatar
hu committed
401 402 403 404 405 406 407 408 409 410

  Members:
  (A)RGB(w)xyz - The value specifies the number of bits for each colour.

  supported color modes :
  (code)
  R_WM_OUTCOLORFMT_RGB888             24bit           rrrrrrrrggggggggbbbbbbbb
  R_WM_OUTCOLORFMT_RGB666             18bit           ------rrrrrrggggggbbbbbb
  R_WM_OUTCOLORFMT_RGB565             16bit           --------rrrrrggggggbbbbb
  (end)
411

hu's avatar
hu committed
412 413

  ***Documentation of flags it subject to be moved to system-specific implementation***
414

hu's avatar
hu committed
415 416 417 418
  supported flags :
  R_WM_OUTCOLORFMT_FLAG_ENDIAN        change endianess of output colour
  R_WM_OUTCOLORFMT_FLAG_SWAP_BR       swap blue and red channel of output color
  R_WM_OUTCOLORFMT_FLAG_DITHER        activate dithering applied to output colour
419

hu's avatar
hu committed
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442
  Result of flags is shown as example for RGB666.
  (code)
                                                      MSB                     LSB
  R_WM_OUTCOLORFMT_FLAG_ENDIAN                        ------ rrrrrr gggggg bbbbbb
                                    FLAG=0:           ------ 765432 765432 765432
                                    FLAG=1:           ------ 234567 234567 234567

                                                      MSB                     LSB
  R_WM_OUTCOLORFMT_FLAG_SWAP_BR                       ------ rrrrrr gggggg bbbbbb
                                    FLAG=0:           ------ hgfedc ba9876 543210
                                    FLAG=1:           ------ 543210 ba9876 hgfedc
  (end)

  Note:
  Not all displays support all formats.
*/

typedef enum
{
    R_WM_OUTCOLORFMT_RGB888 = 0u,
    R_WM_OUTCOLORFMT_RGB666 = 1u,
    R_WM_OUTCOLORFMT_RGB565 = 2u,
    R_WM_OUTCOLORFMT_LAST = 3u,
443

hu's avatar
hu committed
444
    /* Documentation of flags is subject to be moved to system-specific implementation */
445 446 447
    R_WM_OUTCOLORFMT_FLAG_DITHER  = (uint32_t) 1u << 28u,
    R_WM_OUTCOLORFMT_FLAG_SWAP_BR = (uint32_t) 1u << 29u,
    R_WM_OUTCOLORFMT_FLAG_ENDIAN  = (uint32_t) 1u << 30u,
hu's avatar
hu committed
448 449
    /* We do not use the 31th bit if not needed. Saves some signedness castings */
    R_WM_OUTCOLORFMT_FLAG_MASK = (R_WM_OUTCOLORFMT_FLAG_ENDIAN
450 451
                                  + R_WM_OUTCOLORFMT_FLAG_SWAP_BR
                                  + R_WM_OUTCOLORFMT_FLAG_DITHER),
hu's avatar
hu committed
452 453 454 455 456
} r_wm_OutColorFmt_t;


/***********************************************************
  typedef: r_wm_ClutEntry_t
457

hu's avatar
hu committed
458 459
  Description:
  Defines an entry of the colour lookup table.
460

hu's avatar
hu committed
461 462 463 464 465
  Struct members:
  B -   8-bit blue component
  G -   8-bit green component
  R -   8-bit red component
  A -   8-bit alpha component
466

hu's avatar
hu committed
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
*/

typedef struct
{
    uint8_t B;
    uint8_t G;
    uint8_t R;
    uint8_t A;
} r_wm_ClutEntry_t;


/***********************************************************
  typedef: r_wm_Window_s

  forward declaration for <r_wm_Window_t>
*/
typedef struct r_wm_Window_s r_wm_Window_t; /* need forward declaration here */


/***********************************************************
    Enum: r_wm_SpriteStatus_t

    Description:

    Describes the state of the sprite. If the sprite is not assigned to any window, it will have a
    R_WM_SPRITESTATUS_NOT_INITIALIZED value. If it is assigned, it can have either R_WM_SPRITESTATUS_DISABLED
    (not visible) or R_WM_SPRITESTATUS_ENABLED (visible) state set.

    Members:
*/

typedef enum
{
    R_WM_SPRITESTATUS_NOT_INITIALIZED = 0,
    R_WM_SPRITESTATUS_DISABLED,
    R_WM_SPRITESTATUS_ENABLED
} r_wm_SpriteStatus_t;

/***********************************************************
    typedef: r_wm_Sprite_t

    Description:

    Each sprite has a data structure of this type. All sprites are linked in a queue by the window manager.

    Members:

    Window              -   pointer to the parent window
    Next                -   *internal* pointer to the next sprite in the queue
    Status              -   status of the sprite
    Data                -   pointer to the image data of a sprite
    PosX / PosY / PosZ  -   position of the sprite on the window
    Width / Height      -   size of the sprite
*/

typedef struct r_wm_Sprite_s
{
    struct r_wm_Window_s  *Window;
    struct r_wm_Sprite_s *Next;
    r_wm_SpriteStatus_t Status;
    void *Data;
    uint32_t PosX;
    uint32_t PosY;
    uint32_t PosZ;
    uint32_t Width;
    uint32_t Height;
} r_wm_Sprite_t;


/***********************************************************
    Enum: r_wm_WinFlags_t

    Description:

    On/Off Switches for different functionalities of a WM window.

    Members:
544

hu's avatar
hu committed
545 546 547 548 549 550 551 552 553 554 555 556 557 558
    R_WM_WINFLAG_V_MIRROR   - Flip the output image vertically
*/

typedef enum
{
    R_WM_WINFLAG_NONE = 0,
    R_WM_WINFLAG_V_MIRROR = 1,
    R_WM_WINFLAG_MASK = (R_WM_WINFLAG_V_MIRROR),
} r_wm_WinFlags_t;

/***********************************************************
  typedef: r_wm_Window_t

  Description:
559
  Each window has a data structure of this type.
hu's avatar
hu committed
560 561 562 563
  All windows are linked in a chain by the window manager.

  Initialization instructions:
  It is required to clear the memory of <r_wm_Window_t> to zero.
564 565

    The following variables need to be initialised to any valid value (including zero)
hu's avatar
hu committed
566 567 568 569 570 571 572 573 574
    before calling <R_WM_WindowCreate>. This is already covered by clearing everything to zero.
        PosX
        PosY
        PosZ
        ScaledWidth
        ScaledHeight
        UsePremultipliedAlpha
        ClutNumEntries
        ColorKey.Enabled
575

hu's avatar
hu committed
576 577 578 579 580 581 582 583 584 585 586 587
    The following varibales need use-case specific setup before calling R_WM_WindowCreate
        Mode
        ColorFmt
        Pitch
        Width
        Height
        Surface.Fb.BufNum     (if Mode is R_WM_WINMODE_FB)
        Surface.Fb.BufMode    (if Mode is R_WM_WINMODE_FB)
        Surface.Fb.Buffer     (if Mode is R_WM_WINMODE_FB and BufMode is R_WM_WINBUF_ALLOC_EXTERNAL)
        Alpha
        ClutNumEntries        (if ColorFmt is a CLUT format)
        Clut                  (if ColorFmt is a CLUT format)
588

hu's avatar
hu committed
589 590 591 592 593 594 595 596 597
    The following variables are set by <R_WM_WindowCreate>, so initialization value is not important
        Status
        Surface.SpritesRoot   (if Mode is R_WM_WINMODE_SPRITES)
        Next

  Struct members:
    Status                - The element keeps the status of the window; see <r_wm_WinStatus_t>.
    Mode                  - See description of <r_wm_WinMode_t>.
    ColorFmt              - The member specifies the color mode of the window; see <r_wm_WinColorFmt_t>.
598

hu's avatar
hu committed
599
    PosX / PosY           - These parameters specify the position of the window on the screen.
600
    PosZ                  - This parameter specifies the Z position of the window.
hu's avatar
hu committed
601 602 603 604 605 606 607 608 609 610 611 612 613
    Pitch                 - This is the line pitch of a frame buffer. It must be greater or equal Width.
    Width / Height        - These values are the size of the window.
    ScaledWidth / ScaledHeight - These values are the scaled size of the window.

    [used when Mode == R_WM_WINMODE_FB]
      Surface.Fb.Buffer   - This is a pointer to an array of BufNum <r_wm_WinBuffer_t> elements. The array contains information about all frame buffers of the window.
      Surface.Fb.BufNum   - This is the number of frame buffers of the window.
      Surface.Fb.BufMode  - Buffer allocation mode; see <r_wm_WinBufAllocMode_t>
    [used when Mode == R_WM_WINMODE_SPRITES]
      Surface.SpritesRoot - *internal* pointer used to store the Sprite List assigned to this window

    Alpha                 - The parameter specifies the transparency value of the window.
    UsePremultipliedAlpha - Premultiplied Alpha Mode is active
614

hu's avatar
hu committed
615 616 617
    [used when ColorFmt == R_WM_COLORFMT_CLUT* ]
      ClutNumEntries      - No of entries of the CLUT assigned to this window
      Clut                - Pointer to array of CLUT entries
618

hu's avatar
hu committed
619 620
    [Color Keying. This feature cannot be used together with the Window's <Alpha>]
    [used when <ColorFmt> is an RGB Format ]
621
      ColorKey.In.RgbKey  - The key color for the RGBA color keying
hu's avatar
hu committed
622 623 624
    [used when <ColorFmt> == R_WM_COLORFMT_CLUT* ]
      ColorKey.In.ClutKey - The key color for the color indexed color keying
    ColorKey.Out          - The 'In' key color gets substituted with the 'Out' color defined here).
625

hu's avatar
hu committed
626 627 628 629 630 631 632 633 634 635
    Flags                 - Additional flags to set certain properties of a window.
    Next                  - *internal* pointer to the next window in the chain.

*/

struct r_wm_Window_s
{
    r_wm_WinStatus_t    Status;
    r_wm_WinMode_t      Mode;
    r_wm_WinColorFmt_t  ColorFmt;
636

hu's avatar
hu committed
637 638 639
    int32_t             PosX;
    int32_t             PosY;
    uint32_t            PosZ;
640
    uint32_t            Pitch;
hu's avatar
hu committed
641 642 643 644
    uint32_t            Width;
    uint32_t            Height;
    uint32_t            ScaledWidth;
    uint32_t            ScaledHeight;
645

hu's avatar
hu committed
646 647 648 649 650 651 652 653 654 655 656 657 658
    union
    {
        struct
        {
            r_wm_WinBuffer_t        *Buffer;
            uint8_t                 BufNum;
            r_wm_WinBufAllocMode_t  BufMode;
        } Fb;
        r_wm_Sprite_t               *SpritesRoot;
    } Surface;

    uint8_t                         Alpha;
    uint8_t                         UsePremultipliedAlpha;
659

hu's avatar
hu committed
660 661
    uint32_t                        ClutNumEntries;
    const r_wm_ClutEntry_t*         Clut;
662

hu's avatar
hu committed
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683
    struct
    {
        uint8_t Enabled;
        union
        {
            struct
            {
                uint8_t             Red;
                uint8_t             Green;
                uint8_t             Blue;
            } RgbKey;
            uint8_t ClutKey;
        } In;
        struct
        {
            uint8_t                 Red;
            uint8_t                 Green;
            uint8_t                 Blue;
            uint8_t                 Alpha;
        } Out;
    } ColorKey;
684

hu's avatar
hu committed
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913
    r_wm_WinFlags_t         Flags;
    struct r_wm_Window_s   *Next;    /*internal*/
} /*r_wm_Window_t*/;



typedef struct
{
    uint32_t Enabled;
} r_wm_MsgScreenEnable_t;

typedef struct
{
    uint8_t     Red;
    uint8_t     Green;
    uint8_t     Blue;
} r_wm_MsgScreenBgColorSet_t;

typedef struct
{
    uint32_t    NumEntries;
    const r_wm_ClutEntry_t *ColorCurve;
} r_wm_MsgScreenColorCurveSet_t;

typedef struct
{
    uint8_t     GammaRed;
    uint8_t     GammaGreen;
    uint8_t     GammaBlue;
} r_wm_MsgScreenGammaSet_t;

typedef struct
{
    r_wm_Window_t   *Win;
} r_wm_MsgWinCreateData_t;

typedef struct
{
    r_wm_Window_t   *Win;
} r_wm_MsgWinDeleteData_t;

typedef struct
{
    r_wm_Window_t   *Win;
    uint32_t Enabled;
} r_wm_MsgWinEnableData_t;

typedef struct
{
    r_wm_Window_t   *Win;
    int32_t        PosX;
    int32_t        PosY;
    int32_t        PosZ;
} r_wm_MsgWinMoveData_t;

typedef struct
{
    r_wm_Window_t   *Win;
    uint32_t        Pitch;
    uint32_t        Width;
    uint32_t        Height;
} r_wm_MsgWinResizeData_t;

typedef struct
{
    r_wm_Window_t       *Win;
    r_wm_WinColorFmt_t  ColorFmt;
} r_wm_MsgWinColorFmtSet_t;

typedef struct
{
    r_wm_Window_t   *Win;
    uint8_t         Alpha;
} r_wm_MsgWinAlphaData_t;

typedef struct
{
    r_wm_Window_t   *Win;
    uint8_t         Enabled;
} r_wm_MsgWinPremultAlphaEnableData_t;

typedef struct
{
    r_wm_Window_t       *Win;
    r_wm_WinBuffer_t    *Buf;
    uint32_t            BufNum;
    r_wm_WinColorFmt_t  ColorFormat;
} r_wm_MsgWinExternalBufSetData_t;

typedef struct
{
    r_wm_Window_t   *Win;
    r_wm_Sprite_t   *Sprite;
} r_wm_MsgWinSpriteData_t;

typedef struct
{
    r_wm_Window_t           *Win;
    uint32_t                NumEntries;
    const r_wm_ClutEntry_t  *Clut;
} r_wm_MsgWinClutSetData_t;

typedef struct
{
    r_wm_Window_t   *Win;
    uint32_t        Enabled;
} r_wm_MsgWinColorKeyEnableData_t;

typedef struct
{
    r_wm_Window_t   *Win;
    r_wm_WinFlags_t  SetFlags;
    r_wm_WinFlags_t  ClearFlags;
} r_wm_MsgWinFlagsUpdateData_t;

typedef struct
{
    r_wm_Window_t   *Win;
} r_wm_MsgWinPaintData_t;

typedef struct
{
    r_wm_Window_t   *Win;
} r_wm_MsgWinSwapData_t;

typedef struct
{
    r_wm_Window_t   *Win;
} r_wm_MsgWinDeleteAllSprites_t;

typedef struct
{
    r_wm_Window_t   *Win;
} r_wm_MsgSwapData_t;


typedef struct
{
    uint32_t    Id;
} r_wm_MsgEofData_t;

typedef struct
{
    r_wm_Sprite_t   *Sprite;
} r_wm_MsgSpriteCreateData_t;

typedef struct
{
    r_wm_Sprite_t   *Sprite;
} r_wm_MsgSpriteDeleteData_t;

typedef struct
{
    r_wm_Sprite_t   *Sprite;
    uint32_t        Enabled;
} r_wm_MsgSpriteEnableData_t;

typedef struct
{
    r_wm_Sprite_t   *Sprite;
    uint32_t        PosX;
    uint32_t        PosY;
    uint32_t        PosZ;
} r_wm_MsgSpriteMoveData_t;

typedef struct
{
    r_wm_Sprite_t   *Sprite;
    void            *Buf;
} r_wm_MsgSpriteBufSetData_t;

typedef struct r_wm_Capture_s r_wm_Capture_t;

typedef struct
{
    r_wm_Capture_t  *Capt;
} r_wm_MsgCaptCreateData_t;

typedef struct
{
    r_wm_Capture_t  *Capt;
} r_wm_MsgCaptDeleteData_t;

typedef struct
{
    r_wm_Capture_t  *Capt;
    uint32_t        Enabled;
} r_wm_MsgCaptEnableData_t;

typedef union
{
    r_wm_MsgScreenEnable_t              ScrEnable;
    r_wm_MsgScreenBgColorSet_t          ScrBgColorSet;
    r_wm_MsgScreenColorCurveSet_t       ScrColorCurveSet;
    r_wm_MsgScreenGammaSet_t            ScrGammaSet;
    r_wm_MsgWinCreateData_t             WinCreate;
    r_wm_MsgWinDeleteData_t             WinDelete;
    r_wm_MsgWinEnableData_t             WinEnable;
    r_wm_MsgWinMoveData_t               WinMove;
    r_wm_MsgWinResizeData_t             WinResize;
    r_wm_MsgWinAlphaData_t              WinAlphaSet;
    r_wm_MsgWinPremultAlphaEnableData_t WinPremultAlphaEnable;
    r_wm_MsgWinSpriteData_t             WinSprite;
    r_wm_MsgWinClutSetData_t            WinClutSet;
    r_wm_MsgWinColorFmtSet_t            WinColorFmtSet;
    r_wm_MsgWinFlagsUpdateData_t        WinFlags;
    r_wm_MsgWinPaintData_t              WinPaint;
    r_wm_MsgWinSwapData_t               WinSwap;
    r_wm_MsgWinExternalBufSetData_t     WinExternalBufSet;
    r_wm_MsgWinColorKeyEnableData_t     WinColorKeyEnable;
    r_wm_MsgWinDeleteAllSprites_t       WinDeleteAllSprites;
    r_wm_MsgSpriteCreateData_t          SpriteCreate;
    r_wm_MsgSpriteDeleteData_t          SpriteDelete;
    r_wm_MsgSpriteEnableData_t          SpriteEnable;
    r_wm_MsgSpriteMoveData_t            SpriteMove;
    r_wm_MsgSpriteBufSetData_t          SpriteBufSet;
    r_wm_MsgCaptCreateData_t            CaptCreate;
    r_wm_MsgCaptDeleteData_t            CaptDelete;
    r_wm_MsgCaptEnableData_t            CaptEnable;
    r_wm_MsgSwapData_t                  Swap;
    r_wm_MsgEofData_t                   Eof;
} r_wm_MsgGenericData;


/***********************************************************
  typedef: r_wm_Msg_t

  Description:
  The window manager stores all requests in an internal msg queue.
914
  During initialization the application provides an array of
hu's avatar
hu committed
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937
  <r_wm_Msg_t>, which the driver will use as a msg queue storage.

  Struct members:
  Id            - See <r_wm_MsgId_t>.
  Data          - A union to hold event specific data.
*/

typedef struct r_wm_Msg_s r_wm_Msg_t;

struct r_wm_Msg_s
{
    r_wm_MsgId_t            Id;
    r_wm_MsgGenericData     Data;
};


/***********************************************************
  typedef: r_wm_EventId_t

  Description:
  External event id. The events are dispatched to the callback function specified
  during the R_WM_DevInit call. These events can be used for implementing the asynchronous
  drawing mechanism (see the appropriate application note).
938

hu's avatar
hu committed
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970
  R_WM_EVENT_VBLANK                   = VBLANK interrupt notification
  R_WM_EVENT_SCANLINE                 = SCANLINE interrupt notification
  R_WM_EVENT_VI_VBLANK                = Video Input VBLANK interrupt notification
  R_WM_EVENT_VI_OVERFLOW              = Video Input overflow interupt notification
  R_WM_EVENT_LAYER0_UNDERFLOW         = Video output layer 0 undeflow
  R_WM_EVENT_LAYER1_UNDERFLOW         = Video output layer 1 undeflow
  R_WM_EVENT_LAYER2_UNDERFLOW         = Video output layer 2 undeflow
  R_WM_EVENT_LAYER3_UNDERFLOW         = Video output layer 3 undeflow
*/

typedef enum
{
    R_WM_EVENT_VBLANK                   = 0x0,
    R_WM_EVENT_SCANLINE                 = 0x1,
    R_WM_EVENT_VI_VBLANK                = 0x2,
    R_WM_EVENT_VI_OVERFLOW              = 0x3,
    R_WM_EVENT_LAYER0_UNDERFLOW         = 0x4,
    R_WM_EVENT_LAYER1_UNDERFLOW         = 0x5,
    R_WM_EVENT_LAYER2_UNDERFLOW         = 0x6,
    R_WM_EVENT_LAYER3_UNDERFLOW         = 0x7,
    R_WM_EVENT_LAST
} r_wm_EventId_t;

/***********************************************************
  typedef: r_wm_Event_t

  Description:
  The external event description. The events are dispatched to the callback function specified
  during the R_WM_DevInit call. These events can be used for implementing the asynchronous
  drawing mechanism (see the appropriate application note).

  Member:
971

hu's avatar
hu committed
972 973 974 975
  Id    - Event ID
  Data  - Data associated with the event
*/

976
typedef struct
hu's avatar
hu committed
977 978 979 980 981 982 983 984 985
{
    r_wm_EventId_t  Id;
    uint32_t        Data;
} r_wm_Event_t;

/***********************************************************
  Enum: r_wm_Memory_t

  Description:
986 987
  The window manager requires different access types to the memory.
  Therefore the function R_WM_SysAlloc is called with a parameter,
hu's avatar
hu committed
988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
  which indicates the memory type requested by the window manager.

  Members:
    R_WM_MEM_CPU   - The memory needs to be accessible by the CPU.
    R_WM_MEM_VIDEO - It has to be possible to access the memory by the VOUT, VIN, GPU and CPU.
*/

typedef enum
{
    R_WM_MEM_CPU = 0,
    R_WM_MEM_VIDEO,
} r_wm_Memory_t;


/***********************************************************
  typedef: r_wm_CapMode_t

  Description:
1006
  There are different modes of video capturing, especially for interlaced videos.
hu's avatar
hu committed
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020
  This type is used to describe, which method shall be used for a capturing surface.

  Members:
  One of these six flags must be selected or the function call will fail :

  R_WM_CAPMODE_YUV_ITU656 - Select YUV itu 656 mode
  R_WM_CAPMODE_YUV_8BIT   - Select YUV raw 8bit mode with external sync
  R_WM_CAPMODE_YUV_16BIT  - Select YUV raw 16bit mode with external sync
  R_WM_CAPMODE_RGB_16BPP  - Select RGB 565 bit mode with external sync
  R_WM_CAPMODE_RGB_18BPP  - Select RGB 666 bit mode with external sync
  R_WM_CAPMODE_RGB_24BPP  - Select RGB 888 bit mode with external sync

  The following flags are optional and can be omitted :

1021
  Dithering can be used with framebuffer format R_VI_FB_FORMAT_RGB565.
hu's avatar
hu committed
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038
  Dithering is disabled on default and can be enabled with one of the following flags.
  If none of these is selected dithering is disabled :

  R_WM_CAPMODE_DITHER           - Enable dithering

  some additional flags can be used :

  R_WM_CAPMODE_YUV_Y_UV_INVERT  - Invert the position of Y and UV in the ITU stream (YUYV -> UYVY)
  R_WM_CAPMODE_VSYNC_INVERT     - Invert the polarity of the incoming vsync signals
  R_WM_CAPMODE_HSYNC_INVERT     - Invert the polarity of the incoming vsync signals
  R_WM_CAPMODE_DATA_CLK_INVERT  - Data sampling point
  R_WM_CAPMODE_VSYNC_CLK_INVERT - vsync sampling point
  R_WM_CAPMODE_HSYNC_CLK_INVERT - hsync sampling point
  R_WM_CAPMODE_FIXED_VSYNC      - Video Output VSYNC is fixed to internal pixel clock.

  Data can be captured using CSync, HSync/VSync or Data Enable Sync.
  If none of the following flags is set then HSync/VSync is used.
1039

hu's avatar
hu committed
1040 1041 1042 1043
  Default capture mode does not use deinterlacing.
  If interlaced video is input, this equals to BOB deinterlacing.
  Set flag below for weave deinterlacing.

1044
  R_WM_CAPMODE_WEAVE        - The weave method is used to deinterlace the video.
hu's avatar
hu committed
1045 1046 1047 1048 1049 1050
                              Only one single input buffer video is supported, no multi-buffering.
*/

typedef enum
{
    R_WM_CAPMODE_NONE             = 0,
1051 1052 1053 1054 1055 1056 1057 1058
    R_WM_CAPMODE_YUV_ITU656       = (int32_t)(1uL << 0),
    R_WM_CAPMODE_YUV_8BIT         = (int32_t)(1uL << 1),
    R_WM_CAPMODE_YUV_16BIT        = (int32_t)(1uL << 2),
    R_WM_CAPMODE_RGB_16BPP        = (int32_t)(1uL << 3),
    R_WM_CAPMODE_RGB_18BPP        = (int32_t)(1uL << 4),
    R_WM_CAPMODE_RGB_24BPP        = (int32_t)(1uL << 5),
    R_WM_CAPMODE_DITHER           = (int32_t)(1uL << 6),

hu's avatar
hu committed
1059
    /* default Y1UY2V, inverted UY1VY2 */
1060
    R_WM_CAPMODE_YUV_Y_UV_INVERT  = (int32_t)(1uL << 10),
hu's avatar
hu committed
1061
    /* vsync polarity (default: pos polarity, inverted: neg polarity) */
1062
    R_WM_CAPMODE_VSYNC_INVERT     = (int32_t)(1uL << 11),
hu's avatar
hu committed
1063
    /* hsync polarity (default: pos polarity, inverted: neg polarity) */
1064
    R_WM_CAPMODE_HSYNC_INVERT     = (int32_t)(1uL << 12),
hu's avatar
hu committed
1065
    /* data sampling point  (default: falling clock edge, inverted: rising clock edge) */
1066
    R_WM_CAPMODE_DATA_CLK_INVERT  = (int32_t)(1uL << 15),
hu's avatar
hu committed
1067
    /* vsync sampling point (default: falling clock edge, inverted: rising clock edge) */
1068
    R_WM_CAPMODE_VSYNC_CLK_INVERT = (int32_t)(1uL << 16),
hu's avatar
hu committed
1069
    /* hsync sampling point (default: falling clock edge, inverted: rising clock edge) */
1070 1071 1072
    R_WM_CAPMODE_HSYNC_CLK_INVERT = (int32_t)(1uL << 17),
    R_WM_CAPMODE_H_MIRRORING      = (int32_t)(1uL << 18),
    R_WM_CAPMODE_V_MIRRORING      = (int32_t)(1uL << 19),
hu's avatar
hu committed
1073
    /* internal fixed vsync generation (default: vo vsync is synchronised to vi vsync) */
1074 1075 1076
    R_WM_CAPMODE_FIXED_VSYNC      = (int32_t)(1uL << 20),

    /* Bits 0-20 mirror the VDCE data type <r_vdce_CapMode_t>.
hu's avatar
hu committed
1077
       The following entries are additional. */
1078 1079

    R_WM_CAPMODE_WEAVE            = (int32_t)(1ul << 30),
hu's avatar
hu committed
1080 1081 1082 1083 1084 1085 1086
} r_wm_CapMode_t;


/***********************************************************
  typedef: r_wm_Capture_t

  Description:
1087 1088
  The type describes the settings of a video capturing surface.
  The video capturing surface is always associated with a window surface.
hu's avatar
hu committed
1089 1090

  Members:
1091 1092
    Window              - The member is a pointer to the associated window.
                            The window has to match the requirements of the captured video;
hu's avatar
hu committed
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104
                            e.g. size, colour mode.
    Mode                - The member specifies the capturing mode.
    Status              - see <R_WM_WinStatus_t>
    StartX              - This is the X starting position in the video.
    StrideX             - The parameter specifies the stride in the frame buffer.
    StartY1 / StartY2   - This is the Y starting position for the field 1 and field 2.
    Width / Height      - This is the size of the video.
    ScaledWidth/Height  - The target window will be scaled.
                          <ScaledWidth/-Height> will be the dimensions of the buffer in memory.
                          <Width/Height> will be the dimension of the window on-screen.
                          D1x/VDCE Specific: Only upscaling is supported, thus ScaledWidth/Height < Width/Height.
    Delay               - When VI- and VO-VSYNC are synchronized, this value delays VO-VSYNC measured in lines.
1105 1106
    CapUnit             - The Video Channel to be used for capturing.
                            If another Unit is to be used than the assigned Window,
hu's avatar
hu committed
1107
                            please make sure that this unit is already initialised.
1108
    Next                - *internal* All capturing surfaces are linked in a list.
hu's avatar
hu committed
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
                            This pointer points to the next capturing surface.
*/

struct r_wm_Capture_s
{
    r_wm_Window_t           *Window;
    r_wm_CapMode_t          Mode;
    uint32_t                StartX;
    uint32_t                StrideX;
    uint32_t                StartY1;
    uint32_t                StartY2;
    uint32_t                Width;
    uint32_t                Height;
    uint32_t                ScaledWidth;
    uint32_t                ScaledHeight;
    uint32_t                Delay;
    uint32_t                CapUnit;
    struct r_wm_Capture_s   *Next;
};


/***********************************************************
  typedef: r_wm_WinCapbs_t

1133 1134
  Description:

hu's avatar
hu committed
1135 1136 1137 1138 1139 1140
    D1M1A only.
    For other devices, this is fixed to:
      0: RLE
      1: SPRITES
      2: SPRITES
      3: SPRITES
1141

hu's avatar
hu committed
1142
  Please see API documentation of function <R_WM_WindowCapabilitiesSet>.
1143

hu's avatar
hu committed
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164
  Members:
  R_WM_WINCAPBS_RLE      - Set video output layer to support RLE format.
  R_WM_WINCAPBS_SPRITES  - Set video output layer to support SPRITES.
*/

typedef enum
{
    R_WM_WINCAPBS_RLE = 0,
    R_WM_WINCAPBS_SPRITES = 1,
    R_WM_WINCAPBS_LAST = 2,
} r_wm_WinCapbs_t;


/***********************************************************
  Section: Global API functions
*/


/***********************************************************
  Group: Device

1165 1166
  The section describes driver functions,
  which are required for general use of the driver,
hu's avatar
hu committed
1167 1168 1169 1170 1171 1172 1173 1174
  but which are related to a specific functionality of the macro itself.
*/


/***********************************************************
  Function: R_WM_DevInit

  Init WM unit.
1175

hu's avatar
hu committed
1176
  Description:
1177 1178 1179 1180 1181
  This function initializes the driver and the hardware as far as necessary.
  The driver makes sure, that the macro is set into a default configuration.
  It is also in the responsibility of the driver to keep track of the macro
  instance status and to avoid, that the macro instance is initialized more
  than one time or that any other function can be executed before the
hu's avatar
hu committed
1182
  initialization has been completed successfully.
1183

hu's avatar
hu committed
1184 1185
  Parameter:
  Unit          -   The parameter specifies the screen number
1186
                    The window manager can support more than one physical screen
hu's avatar
hu committed
1187 1188 1189 1190 1191 1192 1193 1194
                    Valid values are defined by <R_WM_DEV_*>
                    The number of valid devices is <R_WM_DEV_NUM>
  MsgQueue      -   This is a pointer to Size elements of the <R_WM_Msg_t> type
                    The array is used by the window manager to store the window manager requests
  Size          -   The number specified the number of elements in the message queue
  EventCb       -   External event notification callback function
  CpuHeap       -   Pointer to your managed cpu heap
  VidHeap       -   Pointer to your managed video heap
1195

hu's avatar
hu committed
1196
  Return value:
1197
  See <R_WM_Error_t>.
hu's avatar
hu committed
1198 1199 1200
*/

r_wm_Error_t R_WM_DevInit   (  uint32_t        Unit,
1201 1202 1203 1204 1205
                               r_wm_Msg_t      *MsgQueue,
                               uint32_t        Size,
                               void(*EventCb)(uint32_t Unit, const r_wm_Event_t *Event),
                               const void *CpuHeap,
                               const void *VidHeap
hu's avatar
hu committed
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215
                            );


/***********************************************************
  Function: R_WM_DevEventRegister

  Description:
  Register for retrieving the notification on an event.
  Only the external events registered with this function will
  be received by the device callback function.
1216

hu's avatar
hu committed
1217
  Parameter:
1218

hu's avatar
hu committed
1219 1220 1221
  Unit      -   See description of <R_WM_DevInit>
  EventId   -   The ID of the event to be registered for receiving
  Arg       -   Generic argument if applicable
1222

hu's avatar
hu committed
1223
  Generic argument values:
1224

hu's avatar
hu committed
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238
  R_WM_EVENT_VBLANK     - any (ignored)
  R_WM_EVENT_SCANLINE   - scan line number on which the interrupt will trigger
*/
r_wm_Error_t R_WM_DevEventRegister  (   uint32_t        Unit,
                                        r_wm_EventId_t  EventId,
                                        uint32_t        Arg
                                    );

/***********************************************************
  Function: R_WM_DevDeinit

  DeInit WM unit.

  Description:
1239 1240 1241 1242
  This function deinitializes the driver and the hardware.
  In case the function is called for an instance of the macro,
  which has not been initialized before, the function shall return an error.

hu's avatar
hu committed
1243 1244
  Parameter:
  Unit -  See description of <R_WM_DevInit>
1245

hu's avatar
hu committed
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282
  Return value:
  See <r_wm_Error_t>.
*/

r_wm_Error_t R_WM_DevDeinit(uint32_t Unit);



/***********************************************************
  Function: R_WM_DevInfoGet

  Description:
  Get information of screen and window parameters.

  Parameter:
  Unit      - See description of <R_WM_DevInit>
  LayerNum  - pointer to a variable to return number of usable layers
  PitchMax  - pointer to a variable to return maximum pitch of a layer. If 0 is returned then a pitch is not supported.
  WidthMax  - pointer to a variable to return maximum width of a layer
  HeightMax - pointer to a variable to return maximum height of a layer

  Return value:
  See <r_wm_Error_t>.
*/

r_wm_Error_t R_WM_DevInfoGet    (   uint32_t  Unit,
                                    uint32_t *LayerNum,
                                    uint32_t *PitchMax,
                                    uint32_t *WidthMax,
                                    uint32_t *HeightMax
                                );


/***********************************************************
  Function: R_WM_GetVersionString

  Returns:
1283

hu's avatar
hu committed
1284 1285 1286 1287 1288 1289 1290 1291 1292
  version string of this WM driver
*/

const int8_t *R_WM_GetVersionString(void);


/***********************************************************
  Group: Screen

1293 1294
  A screen is a physical video output unit.
  There is no frame-buffer associated with a screen,
hu's avatar
hu committed
1295 1296 1297 1298 1299 1300 1301 1302 1303
  but a screen might have a background color.
*/


/***********************************************************
  Function: R_WM_ScreenTimingSet

  Description:
  Create a screen on the specified video output.
1304
  The new values will be active after placing a call to <R_WM_ScreenEnable>
hu's avatar
hu committed
1305 1306 1307 1308
  into the message queue and executing this part of the queue.

  Parameter:
    Unit   - See description of <R_WM_DevInit>
1309
    Timing - The timing parameter contains all the information
hu's avatar
hu committed
1310 1311 1312
             to drive the display see the description of <r_ddb_Timing_t> for details.

  Return value:
1313
  See <r_wm_Error_t>.
hu's avatar
hu committed
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325
*/

r_wm_Error_t R_WM_ScreenTimingSet   (   uint32_t        Unit,
                                        r_ddb_Timing_t  *Timing
                                    );


/***********************************************************
  Function: R_WM_ScreenTimingSetByName

  Description:
  Create a screen on the specified video output.
1326
  The new values will be active after placing a call to <R_WM_ScreenEnable>
hu's avatar
hu committed
1327 1328 1329 1330
  into the message queue and executing this part of the queue.

  Parameter:
    Unit - See description of <R_WM_DevInit>
1331
    Name - The name is an identifier, which is used to lookup
hu's avatar
hu committed
1332 1333 1334 1335 1336 1337 1338
            for the correct screen timing in the display data base (see: <r_ddb_Timing_t>).

  Return value:
  See <r_wm_Error_t>.
*/

r_wm_Error_t R_WM_ScreenTimingSetByName (   uint32_t        Unit,
1339
        const int8_t    *Name
hu's avatar
hu committed
1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358
                                        );


/***********************************************************
  Function: R_WM_ScreenColorFormatSet

  Description:
  Set the color format for the signals of the specified video output.
  Default format for the video output is RGB888.

  Parameter:
    Unit   - See description of <R_WM_DevInit>
    OutFmt - A color format of <r_wm_OutColorFmt_t> plus optional bit flags.

  Return value:
  See <r_wm_Error_t>.
*/

r_wm_Error_t R_WM_ScreenColorFormatSet (    uint32_t            Unit,
1359 1360
        r_wm_OutColorFmt_t  OutFmt
                                       );
hu's avatar
hu committed
1361 1362 1363 1364 1365 1366


/***********************************************************
  Function: R_WM_ScreenBgColorSet

  Description:
1367 1368 1369
  Set the screen background color that is seen, if no window
  (or a transparent one) is on top of it.
  If the selected screen does not support a background color,
hu's avatar
hu committed
1370 1371 1372 1373 1374 1375 1376
  the function will return with an error.

  Parameter:
  Unit           - See description of <R_WM_DevInit>
  Red/Green/Blue - The individual color components of the background color.

  Return value:
1377
  See <r_wm_Error_t>.
hu's avatar
hu committed
1378 1379
*/
r_wm_Error_t R_WM_ScreenBgColorSet  (   uint32_t Unit,
1380 1381
                                        uint8_t  Red,
                                        uint8_t  Green,
hu's avatar
hu committed
1382 1383 1384 1385 1386 1387 1388 1389
                                        uint8_t  Blue
                                    );


/***********************************************************
  Function: R_WM_ScreenColorCurveSet

  Description:
1390 1391
  Set a curve to be used as custom gamma or color correction curve.
  Using this curve, each RGB color channel is individually corrected according
hu's avatar
hu committed
1392
  to the given curve.
1393 1394

  For the correction in D1x/VDCE, the incoming color information of each channel
hu's avatar
hu committed
1395 1396
  is split into 32 equally sized segments each covering a range 8 color values.
  For each of these 8 values in a segment, the same gain factor applies.
1397 1398

  To configure the segments, a start and an end value need to be given.
hu's avatar
hu committed
1399
  This requires 33 RGB reference points to be passed to this function.
1400 1401

  For each segment of each color, the gain factor must be in range [0.0 .. +2.0],
hu's avatar
hu committed
1402 1403 1404
  thus the values between two reference points may have a difference in range of [0 .. +16].
  The origin is always at point zero: In = Out = RGB(0,0,0).
  The slope is always positive.
1405

hu's avatar
hu committed
1406 1407
  If any value except [0] exceeds above limitation, the curve will be approximated
  as close as possible while staying within the HW limitations.
1408 1409 1410 1411

  The reference points are defined as RGB values which define the color output expected
  for that certain reference point.
  E.g.
hu's avatar
hu committed
1412 1413
    Reference point 1 defines the desired RGB output color for the input color RGB(8,8,8).
    Reference point 3 defines the desired RGB output color for the input color RGB(24,24,24).
1414

hu's avatar
hu committed
1415
  This function will overwrite the settings of <R_WM_ScreenGammaSet>.
1416

hu's avatar
hu committed
1417 1418 1419
  Parameter:
  Unit          - See description of <R_WM_DevInit>
  NumEntries    - Number of reference points
1420
  Clut          - Pointer to Table of reference points <r_wm_ClutEntry_t>.
hu's avatar
hu committed
1421 1422 1423 1424
                  ALPHA value of data type is unused!
                  Note: The data pointed to by the pointer <ColorCurve> must be available
                        until the message queue containing this command has been processed.
  Return value:
1425
  See <r_wm_Error_t>.
hu's avatar
hu committed
1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437
*/
r_wm_Error_t R_WM_ScreenColorCurveSet ( uint32_t Unit,
                                        uint32_t NumEntries,
                                        const r_wm_ClutEntry_t *ColorCurve
                                      );


/***************************************************************************
  Function: R_WM_ScreenGammaSet

  Description:
    This function sets the output gamma correction.
1438

hu's avatar
hu committed
1439
    This function will overwrite the settings of <R_WM_ScreenColorCurveSet>.
1440 1441

    Also for Gamma Correction Curves, the slope is limited to the range [0.0 .. +2.0]
hu's avatar
hu committed
1442
    as described above in <R_WM_ScreenColorCurveSet>.
1443
    If parts of the Gamma Curve exceed this range, this function will choose
hu's avatar
hu committed
1444 1445 1446 1447 1448 1449 1450
    the closest match based on the given limitations.

  Parameter:
    Unit    - See description of <R_WM_DevInit>
    Gamma   - Gamma correction factor (0..255 => 0.25..2.0, 128=1.0)

  Return value:
1451
  See <r_wm_Error_t>.
hu's avatar
hu committed
1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469
*/
r_wm_Error_t R_WM_ScreenGammaSet (  uint32_t Unit,
                                    const uint8_t GammaRed,
                                    const uint8_t GammaGreen,
                                    const uint8_t GammaBlue
                                 );


/***********************************************************
  Function: R_WM_ScreenEnable

  Description:
  Switch on the display.

  Parameter:
  Unit - See description of <R_WM_DevInit>

  Return value:
1470
  See <r_wm_Error_t>.
hu's avatar
hu committed
1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485
*/

r_wm_Error_t R_WM_ScreenEnable(uint32_t Unit);


/***********************************************************
  Function: R_WM_ScreenDisable

  Description:
  Switch off the display.

  Parameter:
  Unit - See description of <R_WM_DevInit>

  Return value:
1486
  See <r_wm_Error_t>.
hu's avatar
hu committed
1487 1488 1489 1490 1491 1492 1493
*/

r_wm_Error_t R_WM_ScreenDisable(uint32_t Unit);


/***********************************************************
  Group: Windows
1494

hu's avatar
hu committed
1495
  Description:
1496 1497 1498 1499
  A window is an area with graphical content, which is placed
  on a screen.
  Windows may cover the whole screen, but they could also cover
  part of the screen only.
hu's avatar
hu committed
1500

1501 1502 1503 1504
  It is possible to stack windows and to define transparency
  for a window.
  If overlapping windows have the same Z position, it is not
  defined, which window will be on the top.
hu's avatar
hu committed
1505

1506 1507
  A video output can have hardware support for windows (e.g.
  hardware layers).
hu's avatar
hu committed
1508 1509

  Note:
1510
  If an OS is used the Window functions internally use semaphores.
hu's avatar
hu committed
1511 1512 1513 1514 1515 1516 1517 1518
  This must be taken into account if they are called by an interrupt service routine.
*/


/***********************************************************
  Function: R_WM_WindowCapabilitiesSet

  Description:
1519
  Configure the Video Output Layers to decode RLE compressed textures or to
hu's avatar
hu committed
1520 1521
  show sprite windows. Only one feature may be selected for each layer.

1522 1523
  The windows of the WM are internally mapped to HW-video-output layers.

hu's avatar
hu committed
1524 1525 1526 1527
  The assignment happens automatically and is influenced by the following parameters:
   * Z-Index (PosZ), mapping to HW is started with lowest PosZ to lowest HW-Layer
   * Color Format (r_wm_WinColorFmt_t), if RLE Format is requested, HW-Layers may be skipped until HW-Layer with RLE support is found.
   * Window-Mode (r_wm_WinMode_t), if Sprite Mode is requested, HW-Layers may be skipped until HW-Layer with sprite support is found.
1528

hu's avatar
hu committed
1529 1530
   -> If no matching layer could be found with regard to the z-Index, the driver reports an error.
      Please make sure, the z-Indices <PosZ> match the order of the required capabilities.
1531

hu's avatar
hu committed
1532 1533 1534 1535 1536 1537 1538 1539 1540 1541
  D1M1A only!  Default values are as shown below.
  For other devices, this is always fixed to the default values and cannot be changed.
  Default values:
    Capability0: RLE
    Capability1: SPRITES
    Capability2: SPRITES
    Capability3: SPRITES

  Calling this function influences both WM Unit 0 and WM Unit 1, therefore it has no Unit <parameter>.
  Attention: The layer order of VO1 is different from the layer order of VO0.
1542

hu's avatar
hu committed
1543
  Calling this function is only possible with all instances of VDCE/VOWE disabled.
1544

hu's avatar
hu committed
1545 1546 1547 1548 1549 1550 1551 1552 1553
  Parameter:
    Capability0  - Selects mode for VO0 Layer0 and VO1 Layer0
    Capability1  - Selects mode for VO0 Layer1 and VO1 Layer3
    Capability2  - Selects mode for VO0 Layer2 and VO1 Layer2
    Capability3  - Selects mode for VO0 Layer3 and VO1 Layer1

*/

r_wm_Error_t R_WM_WindowCapabilitiesSet (   r_wm_WinCapbs_t Capability0,
1554 1555 1556 1557
        r_wm_WinCapbs_t Capability1,
        r_wm_WinCapbs_t Capability2,
        r_wm_WinCapbs_t Capability3
                                        );
hu's avatar
hu committed
1558 1559 1560 1561 1562 1563


/***********************************************************
  Function: R_WM_WindowCreate

  Description:
1564
  Create a window as specified in the Window parameter on screen Unit.
hu's avatar
hu committed
1565

1566
  For variable locations of <r_wm_Window_t> that are not initialized
hu's avatar
hu committed
1567 1568 1569 1570 1571 1572 1573
  during startup, e.g. local variables or allocated variables, please
  make sure to initialize all members of the struct.
  Unused values may be set to zero.
  For example: (code)
  memset(&Window, 0, sizeof(r_wm_Window_t))
  (end)

1574 1575
  If the <r_wm_WinBufAllocMode_t> is R_WM_WINBUF_ALLOC_EXTERNAL
  the pointer Buffer of the window structure has to point to
hu's avatar
hu committed
1576
  an array of BufNum elements of <r_wm_WinBuffer_t> type.
1577

hu's avatar
hu committed
1578 1579 1580 1581
  D1x/VDCE Specific:
  - RLE-Type buffer addresses must be 128-Byte aligned.
  - RLE-Type buffer strides must be 128-byte aligned and increased by another 128-byte.
  - Normal-Type buffer addresses must be 128-Byte aligned.
1582 1583

  Alternatively the Buffer does not need to be set yet.
hu's avatar
hu committed
1584 1585 1586
  It can be set later by <r_wm_WindowExternalBufSet>.

  If the <r_wm_WinBufAllocMode_t> is R_WM_WINBUF_ALLOC_INTERNAL
1587
  the function will allocate the Buffer data for each buffer itself.
hu's avatar
hu committed
1588 1589
  Buffer must be set to NULL.

1590 1591 1592 1593
  The Next pointer value is set by the function; any value
  in it will be ignored.

  The window will not be visible until it is enabled.
hu's avatar
hu committed
1594 1595 1596

  Parameter:
    Unit   - See description of <R_WM_DevInit>
1597 1598
    Window - This is a pointer to an <r_wm_Window_t> structure.
             The structure has to be filled by the application
hu's avatar
hu committed
1599
             before calling the function.
1600

hu's avatar
hu committed
1601
  Return value:
1602
  See <r_wm_Error_t>.
hu's avatar
hu committed
1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613
*/

r_wm_Error_t R_WM_WindowCreate  (   uint32_t       Unit,
                                    r_wm_Window_t *Window
                                );


/***********************************************************
  Function: R_WM_WindowDelete

  Description:
1614 1615
  The function will delete the specified window.
  All internally allocated data buffer will be freed by the function.
hu's avatar
hu committed
1616 1617 1618 1619

  Parameter:
    Unit   - See description of <R_WM_DevInit>
    Window - This is a window's structure <r_wm_Window_t> pointer
1620

hu's avatar
hu committed
1621
  Return value:
1622
  See <r_wm_Error_t>.
hu's avatar
hu committed
1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633
*/

r_wm_Error_t R_WM_WindowDelete  (   uint32_t        Unit,
                                    r_wm_Window_t   *Window
                                );


/***********************************************************
  Function: R_WM_WindowEnable

  Description:
1634
  Enable the window. The window will be visible on the screen
hu's avatar
hu committed
1635 1636 1637 1638 1639 1640 1641 1642 1643
  after calling this function.

  This function triggers a config event, see <r_wm_MsgId_t>.

  Parameter:
    Unit   - See description of <R_WM_DevInit>
    Window - This is a window's structure <r_wm_Window_t> pointer

  Return value:
1644
  See <r_wm_Error_t>.
hu's avatar
hu committed
1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655
*/

r_wm_Error_t R_WM_WindowEnable  (   uint32_t        Unit,
                                    r_wm_Window_t   *Window
                                );


/***********************************************************
  Function: R_WM_WindowDisable

  Description:
1656
  Disable the window. The window will be invisible on the screen
hu's avatar
hu committed
1657 1658 1659 1660 1661 1662 1663 1664 1665
  after calling this function.

  This function triggers a config event, see <r_wm_MsgId_t>.

  Parameter:
    Unit   - See description of <R_WM_DevInit>
    Window - This is a Window's structure <r_wm_Window_t> pointer

  Return value:
1666
  See <r_wm_Error_t>.
hu's avatar
hu committed
1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685
*/

r_wm_Error_t R_WM_WindowDisable (   uint32_t Unit,
                                    r_wm_Window_t *Window
                                );


/***********************************************************
  Function: R_WM_WindowMove

  Description:
  Move the window to the specified position.

  This function triggers a move event, see <r_wm_MsgId_t>.

  Parameter:
    Unit           - See description of <R_WM_DevInit>
    Window         - This is a window's structure <r_wm_Window_t> pointer
    PosX/PosY/PosZ - These parameters specify the new absolute position of the window on the screen.
1686 1687 1688
                     For negative X coordinates, please note that moving is restricted
                     by the horizontal blanking width. Negative PosX values may not fall
                     below (-r_ddb_Timing_t.H.BlankWidth+16). For negative PosX that exceed
hu's avatar
hu committed
1689
                     this limit, their value is clamped to (-r_ddb_Timing_t.H.BlankWidth+16).
1690 1691

                     An exception that allows for free moving in negative X direction is
hu's avatar
hu committed
1692
                     that (r_ddb_Timing_t.H.BlankWidth - 16) >= (128 / BPP).
1693

hu's avatar
hu committed
1694
  Return value:
1695
  See <r_wm_Error_t>.
hu's avatar
hu committed
1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716
*/

r_wm_Error_t R_WM_WindowMove    (   uint32_t       Unit,
                                    r_wm_Window_t  *Window,
                                    int32_t        PosX,
                                    int32_t        PosY,
                                    int32_t        PosZ
                                );

/***********************************************************
  Function: R_WM_WindowResize

  Description:
  Resizes the window.

  Parameter:
    Unit                - See description of <R_WM_DevInit>
    Window              - This is a window's structure <r_wm_Window_t> pointer
    Pitch/Width/Height  - These parameters specify the new geometry of the window.

  Return value:
1717
  See <r_wm_Error_t>.
hu's avatar
hu committed
1718 1719 1720 1721 1722 1723 1724
*/

r_wm_Error_t R_WM_WindowResize    ( uint32_t        Unit,
                                    r_wm_Window_t   *Window,
                                    uint32_t        Pitch,
                                    uint32_t        Width,
                                    uint32_t        Height
1725
                                  );
hu's avatar
hu committed
1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738

/***********************************************************
  Function: R_WM_WindowColorFmtSet

  Description:
  Sets the color format of the window.

  Parameter:
    Unit                - See description of <R_WM_DevInit>
    Window              - Pointer to the window's structure <r_wm_Window_t>
    ColorFmt            - Window color format, see the description of <r_wm_WinColorFmt_t>

  Return value:
1739
  See <r_wm_Error_t>.
hu's avatar
hu committed
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757
*/

r_wm_Error_t R_WM_WindowColorFmtSet (   uint32_t                Unit,
                                        r_wm_Window_t           *Window,
                                        r_wm_WinColorFmt_t      ColorFmt
                                    );


/***********************************************************
  Function: R_WM_WindowAlphaSet

  Description:
  Change the window's alpha value.

  Parameter:
    Unit   - See description of <R_WM_DevInit>
    Window - This is a window's structure <r_wm_Window_t> pointer
    Alpha  - New alpha value of the window.
1758

hu's avatar
hu committed
1759
  Return value:
1760
  See <r_wm_Error_t>.
hu's avatar
hu committed
1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776
*/

r_wm_Error_t R_WM_WindowAlphaSet(   uint32_t        Unit,
                                    r_wm_Window_t  *Window,
                                    uint8_t         Alpha);


/***********************************************************
  Function: R_WM_WindowPremultipliedAlphaEnable

  Description:
  Enable the window's premultiplied alpha mode.

  Parameter:
    Unit   - See description of <R_WM_DevInit>
    Window - This is a window's structure <r_wm_Window_t> pointer
1777

hu's avatar
hu committed
1778
  Return value:
1779
  See <r_wm_Error_t>.
hu's avatar
hu committed
1780 1781 1782
*/

r_wm_Error_t R_WM_WindowPremultipliedAlphaEnable(   uint32_t        Unit,
1783
        r_wm_Window_t  *Window);
hu's avatar
hu committed
1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794


/***********************************************************
  Function: R_WM_WindowPremultipliedAlphaDisable

  Description:
  Disable the window's premultiplied alpha mode.

  Parameter:
    Unit   - See description of <R_WM_DevInit>
    Window - This is a window's structure <r_wm_Window_t> pointer
1795

hu's avatar
hu committed
1796
  Return value:
1797
  See <r_wm_Error_t>.
hu's avatar
hu committed
1798 1799 1800
*/

r_wm_Error_t R_WM_WindowPremultipliedAlphaDisable(  uint32_t        Unit,
1801
        r_wm_Window_t  *Window);
hu's avatar
hu committed
1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812


/***********************************************************
  Function: R_WM_WindowVerticalMirrorEnable

  Description:
  Enable window's vertical mirroring.

  Parameter:
    Unit   - See description of <R_WM_DevInit>
    Window - This is a window's structure <r_wm_Window_t> pointer
1813

hu's avatar
hu committed
1814
  Return value:
1815
  See <r_wm_Error_t>.
hu's avatar
hu committed
1816 1817 1818
*/

r_wm_Error_t R_WM_WindowVerticalMirrorEnable(   uint32_t        Unit,
1819
        r_wm_Window_t  *Window);
hu's avatar
hu committed
1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830


/***********************************************************
  Function: R_WM_WindowVerticalMirrorDisable

  Description:
  Disable window's vertical mirroring.

  Parameter:
    Unit   - See description of <R_WM_DevInit>
    Window - This is a window's structure <r_wm_Window_t> pointer
1831

hu's avatar
hu committed
1832
  Return value:
1833
  See <r_wm_Error_t>.
hu's avatar
hu committed
1834 1835 1836
*/

r_wm_Error_t R_WM_WindowVerticalMirrorDisable(  uint32_t        Unit,
1837
        r_wm_Window_t  *Window);
hu's avatar
hu committed
1838 1839 1840 1841 1842 1843


/***********************************************************
  Function: R_WM_WindowSwap

  Description:
1844 1845
  If the window is a multi-buffer window, the background buffer
  is switched to the window surface (see: <r_wm_WinBufStatus_t>).
hu's avatar
hu committed
1846 1847 1848 1849

  Parameter:
    Unit       - See description of <R_WM_DevInit>
    Window     - Pointer to the window's structure <r_wm_Window_t>
1850

hu's avatar
hu committed
1851
  Return value:
1852
  See <r_wm_Error_t>.
hu's avatar
hu committed
1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924
*/

r_wm_Error_t R_WM_WindowSwap    (   uint32_t        Unit,
                                    r_wm_Window_t   *Window
                                );



/***********************************************************
  Function: R_WM_WindowNewDrawBufGet

  Description:
  Returns the next free buffer of the specified window.

  Parameter:
  Unit   - See description of <R_WM_DevInit>
  Window - This is a window's structure <r_wm_Window_t> pointer

  Return value:
  Address of the next frame buffer, which can be used for drawing operations.
  Zero if no free buffer is available.
*/

void *R_WM_WindowNewDrawBufGet  (   uint32_t        Unit,
                                    r_wm_Window_t   *Window
                                );


/***********************************************************
  Function: R_WM_WindowVisibleBufGet

  Description:
  Returns the visible buffer of the specified window.

  Parameter:
  Unit   - See description of <R_WM_DevInit>
  Window - This is a window's structure <r_wm_Window_t> pointer

  Return value:
  Address of the next frame buffer, which is currently on screen (or scheduled to be on screen)
*/

void *R_WM_WindowVisibleBufGet  (   uint32_t        Unit,
                                    r_wm_Window_t   *Window
                                );


/***********************************************************
  Function: R_WM_WindowCurrentDrawBufGet

  Description:
  Return the current drawing frame buffer of the specified window.

  Parameter:
  Unit   - See description of <R_WM_DevInit>
  Window - This is a window's structure <r_wm_Window_t> pointer

  Return value:
  Address of the current frame buffer.
  Zero if error.
*/
void *R_WM_WindowCurrentDrawBufGet  (   uint32_t        Unit,
                                        r_wm_Window_t   *Window
                                    );


/***********************************************************
  Function: R_WM_WindowExternalBufSet

  Description:
  Dynamically set the framebuffers in desired format (not neccessarilly the same as during window creation)
  for windows with externally allocated buffers.
1925

hu's avatar
hu committed
1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944
  The window must have been created with the <r_wm_WinBufAllocMode_t> R_WM_WINBUF_ALLOC_EXTERNAL.

  D1x/VDCE Specific:
  - RLE-Type buffer addresses must be 128-Byte aligned.
  - RLE-Type buffer strides must be 128-byte aligned and increased by another 128-byte.
  - Normal-Type buffer addresses must be 128-Byte aligned.

  Parameter:
    Unit        - See description of <R_WM_DevInit>
    Window      - Pointer to the window's structure <r_wm_Window_t>
    Buf         - Buffer array
    BufNum      - Number of buffers in the array
    ColorFormat - Color format of the buffers

  Return value:
  See <r_wm_Error_t>.
*/

r_wm_Error_t R_WM_WindowExternalBufSet  (   uint32_t            Unit,
1945 1946 1947 1948
        r_wm_Window_t       *Window,
        r_wm_WinBuffer_t    *Buf,
        uint32_t            BufNum,
        r_wm_WinColorFmt_t  ColorFormat
hu's avatar
hu committed
1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985
                                        );


/***********************************************************
  Function: R_WM_WindowColorKeyEnable

  Description:
  Enable the colorkeying of the selected Window.
  Colorkeying will override the <r_wm_Window_t.Alpha> setting.

  Parameters:
    Unit    - See description of <R_WM_DevInit>
    Window  - This is a window's structure <r_wm_Window_t> pointer

  Returns value:
  See <r_wm_Error_t>.
*/

r_wm_Error_t R_WM_WindowColorKeyEnable(uint32_t Unit, r_wm_Window_t  *Window);

/***********************************************************
  Function: R_WM_WindowColorKeyDisable

  Description:
  Disable the colorkeying of the selected Window

  Parameters:
    Unit    - See description of <R_WM_DevInit>
    Window - window's structure <r_wm_Window_t> pointer

  Returns value:
  See <r_wm_Error_t>.
*/
r_wm_Error_t R_WM_WindowColorKeyDisable(uint32_t Unit, r_wm_Window_t *Window);

/***********************************************************
  Function: R_WM_WindowClutSet
1986

hu's avatar
hu committed
1987
  Description:
1988

hu's avatar
hu committed
1989 1990
  Sets the colour lookup table. Only applicable for the
  windows with CLUT colour modes specified.
1991

hu's avatar
hu committed
1992 1993 1994 1995
  Parameters:
    Unit        - See description of <R_WM_DevInit>
    Window      - window's structure <r_wm_Window_t> pointer
    NumEntries  - Number of the color lookup-table entries
1996 1997
    Clut        - Color lookup-table pointer <r_wm_ClutEntry_t>.
                  Note: The data pointed to by the pointer <Clut> must be avalilable
hu's avatar
hu committed
1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012
                        as long as the Window using the CLUT color format is active.
*/

r_wm_Error_t R_WM_WindowClutSet (   uint32_t Unit,
                                    r_wm_Window_t *Window,
                                    uint32_t NumEntries,
                                    const r_wm_ClutEntry_t  *Clut
                                );

/***********************************************************
  Function: R_WM_WindowRemoveAllSprites

  Description:
  Deletes all sprites associated to the window. This function is guaranteed
  to execute faster than deleting sprite by sprite manually.
2013

hu's avatar
hu committed
2014 2015 2016 2017 2018 2019
  Parameters:
  Unit        - See description of <R_WM_DevInit>
  Window      - window's structure <r_wm_Window_t> pointer
*/

r_wm_Error_t R_WM_WindowDeleteAllSprites    (   uint32_t Unit,
2020
        r_wm_Window_t *Window
hu's avatar
hu committed
2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033
                                            );


/***********************************************************
  Group: Message Queue
*/


/***********************************************************
  Function: R_WM_MsgEnqueue

  Description:
  Enqueues the WM requests to the message queue.
2034

hu's avatar
hu committed
2035 2036 2037 2038 2039
  Parameter:
    Unit      - See description of <R_WM_DevInit>
    Msg       - Event description, see <r_wm_Msg_t>.

  Return value:
2040
  See <r_wm_Error_t>.
hu's avatar
hu committed
2041 2042

  Note:
2043
  This function must not be called by an ISR!
hu's avatar
hu committed
2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055
*/

r_wm_Error_t R_WM_MsgEnqueue    (   uint32_t        Unit,
                                    r_wm_Msg_t      *Msg
                                );

/***********************************************************
  Function: R_WM_FrameEndMark

  Description:
  Frame delimiter - marks the end of the sequence of the WM requests to be executed
  during one frame redraw.
2056

hu's avatar
hu committed
2057 2058 2059
  Parameters:
  Unit  - See description of <R_WM_DevInit>
  Id    - The sequence ID (should be used in subsequent R_WM_FrameWait call)
2060

hu's avatar
hu committed
2061 2062 2063
  Return value:
  See <r_wm_Error_t>.
*/
2064

hu's avatar
hu committed
2065 2066 2067 2068 2069 2070
r_wm_Error_t R_WM_FrameEndMark(uint32_t Unit, uint16_t Id);

/***********************************************************
  Function: R_WM_FrameWait

  Description:
2071
  Executes the requests from the message queue up to the specicied frame delimiter.
hu's avatar
hu committed
2072 2073 2074 2075 2076 2077 2078

  Parameters:
  Unit  - See description of <R_WM_DevInit>
  Id    - ID of the frame up to which all the requests should be executed

  Return value:
  See <r_wm_Error_t>.
2079

hu's avatar
hu committed
2080 2081 2082
  Remarks:
  This function blocks until all the requests scheduled up to the specified frame delimiter
  are executed, and the corresponding VOUT HW update is finished.
2083

hu's avatar
hu committed
2084
  Specific implementation for the VDCE:
2085 2086
  - Before processing the message queue, this function waits until the Hardware is ready to be
    reconfigured. The point of time of this "Scanline Event" can be configured with the function
hu's avatar
hu committed
2087
    <R_WM_Sys_DevEventRegister>. The default value is (ScreenHeight / 2).
2088
  - After processing the queue, this function waits for the "VSync Event" until the Hardware
hu's avatar
hu committed
2089
    accepted the new configuration.
2090
  - Please note, if the "Scanline Event" already occurred for the current frame, this function
hu's avatar
hu committed
2091
    will wait for the next event, thus it will skip one frame.
2092
    The same applies to the "VSync Event". If processing the message queue took too much time to
hu's avatar
hu committed
2093
    miss the current event, this function will wait for the next event and skip one frame.
2094

hu's avatar
hu committed
2095
  Default sequence:
2096
  The call to <R_WM_FrameWait> consists of
hu's avatar
hu committed
2097 2098 2099
  - WAIT (for "Scanline Event")
  - EXEC (process the message queue)
  - WAIT (for "VSync Event")
2100

hu's avatar
hu committed
2101 2102
  (code)
  VSync      ScanLine        VSync      ScanLine         VSync
2103 2104 2105 2106 2107
    |            |             |            |             |
    | DRW |      |             | DRW |      |             |
    |     | WAIT |             |     | WAIT |             |
    |            | EXEC |      |            | EXEC |      |
    |            |      | WAIT |            |      | WAIT |
hu's avatar
hu committed
2108 2109 2110 2111 2112
  (end)

  Problematic sequence:
  Case 1 - The "Scanline Event" is configured to occur while drawing is still active.
  The execution of the Message Queue will happen on the following "Scanline Event".
2113

hu's avatar
hu committed
2114 2115
  (code)
  VSync      ScanLine        VSync      ScanLine         VSync
2116 2117 2118 2119 2120
    |            |             |            |             |
    | DRW --------> |          |            |             |
    |            |  | WAIT ---------------> |             |
    |            |             |            | EXEC |      |
    |            |             |            |      | WAIT |
hu's avatar
hu committed
2121
  (end)
2122

hu's avatar
hu committed
2123 2124
  Case 2 - The "Scanline Event" is configured to occur too close to the "Vsync Event".
  Control will be given back to user application only after the following "VSync Event"
2125

hu's avatar
hu committed
2126 2127 2128 2129 2130 2131 2132 2133
  (code)
  VSync            ScanLine  VSync            ScanLine   VSync
    |                  |       |                  |       |
    | DRW |            |       |                  |       |
    |     | WAIT ----> |       |                  |       |
    |                  | EXEC --> |               |       |
    |                  |       |  | WAIT ---------------> |
  (end)
2134

hu's avatar
hu committed
2135 2136 2137 2138 2139 2140 2141
*/
r_wm_Error_t R_WM_FrameWait(uint32_t Unit, uint16_t Id);

/***********************************************************
  Function: R_WM_FrameExecuteNext

  Description:
2142 2143
  Requests to WM are stored in the message queue.
  This function executes the requests in the queue up to the next frame delimiter.
hu's avatar
hu committed
2144 2145 2146 2147 2148 2149

  Parameters:
  Unit  - See description of <R_WM_DevInit>

  Return value:
  The encountered frame-end Id .
2150

hu's avatar
hu committed
2151 2152 2153 2154 2155 2156 2157 2158 2159
  Remarks:
  This function can be used for implementing the custom drawing mechanism, apart from the
  synchronous one provided by default.
*/
uint32_t R_WM_FrameExecuteNext(uint32_t Unit);

/***********************************************************
  Group: Video Capture

2160
  The window manager offers the possibility to create surfaces
hu's avatar
hu committed
2161 2162 2163 2164 2165 2166 2167
  for the video capturing.
*/

/***********************************************************
  Function: R_WM_CaptureCreate

  Description:
2168
  Create a video capture surface inside a specific window on the screen Unit.
hu's avatar
hu committed
2169 2170 2171
  The pointer Window of the capture structure has to point to a valid window,
  which needs to be of the 'frame buffer' type.
  It is also the responsibility of the caller to ensure
2172 2173
  that the window is suitable for the desired video capturing parameters.
  The capturing surface will not be visible until it is enabled.
hu's avatar
hu committed
2174 2175 2176

  Parameter:
  Unit    - See description of <R_WM_DevInit>
2177
  Capture - This is a pointer to an <r_wm_Capture_t> structure.
hu's avatar
hu committed
2178 2179 2180
            The structure has to be filled by the application before calling the function.

  Return value:
2181
  See <r_wm_Error_t>.
hu's avatar
hu committed
2182 2183 2184 2185 2186 2187 2188 2189 2190
*/

r_wm_Error_t R_WM_CaptureCreate (   uint32_t    Unit,
                                    r_wm_Capture_t *Capture
                                );
/***********************************************************
  Function: R_WM_CaptureDelete

  Description:
2191
  Delete the specified capturing surface.
hu's avatar
hu committed
2192 2193 2194 2195 2196 2197 2198
  It will not delete the window, which is used for the capturing.

  Parameter:
  Unit    - See description of <R_WM_DevInit>s
  Capture - This is a pointer to the capturing surface's structure <r_wm_Capture_t>.

  Return value:
2199
  See <r_wm_Error_t>.
hu's avatar
hu committed
2200 2201 2202
*/

r_wm_Error_t R_WM_CaptureDelete(uint32_t             Unit,
2203
                                r_wm_Capture_t *Capture);
hu's avatar
hu committed
2204 2205 2206 2207 2208 2209


/***********************************************************
  Function: R_WM_CaptureEnable

  Description:
2210
  Enable the video capturing surface and start the capturing.
hu's avatar
hu committed
2211 2212 2213 2214 2215 2216 2217 2218
  The capturing is visible inside the specified window.


  Parameter:
  Unit    - See description of <R_WM_DevInit>
  Capture - This is a pointer to the capturing surface's structure <r_wm_Capture_t>

  Return value:
2219
  See <r_wm_Error_t>.
hu's avatar
hu committed
2220 2221 2222
*/

r_wm_Error_t R_WM_CaptureEnable(uint32_t             Unit,
2223
                                r_wm_Capture_t *Capture);
hu's avatar
hu committed
2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236


/***********************************************************
  Function: R_WM_CaptureDisable

  Description:
  Disable the video capturing. The last frame will remain in the window's framebuffer.

  Parameter:
  Unit    - See description of <R_WM_DevInit>
  Capture - This is a pointer to the capturing surface's structure <r_wm_Capture_t>.

  Return value:
2237
  See <r_wm_Error_t>.
hu's avatar
hu committed
2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304
*/

r_wm_Error_t R_WM_CaptureDisable    (   uint32_t             Unit,
                                        r_wm_Capture_t *Capture
                                    );


/***********************************************************
  Function: R_WM_Cap_CapBufGet

  Description:
  To be used for Interrupt-based Video Output Syncronisation by the WM SYS layer.
  Grabs an empty writeable buffer to be assigned for video input capturing.

  Parameter:
  Unit    - See description of <R_WM_DevInit>
  Window  - This is a pointer to the parent window handling the capturing.

  Returns:
  0   - if Buffer States do not match
  Buf - if Buffer State change successful
*/
r_wm_WinBuffer_t *R_WM_Cap_CapBufGet( uint32_t Unit, r_wm_Window_t* Window );


/***********************************************************
  Function: R_WM_Cap_DispBufGet

  Description:
  To be used for Interrupt-based Video Output Syncronisation by the WM SYS layer.
  Grabs a captured buffer to be assigned for video output display.

  Parameter:
  Unit    - See description of <R_WM_DevInit>
  Window  - This is a pointer to the parent window handling the capturing.

  Returns:
  0   - if Buffer States do not match
  Buf - if Buffer State change successful
*/
r_wm_WinBuffer_t *R_WM_Cap_DispBufGet( uint32_t Unit, r_wm_Window_t*  Window );



/***********************************************************
  Group: Sprites
*/

/***********************************************************
  Function: R_WM_SpriteCreate

  Description:
  Create a sprite as specified in the Sprite parameter on window Window of screen Unit.
  The sprite will not be visible until it is enabled.

  Parameter:
  Unit      -   See description of <R_WM_DevInit>
  Sprite    -   <R_WM_Sprite_t> structure pointer
                The structure has to be filled by the application before calling the function.

  Return value:
  See R_WM_Error_t.
*/
r_wm_Error_t R_WM_SpriteCreate(uint32_t Unit, r_wm_Sprite_t *Sprite);

/***********************************************************
  Function: R_WM_SpriteEnable
2305

hu's avatar
hu committed
2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319
  Description:
  Enable the specified sprite. The sprite becomes visible on the screen.

  Parameter:
  Unit      -   See description of <R_WM_DevInit>
  Sprite    -   <R_WM_Sprite_t> structure pointer

  Return value:
  See R_WM_Error_t.
*/
r_wm_Error_t R_WM_SpriteEnable(uint32_t Unit, r_wm_Sprite_t *Sprite);

/***********************************************************
  Function: R_WM_SpriteDisable
2320

hu's avatar
hu committed
2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335
  Description:
  Disable the specified sprite. The sprite becomes not visible on the screen.

  Parameter:
  Unit      -   See description of <R_WM_DevInit>
  Sprite    -   <R_WM_Sprite_t> structure pointer

  Return value:
  See R_WM_Error_t.
*/

r_wm_Error_t R_WM_SpriteDisable(uint32_t Unit, r_wm_Sprite_t *Sprite);

/***********************************************************
  Function: R_WM_SpriteMove
2336

hu's avatar
hu committed
2337 2338 2339 2340 2341 2342 2343
  Description:
  Move the sprite to the specified X/Y and Z-order location.

  Parameter:
  Unit              -   See description of <R_WM_DevInit>
  Sprite            -   <R_WM_Sprite_t> structure pointer
  PosX/PosY/PosZ    -   New sprite position
2344

hu's avatar
hu committed
2345 2346
  Return value:
  See R_WM_Error_t.
2347

hu's avatar
hu committed
2348
  Remarks:
2349

hu's avatar
hu committed
2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363
  The PosZ specifies the relative position of the sprite in the sprites Z-order.
  Changing the PosZ of one sprite can yield VOUT HW registers writes for all the sprites
  defined within a window.
*/

r_wm_Error_t R_WM_SpriteMove    (   uint32_t            Unit,
                                    r_wm_Sprite_t       *Sprite,
                                    uint32_t            PosX,
                                    uint32_t            PosY,
                                    uint32_t            PosZ
                                );

/***********************************************************
  Function: R_WM_SpriteBufSet
2364

hu's avatar
hu committed
2365 2366 2367 2368 2369 2370 2371 2372
  Description:
    Set the sprite buffer. This way the buffer initially
    set upon completion of the <R_WM_SpriteCreate> can be changed.

  Parameter:
    Unit              -   See description of <R_WM_DevInit>
    Sprite            -   <R_WM_Sprite_t> structure pointer
    Buffer            -   New sprite buffer
2373

hu's avatar
hu committed
2374 2375 2376 2377 2378 2379 2380 2381
  Return value:
    See R_WM_Error_t.
*/

r_wm_Error_t R_WM_SpriteBufSet(uint32_t Unit, r_wm_Sprite_t *Sprite, void *Buffer);

/***********************************************************
  Function: R_WM_SpriteDelete
2382

hu's avatar
hu committed
2383 2384
  Description:
  Remove the sprite from the host window.
2385

hu's avatar
hu committed
2386 2387 2388
  Parameter:
  Unit              -   See description of <R_WM_DevInit>
  Sprite            -   <R_WM_Sprite_t> structure pointer
2389

hu's avatar
hu committed
2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410
  Return value:
  See R_WM_Error_t.
*/

r_wm_Error_t R_WM_SpriteDelete(uint32_t Unit, r_wm_Sprite_t *Sprite);

/***********************************************************
  Group: General
*/

/***********************************************************
  Function: R_WM_ErrorCallbackSet

  Description:
  Set the error callback function.

  Parameter:
  Unit    - See description of <R_WM_DevInit>
  ErrorCb - Error callback function

  Return value:
2411
  See <r_wm_Error_t>.
hu's avatar
hu committed
2412 2413 2414
*/
r_wm_Error_t R_WM_ErrorCallbackSet  (   uint32_t Unit,
                                        void (*ErrorCb) (   uint32_t Unit,
2415
                                                r_wm_Error_t Error
hu's avatar
hu committed
2416 2417 2418 2419 2420 2421 2422 2423
                                                        )
                                    );


/***********************************************************
  Function: R_WM_ErrorHandler

  Description:
2424 2425 2426 2427
  The function is the driver's central error handler.
  If the application has set an error handler call-back function,
  the central error handler shall call it and then return to its caller.
  The central error handler shall return in case no
hu's avatar
hu committed
2428
  error handler call-back function has been set.
2429

hu's avatar
hu committed
2430 2431 2432 2433 2434 2435 2436
  Unit   -   See description of <R_WM_DevInit>
  Error  -   See <r_wm_Error_t>.

  Return value:
  No return value.

*/
2437
void R_WM_ErrorHandler  (   uint32_t      Unit,
hu's avatar
hu committed
2438 2439 2440 2441 2442 2443 2444 2445 2446 2447
                            r_wm_Error_t  Error
                        );



/***********************************************************
  Function: R_WM_ColorModeBitsPerPixGet

  Description:
  Return the bits per pixel count for the specified format.
2448

hu's avatar
hu committed
2449 2450
  Parameter:
  Format    -   Color format
2451

hu's avatar
hu committed
2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462
  Return value:
  Bits per pixel count of the specified format.
*/
uint8_t R_WM_ColorFmtBitsPerPixGet(r_wm_WinColorFmt_t Format);

#ifdef __cplusplus
}
#endif


#endif /* R_WM_API_H__ */