#ifndef BKAPI_H
#define BKAPI_H

/* BlizKick EXTRES buffer api - bkapi header file

   Written by Harry "Piru" Sintonen, Jan 2000.
   Public Domain.
*/


#include <exec/types.h>
#include <exec/memory.h>
#include <exec/semaphores.h>
#include <exec/resident.h>

#include "myregargs.h"

#define BKA_MemoryInsane 0x0042000C  /* Sanity check on memory header failed */

typedef enum { ERH_API_V1 = 1
             } ERHVER;

struct bkerhss {
  struct SignalSemaphore ss;
  ULONG  version;              /* currently ERH_API_V1 */
  UWORD  unused0;              /* must be null for now */
  struct MemHeader *mh;        /* pointer to MemHeader of EXTRES buffer */
  /* furure fields here...*/
};

ULONG er_init(void);
void * ASM er_alloc(REG(d0,ULONG));
void * __saveds ASM er_allocmem(REG(d0,ULONG), REG(d1,ULONG));
void __saveds ASM er_free(REG(a1,void *), REG(d0,ULONG));
void * ASM er_allocvec(REG(d0,ULONG), REG(d1,ULONG));
void ASM er_freevec(REG(a1,void *));
void ASM er_lock(void);
void ASM er_unlock(void);
ULONG ASM er_getarea(REG(a0,ULONG *));
ULONG ASM er_availmem(REG(d1,ULONG));
struct Resident * ASM er_nextresident(REG(a0,struct Resident *));
struct Resident * ASM er_findresident(REG(a1,STRPTR));

#endif /* BKAPI_H */
