exec.library->AddTask() stack handling...
Posted: Sat Jun 09, 2018 6:17 am
What would be the specific corrections needed to deal with the SPReg, SPLower and SPUpper in the "struct Task uTask;" as part of the "struct DEVICE_UNIT_CLASS *unit;" dyamically allocated within the following code ?
I'm looking at the example on the Amiga Developer CD 2.1 and trying to adapt from 68K Assembly into C... and apparently missing something during the translation?
Would like not to use dos.library for this one
I'm looking at the example on the Amiga Developer CD 2.1 and trying to adapt from 68K Assembly into C... and apparently missing something during the translation?
Would like not to use dos.library for this one
Code: Select all
struct DEVICE_UNIT_CLASS *unit=NULL;
struct PCIResourceRange *Range=NULL;
if(card)
unit=Base->IExec->AllocVecTags(DEVICE_UNIT_SIZE,AVT_Type,MEMF_SHARED,AVT_ClearWithValue,0L,TAG_DONE,TAG_DONE);
if(unit)
{
KDEBUG("XHCI::InitUnit()@unit=%lx\n",unit);
Base->Library.lib_OpenCnt++;
unit->Attrs[0].ti_Tag=AT_Param1;
unit->Attrs[0].ti_Data=(uint32)unit;
unit->Attrs[1].ti_Tag=AT_Param2;
unit->Attrs[1].ti_Data=(uint32)Base;
unit->Attrs[1].ti_Tag=TAG_END;
unit->Attrs[2].ti_Data=(uint32)0L;
card->Lock(PCI_LOCK_SHARED);
HwCardReset((APTR)Base,card);
Range=card->GetResourceRange(0UL);
if(Range)
{
KDEBUG("XHCI::InitUnit() @Range=%lx\n",Range);
KDEBUG("XHCI::InitUnit() @Range/BaseAddress=%lx\n",Range->BaseAddress);
KDEBUG("XHCI::InitUnit() @Range/Size=%lx\n",Range->Size);
KDEBUG("XHCI::InitUnit() @Range/Physical=%lx\n",Range->Physical);
KDEBUG("XHCI::InitUnit() @Range/Flags=%lx\n",Range->Flags);
card->FreeResourceRange(Range);
}
unit->InterruptService.is_Data=unit;
unit->InterruptService.is_Code=(APTR)&HwInterruptService;
unit->uStack=Base->IExec->AllocVecTags(UNIT_STACK_SIZE,AVT_Type,MEMF_SHARED,AVT_ClearWithValue,0L,TAG_DONE,TAG_DONE);
if(unit->uStack)
{
unit->uTask.tc_IDNestCnt = -1L;
unit->uTask.tc_TDNestCnt = -1L;
unit->uTask.tc_SPReg = unit->uStack;
unit->uTask.tc_SPLower = unit->uStack;
unit->uTask.tc_SPUpper = (APTR)((uint32)UNIT_STACK_SIZE +(uint32)(unit->uStack));
Base->IExec->NewList(&unit->uTask.tc_MemEntry);
unit->uTask.tc_UserData=(APTR)unit;
// Base->IExec->AddTask(&unit->uTask, &ExecUnitTask, NULL, &unit->Attrs[0]);
if(Base->IExec->AddIntServer(card->MapInterrupt(),&unit->InterruptService))
KDEBUG("XHCI::InitUnit() @InterruptService = Mapped && Activated\n");
}
card->Unlock();
}
return;