Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 270437
b: refs/heads/master
c: 49957f3
h: refs/heads/master
i:
  270435: ed591c3
v: v3
  • Loading branch information
Andy Shevchenko authored and Takashi Iwai committed Sep 23, 2011
1 parent da80547 commit 72669a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ca595ab7a557f6cee21bf073fe2a242004cd19e
refs/heads/master: 49957f39665d50343e04effc65c78919364228ce
25 changes: 12 additions & 13 deletions trunk/sound/usb/6fire/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <linux/firmware.h>
#include <linux/bitrev.h>
#include <linux/kernel.h>

#include "firmware.h"
#include "chip.h"
Expand Down Expand Up @@ -59,21 +60,19 @@ struct ihex_record {
unsigned int txt_offset; /* current position in txt_data */
};

static u8 usb6fire_fw_ihex_nibble(const u8 n)
{
if (n >= '0' && n <= '9')
return n - '0';
else if (n >= 'A' && n <= 'F')
return n - ('A' - 10);
else if (n >= 'a' && n <= 'f')
return n - ('a' - 10);
return 0;
}

static u8 usb6fire_fw_ihex_hex(const u8 *data, u8 *crc)
{
u8 val = (usb6fire_fw_ihex_nibble(data[0]) << 4) |
usb6fire_fw_ihex_nibble(data[1]);
u8 val = 0;
int hval;

hval = hex_to_bin(data[0]);
if (hval >= 0)
val |= (hval << 4);

hval = hex_to_bin(data[1]);
if (hval >= 0)
val |= hval;

*crc += val;
return val;
}
Expand Down

0 comments on commit 72669a0

Please sign in to comment.