added some more headers from pcmcia-cs
fixed the build for non haiku platforms git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15569 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* bus_ops.h 1.12 2001/08/24 12:16:12
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License
|
||||
* at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is David A. Hinds
|
||||
* <[email protected]>. Portions created by David A. Hinds
|
||||
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU General Public License version 2 (the "GPL"), in
|
||||
* which case the provisions of the GPL are applicable instead of the
|
||||
* above. If you wish to allow the use of your version of this file
|
||||
* only under the terms of the GPL and not to allow others to use
|
||||
* your version of this file under the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice and
|
||||
* other provisions required by the GPL. If you do not delete the
|
||||
* provisions above, a recipient may use your version of this file
|
||||
* under either the MPL or the GPL.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_BUS_OPS_H
|
||||
#define _LINUX_BUS_OPS_H
|
||||
|
||||
#include <linux/config.h>
|
||||
|
||||
#ifdef CONFIG_VIRTUAL_BUS
|
||||
|
||||
typedef struct bus_operations {
|
||||
void *priv;
|
||||
u32 (*b_in)(void *bus, u32 port, s32 sz);
|
||||
void (*b_ins)(void *bus, u32 port, void *buf,
|
||||
u32 count, s32 sz);
|
||||
void (*b_out)(void *bus, u32 val, u32 port, s32 sz);
|
||||
void (*b_outs)(void *bus, u32 port, void *buf,
|
||||
u32 count, s32 sz);
|
||||
void *(*b_ioremap)(void *bus, u_long ofs, u_long sz);
|
||||
void (*b_iounmap)(void *bus, void *addr);
|
||||
u32 (*b_read)(void *bus, void *addr, s32 sz);
|
||||
void (*b_write)(void *bus, u32 val, void *addr, s32 sz);
|
||||
void (*b_copy_from)(void *bus, void *d, void *s, u32 count);
|
||||
void (*b_copy_to)(void *bus, void *d, void *s, u32 count);
|
||||
int (*b_request_irq)(void *bus, u_int irq,
|
||||
void (*handler)(int, void *,
|
||||
struct pt_regs *),
|
||||
u_long flags, const char *device,
|
||||
void *dev_id);
|
||||
void (*b_free_irq)(void *bus, u_int irq, void *dev_id);
|
||||
} bus_operations;
|
||||
|
||||
#define bus_inb(b,p) (b)->b_in((b),(p),0)
|
||||
#define bus_inw(b,p) (b)->b_in((b),(p),1)
|
||||
#define bus_inl(b,p) (b)->b_in((b),(p),2)
|
||||
#define bus_inw_ns(b,p) (b)->b_in((b),(p),-1)
|
||||
#define bus_inl_ns(b,p) (b)->b_in((b),(p),-2)
|
||||
|
||||
#define bus_insb(b,p,a,c) (b)->b_ins((b),(p),(a),(c),0)
|
||||
#define bus_insw(b,p,a,c) (b)->b_ins((b),(p),(a),(c),1)
|
||||
#define bus_insl(b,p,a,c) (b)->b_ins((b),(p),(a),(c),2)
|
||||
#define bus_insw_ns(b,p,a,c) (b)->b_ins((b),(p),(a),(c),-1)
|
||||
#define bus_insl_ns(b,p,a,c) (b)->b_ins((b),(p),(a),(c),-2)
|
||||
|
||||
#define bus_outb(b,v,p) (b)->b_out((b),(v),(p),0)
|
||||
#define bus_outw(b,v,p) (b)->b_out((b),(v),(p),1)
|
||||
#define bus_outl(b,v,p) (b)->b_out((b),(v),(p),2)
|
||||
#define bus_outw_ns(b,v,p) (b)->b_out((b),(v),(p),-1)
|
||||
#define bus_outl_ns(b,v,p) (b)->b_out((b),(v),(p),-2)
|
||||
|
||||
#define bus_outsb(b,p,a,c) (b)->b_outs((b),(p),(a),(c),0)
|
||||
#define bus_outsw(b,p,a,c) (b)->b_outs((b),(p),(a),(c),1)
|
||||
#define bus_outsl(b,p,a,c) (b)->b_outs((b),(p),(a),(c),2)
|
||||
#define bus_outsw_ns(b,p,a,c) (b)->b_outs((b),(p),(a),(c),-1)
|
||||
#define bus_outsl_ns(b,p,a,c) (b)->b_outs((b),(p),(a),(c),-2)
|
||||
|
||||
#define bus_readb(b,a) (b)->b_read((b),(a),0)
|
||||
#define bus_readw(b,a) (b)->b_read((b),(a),1)
|
||||
#define bus_readl(b,a) (b)->b_read((b),(a),2)
|
||||
#define bus_readw_ns(b,a) (b)->b_read((b),(a),-1)
|
||||
#define bus_readl_ns(b,a) (b)->b_read((b),(a),-2)
|
||||
|
||||
#define bus_writeb(b,v,a) (b)->b_write((b),(v),(a),0)
|
||||
#define bus_writew(b,v,a) (b)->b_write((b),(v),(a),1)
|
||||
#define bus_writel(b,v,a) (b)->b_write((b),(v),(a),2)
|
||||
#define bus_writew_ns(b,v,a) (b)->b_write((b),(v),(a),-1)
|
||||
#define bus_writel_ns(b,v,a) (b)->b_write((b),(v),(a),-2)
|
||||
|
||||
#define bus_ioremap(b,s,n) (b)->b_ioremap((b),(s),(n))
|
||||
#define bus_iounmap(b,a) (b)->b_iounmap((b),(a))
|
||||
#define bus_memcpy_fromio(b,d,s,n) (b)->b_copy_from((b),(d),(s),(n))
|
||||
#define bus_memcpy_toio(b,d,s,n) (b)->b_copy_to((b),(d),(s),(n))
|
||||
|
||||
#define bus_request_irq(b,i,h,f,n,d) \
|
||||
(b)->b_request_irq((b),(i),(h),(f),(n),(d))
|
||||
#define bus_free_irq(b,i,d) (b)->b_free_irq((b),(i),(d))
|
||||
|
||||
#else
|
||||
|
||||
#define bus_inb(b,p) inb(p)
|
||||
#define bus_inw(b,p) inw(p)
|
||||
#define bus_inl(b,p) inl(p)
|
||||
#define bus_inw_ns(b,p) inw_ns(p)
|
||||
#define bus_inl_ns(b,p) inl_ns(p)
|
||||
|
||||
#define bus_insb(b,p,a,c) insb(p,a,c)
|
||||
#define bus_insw(b,p,a,c) insw(p,a,c)
|
||||
#define bus_insl(b,p,a,c) insl(p,a,c)
|
||||
#define bus_insw_ns(b,p,a,c) insw_ns(p,a,c)
|
||||
#define bus_insl_ns(b,p,a,c) insl_ns(p,a,c)
|
||||
|
||||
#define bus_outb(b,v,p) outb(b,v,p)
|
||||
#define bus_outw(b,v,p) outw(b,v,p)
|
||||
#define bus_outl(b,v,p) outl(b,v,p)
|
||||
#define bus_outw_ns(b,v,p) outw_ns(b,v,p)
|
||||
#define bus_outl_ns(b,v,p) outl_ns(b,v,p)
|
||||
|
||||
#define bus_outsb(b,p,a,c) outsb(p,a,c)
|
||||
#define bus_outsw(b,p,a,c) outsw(p,a,c)
|
||||
#define bus_outsl(b,p,a,c) outsl(p,a,c)
|
||||
#define bus_outsw_ns(b,p,a,c) outsw_ns(p,a,c)
|
||||
#define bus_outsl_ns(b,p,a,c) outsl_ns(p,a,c)
|
||||
|
||||
#define bus_readb(b,a) readb(a)
|
||||
#define bus_readw(b,a) readw(a)
|
||||
#define bus_readl(b,a) readl(a)
|
||||
#define bus_readw_ns(b,a) readw_ns(a)
|
||||
#define bus_readl_ns(b,a) readl_ns(a)
|
||||
|
||||
#define bus_writeb(b,v,a) writeb(v,a)
|
||||
#define bus_writew(b,v,a) writew(v,a)
|
||||
#define bus_writel(b,v,a) writel(v,a)
|
||||
#define bus_writew_ns(b,v,a) writew_ns(v,a)
|
||||
#define bus_writel_ns(b,v,a) writel_ns(v,a)
|
||||
|
||||
#define bus_ioremap(b,s,n) ioremap(s,n)
|
||||
#define bus_iounmap(b,a) iounmap(a)
|
||||
#define bus_memcpy_fromio(b,d,s,n) memcpy_fromio(d,s,n)
|
||||
#define bus_memcpy_toio(b,d,s,n) memcpy_toio(d,s,n)
|
||||
|
||||
#ifdef CONFIG_8xx
|
||||
#define bus_request_irq(b,i,h,f,n,d) request_8xxirq((i),(h),(f),(n),(d))
|
||||
#else
|
||||
#define bus_request_irq(b,i,h,f,n,d) request_irq((i),(h),(f),(n),(d))
|
||||
#endif
|
||||
|
||||
#define bus_free_irq(b,i,d) free_irq((i),(d))
|
||||
|
||||
#endif /* CONFIG_VIRTUAL_BUS */
|
||||
|
||||
#endif /* _LINUX_BUS_OPS_H */
|
||||
@@ -0,0 +1,52 @@
|
||||
#ifndef _CB_ENABLER_H
|
||||
#define _CB_ENABLER_H
|
||||
|
||||
#define __KERNEL__
|
||||
|
||||
#include <pcmcia/config.h>
|
||||
#include <pcmcia/k_compat.h>
|
||||
|
||||
#include <pcmcia/version.h>
|
||||
#include <pcmcia/cs_types.h>
|
||||
#include <pcmcia/cs.h>
|
||||
#include <pcmcia/cistpl.h>
|
||||
#include <pcmcia/ds.h>
|
||||
|
||||
#undef __KERNEL__
|
||||
|
||||
#include <PCI.h>
|
||||
|
||||
#define CB_ENABLER_MODULE_NAME "bus_managers/cb_enabler/v0"
|
||||
|
||||
typedef struct cb_device_descriptor cb_device_descriptor;
|
||||
typedef struct cb_notify_hooks cb_notify_hooks;
|
||||
typedef struct cb_enabler_module_info cb_enabler_module_info;
|
||||
|
||||
struct cb_device_descriptor
|
||||
{
|
||||
uint16 vendor_id; /* 0xffff is don't-care */
|
||||
uint16 device_id; /* 0xffff is don't-care */
|
||||
uint8 class_base; /* 0xff is don't-care */
|
||||
uint8 class_sub; /* 0xff is don't-care */
|
||||
uint8 class_api; /* 0xff is don't-care */
|
||||
};
|
||||
|
||||
struct cb_notify_hooks
|
||||
{
|
||||
status_t (*device_added)(pci_info *pci, void **cookie);
|
||||
void (*device_removed)(void *cookie);
|
||||
};
|
||||
|
||||
struct cb_enabler_module_info {
|
||||
bus_manager_info binfo;
|
||||
|
||||
void (*register_driver)(const char *name,
|
||||
const cb_device_descriptor *descriptors,
|
||||
size_t count);
|
||||
void (*install_notify)(const char *name,
|
||||
const cb_notify_hooks *hooks);
|
||||
void (*uninstall_notify)(const char *name,
|
||||
const cb_notify_hooks *hooks);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,10 @@
|
||||
#define AUTOCONF_INCLUDED
|
||||
#define __IN_PCMCIA_PACKAGE__
|
||||
|
||||
//#include <pcmcia/autoconf.h>
|
||||
#define CONFIG_ISA 1
|
||||
#define CONFIG_PCI 1
|
||||
#define CONFIG_CARDBUS 1
|
||||
#undef PCMCIA_DEBUG
|
||||
//#define PCMCIA_DEBUG 10
|
||||
|
||||
#endif /* _PCMCIA_CONFIG_H */
|
||||
|
||||
@@ -77,25 +77,24 @@ typedef union ds_ioctl_arg_t {
|
||||
cisdump_t cisdump;
|
||||
} ds_ioctl_arg_t;
|
||||
|
||||
#ifndef __HAIKU__
|
||||
|
||||
/* ioctl macros */
|
||||
#undef IOC_IN
|
||||
#undef IOC_OUT
|
||||
#undef _IOC
|
||||
#undef IOCPARM_LEN
|
||||
#undef _IOR
|
||||
#undef _IOW
|
||||
#undef _IOWR
|
||||
#undef IOC_IN
|
||||
#undef IOC_OUT
|
||||
#undef IOC_INOUT
|
||||
#define IOC_IN 1
|
||||
#define IOC_OUT 2
|
||||
#define IOC_INOUT (IOC_IN|IOC_OUT)
|
||||
#define _IOC(inout, group, num, len) \
|
||||
(inout | ((len & IOCPARM_MASK)<<2) | ((group) << 24) | (num<<16))
|
||||
#define IOCPARM_LEN(x) (((x) >> 2) & IOCPARM_MASK)
|
||||
#define _IOR(g,n,t) _IOC(2, (g), (n), sizeof(t))
|
||||
#define _IOW(g,n,t) _IOC(1 , (g), (n), sizeof(t))
|
||||
#define _IOWR(g,n,t) _IOC(3, (g), (n), sizeof(t))
|
||||
#endif
|
||||
#undef _IO
|
||||
#define IOC_IN 1
|
||||
#define IOC_OUT 2
|
||||
#define IOCSIZE_MASK 0xfffc
|
||||
#define IOCSIZE_SHIFT 2
|
||||
#define _IOC(dir,tag,num,sz) (((tag)<<24)|((num)<<16)|((sz)<<2)|(dir))
|
||||
#define _IO(tag,num) _IOC(0,tag,num,0)
|
||||
#define _IOW(tag,num,type) _IOC(1,tag,num,sizeof(type))
|
||||
#define _IOR(tag,num,type) _IOC(2,tag,num,sizeof(type))
|
||||
#define _IOWR(tag,num,type) _IOC(3,tag,num,sizeof(type))
|
||||
|
||||
#define DS_GET_CARD_SERVICES_INFO _IOR ('d', 1, servinfo_t)
|
||||
#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* BeOS kernel compatibility layer
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License
|
||||
* at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is David A. Hinds
|
||||
* <[email protected]>. Portions created by David A. Hinds
|
||||
* are Copyright (C) 1998 David A. Hinds. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _BE_K_COMPAT_H
|
||||
#define _BE_K_COMPAT_H
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <ISA.h>
|
||||
#include <PCI.h>
|
||||
#include <Drivers.h>
|
||||
#include <byteorder.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <config_manager.h>
|
||||
|
||||
#define __KERNEL__
|
||||
|
||||
/* IO port access */
|
||||
#define inb(p) (isa->read_io_8)(p)
|
||||
#define inw(p) (isa->read_io_16)(p)
|
||||
#define inl(p) (isa->read_io_32)(p)
|
||||
#define outb(d,p) (isa->write_io_8)(p,d)
|
||||
#define outw(d,p) (isa->write_io_16)(p,d)
|
||||
#define outl(d,p) (isa->write_io_32)(p,d)
|
||||
|
||||
/* Memory-mapped IO access: unlike Linux, BeOS allows dereferencing
|
||||
pointers to mapped devices */
|
||||
#define readb(p) (*(volatile u_char *)(p))
|
||||
#define readw(p) (*(volatile u_short *)(p))
|
||||
#define readl(p) (*(volatile u_int *)(p))
|
||||
#define writeb(b, p) (*(volatile u_char *)(p) = (b))
|
||||
#define writew(w, p) (*(volatile u_short *)(p) = (w))
|
||||
#define writel(l, p) (*(volatile u_int *)(p) = (l))
|
||||
#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
|
||||
#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
|
||||
|
||||
/* Byte swapping */
|
||||
#define le16_to_cpu B_LENDIAN_TO_HOST_INT16
|
||||
#define le32_to_cpu B_LENDIAN_TO_HOST_INT32
|
||||
#define cpu_to_le16 B_HOST_TO_LENDIAN_INT16
|
||||
#define cpu_to_le32 B_HOST_TO_LENDIAN_INT32
|
||||
#define writew_ns writew
|
||||
#define readw_ns readw
|
||||
|
||||
/* Copying data between kernel and user space: BeOS can directly
|
||||
dereference user pointers in kernel mode */
|
||||
#define get_user(x, p) ((x) = *(p))
|
||||
#define put_user(x, p) (*(p) = (x))
|
||||
#define copy_from_user memcpy
|
||||
#define copy_to_user memcpy
|
||||
|
||||
/* Virtual memory mapping: this is somewhat inelegant, but lets us
|
||||
use drop-in replacements for the Linux equivalents */
|
||||
#define PAGE_SIZE (0x1000)
|
||||
static inline void *ioremap(u_long base, u_long size)
|
||||
{
|
||||
char tag[B_OS_NAME_LENGTH];
|
||||
area_id id;
|
||||
void *virt;
|
||||
sprintf(tag, "pccard %08lx", base);
|
||||
id = map_physical_memory(tag, (void *)base,
|
||||
size, B_ANY_KERNEL_ADDRESS,
|
||||
B_READ_AREA | B_WRITE_AREA, &virt);
|
||||
return (id < 0) ? NULL : virt;
|
||||
}
|
||||
static inline void iounmap(void *virt)
|
||||
{
|
||||
area_id id = area_for(virt);
|
||||
if (id >= 0) delete_area(id);
|
||||
}
|
||||
|
||||
/* Resource management: use helper functions from the PCMCIA resource
|
||||
manager module. RSRC_MGR needs to be defined appropriately if the
|
||||
calls are via a module_info structure. */
|
||||
#define request_region(base, num, name) \
|
||||
(RSRC_MGR register_resource(B_IO_PORT_RESOURCE, (base), (num)))
|
||||
#define vacate_region release_region
|
||||
#define vacate_mem_region release_mem_region
|
||||
#define release_region(base, num) \
|
||||
(RSRC_MGR release_resource(B_IO_PORT_RESOURCE, (base), (num)))
|
||||
#define check_region(base, num) \
|
||||
(RSRC_MGR check_resource(B_IO_PORT_RESOURCE, (base), (num)))
|
||||
#define request_mem_region(base, num, name) \
|
||||
(RSRC_MGR register_resource(B_MEMORY_RESOURCE, (base), (num)))
|
||||
#define release_mem_region(base, num) \
|
||||
(RSRC_MGR release_resource(B_MEMORY_RESOURCE, (base), (num)))
|
||||
#define check_mem_region(base, num) \
|
||||
(RSRC_MGR check_resource(B_MEMORY_RESOURCE, (base), (num)))
|
||||
#define register_irq(irq) \
|
||||
(RSRC_MGR register_resource(B_IRQ_RESOURCE, (irq), 0))
|
||||
#define release_irq(irq) \
|
||||
(RSRC_MGR release_resource(B_IRQ_RESOURCE, (irq), 0))
|
||||
#define check_irq(irq) \
|
||||
(RSRC_MGR check_resource(B_IRQ_RESOURCE, (irq), 0))
|
||||
#define ACQUIRE_RESOURCE_LOCK \
|
||||
do { module_info *m; \
|
||||
get_module(B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME, &m); } while (0)
|
||||
#define RELEASE_RESOURCE_LOCK \
|
||||
put_module(B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME)
|
||||
|
||||
/* Memory allocation. BeOS doesn't have an atomic malloc. */
|
||||
#define kmalloc(s,f) malloc(s)
|
||||
#define kfree(p) free(p)
|
||||
#define kfree_s(p,s) free(p)
|
||||
void *malloc();
|
||||
void free(void *);
|
||||
|
||||
/* PCI configuration register access */
|
||||
#define pcibios_present() (1)
|
||||
#define pcibios_read_config_byte(b,df,o,v) \
|
||||
((*(v) = pci->read_pci_config(b,(df)>>3,((df)&7),o,1)),0)
|
||||
#define pcibios_read_config_word(b,df,o,v) \
|
||||
((*(v) = pci->read_pci_config(b,(df)>>3,((df)&7),o,2)),0)
|
||||
#define pcibios_read_config_dword(b,df,o,v) \
|
||||
((*(v) = pci->read_pci_config(b,(df)>>3,((df)&7),o,4)),0)
|
||||
#define pcibios_write_config_byte(b,df,o,v) \
|
||||
pci->write_pci_config(b,(df)>>3,((df)&7),o,1,v)
|
||||
#define pcibios_write_config_word(b,df,o,v) \
|
||||
pci->write_pci_config(b,(df)>>3,((df)&7),o,2,v)
|
||||
#define pcibios_write_config_dword(b,df,o,v) \
|
||||
pci->write_pci_config(b,(df)>>3,((df)&7),o,4,v)
|
||||
#define PCI_VENDOR_ID PCI_vendor_id
|
||||
#define PCI_DEVICE_ID PCI_device_id
|
||||
#define PCI_COMMAND PCI_command
|
||||
#define PCI_COMMAND_IO PCI_command_io
|
||||
#define PCI_COMMAND_MEMORY PCI_command_memory
|
||||
#define PCI_COMMAND_MASTER PCI_command_master
|
||||
#define PCI_COMMAND_WAIT PCI_command_address_step
|
||||
#define PCI_STATUS PCI_status
|
||||
#define PCI_CLASS_REVISION PCI_revision
|
||||
#define PCI_CACHE_LINE_SIZE PCI_line_size
|
||||
#define PCI_LATENCY_TIMER PCI_latency
|
||||
#define PCI_INTERRUPT_LINE PCI_interrupt_line
|
||||
#define PCI_INTERRUPT_PIN PCI_interrupt_pin
|
||||
#define PCI_HEADER_TYPE PCI_header_type
|
||||
#define PCI_BASE_ADDRESS_0 PCI_base_registers
|
||||
#define PCI_BASE_ADDRESS_SPACE PCI_address_space
|
||||
#define PCI_BASE_ADDRESS_MEM_MASK PCI_address_memory_32_mask
|
||||
#define PCI_BASE_ADDRESS_IO_MASK PCI_address_io_mask
|
||||
#define PCI_BASE_ADDRESS_MEM_PREFETCH PCI_address_prefetchable
|
||||
#define PCI_FUNC(devfn) ((devfn)&7)
|
||||
#define PCI_SLOT(devfn) ((devfn)>>3)
|
||||
#define PCI_DEVFN(dev,fn) (((dev)<<3)|((fn)&7))
|
||||
#define PCI_CLASS_BRIDGE_PCMCIA 0x0605
|
||||
#define PCI_CLASS_BRIDGE_CARDBUS 0x0607
|
||||
|
||||
/* Atomic test-and-set */
|
||||
#define test_and_set_bit(b,p) (((atomic_or(p,(1<<(b))))>>(b))&1)
|
||||
|
||||
/* Spin locks */
|
||||
#define __SMP__
|
||||
#define spinlock_t spinlock
|
||||
#define USE_SPIN_LOCKS
|
||||
#define SPIN_LOCK_UNLOCKED 0
|
||||
#define spin_lock_irqsave(l,f) \
|
||||
do { f = disable_interrupts(); acquire_spinlock(l); } while (0)
|
||||
#define spin_unlock_irqrestore(l,f) \
|
||||
do { release_spinlock(l); restore_interrupts(f); } while (0)
|
||||
|
||||
/* Interrupt handling */
|
||||
#define REQUEST_IRQ(i,h,f,n,d) install_io_interrupt_handler(i,h,d,0)
|
||||
#define FREE_IRQ(i,h,d) remove_io_interrupt(i,h)
|
||||
#define IRQ(i,d,r) (d)
|
||||
#define DEV_ID dev_id
|
||||
#define NR_IRQS 16
|
||||
|
||||
#define init_waitqueue(w) memset((w), 0, sizeof(*w))
|
||||
#define init_waitqueue_head(w) memset((w), 0, sizeof(*w))
|
||||
#define signal_pending(a) has_signals_pending(NULL)
|
||||
|
||||
/* Miscellaneous services */
|
||||
typedef long long k_time_t;
|
||||
#define schedule_timeout(x) snooze(x)
|
||||
#define udelay(d) spin(d)
|
||||
#define mdelay(d) \
|
||||
do { int i; for (i=0;i<d;i++) spin(1000); } while (0)
|
||||
#define printk dprintf
|
||||
#define KERN_ERR ""
|
||||
#define KERN_NOTICE ""
|
||||
#define KERN_INFO ""
|
||||
#define KERN_WARNING ""
|
||||
#define KERN_DEBUG ""
|
||||
|
||||
#ifndef ENODATA
|
||||
#define ENODATA ENOSPC
|
||||
#endif
|
||||
|
||||
#include <pcmcia/cs_timer.h>
|
||||
#define add_timer my_add_timer
|
||||
#define del_timer my_del_timer
|
||||
|
||||
/* Module handling stuff */
|
||||
#define MODULE_PARM(a,b) extern int __dummy_decl
|
||||
#define MOD_INC_USE_COUNT
|
||||
#define MOD_DEC_USE_COUNT
|
||||
|
||||
#endif /* _BE_K_COMPAT_H */
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* mem_op.h 1.14 2001/08/24 12:16:13
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License
|
||||
* at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is David A. Hinds
|
||||
* <[email protected]>. Portions created by David A. Hinds
|
||||
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU General Public License version 2 (the "GPL"), in
|
||||
* which case the provisions of the GPL are applicable instead of the
|
||||
* above. If you wish to allow the use of your version of this file
|
||||
* only under the terms of the GPL and not to allow others to use
|
||||
* your version of this file under the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice and
|
||||
* other provisions required by the GPL. If you do not delete the
|
||||
* provisions above, a recipient may use your version of this file
|
||||
* under either the MPL or the GPL.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_MEM_OP_H
|
||||
#define _LINUX_MEM_OP_H
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
/*
|
||||
If UNSAFE_MEMCPY is defined, we use the (optimized) system routines
|
||||
to copy between a card and kernel memory. These routines do 32-bit
|
||||
operations which may not work with all PCMCIA controllers. The
|
||||
safe versions defined here will do only 8-bit and 16-bit accesses.
|
||||
*/
|
||||
|
||||
#ifdef UNSAFE_MEMCPY
|
||||
|
||||
#define copy_from_pc memcpy_fromio
|
||||
#define copy_to_pc memcpy_toio
|
||||
|
||||
static inline void copy_pc_to_user(void *to, const void *from, size_t n)
|
||||
{
|
||||
size_t odd = (n & 3);
|
||||
n -= odd;
|
||||
while (n) {
|
||||
put_user(readl_ns(from), (int *)to);
|
||||
(char *)from += 4; (char *)to += 4; n -= 4;
|
||||
}
|
||||
while (odd--)
|
||||
put_user(readb((char *)from++), (char *)to++);
|
||||
}
|
||||
|
||||
static inline void copy_user_to_pc(void *to, const void *from, size_t n)
|
||||
{
|
||||
int l;
|
||||
char c;
|
||||
size_t odd = (n & 3);
|
||||
n -= odd;
|
||||
while (n) {
|
||||
get_user(l, (int *)from);
|
||||
writel_ns(l, to);
|
||||
(char *)to += 4; (char *)from += 4; n -= 4;
|
||||
}
|
||||
while (odd--) {
|
||||
get_user(c, (char *)from++);
|
||||
writeb(c, (char *)to++);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* UNSAFE_MEMCPY */
|
||||
|
||||
static inline void copy_from_pc(void *to, const void *from, size_t n)
|
||||
{
|
||||
size_t odd = (n & 1);
|
||||
n -= odd;
|
||||
while (n) {
|
||||
*(u_short *)to = readw_ns(from);
|
||||
(char *)to += 2; (char *)from += 2; n -= 2;
|
||||
}
|
||||
if (odd)
|
||||
*(u_char *)to = readb(from);
|
||||
}
|
||||
|
||||
static inline void copy_to_pc(void *to, const void *from, size_t n)
|
||||
{
|
||||
size_t odd = (n & 1);
|
||||
n -= odd;
|
||||
while (n) {
|
||||
writew_ns(*(u_short *)from, to);
|
||||
(char *)to += 2; (char *)from += 2; n -= 2;
|
||||
}
|
||||
if (odd)
|
||||
writeb(*(u_char *)from, to);
|
||||
}
|
||||
|
||||
static inline void copy_pc_to_user(void *to, const void *from, size_t n)
|
||||
{
|
||||
size_t odd = (n & 1);
|
||||
n -= odd;
|
||||
while (n) {
|
||||
put_user(readw_ns(from), (short *)to);
|
||||
(char *)to += 2; (char *)from += 2; n -= 2;
|
||||
}
|
||||
if (odd)
|
||||
put_user(readb(from), (char *)to);
|
||||
}
|
||||
|
||||
static inline void copy_user_to_pc(void *to, const void *from, size_t n)
|
||||
{
|
||||
short s;
|
||||
char c;
|
||||
size_t odd = (n & 1);
|
||||
n -= odd;
|
||||
while (n) {
|
||||
get_user(s, (short *)from);
|
||||
writew_ns(s, to);
|
||||
(char *)to += 2; (char *)from += 2; n -= 2;
|
||||
}
|
||||
if (odd) {
|
||||
get_user(c, (char *)from);
|
||||
writeb(c, to);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* UNSAFE_MEMCPY */
|
||||
|
||||
#endif /* _LINUX_MEM_OP_H */
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* memory.h 1.8 2001/08/24 12:16:13
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License
|
||||
* at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is David A. Hinds
|
||||
* <[email protected]>. Portions created by David A. Hinds
|
||||
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU General Public License version 2 (the "GPL"), in
|
||||
* which case the provisions of the GPL are applicable instead of the
|
||||
* above. If you wish to allow the use of your version of this file
|
||||
* only under the terms of the GPL and not to allow others to use
|
||||
* your version of this file under the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice and
|
||||
* other provisions required by the GPL. If you do not delete the
|
||||
* provisions above, a recipient may use your version of this file
|
||||
* under either the MPL or the GPL.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_MEMORY_H
|
||||
#define _LINUX_MEMORY_H
|
||||
|
||||
typedef struct erase_info_t {
|
||||
u_long Offset;
|
||||
u_long Size;
|
||||
} erase_info_t;
|
||||
|
||||
#define MEMGETINFO _IOR('M', 1, region_info_t)
|
||||
#define MEMERASE _IOW('M', 2, erase_info_t)
|
||||
|
||||
#endif /* _LINUX_MEMORY_H */
|
||||
@@ -1,5 +1,16 @@
|
||||
SubDir HAIKU_TOP src bin pcmcia-cs ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
if $(TARGET_PLATFORM) != haiku {
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) headers os drivers ] : true ;
|
||||
# We need the public pcmcia headers also when not compiling for Haiku.
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) headers os support ] : true ;
|
||||
# We need Errors.h also when not compiling for Haiku.
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ;
|
||||
# We need errno.h also when not compiling for Haiku.
|
||||
}
|
||||
|
||||
StdBinCommands
|
||||
cardctl.c
|
||||
dump_cis.c
|
||||
|
||||
Reference in New Issue
Block a user