![]() |
USB2XXX 1.2
USB2XXX接口函数说明文档
|
USB转SENT接口函数和数据类型定义 更多...
结构体 | |
struct | _SENT_CONFIG |
struct | _SENT_MSG |
函数 | |
int WINAPI | SENT_Init (int DevHandle, unsigned char Channel, SENT_CONFIG *pConfig) |
初始化配置SENT总线,必须调用,否则无法正常工作 更多... | |
int WINAPI | SENT_SetTickTime (int DevHandle, unsigned char Channel, double TickTimeUs) |
配置SENT总线Tick时间 更多... | |
int WINAPI | SENT_SendMsg (int DevHandle, unsigned char Channel, SENT_MSG *pSentMsg, unsigned int MsgNum) |
主机模式下手动发送SENT消息 更多... | |
int WINAPI | SENT_StartFastMsgTable (int DevHandle, unsigned char Channel, SENT_MSG *pSentMsg, unsigned int MsgNum, unsigned int SendTimes) |
设置并启动SENT快速通道帧发送列表 更多... | |
int WINAPI | SENT_UpdateFastMsgTable (int DevHandle, unsigned char Channel, unsigned char StartMsgIndex, SENT_MSG *pSentMsg, unsigned int MsgNum) |
更新SENT快速通道发送列表中的帧 更多... | |
int WINAPI | SENT_StopFastMsgTable (int DevHandle, unsigned char Channel) |
停止正在发送的SENT帧列表 更多... | |
int WINAPI | SENT_StartSPCMsgTable (int DevHandle, unsigned char Channel, SENT_MSG *pSentMsg, unsigned int MsgNum, unsigned int SendTimes) |
设置并启动SENT SPC帧发送列表 更多... | |
int WINAPI | SENT_UpdateSPCMsgTable (int DevHandle, unsigned char Channel, unsigned char StartMsgIndex, SENT_MSG *pSentMsg, unsigned int MsgNum) |
更新SENT SPC快速通道发送列表中的帧 更多... | |
int WINAPI | SENT_StopSPCMsgTable (int DevHandle, unsigned char Channel) |
停止正在发送的SENT帧列表 更多... | |
int WINAPI | SENT_StartSlowMsgTable (int DevHandle, unsigned char Channel, SENT_MSG *pSentMsg, unsigned int MsgNum, unsigned int SendTimes) |
设置并启动SENT慢速通道帧发送列表,调用该函数后数据不会立即发送,它是在发送快速数据的时候才通过Status域发送,所以需要发送慢速通道帧数据,需要同时启动快速帧发送列表 更多... | |
int WINAPI | SENT_UpdateSlowMsgTable (int DevHandle, unsigned char Channel, unsigned char StartMsgIndex, SENT_MSG *pSentMsg, unsigned int MsgNum) |
更新慢速通道发送列表中的帧 更多... | |
int WINAPI | SENT_StopSlowMsgTable (int DevHandle, unsigned char Channel) |
停止正在发送的SENT帧列表 更多... | |
int WINAPI | SENT_GetMsg (int DevHandle, unsigned char Channel, SENT_MSG *pSentMsg) |
主机模式获取已发成功发送出去的帧,从机模式获取监控到的帧 更多... | |
int WINAPI | SENT_GetMsgWithSize (int DevHandle, unsigned char Channel, SENT_MSG *pSentMsg, unsigned int BufSize) |
主机模式获取已发成功发送出去的帧,从机模式获取监控到的帧 更多... | |
long long WINAPI | SENT_GetStartTime (int DevHandle, unsigned char Channel) |
获取SENT起始时间戳,该时间戳可以转换成实际的时间 更多... | |
int WINAPI | SENT_ResetStartTime (int DevHandle, unsigned char Channel) |
复位时间戳,复位后起始时间戳为当前时间 更多... | |
int WINAPI | SENT_Stop (int DevHandle, unsigned char Channel) |
停止SENT总线功能 更多... | |
int WINAPI | SENT_MsgDecode (unsigned char DataFormat, SENT_MSG *pSentMsg, int MsgNum, unsigned int *pDataCh1, unsigned int *pDataCh2) |
将快速通道原始SENT数据解析成实际数据,注意只解析快速通道帧数据 更多... | |
int WINAPI | SENT_MsgDecodeEx (unsigned char DataFormat, SENT_MSG *pSentMsg, int MsgNum, unsigned int *pDataCh1, unsigned int *pDataCh2, unsigned char *pFC, unsigned char *pDCC) |
将快速通道原始SENT数据解析成实际数据,注意只解析快速通道帧数据 更多... | |
SENT帧数据格式 | |
SENT帧数据格式定义 | |
enum | SENT_DATA_FORMATS { H0 = 0 , H1 , H2 , H3 , H4 , H5 , H6 , H7 , F1_1 , F1_2 , F1_3 , F1_4 , F1_5 , F1_6 , F2_1 , F2_2 , F2_3 , F2_4 , F3_1 , F3_2 , F3_3 , F3_4 , F3_5 , F4_1 , F4_2 , F4_3 , F4_4 , F4_5 , F4_6 , F4_7 , F4_8 , F4_9 } |
SENT初始化结构体 | |
SENT初始化结构定义 | |
typedef struct _SENT_CONFIG | SENT_CONFIG |
SENT帧结构体 | |
SENT帧结构体定义 | |
typedef struct _SENT_MSG | SENT_MSG |
SENT主从模式 | |
SENT主从模式宏定义 | |
#define | SENT_MASTER 1 |
主机模式,用于模拟主节点发送数据 | |
#define | SENT_SLAVE 0 |
从机模式,用于监控SENT主机发送出来的数据 | |
#define | SENT_SPC 0x80 |
使能SPC模式 | |
#define | SENT_SPC_SLAVE_TX 0x40 |
使能SPC从机模式发送数据 | |
SENT总线空闲电平 | |
SENT空闲模式下总线电平 | |
#define | SENT_IDLE_HIGH 1 |
总线空闲时为高电平,数据输出低电平脉冲 | |
#define | SENT_IDLE_LOW 0 |
总线空闲时为低电平,数据输出高电平脉冲 | |
USB转SENT接口函数和数据类型定义
enum SENT_DATA_FORMATS |
int WINAPI SENT_Init | ( | int | DevHandle, |
unsigned char | Channel, | ||
SENT_CONFIG * | pConfig | ||
) |
初始化配置SENT总线,必须调用,否则无法正常工作
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 | |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 | |
[in] | pConfig | 初始化结构体,可以参考 SENT初始化结构定义 查看参数详情 |
=0 | 函数执行成功 |
!=0 | 函数执行失败 |
int WINAPI SENT_SetTickTime | ( | int | DevHandle, |
unsigned char | Channel, | ||
double | TickTimeUs | ||
) |
配置SENT总线Tick时间
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
TickTimeUs | Tick时间,单位为us |
=0 | 函数执行成功 |
!=0 | 函数执行失败 |
int WINAPI SENT_SendMsg | ( | int | DevHandle, |
unsigned char | Channel, | ||
SENT_MSG * | pSentMsg, | ||
unsigned int | MsgNum | ||
) |
主机模式下手动发送SENT消息
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 | |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 | |
[in] | pSentMsg | SENT消息帧指针 |
MsgNum | 发送的SENT消息帧数,不能大于64帧 |
=0 | 函数执行成功 |
!=0 | 函数执行失败 |
int WINAPI SENT_StartFastMsgTable | ( | int | DevHandle, |
unsigned char | Channel, | ||
SENT_MSG * | pSentMsg, | ||
unsigned int | MsgNum, | ||
unsigned int | SendTimes | ||
) |
设置并启动SENT快速通道帧发送列表
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
pSentMsg | SENT快速通道消息帧指针 |
MsgNum | 发送的SENT消息帧数,不能大于64帧 |
SendTimes | 列表循环发送次数,若设置为0xFFFFFFFF则一直循环发送列表,直到调用 SENT_StopFastMsgTable 函数为止 |
=0 | 函数执行成功 |
!=0 | 函数执行失败 |
int WINAPI SENT_UpdateFastMsgTable | ( | int | DevHandle, |
unsigned char | Channel, | ||
unsigned char | StartMsgIndex, | ||
SENT_MSG * | pSentMsg, | ||
unsigned int | MsgNum | ||
) |
更新SENT快速通道发送列表中的帧
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
StartMsgIndex | 需要开始更新的起始帧索引,如果该索引大于原来列表大小,则将更新的帧添加到列表后面 |
pSentMsg | SENT快速通道消息帧指针 |
MsgNum | 更新的SENT消息帧数,不能大于64帧 |
int WINAPI SENT_StopFastMsgTable | ( | int | DevHandle, |
unsigned char | Channel | ||
) |
停止正在发送的SENT帧列表
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
=0 | 函数执行成功 |
!=0 | 函数执行失败 |
int WINAPI SENT_StartSPCMsgTable | ( | int | DevHandle, |
unsigned char | Channel, | ||
SENT_MSG * | pSentMsg, | ||
unsigned int | MsgNum, | ||
unsigned int | SendTimes | ||
) |
设置并启动SENT SPC帧发送列表
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
pSentMsg | SENT快速通道消息帧指针 |
MsgNum | 发送的SENT消息帧数,不能大于64帧 |
SendTimes | 列表循环发送次数,若设置为0xFFFFFFFF则一直循环发送列表,直到调用 SENT_StopSPCMsgTable 函数为止 |
=0 | 函数执行成功 |
!=0 | 函数执行失败 |
int WINAPI SENT_UpdateSPCMsgTable | ( | int | DevHandle, |
unsigned char | Channel, | ||
unsigned char | StartMsgIndex, | ||
SENT_MSG * | pSentMsg, | ||
unsigned int | MsgNum | ||
) |
更新SENT SPC快速通道发送列表中的帧
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
StartMsgIndex | 需要开始更新的起始帧索引,如果该索引大于原来列表大小,则将更新的帧添加到列表后面 |
pSentMsg | SENT快速通道消息帧指针 |
MsgNum | 更新的SENT消息帧数,不能大于64帧 |
int WINAPI SENT_StopSPCMsgTable | ( | int | DevHandle, |
unsigned char | Channel | ||
) |
停止正在发送的SENT帧列表
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
=0 | 函数执行成功 |
!=0 | 函数执行失败 |
int WINAPI SENT_StartSlowMsgTable | ( | int | DevHandle, |
unsigned char | Channel, | ||
SENT_MSG * | pSentMsg, | ||
unsigned int | MsgNum, | ||
unsigned int | SendTimes | ||
) |
设置并启动SENT慢速通道帧发送列表,调用该函数后数据不会立即发送,它是在发送快速数据的时候才通过Status域发送,所以需要发送慢速通道帧数据,需要同时启动快速帧发送列表
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
pSentMsg | SENT慢速通道消息帧指针 |
MsgNum | 发送的SENT消息帧数,不能大于64帧 |
SendTimes | 列表循环发送次数,若设置为0xFFFFFFFF则一直循环发送列表,直到调用 SENT_StopSlowMsgTable 函数为止 |
int WINAPI SENT_UpdateSlowMsgTable | ( | int | DevHandle, |
unsigned char | Channel, | ||
unsigned char | StartMsgIndex, | ||
SENT_MSG * | pSentMsg, | ||
unsigned int | MsgNum | ||
) |
更新慢速通道发送列表中的帧
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
StartMsgIndex | 需要开始更新的起始帧索引,如果该索引大于原来列表大小,则将更新的帧添加到列表后面 |
pSentMsg | SENT慢速通道消息帧指针 |
MsgNum | 更新的SENT消息帧数,不能大于64帧 |
int WINAPI SENT_StopSlowMsgTable | ( | int | DevHandle, |
unsigned char | Channel | ||
) |
停止正在发送的SENT帧列表
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
=0 | 函数执行成功 |
!=0 | 函数执行失败 |
int WINAPI SENT_GetMsg | ( | int | DevHandle, |
unsigned char | Channel, | ||
SENT_MSG * | pSentMsg | ||
) |
主机模式获取已发成功发送出去的帧,从机模式获取监控到的帧
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
pSentMsg | 存储SENT帧缓冲区指针,该缓冲区不能小于64,否则可能会出现缓冲区溢出导致程序异常闪退 |
<0 | 函数执行失败 |
int WINAPI SENT_GetMsgWithSize | ( | int | DevHandle, |
unsigned char | Channel, | ||
SENT_MSG * | pSentMsg, | ||
unsigned int | BufSize | ||
) |
主机模式获取已发成功发送出去的帧,从机模式获取监控到的帧
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4,SENT总线在硬件上是跟LIN总线共用的 |
pSentMsg | 存储SENT帧缓冲区指针 |
BufSize | 存储数据的缓存区大小 |
<0 | 函数执行失败 |
long long WINAPI SENT_GetStartTime | ( | int | DevHandle, |
unsigned char | Channel | ||
) |
获取SENT起始时间戳,该时间戳可以转换成实际的时间
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4 |
<0 | 函数调用失败 |
int WINAPI SENT_ResetStartTime | ( | int | DevHandle, |
unsigned char | Channel | ||
) |
复位时间戳,复位后起始时间戳为当前时间
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4 |
<0 | 函数调用失败 |
int WINAPI SENT_Stop | ( | int | DevHandle, |
unsigned char | Channel | ||
) |
停止SENT总线功能
DevHandle | 设备号,通过调用 USB_ScanDevice 获取 |
Channel | SENT通道号,0-SENT1,1-SENT2,2-SENT3,3-SENT4 |
<0 | 函数调用失败 |
int WINAPI SENT_MsgDecode | ( | unsigned char | DataFormat, |
SENT_MSG * | pSentMsg, | ||
int | MsgNum, | ||
unsigned int * | pDataCh1, | ||
unsigned int * | pDataCh2 | ||
) |
将快速通道原始SENT数据解析成实际数据,注意只解析快速通道帧数据
DataFormat | 数据格式定义,只支持H1到H7格式数据 |
pSentMsg | SENT帧缓冲区首地址 |
MsgNum | 需要进行解析的帧数 |
pDataCh1 | 解析出的快速通道1数据 |
pDataCh2 | 解析出的快速通道2数据 |
>=0 | 成功解析到的快速通道数据帧数 |
<0 | 函数调用失败 |
int WINAPI SENT_MsgDecodeEx | ( | unsigned char | DataFormat, |
SENT_MSG * | pSentMsg, | ||
int | MsgNum, | ||
unsigned int * | pDataCh1, | ||
unsigned int * | pDataCh2, | ||
unsigned char * | pFC, | ||
unsigned char * | pDCC | ||
) |
将快速通道原始SENT数据解析成实际数据,注意只解析快速通道帧数据
DataFormat | 数据格式定义,支持所有格式数据 |
pSentMsg | SENT帧缓冲区首地址 |
MsgNum | 需要进行解析的帧数 |
pDataCh1 | 解析出的快速通道1数据 |
pDataCh2 | 解析出的快速通道2数据 |
pFC | 数据格式为F1_1及以上时输出的对应FC(Frame Control)数据 |
pDCC | 数据格式为F1_1及以上时输出的对应DCC(Data Consistency Counter)数据 |
>=0 | 成功解析到的快速通道数据帧数 |
<0 | 函数调用失败 |