leord_capa.c
2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* 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
}