Commit | Line | Data |
---|---|---|
3719602c PC |
1 | /* Copyright (C) 2010-2021 The RetroArch team |
2 | * | |
3 | * --------------------------------------------------------------------------------------- | |
4 | * The following license statement only applies to this file (gx_defines.h). | |
5 | * --------------------------------------------------------------------------------------- | |
6 | * | |
7 | * Permission is hereby granted, free of charge, | |
8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), | |
9 | * to deal in the Software without restriction, including without limitation the rights to | |
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, | |
11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
12 | * | |
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
14 | * | |
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
21 | */ | |
22 | ||
23 | #ifndef _GX_DEFINES_H | |
24 | #define _GX_DEFINES_H | |
25 | ||
26 | #ifdef GEKKO | |
27 | ||
28 | #define SYSMEM1_SIZE 0x01800000 | |
29 | ||
30 | #define _SHIFTL(v, s, w) ((uint32_t) (((uint32_t)(v) & ((0x01 << (w)) - 1)) << (s))) | |
31 | #define _SHIFTR(v, s, w) ((uint32_t)(((uint32_t)(v) >> (s)) & ((0x01 << (w)) - 1))) | |
32 | ||
33 | #define OSThread lwp_t | |
34 | #define OSCond lwpq_t | |
35 | #define OSThreadQueue lwpq_t | |
36 | ||
37 | #define OSInitMutex(mutex) LWP_MutexInit(mutex, 0) | |
38 | #define OSLockMutex(mutex) LWP_MutexLock(mutex) | |
39 | #define OSUnlockMutex(mutex) LWP_MutexUnlock(mutex) | |
40 | #define OSTryLockMutex(mutex) LWP_MutexTryLock(mutex) | |
41 | ||
42 | #define OSInitCond(cond) LWP_CondInit(cond) | |
43 | #define OSSignalCond(cond) LWP_ThreadSignal(cond) | |
44 | #define OSWaitCond(cond, mutex) LWP_CondWait(cond, mutex) | |
45 | ||
46 | #define OSInitThreadQueue(queue) LWP_InitQueue(queue) | |
47 | #define OSCloseThreadQueue(queue) LWP_CloseQueue(queue) | |
48 | #define OSSleepThread(queue) LWP_ThreadSleep(queue) | |
49 | #define OSJoinThread(thread, val) LWP_JoinThread(thread, val) | |
50 | ||
51 | #define OSCreateThread(thread, func, intarg, ptrarg, stackbase, stacksize, priority, attrs) LWP_CreateThread(thread, func, ptrarg, stackbase, stacksize, priority) | |
52 | ||
53 | #define BLIT_LINE_16(off) \ | |
54 | { \ | |
55 | const uint32_t *tmp_src = src; \ | |
56 | uint32_t *tmp_dst = dst; \ | |
57 | for (unsigned x = 0; x < width2 >> 1; x++, tmp_src += 2, tmp_dst += 8) \ | |
58 | { \ | |
59 | tmp_dst[ 0 + off] = BLIT_LINE_16_CONV(tmp_src[0]); \ | |
60 | tmp_dst[ 1 + off] = BLIT_LINE_16_CONV(tmp_src[1]); \ | |
61 | } \ | |
62 | src += tmp_pitch; \ | |
63 | } | |
64 | ||
65 | #define BLIT_LINE_32(off) \ | |
66 | { \ | |
67 | const uint16_t *tmp_src = src; \ | |
68 | uint16_t *tmp_dst = dst; \ | |
69 | for (unsigned x = 0; x < width2 >> 3; x++, tmp_src += 8, tmp_dst += 32) \ | |
70 | { \ | |
71 | tmp_dst[ 0 + off] = tmp_src[0] | 0xFF00; \ | |
72 | tmp_dst[ 16 + off] = tmp_src[1]; \ | |
73 | tmp_dst[ 1 + off] = tmp_src[2] | 0xFF00; \ | |
74 | tmp_dst[ 17 + off] = tmp_src[3]; \ | |
75 | tmp_dst[ 2 + off] = tmp_src[4] | 0xFF00; \ | |
76 | tmp_dst[ 18 + off] = tmp_src[5]; \ | |
77 | tmp_dst[ 3 + off] = tmp_src[6] | 0xFF00; \ | |
78 | tmp_dst[ 19 + off] = tmp_src[7]; \ | |
79 | } \ | |
80 | src += tmp_pitch; \ | |
81 | } | |
82 | ||
83 | #define CHUNK_FRAMES 64 | |
84 | #define CHUNK_SIZE (CHUNK_FRAMES * sizeof(uint32_t)) | |
85 | #define BLOCKS 16 | |
86 | ||
87 | #define AIInit AUDIO_Init | |
88 | #define AIInitDMA AUDIO_InitDMA | |
89 | #define AIStartDMA AUDIO_StartDMA | |
90 | #define AIStopDMA AUDIO_StopDMA | |
91 | #define AIRegisterDMACallback AUDIO_RegisterDMACallback | |
92 | #define AISetDSPSampleRate AUDIO_SetDSPSampleRate | |
93 | ||
94 | #endif | |
95 | ||
96 | #endif |