namespace io.JLinkLib.lib

namespace lib {

// global functions

int cdecl JLINK_GetSN();
char cdecl JLINK_IsOpen();
char cdecl JLINK_IsHalted();

int cdecl JLINKARM_DEVICE_GetInfo(
    int DeviceIndex,
    io.JLINKARM_DEVICE_INFO thin* pDeviceInfo
);

char const thin* cdecl JLINK_Open();

char const thin* cdecl JLINK_OpenEx(
    io.JLINK_LOG thin* pfLog,
    io.JLINK_LOG thin* pfErrorOut
);

void cdecl JLINK_Close();
int cdecl JLINK_Connect();
void thin* cdecl JLINK_GetpFunc(io.JLINK_FUNC_INDEX FuncIndex);

int cdecl JLINK_ExecCommand(
    char const thin* pIn,
    char thin* pOut,
    int BufferSize
);

void cdecl JLINK_Go();
void cdecl JLINK_SetSpeed(io.U32 Speed);

char cdecl JLINK_SelectIP(
    char const thin* sHost,
    int Port
);

int cdecl JLINK_TIF_Select(int Interface);
int cdecl JLINK_EMU_SelectByUSBSN(io.U32 SerialNo);
int cdecl JLINK_EMU_GetNumConnections();

void cdecl JLINK_EMU_GetProductName(
    char thin* pBuffer,
    io.U32 BufferSize
);

int cdecl JLINK_RTTERMINAL_Control(
    io.U32 Cmd,
    void thin* p
);

int cdecl JLINK_RTTERMINAL_Read(
    io.U32 BufferIndex,
    char thin* sBuffer,
    io.U32 BufferSize
);

int cdecl JLINK_RTTERMINAL_Write(
    io.U32 BufferIndex,
    void const thin* sBuffer,
    io.U32 BufferSize
);

} // namespace lib