Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

defines.h

Go to the documentation of this file.
00001 /*============================================================================*
00002  * FILE:                      defines.h
00003  *============================================================================*
00004  *
00005  *                      COPYRIGHT (C) 2006  BY
00006  *          CONDOR ENGINEERING, INC., SANTA BARBARA, CALIFORNIA
00007  *          ALL RIGHTS RESERVED.
00008  *
00009  *          THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND
00010  *          COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH
00011  *          THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY
00012  *          OTHER COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE
00013  *          AVAILABLE TO ANY OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE
00014  *          SOFTWARE IS HEREBY TRANSFERRED.
00015  *
00016  *          THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT
00017  *          NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY CONDOR
00018  *          ENGINEERING.
00019  *
00020  *============================================================================*
00021  *
00022  * FUNCTION:    Internal functions and constants for the CAN api
00023  *
00024  * Author:      Christopher McKenzie
00025  * 
00026  * MAINTENANCE NOTES:
00027  * 
00028  *============================================================================*/
00029 #ifndef _CACEDEFINES_H_
00030 #define _CACEDEFINES_H_
00031 //Don't *assume* this is big enough
00032 
00033 #define MAX_CARDS               48
00034 #define MAX_STACK               64
00035 
00036 enum
00037 {       B_SOF=0,
00038         B_ID,
00039         B_SRR,
00040         B_IDE,
00041         B_EXT,
00042         B_RTR,
00043         B_RES,
00044         B_DLC,
00045         B_DAT,
00046         B_CRC,
00047         B_ACK,
00048         B_EOF,
00049         B__MAX
00050 };
00051 
00052 #define maskMS "\x00\x80\xC0\xE0\xF0\xF8\xFC\xFE\xFF"
00053         //      0000 0000       00
00054         //      1000 0000       80
00055         //      1100 0000       C0
00056         //      1110 0000       E0
00057         //      1111 0000       F0
00058         //      1111 1000       F8
00059         //      1111 1100       FC
00060         //      1111 1110       FE
00061         //  1111 1111   FF
00062 
00063 #define maskLS "\x00\x01\x03\x07\x0F\x1F\x3F\x7F\xFF"
00064         //      0000 0000       00
00065         //      0000 0001       01
00066         //      0000 0011       03
00067         //      0000 0111       07
00068         //      0000 1111       0F
00069         //      0001 1111       1F
00070         //      0011 1111       3F
00071         //      0111 1111       7F
00072         //  1111 1111   FF
00073 enum
00074 {       LEFT,
00075         RIGHT
00076 };
00077 
00078 #define _GETBYTE(n)     (n>>3)
00079 #define _GETBIT(n)      (n-(_GETBYTE(n)<<3))
00080 
00081 #define _BYTES2BIT(byte,bit)    \
00082                         (_GETBYTE(byte)+bit)
00083 
00084 #define GRABBIT(data,bit) (maskLS[9-bit]&data)>>bit
00085 
00086 #define SETERROR(n)             channel[handle].error.last=n
00087 //useful functions
00088 int _stdcall rightshifteverything(
00089                                                 unsigned char*from,
00090                                                 int distance,
00091                                                 int size);
00092 
00093 int _stdcall setatbit(
00094                                 unsigned char*structure,
00095                                 unsigned char*toset,
00096                                 int start,
00097                                 int size);
00098 
00099 int _stdcall getatbit(
00100                                 unsigned char*structure,
00101                                 unsigned char*toset,
00102                                 int start,
00103                                 int size);
00104 #endif

Generated on Wed Feb 22 13:31:25 2006 for CANapi by  doxygen 1.4.4