summaryrefslogtreecommitdiff
path: root/arch/arm/common/rvidcc_config.h
blob: faabe1db1b5975433fac7d457e11b664b299cd02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/* 
   Copyright (C) 2004-2007 ARM Limited.

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License version 2
   as published by the Free Software Foundation.

   This program 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 General Public License for more details.

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

   As a special exception, if other files instantiate templates or use macros
   or inline functions from this file, or you compile this file and link it
   with other works to produce a work based on this file, this file does not
   by itself cause the resulting work to be covered by the GNU General Public
   License. However the source code for this file must still be made available
   in accordance with section (3) of the GNU General Public License.

   This exception does not invalidate any other reasons why a work based on
   this file might be covered by the GNU General Public License.
*/

#ifndef RVIDCC_CONFIG_H
#define RVIDCC_CONFIG_H

/*
 *
 * Platform headers that define basic types (e.g. size_t)
 * ------------------------------------------------------
 * 
 */
#include <linux/types.h>
#include <linux/netdevice.h>


/*
 * Put any platform specific definitions required by the interrupt macros here
 * ---------------------------------------------------------------------------
 */

/* Structure containing our internal state, etc. */
struct dccconfig
{
  unsigned int rx_interrupt;
  unsigned int tx_interrupt;
  unsigned long timer_poll_period;
  int use_timer_poll;

  volatile unsigned long irq_disable;
};

extern struct dccconfig dcc_config;


/*
 * Configuration
 * -------------
 */

/*
 * Define which ARM cores this binary is to be used on
 *  - RVIDCC_ARM79 for all ARM 7 and ARM 9 based cores
 *  - RVIDCC_ARM10 for all ARM 10 cores
 *  - RVIDCC_ARM11 for all ARM 11 and later cores (including Cortex)
 */
#define RVIDCC_ARM79
#define RVIDCC_ARM10
#define RVIDCC_ARM11

/*
 * Define RVIDCC_OUTBUF_DATA if the OS needs to check if all pending data
 * has been sent out to the ICE.
 */
#define RVIDCC_OUTBUF_DATA

/*
 * Define RVIDCC_RAW if the virtual ethernet functionality is not required.  See
 * rvidcc.c for more information.
 */
#ifdef CONFIG_DEBUG_DCC_RAW
#define RVIDCC_RAW
#endif

/*
 * Define RVIDCC_BIG_ENDIAN if your platform is big endian.
 */
#ifdef CONFIG_CPU_BIG_ENDIAN
#define RVIDCC_BIG_ENDIAN
#endif

/*
 * Define RVIDCC_SCAN_INPUT_FOR if the OS needs to peek ahead in the TTY data
 */
#ifdef CONFIG_DEBUG_DCC_KGDB
#define RVIDCC_SCAN_INPUT_FOR
#endif

/*
 * RVIDCC_BUFSIZE defines the size of the input and output buffers for DCC data
 */
#ifndef RVIDCC_BUFSIZE
#ifdef RVIDCC_RAW
#define RVIDCC_BUFSIZE 4096
#else
#define RVIDCC_BUFSIZE 8192
#endif
#endif

/*
 * RVIDCC_MAX_INLINE_POLLS defines the number of times to the driver should
 * check if the host is ready for more data in rvidcc_write or if the host has
 * sent more data in rvidcc_read.  Increasing this value may improve the data
 * transfer rate, but will increase the length of time spent in the interrupt
 * handler.  Adjust this value according to the performance and latency
 * requirements of the system.
 */
#define RVIDCC_MAX_INLINE_POLLS 500

/*
 * Interrupt configuration
 *
 * Define macros here to enable and disable interrupts.  If the OS uses
 * polling instead of interrupts, define as empty.
 *
 */

#define RVIDCC_ENABLE_INTERRUPTS

#define RVIDCC_DISABLE_INTERRUPTS

/* Interrupt control macros */
#define RVIDCC_ENABLE_WRITE_INTERRUPT do {                \
    if (!dcc_config.use_timer_poll) {                     \
      if (test_and_clear_bit(0, &dcc_config.irq_disable)) \
        enable_irq(dcc_config.tx_interrupt);              \
    }                                                   \
  } while(0)

#define RVIDCC_DISABLE_WRITE_INTERRUPT do {             \
    if (!dcc_config.use_timer_poll) {                     \
      if (!test_and_set_bit(0, &dcc_config.irq_disable))  \
        disable_irq(dcc_config.tx_interrupt);             \
    }                                                   \
  } while(0)

#define RVIDCC_ENABLE_READ_INTERRUPT do {               \
    if (!dcc_config.use_timer_poll) {                     \
      if (test_and_clear_bit(1, &dcc_config.irq_disable)) \
        enable_irq(dcc_config.rx_interrupt);              \
    }                                                   \
  } while(0)

#define RVIDCC_DISABLE_READ_INTERRUPT do {              \
    if (!dcc_config.use_timer_poll) {                     \
      if (!test_and_set_bit(1, &dcc_config.irq_disable))  \
        disable_irq(dcc_config.rx_interrupt);             \
    }                                                   \
  } while(0)


#endif /* RVIDCC_CONFIG_H */