summaryrefslogtreecommitdiffstats
path: root/drivers/isdn/eicon/linsys.c
blob: 3f167ed7bbf64915003c5af76aadb5fd953d4e63 (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
167
168
169
170

/*
 *
 * Copyright (C) Eicon Technology Corporation, 2000.
 *
 * This source file is supplied for the exclusive use with Eicon
 * Technology Corporation's range of DIVA Server Adapters.
 *
 * Eicon File Revision :    1.10  
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY 
 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */


#include <linux/sched.h>
#undef N_DATA
#include <linux/tqueue.h>

#include <linux/smp.h>
struct pt_regs;
#include <linux/interrupt.h>
#include <linux/ioport.h>

#include "sys.h"
#include "divas.h"
#include "adapter.h"
#include "divalog.h"

#include "uxio.h"

#ifdef MODULE
void bcopy(void *pSource, void *pDest, dword dwLength)
{
	memcpy(pDest, pSource, dwLength);
}
#endif

void bzero(void *pDataArea, dword dwLength)
{
	memset(pDataArea, 0, dwLength);
}

int Divas4BRIInitPCI(card_t *card, dia_card_t *cfg)
{
	/* Use UxPciConfigWrite	routines to initialise PCI config space */

/*	wPCIcommand = 0x03;
	cm_write_devconfig16(CMKey, PCI_COMMAND, &wPCIcommand);

	wPCIcommand = 0x280;
	cm_write_devconfig16(CMKey, PCI_STATUS, &wPCIcommand);

	bPCIcommand = 0x30;
	cm_write_devconfig16(CMKey, PCI_STATUS, &wPCIcommand);
*/
	return 0; 
}

int DivasPRIInitPCI(card_t *card, dia_card_t *cfg)
{
	/* Use UxPciConfigWrite	routines to initialise PCI config space */

/*		wPCIcommand = 0x03;
	cm_write_devconfig16(CMKey, PCI_COMMAND, &wPCIcommand);
	
	wPCIcommand = 0x280;
	cm_write_devconfig16(CMKey, PCI_STATUS, &wPCIcommand);
	
	bPCIcommand = 0x30;
	cm_write_devconfig8(CMKey, PCI_LATENCY, &bPCIcommand);*/

	return 0;  
}

int DivasBRIInitPCI(card_t *card, dia_card_t *cfg)
{
	/* Need to set these platform dependent values after patching */

	card->hw->reset_base = card->cfg.reset_base;
	card->hw->io_base = card->cfg.io_base;

	request_region(card->hw->reset_base,0x80,"Divas");
	request_region(card->hw->io_base,0x20,"Divas");


	/* Same as for PRI */
	return DivasPRIInitPCI(card, cfg);
}

/* ######################### Stubs of routines that are not done yet ################## */
/*void DivasLogIdi(card_t *card, ENTITY *e, int request)
{
}
*/

int	DivasDpcSchedule(void)
{
	static	struct tq_struct DivasTask;

	DivasTask.routine = DivasDoDpc;
	DivasTask.data = (void *) 0;

	queue_task(&DivasTask, &tq_immediate);
	mark_bh(IMMEDIATE_BH);

	return 0;
}

int	DivasScheduleRequestDpc(void)
{
	static	struct tq_struct DivasTask;

	DivasTask.routine = DivasDoRequestDpc;
	DivasTask.data = (void *) 0;

	queue_task(&DivasTask, &tq_immediate);
	mark_bh(IMMEDIATE_BH);

	return 0;
}

void    DivasLogAdd(void *buffer, int length)
{
    static
    boolean_t   overflow = FALSE;
    static
    boolean_t   busy = FALSE;

    /* make sure we're not interrupting ourselves */

    if (busy)
    {
        printk(KERN_DEBUG "Divas: Logging interrupting self !\n");
        return;
    }
    busy = TRUE;

    /* ignore call if daemon isn't running and we've reached limit */

    if (DivasLogFifoFull())
    {
        if (!overflow)
        {
            printk(KERN_DEBUG "Divas: Trace buffer full\n");
            overflow = TRUE;
        }
        busy = FALSE;
        return;
    }

	DivasLogFifoWrite(buffer, length);

    busy = FALSE;
    return;
}

/* #################################################################################### */