Added fet_block_size option.
This option controls the buffer size used for transfers to and from the FET. Increasing it will improve transfer times, but may cause problems with some chips. Also, the default request size used for several commands has been increased to take advantage of this.
This commit is contained in:
parent
429edda47d
commit
e182be2204
4
devcmd.c
4
devcmd.c
|
@ -82,7 +82,7 @@ int cmd_md(char **arg)
|
|||
reader_set_repeat("md 0x%x 0x%x", offset + length, length);
|
||||
|
||||
while (length) {
|
||||
uint8_t buf[128];
|
||||
uint8_t buf[4096];
|
||||
int blen = length > sizeof(buf) ? sizeof(buf) : length;
|
||||
|
||||
if (device_default->readmem(device_default,
|
||||
|
@ -450,7 +450,7 @@ int cmd_hexout(char **arg)
|
|||
return -1;
|
||||
|
||||
while (length) {
|
||||
uint8_t buf[128];
|
||||
uint8_t buf[4096];
|
||||
int count = length;
|
||||
|
||||
if (count > sizeof(buf))
|
||||
|
|
25
fet.c
25
fet.c
|
@ -32,9 +32,10 @@
|
|||
#include "fet_error.h"
|
||||
#include "fet_db.h"
|
||||
#include "output.h"
|
||||
#include "opdb.h"
|
||||
|
||||
#define MAX_PARAMS 16
|
||||
#define BLOCK_SIZE 64
|
||||
#define MAX_BLOCK_SIZE 4096
|
||||
|
||||
struct fet_device {
|
||||
struct device base;
|
||||
|
@ -357,10 +358,10 @@ static int send_command(struct fet_device *dev, int command_code,
|
|||
const uint32_t *params, int nparams,
|
||||
const uint8_t *extra, int exlen)
|
||||
{
|
||||
uint8_t datapkt[256];
|
||||
uint8_t datapkt[MAX_BLOCK_SIZE * 2];
|
||||
int len = 0;
|
||||
|
||||
uint8_t buf[512];
|
||||
uint8_t buf[MAX_BLOCK_SIZE * 3];
|
||||
uint16_t cksum;
|
||||
int i = 0;
|
||||
int j;
|
||||
|
@ -758,10 +759,23 @@ static int write_byte(struct fet_device *dev, address_t addr, uint8_t value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int get_adjusted_block_size(void)
|
||||
{
|
||||
int block_size = opdb_get_numeric("fet_block_size") & ~1;
|
||||
|
||||
if (block_size < 2)
|
||||
block_size = 2;
|
||||
if (block_size > MAX_BLOCK_SIZE)
|
||||
block_size = MAX_BLOCK_SIZE;
|
||||
|
||||
return block_size;
|
||||
}
|
||||
|
||||
int fet_readmem(device_t dev_base, address_t addr, uint8_t *buffer,
|
||||
address_t count)
|
||||
{
|
||||
struct fet_device *dev = (struct fet_device *)dev_base;
|
||||
int block_size = get_adjusted_block_size();
|
||||
|
||||
if (addr & 1) {
|
||||
if (read_byte(dev, addr, buffer) < 0)
|
||||
|
@ -772,7 +786,7 @@ int fet_readmem(device_t dev_base, address_t addr, uint8_t *buffer,
|
|||
}
|
||||
|
||||
while (count > 1) {
|
||||
int plen = count > BLOCK_SIZE ? BLOCK_SIZE : count;
|
||||
int plen = count > block_size ? block_size : count;
|
||||
|
||||
plen &= ~0x1;
|
||||
|
||||
|
@ -804,6 +818,7 @@ int fet_writemem(device_t dev_base, address_t addr,
|
|||
const uint8_t *buffer, address_t count)
|
||||
{
|
||||
struct fet_device *dev = (struct fet_device *)dev_base;
|
||||
int block_size = get_adjusted_block_size();
|
||||
|
||||
if (addr & 1) {
|
||||
if (write_byte(dev, addr, *buffer) < 0)
|
||||
|
@ -814,7 +829,7 @@ int fet_writemem(device_t dev_base, address_t addr,
|
|||
}
|
||||
|
||||
while (count > 1) {
|
||||
int plen = count > BLOCK_SIZE ? BLOCK_SIZE : count;
|
||||
int plen = count > block_size ? block_size : count;
|
||||
int ret;
|
||||
|
||||
plen &= ~0x1;
|
||||
|
|
|
@ -430,6 +430,10 @@ The following are all valid examples of address expressions:
|
|||
MSPDebug's behaviour can be configured via the following variables:
|
||||
.IP "\fBcolor\fR (boolean)"
|
||||
If true, MSPDebug will colorize debugging output.
|
||||
.IP "\fBfet_block_size\fR (numeric)"
|
||||
Change the size of the buffer used to transfer memory to and from the
|
||||
FET. Increasing the value from the default of 64 will improve transfer
|
||||
speed, but may cause problems with some chips.
|
||||
.IP "\fBgdb_loop\fR (boolean)"
|
||||
Automatically restart the GDB server after disconnection. If this
|
||||
option is set, then the GDB server keeps running until an error occurs,
|
||||
|
|
11
opdb.c
11
opdb.c
|
@ -55,6 +55,17 @@ const static struct opdb_key keys[] = {
|
|||
.defval = {
|
||||
.numeric = 10
|
||||
}
|
||||
},
|
||||
{
|
||||
.name = "fet_block_size",
|
||||
.type = OPDB_TYPE_NUMERIC,
|
||||
.help =
|
||||
"Size of buffer used for memory transfers to and from the FET device.\n"
|
||||
"Increasing this value will result in faster transfers, but may cause\n"
|
||||
"problems with some chips.\n",
|
||||
.defval = {
|
||||
.numeric = 64
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue