diadummy Testing serial device

This commit is contained in:
2025-11-22 12:22:35 +01:00
parent b4d6315dea
commit 7f78f20b17
2 changed files with 23 additions and 1 deletions

View File

@ -1,7 +1,8 @@
#include <ulib.h>
#define CMDS(X) \
X(block) X(openf)
X(block) X(openf) \
X(serialprint)
void main(void) {
if (argslen() == 0) {

21
user/diagdummy/serial.c Normal file
View File

@ -0,0 +1,21 @@
#include <stdint.h>
#include <stddef.h>
#include <ulib.h>
void diagdummy_serialprint(void) {
char *str = "Hello world\n";
if (argslen() >= 2) {
str = args()[1];
}
Dev_t serialdev;
dev_gethandle(&serialdev, "serialdev");
char *s = str;
while (*s) {
while(!dev_cmd(&serialdev, DEV_SERIALDEV_SENDREADY, NULL, 0));
dev_cmd(&serialdev, DEV_SERIALDEV_SENDB, s, 1);
s++;
}
}