source: trunk/Cosy/incl/icanconf.h@ 17976

Last change on this file since 17976 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 3.7 KB
Line 
1/*-----------------------------------------------------------------------------
2icanconf.h -- ICANOS specific definitions
3
4Copyright (c) 1994 JANZ Computer AG
5All Rights Reserved
6
7Created 94/10/11 by Soenke Hansen
8Version 1.16 of 99/06/23
9
10Declarations and definitions of functions and macros:
11 - disable/enable CAN and clock interrupts
12 - start/stop a periodical timer
13 - read/write registers in Basic CAN controller
14The conditionally included files i8051.h and mc68332.h contain
15examples for the Intel 8051 and Motorola 68332 micro-controller
16families, respectively.
17
18Some definitions in bcan.h depend on the oscillator frequency used
19for the Basic CAN controller. Currently only definitions for a 16 MHz
20oscillator are given. These are activated by defining OSC_16MHZ here.
21
22Memory allocation functions:
23 - malloc() and free()
24If these functions are not available from a system library the
25functions implemented in malloc.c are used if OUR_MALLOC==1.
26These functions allocate memory from a fixed size array.
27The length of this array in bytes is given by MALLOC_BYTES.
28The data type ALIGN_t is used to insure that malloc returns addresses
29which are correctly aligned for every data type.
30
31-----------------------------------------------------------------------------*/
32
33#ifndef icanconf_DEFINED
34#define icanconf_DEFINED
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/* Load the user configuration */
41#include "config.h"
42
43/* Intel 8051 family with Archimedes C-51 compiler */
44#ifdef i8051
45#include "i8051.h"
46#endif
47
48/* Motorola 68332 with Microtec Research C compiler */
49#ifdef mc68332
50#include "mc68332.h"
51#endif
52
53/* Implementation options */
54#ifndef ICAN_ECHO
55#define ICAN_ECHO 1 /* with local transmit echo if == 1 */
56#endif
57#ifndef ICAN_FILTER
58#define ICAN_FILTER 1 /* with acceptance filtering if == 1 */
59#endif
60
61/* Set maximum CAN send queue length. */
62#ifndef TX_QUEUE_LEN
63#define TX_QUEUE_LEN 20
64#endif
65
66/* Define this if a 16 MHz oscillator is used for BCAN */
67#define OSC_16MHZ
68
69/*------- Memory allocation ------------------------------------------------*/
70
71/* If OUR_MALLOC is !=0 then malloc() and fre() as implemented in
72 malloc.c are used else the system library functions are used.
73 By default our functions are used. */
74#ifndef OUR_MALLOC
75#define OUR_MALLOC 0 /* if true, use our malloc and free */
76#endif
77
78/* Memory management */
79#if OUR_MALLOC == 1 /* using our malloc and free? */
80
81#ifndef MALLOC_BYTES
82#define MALLOC_BYTES 8000 /* size in bytes of alloc array */
83#endif
84typedef int ALIGN_t; /* alignment type */
85
86/* Memory is allocated from an array of blocks of type HEADER */
87union header { /* free block header */
88 struct {
89 union header *ptr; /* next free block */
90 unsigned size; /* size of this free block */
91 } s;
92 ALIGN_t x; /* force alignment of blocks */
93};
94
95typedef union header HEADER;
96
97/* Maximum number of blocks */
98#define MALLOC_BLOCKS (MALLOC_BYTES/sizeof(HEADER)+1)
99
100extern void init_malloc(); /* initialization of alloc array */
101extern void *malloc(); /* well known function */
102extern void free(); /* well known function */
103extern int check_free_mem(); /* check for free memory */
104
105#else /* use malloc and free of system library */
106#include <stdlib.h>
107#define init_malloc()
108#endif
109#define FREE(p) if ((p)) free((void *)p)
110
111
112/*------- Debugging tools (for development at JANZ only) -------------------*/
113
114#ifndef DEBUG
115#define DEBUG 0 /* default: no debugging */
116#endif
117
118/* Logging */
119#if DEBUG>0
120#include "debug.h"
121#else
122#define PRINTF(args)
123#define LOG(level, args)
124#define DESPAIR
125#endif
126
127#ifndef BIGBOX
128#ifdef GDBDEBUG
129#include "userIf.h"
130#else
131#define KPRINTF(X)
132#endif
133#endif
134
135/* Dummies */
136#if DEBUG==1
137#include "simul.h"
138#endif
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif /* !icanconf_DEFINED */
Note: See TracBrowser for help on using the repository browser.