iplleoread.c
3.68 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* F i l e N a m e : i p l l e o r e a d . c
*
****************************************************************************
* (C) Copyright ALPS Electric Co., Ltd. 1995-1996
****************************************************************************
* Version
*
* ver Date
* ---- --------
* 1.06 '96-07-25 Move track/retry operation to iplleoint.c .Add c2-control message.
* 1.05 '96-05-22 Debug set sensecode in leoChk_disk_err() .
* 1.04 '96-05-08 Change SC_NO_REFERENCE_POSITION retry .
* 1.03 '96-04-11 Move retry judgment location .
* 1.02 '96-02-27 Rename iplread.c to iplleoread.c .
* 1.01 '96-02-03 Debug.
* 1.00 '95-12-20 Initial revision .
****************************************************************************
*/
#include <ultra64.h>
#include "leodefine.h"
#include "leodrive.h"
#include "iplleomacro.h"
#include "leoappli.h"
/**************************************/
/* PROTOTYPE DEFINITIONS */
/**************************************/
void leoiplRead_zone0(void);
/**************************************/
/* EXTERNALY DEFINED FUNCTIONS */
/**************************************/
extern u16 leoiplLba_to_phys(u32 lba);
extern void leoiplSet_mseq(void);
extern int leoiplC2_Correction(void);
/**************************************/
/* RAM LOCATIONS */
/**************************************/
/**************************************/
/* EXTERNALY DEFINED RAM LOCATIONS */
/**************************************/
extern OSThread LeoIPLinterruptThread;
extern OSMesg LeoIPLcur_command;
extern OSMesgQueue LeoIPLcontrol_que;
extern OSMesgQueue LeoIPLc2ctrl_que;
extern struct block_param_form LeoIPLc2_param;
extern struct tgt_param_form LeoIPLtgt_param;
extern volatile u16 LeoIPLrw_flags;
/*************************************/
/* MACRO DEFINITIONS */
/*************************************/
#define read_command ((LEOCmdRead *)LeoIPLcur_command)
/**********************************************************
* Function : leoiplRead_common
* ---------------------------------------------------------
* Description : read for zone-0 only
* IN : LeoIPLcur_command .. command description block pointer
* OUT : *LeoIPLcur_command
* : non
**********************************************************/
void leoiplRead_zone0(void)
{
u32 tg_lba;
u32 tg_blocks;
u32 message;
tg_lba = read_command->lba;
tg_blocks = read_command->xfer_blks;
LeoIPLtgt_param.lba = tg_lba;
LeoIPLrw_flags &= ~(LOCK_C2_PARAM+WRITE_MODE); /* clear C2 flag */
osSendMesg(IPLC2_CTRL_QUE, MES_NONE, OS_MESG_NOBLOCK);
osStartThread(&LeoIPLinterruptThread);
for (;;) /* track read loop */
{
/* wait block read done */
(void)osRecvMesg(IPLCONTROL_QUE, (OSMesg*)&message, OS_MESG_BLOCK);
switch (message)
{
case (u32)MES_RW_COMPLETE:
goto read_complete;
case (u32)MES_REQ_C2_CORR:
leoiplC2_Correction();
LeoIPLrw_flags &= ~LOCK_C2_PARAM; /* clear flags to indicate new c2_param acceptable */
osSendMesg(IPLC2_CTRL_QUE, MES_NONE, OS_MESG_NOBLOCK);
continue;
default:
/* error */
read_command->header.sense = message;
read_command->header.status = LEO_STATUS_CHECK_CONDITION;
return; /* stop command */
}
}
/*
* all block read complete
*/
read_complete:
read_command->header.sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION;
read_command->header.status = LEO_STATUS_GOOD;
}