29,6 → 29,40 |
#ifndef __KCONSOLE_H__ |
#define __KCONSOLE_H__ |
|
#include <typedefs.h> |
#include <list.h> |
#include <synch/spinlock.h> |
|
enum cmd_arg_type { |
ARG_TYPE_INVALID = 0, |
ARG_TYPE_INT, |
ARG_TYPE_STRING |
}; |
|
/** Structure representing one argument of kconsole command line. */ |
struct cmd_arg { |
cmd_arg_type_t type; /**< Type descriptor. */ |
void *buffer; /**< Buffer where to store data. */ |
size_t buflen; /**< Size of the buffer. */ |
}; |
|
/** Structure representing one kconsole command. */ |
struct cmd_info { |
link_t link; /**< Command list link. */ |
spinlock_t lock; /**< This lock protects everything below. */ |
const char *name; /**< Command name. */ |
const char *description; /**< Textual description. */ |
int (* func)(cmd_arg_t *cmd); /**< Function implementing the command. */ |
count_t argc; /**< Number of arguments. */ |
cmd_arg_t *argv; /**< Argument vector. */ |
}; |
|
extern spinlock_t cmd_lock; |
extern link_t cmd_head; |
|
extern void kconsole_init(void); |
extern void kconsole(void *arg); |
|
extern int cmd_register(cmd_info_t *cmd); |
|
#endif |