1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - OS - libraries
3   File:     os_systemWork.c
4 
5   Copyright 2007-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-02-01#$
14   $Rev: 4001 $
15   $Author: nakasima $
16  *---------------------------------------------------------------------------*/
17 
18 #include <nitro/os.h>
19 #ifdef SDK_TWL
20 #include    <nitro/os/common/emulator.h>
21 #include    <twl/os/common/codecmode.h>
22 #endif
23 
24 /*---------------------------------------------------------------------------*
25   Name:         OS_GetBootType
26 
27   Description:  Gets your own boot type
28 
29   Arguments:    None.
30 
31   Returns:      Specifies your own boot type and returns the OSBootType type.
32  *---------------------------------------------------------------------------*/
OS_GetBootType(void)33 OSBootType OS_GetBootType(void)
34 {
35     return OS_GetBootInfo()->boot_type;
36 }
37 
38 /*---------------------------------------------------------------------------*
39   Name:         OS_GetBootInfo
40 
41   Description:  Gets information specific to your own boot type.
42 
43   Arguments:    None.
44 
45   Returns:      Specifies information related to your own boot type and returns the OSBootInfo structure
46  *---------------------------------------------------------------------------*/
OS_GetBootInfo(void)47 const OSBootInfo *OS_GetBootInfo(void)
48 {
49 	return ((const OSBootInfo *)HW_WM_BOOT_BUF);
50 }
51 
52 //---- internal
53 
54 #ifdef SDK_TWL
55 
OSi_IsCodecTwlMode(void)56 BOOL OSi_IsCodecTwlMode(void)
57 {
58     static BOOL retval;
59     static BOOL initialized = FALSE;
60 
61     if ( initialized == FALSE )
62     {
63         retval = ((OS_IsRunOnTwl() == TRUE) && ((*((u8*)(HW_TWL_ROM_HEADER_BUF + 0x01bf)) & 0x01) == OS_CODECMODE_TWL));
64     }
65     initialized = TRUE;
66 
67     return retval;
68 }
69 
70 #endif // SDK_TWL
71