diagdummy srpr2 wait for device lock

This commit is contained in:
2025-11-24 22:29:59 +01:00
parent cc2b96f37a
commit a52dc89f9f

View File

@ -6,6 +6,8 @@
#define SENDREADY 1
#define RECVB 2
#define RECVREADY 3
#define LOCK 4
#define UNLOCK 5
void diagdummy_srpr(void) {
char *str = "Hello world\n";
@ -35,9 +37,13 @@ void diagdummy_srpr2(void) {
Dev_t serialdev;
dev_gethandle(&serialdev, "serialdev");
while(dev_cmd(&serialdev, LOCK, NULL, 0) != E_OK);
for (;;) {
while (!dev_cmd(&serialdev, SENDREADY, NULL, 0));
dev_cmd(&serialdev, SENDB, str, 1);
schedsleep(500);
}
dev_cmd(&serialdev, UNLOCK, NULL, 0);
}