Difference Analysis Generated by HtmlDiff on 10/26/2004 1:34 PM  

Base file: C:\CY4632_RDK_1_21\Firmware\Source Code\RDK Keyboard\keyboard.h

Modified file: C:\CY4632_RDK_1_3\Firmware\Source Code\RDK Keyboard\keyboard.h

//--------------------------------------------------------------------------
//
// Keyboard Header file
//
//--------------------------------------------------------------------------
// $Archive: /WirelessUSB/WUSB Kits/CY4632 LS KBM RDK/DocSrc/CD_Root/Firmware/Source Code/RDK Keyboard/keyboard.h $
// $Modtime: 6/11/04 5:27p9/29/04 3:20p $
// $Revision: 78 $
//--------------------------------------------------------------------------
//
// Copyright 2003-2004, Cypress Semiconductor Corporation.
//
// This software is owned by Cypress Semiconductor Corporation (Cypress)
// and is protected by and subject to worldwide patent protection (United
// States and foreign), United States copyright laws and international 
// treaty provisions. Cypress hereby grants to licensee a personal, 
// non-exclusive, non-transferable license to copy, use, modify, create 
// derivative works of, and compile the Cypress Source Code and derivative 
// works for the sole purpose of creating custom software in support of 
// licensee product to be used only in conjunction with a Cypress integrated 
// circuit as specified in the applicable agreement. Any reproduction, 
// modification, translation, compilation, or representation of this 
// software except as specified above is prohibited without the express 
// written permission of Cypress.
//
// Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, 
// WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// Cypress reserves the right to make changes without further notice to the
// materials described herein. Cypress does not assume any liability arising
// out of the application or use of any product or circuit described herein.
// Cypress does not authorize its products for use as critical components in
// life-support systems where a malfunction or failure may reasonably be
// expected to result in significant injury to the user. The inclusion of
// Cypress’ product in a life-support systems application implies that the
// manufacturer assumes all risk of such use and in doing so indemnifies
// Cypress against all charges.
//
// Use may be limited by and subject to the applicable Cypress software
// license agreement.
//
//--------------------------------------------------------------------------

#ifndef _KEYBOARD_H_
#define _KEYBOARD_H_

#define COLUMNS                         18
#define ROWS                            8


#define KEYBOARD_REPORT_NUM_KEYCODES    5

#ifdef ENCRYPT_DATA    
#define DEBOUNCE_QUEUE_LENGTH           5
#define KEY_QUEUE_LEN                   1412
#else
#define DEBOUNCE_QUEUE_LENGTH           5
#define KEY_QUEUE_LEN                   2220
#endif // ENCRYPT_DATA

// For Debounce
#define INVALID_INDEX                   0xFF

#define KEYBOARD_HOT_REPORT_TYPE        0xFF
#define KEYBOARD_PWR_REPORT_TYPE        0xFE
#define KEYBOARD_BATT_REPORT_TYPE       0xFD
#define KEYBOARD_ALIVE_REPORT_TYPE      0xFC

#define KEYBOARD_REPORT_NUM_HOTCODES    0x1
#define KEYBOARD_REPORT_NUM_PWRCODES    0x1

// Standard 101 Keys Report
typedef struct _KEYBOARD_SCAN_REPORT
{
    UINT8                   modifier_keys;
    UINT8                   keycode[KEYBOARD_REPORT_NUM_KEYCODES];
} KEYBOARD_SCAN_REPORT;

// Hot Keys Report
typedef struct _KEYBOARD_HOT_REPORT
{
    UINT8                   report_type;
    UINT16                  hotcode[KEYBOARD_REPORT_NUM_HOTCODES];
} KEYBOARD_HOT_REPORT;

typedef struct _KEYBOARD_PWR_REPORT
{
    UINT8                   report_type;
    UINT8                   pwrcode[KEYBOARD_REPORT_NUM_PWRCODES];
} KEYBOARD_PWR_REPORT;

typedef struct _KEYBOARD_BATT_REPORT
{
    UINT8                   report_type;
    UINT8                   battery_voltage_level;
} KEYBOARD_BATT_REPORT;

#ifdef ENCRYPT_DATA    
typedef struct _KEYBOARD_ENCR_REPORT
    {
        UINT8 encr_data[0x8];
    } KEYBOARD_ENCR_REPORT;
#endif // ENCRYPT_DATA

#ifdef MOUSE_EMULATION_MODE
typedef struct _KEYBOARD_MOUSE_REPORT
{
    INT8                    x;
    INT8                    y;
    UINT8                   combi;
} KEYBOARD_MOUSE_REPORT;
#endif //MOUSE_EMULATION_MODE

typedef union _APP_TX_PACKET
{
    KEYBOARD_SCAN_REPORT    scan_report;

#ifdef KEYBOARD_MULTIMEDIA_SUPPORT
    KEYBOARD_HOT_REPORT     hot_report;
    KEYBOARD_PWR_REPORT     pwr_report;
#endif //KEYBOARD_MULTIMEDIA_SUPPORT

#ifdef KEYBOARD_BATTERY_VOLTAGE_SUPPORT
    KEYBOARD_BATT_REPORT    batt_report;
#endif // KEYBOARD_BATTERY_VOLTAGE_SUPPORT

#ifdef ENCRYPT_DATA
    KEYBOARD_ENCR_REPORT    encr_report;    
#endif // ENCRYPT_DATA

#ifdef MOUSE_EMULATION_MODE
    KEYBOARD_MOUSE_REPORT   mouse_report;
#endif // MOUSE_EMULATION_MODE

} APP_TX_PACKET;

typedef enum _KEY_STATE
{
    KEY_STATE_UP        = 0x1,
    KEY_STATE_DOWN      = 0x2,
    KEY_STATE_REMOVE    = 0x4,
    KEY_STATE_MOD_UP    = 0x8
} KEY_STATE;

typedef enum _STATUS_STATE
{
    KEY_DOWN            = 0x1,
    GENERATE_STD_REPORT = 0x2,
    GENERATE_HOT_REPORT = 0x4,
    GENERATE_PWR_REPORT = 0x8,
    KEYBOARD_SLEEP      = 0x10,
    BIND_BUTTON         = 0x20,
    BATT_REPORT_REQ     = 0x40,
    SKIP_TEST_MODE      = 0x80
} STATUS_STATE;

typedef struct _KEY
{
    KEY_STATE               state;
    UINT8                   index;
} KEY;

typedef struct _DEBOUNCE_ENTRY
{
    UINT8                   value;
    UINT8                   index;
} DEBOUNCE_ENTRY;


typedef struct _HID_APP
{
        KEY                 key_queue[KEY_QUEUE_LEN];
        STATUS_STATE        status;
        DEBOUNCE_ENTRY      debounce[DEBOUNCE_QUEUE_LENGTH];
        UINT8               prior_key_state[COLUMNS];
} HID_APP;

// Prototypes
void scan_keyboard(void);
void age_debounce_queue(void);

#pragma interrupt_handler bind_button_isr
#pragma interrupt_handler keyboard_isr

extern void bind_button_isr(void);
extern void keyboard_isr(void);

extern HID_APP hid;
extern TIME_STAMP last_transfer_ts;

#endif