00001 /*--------------------------------------------------------------------------------- 00002 00003 Inter Processor Communication 00004 00005 Copyright (C) 2005 00006 Michael Noland (joat) 00007 Jason Rogers (dovoto) 00008 Dave Murphy (WinterMute) 00009 00010 This software is provided 'as-is', without any express or implied 00011 warranty. In no event will the authors be held liable for any 00012 damages arising from the use of this software. 00013 00014 Permission is granted to anyone to use this software for any 00015 purpose, including commercial applications, and to alter it and 00016 redistribute it freely, subject to the following restrictions: 00017 00018 1. The origin of this software must not be misrepresented; you 00019 must not claim that you wrote the original software. If you use 00020 this software in a product, an acknowledgment in the product 00021 documentation would be appreciated but is not required. 00022 2. Altered source versions must be plainly marked as such, and 00023 must not be misrepresented as being the original software. 00024 3. This notice may not be removed or altered from any source 00025 distribution. 00026 00027 ---------------------------------------------------------------------------------*/ 00028 00029 #ifndef NDS_IPC_INCLUDE 00030 #define NDS_IPC_INCLUDE 00031 00032 #include "ndstypes.h" 00033 00034 //--------------------------------------------------------------------------------- 00035 // Synchronization register 00036 //--------------------------------------------------------------------------------- 00037 #define REG_IPC_SYNC (*(vuint16*)0x04000180) 00038 00039 enum IPC_SYNC_BITS { 00040 IPC_SYNC_IRQ_ENABLE = BIT(14), 00041 IPC_SYNC_IRQ_REQUEST = BIT(13) 00042 }; 00043 00044 //--------------------------------------------------------------------------------- 00045 static inline void IPC_SendSync(unsigned int sync) { 00046 //--------------------------------------------------------------------------------- 00047 REG_IPC_SYNC = (REG_IPC_SYNC & 0xf0ff) | (((sync) & 0x0f) << 8) | IPC_SYNC_IRQ_REQUEST; 00048 } 00049 00050 //--------------------------------------------------------------------------------- 00051 static inline int IPC_GetSync() { 00052 //--------------------------------------------------------------------------------- 00053 return REG_IPC_SYNC & 0x0f; 00054 } 00055 00056 //--------------------------------------------------------------------------------- 00057 // fifo 00058 //--------------------------------------------------------------------------------- 00059 #define REG_IPC_FIFO_TX (*(vu32*)0x4000188) 00060 #define REG_IPC_FIFO_RX (*(vu32*)0x4100000) 00061 #define REG_IPC_FIFO_CR (*(vu16*)0x4000184) 00062 00063 enum IPC_CONTROL_BITS { 00064 IPC_FIFO_SEND_EMPTY = (1<<0), 00065 IPC_FIFO_SEND_FULL = (1<<1), 00066 IPC_FIFO_SEND_IRQ = (1<<2), 00067 IPC_FIFO_SEND_CLEAR = (1<<3), 00068 IPC_FIFO_RECV_EMPTY = (1<<8), 00069 IPC_FIFO_RECV_FULL = (1<<9), 00070 IPC_FIFO_RECV_IRQ = (1<<10), 00071 IPC_FIFO_ERROR = (1<<14), 00072 IPC_FIFO_ENABLE = (1<<15) 00073 }; 00074 00075 #endif // NDS_IPC_INCLUDE 00076 00077