rbtest: timed small messages, one 50 kB message, and MT checks
`rbtest` in the shell sample sends test messages with a 16-byte header and a counting ramp, so every byte can be checked at the other end. `rbtest small` sends a few 32-byte messages and logs how long each took, `rbtest large` sends one of up to 50000 bytes and only with `confirm`, and `rbtest mt` shows the last MT and checks it. `rb9704 pattern make` and `check` in python/ make and check the same messages. rb9704_send_fill writes a message straight into the module's buffer, so a large generated one is not held twice. overlay-large.conf raises the limit to 50000 bytes; on the M5Stamp-C3 that links on the USB console and not beside WiFi, which overflows by 11 kB. Run against the fake modem on native_sim only; not yet on a real modem.
This commit is contained in:
1 parent
9f68104ac6
commit
144efe683e
15 files changed
+798
-6
No files matched your search
+16
-2
@@ -530,12 +530,26 @@ int rb9704_info(struct rb9704_info *out, k_timeout_t timeout)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void fill_copy(uint8_t *buf, size_t len, void *user)
|
||||
{
|
||||
memcpy(buf, user, len);
|
||||
}
|
||||
|
||||
int rb9704_send(uint16_t topic, const void *data, size_t len, k_timeout_t timeout)
|
||||
{
|
||||
if (data == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
return rb9704_send_fill(topic, len, fill_copy, (void *)data, timeout);
|
||||
}
|
||||
|
||||
int rb9704_send_fill(uint16_t topic, size_t len, rb9704_fill_t fill, void *user,
|
||||
k_timeout_t timeout)
|
||||
{
|
||||
bool abandoned;
|
||||
int rc;
|
||||
|
||||
if (topic < RB9704_TOPIC_MIN || data == NULL || len == 0 || len > sizeof(mo_buf)) {
|
||||
if (topic < RB9704_TOPIC_MIN || fill == NULL || len == 0 || len > sizeof(mo_buf)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
rc = take_slot(timeout);
|
||||
@@ -545,7 +559,7 @@ int rb9704_send(uint16_t topic, const void *data, size_t len, k_timeout_t timeou
|
||||
req.op = OP_SEND;
|
||||
req.topic = topic;
|
||||
req.len = len;
|
||||
memcpy(mo_buf, data, len);
|
||||
fill(mo_buf, len, user);
|
||||
rc = submit(timeout, &abandoned);
|
||||
if (abandoned) {
|
||||
return -EINPROGRESS;
|
||||
|
||||
Reference in new issue
Block a user