drivers/can_copcican_linux/co_pcicanops.h
author Robert Lehmann <robert.lehmann@sitec-systems.de>
Tue, 28 Jul 2015 16:36:55 +0200
changeset 793 72e9e1064432
parent 629 b9274b595650
permissions -rw-r--r--
timers_unix: Fix termination problem of WaitReceiveTaskEnd

The function pthread_kill sends the Signal thread and to the own process.
If you use this construct than the application which calls uses the
canfestival api will terminate at the call of canClose. To avoid that
use pthread_cancel instead of pthread_kill. To use the pthread_cancel call
you need to set the cancel ability in the thread function. That means
you need to call pthread_setcancelstate and pthread_setcanceltype.
For the termination of the thread at any time it is important to set the
cancel type to PTHREAD_CANCEL_ASYNCHRONOUS.
/*
This file is part of CanFestival, a library implementing CanOpen Stack.

Copyright (C): Cosateq GmbH & Co.KG
               http://www.cosateq.com/
               http://www.scale-rt.com/

See COPYING file for copyrights details.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

/*
	CAN driver interface for CO-PCICAN card.
*/

#ifndef _CO_PCICANOPS_
#define _CO_PCICANOPS_

#define NUM_CAN_CHANNELS 4

#define CMDQ_OPC_ENTER_RUN_MODE     0x01
#define CMDQ_OPC_ENTER_CONFIG_MODE  0x02
#define CMDQ_OPC_SET_CONFIG_CHANNEL 0xA2

typedef struct
{
  unsigned char opcode;
  unsigned long param[15];
} co_pcican_config_t;

typedef struct
{
  unsigned char channelnum;
  unsigned long type;
  unsigned long size;
  unsigned long id;
  unsigned char data[8];
  unsigned long timestamp_lo;
  unsigned long timestamp_hi;
} co_pcican_message_t;

/*=============================================================================
  supported operations
  ===========================================================================*/
#define CAN_CONFIG 2
#define CAN_WRITE  3
#define CAN_READ   4

/*=============================================================================
  directions
  ===========================================================================*/
#define RX         0
#define TX         1

/*=============================================================================
  supported types
  ===========================================================================*/
#define MSG_EXT    0x00000001
#define MSG_RTR    0x00000002



#endif