haiku/headers/private/firewire/fwglue.h
Jérôme Duval bb5ea4eb08 work from JiSheng Zhang : firewire and ohci modules from FreeBSD current, update for fw_raw and fw_control. Thanks!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22124 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-30 21:59:49 +00:00

57 lines
1.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Copyright 2007, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* JiSheng Zhang
*/
#ifndef _FW_GLUE_H
#define _FW_GLUE_H
#include <stdint.h>
#include <dpc.h>
#define device_printf(dev, a...) dprintf("firewire:" a)
#define printf(a...) dprintf(a)
#define KASSERT(cond,msg) do { \
if (!cond) \
panic msg; \
} while(0)
#ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y)) // x/y的上界
#endif
#define rounddown(x, y) (((x)/(y))*(y)) // 比x小y的最大的倍数
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ // 比x大y的最小倍数
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#define powerof2(x) ((((x)-1)&(x))==0) // 是否是2的次方
typedef uint32_t bus_addr_t;
typedef uint32_t bus_size_t;
#define atomic_readandclear_int(a) atomic_set(a, 0)
#define atomic_set_int(addr, newvalue) atomic_set(addr, newvalue)
#define mtx_lock benaphore_lock
#define mtx_unlock benaphore_unlock
#define mtx_destroy benaphore_destroy
#define mtx_init(lockaddr, name, type, opts) benaphore_init(lockaddr, name)
#define splfw() 0
#define splx(s)
#define hz 1000000LL
#define DELAY(n) snooze(n)
#define OWRITE(sc, offset, value) (*(volatile uint32 *)((char *)(sc->regAddr) + (offset)) = value)
#define OREAD(sc, offset) (*(volatile uint32 *)((char *)(sc->regAddr) + (offset)))
#define MAX_CARDS 4
extern dpc_module_info *gDpc;
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
#endif /*_FW_GLUE_H*/