RetroArch
gx_defines.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2011-2017 - Daniel De Matteis
3  *
4  * RetroArch is free software: you can redistribute it and/or modify it under the terms
5  * of the GNU General Public License as published by the Free Software Found-
6  * ation, either version 3 of the License, or (at your option) any later version.
7  *
8  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10  * PURPOSE. See the GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License along with RetroArch.
13  * If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef _GX_DEFINES_H
17 #define _GX_DEFINES_H
18 
19 #ifdef GEKKO
20 
21 #define SYSMEM1_SIZE 0x01800000
22 
23 #define _SHIFTL(v, s, w) ((uint32_t) (((uint32_t)(v) & ((0x01 << (w)) - 1)) << (s)))
24 #define _SHIFTR(v, s, w) ((uint32_t)(((uint32_t)(v) >> (s)) & ((0x01 << (w)) - 1)))
25 
26 #define OSThread lwp_t
27 #define OSCond lwpq_t
28 #define OSThreadQueue lwpq_t
29 
30 #define OSInitMutex(mutex) LWP_MutexInit(mutex, 0)
31 #define OSLockMutex(mutex) LWP_MutexLock(mutex)
32 #define OSUnlockMutex(mutex) LWP_MutexUnlock(mutex)
33 #define OSTryLockMutex(mutex) LWP_MutexTryLock(mutex)
34 
35 #define OSInitCond(cond) LWP_CondInit(cond)
36 #define OSSignalCond(cond) LWP_ThreadSignal(cond)
37 #define OSWaitCond(cond, mutex) LWP_CondWait(cond, mutex)
38 
39 #define OSInitThreadQueue(queue) LWP_InitQueue(queue)
40 #define OSCloseThreadQueue(queue) LWP_CloseQueue(queue)
41 #define OSSleepThread(queue) LWP_ThreadSleep(queue)
42 #define OSJoinThread(thread, val) LWP_JoinThread(thread, val)
43 
44 #define OSCreateThread(thread, func, intarg, ptrarg, stackbase, stacksize, priority, attrs) LWP_CreateThread(thread, func, ptrarg, stackbase, stacksize, priority)
45 
46 #define BLIT_LINE_16(off) \
47 { \
48  const uint32_t *tmp_src = src; \
49  uint32_t *tmp_dst = dst; \
50  for (unsigned x = 0; x < width2 >> 1; x++, tmp_src += 2, tmp_dst += 8) \
51  { \
52  tmp_dst[ 0 + off] = BLIT_LINE_16_CONV(tmp_src[0]); \
53  tmp_dst[ 1 + off] = BLIT_LINE_16_CONV(tmp_src[1]); \
54  } \
55  src += tmp_pitch; \
56 }
57 
58 #define BLIT_LINE_32(off) \
59 { \
60  const uint16_t *tmp_src = src; \
61  uint16_t *tmp_dst = dst; \
62  for (unsigned x = 0; x < width2 >> 3; x++, tmp_src += 8, tmp_dst += 32) \
63  { \
64  tmp_dst[ 0 + off] = tmp_src[0] | 0xFF00; \
65  tmp_dst[ 16 + off] = tmp_src[1]; \
66  tmp_dst[ 1 + off] = tmp_src[2] | 0xFF00; \
67  tmp_dst[ 17 + off] = tmp_src[3]; \
68  tmp_dst[ 2 + off] = tmp_src[4] | 0xFF00; \
69  tmp_dst[ 18 + off] = tmp_src[5]; \
70  tmp_dst[ 3 + off] = tmp_src[6] | 0xFF00; \
71  tmp_dst[ 19 + off] = tmp_src[7]; \
72  } \
73  src += tmp_pitch; \
74 }
75 
76 #define CHUNK_FRAMES 64
77 #define CHUNK_SIZE (CHUNK_FRAMES * sizeof(uint32_t))
78 #define BLOCKS 16
79 
80 #define AIInit AUDIO_Init
81 #define AIInitDMA AUDIO_InitDMA
82 #define AIStartDMA AUDIO_StartDMA
83 #define AIStopDMA AUDIO_StopDMA
84 #define AIRegisterDMACallback AUDIO_RegisterDMACallback
85 #define AISetDSPSampleRate AUDIO_SetDSPSampleRate
86 
87 #endif
88 
89 #endif