1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - OS - include
3   File:     reset.h
4 
5   Copyright 2003-2008 Nintendo.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-17#$
14   $Rev: 8556 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_OS_RESET_H_
19 #define NITRO_OS_RESET_H_
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include <nitro/misc.h>
26 #include <nitro/types.h>
27 #include <nitro/os/common/pxi.h>
28 
29 
30 //---- PXI command
31 #define OS_PXI_COMMAND_RESET      0x10
32 #define OS_PXI_COMMAND_TERMINATE  0x20
33 
34 //---- PXI command field
35 #define OS_PXI_COMMAND_MASK       0x00007f00
36 #define OS_PXI_COMMAND_SHIFT      8
37 #define OS_PXI_DATA_MASK          0x000000ff
38 #define OS_PXI_DATA_SHIFT         0
39 
40 
41 //================================================================================
42 /*---------------------------------------------------------------------------*
43   Name:         OS_InitReset
44 
45   Description:  init reset system
46 
47   Arguments:    None.
48 
49   Returns:      None.
50  *---------------------------------------------------------------------------*/
51 void    OS_InitReset(void);
52 
53 /*---------------------------------------------------------------------------*
54   Name:         OS_ResetSystem
55 
56   Description:  start reset proc
57 
58   Arguments:    parameter : parameter to be sent to next boot.
59 
60   Returns:      None.
61  *---------------------------------------------------------------------------*/
62 #ifdef SDK_ARM9
63 void    OS_ResetSystem(u32 parameter);
64 #else
65 void    OS_ResetSystem(void);
66 #endif
67 
68 /*---------------------------------------------------------------------------*
69   Name:         OS_GetResetParameter
70 
71   Description:  get parameter from previous reset
72 
73   Arguments:    None.
74 
75   Returns:      reset parameter
76  *---------------------------------------------------------------------------*/
OS_GetResetParameter(void)77 static inline u32 OS_GetResetParameter(void)
78 {
79     return (u32)*(u32 *)HW_RESET_PARAMETER_BUF;
80 }
81 
82 //================================================================================
83 #ifdef __cplusplus
84 } /* extern "C" */
85 #endif
86 
87 /* NITRO_OS_RESET_H_ */
88 #endif
89