leomode_sel.c 2.67 KB
/*
 *  F i l e N a m e : l e o m o d e _ s e l .c
 *
 ****************************************************************************
 *                   (C) Copyright ALPS Electric Co., Ltd. 1995-1996
 ****************************************************************************
 *  Version:
 *
 *  ver       date
 *  ----    ---------
 *  1.01    '96-12-27  Rename mode_sel.c to leomode_sel.c
 *  1.00    '95-12-20  Initial Revision.
 ****************************************************************************
 */
#include <ultra64.h>
#include "leodefine.h"
#include "leodrive.h"
#include "leomacro.h"
#include "leoappli.h"

/*************************************/
/* PROTOTYPE                         */
/*************************************/
void leoMode_sel(void);

/*************************************/
/* EXTERNALY DEFINED FUNCTION        */
/*************************************/
extern u8 leoSend_asic_cmd_w_nochkDiskChange(u32 asic_cmd, u32 asic_data);

/*************************************/
/* EXTERNAL RAM                      */
/*************************************/
extern OSMesg      LEOcur_command;

/*************************************/
/*  MACROS                           */
/*************************************/
#define msel_cmd    ((LEOCmdModeSelect *)LEOcur_command)

/* ==========================================================================
* Function : leoMode_sel
* --------------------------------------------------------------------------
* Description : Set parameters to drive
* --------------------------------------------------------------------------
* 入力変数      : 無し
* 出力変数      : 無し
* 引数          : 無し
* 戻り値        : 無し
* ==========================================================================
*/
void leoMode_sel(void)
{
    u32 sense;

    /* Set stand-by timer */
    if (sense = leoSend_asic_cmd_w_nochkDiskChange(ASIC_SET_STBY, ((u32)msel_cmd->standby_time << 16)) )
    {
        goto mselerror;
    }

    /* Set sleep timer */
    if (sense = leoSend_asic_cmd_w_nochkDiskChange(ASIC_SET_SLEEP, ((u32)msel_cmd->sleep_time << 16)) )
    {
        goto mselerror;
    }

    /* Set LED on/off timer */
    if (sense = leoSend_asic_cmd_w_nochkDiskChange(ASIC_LED_BLINK_RATE, *(u32 *)&msel_cmd->led_on_time ) )
    {
mselerror:
        msel_cmd->header.sense = sense;
        msel_cmd->header.status = LEO_STATUS_CHECK_CONDITION;
        return;
    }
#ifdef _ERRCHK
    if (msel_cmd->header.sense = msel_cmd->header.reserve1 )
       msel_cmd->header.status = LEO_STATUS_CHECK_CONDITION;
    else
       msel_cmd->header.status = LEO_STATUS_GOOD;
#else
    msel_cmd->header.sense = sense;
    msel_cmd->header.status = LEO_STATUS_GOOD;
#endif
    return;
}