forked from kode54/libupse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upse_ps1_spu_dma_handler.c
69 lines (56 loc) · 2.1 KB
/
upse_ps1_spu_dma_handler.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* UPSE: the unix playstation sound emulator.
*
* Filename: upse_ps1_spu_dma_handler.c
* Purpose: libupse: PS1 SPU DMA handling engine
*
* Copyright (c) 2007 William Pitcock <[email protected]>
* Portions copyright (c) 2002 Pete Bernert <[email protected]>
*
* UPSE is free software, released under the GNU General Public License,
* version 2.
*
* A copy of the GNU General Public License, version 2, is included in
* the UPSE source kit as COPYING.
*
* UPSE is offered without any warranty of any kind, explicit or implicit.
*/
#define _IN_DMA
#include "upse-types.h"
#include "upse-internal.h"
#include "upse-ps1-spu-base.h"
#include "upse-spu-internal.h"
#include "upse.h"
#include "upse-ps1-memory-manager.h"
#include "Neill/spu.h"
////////////////////////////////////////////////////////////////////////
// READ DMA (many values)
////////////////////////////////////////////////////////////////////////
void upse_ps1_spu_dma_read_memory(upse_spu_state_t *spu, u32 usPSXMem, int iSize)
{
int i;
for (i = 0; i < iSize; i++)
{
*(u16 *) PSXM(spu->ins, usPSXMem) = spu_lh(spu->pCore, 0x1F801DA8); // spu addr got by writeregister
usPSXMem += 2;
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// to investigate: do sound data updates by writedma affect spu
// irqs? Will an irq be triggered, if new data is written to
// the memory irq address?
////////////////////////////////////////////////////////////////////////
// WRITE DMA (many values)
////////////////////////////////////////////////////////////////////////
void upse_ps1_spu_dma_write_memory(upse_spu_state_t *spu, u32 usPSXMem, int iSize)
{
int i;
for (i = 0; i < iSize; i++)
{
spu_sh(spu->pCore, 0x1F801DA8, *(u16 *) PSXM(spu->ins, usPSXMem));
usPSXMem += 2; // spu addr got by writeregister
}
}
////////////////////////////////////////////////////////////////////////