Changeset b366a6f4 in mainline for kernel/arch/sparc64/src/drivers/sgcn.c
- Timestamp:
- 2011-06-24T15:58:01Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7250d2c
- Parents:
- ee2fa30a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/drivers/sgcn.c
ree2fa30a rb366a6f4 102 102 #define SGCN_BUFFER_HEADER (SGCN_BUFFER(sgcn_buffer_header_t, 0)) 103 103 104 static void sgcn_putchar(outdev_t *, const wchar_t , bool);104 static void sgcn_putchar(outdev_t *, const wchar_t); 105 105 106 106 static outdev_operations_t sgcndev_ops = { … … 111 111 static sgcn_instance_t *instance = NULL; 112 112 113 /** 114 * Set some sysinfo values (SRAM address and SRAM size). 115 */ 116 static void register_sram(uintptr_t sram_begin_physical) 117 { 118 sysinfo_set_item_val("sram.area.size", NULL, MAPPED_AREA_SIZE); 119 sysinfo_set_item_val("sram.address.physical", NULL, 120 sram_begin_physical); 121 } 122 123 /** 124 * Initializes the starting address of SRAM. 113 /** Initialize the starting address of SRAM. 125 114 * 126 115 * The SRAM starts 0x900000 + C bytes behind the SBBC start in the … … 129 118 * be set to the virtual address which maps to the SRAM physical 130 119 * address. 120 * 131 121 */ 132 122 static void init_sram_begin(void) … … 149 139 instance->sram_begin = hw_map(sram_begin_physical, MAPPED_AREA_SIZE); 150 140 151 register_sram(sram_begin_physical); 152 } 153 154 /** 155 * Function regularly called by the keyboard polling thread. Finds out whether 156 * there are some unread characters in the input queue. If so, it picks them up 157 * and sends them to the upper layers of HelenOS. 141 link_initialize(&instance->parea.link); 142 instance->parea.pbase = sram_begin_physical; 143 instance->parea.frames = SIZE2FRAMES(MAPPED_AREA_SIZE); 144 instance->parea.unpriv = false; 145 instance->parea.mapped = false; 146 ddi_parea_register(&instance->parea); 147 148 sysinfo_set_item_val("sram.area.size", NULL, MAPPED_AREA_SIZE); 149 sysinfo_set_item_val("sram.address.physical", NULL, 150 sram_begin_physical); 151 } 152 153 /** Get unread characters from the input queue. 154 * 155 * Check for unread characters in the input queue. 156 * 158 157 */ 159 158 static void sgcn_poll(sgcn_instance_t *instance) … … 163 162 uint32_t size = end - begin; 164 163 165 if ( silent)164 if ((instance->parea.mapped) && (!console_override)) 166 165 return; 167 166 168 167 spinlock_lock(&instance->input_lock); 169 168 170 /* we need pointers to volatile variables */169 /* We need pointers to volatile variables */ 171 170 volatile char *buf_ptr = (volatile char *) 172 171 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); … … 186 185 } 187 186 188 /** 189 * Polling thread function.187 /** Polling thread function. 188 * 190 189 */ 191 190 static void ksgcnpoll(void *instance) { 192 191 while (true) { 193 if (!silent) 194 sgcn_poll(instance); 195 192 sgcn_poll(instance); 196 193 thread_usleep(POLL_INTERVAL); 197 194 } 198 195 } 199 196 200 /** 201 * Initializes the starting address of the SGCN buffer. 197 /** Initialize the starting address of the SGCN buffer. 202 198 * 203 199 * The offset of the SGCN buffer within SRAM is obtained from the 204 200 * SRAM table of contents. The table of contents contains 205 201 * information about several buffers, among which there is an OBP 206 * console buffer - this one will be used as the SGCN buffer.202 * console buffer -- this one will be used as the SGCN buffer. 207 203 * 208 204 * This function also writes the offset of the SGCN buffer within SRAM 209 205 * under the sram.buffer.offset sysinfo key. 206 * 210 207 */ 211 208 static void sgcn_init(void) … … 248 245 } 249 246 250 /** 251 * Writes a single character to the SGCN (circular) output buffer 252 * and updates the output write pointer so that SGCN gets to know 247 /** Write a single character to the SGCN output buffer 248 * 249 * Write a single character to the SGCN (circular) output buffer 250 * and update the output write pointer so that SGCN gets to know 253 251 * that the character has been written. 252 * 254 253 */ 255 254 static void sgcn_do_putchar(const char c) … … 286 285 } 287 286 288 /** 289 * SGCN output operation. Prints a single character to the SGCN. Newline 287 /** SGCN output operation 288 * 289 * Print a single character to the SGCN. Newline 290 290 * character is converted to CRLF. 291 */ 292 static void sgcn_putchar(outdev_t *dev, const wchar_t ch, bool silent) 293 { 294 if (!silent) { 291 * 292 */ 293 static void sgcn_putchar(outdev_t *dev, const wchar_t ch) 294 { 295 if ((!instance->parea.mapped) || (console_override)) { 295 296 spinlock_lock(&instance->output_lock); 296 297 … … 306 307 } 307 308 308 /** 309 * A public function which initializes input from the Serengeti console.309 /** Initialize input from the Serengeti console. 310 * 310 311 */ 311 312 sgcn_instance_t *sgcnin_init(void) … … 326 327 } 327 328 328 /** 329 * A public function which initializes output to the Serengeti console.329 /** Initialize output to the Serengeti console. 330 * 330 331 */ 331 332 outdev_t *sgcnout_init(void)
Note:
See TracChangeset
for help on using the changeset viewer.