#ifndef SM502GFX_HIDD_H
#define SM502GFX_HIDD_H

/*
    Copyright © 1995-2026, The AROS Development Team. All rights reserved.
    $Id$

    Desc: Some SM502Gfx useful data.
    Lang: English.
*/

#include <exec/interrupts.h>
#include <exec/semaphores.h>
#include <exec/memory.h>
#include <exec/nodes.h>
#include <exec/types.h>

#include "sm502gfx_bitmap.h"
#include "sm502gfx_support.h"

#define CLID_Hidd_Gfx_SM502 "hidd.gfx.sm502"
#define CLID_Hidd_Display_SM502 "hidd.display.sm502"

struct SM502Gfx_data
{
    struct Interrupt ResetInterrupt;
};

struct SM502GfxDisplayData
{
};

#define ATTRBASES_NUM 8

struct SM502Gfx_staticdata
{
    OOP_Class 	    	    *basebm;            /* baseclass for CreateObject */

    OOP_Class 	    	    *sm502gfxclass;
    OOP_Class 	    	    *sm502gfxdisplayclass;
    OOP_Class 	    	    *bmclass;
    OOP_Object      	    *sm502gfxhidd;
    OOP_Object      	    *sm502gfxdisplay;
    OOP_Object      	    *dmenum;
    OOP_Object       	    *visible;		/* Currently visible bitmap */
    struct SM502_HWData      data;
    struct SignalSemaphore  framebufferlock;
    struct SignalSemaphore  HW_acc;
    OOP_AttrBase	    attrBases[ATTRBASES_NUM];
};

struct SM502GfxBase
{
    struct Library library;
    struct SM502Gfx_staticdata vsd;
};

#define LOCK_FRAMEBUFFER(xsd)	ObtainSemaphore(&xsd->framebufferlock)
#define UNLOCK_FRAMEBUFFER(xsd) ReleaseSemaphore(&xsd->framebufferlock)

#define XSD(cl)	(&((struct SM502GfxBase *)cl->UserData)->vsd)

#undef HiddChunkyBMAttrBase
#undef HiddBitMapAttrBase
#undef HiddGfxAttrBase
#undef HiddDisplayAttrBase
#undef HiddDMEnumAttrBase
#undef HiddPixFmtAttrBase
#undef HiddSyncAttrBase
#undef HiddAttrBase

/* These must stay in the same order as interfaces[] array in sm502gfx_init.c */
#define HiddChunkyBMAttrBase	  XSD(cl)->attrBases[0]
#define HiddBitMapAttrBase	  XSD(cl)->attrBases[1]
#define HiddGfxAttrBase		  XSD(cl)->attrBases[2]
#define HiddPixFmtAttrBase	  XSD(cl)->attrBases[3]
#define HiddSyncAttrBase	  XSD(cl)->attrBases[4]
#define HiddAttrBase		  XSD(cl)->attrBases[5]
#define HiddDisplayAttrBase	  XSD(cl)->attrBases[6]
#define HiddDMEnumAttrBase	  XSD(cl)->attrBases[7]

#endif /* SM502GFX_HIDD_H */
