Exemplo n.º 1
0
static u32 remove_bp(void *mem)
{
    struct bp_entry *e = p_bpentries;
    struct bp_entry *f = NULL;

    if(!e) return 0;
    if(e->address==mem) {
        p_bpentries = e->next;
        f = e;
    } else {
        for(; e->next; e=e->next) {
            if(e->next->address==mem) {
                f = e->next;
                e->next = f->next;
                break;
            }
        }
    }
    if(!f) return 0;

    *(f->address) = f->instr;
    f->instr = 0xffffffff;
    f->address = NULL;

    DCStoreRangeNoSync((void*)((u32)mem&~0x1f),32);
    ICInvalidateRange((void*)((u32)mem&~0x1f),32);
    _sync();

    return 1;
}
Exemplo n.º 2
0
static int play(void *data, int remaining, int flags)
{
	int processed = 0;
	int samples = BUFFER_SIZE / (sizeof(s16) * HW_CHANNELS);
	s16 *source = (s16 *)data;

	while (remaining >= request_size && get_space() >= request_size)
	{
		copy_channels((s16 *)buffers[buffer_fill], source, samples, processed, remaining);
		DCStoreRangeNoSync(buffers[buffer_fill], BUFFER_SIZE);

		buffer_fill = (buffer_fill + 1) % BUFFER_COUNT;

		processed += request_size;
		source += request_size / sizeof(s16);
		buffered += BUFFER_SIZE;
		remaining -= request_size;		
	}

	if ((flags & AOPLAY_FINAL_CHUNK) && remaining > 0)
	{
		samples = remaining / (sizeof(s16) * HW_CHANNELS);
		memset(buffers[buffer_fill], 0, BUFFER_SIZE);
		copy_channels((s16 *)buffers[buffer_fill], source, samples, processed, 0);
		DCStoreRangeNoSync(buffers[buffer_fill], BUFFER_SIZE);
		buffer_fill = (buffer_fill + 1) % BUFFER_COUNT;

		processed += remaining;
		buffered += BUFFER_SIZE;
	}

	if (!playing)// && buffered > request_size)
	{
		playing = true;
		switch_buffers();
		AUDIO_StartDMA();
	}
	return processed;
}
Exemplo n.º 3
0
static u32 insert_bp(void *mem)
{
    u32 i;
    struct bp_entry *p;

    for(i=0; i<GEKKO_MAX_BP; i++) {
        if(bp_entries[i].address == NULL) break;
    }
    if(i==GEKKO_MAX_BP) return 0;

    p = &bp_entries[i];
    p->next = p_bpentries;
    p->address = mem;
    p_bpentries = p;

    p->instr = *(p->address);
    *(p->address) = BPCODE;

    DCStoreRangeNoSync((void*)((u32)mem&~0x1f),32);
    ICInvalidateRange((void*)((u32)mem&~0x1f),32);
    _sync();

    return 1;
}