/*****************************************************************************\
 *
 *  Filename:           HADSHR.h
 *
 *  Description:        This header is shared by both the HAD caller, HAD
 *                      user-mode driver and HAD kernel mode driver.  It
 *                      defines common structures and defines that will
 *                      be needed by all 3 layers.
 *
 *                        
 *  Original author:    Alice Kao
 *  CE port:			Arnaud Glatron
 *
 *  Copyright (c) Winnov L.P., 1996
 *  All Rights Reserved.
 *
 *
\*****************************************************************************/

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

#ifndef HADSHR_H
#define HADSHR_H

/*****************************************************************************/
/* PUBLIC DEFINES and ENUMERATIONS */

// These values are returned in the actual bytes read parameter in READ_VIDEO
#define HADSHR_ERR_DATA_OVERFLOW        0
#define HADSHR_ERR_NOT_USED             -1
#define HADSHR_ERR_DATA_CORRUPTION      -2

typedef enum HADSHR_I2C_CMD_TYPE 
{
    HADSHR_I2C_START = 0,
    HADSHR_I2C_END,
    HADSHR_I2C_IN8,
    HADSHR_I2C_OUT8,
    HADSHR_I2C_GET_ACK,
    HADSHR_I2C_SEND_ACK,
    HADSHR_I2C_SEND_NAK
} HADSHR_I2C_CMD_TYPE;

typedef enum HADSHR_PWR_MGT_CMD_TYPE
{
    HADSHR_PWR_TURN_ON,
    HADSHR_PWR_TURN_OFF,
    HADSHR_PWR_ENABLE_VIDEO_MODULE,
    HADSHR_PWR_DISABLE_VIDEO_MODULE,
    HADSHR_PWR_ENABLE_AUDIO_MODULE,
    HADSHR_PWR_DISABLE_AUDIO_MODULE
} HADSHR_PWR_MGT_CMD_TYPE;

typedef enum HADSHR_ERR_CMD_TYPE
{
    HADSHR_ERR_GET_MPLUG_STATUS,
    HADSHR_ERR_RESET_MPLUG_STATUS
} HADSHR_ERR_CMD_TYPE;

//
// This enumeration defines a set of commands that's
// allowed to be use in a queued buffer to submit a set of
// commands to the hardware access driver.
//

typedef enum HADSHR_PORT_TYPE
{
    HADSHR_PHYSICAL_PORT,
    HADSHR_LOGICAL_PORT
} HADSHR_PORT_TYPE;

typedef enum HADSHR_ATOMIC_CMDS_TYPE
{
    HADSHR_READ_PORT_BYTES,
    HADSHR_READ_PORT_WORDS,
    HADSHR_READ_PORT_DWORDS,
    HADSHR_WRITE_PORT_BYTES,
    HADSHR_WRITE_PORT_WORDS,
    HADSHR_WRITE_PORT_DWORDS,
    HADSHR_READ_AND_OR_WRITE_WORD

} HADSHR_ATOMIC_CMDS_TYPE;


// query commands

typedef enum HADSHR_QUERY_CMD_TYPE
{
    HADSHR_GET_AVAILABLE_PORT_BASE,
    HADSHR_GET_FIRST_AVAIL_MEMORY

} HADSHR_QUERY_CMD_TYPE;

/*****************************************************************************/
/* PUBLIC STRUCTURES and TYPES */


typedef struct HADSHR_IO_PORT_HDR_TYPE       // For IO port commands
{
    HADSHR_ATOMIC_CMDS_TYPE     cmd;
    HADSHR_PORT_TYPE            portType;
    DWORD                       dwBoardNum;
    DWORD                       dwPortNum;
    DWORD                       dwDataLength;
} HADSHR_IO_PORT_HDR_TYPE;

//
// Each commands in the command queue must adhere to
// this type structure.  pBuffer points to a buffer with
// the data to write to or points to a buffer to 
// receive data
//

typedef struct HADSHR_CMD_QUE_TYPE
{
    struct HADSHR_IO_PORT_HDR_TYPE  portInfo;
    PVOID                           pBuffer;
} HADSHR_CMD_QUE_TYPE;


// Media-plug error status return structure

typedef struct HADSHR_MPLUG_ERR_STATUS_TYPE
{
    DWORD       dwStrRWordErrCnt;
    DWORD       dwStrWWordErrCnt;
    DWORD       dwStrRDWordErrCnt;
    DWORD       dwStrWDWordErrCnt;
    DWORD       dwMMAReadErrCnt;
    DWORD       dwCableNotConnectCnt;
    DWORD       dwDirtyBitSetCnt;
    DWORD       dwTimeoutBitSetCnt;
    WORD        wCurrLCMD;
} HADSHR_MPLUG_ERR_STATUS_TYPE;


#endif // HADSHR.h

#ifdef __cplusplus
}
#endif

