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)
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;
19 curlist = copperlist = copmem;
20 *curlist = COPPER_END;
22 if(mode == COPPER_DOUBLE) {
23 copperlist = curlist + maxlist;
24 *copperlist = COPPER_END;
26 copperlist_end = copperlist;
28 REG32_COP1LC = (uint32_t)curlist;
29 REG_COPJMP1 = 0; /* causes copper to read COP1LC */
33 void cleanup_copper(void)
37 void enable_copper(void)
39 REG_DMACON = SETBITS(DMA_COPPER);
42 void disable_copper(void)
44 REG_DMACON = CLRBITS(DMA_COPPER);
47 void clear_copper(void)
49 copperlist_end = copperlist;
50 *copperlist_end = COPPER_END;
53 void add_copper(uint32_t cmd)
55 *copperlist_end++ = cmd;
58 void sort_copper(void)
63 void swap_copper(void)
65 if(mode == COPPER_DOUBLE) {
69 copperlist = copperlist_end = tmpptr;
71 REG32_COP1LC = (uint32_t)curlist;
74 copperlist_end = curlist;
76 *copperlist_end = COPPER_END;