/**
* @file CM_Convert.h
* @brief 通用类型转换函数
* @author GT-BU
* @date 2021.02.01
* @version V1.1
* @copyright TCT
* @par 修改日志
* <table>
* <tr><th>Date        <th>Version  <th>Author     <th>Description
* <tr><td>2017.12.20  <td>V1.0     <td>MSCP项目组 <td>创建初始版本
* <tr><td>2021.02.01  <td>V1.1     <td>GT-BU      <td>TSCP项目集成、更新
* </table>
*/
#ifndef CM_CONVERT_H_
#define CM_CONVERT_H_

#include "CM_Types.h"

#ifdef __cplusplus
extern "C"
{
#endif

    /* 2字节变UINT16,大端*/
    CM_UINT16 CM_ShortFromChar(IN const CM_UINT8 data[]);

    /* 4字节变UINT32,大端*/
    CM_UINT32 CM_LongFromChar(IN const CM_UINT8 data[]);

    /* 8字节变UINT64,大端*/
    CM_UINT64 CM_64FromChar(IN const CM_UINT8 data[]);

    /* UINT16转字节,大端*/
    void CM_ShortToChar(IN const CM_UINT16 val, OUT CM_UINT8 pOutput[]);

    /* UINT32转字节,大端*/
    void CM_LongToChar(IN const CM_UINT32 val, OUT CM_UINT8 pOutput[]);

    /* UINT64转字节,大端*/
    void CM_64ToChar(IN CM_UINT64 val,OUT CM_UINT8 pOutput[]);
    /* 2字节变UINT16,小端*/
    CM_UINT16 CM_ShortFromCharLE(IN const CM_UINT8 data[]);

    /* 4字节变UINT32,小端*/
    CM_UINT32 CM_LongFromCharLE(IN const CM_UINT8 data[]);
    /* 8字节变UINT64,小端*/
    CM_UINT64 CM_64FromCharLE(IN const CM_UINT8 data[]);
    /* UINT16转字节,小端*/
    void CM_ShortToCharLE(IN const CM_UINT16 val, OUT CM_UINT8 pOutput[]);

    /* UINT32转字节,小端*/
    void CM_LongToCharLE(IN const CM_UINT32 val, OUT CM_UINT8 pOutput[]);

    /* UINT64转字节,小端*/
    void CM_64ToCharLE(IN CM_UINT64 val, OUT CM_UINT8 pOutput[]);
#ifdef __cplusplus
}
#endif

#endif
