00001 /*--------------------------------------------------------------------------------- 00002 00003 PosTest.c -- Code for performing hardware position testing 00004 00005 Copyright (C) 2007 00006 Gabe Ghearing (gabebear) 00007 00008 This software is provided 'as-is', without any express or implied 00009 warranty. In no event will the authors be held liable for any 00010 damages arising from the use of this software. 00011 00012 Permission is granted to anyone to use this software for any 00013 purpose, including commercial applications, and to alter it and 00014 redistribute it freely, subject to the following restrictions: 00015 00016 1. The origin of this software must not be misrepresented; you 00017 must not claim that you wrote the original software. If you use 00018 this software in a product, an acknowledgment in the product 00019 documentation would be appreciated but is not required. 00020 00021 2. Altered source versions must be plainly marked as such, and 00022 must not be misrepresented as being the original software. 00023 00024 3. This notice may not be removed or altered from any source 00025 distribution. 00026 00027 ---------------------------------------------------------------------------------*/ 00028 #ifndef POS_TEST_INCLUDE 00029 #define POS_TEST_INCLUDE 00030 00031 #include <nds/arm9/video.h> 00032 #include <nds/arm9/videoGL.h> 00033 00036 GL_STATIC_INL bool PosTestBusy() { 00037 return (GFX_STATUS & BIT(0))!=0; 00038 } 00039 00052 GL_STATIC_INL void PosTest_Asynch(v16 x, v16 y, v16 z){ 00053 GFX_POS_TEST = VERTEX_PACK(x, y); 00054 GFX_POS_TEST = z; 00055 } 00056 00061 GL_STATIC_INL void PosTest(v16 x, v16 y, v16 z) { 00062 PosTest_Asynch(x,y,z); 00063 while(PosTestBusy()); 00064 } 00065 00068 GL_STATIC_INL int32 PosTestWresult() { 00069 return GFX_POS_RESULT[3]; 00070 } 00071 00074 GL_STATIC_INL int32 PosTestXresult() { 00075 return GFX_POS_RESULT[0]; 00076 } 00077 00080 GL_STATIC_INL int32 PosTestYresult() { 00081 return GFX_POS_RESULT[1]; 00082 } 00083 00086 GL_STATIC_INL int32 PosTestZresult() { 00087 return GFX_POS_RESULT[2]; 00088 } 00089 00090 #endif // ifndef POS_TEST_INCLUDE 00091
1.6.3