leoreset.c
3.4 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
/*
* F i l e N a m e : l e o r e s e t . c
*
****************************************************************************
* (C) Copyright ALPS Electric Co., Ltd. 1995-1996
****************************************************************************
* Version
*
* ver date
* ---- --------
* 1.05 '97-02-20 Add leoClr_reset();
* 1.04 '96-11-05 Add post que handling in leoClr_queue().
* 1.03 '96-09-18 Delete leoInit_thread(void);
* 1.02 '96-09-17 Change leoReset() is dummy function .
* 1.01 '96-02-27 Rename file name reset.c to leoreset.c .
* 1.00 '95-12-20 Initial Revision.
****************************************************************************
*/
#include "os.h"
#include <ultra64.h>
#include "leodefine.h"
#include "leoappli.h"
/******************************/
/* PROTOTYPE */
/******************************/
void leoClr_queue(void);
void leoClr_reset(void);
/*************************************/
/* EXTERNALY DEFINED FUNCTIONS */
/*************************************/
extern void leoClrUA_RESET(void);
extern u32 leoRetUnit_atten(void);
extern u8 leoAnalize_asic_status(void);
/*************************************/
/* EXTERNAL RAMS */
/*************************************/
extern OSMesgQueue LEOcommand_que;
extern OSMesg LEOcur_command;
/* =========================================================================
* Function : leoClear_queue
* --------------------------------------------------------------------------
* Description : CLEAR COMMAND QUE
* --------------------------------------------------------------------------
* IN : qued command
* OUT : qued command
* ARG : non
* RET : non
* ==========================================================================
*/
void leoClr_queue(void)
{
OSMesg clr_cmd;
while (!osRecvMesg(COMMAND_QUE, &clr_cmd, OS_MESG_NOBLOCK))
{
((LEOCmdHeader *)clr_cmd)->sense = LEO_SENSE_COMMAND_TERMINATED;
((LEOCmdHeader *)clr_cmd)->status = LEO_STATUS_CHECK_CONDITION;
if (((LEOCmdHeader *)clr_cmd)->control & LEO_CONTROL_POST)
{
/* send post message */
osSendMesg(((LEOCmdHeader *)clr_cmd)->post,
(OSMesg)LEO_SENSE_COMMAND_TERMINATED, OS_MESG_BLOCK);
}
}
}
/* =========================================================================
* Function : leoClear_reset
* --------------------------------------------------------------------------
* Description : Clear UA reset condition.
* --------------------------------------------------------------------------
* IN : qued command
* OUT : qued command
* ARG : non
* RET : non
* ==========================================================================
*/
void leoClr_reset(void)
{
u32 code;
code = leoAnalize_asic_status();
switch (code)
{
case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED:
case LEO_SENSE_COMMAND_PHASE_ERROR:
case LEO_SENSE_DEVICE_COMMUNICATION_FAILURE:
((LEOCmdHeader *)LEOcur_command)->sense = code;
((LEOCmdHeader *)LEOcur_command)->status = LEO_STATUS_CHECK_CONDITION;
break;
default:
((LEOCmdHeader *)LEOcur_command)->sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION;
((LEOCmdHeader *)LEOcur_command)->status = LEO_STATUS_GOOD;
}
}
/*--------------end of file-------------*/