/*
 * Copyright (c) 2011-2012 Wind River Systems, Inc. 
 *
 * The right to copy, distribute, modify or otherwise make use
 * of this software may be licensed only pursuant to the terms
 * of an applicable Wind River license agreement. 
 */

/* 
DESCRIPTION
   
This file provides VxWorks graphics adaptation functions.
*/

#ifndef QVXWORKSDISPLAY_H
#define QVXWORKSDISPLAY_H

#if defined(VXWORKS_DISPLAY)

#ifdef __cplusplus
extern "C"
{
#endif

#define VX_CM_ARGB      0x01000000
#define VX_ARGB8888     (VX_CM_ARGB | 0x00048888)
#define VX_RGB565       (VX_CM_ARGB | 0x00020565)

extern int vxDisplayOpen(int displayId);
extern void vxDisplayGet(
            int *width,
            int *height,
            int *bpp,
            int *format,
            unsigned char **data,
            int *stride);
extern void vxDisplayClose (void);
extern void vxDisplayBlit(int left, int top, int right, int bottom);

#define VX_PTR_BUTTON1         0x00000001
#define VX_PTR_BUTTON2         0x00000002
#define VX_PTR_BUTTON3         0x00000004

#define VX_CURSOR_ARROW        0
#define VX_CURSOR_EDIT         1
#define VX_CURSOR_WAIT         2
#define VX_CURSOR_INVALID      3
#define VX_CURSOR_MOVE         4
#define VX_CURSOR_SIZE_HORIZ   5
#define VX_CURSOR_SIZE_VERT    6
#define VX_CURSOR_SIZE_TL_BR   7
#define VX_CURSOR_SIZE_TR_BL   8
#define VX_CURSOR_UP           9
#define VX_CURSOR_CROSS       10
#define VX_CURSOR_BLANK       11
#define VX_NUM_CURSORS        11

extern int vxPtrOpen(const char *ptr);
extern void vxPtrClose(const char *ptr);
extern int vxPtrRead(int *x, int *y, int *button);
extern int vxPtrHideStart(void);
extern void vxPtrHideClip(int left, int top, int right, int bottom);
extern void vxPtrHideEnd(void);
extern void vxPtrShow(void);
extern void vxPtrChange(int cursor);

#define KEY_UNKNOWN        0
#define KEY_SHIFT_DOWN     1
#define KEY_CTRL_DOWN      2
#define KEY_ALT_DOWN       4
#define KEY_NUM_DOWN       8

#define VX_KEY_BASE_START  0x8000
#define VX_KEY_BASE_END    0xEF00
#define VX_KEY_BACKSPACE   (VX_KEY_BASE_START | 0X08) /* BACKSPACE key */
#define VX_KEY_TAB         (VX_KEY_BASE_START | 0X09) /* TAB key */
#define VX_KEY_ENTER       (VX_KEY_BASE_START | 0X0D) /* ENTER key */
#define VX_KEY_CAPS        (VX_KEY_BASE_START | 0X14) /* CAPS LOCK KEY */
#define VX_KEY_ESC         (VX_KEY_BASE_START | 0X1B) /* ESC key */
#define VX_KEY_SPACE       (VX_KEY_BASE_START | 0X20) /* SPACEBAR */
#define VX_KEY_PGUP        (VX_KEY_BASE_START | 0X21) /* PAGE UP key */
#define VX_KEY_PGDN        (VX_KEY_BASE_START | 0X22) /* PAGE DOWN key */
#define VX_KEY_END         (VX_KEY_BASE_START | 0X23) /* END key */
#define VX_KEY_HOME        (VX_KEY_BASE_START | 0X24) /* HOME key */
#define VX_KEY_LEFTARROW   (VX_KEY_BASE_START | 0X25) /* LEFT ARROW key */
#define VX_KEY_UPARROW     (VX_KEY_BASE_START | 0X26) /* UP ARROW key */
#define VX_KEY_RIGHTARROW  (VX_KEY_BASE_START | 0X27) /* RIGHT ARROW key */
#define VX_KEY_DOWNARROW   (VX_KEY_BASE_START | 0X28) /* DOWN ARROW key */
#define VX_KEY_PRINTSCREEN (VX_KEY_BASE_START | 0X29)
#define VX_KEY_PAUSE       (VX_KEY_BASE_START | 0X2a)
#define VX_KEY_NUMLOCK     (VX_KEY_BASE_START | 0X2b)
#define VX_KEY_SCROLLLOCK  (VX_KEY_BASE_START | 0X2c)
#define VX_KEY_INS         (VX_KEY_BASE_START | 0X2d)
#define VX_KEY_DEL         (VX_KEY_BASE_START | 0X2e)
#define VX_KEY_LEFTSHIFT   (VX_KEY_BASE_START | 0X30)
#define VX_KEY_RIGHTSHIFT  (VX_KEY_BASE_START | 0X31)
#define VX_KEY_LEFTCTRL    (VX_KEY_BASE_START | 0X32)
#define VX_KEY_RIGHTCTRL   (VX_KEY_BASE_START | 0X33)
#define VX_KEY_LEFTALT     (VX_KEY_BASE_START | 0X34)
#define VX_KEY_RIGHTALT    (VX_KEY_BASE_START | 0X35)
#define VX_KEY_PROGRAM     (VX_KEY_BASE_START | 0X36)
#define VX_KEY_BACKTAB     (VX_KEY_BASE_START | 0X37)
#define VX_KEY_CENTER      (VX_KEY_BASE_START | 0XB0)
#define VX_KEY_GRAYPLUS    (VX_KEY_BASE_START | 0XB1)
#define VX_KEY_GRAYMINUS   (VX_KEY_BASE_START | 0XB2)
#define VX_KEY_GRAYENTER   (VX_KEY_BASE_START | 0XB3)
#define VX_KEY_GRAYASTRIX  (VX_KEY_BASE_START | 0XB4)
#define VX_KEY_GRAYSLASH   (VX_KEY_BASE_START | 0XB5)
#define VX_KEY_F1          (VX_KEY_BASE_START | 0XC1)
#define VX_KEY_F2          (VX_KEY_BASE_START | 0XC2)
#define VX_KEY_F3          (VX_KEY_BASE_START | 0XC3)
#define VX_KEY_F4          (VX_KEY_BASE_START | 0XC4)
#define VX_KEY_F5          (VX_KEY_BASE_START | 0XC5)
#define VX_KEY_F6          (VX_KEY_BASE_START | 0XC6)
#define VX_KEY_F7          (VX_KEY_BASE_START | 0XC7)
#define VX_KEY_F8          (VX_KEY_BASE_START | 0XC8)
#define VX_KEY_F9          (VX_KEY_BASE_START | 0XC9)
#define VX_KEY_F10         (VX_KEY_BASE_START | 0XCA)
#define VX_KEY_F11         (VX_KEY_BASE_START | 0XCB)
#define VX_KEY_F12         (VX_KEY_BASE_START | 0XCC)

extern int vxKbdOpen(const char *kbd);
extern void vxKbdClose(const char *kbd);
extern int vxKbdReadMsgQ(int *keyState, int *keyCode);
extern int vxKbdRead(int *retKeyState, int *retKey, int *retKeyCode);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* VXWORKS_DISPLAY */

#endif /* QVXWORKSDISPLAY_H */

