#ifndef VMUSBSTACK_H
#define VMUSBSTACK_H
#define CMD_WRITE 0x000
#define CMD_READ 0x100
#define CMD_A24 0x039
#define CMD_A32 0x009
#define CMD_HM 0x80000
#define CMD_HD 0x20000
#define CMD_MRK 0x2000
#define CMD_DLY 0x8000
#define CMD_BLT 0xFF000000
#define CMD_D16 1
#define CMD_D32 0
void VmUsbStackInit();
void VmUsbStackClear();
#define VmUsbStackReadA24D16( ADDR ) VmUsbStackAppend(CMD_READ | CMD_A24 , CMD_D16 | (ADDR) )
#define VmUsbStackReadA24D32( ADDR ) VmUsbStackAppend(CMD_READ | CMD_A24 , CMD_D32 | (ADDR) )
#define VmUsbStackReadA32D16( ADDR ) VmUsbStackAppend(CMD_READ | CMD_A32 , CMD_D16 | (ADDR) )
#define VmUsbStackReadA32D32( ADDR ) VmUsbStackAppend(CMD_READ | CMD_A32 , CMD_D32 | (ADDR) )
#define VmUsbStackWriteA24D16( ADDR, DATA) VmUsbStackAppendData(CMD_WRITE | CMD_A24,CMD_D16 | (ADDR), (DATA))
#define VmUsbStackWriteA24D32( ADDR, DATA) VmUsbStackAppendData(CMD_WRITE | CMD_A24,CMD_D32 | (ADDR), (DATA))
#define VmUsbStackWriteA32D16( ADDR, DATA) VmUsbStackAppendData(CMD_WRITE | CMD_A32,CMD_D16 | (ADDR), (DATA))
#define VmUsbStackWriteA32D32( ADDR, DATA) VmUsbStackAppendData(CMD_WRITE | CMD_A32,CMD_D32 | (ADDR), (DATA))
#define VmUsbStackMarker(MRK) VmUsbStackAppend(CMD_MRK, (MRK))
void VmUsbStackAppend(int cmd, int marker);
void VmUsbStackAppendData(int cmd, int addr, int data);
void VmUsbStackConditionalRead(int am ,int d16d32,int addr, int data);
void VmUsbStackMultiRead(int addr_modifier,int d16d32, int baseaddr, int n, int increment);
void VmUsbStackMultiWrite(int addr_modifier,int d16d32, int baseaddr, int n, int increment, int data);
int VmUsbStackGet(int maxn, int *stack);
void VmUsbStackPrint();
#endif