Subversion Repositories HelenOS

Rev

Rev 3707 | Rev 3941 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3707 Rev 3761
Line 49... Line 49...
49
#include <macros.h>
49
#include <macros.h>
50
#include <debug.h>
50
#include <debug.h>
51
#include <func.h>
51
#include <func.h>
52
#include <symtab.h>
52
#include <symtab.h>
53
#include <macros.h>
53
#include <macros.h>
-
 
54
#include <sysinfo/sysinfo.h>
-
 
55
#include <ddi/device.h>
54
 
56
 
55
/** Simple kernel console.
57
/** Simple kernel console.
56
 *
58
 *
57
 * The console is realized by kernel thread kconsole.
59
 * The console is realized by kernel thread kconsole.
58
 * It doesn't understand any useful command on its own,
60
 * It doesn't understand any useful command on its own,
Line 81... Line 83...
81
static cmd_info_t *parse_cmdline(char *cmdline, size_t len);
83
static cmd_info_t *parse_cmdline(char *cmdline, size_t len);
82
static bool parse_argument(char *cmdline, size_t len, index_t *start,
84
static bool parse_argument(char *cmdline, size_t len, index_t *start,
83
    index_t *end);
85
    index_t *end);
84
static char history[KCONSOLE_HISTORY][MAX_CMDLINE] = {};
86
static char history[KCONSOLE_HISTORY][MAX_CMDLINE] = {};
85
 
87
 
-
 
88
/*
-
 
89
 * For now, we use 0 as INR.
-
 
90
 * However, it is therefore desirable to have architecture specific
-
 
91
 * definition of KCONSOLE_VIRT_INR in the future.
-
 
92
 */
-
 
93
#define KCONSOLE_VIRT_INR  0
-
 
94
 
-
 
95
bool kconsole_notify = false;
-
 
96
irq_t kconsole_irq;
-
 
97
 
-
 
98
 
-
 
99
/** Allways refuse IRQ ownership.
-
 
100
 *
-
 
101
 * This is not a real IRQ, so we always decline.
-
 
102
 *
-
 
103
 * @return Always returns IRQ_DECLINE.
-
 
104
 *
-
 
105
 */
-
 
106
static irq_ownership_t kconsole_claim(void)
-
 
107
{
-
 
108
    return IRQ_DECLINE;
-
 
109
}
-
 
110
 
-
 
111
 
86
/** Initialize kconsole data structures. */
112
/** Initialize kconsole data structures
-
 
113
 *
-
 
114
 * This is the most basic initialization, almost no
-
 
115
 * other kernel subsystem is ready yet.
-
 
116
 *
-
 
117
 */
87
void kconsole_init(void)
118
void kconsole_init(void)
88
{
119
{
89
    int i;
120
    unsigned int i;
90
 
121
 
91
    cmd_init();
122
    cmd_init();
92
    for (i = 0; i < KCONSOLE_HISTORY; i++)
123
    for (i = 0; i < KCONSOLE_HISTORY; i++)
93
        history[i][0] = '\0';
124
        history[i][0] = '\0';
94
}
125
}
95
 
126
 
96
 
127
 
-
 
128
/** Initialize kconsole notification mechanism
-
 
129
 *
-
 
130
 * Initialize the virtual IRQ notification mechanism.
-
 
131
 *
-
 
132
 */
-
 
133
void kconsole_notify_init(void)
-
 
134
{
-
 
135
    devno_t devno = device_assign_devno();
-
 
136
   
-
 
137
    sysinfo_set_item_val("kconsole.present", NULL, true);
-
 
138
    sysinfo_set_item_val("kconsole.devno", NULL, devno);
-
 
139
    sysinfo_set_item_val("kconsole.inr", NULL, KCONSOLE_VIRT_INR);
-
 
140
   
-
 
141
    irq_initialize(&kconsole_irq);
-
 
142
    kconsole_irq.devno = devno;
-
 
143
    kconsole_irq.inr = KCONSOLE_VIRT_INR;
-
 
144
    kconsole_irq.claim = kconsole_claim;
-
 
145
    irq_register(&kconsole_irq);
-
 
146
   
-
 
147
    kconsole_notify = true;
-
 
148
}
-
 
149
 
-
 
150
 
97
/** Register kconsole command.
151
/** Register kconsole command.
98
 *
152
 *
99
 * @param cmd Structure describing the command.
153
 * @param cmd Structure describing the command.
100
 *
154
 *
101
 * @return 0 on failure, 1 on success.
155
 * @return 0 on failure, 1 on success.