Changeset 9940ce0 in mainline
- Timestamp:
- 2017-11-26T01:03:40Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5f4c41b2
- Parents:
- 96258fc
- Location:
- uspace
- Files:
-
- 2 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/ski-con/ski-con.c
r96258fc r9940ce0 43 43 44 44 #define SKI_GETCHAR 21 45 #define SKI_PUTCHAR 31 45 46 46 47 #define POLL_INTERVAL 10000 … … 57 58 .write = ski_con_write 58 59 }; 60 61 static void ski_con_putchar(ski_con_t *con, char ch); /* XXX */ 59 62 60 63 /** Add ski console device. */ … … 88 91 goto error; 89 92 } 93 94 ddf_fun_add_to_category(fun, "console"); 90 95 91 96 bound = true; … … 177 182 } 178 183 184 185 /** Display character on ski debug console 186 * 187 * Use SSC (Simulator System Call) to 188 * display character on debug console. 189 * 190 * @param c Character to be printed. 191 * 192 */ 179 193 static void ski_con_putchar(ski_con_t *con, char ch) 180 194 { 181 195 #ifdef UARCH_ia64 196 asm volatile ( 197 "mov r15 = %0\n" 198 "mov r32 = %1\n" /* r32 is in0 */ 199 "break 0x80000\n" /* modifies r8 */ 200 : 201 : "i" (SKI_PUTCHAR), "r" (ch) 202 : "r15", "in0", "r8" 203 ); 204 #else 205 (void) ch; 206 #endif 207 if (ch == '\n') 208 ski_con_putchar(con, '\r'); 182 209 } 183 210 -
uspace/srv/hid/output/Makefile
r96258fc r9940ce0 37 37 port/kchar.c \ 38 38 port/niagara.c \ 39 port/ski.c \40 39 port/chardev.c \ 41 40 proto/vt100.c \ -
uspace/srv/hid/output/output.c
r96258fc r9940ce0 38 38 #include "port/kchar.h" 39 39 #include "port/niagara.h" 40 #include "port/ski.h"41 40 #include "port/chardev.h" 42 41 #include "output.h" … … 481 480 kchar_init(); 482 481 niagara_init(); 483 ski_init(); 484 } else { 485 chardev_init(); 486 } 482 } 483 484 chardev_init(); 487 485 488 486 printf("%s: Accepting connections\n", NAME); -
uspace/srv/hid/output/port/chardev.c
r96258fc r9940ce0 1 1 /* 2 2 * Copyright (c) 2016 Jakub Jermar 3 * Copyright (c) 2017 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 50 51 static chardev_t *chardev; 51 52 static service_id_t serial_cat_id; 53 static service_id_t console_cat_id; 52 54 53 55 static FIBRIL_MUTEX_INITIALIZE(discovery_lock); … … 68 70 chardev_write(chardev, (void *) str, str_size(str), &nwr); 69 71 /* XXX Handle error */ 72 } 73 74 static bool find_output_dev(service_id_t *svcid) 75 { 76 service_id_t *svc; 77 size_t svcs; 78 int rc; 79 80 rc = loc_category_get_svcs(serial_cat_id, &svc, &svcs); 81 if (rc != EOK) { 82 fibril_mutex_unlock(&discovery_lock); 83 printf("%s: Failed to get services\n", NAME); 84 return false; 85 } 86 87 for (size_t i = 0; i < svcs; i++) { 88 char *name; 89 90 rc = loc_service_get_name(svc[i], &name); 91 if (rc != EOK) 92 continue; 93 94 if (!str_cmp(console, name)) { 95 /* 96 * This is the serial console service that the user 97 * wanted to use. 98 */ 99 *svcid = svc[i]; 100 free(svc); 101 return true; 102 } 103 104 free(name); 105 } 106 107 free(svc); 108 109 /* Look for any service in the 'console' category */ 110 111 rc = loc_category_get_svcs(console_cat_id, &svc, &svcs); 112 if (rc != EOK) { 113 fibril_mutex_unlock(&discovery_lock); 114 printf("%s: Failed to get services\n", NAME); 115 return false; 116 } 117 118 if (svcs > 0) { 119 *svcid = svc[0]; 120 free(svc); 121 return true; 122 } 123 124 free(svc); 125 return false; 70 126 } 71 127 … … 79 135 { 80 136 int rc; 137 bool found; 138 service_id_t sid; 81 139 82 140 fibril_mutex_lock(&discovery_lock); … … 87 145 } 88 146 89 service_id_t *svc; 90 size_t svcs; 91 rc = loc_category_get_svcs(serial_cat_id, &svc, &svcs); 92 if (rc != EOK) { 93 fibril_mutex_unlock(&discovery_lock); 94 printf("%s: Failed to get services\n", NAME); 95 return; 96 } 97 98 service_id_t sid; 99 bool found = false; 100 101 for (size_t i = 0; i < svcs && !found; i++) { 102 char *name; 103 104 rc = loc_service_get_name(svc[i], &name); 105 if (rc != EOK) 106 continue; 107 108 if (!str_cmp(console, name)) { 109 /* 110 * This is the serial console service that the user 111 * wanted to use. 112 */ 113 found = true; 114 sid = svc[i]; 115 } 116 117 free(name); 118 } 119 120 free(svc); 121 147 found = find_output_dev(&sid); 122 148 if (!found) { 123 149 fibril_mutex_unlock(&discovery_lock); … … 148 174 int chardev_init(void) 149 175 { 150 console = config_get_value("console"); 151 if (!console) { 152 /* 153 * The system is not configured to use serial console. 154 */ 176 if (!config_key_exists("console")) { 177 console = NULL; 178 #ifndef MACHINE_ski 155 179 return EOK; 180 #endif 181 } else { 182 console = config_get_value("console"); 183 if (!console) 184 return EOK; 156 185 } 157 186 … … 162 191 } 163 192 193 rc = loc_category_get_id("console", &console_cat_id, IPC_FLAG_BLOCKING); 194 if (rc != EOK) { 195 printf("%s: Failed to get \"console\" category ID.\n", NAME); 196 return rc; 197 } 198 164 199 rc = loc_register_cat_change_cb(check_for_dev); 165 200 if (rc != EOK) { … … 168 203 return rc; 169 204 } 205 206 check_for_dev(); 170 207 171 208 fibril_mutex_lock(&discovery_lock); -
uspace/srv/locsrv/locsrv.c
r96258fc r9940ce0 1347 1347 categ_dir_add_cat(&cdir, cat); 1348 1348 1349 cat = category_new("console"); 1350 categ_dir_add_cat(&cdir, cat); 1351 1349 1352 cat = category_new("clock"); 1350 1353 categ_dir_add_cat(&cdir, cat);
Note:
See TracChangeset
for help on using the changeset viewer.