@startuml

!include hal.uml

remove HAL.CoreTypes

namespace mppa256 {
	class Core {
		- pthread_t threads[]
		- pthread_mutex_t lock
		~ const int NR_CCLUSTER
		~ const int NR_IOCLUSTER
		~ const int NR_IOCLUSTER_CORES
		~ const int CCLUSTER0
		~ const int CCLUSTER1
		~ const int CCLUSTER2
		~ const int CCLUSTER3
		~ const int CCLUSTER4
		~ const int CCLUSTER5
		~ const int CCLUSTER6
		~ const int CCLUSTER7
		~ const int CCLUSTER8
		~ const int CCLUSTER9
		~ const int CCLUSTER10
		~ const int CCLUSTER11
		~ const int CCLUSTER12
		~ const int CCLUSTER13
		~ const int CCLUSTER14
		~ const int CCLUSTER15
		~ const int IOCLUSTER0
		~ const int IOCLUSTER1
		- void mppa256_core_lock(void)
		- void mppa256_core_unlock(void)
		~ int mppa256_is_ccluster(int)
		~ int mpp256_is_iocluster(int)
		~ int mppa256_get_cluster_id(void)
		~ void mppa256_core_setup(void)
		~ void mpp256_core_cleanup(void)
	}

	class NoC {
		~ const int NR_CCLUSTER_DMA
		~ const int NR_IOCLUSTER_DMA
		~ int noctag_mailbox(int)
		~ int noctag_sync(int)
		~ int noctag_portal(int)
		~ int noc_get_node_num(int)
		~ void noc_get_remotes(char *, int)
		~ void noc_get_names(char *, const int *, int)
		~ int noc_get_dma(int)
		~ int noc_is_ionode(int)
		~ int noc_is_ionode0(int)
		~ int noc_is_ionode1(int)
		~ int noc_is_cnode(int)
	}

	namespace UnnamedPortal {
		class PortalFlags {
			PORTAL_FLAGS_USED
			PORTAL_FLAGS_WRONLY
		}

		class Portal {
			- int flags
			~ int portal_fd
			~ int sync_fd
			~ int remote
			~ int local
			~ int portal_is_valid(int portalid)
			~ int portal_is_used(int portalid)
			~ int portal_is_wronly(int portalid)
			~ void portal_set_used(int portalid)
			~ void portal_set_wronly(int portalid)
			~  void portal_clear_flags(int portalid)
		}

		class PortalOperations {
			- int portal_alloc(void)
			- void portal_free(int portalid)
		}

		Portal               ..> PortalFlags            : <<use>>
		PortalOperations     ..> Portal                 : <<use>>
		PortalOperations "1" *-- "HAL_NR_PORTAL" Portal : portals
	}

	mppa256.Sync                           ..> NoC  : <<use>>
	mppa256.Mailbox                        ..> NoC  : <<use>>
	mppa256.UnnamedPortal.PortalOperations ..> NoC  : <<use>>
	mppa256.NoC                            ..> Core : <<use>>
	mppa256.Setup                          ..> Core : <<use>>
}

HAL.SetupInterface    <|.. mppa256.Setup                          : <<implements>>
HAL.NoCInterface      <|.. mppa256.NoC                            : <<implements>>
HAL.CoreInterface     <|.. mppa256.Core                           : <<implements>>
HAL.MailboxInterface  <|.. mppa256.Mailbox                        : <<implements>>
HAL.SyncInterface     <|.. mppa256.Sync                           : <<implements>>
HAL.PortalInterface   <|.. mppa256.UnnamedPortal.PortalOperations : <<implements>>

@enduml

