leoinquiry.c 2.51 KB
/*
 *  F i l e N a m e : l e o i n q u i r y .c
 *
 ****************************************************************************
 *                   (C) Copyright ALPS Electric Co., Ltd. 1995-1996
 ****************************************************************************
 *  Version:
 *
 *  ver       date
 *  ----    ---------
 *  1.02    '97-11-18  Add MECHA-CON version to VERSION byte(b7-b4).
 *  1.01    '96-02-27  Rename inquiry.c to leoinquiry.c .
 *  1.00    '95-12-17  Initial Revision.
 ****************************************************************************
 */
#include "os.h"

#include <ultra64.h>
#include "leodefine.h"
#include "leodrive.h"
#include "leomacro.h"
#include "leoappli.h"

/*************************************/
/* PROTOTYPE DEFINITONS              */
/*************************************/
void leoInquiry(void);

/*************************************/
/* EXTERNAL FUNCTIONS                */
/*************************************/
extern OSMesg LEOcur_command;

extern OSPiHandle *LEOPiInfo;

/*************************************/
/* LOCAL DEFINETION                  */
/*************************************/
#define inq_cmd     ((LEOCmdInquiry *)LEOcur_command)

#define DEVICE_TYPE                 0x00    /* DF3A9U011A        */
#define DEVICE_NUMBER               0x01    /* NUMBER OF DEVICE */

/* ==========================================================================
* 関数名 : leoInquiry
* --------------------------------------------------------------------------
* 機能 : INQUIRY COMMNAD
* --------------------------------------------------------------------------
* 入力変数      : 無し
* 出力変数      : 無し
* 引数          : 無し
* 戻り値        : 無し
* ==========================================================================
*/
void leoInquiry(void)
{
    u32    asic_id;
    u32    asic_data;

    leoGet_leo_asic_id(&asic_id);
    if (leoSend_asic_cmd_w(ASIC_RD_PROGRAM_VERSION, 0) == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION)
    {
        leoGet_leo_asic_data(&asic_data);
        if (asic_data & 0x00010000)
            asic_id |= 0x00100000;
    }

    inq_cmd->dev_type     = DEVICE_TYPE;
    inq_cmd->version      = (u8)(asic_id >> 16 );
    inq_cmd->dev_num      = DEVICE_NUMBER;
    inq_cmd->leo_bios_ver = (u8)0;

#ifdef _ERRCHK
    if (inq_cmd->header.sense = inq_cmd->header.reserve1 )
        inq_cmd->header.status = LEO_STATUS_CHECK_CONDITION;
    else
        inq_cmd->header.status = LEO_STATUS_GOOD;
#else
    /* ALWAYS GOOD */
    inq_cmd->header.status = LEO_STATUS_GOOD;
#endif
}