I need some help converting a header file to hhf. I don't know how to declare the function prototypes properly.

#ifndef ADIO1600_H
#define ADIO1600_H

extern "C" __declspec(dllimport) unsigned short InPort(unsigned long Port);
extern "C" __declspec(dllimport) unsigned short InPortB(unsigned long Port);
extern "C" __declspec(dllimport) unsigned short OutPort(unsigned long Port, unsigned short Value);
extern "C" __declspec(dllimport) unsigned short OutPortB(unsigned long Port, unsigned char Value);

unsigned short VendorID;
unsigned short DeviceID;
unsigned short Command;
unsigned short Status;
unsigned char RevisionID;
unsigned char ProgIf;
unsigned char SubClass;
unsigned char BaseClass;
unsigned char CacheLineSize;
unsigned char LatencyTimer;
unsigned char HeaderType;
unsigned char BIST;
unsigned long BaseAddresses[6];
unsigned long Reserved1[2];
unsigned long RomBaseAddress;
unsigned long Reserved2[2];
unsigned char InterruptLine;
unsigned char InterruptPin;
unsigned char MinimumGrant;
unsigned char MaximumLatency;


Posted on 2004-01-15 23:45:31 by malone
You can try this :). I can't guarantee that you'll have no problems but at least its a start. You may also need to change the external names for the functions depending on which C compiler the dll was coded with also.


#if( ! @defined( ADIO1600_H ))
?ADIO1600_H := true;


procedure InPort
Port : uns32
returns( "ax" );
external( "_InPort@4" );

procedure InPortB
returns( "ax" );
external( "_InPortB@4" );

procedure OutPort
Port : uns32;
Value : uns16

returns( "ax" );
external( "_OutPort@6" );

procedure OutPortB
Port : uns32;
Value : char
returns( "ax" );
external( "_OutPortB@5" );

type TCPI_COMMON_CONFIG : record
VendorID : uns16;
DeviceID : uns16;
Command : uns16;
Status : uns16;
RevisionID : uns8;
ProgIf : uns8;
SubClass : uns8;
BaseClass : uns8;
CacheLineSize : uns8;
LatencyTimer : uns8;
HeaderType : uns8;
BIST : uns8;
BaseAddresses : uns32[6];
Reserved1 : uns32[2];
RomBaseAddress : uns32;
Reserved2 : uns32[2];
InterruptLine : uns8;
InterruptPin : uns8;
MinimumGrant : uns8;
MaximumLatency : uns8;

Posted on 2004-01-16 06:24:34 by Odyssey
If you haven't done so yet, take a look at Chapter Three of "Windows Programming in Assembly Language" entitled "The C-Assembly Connection".
This chapter contains a fair discussion of how to convert C constructs to HLA, specifically for the purpose of converting ".h" files to ".hhf" format.
Randy Hyde
Posted on 2004-01-16 10:26:48 by rhyde
Thanks for the help guys. I don't have the board in my pc at home, but hopefully I can try it out on Monday.

Posted on 2004-01-16 13:18:58 by malone