Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame^] | 1 | /* |
| 2 | <:copyright-BRCM:2016:DUAL/GPL:standard |
| 3 | |
| 4 | Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| 5 | All Rights Reserved |
| 6 | |
| 7 | Unless you and Broadcom execute a separate written software license |
| 8 | agreement governing use of this software, this software is licensed |
| 9 | to you under the terms of the GNU General Public License version 2 |
| 10 | (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| 11 | with the following added to such license: |
| 12 | |
| 13 | As a special exception, the copyright holders of this software give |
| 14 | you permission to link this software with independent modules, and |
| 15 | to copy and distribute the resulting executable under terms of your |
| 16 | choice, provided that you also meet, for each linked independent |
| 17 | module, the terms and conditions of the license of that module. |
| 18 | An independent module is a module which is not derived from this |
| 19 | software. The special exception does not apply to any modifications |
| 20 | of the software. |
| 21 | |
| 22 | Not withstanding the above, under no circumstances may you combine |
| 23 | this software in any way with any other Broadcom software provided |
| 24 | under a license other than the GPL, without Broadcom's express prior |
| 25 | written consent. |
| 26 | |
| 27 | :> |
| 28 | */ |
| 29 | |
| 30 | #include <bcmolt_host_api.h> |
| 31 | #include <bcmolt_board.h> |
| 32 | #include <bcmolt_board_cli.h> |
| 33 | #include <bcmolt_user_appl_cli.h> |
| 34 | #include <bcmolt_user_appl_ex_cli.h> |
| 35 | #include <bcmolt_user_appl_epon_oam.h> |
| 36 | #if defined(LINUX_KERNEL_SPACE) |
| 37 | #include <bcmolt_dev_log_linux.h> |
| 38 | #endif |
| 39 | #include <bcmolt_dev_selector.h> |
| 40 | #include <bcm_api_cli.h> |
| 41 | #include <bcmolt_api_proxy.h> |
| 42 | #include <bcmolt_remote_cli.h> |
| 43 | #include <bcmolt_image_transfer.h> |
| 44 | |
| 45 | #ifdef SIMULATION_BUILD |
| 46 | static void using_inband_set(bcmos_bool using_inband){} |
| 47 | static bcmos_bool using_inband_get(void) |
| 48 | { |
| 49 | return BCMOS_FALSE; |
| 50 | } |
| 51 | extern uint32_t bcmtr_host_ip; |
| 52 | extern uint16_t bcmtr_host_udp_port; |
| 53 | extern uint32_t bcmtr_olt_ip[BCMTR_MAX_OLTS]; |
| 54 | extern uint16_t bcmtr_olt_udp_port[BCMTR_MAX_OLTS]; |
| 55 | #else |
| 56 | #include <bcmtr_plugin.h> |
| 57 | #endif |
| 58 | |
| 59 | |
| 60 | #define CLI_HOST_PROMPT_FORMAT "BCM.%u> " |
| 61 | |
| 62 | static bcmcli_session *current_session; |
| 63 | |
| 64 | //#if defined(SIMULATION_BUILD) && defined(LINUX_USER_SPACE) |
| 65 | //extern uint32_t bcmtr_host_ip; |
| 66 | //extern uint16_t bcmtr_host_udp_port; |
| 67 | //extern uint32_t bcmtr_olt_ip[BCMTR_MAX_OLTS]; |
| 68 | //extern uint16_t bcmtr_olt_udp_port[BCMTR_MAX_OLTS]; |
| 69 | //#endif |
| 70 | |
| 71 | #ifdef ENABLE_LOG |
| 72 | static int nologger=0; |
| 73 | #endif |
| 74 | |
| 75 | static int _cmd_using_inband(bcmcli_session *sess, const bcmcli_cmd_parm parm[], uint16_t nParms) |
| 76 | { |
| 77 | bcmcli_session_print(sess, "Maple management using %s\n", (using_inband_get())? "In-Band" : "PCIe"); |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | static int _cli_help(const char *cmd) |
| 82 | { |
| 83 | const char *p; |
| 84 | |
| 85 | while ((p = strchr(cmd, '/'))) |
| 86 | { |
| 87 | cmd = p + 1; |
| 88 | } |
| 89 | |
| 90 | fprintf(stderr, |
| 91 | "%s [-l <level>]" |
| 92 | #if defined(SIMULATION_BUILD) && defined(LINUX_USER_SPACE) |
| 93 | " [-p udp_port_device1] [-p udp_port_device2] ...\n" |
| 94 | "OR\n" |
| 95 | " [-olt ip_device1:port_device1] [-olt ip_device2:port_device2] ...\n" |
| 96 | " [-listen ip:port]\n" |
| 97 | #endif |
| 98 | #ifdef ENABLE_LOG |
| 99 | " [-nl]\n" |
| 100 | #endif |
| 101 | " [-ne]\n" |
| 102 | " [-dev]\n" |
| 103 | " [-if_mask mask]\n" |
| 104 | " [-proxy proxy_port_device1] [-proxy proxy_port_device2] ...\n" |
| 105 | " [-ud]\n" |
| 106 | " [-on_ready cmd]\n", cmd); |
| 107 | fprintf(stderr, |
| 108 | "\t\t level == guest | admin | debug\n" |
| 109 | #ifdef ENABLE_LOG |
| 110 | "\t\t -nl - disable kernel logger integration\n" |
| 111 | #endif |
| 112 | "\t\t -ne - disable line editing\n" |
| 113 | "\t\t -dev - device ID to auto-register for indications and run proxy on (default 0)\n" |
| 114 | "\t\t -if_mask - PON NI mask to apply to auto-registration of indications\n" |
| 115 | "\t\t -proxy - run the API proxy listening on this UDP port\n" |
| 116 | "\t\t -ud - use a unix domain connection to a user space device control" |
| 117 | "\t\t -on_ready - command for API proxy to execute after receiving device ready indication\n"); |
| 118 | return -EINVAL; |
| 119 | } |
| 120 | |
| 121 | /* quit command handler */ |
| 122 | static int _cmd_quit(bcmcli_session *sess, const bcmcli_cmd_parm parm[], uint16_t nParms) |
| 123 | { |
| 124 | bcmcli_stop(sess); |
| 125 | bcmcli_session_print(sess, "Maple CLI terminated by 'Quit' command\n"); |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | #if defined(SIMULATION_BUILD) && defined(LINUX_USER_SPACE) |
| 130 | /* parse ip:port */ |
| 131 | static bcmos_errno _parse_ip_port(const char *s, uint32_t *ip, uint16_t *port) |
| 132 | { |
| 133 | int n; |
| 134 | uint32_t ip1, ip2, ip3, ip4, pp; |
| 135 | |
| 136 | n = sscanf(s, "%u.%u.%u.%u:%u", &ip1, &ip2, &ip3, &ip4, &pp); |
| 137 | if (n != 5 || ip1 > 0xff || ip2 > 0xff || ip3 > 0xff || ip4 > 0xff || pp > 0xffff) |
| 138 | { |
| 139 | fprintf(stderr, "Can't parse %s. Must be ip_address:port\n", s); |
| 140 | return BCM_ERR_PARM; |
| 141 | } |
| 142 | *ip = (ip1 << 24) | (ip2 << 16) | (ip3 << 8) | ip4; |
| 143 | *port = pp; |
| 144 | return BCM_ERR_OK; |
| 145 | } |
| 146 | #endif |
| 147 | |
| 148 | /* Try to learn system mode */ |
| 149 | static bcmolt_system_mode _get_system_mode(bcmolt_devid dev) |
| 150 | { |
| 151 | bcmolt_device_key key = {}; |
| 152 | bcmolt_device_cfg dev_cfg; |
| 153 | bcmos_errno rc; |
| 154 | |
| 155 | BCMOLT_CFG_INIT(&dev_cfg, device, key); |
| 156 | BCMOLT_CFG_PROP_GET(&dev_cfg, device, system_mode); |
| 157 | rc = bcmolt_cfg_get(dev, &dev_cfg.hdr); |
| 158 | if (rc != BCM_ERR_OK) |
| 159 | { |
| 160 | bcmos_printf("Device %u: failed to read system mode (%s). Waiting for configuration\n", |
| 161 | (unsigned)dev, bcmos_strerror(rc)); |
| 162 | return BCMOLT_SYSTEM_MODE__NUM_OF; |
| 163 | } |
| 164 | bcmos_printf("Device %u: System mode: %s\n", |
| 165 | (unsigned)dev, bcmolt_system_mode_name(dev_cfg.data.system_mode)); |
| 166 | return dev_cfg.data.system_mode; |
| 167 | } |
| 168 | |
| 169 | #ifdef ENABLE_LOG |
| 170 | static int dev_log_time_to_str_cb(uint32_t time_stamp, char *time_str, int time_str_size) |
| 171 | { |
| 172 | return snprintf(time_str, time_str_size, "%u", time_stamp / 1000); /* convert from usec to msec. */ |
| 173 | } |
| 174 | |
| 175 | static bcmos_errno bcm_init_logger(void) |
| 176 | { |
| 177 | #define DEV_LOG_SIZE1 1<<11 |
| 178 | #define DEV_LOG_SIZE2 1<<13 |
| 179 | #define DEV_LOG_QUEUE_SIZE 1000 |
| 180 | |
| 181 | static uint8_t logger_buf1[DEV_LOG_SIZE1]; |
| 182 | static uint8_t logger_buf2[DEV_LOG_SIZE2]; |
| 183 | bcmos_errno err; |
| 184 | void *addresses[DEV_LOG_MAX_FILES] = {logger_buf1, logger_buf2}; |
| 185 | uint32_t sizes[DEV_LOG_MAX_FILES] = {sizeof(logger_buf1), sizeof(logger_buf2)}; |
| 186 | uint32_t flags[DEV_LOG_MAX_FILES] = {BCM_DEV_LOG_FILE_FLAG_STOP_WHEN_FULL, BCM_DEV_LOG_FILE_FLAG_WRAP_AROUND}; |
| 187 | |
| 188 | err = bcm_dev_log_init_default_logger(addresses, sizes, flags, BCM_SIZEOFARRAY(addresses), 0x4000, TASK_PRIORITY_DEV_LOG, DEV_LOG_QUEUE_SIZE); |
| 189 | BCMOS_TRACE_CHECK_RETURN(err, err, "bcm_dev_log_initialize_dev_logger_default()\n"); |
| 190 | |
| 191 | bcm_dev_log_level_set_style(DEV_LOG_LEVEL_FATAL, BCM_DEV_LOG_STYLE_BOLD); |
| 192 | bcm_dev_log_level_set_style(DEV_LOG_LEVEL_ERROR, BCM_DEV_LOG_STYLE_BOLD); |
| 193 | |
| 194 | bcm_dev_log_set_time_to_str_cb(dev_log_time_to_str_cb); |
| 195 | |
| 196 | #if defined(LINUX_KERNEL_SPACE) |
| 197 | if (!nologger) |
| 198 | { |
| 199 | err = bcm_dev_log_linux_init(); |
| 200 | BCMOS_TRACE_CHECK_RETURN(err, err, "bcm_dev_log_linux_init()\n"); |
| 201 | } |
| 202 | #endif |
| 203 | |
| 204 | BCM_LOG(INFO, def_log_id, "Hello Logger\n"); |
| 205 | |
| 206 | return BCM_ERR_OK; |
| 207 | } |
| 208 | #endif |
| 209 | |
| 210 | static void handle_system_mode_change(bcmolt_devid dev) |
| 211 | { |
| 212 | bcmcli_entry *cur_dir = bcmcli_dir_get(current_session); |
| 213 | char old_dir_name[32] = ""; |
| 214 | bcmolt_system_mode system_mode; |
| 215 | |
| 216 | bcmolt_system_mode_get(dev, &system_mode); |
| 217 | bcm_common_gpon_init(system_mode); |
| 218 | |
| 219 | if (dev == current_device) |
| 220 | { |
| 221 | if (cur_dir) |
| 222 | strncpy(old_dir_name, bcmcli_token_name(cur_dir), sizeof(old_dir_name) - 1); |
| 223 | |
| 224 | api_cli_set_commands(current_session); |
| 225 | |
| 226 | /* Restore current CLI directory */ |
| 227 | cur_dir = bcmcli_dir_find(NULL, old_dir_name); |
| 228 | if (cur_dir) |
| 229 | bcmcli_dir_set(current_session, cur_dir); |
| 230 | } |
| 231 | |
| 232 | bcmolt_user_appl_cli_handle_system_mode_change(dev); |
| 233 | } |
| 234 | |
| 235 | static void cli_get_prompt(bcmcli_session *session, char *buf, uint32_t max_len) |
| 236 | { |
| 237 | snprintf(buf, max_len, CLI_HOST_PROMPT_FORMAT, current_device); |
| 238 | } |
| 239 | |
| 240 | int main(int argc, char *argv[]) |
| 241 | { |
| 242 | bcmcli_session_parm mon_session_parm; |
| 243 | #ifndef SIMULATION_BUILD |
| 244 | uint32_t fpga_version; |
| 245 | #endif |
| 246 | int noedit = 0; |
| 247 | int rc; |
| 248 | int i; |
| 249 | bcmolt_host_init_params params = |
| 250 | { |
| 251 | #ifdef ENABLE_LOG |
| 252 | .logger_init_cb = bcm_init_logger, |
| 253 | #endif |
| 254 | .run_dev_ctrl = BCMOS_FALSE |
| 255 | }; |
| 256 | bcmolt_devid device = 0; |
| 257 | bcmos_bool specific_device = BCMOS_FALSE; |
| 258 | bcmos_bool run_proxy = BCMOS_FALSE; |
| 259 | bcmos_bool run_remote_cli = BCMOS_FALSE; |
| 260 | uint32_t proxy_port[BCMTR_MAX_OLTS] = {}; |
| 261 | uint32_t remote_cli_port = 0; |
| 262 | int cur_proxy_dev = 0; |
| 263 | char *on_ready_cmd = NULL; |
| 264 | struct bcmolt_rx_cfg rx_cfg = |
| 265 | { |
| 266 | .obj_type = BCMOLT_OBJECT_ANY, |
| 267 | .flags = BCMOLT_AUTO_FLAGS_NONE, |
| 268 | }; |
| 269 | #if defined(SIMULATION_BUILD) && defined(LINUX_USER_SPACE) |
| 270 | int cur_olt = 0; |
| 271 | #endif |
| 272 | |
| 273 | (void)noedit; /* prevent warning */ |
| 274 | |
| 275 | memset(&mon_session_parm, 0, sizeof(mon_session_parm)); |
| 276 | mon_session_parm.get_prompt = cli_get_prompt; |
| 277 | mon_session_parm.access_right = BCMCLI_ACCESS_ADMIN; |
| 278 | |
| 279 | for (i = 1; i < argc; i++) |
| 280 | { |
| 281 | if (!strcmp(argv[i], "-l")) |
| 282 | { |
| 283 | ++i; |
| 284 | if (!strcmp(argv[i], "admin")) |
| 285 | mon_session_parm.access_right = BCMCLI_ACCESS_ADMIN; |
| 286 | else if (!strcmp(argv[i], "guest")) |
| 287 | mon_session_parm.access_right = BCMCLI_ACCESS_GUEST; |
| 288 | else if (!strcmp(argv[i], "debug")) |
| 289 | mon_session_parm.access_right = BCMCLI_ACCESS_DEBUG; |
| 290 | else |
| 291 | return _cli_help(argv[0]); |
| 292 | } |
| 293 | else if (!strcmp(argv[i], "-ne")) |
| 294 | { |
| 295 | noedit = 1; |
| 296 | } |
| 297 | #ifdef ENABLE_LOG |
| 298 | else if (!strcmp(argv[i], "-nl")) |
| 299 | { |
| 300 | nologger = 1; |
| 301 | } |
| 302 | #endif |
| 303 | #if defined(SIMULATION_BUILD) && defined(LINUX_USER_SPACE) |
| 304 | else if (!strcmp(argv[i], "-p")) |
| 305 | { |
| 306 | if (cur_olt >= BCMTR_MAX_OLTS) |
| 307 | { |
| 308 | printf("Too many -p and/or -olt options\n"); |
| 309 | return -1; |
| 310 | } |
| 311 | ++i; |
| 312 | bcmtr_olt_udp_port[cur_olt] = strtol(argv[i], NULL, 0); |
| 313 | ++cur_olt; |
| 314 | } |
| 315 | else if (!strcmp(argv[i], "-olt")) |
| 316 | { |
| 317 | if (cur_olt >= BCMTR_MAX_OLTS) |
| 318 | { |
| 319 | printf("Too many -p and/or -olt options\n"); |
| 320 | return -1; |
| 321 | } |
| 322 | ++i; |
| 323 | if (_parse_ip_port(argv[i], &bcmtr_olt_ip[cur_olt], &bcmtr_olt_udp_port[cur_olt]) != BCM_ERR_OK) |
| 324 | return -1; |
| 325 | ++cur_olt; |
| 326 | } |
| 327 | else if (!strcmp(argv[i], "-listen")) |
| 328 | { |
| 329 | ++i; |
| 330 | if (_parse_ip_port(argv[i], &bcmtr_host_ip, &bcmtr_host_udp_port) != BCM_ERR_OK) |
| 331 | return -1; |
| 332 | } |
| 333 | #endif |
| 334 | else if (!strcmp(argv[i], "-dev")) |
| 335 | { |
| 336 | ++i; |
| 337 | device = (bcmolt_devid)strtoul(argv[i], NULL, 0); |
| 338 | if (device >= BCMTR_MAX_OLTS) |
| 339 | { |
| 340 | printf("Invalid device ID\n"); |
| 341 | return -1; |
| 342 | } |
| 343 | current_device = device; |
| 344 | specific_device = BCMOS_TRUE; |
| 345 | } |
| 346 | else if (!strcmp(argv[i], "-if_mask")) |
| 347 | { |
| 348 | ++i; |
| 349 | rx_cfg.pon_ni_mask = (uint32_t)strtoul(argv[i], NULL, 0); |
| 350 | } |
| 351 | else if (!strcmp(argv[i], "-proxy")) |
| 352 | { |
| 353 | if (cur_proxy_dev >= BCMTR_MAX_OLTS) |
| 354 | { |
| 355 | printf("Too many -proxy options\n"); |
| 356 | return -1; |
| 357 | } |
| 358 | ++i; |
| 359 | run_proxy = BCMOS_TRUE; |
| 360 | proxy_port[cur_proxy_dev] = (uint32_t)strtoul(argv[i], NULL, 0); |
| 361 | if (proxy_port[cur_proxy_dev] > 0xffff) |
| 362 | { |
| 363 | printf("Invalid proxy port %u\n", (unsigned)proxy_port[cur_proxy_dev]); |
| 364 | return -1; |
| 365 | } |
| 366 | ++cur_proxy_dev; |
| 367 | } |
| 368 | else if (!strcmp(argv[i], "-remote")) |
| 369 | { |
| 370 | ++i; |
| 371 | run_remote_cli = BCMOS_TRUE; |
| 372 | remote_cli_port = (uint32_t)strtoul(argv[i], NULL, 0); |
| 373 | } |
| 374 | else if (!strcmp(argv[i], "-ud")) |
| 375 | { |
| 376 | using_inband_set(BCMOS_TRUE); |
| 377 | } |
| 378 | else if (!strcmp(argv[i], "-on_ready")) |
| 379 | { |
| 380 | ++i; |
| 381 | on_ready_cmd = argv[i]; |
| 382 | } |
| 383 | else |
| 384 | { |
| 385 | return _cli_help(argv[0]); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | rc = bcmolt_host_init(¶ms); |
| 390 | BUG_ON(rc); |
| 391 | |
| 392 | bcmos_trace_level_set(BCMOS_TRACE_LEVEL_DEBUG); |
| 393 | |
| 394 | if (noedit) |
| 395 | { |
| 396 | mon_session_parm.line_edit_mode = BCMCLI_LINE_EDIT_DISABLE; |
| 397 | } |
| 398 | if (bcmcli_session_open(&mon_session_parm, ¤t_session)) |
| 399 | { |
| 400 | printf("Can't open CLI session\n"); |
| 401 | return -EINVAL; |
| 402 | } |
| 403 | |
| 404 | /* Try to learn system mode for all devices */ |
| 405 | if (specific_device) |
| 406 | { |
| 407 | bcmolt_system_mode_set(current_device, _get_system_mode(current_device)); |
| 408 | } |
| 409 | else |
| 410 | { |
| 411 | for (i = 0; i < BCMTR_MAX_OLTS; i++) |
| 412 | bcmolt_system_mode_set(i, _get_system_mode(i)); |
| 413 | } |
| 414 | |
| 415 | /* Init device selector */ |
| 416 | rc = bcmolt_dev_sel_init(NULL); |
| 417 | |
| 418 | /* Add Maple API commands */ |
| 419 | rc = rc ? rc : api_cli_init(NULL, current_session); |
| 420 | |
| 421 | /* (x)GPON init. Does nothing if system mode is not (x)GPON */ |
| 422 | if (rc == BCM_ERR_OK) |
| 423 | { |
| 424 | bcmolt_system_mode system_mode = BCMOLT_SYSTEM_MODE__NUM_OF; |
| 425 | bcmolt_system_mode_get(current_device, &system_mode); |
| 426 | bcm_common_gpon_init(system_mode); |
| 427 | } |
| 428 | |
| 429 | /* Add transport commands */ |
| 430 | rc = rc ? rc : bcmtr_cli_init(); |
| 431 | |
| 432 | /* Add capture, log, debug commands */ |
| 433 | rc = rc ? rc : bcmtr_cld_init(current_session); |
| 434 | |
| 435 | /* Initialize embedded CLI module */ |
| 436 | rc = rc ? rc : bcm_embedded_cli_init(); |
| 437 | |
| 438 | rc = rc ? rc : bcmos_cli_init(NULL); |
| 439 | |
| 440 | rc = rc ? rc : bcmolt_user_appl_cli_init(NULL); |
| 441 | |
| 442 | rc = rc ? rc : bcmolt_user_appl_ex_cli_init(); |
| 443 | |
| 444 | |
| 445 | #if defined(LINUX_KERNEL_SPACE) |
| 446 | rc = rc ? rc : bcm_board_init(); |
| 447 | rc = rc ? rc : bcm_board_cli_init(NULL); |
| 448 | #endif |
| 449 | |
| 450 | #ifdef ENABLE_LOG |
| 451 | /* logger CLI directory */ |
| 452 | bcm_dev_log_cli_init(NULL); |
| 453 | #endif |
| 454 | |
| 455 | if (run_proxy) |
| 456 | { |
| 457 | /* If executing for specific device, run only 1 proxy instance. |
| 458 | * Otherwise, create as many instances as requested |
| 459 | */ |
| 460 | if (specific_device) |
| 461 | rc = rc ? rc : bcmolt_api_proxy_init(NULL, device, proxy_port[0], on_ready_cmd); |
| 462 | else |
| 463 | { |
| 464 | for (i = 0; i < cur_proxy_dev; i++) |
| 465 | { |
| 466 | rc = rc ? rc : bcmolt_api_proxy_init(NULL, i, proxy_port[i], on_ready_cmd); |
| 467 | } |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | if (run_remote_cli) |
| 472 | { |
| 473 | rc = rc ? rc : bcmolt_remote_cli_init(NULL, device, remote_cli_port); |
| 474 | } |
| 475 | |
| 476 | /* Add other commands, e.g., access to embedded CLI */ |
| 477 | if (rc) |
| 478 | return rc; |
| 479 | |
| 480 | rx_cfg.rx_cb = bcmolt_user_appl_indication_cb; |
| 481 | rc = bcmolt_auto_rx_cb_set(device, &rx_cfg); |
| 482 | BUG_ON(BCM_ERR_OK != rc); |
| 483 | rx_cfg.rx_cb = bcmolt_user_appl_proxy_rx_cb; |
| 484 | rc = bcmolt_proxy_rx_cb_set(device, &rx_cfg); |
| 485 | BUG_ON(BCM_ERR_OK != rc); |
| 486 | |
| 487 | bcmolt_user_mftp_init(); |
| 488 | |
| 489 | sm_change_cb = handle_system_mode_change; |
| 490 | |
| 491 | BCMCLI_MAKE_CMD_NOPARM(NULL, "quit", "Quit", _cmd_quit); |
| 492 | BCMCLI_MAKE_CMD_NOPARM(NULL, "using_inband", "Using In Band", _cmd_using_inband); |
| 493 | |
| 494 | #ifndef SIMULATION_BUILD |
| 495 | bcm_board_fpga_version_get(&fpga_version); |
| 496 | bcmcli_session_print(current_session, "FPGA version: %d\n", fpga_version); |
| 497 | #endif |
| 498 | |
| 499 | /* Process user input until EOF or quit command */ |
| 500 | bcmcli_driver(current_session); |
| 501 | |
| 502 | #if defined(LINUX_KERNEL_SPACE) |
| 503 | bcm_board_uninit(); |
| 504 | #endif |
| 505 | bcmtr_exit(); |
| 506 | bcmcli_session_close(current_session); |
| 507 | bcmcli_token_destroy(NULL); |
| 508 | |
| 509 | if (run_proxy) |
| 510 | { |
| 511 | bcmolt_api_proxy_stop(); |
| 512 | } |
| 513 | |
| 514 | if (run_remote_cli) |
| 515 | { |
| 516 | bcmolt_remote_cli_stop(); |
| 517 | } |
| 518 | |
| 519 | return 0; |
| 520 | } |