1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - OS - include
3   File:     vramExclusive.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-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 #ifndef NITRO_OS_ARM9_VRAMEXCLUSIVE_H_
18 #define NITRO_OS_ARM9_VRAMEXCLUSIVE_H_
19 
20 #ifdef  __cplusplus
21 extern "C" {
22 #endif
23 
24 /*===========================================================================*/
25 
26 #include	<nitro/types.h>
27 
28 
29 /*---------------------------------------------------------------------------*
30     Constant Definitions
31  *---------------------------------------------------------------------------*/
32 #define		OS_VRAM_BANK_ID_A		0x0001
33 #define		OS_VRAM_BANK_ID_B		0x0002
34 #define		OS_VRAM_BANK_ID_C		0x0004
35 #define		OS_VRAM_BANK_ID_D		0x0008
36 #define		OS_VRAM_BANK_ID_E		0x0010
37 #define		OS_VRAM_BANK_ID_F		0x0020
38 #define		OS_VRAM_BANK_ID_G		0x0040
39 #define		OS_VRAM_BANK_ID_H		0x0080
40 #define		OS_VRAM_BANK_ID_I		0x0100
41 #define		OS_VRAM_BANK_ID_ALL		0x01ff
42 
43 #define		OS_VRAM_BANK_KINDS		9
44 
45 
46 /*---------------------------------------------------------------------------*
47   Name:         OSi_InitVramExclusive
48 
49   Description:  Initializes VRAM mutex processing.
50 
51   Arguments:    None.
52 
53   Returns:      None.
54  *---------------------------------------------------------------------------*/
55 void    OSi_InitVramExclusive(void);
56 
57 /*---------------------------------------------------------------------------*
58   Name:         OSi_TryLockVram
59 
60   Description:  Tries the VRAM exclusive lock.
61 
62   Arguments:    bank:       ID bitmap of VRAM for which exclusive lock is to be attempted
63 				lockId:     Arbitrary ID that will become a key when locking
64 
65   Returns:      BOOL        Returns TRUE if lock succeeds.
66  *---------------------------------------------------------------------------*/
67 BOOL    OSi_TryLockVram(u16 bank, u16 lockId);
68 
69 /*---------------------------------------------------------------------------*
70   Name:         OSi_InitVramExclusive
71 
72   Description:  Releases VRAM exclusive lock.
73 
74   Arguments:    bank:       ID bitmap of VRAM for which exclusive lock is to be released
75 				lockId:     The arbitrary ID specified at locking
76 
77   Returns:      None.
78  *---------------------------------------------------------------------------*/
79 void    OSi_UnlockVram(u16 bank, u16 lockId);
80 
81 
82 /*===========================================================================*/
83 
84 #ifdef  __cplusplus
85 }       /* extern "C" */
86 #endif
87 
88 #endif /* NITRO_OS_ARM9_VRAMEXCLUSIVE_H_ */
89 
90 /*---------------------------------------------------------------------------*
91     End of file
92  *---------------------------------------------------------------------------*/
93