Changeset de88998 in mainline for kernel/arch/sparc64/src/drivers/sgcn.c
- Timestamp:
- 2009-03-11T19:46:35Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 05915ba4
- Parents:
- 63b1537
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/drivers/sgcn.c
r63b1537 rde88998 74 74 * which can be used. It is, however, used because when the kernel 75 75 * is running, the OBP buffer is not used by OBP any more but OBP 76 * has already made nec cessary arangements so that the output will76 * has already made necessary arrangements so that the output will 77 77 * be read from the OBP buffer and input will go to the OBP buffer. 78 78 * Therefore HelenOS needs to make no such arrangements any more. … … 97 97 */ 98 98 #define SGCN_BUFFER(type, offset) \ 99 99 ((type *) (sgcn_buffer_begin + (offset))) 100 100 101 101 /** Returns a pointer to the console buffer header. */ … … 146 146 chardev_t sgcn_io; 147 147 148 /** Address of the chardev, which is connected to SGCN. */ 149 static chardev_t *sgcnout; 150 148 151 /** 149 152 * Set some sysinfo values (SRAM address and SRAM size). … … 153 156 sysinfo_set_item_val("sram.area.size", NULL, MAPPED_AREA_SIZE); 154 157 sysinfo_set_item_val("sram.address.physical", NULL, 155 158 sram_begin_physical); 156 159 } 157 160 … … 164 167 * be set to the virtual address which maps to the SRAM physical 165 168 * address. 166 *167 * It also registers the physical area of SRAM and sets some sysinfo168 * values (SRAM address and SRAM size).169 169 */ 170 170 static void init_sram_begin(void) … … 185 185 186 186 sram_begin_physical = SBBC_START + SBBC_SRAM_OFFSET 187 187 + *((uint32_t *) iosram_toc->value); 188 188 sram_begin = hw_map(sram_begin_physical, MAPPED_AREA_SIZE); 189 189 … … 219 219 220 220 sysinfo_set_item_val("sram.buffer.offset", NULL, 221 221 SRAM_TOC->keys[i].offset); 222 222 } 223 223 … … 242 242 /* we need pointers to volatile variables */ 243 243 volatile char *buf_ptr = (volatile char *) 244 244 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->out_wrptr); 245 245 volatile uint32_t *out_wrptr_ptr = &(SGCN_BUFFER_HEADER->out_wrptr); 246 246 volatile uint32_t *out_rdptr_ptr = &(SGCN_BUFFER_HEADER->out_rdptr); … … 320 320 uint32_t size = end - begin; 321 321 322 if (kbd_disabled) 323 return; 324 322 325 spinlock_lock(&sgcn_input_lock); 323 324 ipl_t ipl = interrupts_disable();325 326 if (kbd_disabled) {327 interrupts_restore(ipl);328 return;329 }330 326 331 327 /* we need pointers to volatile variables */ 332 328 volatile char *buf_ptr = (volatile char *) 333 329 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); 334 330 volatile uint32_t *in_wrptr_ptr = &(SGCN_BUFFER_HEADER->in_wrptr); 335 331 volatile uint32_t *in_rdptr_ptr = &(SGCN_BUFFER_HEADER->in_rdptr); … … 338 334 339 335 buf_ptr = (volatile char *) 340 336 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); 341 337 char c = *buf_ptr; 342 338 *in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin; 343 339 344 if (c == '\r') { 345 c = '\n'; 346 } 347 chardev_push_character(&sgcn_io, c); 340 if (sgcnout) 341 chardev_push_character(sgcnout, c); 348 342 } 349 343 350 interrupts_restore(ipl);351 344 spinlock_unlock(&sgcn_input_lock); 352 345 } … … 368 361 * and sets it as a default input/output. 369 362 */ 370 void sgcn_init( void)363 void sgcn_init(chardev_t *devout) 371 364 { 372 365 sgcn_buffer_begin_init(); … … 384 377 385 378 chardev_initialize("sgcn_io", &sgcn_io, &sgcn_ops); 386 stdin = &sgcn_io;387 379 stdout = &sgcn_io; 380 381 sgcnout = devout; 388 382 } 389 383
Note:
See TracChangeset
for help on using the changeset viewer.