]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/staging/slicoss/slic_os.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
[linux-2.6-omap-h63xx.git] / drivers / staging / slicoss / slic_os.h
1 /**************************************************************************
2  *
3  * Copyright (c)2000-2002 Alacritech, Inc.  All rights reserved.
4  *
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above
13  *    copyright notice, this list of conditions and the following
14  *    disclaimer in the documentation and/or other materials provided
15  *    with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY ALACRITECH, INC. ``AS IS'' AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ALACRITECH, INC. OR
21  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  * The views and conclusions contained in the software and documentation
31  * are those of the authors and should not be interpreted as representing
32  * official policies, either expressed or implied, of Alacritech, Inc.
33  *
34  **************************************************************************/
35
36 /*
37  * FILENAME: slic_os.h
38  *
39  * These are the Linux-specific definitions required for the SLICOSS
40  * driver, which should allow for greater portability to other OSes.
41  */
42 #ifndef _SLIC_OS_SPECIFIC_H_
43 #define _SLIC_OS_SPECIFIC_H_
44
45 #define FALSE               (0)
46 #define TRUE                (1)
47
48 #define SLIC_SECS_TO_JIFFS(x)  ((x) * HZ)
49 #define SLIC_MS_TO_JIFFIES(x)  (SLIC_SECS_TO_JIFFS((x)) / 1000)
50
51 #ifdef DEBUG_REGISTER_TRACE
52 #define WRITE_REG(reg, value, flush)                                      \
53         {                                                           \
54                 adapter->card->reg_type[adapter->card->debug_ix] = 0;   \
55                 adapter->card->reg_offset[adapter->card->debug_ix] = \
56                 ((unsigned char *)(&reg)) - \
57                 ((unsigned char *)adapter->slic_regs); \
58                 adapter->card->reg_value[adapter->card->debug_ix++] = value;  \
59                 if (adapter->card->debug_ix == 32) \
60                         adapter->card->debug_ix = 0;                      \
61                 slic_reg32_write((&reg), (value), (flush));            \
62         }
63 #define WRITE_REG64(a, reg, value, regh, valh, flush)                        \
64         {                                                           \
65                 adapter->card->reg_type[adapter->card->debug_ix] = 1;        \
66                 adapter->card->reg_offset[adapter->card->debug_ix] = \
67                 ((unsigned char *)(&reg)) - \
68                 ((unsigned char *)adapter->slic_regs); \
69                 adapter->card->reg_value[adapter->card->debug_ix] = value;   \
70                 adapter->card->reg_valueh[adapter->card->debug_ix++] = valh;  \
71                 if (adapter->card->debug_ix == 32) \
72                         adapter->card->debug_ix = 0;                      \
73                 slic_reg64_write((a), (&reg), (value), (&regh), (valh), \
74                                 (flush));\
75         }
76 #else
77 #define WRITE_REG(reg, value, flush) \
78         slic_reg32_write((&reg), (value), (flush))
79 #define WRITE_REG64(a, reg, value, regh, valh, flush) \
80         slic_reg64_write((a), (&reg), (value), (&regh), (valh), (flush))
81 #endif
82
83 #endif  /* _SLIC_OS_SPECIFIC_H_  */
84