1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - OS
3   File:     os_resource.c
4 
5   Copyright 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-04-24#$
14   $Rev: 5735 $
15   $Author: okubata_ryoma $
16 
17  *---------------------------------------------------------------------------*/
18 //#include <nitro/os.h>
19 #include <nitro/os/common/resource.h>
20 #include <nitro/os/common/system.h>
21 
22 //================================================================================
23 //   for DEBUG
24 //================================================================================
25 /*---------------------------------------------------------------------------*
26   Name:         OS_GetAllResources
27 
28   Description:  store system resources to specified pointer
29 
30   Arguments:    resource       pointer to store system resources
31 
32   Returns:      TRUE  ... success
33                 FALSE ... fail
34  *---------------------------------------------------------------------------*/
OS_GetAllResources(OSResource * resource)35 BOOL OS_GetAllResources(OSResource *resource)
36 {
37     OSIntrMode enabled = OS_DisableInterrupts();
38 	BOOL flag = TRUE;
39 	SDK_ASSERT(resource != NULL);
40 
41 	//---- thread resource
42 	if (!(resource->threadResourceFlag = OS_GetThreadResource(&resource->threadResource)))
43 	{
44 		flag = FALSE;
45 	}
46 
47 	//---- alarm resource
48 	if (!(resource->alarmResourceFlag = OS_GetAlarmResource(&resource->alarmResource)))
49 	{
50 		flag = FALSE;
51 	}
52 
53 	//---- valarm resource
54 	if (!(resource->valarmResourceFlag = OS_GetVAlarmResource(&resource->valarmResource)))
55 	{
56 		flag = FALSE;
57 	}
58 
59 	//---- arena resource
60 	if (!(resource->arenaResourceFlag = OS_GetArenaResource(&resource->arenaResource)))
61 	{
62 		flag = FALSE;
63 	}
64 
65     (void)OS_RestoreInterrupts(enabled);
66 	return flag;
67 }
68