82 WaitForSingleObject(pAnaGatePort->hFesticalRecAcknowledge,INFINITE); |
82 WaitForSingleObject(pAnaGatePort->hFesticalRecAcknowledge,INFINITE); |
83 } |
83 } |
84 |
84 |
85 |
85 |
86 /*********functions which permit to communicate with the board****************/ |
86 /*********functions which permit to communicate with the board****************/ |
87 UNS8 canReceive_driver(CAN_HANDLE fd0, Message *m) |
87 UNS8 __stdcall canReceive_driver(CAN_HANDLE fd0, Message *m) |
88 { |
88 { |
89 SAnaGatePort* pAnaGatePort = (SAnaGatePort*)fd0; |
89 SAnaGatePort* pAnaGatePort = (SAnaGatePort*)fd0; |
90 int i; |
90 int i; |
91 |
91 |
92 WaitForSingleObject( // Wait for receive event |
92 WaitForSingleObject( // Wait for receive event |
150 |
150 |
151 return 0x0000; |
151 return 0x0000; |
152 } |
152 } |
153 /****************************************************************************/ |
153 /****************************************************************************/ |
154 |
154 |
155 UNS8 canChangeBaudRate_driver( CAN_HANDLE fd0, char* baud) |
155 UNS8 __stdcall canChangeBaudRate_driver( CAN_HANDLE fd0, char* baud) |
156 { |
156 { |
157 int nRetCode; |
157 int nRetCode; |
158 char cErrorMsg[100]; |
158 char cErrorMsg[100]; |
159 struct SAnaGatePort* pAnaGatePort = (struct SAnaGatePort*)fd0; |
159 struct SAnaGatePort* pAnaGatePort = (struct SAnaGatePort*)fd0; |
160 |
160 |
161 if (nRetCode = CANSetGlobals (pAnaGatePort->hHandle, TranslateBaudeRate(baud), 0, 0, 1) ) |
161 if (nRetCode = CANSetGlobals (pAnaGatePort->hHandle, TranslateBaudeRate(baud), 0, 0, 1, 0) ) |
162 { |
162 { |
163 CANErrorMessage( nRetCode, cErrorMsg ,100 ); // Convert returncode to error messge |
163 CANErrorMessage( nRetCode, cErrorMsg ,100 ); // Convert returncode to error messge |
164 fprintf(stderr, "canChangeBaudRate_drive (AnaGate_Win32): %s\n", cErrorMsg); |
164 fprintf(stderr, "canChangeBaudRate_drive (AnaGate_Win32): %s\n", cErrorMsg); |
165 printf("canChangeBaudRate_drive (AnaGate_Win32): %s\n", cErrorMsg); |
165 printf("canChangeBaudRate_drive (AnaGate_Win32): %s\n", cErrorMsg); |
166 return 1; |
166 return 1; |
246 // Inizial Baudrate |
246 // Inizial Baudrate |
247 if (nRetCode = CANSetGlobals (pNewAnaGatePort->hHandle, |
247 if (nRetCode = CANSetGlobals (pNewAnaGatePort->hHandle, |
248 TranslateBaudeRate(board->baudrate), |
248 TranslateBaudeRate(board->baudrate), |
249 0,/*OperatingMode = normal*/ |
249 0,/*OperatingMode = normal*/ |
250 0,/*CAN-Termination = off*/ |
250 0,/*CAN-Termination = off*/ |
251 1 /*HighSpeedMode = on*/) ) |
251 1, /*HighSpeedMode = on*/ |
|
252 0 /*Timestamps = off*/) ) |
252 { |
253 { |
253 CANErrorMessage( nRetCode, cErrorMsg ,100 ); // Convert returncode to error messge |
254 CANErrorMessage( nRetCode, cErrorMsg ,100 ); // Convert returncode to error messge |
254 fprintf(stderr, "canOpen_driver (AnaGate_Win32): %s @ %s\n", cErrorMsg,sIPAddress); |
255 fprintf(stderr, "canOpen_driver (AnaGate_Win32): %s @ %s\n", cErrorMsg,sIPAddress); |
255 //printf("canOpen_driver (AnaGate_Win32): %s @ %s\n", cErrorMsg,sIPAddress); |
256 //printf("canOpen_driver (AnaGate_Win32): %s @ %s\n", cErrorMsg,sIPAddress); |
256 return (CAN_HANDLE) NULL; |
257 return (CAN_HANDLE) NULL; |