drivers/can_peak_win32/can_peak_win32.c
author lbessard
Wed, 21 Jun 2006 08:31:34 +0200
changeset 39 3e94ee906bc6
parent 38 9b5bb1dcb4f5
child 41 e70439f50539
permissions -rw-r--r--
Add incremented index in Add Map Variable
Remove jaxe from makefile and configure
38
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
     1
/*
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
     3
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
     5
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
     7
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    12
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    17
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    21
*/
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    22
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    23
#include <stdio.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    24
#include <string.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    25
#include <stdlib.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    26
#include <errno.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    27
#include <stddef.h> /* for NULL */
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    28
#include <sys/ioctl.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    29
#include <fcntl.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    30
#include <signal.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    31
#include <sys/time.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    32
#include <unistd.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    33
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    34
/* driver pcan pci for Peak board */
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    35
//#include "libpcan.h"
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    36
//#include "pcan.h"
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    37
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    38
#include <applicfg.h>
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    39
#include "timer.h"
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    40
#include "can_driver.h"
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    41
#include "timers_driver.h"
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    42
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    43
#define MAX_NB_CAN_PORTS 1
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    44
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    45
typedef struct {
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    46
  char used;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    47
  TASK_HANDLE receiveTask;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    48
  CO_Data* d;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    49
} CANPort;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    50
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    51
CANPort canports[MAX_NB_CAN_PORTS] = {{0,},};
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    52
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    53
// Define for rtr CAN message
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    54
#define CAN_INIT_TYPE_ST_RTR MSGTYPE_STANDARD | MSGTYPE_RTR 
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    55
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    56
/*********functions which permit to communicate with the board****************/
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    57
UNS8 canReceive(CAN_HANDLE fd0, Message *m)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    58
{
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    59
  UNS8 data; 
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    60
  TPCANMsg peakMsg;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    61
  if ((errno = CAN_Read(& peakMsg))) {		// Blocks until no new message or error.
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    62
    perror("!!! Peak board : error of reading. (from f_can_receive function) \n");
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    63
    return 1;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    64
  }
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    65
  m->cob_id.w = peakMsg.ID;   
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    66
  if (peakMsg.MSGTYPE == CAN_INIT_TYPE_ST)         	/* bits of MSGTYPE_*/
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    67
    m->rtr = 0;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    68
  else 
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    69
    m->rtr = 1;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    70
  m->len = peakMsg.LEN;					/* count of data bytes (0..8) */
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    71
  for(data = 0  ; data < peakMsg.LEN ; data++)             			
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    72
    m->data[data] = peakMsg.DATA[data];         	/* data bytes, up to 8 */
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    73
  
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    74
  return 0;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    75
}
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    76
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    77
void canReceiveLoop(CAN_HANDLE fd0)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    78
{
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    79
	CO_Data* d = ((CANPort*)fd0)->d;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    80
	Message m;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    81
	while (1) {
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    82
		if(!canReceive(fd0, &m))
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    83
		{
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    84
			EnterMutex();
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    85
			canDispatch(d, &m);
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    86
			LeaveMutex();
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    87
		}else{
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    88
//			printf("canReceive returned error\n");
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    89
			break;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    90
		}
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    91
	}
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    92
}
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    93
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    94
/***************************************************************************/
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    95
UNS8 canSend(CAN_HANDLE fd0, Message *m)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    96
{
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    97
  UNS8 data;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    98
  TPCANMsg peakMsg;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
    99
  peakMsg.ID=m -> cob_id.w;              			/* 11/29 bit code */
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   100
  if(m->rtr == 0)	
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   101
    peakMsg.MSGTYPE = CAN_INIT_TYPE_ST;       /* bits of MSGTYPE_*/
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   102
  else {
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   103
    peakMsg.MSGTYPE = CAN_INIT_TYPE_ST_RTR;       /* bits of MSGTYPE_*/
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   104
  }
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   105
  peakMsg.LEN = m->len;   
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   106
          			/* count of data bytes (0..8) */
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   107
  for(data = 0 ; data <  m->len; data ++)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   108
  	peakMsg.DATA[data] = m->data[data];         	/* data bytes, up to 8 */
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   109
  
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   110
  if((errno = CAN_Write(& peakMsg))) {
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   111
    perror("!!! Peak board : error of writing. (from canSend function) \n");
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   112
    return 1;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   113
  }
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   114
  return 0;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   115
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   116
}
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   117
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   118
/***************************************************************************/
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   119
CAN_HANDLE canOpen(s_BOARD *board)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   120
{
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   121
  HANDLE fd0 = NULL;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   122
  char busname[64];
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   123
  char* pEnd;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   124
  int i;  
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   125
  
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   126
  for(i=0; i < MAX_NB_CAN_PORTS; i++)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   127
  {
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   128
  	if(!canports[i].used)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   129
	  	break;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   130
  }
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   131
  if(canports[i].used)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   132
  {
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   133
  	perror("can_peak_win32.c: no more can port available with this pcan library\n");
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   134
  	perror("can_peak_win32.c: please link another executable with another pcan lib\n");
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   135
  	return NULL;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   136
  }
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   137
//  if(strtol(board->busname, &pEnd,0) >= 0)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   138
//  {
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   139
//    sprintf(busname,"/dev/pcan%s",board->busname);
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   140
//    fd0 = LINUX_CAN_Open(busname, O_RDWR);
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   141
//  }
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   142
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   143
  if (i==MAX_NB_CAN_PORTS || fd0 == NULL)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   144
    {
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   145
      fprintf (stderr, "Open failed.\n");
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   146
      return (CAN_HANDLE)NULL;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   147
    }
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   148
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   149
   CAN_Init(board->baudrate, CAN_INIT_TYPE_ST);
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   150
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   151
   canports[i].used = 1;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   152
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   153
   canports[i].d = board->d;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   154
   CreateReceiveTask((CANPort*) &canports[i], &canports[i].receiveTask);
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   155
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   156
   return (CANPort*) &canports[i];
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   157
}
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   158
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   159
/***************************************************************************/
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   160
int canClose(CAN_HANDLE fd0)
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   161
{
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   162
  CAN_Close();
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   163
  ((CANPort*)fd0)->used = 0;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   164
  WaitReceiveTaskEnd(&((CANPort*)fd0)->receiveTask);
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   165
  return 0;
9b5bb1dcb4f5 Cygwin port. Still untested. Compiles and link.
etisserant
parents:
diff changeset
   166
}