AutoDocs: exec errors & dicrepancies

Have a question about our Software Developer Kit? Ask them here.

AutoDocs: exec errors & dicrepancies

Postby OldFart » Mon Jan 30, 2012 8:47 pm

Chapter . . .: StartDMA

Section . . .: EXAMPLE

The example wrongly calls IExec->AllocSysObject() where it should call IExec->AllocSysObjectTags().
This allocation is with (struct DMAList *) cast to a non-existent structure. This cast should have been (struct DMAEntry *).
This allocation is then freed by a IExec->FreeVec(), where it should be freed by a call to IExec->FreeSysObject().

Here's the corrected example:


/*
** This example assumes you want to make a DMA write transfer to
** addr, size bytes
*/

ULONG endFlags = 0;

/*
** Tell the system to prepare for DMA
*/
ULONG arraySize = IExec->StartDMA(addr, size, 0);

if (arraySize != 0)
{
/*
** The memory area is prepared, allocate and retrieve the DMA list
*/
struct DMAEntry *DMAList = (struct DMAList *)IExec->AllocSysObjectTags(ASOT_DMAENTRY, ASODMAE_NumEntries, arraySize,
TAG_DONE);

if (DMAList)
{
IExec->GetDMAList(addr, size, 0, DMAList);
/*
** Feed the DMA controller and do stuff
*/
...
/*
** Get rid of the DMAList's memory
*/
IExec->FreeSysObject(ASOT_DMAENTRY, DMAList);
}
else
{
printf("Can't allocate DMA list\n");
endFlags |= DMAF_NoModify;
}

/*
** Note: We still call EndDMA even though the actual transfer
** didn't happen.
*/
IExec->EndDMA(addr, size, endFlags);
}
else
{
printf("Can't initiate DMA transfer\n");
}

===================================================================================================

Chapter . . .: Insert

Section . . .: FUNCTION

Current text:
Insert a node into a doubly linked list AFTER a given node
position. Insertion at the head of a list is possible by passing a
zero value for listNode, though the AddHead function is slightly
faster for that special case.

Proposed text:
Insert a node into a doubly linked list AFTER a given node
position. Insertion at the head of a list is possible by passing a
NULL value for listNode, though the AddHead function is slightly
faster for that special case.

===================================================================================================
Sleeping X5000, eagerly awaiting awakening
Dead MicroA1
A1200 in ElBox, c/w Blizzard '040 @ 50MHz + SCSI module, ZIV-board c/w (o.a.) cv64/3d + flickerdoubler + FastATA-ZIV + Lots of SCSI gear (for sale, willing to split)
RaspBerry Pi 2B, 3B & 4B (4Gb)
User avatar
OldFart
 
Posts: 54
Joined: Tue Jul 12, 2011 3:56 pm
Location: Groningen, Netherlands

Return to SDK Support

Who is online

Users browsing this forum: No registered users and 1 guest