1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: dsp_Types.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. 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 $Rev: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_DSP_CTR_DSP_TYPES_H_ 17 #define NN_DSP_CTR_DSP_TYPES_H_ 18 19 #ifndef CTR_DSP 20 /*---------------------------------------------------------------------------* 21 * includes 22 *---------------------------------------------------------------------------*/ 23 #include <nn/types.h> 24 25 /*---------------------------------------------------------------------------* 26 * namespaces 27 *---------------------------------------------------------------------------*/ 28 namespace nn { 29 namespace dsp { 30 namespace CTR { 31 #else 32 #include <dsp/types.h> 33 #endif // CTR_DSP 34 35 /*---------------------------------------------------------------------------*/ 36 /* Declarations */ 37 38 // Type definitions to use when sharing data during inter-processor communication. 39 typedef u16 DSPAddr; // This type expresses an address in the DSP (2 bytes, 1 word) 40 typedef u16 DSPWord; // This type expresses a size in the DSP (2 bytes, 1 word) 41 typedef u16 DSPByte; // This type expresses a single-byte unit in the DSP (1 byte, 1 word) 42 typedef u32 DSPWord32; // This type expresses a size in the DSP (2 bytes, 1 word) 43 typedef u32 DSPByte32; // This type expresses a single-byte unit in the DSP (1 byte, 1 word) 44 typedef u32 DSPAddrInARM; // This type has converted DSP addresses into bytes 45 46 // Explicit Type-Conversion Macros 47 #define NN_DSP_ADDR_TO_ARM(address) (u32)((address) << 1) 48 #define NN_DSP_ADDR_TO_DSP(address) (u16)((u32)(address) >> 1) 49 #define NN_DSP_WORD_TO_ARM(word) (u16)((word) << 1) 50 #define NN_DSP_WORD_TO_DSP(word) (u16)((word) >> 1) 51 #define NN_DSP_WORD_TO_ARM32(word) (u32)((word) << 1) 52 #define NN_DSP_WORD_TO_DSP32(word) (u32)((word) >> 1) 53 #define NN_DSP_32BIT_TO_ARM(value) (u32)(((u32)(value) >> 16) | ((u32)(value) << 16)) 54 #define NN_DSP_32BIT_TO_DSP(value) (u32)(((u32)(value) >> 16) | ((u32)(value) << 16)) 55 #ifdef NN_SYSTEM_PROCESS 56 #define NN_DSP_BYTE_TO_UNIT(byte) (u16)(byte) 57 #define NN_DSP_UNIT_TO_BYTE(unit) (u16)(unit) 58 #else 59 #define NN_DSP_BYTE_TO_UNIT(byte) (u16)((byte) >> 1) 60 #define NN_DSP_UNIT_TO_BYTE(unit) (u16)((unit) << 1) 61 #endif // #ifdef NN_SYSTEM_PROCESS 62 63 // The native size for sizeof(char) (this is 2 on the DSP and 1 on an ARM processor) 64 #define NN_DSP_WORD_UNIT (3 - sizeof(DSPWord)) 65 66 #ifndef CTR_DSP 67 } // namespace CTR { 68 } // namespace dsp { 69 } // namespace nn { 70 #endif // CTR_DSP 71 72 #endif // ifndef NN_DSP_CTR_DSP_TYPES_H_ 73