Skip to content

Remove EBUS_EVENT_TYPE_USER #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/ebus/include/ebus.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
enum EBUS_EVENT {
EBUS_EVENT_ANY = 0,
EBUS_EVENT_TIMER,
EBUS_EVENT_USER_MSG,
EBUS_EVENT_KEY,
};

Expand All @@ -34,9 +33,6 @@ typedef struct _ebus_event {
int id;
uint32_t time;
} timer;
struct {
const char * msg;
} user_msg;
struct {
uint8_t event;
uint8_t mods;
Expand Down
28 changes: 0 additions & 28 deletions src/kernel/src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,21 +557,6 @@ static int disk_size_cmd(size_t argc, char ** argv) {
return 0;
}

static int ebus_send_cmd(size_t argc, char ** argv) {
static const char * msg = "Hello events";
ebus_event_t event;
event.event_id = EBUS_EVENT_USER_MSG;
event.user_msg.msg = msg;
queue_event(&event);
return 0;
}

static int ebus_size_cmd(size_t argc, char ** argv) {
int size = ebus_queue_size(get_kernel_ebus());
printf("Event queue size is %d\n", size);
return 0;
}

static int currdir(size_t argc, char ** argv) {
printf("Current dir is %p\n", mmu_get_curr_dir());
return 0;
Expand Down Expand Up @@ -789,10 +774,6 @@ static int command_lookup(size_t argc, char ** argv) {
return res;
}

static void user_message_cb(const ebus_event_t * event) {
puts(event->user_msg.msg);
}

void commands_init() {
set_command_lookup(command_lookup);

Expand Down Expand Up @@ -821,13 +802,4 @@ void commands_init() {
// term_command_add("read", disk_read_cmd);
term_command_add("write", disk_write_cmd);
term_command_add("size", disk_size_cmd);
term_command_add("send_event", ebus_send_cmd);
term_command_add("ebus_size", ebus_size_cmd);

ebus_handler_t handler = {0};
handler.callback_fn = user_message_cb;
handler.event_id = EBUS_EVENT_USER_MSG;
if (ebus_register_handler(get_kernel_ebus(), &handler) < 1) {
PANIC("Failed to register handler");
}
}