ui_defx.h (9670B)
1 /* 2 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 * 4 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 5 */ 6 #ifndef UI_DEFX_INCLUDED 7 /* { */ 8 #define UI_DEFX_INCLUDED 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #include <appl/diag/dpp/ref_sys.h> 15 #include <soc/dpp/SAND/Utils/sand_framework.h> 16 17 #if !DUNE_BCM 18 #if !(defined(LINUX) || defined(UNIX)) 19 /* { */ 20 #include "../../../../H/drv/mem/eeprom.h" 21 /* } */ 22 #endif 23 #endif 24 25 #include "utils_defx.h" 26 27 /* 28 * PROTOTYPES 29 * { 30 */ 31 32 #define CLI_INVALID_DEFAULT_DEVICE_ID ((unsigned long)-1) 33 34 #if LINK_TIMNA_LIBRARIES 35 void 36 timna_set_default_unit(uint32 dev_id); 37 uint32 38 timna_get_default_unit(void); 39 #endif 40 41 #if LINK_PPD_LIBRARIES 42 void 43 soc_petra_set_default_unit(uint32 dev_id); 44 uint32 45 soc_petra_get_default_unit(void); 46 47 void 48 soc_petra_set_default_units(uint32 dev_ids[SOC_SAND_MAX_DEVICE], uint32 nof_devices); 49 void 50 soc_petra_get_default_units(uint32 dev_ids[SOC_SAND_MAX_DEVICE], uint32 *nof_devices); 51 #endif 52 53 #if LINK_T20E_LIBRARIES 54 void 55 t20e_set_default_unit(uint32 dev_id); 56 void 57 oam_set_default_unit(uint32 dev_id); 58 uint32 59 t20e_get_default_unit(void); 60 #endif 61 62 #if LINK_TMD_LIBRARIES 63 void 64 tmd_set_default_unit(uint32 dev_id); 65 uint32 66 tmd_get_default_unit(void); 67 #endif 68 69 void 70 display_cli_prompt( 71 void 72 ) ; 73 void 74 init_ui_module( 75 void 76 ) ; 77 void 78 ui_proc( 79 void 80 ) ; 81 #if !(defined(LINUX) || defined(UNIX)) 82 /* { */ 83 84 int 85 index_num_from_nv( 86 unsigned char *next_in_index_ptr, 87 unsigned char *num_events_logged_ptr 88 ) ; 89 int 90 index_num_to_nv( 91 unsigned char next_in_index, 92 unsigned char num_events_logged 93 ) ; 94 int 95 event_item_from_nv( 96 EVENT_LOG_ITEM *event_item_ptr, 97 unsigned char event_item_index 98 ) ; 99 int 100 event_item_to_nv( 101 EVENT_LOG_ITEM *event_item_ptr, 102 unsigned char event_item_index 103 ) ; 104 int 105 next_event_item_to_nv( 106 EVENT_LOG_ITEM *event_item_ptr 107 ) ; 108 int 109 next_event_item_from_nv( 110 EVENT_LOG_ITEM *event_item_ptr, 111 int *index_ptr 112 ) ; 113 114 int 115 block_05_from_nv( 116 BLOCK_05 *block_05_ptr 117 ) ; 118 int 119 block_05_to_nv( 120 BLOCK_05 *block_05_ptr 121 ) ; 122 123 #endif /*} LINUX */ 124 125 int 126 handler_processing_time_from_nv( 127 unsigned long *handler_processing_time_ptr 128 ) ; 129 int 130 handler_processing_time_to_nv( 131 unsigned long handler_processing_time 132 ) ; 133 int 134 new_n_valid_from_nv( 135 unsigned char *new_n_valid_ptr 136 ) ; 137 int 138 new_n_valid_to_nv( 139 unsigned char new_n_valid 140 ) ; 141 int 142 error_identifier_from_nv( 143 unsigned long *error_identifier_ptr 144 ) ; 145 int 146 error_identifier_to_nv( 147 unsigned long error_identifier 148 ) ; 149 int 150 block_04_from_nv( 151 void *block_04_ptr 152 ) ; 153 int 154 block_04_to_nv( 155 void *block_04_ptr 156 ) ; 157 int 158 software_exception_new_n_valid_from_nv( 159 unsigned char *new_n_valid_ptr 160 ); 161 int 162 software_exception_new_n_valid_to_nv( 163 unsigned char new_n_valid 164 ); 165 int 166 software_exception_handler_processing_time_from_nv( 167 unsigned long *handler_processing_time_ptr 168 ); 169 int 170 software_exception_handler_processing_time_to_nv( 171 unsigned long handler_processing_time 172 ); 173 int 174 software_exception_error_identifier_from_nv( 175 unsigned long *error_identifier_ptr 176 ); 177 int 178 software_exception_error_identifier_to_nv( 179 unsigned long error_identifier 180 ); 181 int 182 software_exception_exception_counter_from_nv( 183 unsigned char *exception_counter_ptr 184 ); 185 int 186 block_07_from_nv( 187 void *block_07_ptr 188 ); 189 int 190 block_07_to_nv( 191 void *block_07_ptr 192 ); 193 int 194 get_err_display_level( 195 unsigned char *level_ptr 196 ) ; 197 int 198 get_nv_store_level( 199 unsigned char *level_ptr 200 ) ; 201 int 202 get_err_syslog_level( 203 unsigned char *level_ptr 204 ) ; 205 int 206 get_dpss_display_level( 207 unsigned char *level_ptr 208 ) ; 209 int 210 get_dpss_debug_level( 211 unsigned char *level_ptr 212 ) ; 213 int 214 get_run_cli_script_at_stratup( 215 unsigned char *val_ptr 216 ); 217 int 218 get_load_dpss_config_file_from_flash( 219 unsigned char *val_ptr 220 ); 221 int 222 get_start_application_in_demo_mode( 223 unsigned char *val_ptr 224 ); 225 int 226 get_fap10m_run_mode( 227 unsigned char *val_ptr 228 ); 229 int 230 get_download_mibs( 231 unsigned char *flag_ptr 232 ) ; 233 int 234 get_load_netsnmp_flag( 235 unsigned char *flag_ptr 236 ) ; 237 int 238 get_net_snmp_cmd_line( 239 char *line 240 ) ; 241 void 242 nice_printed_snmp_cmd_line( 243 char *out, 244 char *in1, 245 char *in2, 246 char *in3, 247 int out_len 248 ); 249 int 250 exception_counter_from_nv( 251 unsigned char *exception_counter_ptr 252 ) ; 253 int 254 get_watchdog_period( 255 unsigned char *watchdog_period_ptr 256 ) ; 257 int 258 is_watchdog_active( 259 void 260 ) ; 261 int 262 nv_is_watchdog_active( 263 void 264 ) ; 265 int 266 nv_is_hook_software_exception_active( 267 void 268 ) ; 269 int 270 nv_is_bckg_temperatures_en_active( 271 void 272 ) ; 273 void 274 par_nv_poll_init( 275 void 276 ) ; 277 unsigned 278 long 279 get_par_nv_poll_cycles( 280 void 281 ) ; 282 unsigned 283 long 284 get_par_nv_poll_starts( 285 void 286 ) ; 287 unsigned 288 long 289 get_par_nv_poll_avg_byte( 290 void 291 ) ; 292 unsigned 293 long 294 get_par_nv_poll_avg_num( 295 void 296 ) ; 297 unsigned 298 long 299 get_par_nv_poll_avg_time( 300 void 301 ) ; 302 unsigned 303 short 304 get_par_nv_poll_min_time( 305 void 306 ) ; 307 unsigned 308 short 309 get_par_nv_poll_max_time( 310 void 311 ) ; 312 int 313 parallel_nv_end( 314 unsigned long address 315 ) ; 316 int 317 parallel_nv_start( 318 unsigned long address 319 ) ; 320 int 321 parallel_nv_poll( 322 unsigned long delay 323 ) ; 324 void 325 display_poll_statistics( 326 void 327 ) ; 328 329 STATUS 330 nvRamGet( 331 char *string, /* where to copy non-volatile RAM */ 332 int strLen, /* maximum number of bytes to copy */ 333 int offset /* byte offset into non-volatile RAM */ 334 ); 335 STATUS 336 nvRamSet( 337 char *string, /* string to be copied into non-volatile RAM */ 338 int strLen, /* maximum number of bytes to copy */ 339 int offset /* byte offset into non-volatile RAM */ 340 ); 341 342 unsigned 343 int 344 get_use_par_nv_sem( 345 void 346 ) ; 347 void 348 set_use_par_nv_sem( 349 unsigned int val 350 ) ; 351 int 352 init_par_nv_sem( 353 void 354 ) ; 355 int 356 take_par_nv_sem( 357 void 358 ) ; 359 int 360 give_back_par_nv_sem( 361 void 362 ) ; 363 /* 364 * } 365 */ 366 /* 367 * OBJECT: 368 * handling of inactivity timeout for Telnet. 369 * { 370 */ 371 /* 372 * Last time activity was detected on telnet. Time is 373 * measured from startup in units of 10 milliseconds. 374 */ 375 unsigned 376 int 377 is_telnet_active( 378 void 379 ) ; 380 void 381 set_telnet_active( 382 unsigned int val 383 ) ; 384 unsigned 385 long 386 get_telnet_timeout_val( 387 void 388 ) ; 389 void 390 set_telnet_timeout_val( 391 unsigned long val 392 ) ; 393 void 394 set_telnet_activity_time_mark( 395 void 396 ) ; 397 unsigned 398 int 399 has_telnet_inactivity_time_elapsed( 400 void 401 ) ; 402 /* 403 * } 404 */ 405 /* 406 * OBJECT: 407 * Timeout on suspended ui task. 408 * { 409 */ 410 void 411 inc_ui_suspend_timer( 412 void 413 ); 414 415 void 416 clear_ui_suspend_timer( 417 void 418 ); 419 420 int 421 is_ui_suspend_timer_overflown( 422 void 423 ); 424 425 /* 426 * } 427 */ 428 429 /* 430 * Utilities related to telnet activity items and actions 431 * (block_03) 432 * { 433 */ 434 int 435 get_telnet_activity_timeout_std( 436 unsigned char *period_ptr 437 ) ; 438 int 439 get_telnet_activity_timeout_cont( 440 unsigned char *period_ptr 441 ) ; 442 int 443 set_telnet_activity_timeout_std( 444 unsigned char period 445 ) ; 446 int 447 set_telnet_activity_timeout_cont( 448 unsigned char period 449 ) ; 450 /* 451 * } 452 */ 453 /* 454 * Object: Dummy Telnet handling 455 * Dummy Telnet handles user input on TCP port 26 while 456 * standard Telnet is active. 457 * { 458 */ 459 int 460 get_dummy_telnet_sock_addr_size( 461 void 462 ) ; 463 struct sockaddr_in 464 *get_dummy_telnet_server_addr( 465 void 466 ) ; 467 struct sockaddr_in 468 *get_dummy_telnet_client_addr( 469 void 470 ) ; 471 int 472 get_dummy_telnet_fd( 473 void 474 ) ; 475 void 476 set_dummy_telnet_fd( 477 int fd 478 ) ; 479 int 480 get_dummy_telnet_socket( 481 void 482 ) ; 483 void 484 set_dummy_telnet_socket( 485 int socket 486 ) ; 487 /* 488 * } 489 */ 490 /* 491 * OBJECT: 492 * CLI error counter 493 * Counts the number of syntax (or other) errors (made by 494 * the user while typing in a command line and reported 495 * to the user with a message usually starting with '***' 496 * { 497 */ 498 unsigned 499 int 500 get_cli_err_counter( 501 void 502 ) ; 503 void 504 inc_cli_err_counter( 505 void 506 ) ; 507 void 508 clear_cli_err_counter( 509 void 510 ) ; 511 /* 512 * } 513 */ 514 /* 515 * OBJECT: 516 * Echo - mode 517 * Get/set value of CLI flag which indicates whether 518 * characters received from the user are to be echoed 519 * back to the sender or not. 520 * { 521 */ 522 unsigned 523 int 524 is_echo_mode_on( 525 void 526 ) ; 527 void 528 set_echo_mode_on( 529 void 530 ) ; 531 void 532 set_echo_mode_off( 533 void 534 ) ; 535 536 void 537 ui_activate_file( 538 void 539 ); 540 /* 541 * } 542 */ 543 /* 544 * Pointer to a procedure for checking validity of 545 * input to parameter value on CLI. 546 * If a non-zero value is returned then input 547 * value is not valid. In that case, err_msg 548 * is loaded by plain text explanation of why the 549 * value is not valid. Caller must make sure to supply 550 * an array of at least 160 bytes. 551 * First parameter: 552 * void *. Points to current_line. 553 * Second parameter: 554 * unsigned long. For numeric fields - input value. 555 * For symbolic fields, numeric equivalent. 556 * Third parameter: 557 * char *err_msg. Pointer to string load error 558 * text into. 559 * Fourth parameter: 560 * unsigned long. Indication. Only meaningful for 561 * numeric fields. If 'true' then field has not 562 * yet been fully loaded. 563 */ 564 typedef int (*VAL_PROC_PTR)(void *,unsigned long,char *,unsigned long) ; 565 566 #ifdef __cplusplus 567 } 568 #endif 569 570 /* } */ 571 #endif