static void __dsp_boottask(dsptask_t *task) { u32 mail; #ifdef _DSP_DEBUG printf("__dsp_boottask(%p)\n",task); #endif while(!DSP_CheckMailFrom()); mail = DSP_ReadMailFrom(); #ifdef _DSP_DEBUG if(mail!=0x8071FEED) { //if the overflow calculation applies here too, this should be the value which the dsp should deliver on succesfull sync. printf("__dsp_boottask(): failed to sync DSP on boot (%08x)\n",mail); } #else (void)mail; #endif DSP_SendMailTo(0x80F3A001); while(DSP_CheckMailTo()); DSP_SendMailTo((u32)task->iram_maddr); while(DSP_CheckMailTo()); DSP_SendMailTo(0x80F3C002); while(DSP_CheckMailTo()); DSP_SendMailTo((task->iram_addr&0xffff)); while(DSP_CheckMailTo()); DSP_SendMailTo(0x80F3A002); while(DSP_CheckMailTo()); DSP_SendMailTo(task->iram_len); while(DSP_CheckMailTo()); DSP_SendMailTo(0x80F3B002); while(DSP_CheckMailTo()); DSP_SendMailTo(0); while(DSP_CheckMailTo()); DSP_SendMailTo(0x80F3D001); while(DSP_CheckMailTo()); DSP_SendMailTo(task->init_vec); while(DSP_CheckMailTo()); }
static void __dsp_def_taskcb() { u32 mail; #ifdef _DSP_DEBUG printf("__dsp_def_taskcb()\n"); #endif while(!DSP_CheckMailFrom()); mail = DSP_ReadMailFrom(); #ifdef _DSP_DEBUG printf("__dsp_def_taskcb(mail = 0x%08x)\n",mail); #endif if(__dsp_currtask->flags&DSPTASK_CANCEL) { if(mail==0xDCD10002) mail = 0xDCD10003; } switch(mail) { case 0xDCD10000: __dsp_currtask->state = DSPTASK_RUN; if(__dsp_currtask->init_cb) __dsp_currtask->init_cb(__dsp_currtask); break; case 0xDCD10001: __dsp_currtask->state = DSPTASK_RUN; if(__dsp_currtask->res_cb) __dsp_currtask->res_cb(__dsp_currtask); break; case 0xDCD10002: if(__dsp_rudetask_pend==TRUE) { if(__dsp_rudetask==__dsp_currtask) { DSP_SendMailTo(0xCDD10003); while(DSP_CheckMailTo()); __dsp_rudetask = NULL; __dsp_rudetask_pend = FALSE; if(__dsp_currtask->res_cb) __dsp_currtask->res_cb(__dsp_currtask); } else { DSP_SendMailTo(0xCDD10001); while(DSP_CheckMailTo()); __dsp_exectask(__dsp_currtask,__dsp_rudetask); __dsp_currtask->flags = DSPTASK_YIELD; __dsp_currtask = __dsp_rudetask; __dsp_rudetask = NULL; __dsp_rudetask_pend = FALSE; } } else if(__dsp_currtask->next==NULL) { if(__dsp_firsttask==__dsp_currtask) { DSP_SendMailTo(0xCDD10003); while(DSP_CheckMailTo()); if(__dsp_currtask->res_cb) __dsp_currtask->res_cb(__dsp_currtask); } else { DSP_SendMailTo(0xCDD10001); while(DSP_CheckMailTo()); __dsp_exectask(__dsp_currtask,__dsp_firsttask); __dsp_currtask->state = DSPTASK_YIELD; __dsp_currtask = __dsp_firsttask; } } else { DSP_SendMailTo(0xCDD10001); while(DSP_CheckMailTo()); __dsp_exectask(__dsp_currtask,__dsp_currtask->next); __dsp_currtask->state = DSPTASK_YIELD; __dsp_currtask = __dsp_currtask->next; } break; case 0xDCD10003: if(__dsp_rudetask_pend==TRUE) { if(__dsp_currtask->done_cb) __dsp_currtask->done_cb(__dsp_currtask); DSP_SendMailTo(0xCDD10001); while(DSP_CheckMailTo()); __dsp_exectask(NULL,__dsp_rudetask); __dsp_removetask(__dsp_currtask); __dsp_currtask = __dsp_rudetask; __dsp_rudetask_pend = FALSE; __dsp_rudetask = NULL; } else if(__dsp_currtask->next==NULL) { if(__dsp_firsttask==__dsp_currtask) { if(__dsp_currtask->done_cb) __dsp_currtask->done_cb(__dsp_currtask); DSP_SendMailTo(0xCDD10002); while(DSP_CheckMailTo()); __dsp_currtask->state = DSPTASK_DONE; __dsp_removetask(__dsp_currtask); } } else { if(__dsp_currtask->done_cb) __dsp_currtask->done_cb(__dsp_currtask); DSP_SendMailTo(0xCDD10001); while(DSP_CheckMailTo()); __dsp_currtask->state = DSPTASK_DONE; __dsp_exectask(NULL,__dsp_firsttask); __dsp_currtask = __dsp_firsttask; __dsp_removetask(__dsp_lasttask); } break; case 0xDCD10004: if(__dsp_currtask->req_cb) __dsp_currtask->req_cb(__dsp_currtask); break; } }
static void __dsp_exectask(dsptask_t *exec,dsptask_t *hire) { #ifdef _DSP_DEBUG printf("__dsp_exectask(%p,%p)\n",exec,hire); #endif if(!exec) { DSP_SendMailTo(0); while(DSP_CheckMailTo()); DSP_SendMailTo(0); while(DSP_CheckMailTo()); DSP_SendMailTo(0); while(DSP_CheckMailTo()); } else { DSP_SendMailTo((u32)exec->dram_maddr); while(DSP_CheckMailTo()); DSP_SendMailTo(exec->dram_len); while(DSP_CheckMailTo()); DSP_SendMailTo(exec->dram_addr); while(DSP_CheckMailTo()); } DSP_SendMailTo((u32)hire->iram_maddr); while(DSP_CheckMailTo()); DSP_SendMailTo(hire->iram_len); while(DSP_CheckMailTo()); DSP_SendMailTo(hire->iram_addr); while(DSP_CheckMailTo()); if(hire->state==DSPTASK_INIT) { DSP_SendMailTo(hire->init_vec); while(DSP_CheckMailTo()); DSP_SendMailTo(0); while(DSP_CheckMailTo()); DSP_SendMailTo(0); while(DSP_CheckMailTo()); DSP_SendMailTo(0); while(DSP_CheckMailTo()); return; } DSP_SendMailTo(hire->resume_vec); while(DSP_CheckMailTo()); DSP_SendMailTo((u32)hire->dram_maddr); while(DSP_CheckMailTo()); DSP_SendMailTo(hire->dram_len); while(DSP_CheckMailTo()); DSP_SendMailTo(hire->dram_addr); while(DSP_CheckMailTo()); }
void RealDSP::SendMailTo(u32 mail) { DSP_SendMailTo(mail); }