leord_capa.c 2.45 KB
/*
 *  F i l e N a m e : l e o r d _ c a p a .c
 *
 ****************************************************************************
 *                   (C) Copyright ALPS Electric Co., Ltd. 1995-1996
 ****************************************************************************
 *  Version:
 *
 *  ver       date
 *  ----    ---------
 *  1.02    '96-04-05  Change capacity TBL.
 *  1.01    '96-02-27  Rename file name rd_capa.c to leord_capa.c
 *  1.00    '95-12-20  Initial Revision.
 ****************************************************************************
 */
#include <ultra64.h>
#include "leodefine.h"
#include "leodrive.h"
#include "leoappli.h"

/*************************************/
/*  PROTOTYPE                        */
/*************************************/
void leoRd_capacity(void);

/*************************************/
/* EXTERNAL FUNCTION                 */
/*************************************/
extern u16    LEORAM_START_LBA[DISK_TYPES];
extern u32    LEORAM_BYTE[DISK_TYPES];
extern OSMesg LEOcur_command;
extern u8     LEOdisk_type;

/*************************************/
/* MACRO                             */
/*************************************/
#define rd_capa_cmd     ((LEOCmdReadCapacity *)LEOcur_command)

/* ==========================================================================
* FUNCTION : leoRd_capacity
* --------------------------------------------------------------------------
* DESCRIPTION : RETURN READ/WRITE CAPACITY
* --------------------------------------------------------------------------
* IN    : LEOdisk_type , LEOcur_command
* OUT   : *LEOcur_command
* ARG   : NON
* RET   : NON
* ==========================================================================
*/
void leoRd_capacity(void)
{
    if (rd_capa_cmd->header.control & LEO_CONTROL_WRT)
    {
        /* WRITE CAPACITY */
        rd_capa_cmd->start_lba = (u32)LEORAM_START_LBA[LEOdisk_type] - SYSTEM_LBAS;
        rd_capa_cmd->end_lba   = MAX_L_LBA;
        rd_capa_cmd->capa_bytes = LEORAM_BYTE[LEOdisk_type];
    }
    else
    {
        /* READ CAPACITY */
        rd_capa_cmd->start_lba  = (u32)0x00;
        rd_capa_cmd->end_lba    = MAX_L_LBA;
        rd_capa_cmd->capa_bytes = RD_BYTES_PER_DRV;
    }
#ifdef _ERRCHK
    if (rd_capa_cmd->header.sense = rd_capa_cmd->header.reserve1 )
        rd_capa_cmd->header.status = LEO_STATUS_CHECK_CONDITION;
    else
        rd_capa_cmd->header.status = LEO_STATUS_GOOD;
#else
    rd_capa_cmd->header.status     = LEO_STATUS_GOOD;
#endif
}