summaryrefslogtreecommitdiff
path: root/firmware/target/mips/ingenic_x1000/dma-x1000.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-02-27 22:08:58 +0000
committerAidan MacDonald <amachronic@protonmail.com>2021-03-28 00:01:37 +0000
commit3ec66893e377b088c1284d2d23adb2aeea6d7965 (patch)
treeb647717f83ad56b15dc42cfdef5d04d68cd9bd6b /firmware/target/mips/ingenic_x1000/dma-x1000.h
parent83fcbedc65f4b9ae7e491ecf6f07c0af4b245f74 (diff)
downloadrockbox-3ec66893e377b088c1284d2d23adb2aeea6d7965.tar.gz
rockbox-3ec66893e377b088c1284d2d23adb2aeea6d7965.zip
New port: FiiO M3K on bare metal
Change-Id: I7517e7d5459e129dcfc9465c6fbd708619888fbe
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/dma-x1000.h')
-rw-r--r--firmware/target/mips/ingenic_x1000/dma-x1000.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_x1000/dma-x1000.h b/firmware/target/mips/ingenic_x1000/dma-x1000.h
new file mode 100644
index 0000000000..d836a0cf54
--- /dev/null
+++ b/firmware/target/mips/ingenic_x1000/dma-x1000.h
@@ -0,0 +1,69 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2021 Aidan MacDonald
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef __DMA_X1000_H__
23#define __DMA_X1000_H__
24
25#include "x1000/dma.h"
26#include "x1000/dma_chn.h"
27#include <stdint.h>
28
29/* Events passed to DMA callbacks */
30#define DMA_EVENT_NONE 0 /* Not used by DMA code but can be used as
31 * a sentinel value to indicate "no event" */
32#define DMA_EVENT_INTERRUPT 1 /* Interrupt on a non-final descriptor */
33#define DMA_EVENT_COMPLETE 2 /* Completed the final descriptor */
34#define DMA_EVENT_ERROR 3 /* Some kind of error occurred */
35
36/* All DMA channels which use interrupts must be statically defined here.
37 * The channel numbering should be contiguous, and lower channel numbers
38 * will have lower interrupt latency because they're serviced first.
39 *
40 * Channels >= DMA_NUM_USED_CHANNELS will NOT have interrupts serviced!
41 * Due to the possibility of address error interrupts that can occur even
42 * if no interrupts are requested on the channel, the unallocated channels
43 * cannot be used safely.
44 */
45#define DMA_CHANNEL_AUDIO 0
46#define DMA_CHANNEL_FBCOPY 1
47#define DMA_NUM_USED_CHANNELS 2
48
49struct dma_desc {
50 uint32_t cm; /* meaning and layout same as DMA_CHN_CM */
51 uint32_t sa; /* source address */
52 uint32_t ta; /* target address */
53 uint32_t tc; /* low 24 bits: transfer count
54 * upper 8 bits: offset to next descriptor
55 */
56 uint32_t sd; /* same as DMA_CHN_SD */
57 uint32_t rt; /* request type, same as DMA_CHN_RT */
58 uint32_t pad0;
59 uint32_t pad1;
60} __attribute__((aligned(32)));
61
62typedef struct dma_desc dma_desc;
63
64typedef void(*dma_cb_func)(int event);
65
66extern void dma_init(void);
67extern void dma_set_callback(int chn, dma_cb_func cb);
68
69#endif /* __DMA_X1000_H__ */