1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: dsp_Common.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_COMMON_DSP_COMMON_H_ 17 #define NN_DSP_CTR_COMMON_DSP_COMMON_H_ 18 19 /*---------------------------------------------------------------------------* 20 * constants 21 *---------------------------------------------------------------------------*/ 22 23 // Constants for defining IN and OUT. (Generally defined as 0 : DSP->ARM, 1 : ARM->DSP) 24 #ifdef NN_SYSTEM_PROCESS 25 #define NN_DSP_PIPE_INPUT 0 26 #define NN_DSP_PIPE_OUTPUT 1 27 #else 28 #define NN_DSP_PIPE_INPUT 1 29 #define NN_DSP_PIPE_OUTPUT 0 30 #endif 31 #define NN_DSP_PIPE_PEER_MAX 2 32 33 // Defined ports 34 #define NN_DSP_PIPE_CONSOLE 0 // DSP->ARM: Debugging console 35 #define NN_DSP_PIPE_DMA 1 // DSP<->ARM: Pseudo-DMA 36 #define NN_DSP_PIPE_AUDIO 2 // DSP<->ARM: General-purpose audio communications 37 #define NN_DSP_PIPE_BINARY 3 // DSP<->ARM: General-purpose binary 38 #define NN_DSP_PIPE_EPHEMERAL 4 // Free region that can be allocated with DSP_CreatePipe function 39 #define NN_DSP_PIPE_DSPSND NN_DSP_PIPE_AUDIO 40 41 // System resources 42 #define NN_DSP_PIPE_PORT_MAX 8 // Maximum number of usable ports for pipes 43 #define NN_DSP_PIPE_DEFAULT_BUFFER_LENGTH 64 // Default ring buffer size 44 45 #define NN_DSP_PIPE_FLAG_INPUT 0x0000 // Input side 46 #define NN_DSP_PIPE_FLAG_OUTPUT 0x0001 // Output side 47 #define NN_DSP_PIPE_FLAG_PORTMASK 0x00FF // Negative field for port numbers 48 #define NN_DSP_PIPE_FLAG_BOUND 0x0100 // Opened 49 #define NN_DSP_PIPE_FLAG_EOF 0x0200 // EOF 50 51 #define NN_DSP_PIPE_FLAG_EXIT_OS 0x8000 // Exit processing for the DSP's AHB master 52 53 #define NN_DSP_PIPE_COMMAND_REGISTER 2 54 55 // Command structures for DSP file I/O. 56 #define NN_DSP_PIPE_IO_COMMAND_OPEN 0 57 #define NN_DSP_PIPE_IO_COMMAND_CLOSE 1 58 #define NN_DSP_PIPE_IO_COMMAND_SEEK 2 59 #define NN_DSP_PIPE_IO_COMMAND_READ 3 60 #define NN_DSP_PIPE_IO_COMMAND_WRITE 4 61 #define NN_DSP_PIPE_IO_COMMAND_MEMMAP 5 62 63 #define NN_DSP_PIPE_IO_MODE_R 0x0001 64 #define NN_DSP_PIPE_IO_MODE_W 0x0002 65 #define NN_DSP_PIPE_IO_MODE_RW 0x0004 66 #define NN_DSP_PIPE_IO_MODE_TRUNC 0x0008 67 #define NN_DSP_PIPE_IO_MODE_CREATE 0x0010 68 69 #define NN_DSP_PIPE_IO_SEEK_SET 0 70 #define NN_DSP_PIPE_IO_SEEK_CUR 1 71 #define NN_DSP_PIPE_IO_SEEK_END 2 72 73 #ifndef CTR_DSP 74 /*---------------------------------------------------------------------------* 75 * includes 76 *---------------------------------------------------------------------------*/ 77 #include <nn/types.h> 78 #include <nn/dsp/CTR/Common/dsp_Types.h> 79 80 /*---------------------------------------------------------------------------* 81 * namespaces 82 *---------------------------------------------------------------------------*/ 83 84 namespace nn { 85 namespace dsp { 86 namespace CTR { 87 88 typedef enum 89 { 90 INTERRUPT_TYPE_REPLY0 = 0, 91 INTERRUPT_TYPE_REPLY1 = 1, 92 INTERRUPT_TYPE_PIPE = 2 93 } InterruptType; 94 95 #endif // CTR_DSP 96 97 //---------------------------------------------------------------- 98 // Move from dsp_Pipe.h 99 //---------------------------------------------------------------- 100 // Pipe structures. 101 // Because there is no method to directly access ARM from the DSP. Accordingly, control the buffer in the DSP from ARM using APBP-FIFO. 102 // 103 // It will be treated as a ring buffer in the absence of a particular specification. 104 typedef struct DSPPipe 105 { 106 DSPAddr address; // Starting address of the buffer 107 DSPByte length; // Buffer size 108 DSPByte rpos; // First unread region 109 DSPByte wpos; // Last appended region 110 u16 flags; // Attribute flags 111 } 112 DSPPipe, * pDSPPipe; 113 114 /*---------------------------------------------------------------------------*/ 115 /* Declarations */ 116 117 // Pipe information maintained by the DSP and accessed by an ARM processor. 118 typedef struct DSPPipeMonitor 119 { 120 DSPPipe pipe[NN_DSP_PIPE_PORT_MAX][NN_DSP_PIPE_PEER_MAX]; 121 } 122 DSPPipeMonitor; 123 124 #ifndef CTR_DSP 125 } // namespace nn { 126 } // namespace dsp { 127 } // namespace CTR { 128 #endif // CTR_DSP 129 130 #endif // ifndef NN_DSP_CTR_COMMON_DSP_COMMON_H_ 131 132