mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
Add str
extension to extract_programmer_param function name
This patch changes the function name of extract_programmer_param() to extract_programmer_param_str() as this function name will clearly specify that it returns the value of the given parameter as a string. Signed-off-by: Chinmay Lonkar <chinmay20220@gmail.com> Change-Id: Id7b9fff4d3e1de22abd31b8123a1d237cd0f5c97 Reviewed-on: https://review.coreboot.org/c/flashrom/+/65521 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Thomas Heijligen <src@posteo.de>
This commit is contained in:
parent
f0fae1a9a5
commit
1bb5ddde60
2
atavia.c
2
atavia.c
@ -145,7 +145,7 @@ static const struct par_master lpc_master_atavia = {
|
|||||||
|
|
||||||
static int atavia_init(void)
|
static int atavia_init(void)
|
||||||
{
|
{
|
||||||
char *arg = extract_programmer_param("offset");
|
char *arg = extract_programmer_param_str("offset");
|
||||||
if (arg) {
|
if (arg) {
|
||||||
if (strlen(arg) == 0) {
|
if (strlen(arg) == 0) {
|
||||||
msg_perr("Missing argument for offset.\n");
|
msg_perr("Missing argument for offset.\n");
|
||||||
|
@ -331,7 +331,7 @@ static int buspirate_spi_init(void)
|
|||||||
unsigned char *bp_commbuf;
|
unsigned char *bp_commbuf;
|
||||||
int bp_commbufsize;
|
int bp_commbufsize;
|
||||||
|
|
||||||
dev = extract_programmer_param("dev");
|
dev = extract_programmer_param_str("dev");
|
||||||
if (dev && !strlen(dev)) {
|
if (dev && !strlen(dev)) {
|
||||||
free(dev);
|
free(dev);
|
||||||
dev = NULL;
|
dev = NULL;
|
||||||
@ -341,7 +341,7 @@ static int buspirate_spi_init(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = extract_programmer_param("spispeed");
|
tmp = extract_programmer_param_str("spispeed");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
for (i = 0; spispeeds[i].name; i++) {
|
for (i = 0; spispeeds[i].name; i++) {
|
||||||
if (!strncasecmp(spispeeds[i].name, tmp, strlen(spispeeds[i].name))) {
|
if (!strncasecmp(spispeeds[i].name, tmp, strlen(spispeeds[i].name))) {
|
||||||
@ -355,7 +355,7 @@ static int buspirate_spi_init(void)
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
/* Extract serialspeed parameter */
|
/* Extract serialspeed parameter */
|
||||||
tmp = extract_programmer_param("serialspeed");
|
tmp = extract_programmer_param_str("serialspeed");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
for (i = 0; serialspeeds[i].name; i++) {
|
for (i = 0; serialspeeds[i].name; i++) {
|
||||||
if (!strncasecmp(serialspeeds[i].name, tmp, strlen(serialspeeds[i].name))) {
|
if (!strncasecmp(serialspeeds[i].name, tmp, strlen(serialspeeds[i].name))) {
|
||||||
@ -368,7 +368,7 @@ static int buspirate_spi_init(void)
|
|||||||
}
|
}
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
tmp = extract_programmer_param("pullups");
|
tmp = extract_programmer_param_str("pullups");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if (strcasecmp("on", tmp) == 0)
|
if (strcasecmp("on", tmp) == 0)
|
||||||
pullup = 1;
|
pullup = 1;
|
||||||
@ -379,7 +379,7 @@ static int buspirate_spi_init(void)
|
|||||||
}
|
}
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
tmp = extract_programmer_param("psus");
|
tmp = extract_programmer_param_str("psus");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if (strcasecmp("on", tmp) == 0)
|
if (strcasecmp("on", tmp) == 0)
|
||||||
psu = 1;
|
psu = 1;
|
||||||
|
@ -428,7 +428,7 @@ static int enable_flash_ich_fwh_decode(struct pci_dev *dev, enum ich_chipset ich
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *idsel = extract_programmer_param("fwh_idsel");
|
char *idsel = extract_programmer_param_str("fwh_idsel");
|
||||||
if (idsel && strlen(idsel)) {
|
if (idsel && strlen(idsel)) {
|
||||||
if (!implemented) {
|
if (!implemented) {
|
||||||
msg_perr("Error: fwh_idsel= specified, but (yet) unsupported on this chipset.\n");
|
msg_perr("Error: fwh_idsel= specified, but (yet) unsupported on this chipset.\n");
|
||||||
|
10
dediprog.c
10
dediprog.c
@ -1086,7 +1086,7 @@ static int dediprog_init(void)
|
|||||||
long target = FLASH_TYPE_APPLICATION_FLASH_1;
|
long target = FLASH_TYPE_APPLICATION_FLASH_1;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
spispeed = extract_programmer_param("spispeed");
|
spispeed = extract_programmer_param_str("spispeed");
|
||||||
if (spispeed) {
|
if (spispeed) {
|
||||||
for (i = 0; spispeeds[i].name; ++i) {
|
for (i = 0; spispeeds[i].name; ++i) {
|
||||||
if (!strcasecmp(spispeeds[i].name, spispeed)) {
|
if (!strcasecmp(spispeeds[i].name, spispeed)) {
|
||||||
@ -1102,7 +1102,7 @@ static int dediprog_init(void)
|
|||||||
free(spispeed);
|
free(spispeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
voltage = extract_programmer_param("voltage");
|
voltage = extract_programmer_param_str("voltage");
|
||||||
if (voltage) {
|
if (voltage) {
|
||||||
millivolt = parse_voltage(voltage);
|
millivolt = parse_voltage(voltage);
|
||||||
free(voltage);
|
free(voltage);
|
||||||
@ -1111,7 +1111,7 @@ static int dediprog_init(void)
|
|||||||
msg_pinfo("Setting voltage to %i mV\n", millivolt);
|
msg_pinfo("Setting voltage to %i mV\n", millivolt);
|
||||||
}
|
}
|
||||||
|
|
||||||
id_str = extract_programmer_param("id");
|
id_str = extract_programmer_param_str("id");
|
||||||
if (id_str) {
|
if (id_str) {
|
||||||
char prefix0, prefix1;
|
char prefix0, prefix1;
|
||||||
if (sscanf(id_str, "%c%c%d", &prefix0, &prefix1, &id) != 3) {
|
if (sscanf(id_str, "%c%c%d", &prefix0, &prefix1, &id) != 3) {
|
||||||
@ -1134,7 +1134,7 @@ static int dediprog_init(void)
|
|||||||
}
|
}
|
||||||
free(id_str);
|
free(id_str);
|
||||||
|
|
||||||
device = extract_programmer_param("device");
|
device = extract_programmer_param_str("device");
|
||||||
if (device) {
|
if (device) {
|
||||||
char *dev_suffix;
|
char *dev_suffix;
|
||||||
if (id != -1) {
|
if (id != -1) {
|
||||||
@ -1161,7 +1161,7 @@ static int dediprog_init(void)
|
|||||||
}
|
}
|
||||||
free(device);
|
free(device);
|
||||||
|
|
||||||
target_str = extract_programmer_param("target");
|
target_str = extract_programmer_param_str("target");
|
||||||
if (target_str) {
|
if (target_str) {
|
||||||
char *target_suffix;
|
char *target_suffix;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
@ -153,7 +153,7 @@ static int developerbox_spi_init(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *serialno = extract_programmer_param("serial");
|
char *serialno = extract_programmer_param_str("serial");
|
||||||
if (serialno)
|
if (serialno)
|
||||||
msg_pdbg("Looking for serial number commencing %s\n", serialno);
|
msg_pdbg("Looking for serial number commencing %s\n", serialno);
|
||||||
cp210x_handle = usb_dev_get_by_vid_pid_serial(usb_ctx,
|
cp210x_handle = usb_dev_get_by_vid_pid_serial(usb_ctx,
|
||||||
|
@ -407,7 +407,7 @@ static int digilent_spi_init(void)
|
|||||||
goto close_handle;
|
goto close_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = extract_programmer_param("spispeed");
|
p = extract_programmer_param_str("spispeed");
|
||||||
if (p) {
|
if (p) {
|
||||||
for (i = 0; spispeeds[i].name; ++i) {
|
for (i = 0; spispeeds[i].name; ++i) {
|
||||||
if (!strcasecmp(spispeeds[i].name, p)) {
|
if (!strcasecmp(spispeeds[i].name, p)) {
|
||||||
@ -423,7 +423,7 @@ static int digilent_spi_init(void)
|
|||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
p = extract_programmer_param("reset");
|
p = extract_programmer_param_str("reset");
|
||||||
if (p && strlen(p))
|
if (p && strlen(p))
|
||||||
reset_board = (p[0] == '1');
|
reset_board = (p[0] == '1');
|
||||||
else
|
else
|
||||||
|
@ -946,7 +946,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
char *status = NULL;
|
char *status = NULL;
|
||||||
int size = -1; /* size for VARIABLE_SIZE chip device */
|
int size = -1; /* size for VARIABLE_SIZE chip device */
|
||||||
|
|
||||||
bustext = extract_programmer_param("bus");
|
bustext = extract_programmer_param_str("bus");
|
||||||
msg_pdbg("Requested buses are: %s\n", bustext ? bustext : "default");
|
msg_pdbg("Requested buses are: %s\n", bustext ? bustext : "default");
|
||||||
if (!bustext)
|
if (!bustext)
|
||||||
bustext = strdup("parallel+lpc+fwh+spi+prog");
|
bustext = strdup("parallel+lpc+fwh+spi+prog");
|
||||||
@ -978,7 +978,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
msg_pdbg("Support for all flash bus types disabled.\n");
|
msg_pdbg("Support for all flash bus types disabled.\n");
|
||||||
free(bustext);
|
free(bustext);
|
||||||
|
|
||||||
tmp = extract_programmer_param("spi_write_256_chunksize");
|
tmp = extract_programmer_param_str("spi_write_256_chunksize");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
data->spi_write_256_chunksize = strtoul(tmp, &endptr, 0);
|
data->spi_write_256_chunksize = strtoul(tmp, &endptr, 0);
|
||||||
if (*endptr != '\0' || data->spi_write_256_chunksize < 1) {
|
if (*endptr != '\0' || data->spi_write_256_chunksize < 1) {
|
||||||
@ -989,7 +989,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
}
|
}
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
tmp = extract_programmer_param("spi_blacklist");
|
tmp = extract_programmer_param_str("spi_blacklist");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
i = strlen(tmp);
|
i = strlen(tmp);
|
||||||
if (!strncmp(tmp, "0x", 2)) {
|
if (!strncmp(tmp, "0x", 2)) {
|
||||||
@ -1025,7 +1025,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
}
|
}
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
tmp = extract_programmer_param("spi_ignorelist");
|
tmp = extract_programmer_param_str("spi_ignorelist");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
i = strlen(tmp);
|
i = strlen(tmp);
|
||||||
if (!strncmp(tmp, "0x", 2)) {
|
if (!strncmp(tmp, "0x", 2)) {
|
||||||
@ -1062,7 +1062,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
/* frequency to emulate in Hz (default), KHz, or MHz */
|
/* frequency to emulate in Hz (default), KHz, or MHz */
|
||||||
tmp = extract_programmer_param("freq");
|
tmp = extract_programmer_param_str("freq");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
unsigned long int freq;
|
unsigned long int freq;
|
||||||
char *units = tmp;
|
char *units = tmp;
|
||||||
@ -1112,7 +1112,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
}
|
}
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
tmp = extract_programmer_param("size");
|
tmp = extract_programmer_param_str("size");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
size = strtol(tmp, NULL, 10);
|
size = strtol(tmp, NULL, 10);
|
||||||
if (size <= 0 || (size % 1024 != 0)) {
|
if (size <= 0 || (size % 1024 != 0)) {
|
||||||
@ -1124,7 +1124,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = extract_programmer_param("hwwp");
|
tmp = extract_programmer_param_str("hwwp");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if (!strcmp(tmp, "yes")) {
|
if (!strcmp(tmp, "yes")) {
|
||||||
msg_pdbg("Emulated chip will have hardware WP enabled\n");
|
msg_pdbg("Emulated chip will have hardware WP enabled\n");
|
||||||
@ -1139,7 +1139,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = extract_programmer_param("emulate");
|
tmp = extract_programmer_param_str("emulate");
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
if (size != -1) {
|
if (size != -1) {
|
||||||
msg_perr("%s: size parameter is only valid for VARIABLE_SIZE chip.\n", __func__);
|
msg_perr("%s: size parameter is only valid for VARIABLE_SIZE chip.\n", __func__);
|
||||||
@ -1271,7 +1271,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
/* Should emulated flash erase to zero (yes/no)? */
|
/* Should emulated flash erase to zero (yes/no)? */
|
||||||
tmp = extract_programmer_param("erase_to_zero");
|
tmp = extract_programmer_param_str("erase_to_zero");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if (data->emu_chip != EMULATE_VARIABLE_SIZE) {
|
if (data->emu_chip != EMULATE_VARIABLE_SIZE) {
|
||||||
msg_perr("%s: erase_to_zero parameter is not valid for real chip.\n", __func__);
|
msg_perr("%s: erase_to_zero parameter is not valid for real chip.\n", __func__);
|
||||||
@ -1291,7 +1291,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
|
|||||||
}
|
}
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
status = extract_programmer_param("spi_status");
|
status = extract_programmer_param_str("spi_status");
|
||||||
if (status) {
|
if (status) {
|
||||||
unsigned int emu_status;
|
unsigned int emu_status;
|
||||||
|
|
||||||
@ -1367,7 +1367,7 @@ static int dummy_init(void)
|
|||||||
memset(data->flashchip_contents, data->erase_to_zero ? 0x00 : 0xff, data->emu_chip_size);
|
memset(data->flashchip_contents, data->erase_to_zero ? 0x00 : 0xff, data->emu_chip_size);
|
||||||
|
|
||||||
/* Will be freed by shutdown function if necessary. */
|
/* Will be freed by shutdown function if necessary. */
|
||||||
data->emu_persistent_image = extract_programmer_param("image");
|
data->emu_persistent_image = extract_programmer_param_str("image");
|
||||||
if (!data->emu_persistent_image) {
|
if (!data->emu_persistent_image) {
|
||||||
/* Nothing else to do. */
|
/* Nothing else to do. */
|
||||||
goto dummy_init_out;
|
goto dummy_init_out;
|
||||||
|
@ -325,7 +325,7 @@ static char *extract_param(const char *const *haystack, const char *needle, cons
|
|||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *extract_programmer_param(const char *param_name)
|
char *extract_programmer_param_str(const char *param_name)
|
||||||
{
|
{
|
||||||
return extract_param(&programmer_param, param_name, ",");
|
return extract_param(&programmer_param, param_name, ",");
|
||||||
}
|
}
|
||||||
|
14
ft2232_spi.c
14
ft2232_spi.c
@ -335,7 +335,7 @@ static int ft2232_spi_init(void)
|
|||||||
struct ftdi_context ftdic;
|
struct ftdi_context ftdic;
|
||||||
struct ft2232_data *spi_data;
|
struct ft2232_data *spi_data;
|
||||||
|
|
||||||
arg = extract_programmer_param("type");
|
arg = extract_programmer_param_str("type");
|
||||||
if (arg) {
|
if (arg) {
|
||||||
if (!strcasecmp(arg, "2232H")) {
|
if (!strcasecmp(arg, "2232H")) {
|
||||||
ft2232_type = FTDI_FT2232H_PID;
|
ft2232_type = FTDI_FT2232H_PID;
|
||||||
@ -431,7 +431,7 @@ static int ft2232_spi_init(void)
|
|||||||
/* Remember reserved pins before pindir gets modified. */
|
/* Remember reserved pins before pindir gets modified. */
|
||||||
const uint8_t rsv_bits = pindir & 0xf0;
|
const uint8_t rsv_bits = pindir & 0xf0;
|
||||||
|
|
||||||
arg = extract_programmer_param("port");
|
arg = extract_programmer_param_str("port");
|
||||||
if (arg) {
|
if (arg) {
|
||||||
switch (toupper((unsigned char)*arg)) {
|
switch (toupper((unsigned char)*arg)) {
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -464,7 +464,7 @@ static int ft2232_spi_init(void)
|
|||||||
}
|
}
|
||||||
free(arg);
|
free(arg);
|
||||||
|
|
||||||
arg = extract_programmer_param("divisor");
|
arg = extract_programmer_param_str("divisor");
|
||||||
if (arg && strlen(arg)) {
|
if (arg && strlen(arg)) {
|
||||||
unsigned int temp = 0;
|
unsigned int temp = 0;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
@ -480,7 +480,7 @@ static int ft2232_spi_init(void)
|
|||||||
free(arg);
|
free(arg);
|
||||||
|
|
||||||
bool csgpiol_set = false;
|
bool csgpiol_set = false;
|
||||||
arg = extract_programmer_param("csgpiol");
|
arg = extract_programmer_param_str("csgpiol");
|
||||||
if (arg) {
|
if (arg) {
|
||||||
csgpiol_set = true;
|
csgpiol_set = true;
|
||||||
msg_pwarn("Deprecation warning: `csgpiol` is deprecated and will be removed "
|
msg_pwarn("Deprecation warning: `csgpiol` is deprecated and will be removed "
|
||||||
@ -513,7 +513,7 @@ static int ft2232_spi_init(void)
|
|||||||
for (int pin = 0; pin < 4; pin++) {
|
for (int pin = 0; pin < 4; pin++) {
|
||||||
char gpiol_param[7];
|
char gpiol_param[7];
|
||||||
snprintf(gpiol_param, sizeof(gpiol_param), "gpiol%d", pin);
|
snprintf(gpiol_param, sizeof(gpiol_param), "gpiol%d", pin);
|
||||||
arg = extract_programmer_param(gpiol_param);
|
arg = extract_programmer_param_str(gpiol_param);
|
||||||
|
|
||||||
if (!arg)
|
if (!arg)
|
||||||
continue;
|
continue;
|
||||||
@ -586,8 +586,8 @@ format_error:
|
|||||||
msg_perr("Unable to select channel (%s).\n", ftdi_get_error_string(&ftdic));
|
msg_perr("Unable to select channel (%s).\n", ftdi_get_error_string(&ftdic));
|
||||||
}
|
}
|
||||||
|
|
||||||
arg = extract_programmer_param("serial");
|
arg = extract_programmer_param_str("serial");
|
||||||
arg2 = extract_programmer_param("description");
|
arg2 = extract_programmer_param_str("description");
|
||||||
|
|
||||||
f = ftdi_usb_open_desc(&ftdic, ft2232_vid, ft2232_type, arg2, arg);
|
f = ftdi_usb_open_desc(&ftdic, ft2232_vid, ft2232_type, arg2, arg);
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@ int i2c_open_from_programmer_params(uint16_t addr, int force)
|
|||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
|
||||||
char *bus_str = extract_programmer_param("bus");
|
char *bus_str = extract_programmer_param_str("bus");
|
||||||
char *device_path = extract_programmer_param("devpath");
|
char *device_path = extract_programmer_param_str("devpath");
|
||||||
|
|
||||||
if (device_path != NULL && bus_str != NULL) {
|
if (device_path != NULL && bus_str != NULL) {
|
||||||
msg_perr("%s: only one of bus and devpath may be specified\n", __func__);
|
msg_perr("%s: only one of bus and devpath may be specified\n", __func__);
|
||||||
|
2
ichspi.c
2
ichspi.c
@ -1855,7 +1855,7 @@ enum ich_spi_mode {
|
|||||||
|
|
||||||
static int get_ich_spi_mode_param(enum ich_spi_mode *ich_spi_mode)
|
static int get_ich_spi_mode_param(enum ich_spi_mode *ich_spi_mode)
|
||||||
{
|
{
|
||||||
char *const arg = extract_programmer_param("ich_spi_mode");
|
char *const arg = extract_programmer_param_str("ich_spi_mode");
|
||||||
if (arg && !strcmp(arg, "hwseq")) {
|
if (arg && !strcmp(arg, "hwseq")) {
|
||||||
*ich_spi_mode = ich_hwseq;
|
*ich_spi_mode = ich_hwseq;
|
||||||
msg_pspew("user selected hwseq\n");
|
msg_pspew("user selected hwseq\n");
|
||||||
|
@ -287,7 +287,7 @@ extern struct decode_sizes max_rom_decode;
|
|||||||
extern int programmer_may_write;
|
extern int programmer_may_write;
|
||||||
extern unsigned long flashbase;
|
extern unsigned long flashbase;
|
||||||
unsigned int count_max_decode_exceedings(const struct flashctx *flash);
|
unsigned int count_max_decode_exceedings(const struct flashctx *flash);
|
||||||
char *extract_programmer_param(const char *param_name);
|
char *extract_programmer_param_str(const char *param_name);
|
||||||
|
|
||||||
/* spi.c */
|
/* spi.c */
|
||||||
#define MAX_DATA_UNSPECIFIED 0
|
#define MAX_DATA_UNSPECIFIED 0
|
||||||
|
@ -99,7 +99,7 @@ struct usb_match {
|
|||||||
* Initialize a usb_match structure so that each value's name matches the
|
* Initialize a usb_match structure so that each value's name matches the
|
||||||
* values name in the usb_match structure (so bus.name == "bus"...), and
|
* values name in the usb_match structure (so bus.name == "bus"...), and
|
||||||
* look for each value in the flashrom command line via
|
* look for each value in the flashrom command line via
|
||||||
* extract_programmer_param. If the value is found convert it to an integer
|
* extract_programmer_param_str. If the value is found convert it to an integer
|
||||||
* using strtol, accepting hex, decimal and octal encoding.
|
* using strtol, accepting hex, decimal and octal encoding.
|
||||||
*/
|
*/
|
||||||
void usb_match_init(struct usb_match *match);
|
void usb_match_init(struct usb_match *match);
|
||||||
|
@ -128,7 +128,7 @@ static int get_params(int *boardenable, int *boardmismatch,
|
|||||||
*board_vendor = NULL;
|
*board_vendor = NULL;
|
||||||
*board_model = NULL;
|
*board_model = NULL;
|
||||||
|
|
||||||
arg = extract_programmer_param("boardenable");
|
arg = extract_programmer_param_str("boardenable");
|
||||||
if (arg && !strcmp(arg,"force")) {
|
if (arg && !strcmp(arg,"force")) {
|
||||||
*boardenable = 1;
|
*boardenable = 1;
|
||||||
} else if (arg && !strlen(arg)) {
|
} else if (arg && !strlen(arg)) {
|
||||||
@ -142,7 +142,7 @@ static int get_params(int *boardenable, int *boardmismatch,
|
|||||||
}
|
}
|
||||||
free(arg);
|
free(arg);
|
||||||
|
|
||||||
arg = extract_programmer_param("boardmismatch");
|
arg = extract_programmer_param_str("boardmismatch");
|
||||||
if (arg && !strcmp(arg,"force")) {
|
if (arg && !strcmp(arg,"force")) {
|
||||||
*boardmismatch = 1;
|
*boardmismatch = 1;
|
||||||
} else if (arg && !strlen(arg)) {
|
} else if (arg && !strlen(arg)) {
|
||||||
@ -156,7 +156,7 @@ static int get_params(int *boardenable, int *boardmismatch,
|
|||||||
}
|
}
|
||||||
free(arg);
|
free(arg);
|
||||||
|
|
||||||
arg = extract_programmer_param("laptop");
|
arg = extract_programmer_param_str("laptop");
|
||||||
if (arg && !strcmp(arg, "force_I_want_a_brick"))
|
if (arg && !strcmp(arg, "force_I_want_a_brick"))
|
||||||
*force_laptop = 1;
|
*force_laptop = 1;
|
||||||
else if (arg && !strcmp(arg, "this_is_not_a_laptop"))
|
else if (arg && !strcmp(arg, "this_is_not_a_laptop"))
|
||||||
@ -172,7 +172,7 @@ static int get_params(int *boardenable, int *boardmismatch,
|
|||||||
}
|
}
|
||||||
free(arg);
|
free(arg);
|
||||||
|
|
||||||
arg = extract_programmer_param("mainboard");
|
arg = extract_programmer_param_str("mainboard");
|
||||||
if (arg && strlen(arg)) {
|
if (arg && strlen(arg)) {
|
||||||
if (board_parse_parameter(arg, board_vendor, board_model)) {
|
if (board_parse_parameter(arg, board_vendor, board_model)) {
|
||||||
free(arg);
|
free(arg);
|
||||||
|
@ -327,7 +327,7 @@ static uint16_t it87spi_probe(uint16_t port)
|
|||||||
|
|
||||||
enter_conf_mode_ite(port);
|
enter_conf_mode_ite(port);
|
||||||
|
|
||||||
char *param = extract_programmer_param("dualbiosindex");
|
char *param = extract_programmer_param_str("dualbiosindex");
|
||||||
if (param != NULL) {
|
if (param != NULL) {
|
||||||
sio_write(port, 0x07, 0x07); /* Select GPIO LDN */
|
sio_write(port, 0x07, 0x07); /* Select GPIO LDN */
|
||||||
tmp = sio_read(port, 0xEF);
|
tmp = sio_read(port, 0xEF);
|
||||||
@ -393,7 +393,7 @@ static uint16_t it87spi_probe(uint16_t port)
|
|||||||
flashport |= sio_read(port, 0x65);
|
flashport |= sio_read(port, 0x65);
|
||||||
msg_pdbg("Serial flash port 0x%04x\n", flashport);
|
msg_pdbg("Serial flash port 0x%04x\n", flashport);
|
||||||
/* Non-default port requested? */
|
/* Non-default port requested? */
|
||||||
param = extract_programmer_param("it87spiport");
|
param = extract_programmer_param_str("it87spiport");
|
||||||
if (param) {
|
if (param) {
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
unsigned long forced_flashport;
|
unsigned long forced_flashport;
|
||||||
|
@ -202,7 +202,7 @@ static int jlink_spi_init(void)
|
|||||||
struct jlink_spi_data *jlink_data = NULL;
|
struct jlink_spi_data *jlink_data = NULL;
|
||||||
bool enable_target_power;
|
bool enable_target_power;
|
||||||
|
|
||||||
arg = extract_programmer_param("spispeed");
|
arg = extract_programmer_param_str("spispeed");
|
||||||
|
|
||||||
if (arg) {
|
if (arg) {
|
||||||
char *endptr;
|
char *endptr;
|
||||||
@ -229,7 +229,7 @@ static int jlink_spi_init(void)
|
|||||||
bool use_serial_number;
|
bool use_serial_number;
|
||||||
uint32_t serial_number;
|
uint32_t serial_number;
|
||||||
|
|
||||||
arg = extract_programmer_param("serial");
|
arg = extract_programmer_param_str("serial");
|
||||||
|
|
||||||
if (arg) {
|
if (arg) {
|
||||||
if (!strlen(arg)) {
|
if (!strlen(arg)) {
|
||||||
@ -258,7 +258,7 @@ static int jlink_spi_init(void)
|
|||||||
free(arg);
|
free(arg);
|
||||||
|
|
||||||
reset_cs = true;
|
reset_cs = true;
|
||||||
arg = extract_programmer_param("cs");
|
arg = extract_programmer_param_str("cs");
|
||||||
|
|
||||||
if (arg) {
|
if (arg) {
|
||||||
if (!strcasecmp(arg, "reset")) {
|
if (!strcasecmp(arg, "reset")) {
|
||||||
@ -280,7 +280,7 @@ static int jlink_spi_init(void)
|
|||||||
msg_pdbg("Using TRST as chip select signal.\n");
|
msg_pdbg("Using TRST as chip select signal.\n");
|
||||||
|
|
||||||
enable_target_power = false;
|
enable_target_power = false;
|
||||||
arg = extract_programmer_param("power");
|
arg = extract_programmer_param_str("power");
|
||||||
|
|
||||||
if (arg) {
|
if (arg) {
|
||||||
if (!strcasecmp(arg, "on")) {
|
if (!strcasecmp(arg, "on")) {
|
||||||
|
@ -500,7 +500,7 @@ static int linux_mtd_init(void)
|
|||||||
int ret = 1;
|
int ret = 1;
|
||||||
struct linux_mtd_data *data = NULL;
|
struct linux_mtd_data *data = NULL;
|
||||||
|
|
||||||
param = extract_programmer_param("dev");
|
param = extract_programmer_param_str("dev");
|
||||||
if (param) {
|
if (param) {
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ static int linux_spi_init(void)
|
|||||||
size_t max_kernel_buf_size;
|
size_t max_kernel_buf_size;
|
||||||
struct linux_spi_data *spi_data;
|
struct linux_spi_data *spi_data;
|
||||||
|
|
||||||
p = extract_programmer_param("spispeed");
|
p = extract_programmer_param_str("spispeed");
|
||||||
if (p && strlen(p)) {
|
if (p && strlen(p)) {
|
||||||
speed_hz = (uint32_t)strtoul(p, &endp, 10) * 1000;
|
speed_hz = (uint32_t)strtoul(p, &endp, 10) * 1000;
|
||||||
if (p == endp || speed_hz == 0) {
|
if (p == endp || speed_hz == 0) {
|
||||||
@ -191,7 +191,7 @@ static int linux_spi_init(void)
|
|||||||
}
|
}
|
||||||
free(p);
|
free(p);
|
||||||
|
|
||||||
dev = extract_programmer_param("dev");
|
dev = extract_programmer_param_str("dev");
|
||||||
if (!dev || !strlen(dev)) {
|
if (!dev || !strlen(dev)) {
|
||||||
msg_perr("No SPI device given. Use flashrom -p "
|
msg_perr("No SPI device given. Use flashrom -p "
|
||||||
"linux_spi:dev=/dev/spidevX.Y\n");
|
"linux_spi:dev=/dev/spidevX.Y\n");
|
||||||
|
@ -158,7 +158,7 @@ static int mstarddc_spi_init(void)
|
|||||||
struct mstarddc_spi_data *mstarddc_data;
|
struct mstarddc_spi_data *mstarddc_data;
|
||||||
|
|
||||||
// Get device, address from command-line
|
// Get device, address from command-line
|
||||||
char *i2c_device = extract_programmer_param("dev");
|
char *i2c_device = extract_programmer_param_str("dev");
|
||||||
if (i2c_device != NULL && strlen(i2c_device) > 0) {
|
if (i2c_device != NULL && strlen(i2c_device) > 0) {
|
||||||
char *i2c_address = strchr(i2c_device, ':');
|
char *i2c_address = strchr(i2c_device, ':');
|
||||||
if (i2c_address != NULL) {
|
if (i2c_address != NULL) {
|
||||||
@ -181,7 +181,7 @@ static int mstarddc_spi_init(void)
|
|||||||
msg_pinfo("Info: Will try to use device %s and address 0x%02x.\n", i2c_device, mstarddc_addr);
|
msg_pinfo("Info: Will try to use device %s and address 0x%02x.\n", i2c_device, mstarddc_addr);
|
||||||
|
|
||||||
// Get noreset=1 option from command-line
|
// Get noreset=1 option from command-line
|
||||||
char *noreset = extract_programmer_param("noreset");
|
char *noreset = extract_programmer_param_str("noreset");
|
||||||
if (noreset != NULL && noreset[0] == '1')
|
if (noreset != NULL && noreset[0] == '1')
|
||||||
mstarddc_doreset = 0;
|
mstarddc_doreset = 0;
|
||||||
free(noreset);
|
free(noreset);
|
||||||
|
10
ni845x_spi.c
10
ni845x_spi.c
@ -552,7 +552,7 @@ static int ni845x_spi_init(void)
|
|||||||
int32 tmp = 0;
|
int32 tmp = 0;
|
||||||
|
|
||||||
// read the cs parameter (which Chip select should we use)
|
// read the cs parameter (which Chip select should we use)
|
||||||
CS_str = extract_programmer_param("cs");
|
CS_str = extract_programmer_param_str("cs");
|
||||||
if (CS_str) {
|
if (CS_str) {
|
||||||
CS_number = CS_str[0] - '0';
|
CS_number = CS_str[0] - '0';
|
||||||
free(CS_str);
|
free(CS_str);
|
||||||
@ -562,7 +562,7 @@ static int ni845x_spi_init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
voltage = extract_programmer_param("voltage");
|
voltage = extract_programmer_param_str("voltage");
|
||||||
if (voltage != NULL) {
|
if (voltage != NULL) {
|
||||||
requested_io_voltage_mV = parse_voltage(voltage);
|
requested_io_voltage_mV = parse_voltage(voltage);
|
||||||
free(voltage);
|
free(voltage);
|
||||||
@ -570,9 +570,9 @@ static int ni845x_spi_init(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_number = extract_programmer_param("serial");
|
serial_number = extract_programmer_param_str("serial");
|
||||||
|
|
||||||
speed_str = extract_programmer_param("spispeed");
|
speed_str = extract_programmer_param_str("spispeed");
|
||||||
if (speed_str) {
|
if (speed_str) {
|
||||||
spi_speed_KHz = strtoul(speed_str, &endptr, 0);
|
spi_speed_KHz = strtoul(speed_str, &endptr, 0);
|
||||||
if (*endptr) {
|
if (*endptr) {
|
||||||
@ -585,7 +585,7 @@ static int ni845x_spi_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ignore_io_voltage_limits = false;
|
ignore_io_voltage_limits = false;
|
||||||
ignore_io_voltage_limits_str = extract_programmer_param("ignore_io_voltage_limits");
|
ignore_io_voltage_limits_str = extract_programmer_param_str("ignore_io_voltage_limits");
|
||||||
if (ignore_io_voltage_limits_str
|
if (ignore_io_voltage_limits_str
|
||||||
&& strcmp(ignore_io_voltage_limits_str, "yes") == 0) {
|
&& strcmp(ignore_io_voltage_limits_str, "yes") == 0) {
|
||||||
ignore_io_voltage_limits = true;
|
ignore_io_voltage_limits = true;
|
||||||
|
@ -117,7 +117,7 @@ static int ogp_spi_init(void)
|
|||||||
uint32_t ogp_reg__ce;
|
uint32_t ogp_reg__ce;
|
||||||
uint32_t ogp_reg_sck;
|
uint32_t ogp_reg_sck;
|
||||||
|
|
||||||
type = extract_programmer_param("rom");
|
type = extract_programmer_param_str("rom");
|
||||||
|
|
||||||
if (!type) {
|
if (!type) {
|
||||||
msg_perr("Please use flashrom -p ogp_spi:rom=... to specify "
|
msg_perr("Please use flashrom -p ogp_spi:rom=... to specify "
|
||||||
|
2
pcidev.c
2
pcidev.c
@ -272,7 +272,7 @@ struct pci_dev *pcidev_init(const struct dev_entry *devs, int bar)
|
|||||||
pci_filter_init(pacc, &filter);
|
pci_filter_init(pacc, &filter);
|
||||||
|
|
||||||
/* Filter by bb:dd.f (if supplied by the user). */
|
/* Filter by bb:dd.f (if supplied by the user). */
|
||||||
pcidev_bdf = extract_programmer_param("pci");
|
pcidev_bdf = extract_programmer_param_str("pci");
|
||||||
if (pcidev_bdf != NULL) {
|
if (pcidev_bdf != NULL) {
|
||||||
if ((msg = pci_filter_parse_slot(&filter, pcidev_bdf))) {
|
if ((msg = pci_filter_parse_slot(&filter, pcidev_bdf))) {
|
||||||
msg_perr("Error: %s\n", msg);
|
msg_perr("Error: %s\n", msg);
|
||||||
|
@ -409,7 +409,7 @@ static int pickit2_spi_init(void)
|
|||||||
libusb_device_handle *pickit2_handle;
|
libusb_device_handle *pickit2_handle;
|
||||||
struct pickit2_spi_data *pickit2_data;
|
struct pickit2_spi_data *pickit2_data;
|
||||||
int spispeed_idx = 0;
|
int spispeed_idx = 0;
|
||||||
char *spispeed = extract_programmer_param("spispeed");
|
char *spispeed = extract_programmer_param_str("spispeed");
|
||||||
if (spispeed != NULL) {
|
if (spispeed != NULL) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; spispeeds[i].name; i++) {
|
for (; spispeeds[i].name; i++) {
|
||||||
@ -427,7 +427,7 @@ static int pickit2_spi_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int millivolt = 3500;
|
int millivolt = 3500;
|
||||||
char *voltage = extract_programmer_param("voltage");
|
char *voltage = extract_programmer_param_str("voltage");
|
||||||
if (voltage != NULL) {
|
if (voltage != NULL) {
|
||||||
millivolt = parse_voltage(voltage);
|
millivolt = parse_voltage(voltage);
|
||||||
free(voltage);
|
free(voltage);
|
||||||
|
@ -130,7 +130,7 @@ static int get_params(enum pony_type *type, int *have_device)
|
|||||||
*have_device = 0;
|
*have_device = 0;
|
||||||
|
|
||||||
/* The parameter is in format "dev=/dev/device,type=serbang" */
|
/* The parameter is in format "dev=/dev/device,type=serbang" */
|
||||||
arg = extract_programmer_param("dev");
|
arg = extract_programmer_param_str("dev");
|
||||||
if (arg && strlen(arg)) {
|
if (arg && strlen(arg)) {
|
||||||
sp_fd = sp_openserport(arg, 9600);
|
sp_fd = sp_openserport(arg, 9600);
|
||||||
if (sp_fd == SER_INV_FD)
|
if (sp_fd == SER_INV_FD)
|
||||||
@ -140,7 +140,7 @@ static int get_params(enum pony_type *type, int *have_device)
|
|||||||
}
|
}
|
||||||
free(arg);
|
free(arg);
|
||||||
|
|
||||||
arg = extract_programmer_param("type");
|
arg = extract_programmer_param_str("type");
|
||||||
if (arg && !strcasecmp(arg, "serbang")) {
|
if (arg && !strcasecmp(arg, "serbang")) {
|
||||||
*type = TYPE_SERBANG;
|
*type = TYPE_SERBANG;
|
||||||
} else if (arg && !strcasecmp(arg, "si_prog")) {
|
} else if (arg && !strcasecmp(arg, "si_prog")) {
|
||||||
|
@ -1431,7 +1431,7 @@ static int configure_protocol(struct raiden_debug_spi_data *ctx_data)
|
|||||||
static int get_ap_request_type(void)
|
static int get_ap_request_type(void)
|
||||||
{
|
{
|
||||||
int ap_request = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP;
|
int ap_request = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP;
|
||||||
char *custom_rst_str = extract_programmer_param("custom_rst");
|
char *custom_rst_str = extract_programmer_param_str("custom_rst");
|
||||||
if (custom_rst_str) {
|
if (custom_rst_str) {
|
||||||
if (!strcasecmp(custom_rst_str, "true")) {
|
if (!strcasecmp(custom_rst_str, "true")) {
|
||||||
ap_request = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP_CUSTOM;
|
ap_request = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP_CUSTOM;
|
||||||
@ -1455,7 +1455,7 @@ static int get_target(void)
|
|||||||
*/
|
*/
|
||||||
int request_enable = RAIDEN_DEBUG_SPI_REQ_ENABLE;
|
int request_enable = RAIDEN_DEBUG_SPI_REQ_ENABLE;
|
||||||
|
|
||||||
char *target_str = extract_programmer_param("target");
|
char *target_str = extract_programmer_param_str("target");
|
||||||
if (target_str) {
|
if (target_str) {
|
||||||
if (!strcasecmp(target_str, "ap"))
|
if (!strcasecmp(target_str, "ap"))
|
||||||
request_enable = get_ap_request_type();
|
request_enable = get_ap_request_type();
|
||||||
@ -1484,7 +1484,7 @@ static void free_dev_list(struct usb_device **dev_lst)
|
|||||||
static int raiden_debug_spi_init(void)
|
static int raiden_debug_spi_init(void)
|
||||||
{
|
{
|
||||||
struct usb_match match;
|
struct usb_match match;
|
||||||
char *serial = extract_programmer_param("serial");
|
char *serial = extract_programmer_param_str("serial");
|
||||||
struct usb_device *current;
|
struct usb_device *current;
|
||||||
struct usb_device *device = NULL;
|
struct usb_device *device = NULL;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
@ -244,7 +244,7 @@ static int rayer_spi_init(void)
|
|||||||
uint8_t lpt_outbyte;
|
uint8_t lpt_outbyte;
|
||||||
|
|
||||||
/* Non-default port requested? */
|
/* Non-default port requested? */
|
||||||
arg = extract_programmer_param("iobase");
|
arg = extract_programmer_param_str("iobase");
|
||||||
if (arg) {
|
if (arg) {
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
@ -277,7 +277,7 @@ static int rayer_spi_init(void)
|
|||||||
msg_pdbg("Using address 0x%x as I/O base for parallel port access.\n",
|
msg_pdbg("Using address 0x%x as I/O base for parallel port access.\n",
|
||||||
lpt_iobase);
|
lpt_iobase);
|
||||||
|
|
||||||
arg = extract_programmer_param("type");
|
arg = extract_programmer_param_str("type");
|
||||||
if (arg) {
|
if (arg) {
|
||||||
for (; prog->type != NULL; prog++) {
|
for (; prog->type != NULL; prog++) {
|
||||||
if (strcasecmp(arg, prog->type) == 0) {
|
if (strcasecmp(arg, prog->type) == 0) {
|
||||||
|
@ -449,7 +449,7 @@ static int get_params(int *reset, int *enter_isp)
|
|||||||
char *reset_str = NULL, *isp_str = NULL;
|
char *reset_str = NULL, *isp_str = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
reset_str = extract_programmer_param("reset-mcu");
|
reset_str = extract_programmer_param_str("reset-mcu");
|
||||||
if (reset_str) {
|
if (reset_str) {
|
||||||
if (reset_str[0] == '1') {
|
if (reset_str[0] == '1') {
|
||||||
*reset = 1;
|
*reset = 1;
|
||||||
@ -464,7 +464,7 @@ static int get_params(int *reset, int *enter_isp)
|
|||||||
}
|
}
|
||||||
free(reset_str);
|
free(reset_str);
|
||||||
|
|
||||||
isp_str = extract_programmer_param("enter-isp");
|
isp_str = extract_programmer_param_str("enter-isp");
|
||||||
if (isp_str) {
|
if (isp_str) {
|
||||||
if (isp_str[0] == '1') {
|
if (isp_str[0] == '1') {
|
||||||
*enter_isp = 1;
|
*enter_isp = 1;
|
||||||
|
@ -416,7 +416,7 @@ static int handle_speed(struct pci_dev *dev, enum amd_chipset amd_gen, uint8_t *
|
|||||||
char *spispeed;
|
char *spispeed;
|
||||||
char *spireadmode;
|
char *spireadmode;
|
||||||
|
|
||||||
spispeed = extract_programmer_param("spispeed");
|
spispeed = extract_programmer_param_str("spispeed");
|
||||||
if (spispeed != NULL) {
|
if (spispeed != NULL) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < ARRAY_SIZE(spispeeds); i++) {
|
for (i = 0; i < ARRAY_SIZE(spispeeds); i++) {
|
||||||
@ -440,7 +440,7 @@ static int handle_speed(struct pci_dev *dev, enum amd_chipset amd_gen, uint8_t *
|
|||||||
free(spispeed);
|
free(spispeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
spireadmode = extract_programmer_param("spireadmode");
|
spireadmode = extract_programmer_param_str("spireadmode");
|
||||||
if (spireadmode != NULL) {
|
if (spireadmode != NULL) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < ARRAY_SIZE(spireadmodes); i++) {
|
for (i = 0; i < ARRAY_SIZE(spireadmodes); i++) {
|
||||||
@ -529,7 +529,7 @@ static int handle_imc(struct pci_dev *dev, enum amd_chipset amd_gen)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bool amd_imc_force = false;
|
bool amd_imc_force = false;
|
||||||
char *arg = extract_programmer_param("amd_imc_force");
|
char *arg = extract_programmer_param_str("amd_imc_force");
|
||||||
if (arg && !strcmp(arg, "yes")) {
|
if (arg && !strcmp(arg, "yes")) {
|
||||||
amd_imc_force = true;
|
amd_imc_force = true;
|
||||||
msg_pspew("amd_imc_force enabled.\n");
|
msg_pspew("amd_imc_force enabled.\n");
|
||||||
|
@ -573,7 +573,7 @@ static int serprog_init(void)
|
|||||||
int have_device = 0;
|
int have_device = 0;
|
||||||
|
|
||||||
/* the parameter is either of format "dev=/dev/device[:baud]" or "ip=ip:port" */
|
/* the parameter is either of format "dev=/dev/device[:baud]" or "ip=ip:port" */
|
||||||
device = extract_programmer_param("dev");
|
device = extract_programmer_param_str("dev");
|
||||||
if (device && strlen(device)) {
|
if (device && strlen(device)) {
|
||||||
char *baud_str = strstr(device, ":");
|
char *baud_str = strstr(device, ":");
|
||||||
if (baud_str != NULL) {
|
if (baud_str != NULL) {
|
||||||
@ -610,7 +610,7 @@ static int serprog_init(void)
|
|||||||
}
|
}
|
||||||
free(device);
|
free(device);
|
||||||
|
|
||||||
device = extract_programmer_param("ip");
|
device = extract_programmer_param_str("ip");
|
||||||
if (have_device && device) {
|
if (have_device && device) {
|
||||||
msg_perr("Error: Both host and device specified.\n"
|
msg_perr("Error: Both host and device specified.\n"
|
||||||
"Please use either dev= or ip= but not both.\n");
|
"Please use either dev= or ip= but not both.\n");
|
||||||
@ -738,7 +738,7 @@ static int serprog_init(void)
|
|||||||
spi_master_serprog.max_data_read = v;
|
spi_master_serprog.max_data_read = v;
|
||||||
msg_pdbg(MSGHEADER "Maximum read-n length is %d\n", v);
|
msg_pdbg(MSGHEADER "Maximum read-n length is %d\n", v);
|
||||||
}
|
}
|
||||||
spispeed = extract_programmer_param("spispeed");
|
spispeed = extract_programmer_param_str("spispeed");
|
||||||
if (spispeed && strlen(spispeed)) {
|
if (spispeed && strlen(spispeed)) {
|
||||||
uint32_t f_spi_req, f_spi;
|
uint32_t f_spi_req, f_spi;
|
||||||
uint8_t buf[4];
|
uint8_t buf[4];
|
||||||
|
@ -487,7 +487,7 @@ static int stlinkv3_spi_init(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
serialno = extract_programmer_param("serial");
|
serialno = extract_programmer_param_str("serial");
|
||||||
if (serialno)
|
if (serialno)
|
||||||
msg_pdbg("Opening STLINK-V3 with serial: %s\n", serialno);
|
msg_pdbg("Opening STLINK-V3 with serial: %s\n", serialno);
|
||||||
stlinkv3_handle = usb_dev_get_by_vid_pid_serial(usb_ctx,
|
stlinkv3_handle = usb_dev_get_by_vid_pid_serial(usb_ctx,
|
||||||
@ -505,7 +505,7 @@ static int stlinkv3_spi_init(void)
|
|||||||
}
|
}
|
||||||
free(serialno);
|
free(serialno);
|
||||||
|
|
||||||
speed_str = extract_programmer_param("spispeed");
|
speed_str = extract_programmer_param_str("spispeed");
|
||||||
if (speed_str) {
|
if (speed_str) {
|
||||||
sck_freq_kHz = strtoul(speed_str, &endptr, 0);
|
sck_freq_kHz = strtoul(speed_str, &endptr, 0);
|
||||||
if (*endptr || sck_freq_kHz == 0) {
|
if (*endptr || sck_freq_kHz == 0) {
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
static void usb_match_value_init(struct usb_match_value *match,
|
static void usb_match_value_init(struct usb_match_value *match,
|
||||||
char const *parameter)
|
char const *parameter)
|
||||||
{
|
{
|
||||||
char *string = extract_programmer_param(parameter);
|
char *string = extract_programmer_param_str(parameter);
|
||||||
|
|
||||||
match->name = parameter;
|
match->name = parameter;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user