refuse to set sample limit under 4 (protocol can't handle it)

also a bit of whitespace mangling.
This commit is contained in:
Bert Vermeulen 2011-01-17 02:18:02 +01:00
parent b33e7d7058
commit 574ce4988a
1 changed files with 35 additions and 32 deletions

View File

@ -47,7 +47,8 @@
#define NUM_TRIGGER_STAGES 4 #define NUM_TRIGGER_STAGES 4
#define TRIGGER_TYPES "01" #define TRIGGER_TYPES "01"
#define SERIAL_SPEED B115200 #define SERIAL_SPEED B115200
#define CLOCK_RATE 100000000 #define CLOCK_RATE MHZ(100)
#define MIN_NUM_SAMPLES 4
/* Command opcodes */ /* Command opcodes */
#define CMD_RESET 0x00 #define CMD_RESET 0x00
@ -462,6 +463,8 @@ static int hw_set_configuration(int device_index, int capability, void *value)
break; break;
case HWCAP_LIMIT_SAMPLES: case HWCAP_LIMIT_SAMPLES:
tmp_u64 = value; tmp_u64 = value;
if (*tmp_u64 < MIN_NUM_SAMPLES)
return SIGROK_ERR;
limit_samples = *tmp_u64; limit_samples = *tmp_u64;
g_message("ols: sample limit %" PRIu64, limit_samples); g_message("ols: sample limit %" PRIu64, limit_samples);
ret = SIGROK_OK; ret = SIGROK_OK;