0

For example, see this code for BCM43xx Bluetooth driver adapted from BlueZ:

int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,
    const char *bdaddr)
{
    char chip_name[20];
    char fw_path[PATH_MAX];

    printf("bcm43xx_init\n");

    if (bcm43xx_reset(fd))
        return -1;

    if (bcm43xx_read_local_name(fd, chip_name, sizeof(chip_name)))
        return -1;

    if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) {
        fprintf(stderr, "Patch not found, continue anyway\n");
    } else {
        if (bcm43xx_set_speed(fd, ti, speed))
            return -1;

        if (bcm43xx_load_firmware(fd, fw_path))
            return -1;

        /* Controller speed has been reset to def speed */
        if (set_speed(fd, ti, def_speed) < 0) {
            perror("Can't set host baud rate");
            return -1;
        }

        if (bcm43xx_reset(fd))
            return -1;
    }

    if (bdaddr)
        bcm43xx_set_bdaddr(fd, bdaddr);

    if (bcm43xx_set_speed(fd, ti, speed))
        return -1;

    return 0;
}

In the middle of this function, it looks for a file on the file system and loads it to the chip by calling bcm43xx_load_firmware. Why does it need to do this every time?

Thanks in advance.

Xi Han
  • 323
  • 1
  • 7

1 Answers1

0

It only loads a patch file (not the entire firmware), which is stored in a RAM in the bcm43xx chip. That RAM naturally needs re-loading after power-cycling the bcm43xx chip.

TobiasMelin
  • 231
  • 2
  • 5
  • Thank you for answering my question. Is this patch file amending the original firmware like any other software patch? What's the pros and cons of this design compared with BIOS flashing, in which the firmware is updated in a non-volatile fashion? – Xi Han Nov 29 '16 at 16:18