amiga_boottest

view src/copper.c @ 4:995d42b33974

serial output
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 23 Feb 2018 13:29:37 +0200
parents 48093e4bd99a
children
line source
1 #include "copper.h"
2 #include "hwregs.h"
4 uint32_t *copperlist, *copperlist_end;
5 static uint32_t *copmem, *curlist;
6 static int mode, copmem_size;
8 extern uint32_t **_mem_start;
10 int init_copper(int maxlist, int nlists)
11 {
12 /* allocate and set new copper lists */
13 if(maxlist <= 0) maxlist = 256;
14 mode = nlists >= COPPER_DOUBLE ? COPPER_DOUBLE : COPPER_SINGLE;
16 copmem_size = maxlist * 4 * mode;
17 copmem = *_mem_start;
19 curlist = copperlist = copmem;
20 *curlist = COPPER_END;
22 if(mode == COPPER_DOUBLE) {
23 copperlist = curlist + maxlist;
24 *copperlist = COPPER_END;
25 }
26 copperlist_end = copperlist;
28 REG32_COP1LC = (uint32_t)curlist;
29 REG_COPJMP1 = 0; /* causes copper to read COP1LC */
30 return 0;
31 }
33 void cleanup_copper(void)
34 {
35 }
37 void enable_copper(void)
38 {
39 REG_DMACON = SETBITS(DMA_COPPER);
40 }
42 void disable_copper(void)
43 {
44 REG_DMACON = CLRBITS(DMA_COPPER);
45 }
47 void clear_copper(void)
48 {
49 copperlist_end = copperlist;
50 *copperlist_end = COPPER_END;
51 }
53 void add_copper(uint32_t cmd)
54 {
55 *copperlist_end++ = cmd;
56 }
58 void sort_copper(void)
59 {
60 /* TODO */
61 }
63 void swap_copper(void)
64 {
65 if(mode == COPPER_DOUBLE) {
66 uint32_t *tmpptr;
67 tmpptr = curlist;
68 curlist = copperlist;
69 copperlist = copperlist_end = tmpptr;
71 REG32_COP1LC = (uint32_t)curlist;
72 REG_COPJMP1 = 0;
73 } else {
74 copperlist_end = curlist;
75 }
76 *copperlist_end = COPPER_END;
77 }