Changeset ff3b3197 in mainline for generic/include


Ignore:
Timestamp:
2005-11-25T22:58:38Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f4338d2
Parents:
78c32b4
Message:

Implement basic kernel console command recognition.
Commands without arguments are now recognized.

Location:
generic/include
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • generic/include/console/console.h

    r78c32b4 rff3b3197  
    3636
    3737extern __u8 getc(chardev_t *chardev);
    38 extern void gets(chardev_t *chardev, __u8 *buf, size_t buflen);
     38extern count_t gets(chardev_t *chardev, char *buf, size_t buflen);
    3939
    4040#endif /* __CHARDEV_H__ */
  • generic/include/func.h

    r78c32b4 rff3b3197  
    3131
    3232#include <arch/types.h>
     33#include <typedefs.h>
    3334
    3435extern __u32 haltstate;
     
    3637extern void halt(void);
    3738
    38 extern int strcmp(const char *src, const char *dst);
     39extern size_t strlen(const char *str);
     40extern int strcmp(const char *src, const char *dst, size_t len);
    3941
    4042#endif
  • generic/include/main/kconsole.h

    r78c32b4 rff3b3197  
    3030#define __KCONSOLE_H__
    3131
     32#include <typedefs.h>
     33#include <list.h>
     34#include <synch/spinlock.h>
     35
     36enum cmd_arg_type {
     37        ARG_TYPE_INVALID = 0,
     38        ARG_TYPE_INT,
     39        ARG_TYPE_STRING
     40};
     41
     42/** Structure representing one argument of kconsole command line. */
     43struct cmd_arg {
     44        cmd_arg_type_t type;            /**< Type descriptor. */
     45        void *buffer;                   /**< Buffer where to store data. */
     46        size_t buflen;                  /**< Size of the buffer. */
     47};
     48
     49/** Structure representing one kconsole command. */
     50struct cmd_info {
     51        link_t link;                    /**< Command list link. */
     52        spinlock_t lock;                /**< This lock protects everything below. */
     53        const char *name;               /**< Command name. */
     54        const char *description;        /**< Textual description. */
     55        int (* func)(cmd_arg_t *cmd);   /**< Function implementing the command. */
     56        count_t argc;                   /**< Number of arguments. */
     57        cmd_arg_t *argv;                /**< Argument vector. */
     58};
     59
     60extern spinlock_t cmd_lock;
     61extern link_t cmd_head;
     62
     63extern void kconsole_init(void);
    3264extern void kconsole(void *arg);
    3365
     66extern int cmd_register(cmd_info_t *cmd);
     67
    3468#endif
  • generic/include/typedefs.h

    r78c32b4 rff3b3197  
    8282typedef struct chardev chardev_t;
    8383
     84typedef enum cmd_arg_type cmd_arg_type_t;
     85typedef struct cmd_arg cmd_arg_t;
     86typedef struct cmd_info cmd_info_t;
     87
    8488#endif
Note: See TracChangeset for help on using the changeset viewer.