Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

canop.c File Reference

#include <canop.h>
#include <arbracan.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

Functions

void setupCanInterface (sInitParameter *pParameter)
BYTE canSend (BYTE notused, Message *m)
void closeCanInterface (void)
BYTE canReceive (BYTE notused, Message *m)

Variables

s_rx_buffer_message RAM canMessageRxBuffer [RX_CAN_BUFFER_SIZE]

Function Documentation

BYTE canReceive BYTE    notused,
Message   m
 

This message receives CAN-Messages. This function is platform dependent. If a message has been read, it returns 0. If no new message could be read, the return value is unequal to 0.

Parameters:
m  Here the incoming message data/cobid/rtr-flag/... are copied. The memory for this struct has to be allocated by the caller.
Returns :
0 on success, -1 on failure (this includes, thata no new messages has arrived)

BYTE canSend BYTE    notused,
Message   m
 

Sends a CAN-Message. This function is platform dependent and has to be implemented for every platform. Return 0 for success.

Parameters:
m  The pointer to the message struct. The memory has to be allocated by the caller, of course.
Returns :
0 on success, -1 on failure

void closeCanInterface void   
 

This function does make only sense on PC based systems, because there we have to close the connection to the CAN card. On microcontroller system this makes normally no sens.

void setupCanInterface sInitParameter   pParameter
 

This function sets up the CAN-Interface (baudrate and other neccessary settings) this function is platform dependent. Note: The memory for the message pointer has to be already allocated.

Parameters:
pParameter  The struct sInitParameter contains values needed for initialising the CAN-interface.


Variable Documentation

s_rx_buffer_message RAM canMessageRxBuffer[RX_CAN_BUFFER_SIZE]
 

this is the buffer, where all incoming can/canopen messages are stored a valid flag indicates wheter an entry is valid or not. if someone/thing reads/processes a message it must! set the valid flag to false!


Generated on Wed Dec 25 01:04:57 2002 for CANopen SlaveLib by doxygen1.2.17