00001
00040 #if !CAN_API_FILE_HEADER_INCLUDE
00041 #define CAN_API_FILE_HEADER_INCLUDE
00042
00043 #if _MSC_VER > 1000
00044 #pragma once
00045 #endif // _MSC_VER > 1000
00046
00047 struct can_api;
00048
00049
00050
00056 struct can_api_send_thread
00057 {
00058 HANDLE hThread;
00059 unsigned long dwDelay;
00060 ISRInfo isrCAN;
00061 struct can_api *pMain;
00062 int id;
00063 int stop;
00064 struct can_api_send_thread *pNext;
00065 };
00066
00067
00068
00069
00070
00076 struct can_api
00077 {
00078 HANDLE hDevice;
00079 HWND hWnd;
00080 HANDLE hThread;
00081 HANDLE hBusLoadThread;
00082 volatile int iStopThread;
00083 HANDLE hSignal;
00084 int iMode;
00085 int iFormat;
00086 int dwTimeMultiplier;
00087 int iShowMessages;
00088 void *pUserData;
00089 unsigned long dwAccessCode;
00100 unsigned long dwAccessMask;
00111 unsigned long dwBaudrate;
00112 unsigned long dwDataLost;
00113 unsigned long dwOldTime;
00114 unsigned long dwStartTime;
00115 volatile double statistikTime;
00116 volatile unsigned long statistikBits;
00117 volatile double statistikBusload;
00124 CANPARINFO info;
00125 int (*events)(struct can_api* c, double absTime, double relTime, ISRInfo *i);
00126 struct can_api_send_thread *pThread;
00127 };
00128
00129
00130
00131
00132 #ifdef __cplusplus
00133 extern "C" {
00134 #endif
00135
00136
00137
00138
00171 extern struct can_api * WINAPI canInit(HWND hParent, const void *pUserData,int (*events)(struct can_api* c, double absTime, double relTime, ISRInfo *i));
00172
00173
00174
00181 extern void WINAPI canDeInit(struct can_api *c);
00182
00183
00184
00185
00214 extern int WINAPI canOpenDevice(struct can_api *c, const char *pDevName, int mode, int format, DWORD *pErr);
00215
00216
00217
00218
00227 extern void WINAPI canCloseDevice(struct can_api *c);
00228
00229
00230
00231
00242 extern void WINAPI canExtendedFrames(struct can_api *c, int format);
00243
00244
00245
00246
00254 extern unsigned char WINAPI canGetRegisterRR1(struct can_api *c, unsigned char nIndex);
00255
00256
00257
00258
00265 extern void WINAPI canSetRegisterRR1(struct can_api *c, unsigned char nIndex, unsigned char nNewValue);
00266
00267
00268
00269
00277 extern unsigned char WINAPI canGetRegister(struct can_api *c, unsigned char nIndex);
00278
00279
00280
00281
00288 extern void WINAPI canSetRegister(struct can_api *c, unsigned char nIndex, unsigned char nNewValue);
00289
00290
00291
00292
00303 extern int WINAPI canTransmitDataByISR(struct can_api *c, struct ISRInfo *isr);
00304
00305
00306
00307
00323 extern int WINAPI canTransmitData(struct can_api *c, unsigned long id, int rtr, int dlc, unsigned char* data);
00324
00325
00326
00327
00334 extern unsigned char WINAPI canGetSJA1000Status(struct can_api *c);
00335
00336
00337
00338
00348 extern int WINAPI canSetSJA1000Command(struct can_api *c, unsigned char command);
00349
00350
00351
00352
00372 extern int WINAPI canAcceptanceCodeMask(struct can_api *c, unsigned long code, unsigned long mask);
00373
00374
00375
00376
00398 extern int WINAPI canAcceptanceFilter(struct can_api *c, unsigned long code, unsigned long mask);
00399
00400
00401
00402
00413 extern int WINAPI canSetBaudrate(struct can_api *c, unsigned long baudrate);
00414
00415
00416
00417
00422 extern void WINAPI canResetTime(struct can_api *c);
00423
00424
00425
00426
00439 extern long WINAPI canGetTime(struct can_api *c);
00440
00441
00442
00443
00450 extern long WINAPI canGetLostDataMsg(struct can_api *c);
00451
00452
00453
00454
00465 extern double WINAPI canGetBusLoad(struct can_api *c);
00466
00467
00468
00469
00479 extern void WINAPI canSetLostDataMsg(struct can_api *c, long nNewValue);
00480
00481
00482
00483
00494 extern void WINAPI canShowMessages(struct can_api *c, int on_off);
00495
00496
00497
00498
00510 extern int WINAPI canDeleteTransmitThread(struct can_api *c, int threadId);
00511
00512
00513
00514
00522 extern void WINAPI canDeleteAllTransmitThreads(struct can_api *c);
00523
00524
00525
00526
00547 extern int WINAPI canAddTransmitThread(struct can_api *c, int threadId, unsigned long canId, int rtr, int dlc, unsigned char *data, unsigned long delay);
00548
00549
00550
00551
00552
00553
00566 extern int WINAPI canIsDeviceOpened(struct can_api *c);
00567
00568 #ifdef __cplusplus
00569 }
00570 #endif
00571
00572
00573 #endif // CAN_API_FILE_HEADER_INCLUDE