require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&BCW_ARRAY_SIZE)) {
    sub BCW_ARRAY_SIZE {
	my($array) = @_;
	eval q(($sizeof{$array} / $sizeof{$array->[0]}));
    }
}
eval("sub BCW_LED_OFF () { 0; }") unless defined(&BCW_LED_OFF);
eval("sub BCW_LED_ON () { 1; }") unless defined(&BCW_LED_ON);
eval("sub BCW_LED_ACTIVITY () { 2; }") unless defined(&BCW_LED_ACTIVITY);
eval("sub BCW_LED_RADIO_ALL () { 3; }") unless defined(&BCW_LED_RADIO_ALL);
eval("sub BCW_LED_RADIO_A () { 4; }") unless defined(&BCW_LED_RADIO_A);
eval("sub BCW_LED_RADIO_B () { 5; }") unless defined(&BCW_LED_RADIO_B);
eval("sub BCW_LED_MODE_BG () { 6; }") unless defined(&BCW_LED_MODE_BG);
eval("sub BCW_LED_TRANSFER () { 7; }") unless defined(&BCW_LED_TRANSFER);
eval("sub BCW_LED_APTRANSFER () { 8; }") unless defined(&BCW_LED_APTRANSFER);
eval("sub BCW_LED_WEIRD () { 9; }") unless defined(&BCW_LED_WEIRD);
eval("sub BCW_LED_ASSOC () { 10; }") unless defined(&BCW_LED_ASSOC);
eval("sub BCW_LED_INACTIVE () { 11; }") unless defined(&BCW_LED_INACTIVE);
eval("sub BCW_LED_TEST_BLINKSLOW () { 12; }") unless defined(&BCW_LED_TEST_BLINKSLOW);
eval("sub BCW_LED_TEST_BLINKMEDIUM () { 13; }") unless defined(&BCW_LED_TEST_BLINKMEDIUM);
eval("sub BCW_LED_TEST_BLINKFAST () { 14; }") unless defined(&BCW_LED_TEST_BLINKFAST);
eval("sub BCW_LED_BCM4303_0 () { 0x2B; }") unless defined(&BCW_LED_BCM4303_0);
eval("sub BCW_LED_BCM4303_1 () { 0x78; }") unless defined(&BCW_LED_BCM4303_1);
eval("sub BCW_LED_BCM4303_2 () { 0x2E; }") unless defined(&BCW_LED_BCM4303_2);
eval("sub BCW_LED_BCM4303_3 () { 0x19; }") unless defined(&BCW_LED_BCM4303_3);
unless(defined(&BCW_RADIO_INTERFMODE_NONWLAN)) {
    sub BCW_RADIO_INTERFMODE_NONWLAN () {	1;}
}
unless(defined(&BCW_RADIO_DEFAULT_CHANNEL_A)) {
    sub BCW_RADIO_DEFAULT_CHANNEL_A () {	36;}
}
unless(defined(&BCW_RADIO_DEFAULT_CHANNEL_BG)) {
    sub BCW_RADIO_DEFAULT_CHANNEL_BG () {	6;}
}
unless(defined(&BCW_RADIO_MAX)) {
    sub BCW_RADIO_MAX () {	2;}
}
unless(defined(&BCW_MAX_CORES)) {
    sub BCW_MAX_CORES () {	10;}
}
unless(defined(&BCW_RX_RING_COUNT)) {
    sub BCW_RX_RING_COUNT () {	128;}
}
unless(defined(&BCW_TX_RING_COUNT)) {
    sub BCW_TX_RING_COUNT () {	128;}
}
unless(defined(&BCW_MAX_SCATTER)) {
    sub BCW_MAX_SCATTER () {	8;}
}
unless(defined(&BCW_LO_COUNT)) {
    sub BCW_LO_COUNT () {	(14* 4);}
}
unless(defined(&CTRL_BC_MASK)) {
    sub CTRL_BC_MASK () {	0x1fff;}
}
unless(defined(&CTRL_EOT)) {
    sub CTRL_EOT () {	0x10000000;}
}
unless(defined(&CTRL_IOC)) {
    sub CTRL_IOC () {	0x20000000;}
}
unless(defined(&CTRL_EOF)) {
    sub CTRL_EOF () {	0x40000000;}
}
unless(defined(&CTRL_SOF)) {
    sub CTRL_SOF () {	0x80000000;}
}
unless(defined(&BCW_ILT_FINEFREQA_SIZE)) {
    sub BCW_ILT_FINEFREQA_SIZE () {	256;}
}
unless(defined(&BCW_ILT_FINEFREQG_SIZE)) {
    sub BCW_ILT_FINEFREQG_SIZE () {	256;}
}
unless(defined(&BCW_ILT_NOISEA2_SIZE)) {
    sub BCW_ILT_NOISEA2_SIZE () {	8;}
}
unless(defined(&BCW_ILT_NOISEA3_SIZE)) {
    sub BCW_ILT_NOISEA3_SIZE () {	8;}
}
unless(defined(&BCW_ILT_NOISEG1_SIZE)) {
    sub BCW_ILT_NOISEG1_SIZE () {	8;}
}
unless(defined(&BCW_ILT_NOISEG2_SIZE)) {
    sub BCW_ILT_NOISEG2_SIZE () {	8;}
}
unless(defined(&BCW_ILT_ROTOR_SIZE)) {
    sub BCW_ILT_ROTOR_SIZE () {	53;}
}
unless(defined(&BCW_ILT_RETARD_SIZE)) {
    sub BCW_ILT_RETARD_SIZE () {	53;}
}
unless(defined(&BCW_ILT_SIGMASQR_SIZE)) {
    sub BCW_ILT_SIGMASQR_SIZE () {	53;}
}
unless(defined(&BCW_ILT_NOISESCALEG_SIZE)) {
    sub BCW_ILT_NOISESCALEG_SIZE () {	27;}
}
if(0) {
}
unless(defined(&BCW_DEBUG)) {
    sub BCW_DEBUG () {	1;}
}
if(defined(&BCW_DEBUG)) {
    eval 'sub DPRINTF {
        my($x) = @_;
	    eval q( &do {  &if (1)  &printf $x; }  &while (0));
    }' unless defined(&DPRINTF);
    eval 'sub DPRINTFN {
        my($n,$x) = @_;
	    eval q( &do {  &if (1>= ($n))  &printf $x; }  &while (0));
    }' unless defined(&DPRINTFN);
} else {
    eval 'sub DPRINTF {
        my($x) = @_;
	    eval q();
    }' unless defined(&DPRINTF);
    eval 'sub DPRINTFN {
        my($n,$x) = @_;
	    eval q();
    }' unless defined(&DPRINTFN);
}
unless(defined(&BCW_NTXFRAGS)) {
    sub BCW_NTXFRAGS () {	16;}
}
unless(defined(&BCW_PREPKT_HEADER_SIZE)) {
    sub BCW_PREPKT_HEADER_SIZE () {	30;}
}
unless(defined(&RXF_NO)) {
    sub RXF_NO () {	0x8;}
}
unless(defined(&RXF_RXER)) {
    sub RXF_RXER () {	0x4;}
}
unless(defined(&RXF_CRC)) {
    sub RXF_CRC () {	0x2;}
}
unless(defined(&RXF_OV)) {
    sub RXF_OV () {	0x1;}
}
unless(defined(&BCW_TIMEOUT)) {
    sub BCW_TIMEOUT () {	100;}
}
unless(defined(&BCW_RXBUF_LEN)) {
    sub BCW_RXBUF_LEN () {	( &MCLBYTES - 4);}
}
unless(defined(&BCW_INIT_RXDESC)) {
    sub BCW_INIT_RXDESC {
	my($sc, $x) = @_;
	eval q( &do { 'struct bcw_dma_slot' * &__bcwd =  ($sc->{bcw_rx_ring[$x]}); * &mtod( ($sc->{bcw_cdata}->{bcw_rx_chain[$x]}),  &uint32_t *) = 0;  ($__bcwd->{addr}) =  &htole32( ($sc->{bcw_cdata}->{bcw_rx_map[$x]}->{dm_segs[0]}->{ds_addr})	 + 0x40000000);  &if ($x != ( &BCW_NRXDESC - 1))  ($__bcwd->{ctrl}) =  &htole32( &BCW_RXBUF_LEN);  &else  ($__bcwd->{ctrl}) =  &htole32( &BCW_RXBUF_LEN |  &CTRL_EOT);  &bus_dmamap_sync( ($sc->{bcw_dmatag}),  ($sc->{bcw_ring_map}), $sizeof{'struct bcw_dma_slot'} * $x, $sizeof{'struct bcw_dma_slot'},  &BUS_DMASYNC_PREREAD| &BUS_DMASYNC_PREWRITE); }  &while ( 0));
    }
}
unless(defined(&BCW_NTXFRAGS)) {
    sub BCW_NTXFRAGS () {	16;}
}
1;
