/*
 * oclh_h_srr.h
 *      Author: havock
 */

#ifndef OCLH_H_SRR_H_
#define OCLH_H_SRR_H_ 1
#include <oclh_hd_std_types.clh>
#include <oclh_h_ws_base.h>
#include <oclh_h_basetype_templates.h>

#define _OCLH_OCL_HOST_HEADERS_ 1
#include <oclh_hd_srr.clh>
#undef _OCLH_OCL_HOST_HEADERS_

typedef enum _GHE_SYNC_TYPE {
    _GHE_NO_SYNC          =0,
    _GHE_SYNC_HOST_TO_DEV =1,
    _GHE_SYNC_DEV_TO_HOST =2
} _GHE_SYNC_TYPE;

typedef int8_t   i8;
typedef uint8_t  u8;
typedef int16_t  i16;
typedef uint16_t u16;
typedef int32_t  i32;
typedef uint32_t u32;
typedef int64_t  i64;
typedef uint64_t u64;
typedef flt32_t  f32;
typedef flt64_t  f64;
typedef flt128_t  f128;

#pragma pack(push,1)
_GHM_BASETYPE_HD_DECLARATION(i8)
_GHM_BASETYPE_HD_DECLARATION(u8)
_GHM_BASETYPE_HD_DECLARATION(i16)
_GHM_BASETYPE_HD_DECLARATION(u16)
_GHM_BASETYPE_HD_DECLARATION(i32)
_GHM_BASETYPE_HD_DECLARATION(u32)
_GHM_BASETYPE_HD_DECLARATION(i64)
_GHM_BASETYPE_HD_DECLARATION(u64)
_GHM_BASETYPE_HD_DECLARATION(f32)
_GHM_BASETYPE_HD_DECLARATION(f64)
_GHM_BASETYPE_HD_DECLARATION(f128)
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _GHT_HOST_DEV_VOID_PTR {
	uint8_t* hPtr;
	cl_mem   dPtr;
	uint64_t u64NofBytes;
} _GHT_HDvoid;
#pragma pack(pop)
_GHT_HDvoid _ghf_declHD_void(void);
int32_t _ghf_wdcAllocHD_void(  _GHT_WRKSET wSet, _GHT_HDvoid* const pHdv,
                               const uint64_t u64NofBytes);
int32_t _ghf_wdcReAllocHD_void(_GHT_WRKSET wSet, const _GHE_SYNC_TYPE SyncType,
                               _GHT_HDvoid* const pHdv,
                               const uint64_t u64NofBytes);
int32_t _ghf_wdcSyncHD_void(   _GHT_WRKSET wSet, const _GHE_SYNC_TYPE SyncType,
                               _GHT_HDvoid* const pHdv);
int32_t _ghf_wdcFillHD_void(   _GHT_WRKSET wSet, _GHT_HDvoid* const pHdv,
                               const uint8_t u8Val);
int32_t _ghf_wipeHD_void(      _GHT_WRKSET wSet, _GHT_HDvoid* const pHdv);

#pragma pack(push,1)
typedef struct _GHT_HOST_DEV_VECS_FLT32 {
    _GHT_HDf32 hdf32V;
    uint64_t   u64Dim;
    uint64_t   u64SemDim;
} _GHT_HDVECS_F32;
#pragma pack(pop)
_GHT_HDVECS_F32 _ghf_declHDV_f32(void);
int32_t  _ghf_wdcAllocHDV_f32(_GHT_WRKSET wSet, _GHT_HDVECS_F32* const pVhdf32,
                              uint64_t u64Dim, const uint64_t u64SemDim,
                              const uint64_t u64NofVecs);
int32_t  _ghf_wdcSyncHDV_f32( _GHT_WRKSET wSet, const _GHE_SYNC_TYPE SyncType,
                              _GHT_HDVECS_F32* const pVhdf32);
int32_t  _ghf_wdcFillHDV_f32( _GHT_WRKSET wSet, _GHT_HDVECS_F32* const pVhdf32,
                              const flt32_t f32Val);
int32_t  _ghf_isHDV_f32_Valid(const _GHT_HDVECS_F32 Vhdf32);
uint64_t _ghf_getNofVecsHDV_f32(const _GHT_HDVECS_F32 Vhdf32);
int32_t  _ghf_saveHDV_f32_ToTxt(const _GHT_HDVECS_F32 vfVecs,
                                const char* const pcFileName,
                                const int32_t i32UseSemDimFlag);
int32_t  _ghf_saveHDV_f32_ToTxtByHD_u64_Idxs(const _GHT_HDVECS_F32 vfVecs,
                                             const _GHT_HDu64 hdu64IV,
                                             const char* const pcFileName,
                                             const int32_t i32UseSemDimFlag);
int32_t  _ghf_wipeHDV_f32(_GHT_WRKSET wSet, _GHT_HDVECS_F32* const pVhdf32);

#endif /* OCLH_H_SRR_H_ */

