Minor tweaks to fix the build after the last commit.
* firewire and freebsd_network expect the macros come from sys/param.h, as this is one of the places FreeBSD defines them * All others are Haiku-native and can use Be-style macros.
This commit is contained in:
parent
9cb15d72bd
commit
fb52ab82d2
@ -30,7 +30,7 @@
|
|||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $FreeBSD: src/sys/dev/firewire/firewire.h,v 1.21 2007/04/24 12:15:05 simokawa Exp $
|
* $FreeBSD: src/sys/dev/firewire/firewire.h,v 1.21 2007/04/24 12:15:05 simokawa Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -458,6 +458,13 @@ struct fw_crom_buf {
|
|||||||
|
|
||||||
#define FWMAXNDMA 0x100 /* 8 bits DMA channel id. in device No. */
|
#define FWMAXNDMA 0x100 /* 8 bits DMA channel id. in device No. */
|
||||||
|
|
||||||
|
#ifndef htonl
|
||||||
|
# define htonl(x) B_HOST_TO_BENDIAN_INT32(x)
|
||||||
|
# define ntohl(x) B_BENDIAN_TO_HOST_INT32(x)
|
||||||
|
# define htons(x) B_HOST_TO_BENDIAN_INT16(x)
|
||||||
|
# define ntohs(x) B_BENDIAN_TO_HOST_INT16(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __HAIKU__
|
#ifndef __HAIKU__
|
||||||
#if defined(__DragonFly__) || __FreeBSD_version < 500000
|
#if defined(__DragonFly__) || __FreeBSD_version < 500000
|
||||||
#define dev2unit(x) ((minor(x) & 0xff) | (minor(x) >> 8))
|
#define dev2unit(x) ((minor(x) & 0xff) | (minor(x) >> 8))
|
||||||
|
@ -1195,8 +1195,9 @@ usb_disk_update_capacity(device_lun *lun)
|
|||||||
|
|
||||||
lun->media_present = true;
|
lun->media_present = true;
|
||||||
lun->media_changed = false;
|
lun->media_changed = false;
|
||||||
lun->block_size = ntohl(parameter.logical_block_length);
|
lun->block_size = B_BENDIAN_TO_HOST_INT32(parameter.logical_block_length);
|
||||||
lun->block_count = ntohl(parameter.last_logical_block_address) + 1;
|
lun->block_count =
|
||||||
|
B_BENDIAN_TO_HOST_INT32(parameter.last_logical_block_address) + 1;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Pegasus BeOS Driver
|
* Pegasus BeOS Driver
|
||||||
*
|
*
|
||||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
@ -64,7 +64,7 @@ aue_csr_read_1(pegasus_dev *sc, int reg)
|
|||||||
|
|
||||||
AUE_LOCK(sc);
|
AUE_LOCK(sc);
|
||||||
|
|
||||||
err = usb->send_request(sc->dev, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN,
|
err = usb->send_request(sc->dev, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN,
|
||||||
AUE_UR_READREG, 0, reg, 1, &val, &length);
|
AUE_UR_READREG, 0, reg, 1, &val, &length);
|
||||||
AUE_UNLOCK(sc);
|
AUE_UNLOCK(sc);
|
||||||
|
|
||||||
@ -87,9 +87,9 @@ aue_csr_read_2(pegasus_dev *sc, int reg)
|
|||||||
|
|
||||||
AUE_LOCK(sc);
|
AUE_LOCK(sc);
|
||||||
|
|
||||||
err = usb->send_request(sc->dev, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN,
|
err = usb->send_request(sc->dev, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN,
|
||||||
AUE_UR_READREG, 0, reg, 2, &val, &length);
|
AUE_UR_READREG, 0, reg, 2, &val, &length);
|
||||||
|
|
||||||
AUE_UNLOCK(sc);
|
AUE_UNLOCK(sc);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -110,9 +110,9 @@ aue_csr_write_1(pegasus_dev *sc, int reg, int val)
|
|||||||
|
|
||||||
AUE_LOCK(sc);
|
AUE_LOCK(sc);
|
||||||
|
|
||||||
err = usb->send_request(sc->dev, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT,
|
err = usb->send_request(sc->dev, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT,
|
||||||
AUE_UR_WRITEREG, val, reg, 1, &val, &length);
|
AUE_UR_WRITEREG, val, reg, 1, &val, &length);
|
||||||
|
|
||||||
AUE_UNLOCK(sc);
|
AUE_UNLOCK(sc);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -127,15 +127,15 @@ aue_csr_write_2(pegasus_dev *sc, int reg, int val)
|
|||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
size_t length = 2;
|
size_t length = 2;
|
||||||
|
|
||||||
if (sc->aue_dying)
|
if (sc->aue_dying)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
AUE_LOCK(sc);
|
AUE_LOCK(sc);
|
||||||
|
|
||||||
err = usb->send_request(sc->dev, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT,
|
err = usb->send_request(sc->dev, USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT,
|
||||||
AUE_UR_WRITEREG, val, reg, 2, &val, &length);
|
AUE_UR_WRITEREG, val, reg, 2, &val, &length);
|
||||||
|
|
||||||
AUE_UNLOCK(sc);
|
AUE_UNLOCK(sc);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -189,7 +189,7 @@ aue_read_eeprom(pegasus_dev *sc, caddr_t dest, int off, int cnt, int swap)
|
|||||||
aue_eeprom_getword(sc, off + i, &word);
|
aue_eeprom_getword(sc, off + i, &word);
|
||||||
ptr = (u_int16_t *)(dest + (i * 2));
|
ptr = (u_int16_t *)(dest + (i * 2));
|
||||||
if (swap)
|
if (swap)
|
||||||
*ptr = ntohs(word);
|
*ptr = B_BENDIAN_TO_HOST_INT16(word);
|
||||||
else
|
else
|
||||||
*ptr = word;
|
*ptr = word;
|
||||||
}
|
}
|
||||||
@ -268,14 +268,14 @@ aue_miibus_writereg(pegasus_dev *sc, int phy, int reg, int data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint16
|
static uint16
|
||||||
aue_miibus_read(pegasus_dev *dev, uint16 reg)
|
aue_miibus_read(pegasus_dev *dev, uint16 reg)
|
||||||
{
|
{
|
||||||
return aue_miibus_readreg(dev, dev->phy, reg);
|
return aue_miibus_readreg(dev, dev->phy, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
aue_miibus_write(pegasus_dev *dev, uint16 reg, uint16 value)
|
aue_miibus_write(pegasus_dev *dev, uint16 reg, uint16 value)
|
||||||
{
|
{
|
||||||
aue_miibus_writereg(dev, dev->phy, reg, value);
|
aue_miibus_writereg(dev, dev->phy, reg, value);
|
||||||
@ -309,7 +309,7 @@ aue_init_phy(pegasus_dev *dev)
|
|||||||
{
|
{
|
||||||
uint16 phy, status;
|
uint16 phy, status;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
dev->phy = 255;
|
dev->phy = 255;
|
||||||
|
|
||||||
// search for total of 32 possible MII PHY addresses
|
// search for total of 32 possible MII PHY addresses
|
||||||
@ -329,7 +329,7 @@ aue_init_phy(pegasus_dev *dev)
|
|||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
DPRINTF_INFO("aue_init_phy MII PHY found at %d\n", dev->phy);
|
DPRINTF_INFO("aue_init_phy MII PHY found at %d\n", dev->phy);
|
||||||
|
|
||||||
status = aue_miibus_read(dev, MII_CONTROL);
|
status = aue_miibus_read(dev, MII_CONTROL);
|
||||||
status &= ~MII_CONTROL_ISOLATE;
|
status &= ~MII_CONTROL_ISOLATE;
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ aue_init_phy(pegasus_dev *dev)
|
|||||||
break;
|
break;
|
||||||
DELAY(1000);
|
DELAY(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->link = aue_miibus_status(dev) & MII_STATUS_LINK;
|
dev->link = aue_miibus_status(dev) & MII_STATUS_LINK;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -408,7 +408,7 @@ aue_reset(pegasus_dev *sc)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attach
|
* Attach
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
aue_attach(pegasus_dev *sc)
|
aue_attach(pegasus_dev *sc)
|
||||||
@ -426,10 +426,10 @@ aue_attach(pegasus_dev *sc)
|
|||||||
aue_read_eeprom(sc, (caddr_t)&eaddr, 0, 3, 0);
|
aue_read_eeprom(sc, (caddr_t)&eaddr, 0, 3, 0);
|
||||||
|
|
||||||
memcpy(sc->macaddr, eaddr, ETHER_ADDRESS_LENGTH);
|
memcpy(sc->macaddr, eaddr, ETHER_ADDRESS_LENGTH);
|
||||||
|
|
||||||
if (aue_init_phy(sc) != B_OK)
|
if (aue_init_phy(sc) != B_OK)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
sc->aue_dying = 0;
|
sc->aue_dying = 0;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -51,22 +51,22 @@
|
|||||||
read32(device->reg_base + WB_SIO) & ~x)
|
read32(device->reg_base + WB_SIO) & ~x)
|
||||||
|
|
||||||
#define MII_DELAY(x) read32(x->reg_base + WB_SIO)
|
#define MII_DELAY(x) read32(x->reg_base + WB_SIO)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mii_sync(struct wb_device *device)
|
mii_sync(struct wb_device *device)
|
||||||
{
|
{
|
||||||
// Set data bit and strobe the clock 32 times
|
// Set data bit and strobe the clock 32 times
|
||||||
int bits = 32;
|
int bits = 32;
|
||||||
|
|
||||||
SIO_SET(WB_SIO_MII_DIR|WB_SIO_MII_DATAIN);
|
SIO_SET(WB_SIO_MII_DIR|WB_SIO_MII_DATAIN);
|
||||||
|
|
||||||
while (--bits >= 0) {
|
while (--bits >= 0) {
|
||||||
SIO_SET(WB_SIO_MII_CLK);
|
SIO_SET(WB_SIO_MII_CLK);
|
||||||
MII_DELAY(device);
|
MII_DELAY(device);
|
||||||
SIO_CLR(WB_SIO_MII_CLK);
|
SIO_CLR(WB_SIO_MII_CLK);
|
||||||
MII_DELAY(device);
|
MII_DELAY(device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ mii_send(wb_device *device, uint32 bits, int count)
|
|||||||
* Read an PHY register through the MII.
|
* Read an PHY register through the MII.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
wb_mii_readreg(wb_device *device, wb_mii_frame *frame)
|
wb_mii_readreg(wb_device *device, wb_mii_frame *frame)
|
||||||
{
|
{
|
||||||
int i, ack;
|
int i, ack;
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ wb_mii_readreg(wb_device *device, wb_mii_frame *frame)
|
|||||||
frame->mii_opcode = WB_MII_READOP;
|
frame->mii_opcode = WB_MII_READOP;
|
||||||
frame->mii_turnaround = 0;
|
frame->mii_turnaround = 0;
|
||||||
frame->mii_data = 0;
|
frame->mii_data = 0;
|
||||||
|
|
||||||
write32(device->reg_base + WB_SIO, 0);
|
write32(device->reg_base + WB_SIO, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -192,7 +192,7 @@ wb_mii_writereg(wb_device *device, wb_mii_frame *frame)
|
|||||||
frame->mii_stdelim = WB_MII_STARTDELIM;
|
frame->mii_stdelim = WB_MII_STARTDELIM;
|
||||||
frame->mii_opcode = WB_MII_WRITEOP;
|
frame->mii_opcode = WB_MII_WRITEOP;
|
||||||
frame->mii_turnaround = WB_MII_TURNAROUND;
|
frame->mii_turnaround = WB_MII_TURNAROUND;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Turn on data output.
|
* Turn on data output.
|
||||||
*/
|
*/
|
||||||
@ -212,7 +212,7 @@ wb_mii_writereg(wb_device *device, wb_mii_frame *frame)
|
|||||||
MII_DELAY(device);
|
MII_DELAY(device);
|
||||||
SIO_CLR(WB_SIO_MII_CLK);
|
SIO_CLR(WB_SIO_MII_CLK);
|
||||||
MII_DELAY(device);
|
MII_DELAY(device);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Turn off xmit.
|
* Turn off xmit.
|
||||||
*/
|
*/
|
||||||
@ -262,7 +262,7 @@ wb_eeprom_putbyte(wb_device *device, int addr)
|
|||||||
{
|
{
|
||||||
int d, i;
|
int d, i;
|
||||||
int delay;
|
int delay;
|
||||||
|
|
||||||
d = addr | WB_EECMD_READ;
|
d = addr | WB_EECMD_READ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -276,41 +276,41 @@ wb_eeprom_putbyte(wb_device *device, int addr)
|
|||||||
}
|
}
|
||||||
for (delay = 0; delay < 100; delay++)
|
for (delay = 0; delay < 100; delay++)
|
||||||
MII_DELAY(device);
|
MII_DELAY(device);
|
||||||
|
|
||||||
SIO_SET(WB_SIO_EE_CLK);
|
SIO_SET(WB_SIO_EE_CLK);
|
||||||
|
|
||||||
for (delay = 0; delay < 150; delay++)
|
for (delay = 0; delay < 150; delay++)
|
||||||
MII_DELAY(device);
|
MII_DELAY(device);
|
||||||
|
|
||||||
SIO_CLR(WB_SIO_EE_CLK);
|
SIO_CLR(WB_SIO_EE_CLK);
|
||||||
|
|
||||||
for (delay = 0; delay < 100; delay++)
|
for (delay = 0; delay < 100; delay++)
|
||||||
MII_DELAY(device);
|
MII_DELAY(device);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wb_eeprom_askdata(wb_device *device, int addr)
|
wb_eeprom_askdata(wb_device *device, int addr)
|
||||||
{
|
{
|
||||||
int command, i;
|
int command, i;
|
||||||
int delay;
|
int delay;
|
||||||
|
|
||||||
command = addr | WB_EECMD_READ;
|
command = addr | WB_EECMD_READ;
|
||||||
|
|
||||||
/* Feed in each bit and strobe the clock. */
|
/* Feed in each bit and strobe the clock. */
|
||||||
for(i = 0x400; i; i >>= 1) {
|
for(i = 0x400; i; i >>= 1) {
|
||||||
if (command & i)
|
if (command & i)
|
||||||
SIO_SET(WB_SIO_EE_DATAIN);
|
SIO_SET(WB_SIO_EE_DATAIN);
|
||||||
else
|
else
|
||||||
SIO_CLR(WB_SIO_EE_DATAIN);
|
SIO_CLR(WB_SIO_EE_DATAIN);
|
||||||
|
|
||||||
SIO_SET(WB_SIO_EE_CLK);
|
SIO_SET(WB_SIO_EE_CLK);
|
||||||
|
|
||||||
SIO_CLR(WB_SIO_EE_CLK);
|
SIO_CLR(WB_SIO_EE_CLK);
|
||||||
for (delay = 0; delay < 100; delay++)
|
for (delay = 0; delay < 100; delay++)
|
||||||
EEPROM_DELAY(device);
|
EEPROM_DELAY(device);
|
||||||
@ -327,12 +327,12 @@ wb_eeprom_getword(wb_device *device, int addr, uint16 *dest)
|
|||||||
|
|
||||||
/* Enter EEPROM access mode */
|
/* Enter EEPROM access mode */
|
||||||
write32(device->reg_base + WB_SIO, WB_SIO_EESEL|WB_SIO_EE_CS);
|
write32(device->reg_base + WB_SIO, WB_SIO_EESEL|WB_SIO_EE_CS);
|
||||||
|
|
||||||
/* Send address of word we want to read. */
|
/* Send address of word we want to read. */
|
||||||
wb_eeprom_askdata(device, addr);
|
wb_eeprom_askdata(device, addr);
|
||||||
|
|
||||||
write32(device->reg_base + WB_SIO, WB_SIO_EESEL|WB_SIO_EE_CS);
|
write32(device->reg_base + WB_SIO, WB_SIO_EESEL|WB_SIO_EE_CS);
|
||||||
|
|
||||||
/* Start reading bits from EEPROM */
|
/* Start reading bits from EEPROM */
|
||||||
for (i = 0x8000; i > 0; i >>= 1) {
|
for (i = 0x8000; i > 0; i >>= 1) {
|
||||||
SIO_SET(WB_SIO_EE_CLK);
|
SIO_SET(WB_SIO_EE_CLK);
|
||||||
@ -340,10 +340,10 @@ wb_eeprom_getword(wb_device *device, int addr, uint16 *dest)
|
|||||||
word |= i;
|
word |= i;
|
||||||
SIO_CLR(WB_SIO_EE_CLK);
|
SIO_CLR(WB_SIO_EE_CLK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Turn off EEPROM access mode */
|
/* Turn off EEPROM access mode */
|
||||||
write32(device->reg_base + WB_SIO, 0);
|
write32(device->reg_base + WB_SIO, 0);
|
||||||
|
|
||||||
*dest = word;
|
*dest = word;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,12 +354,12 @@ wb_read_eeprom(wb_device *device, void* dest,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint16 word = 0, *ptr;
|
uint16 word = 0, *ptr;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
wb_eeprom_getword(device, offset + i, &word);
|
wb_eeprom_getword(device, offset + i, &word);
|
||||||
ptr = (uint16 *)((uint8 *)dest + (i * 2));
|
ptr = (uint16 *)((uint8 *)dest + (i * 2));
|
||||||
if (swap)
|
if (swap)
|
||||||
*ptr = ntohs(word);
|
*ptr = B_BENDIAN_TO_HOST_INT16(word);
|
||||||
else
|
else
|
||||||
*ptr = word;
|
*ptr = word;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE(x) printf x
|
//#define TRACE(x) printf x
|
||||||
@ -2022,7 +2021,7 @@ DCRaw::_ConvertToRGB()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < phead[0]/4; i++) {
|
for (i = 0; i < phead[0]/4; i++) {
|
||||||
fOutputProfile[i] = htonl(fOutputProfile[i]);
|
fOutputProfile[i] = B_HOST_TO_BENDIAN_INT32(fOutputProfile[i]);
|
||||||
}
|
}
|
||||||
strcpy((char *)fOutputProfile + pbody[2] + 8,
|
strcpy((char *)fOutputProfile + pbody[2] + 8,
|
||||||
"auto-generated by dcraw");
|
"auto-generated by dcraw");
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <posix/sys/param.h>
|
#include <posix/sys/param.h>
|
||||||
|
#include <ByteOrder.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
@ -94,4 +95,12 @@
|
|||||||
#define isclr(a,i) \
|
#define isclr(a,i) \
|
||||||
((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
|
((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
|
||||||
|
|
||||||
|
/* byteswap macros */
|
||||||
|
#ifndef htonl
|
||||||
|
# define htonl(x) B_HOST_TO_BENDIAN_INT32(x)
|
||||||
|
# define ntohl(x) B_BENDIAN_TO_HOST_INT32(x)
|
||||||
|
# define htons(x) B_HOST_TO_BENDIAN_INT16(x)
|
||||||
|
# define ntohs(x) B_BENDIAN_TO_HOST_INT16(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _FBSD_COMPAT_SYS_PARAM_H_ */
|
#endif /* _FBSD_COMPAT_SYS_PARAM_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user