static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf,

                uint8_t *data, int len)

{

    int offset;

    uint8_t *rpkt;



    switch (ocf) {

    case OCF_CSR_SEND_FIRMWARE:

        /* Check if this is the bd_address packet */

        if (len >= 18 + 8 && data[12] == 0x01 && data[13] == 0x00) {

            offset = 18;

            s->bd_addr.b[0] = data[offset + 7];	/* Beyond cmd packet end(!?) */

            s->bd_addr.b[1] = data[offset + 6];

            s->bd_addr.b[2] = data[offset + 4];

            s->bd_addr.b[3] = data[offset + 0];

            s->bd_addr.b[4] = data[offset + 3];

            s->bd_addr.b[5] = data[offset + 2];



            s->hci->bdaddr_set(s->hci, s->bd_addr.b);

            fprintf(stderr, "%s: bd_address loaded from firmware: "

                            "%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,

                            s->bd_addr.b[0], s->bd_addr.b[1], s->bd_addr.b[2],

                            s->bd_addr.b[3], s->bd_addr.b[4], s->bd_addr.b[5]);

        }



        rpkt = csrhci_out_packet_event(s, EVT_VENDOR, 11);

        /* Status bytes: no error */

        rpkt[9] = 0x00;

        rpkt[10] = 0x00;

        break;



    default:

        fprintf(stderr, "%s: got a bad CMD packet\n", __FUNCTION__);

        return;

    }



    csrhci_fifo_wake(s);

}

static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf,

                uint8_t *data, int len)

{

    int offset;

    uint8_t *rpkt;



    switch (ocf) {

    case OCF_CSR_SEND_FIRMWARE:

        

        if (len >= 18 + 8 && data[12] == 0x01 && data[13] == 0x00) {

            offset = 18;

            s->bd_addr.b[0] = data[offset + 7];	

            s->bd_addr.b[1] = data[offset + 6];

            s->bd_addr.b[2] = data[offset + 4];

            s->bd_addr.b[3] = data[offset + 0];

            s->bd_addr.b[4] = data[offset + 3];

            s->bd_addr.b[5] = data[offset + 2];



            s->hci->bdaddr_set(s->hci, s->bd_addr.b);

            fprintf(stderr, "%s: bd_address loaded from firmware: "

                            "%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,

                            s->bd_addr.b[0], s->bd_addr.b[1], s->bd_addr.b[2],

                            s->bd_addr.b[3], s->bd_addr.b[4], s->bd_addr.b[5]);

        }



        rpkt = csrhci_out_packet_event(s, EVT_VENDOR, 11);

        

        rpkt[9] = 0x00;

        rpkt[10] = 0x00;

        break;



    default:

        fprintf(stderr, "%s: got a bad CMD packet\n", __FUNCTION__);

        return;

    }



    csrhci_fifo_wake(s);

}

static void FUNC_0(struct csrhci_s *VAR_0, int VAR_1,

                uint8_t *VAR_2, int VAR_3)

{

    int VAR_4;

    uint8_t *rpkt;



    switch (VAR_1) {

    case OCF_CSR_SEND_FIRMWARE:

        

        if (VAR_3 >= 18 + 8 && VAR_2[12] == 0x01 && VAR_2[13] == 0x00) {

            VAR_4 = 18;

            VAR_0->bd_addr.b[0] = VAR_2[VAR_4 + 7];	

            VAR_0->bd_addr.b[1] = VAR_2[VAR_4 + 6];

            VAR_0->bd_addr.b[2] = VAR_2[VAR_4 + 4];

            VAR_0->bd_addr.b[3] = VAR_2[VAR_4 + 0];

            VAR_0->bd_addr.b[4] = VAR_2[VAR_4 + 3];

            VAR_0->bd_addr.b[5] = VAR_2[VAR_4 + 2];



            VAR_0->hci->bdaddr_set(VAR_0->hci, VAR_0->bd_addr.b);

            fprintf(stderr, "%VAR_0: bd_address loaded from firmware: "

                            "%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,

                            VAR_0->bd_addr.b[0], VAR_0->bd_addr.b[1], VAR_0->bd_addr.b[2],

                            VAR_0->bd_addr.b[3], VAR_0->bd_addr.b[4], VAR_0->bd_addr.b[5]);

        }



        rpkt = csrhci_out_packet_event(VAR_0, EVT_VENDOR, 11);

        

        rpkt[9] = 0x00;

        rpkt[10] = 0x00;

        break;



    default:

        fprintf(stderr, "%VAR_0: got a bad CMD packet\n", __FUNCTION__);

        return;

    }



    csrhci_fifo_wake(VAR_0);

}

static void FUNC_0(struct csrhci_s *VAR_0, int VAR_1,
uint8_t *VAR_2, int VAR_3)
{ int VAR_4; uint8_t *rpkt; switch (VAR_1) { case OCF_CSR_SEND_FIRMWARE:
if (VAR_3 >= 18 + 8 && VAR_2[12] == 0x01 && VAR_2[13] == 0x00) { VAR_4 = 18; VAR_0->bd_addr.b[0] = VAR_2[VAR_4 + 7]; VAR_0->bd_addr.b[1] = VAR_2[VAR_4 + 6]; VAR_0->bd_addr.b[2] = VAR_2[VAR_4 + 4]; VAR_0->bd_addr.b[3] = VAR_2[VAR_4 + 0]; VAR_0->bd_addr.b[4] = VAR_2[VAR_4 + 3]; VAR_0->bd_addr.b[5] = VAR_2[VAR_4 + 2]; VAR_0->hci->bdaddr_set(VAR_0->hci, VAR_0->bd_addr.b); fprintf(stderr, "%VAR_0: bd_address loaded from firmware: "
"%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,
VAR_0->bd_addr.b[0], VAR_0->bd_addr.b[1], VAR_0->bd_addr.b[2],
VAR_0->bd_addr.b[3], VAR_0->bd_addr.b[4], VAR_0->bd_addr.b[5]); } rpkt = csrhci_out_packet_event(VAR_0, EVT_VENDOR, 11); rpkt[9] = 0x00; rpkt[10] = 0x00; break; default:
fprintf(stderr, "%VAR_0: got a bad CMD packet\n", __FUNCTION__); return; } csrhci_fifo_wake(VAR_0); }