Use shared macros for dev function IDs
This commit is contained in:
@ -8,6 +8,7 @@
|
|||||||
#include "dlmalloc/malloc.h"
|
#include "dlmalloc/malloc.h"
|
||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
#include "hshtb.h"
|
#include "hshtb.h"
|
||||||
|
#include "sysdefs/devctl.h"
|
||||||
|
|
||||||
Ps2KbFastBuf PS2KB_BUF;
|
Ps2KbFastBuf PS2KB_BUF;
|
||||||
|
|
||||||
@ -34,5 +35,5 @@ void ps2kbdev_init(void) {
|
|||||||
Dev *ps2kbdev;
|
Dev *ps2kbdev;
|
||||||
HSHTB_ALLOC(DEVTABLE.devs, ident, "ps2kbdev", ps2kbdev);
|
HSHTB_ALLOC(DEVTABLE.devs, ident, "ps2kbdev", ps2kbdev);
|
||||||
spinlock_init(&ps2kbdev->spinlock);
|
spinlock_init(&ps2kbdev->spinlock);
|
||||||
ps2kbdev->fns[0] = &ps2kbdev_readch;
|
ps2kbdev->fns[DEV_PS2KBDEV_READCH] = &ps2kbdev_readch;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
#include "hshtb.h"
|
#include "hshtb.h"
|
||||||
|
#include "sysdefs/devctl.h"
|
||||||
|
|
||||||
int32_t termdev_putch(uint8_t *buffer, size_t len, void *extra) {
|
int32_t termdev_putch(uint8_t *buffer, size_t len, void *extra) {
|
||||||
kprintf("%.*s", (int)len, (char *)buffer);
|
kprintf("%.*s", (int)len, (char *)buffer);
|
||||||
@ -16,6 +17,6 @@ int32_t termdev_putch(uint8_t *buffer, size_t len, void *extra) {
|
|||||||
void termdev_init(void) {
|
void termdev_init(void) {
|
||||||
Dev *termdev = NULL;
|
Dev *termdev = NULL;
|
||||||
HSHTB_ALLOC(DEVTABLE.devs, ident, "termdev", termdev);
|
HSHTB_ALLOC(DEVTABLE.devs, ident, "termdev", termdev);
|
||||||
termdev->fns[0] = &termdev_putch;
|
termdev->fns[DEV_TERMDEV_PUTCH] = &termdev_putch;
|
||||||
spinlock_init(&termdev->spinlock);
|
spinlock_init(&termdev->spinlock);
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,6 @@ void main(void) {
|
|||||||
PID = (uint64_t)processctl(-1, PCTL_GETPID, 0, 0, 0);
|
PID = (uint64_t)processctl(-1, PCTL_GETPID, 0, 0, 0);
|
||||||
devctl(&ps2kbdev, DEVCTL_GET_HANDLE, (uint8_t *)"ps2kbdev", 0, 0);
|
devctl(&ps2kbdev, DEVCTL_GET_HANDLE, (uint8_t *)"ps2kbdev", 0, 0);
|
||||||
|
|
||||||
Dev_t serialdev;
|
|
||||||
int32_t err = devctl(&serialdev, DEVCTL_GET_HANDLE, (uint8_t *)"serialdev", 0, 0);
|
|
||||||
uint8_t a = 'A';
|
|
||||||
devctl(&serialdev, DEV_SERIALDEV_SENDB, &a, 1, 0);
|
|
||||||
|
|
||||||
tb_runinitscript();
|
tb_runinitscript();
|
||||||
|
|
||||||
uprintf("Shell exited! Please reboot the system.\n");
|
uprintf("Shell exited! Please reboot the system.\n");
|
||||||
|
Reference in New Issue
Block a user