DV 26 - Power Macintosh での ataManager の呼び出し (97 年 1 月 31 日)
Q: 現在、Power Macintosh コンピュータの ATA バスに対応したドライバを開発しています。しかし、われわれの ETO ディスクに対するリンクライブラリを見つけることができません。ヘッダライブラリはあるのですが、リンクすべきものが見つかりません。
A: 少なくとも、68K コードを書いているのなら、リンクすべきライブラリは用意されていません。Power Macintosh の ATA マネージャを使用する場合は、Mixed Mode グルーを作成して ataManager を呼び出す必要があります。これは次のようになります。
#include
#include
#define RESULT_OFFSET(type) ((sizeof(type) == 1) ? 3 : ((sizeof(type) == 2) ? 1 : 0))
#define TBTrapTableAddress(trapNum) (((trapNum & 0x03FF) << 2) + 0xE00)
pascal SInt16 ataManager(ataPB *pb)
{
#ifdef applec
#if sizeof(SInt16) > 4
#error "Result types larger than 4 bytes are not supported."
#endif
#endif
long private_result;
private_result =
CallUniversalProc(*(UniversalProcPtr*)TBTrapTableAddress(0xAAF1),
kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(pb))), pb);
return *(((SInt16*)&private_result) + RESULT_OFFSET(SInt16));
}
--Vinnie Moscaritolo
devsupport@apple.com
[ Technical Q&A's : Devices : DV26 ]
|