Subversion Repositories HelenOS

Rev

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

Rev 4153 Rev 4263
Line 29... Line 29...
29
/** @addtogroup sparc64
29
/** @addtogroup sparc64
30
 * @{
30
 * @{
31
 */
31
 */
32
/**
32
/**
33
 * @file
33
 * @file
34
 * @brief   SGCN driver.
34
 * @brief SGCN driver.
35
 */
35
 */
36
 
36
 
37
#include <arch.h>
37
#include <arch.h>
38
#include <arch/drivers/sgcn.h>
38
#include <arch/drivers/sgcn.h>
39
#include <arch/drivers/kbd.h>
39
#include <arch/drivers/kbd.h>
Line 128... Line 128...
128
 */
128
 */
129
SPINLOCK_INITIALIZE(sgcn_input_lock);
129
SPINLOCK_INITIALIZE(sgcn_input_lock);
130
 
130
 
131
 
131
 
132
/* functions referenced from definitions of I/O operations structures */
132
/* functions referenced from definitions of I/O operations structures */
133
static void sgcn_putchar(outdev_t *, const char, bool);
133
static void sgcn_putchar(outdev_t *, const wchar_t, bool);
134
 
134
 
135
/** SGCN output device operations */
135
/** SGCN output device operations */
136
static outdev_operations_t sgcnout_ops = {
136
static outdev_operations_t sgcnout_ops = {
137
    .write = sgcn_putchar
137
    .write = sgcn_putchar
138
};
138
};
Line 205... Line 205...
205
    if (initialized)
205
    if (initialized)
206
        return;
206
        return;
207
 
207
 
208
    init_sram_begin();
208
    init_sram_begin();
209
       
209
       
210
    ASSERT(strcmp(SRAM_TOC->magic, SRAM_TOC_MAGIC) == 0);
210
    ASSERT(str_cmp(SRAM_TOC->magic, SRAM_TOC_MAGIC) == 0);
211
   
211
   
212
    /* lookup TOC entry with the correct key */
212
    /* lookup TOC entry with the correct key */
213
    uint32_t i;
213
    uint32_t i;
214
    for (i = 0; i < MAX_TOC_ENTRIES; i++) {
214
    for (i = 0; i < MAX_TOC_ENTRIES; i++) {
215
        if (strcmp(SRAM_TOC->keys[i].key, CONSOLE_KEY) == 0)
215
        if (str_cmp(SRAM_TOC->keys[i].key, CONSOLE_KEY) == 0)
216
            break;
216
            break;
217
    }
217
    }
218
    ASSERT(i < MAX_TOC_ENTRIES);
218
    ASSERT(i < MAX_TOC_ENTRIES);
219
   
219
   
220
    sgcn_buffer_begin = sram_begin + SRAM_TOC->keys[i].offset;
220
    sgcn_buffer_begin = sram_begin + SRAM_TOC->keys[i].offset;
Line 262... Line 262...
262
    *buf_ptr = c;
262
    *buf_ptr = c;
263
    *out_wrptr_ptr = new_wrptr;
263
    *out_wrptr_ptr = new_wrptr;
264
}
264
}
265
 
265
 
266
/**
266
/**
267
 * SGCN output operation. Prints a single character to the SGCN. If the line
267
 * SGCN output operation. Prints a single character to the SGCN. Newline
268
 * feed character is written ('\n'), the carriage return character ('\r') is
-
 
269
 * written straight away.
268
 * character is converted to CRLF.
270
 */
269
 */
271
static void sgcn_putchar(outdev_t *od, const char c, bool silent)
270
static void sgcn_putchar(outdev_t *od, const wchar_t ch, bool silent)
272
{
271
{
273
    if (!silent) {
272
    if (!silent) {
274
        spinlock_lock(&sgcn_output_lock);
273
        spinlock_lock(&sgcn_output_lock);
275
       
274
       
276
        sgcn_do_putchar(c);
275
        if (ascii_check(ch)) {
277
        if (c == '\n')
276
            if (ch == '\n')
278
            sgcn_do_putchar('\r');
277
                sgcn_do_putchar('\r');
-
 
278
            sgcn_do_putchar(ch);
-
 
279
        } else
-
 
280
            sgcn_do_putchar(U_SPECIAL);
279
       
281
       
280
        spinlock_unlock(&sgcn_output_lock);
282
        spinlock_unlock(&sgcn_output_lock);
281
    }
283
    }
282
}
284
}
283
 
285