blob: 8c621dabcd825090ac3bec7ef3fa8dd9d0f5db2f [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001/*
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_msg.h>
31#include <bcmolt_api.h>
32#include <bcmcli.h>
33#include <bcm_api_cli.h>
34#include <bcm_api_dev_log.h>
35#include <bcm_dev_log.h>
36#include <bcmolt_msg_pack.h>
37#include "bcmolt_user_appl_cli.h"
38#include "bcmolt_user_appl_gpon_utils.h"
39#include "bcmolt_user_appl_ps.h"
40#include "bcmolt_user_appl_ps_cli.h"
41#ifndef RELEASE_BUILD
42#include "bcmolt_user_appl_omci_swdl_cli.h"
43#include "bcmolt_user_appl_omci_swdl.h"
44#include "bcmolt_user_appl_gpon_mac_learning_cli.h"
45#include "bcmolt_user_appl_gpon_mac_learning.h"
46#include "bcmolt_user_appl_gpon_stress_cli.h"
47#include "bcmolt_user_appl_gpon_stress.h"
48#include "bcmolt_user_appl_gpon_sn_acquisition_cli.h"
49#include "bcmolt_user_appl_gpon_sn_acquisition.h"
50#include "bcmolt_user_appl_gpon_ds_omci_cli.h"
51#include "bcmolt_user_appl_gpon_ds_omci.h"
52#include "bcmolt_user_appl_gpon_statistics_cli.h"
53#include "bcmolt_user_appl_gpon_statistics.h"
54#include "bcmolt_user_appl_gpon_rssi_cli.h"
55#include "bcmolt_user_appl_gpon_rssi.h"
56#include "bcmolt_user_appl_remote_logger_cli.h"
57#include "bcmolt_user_appl_remote_logger.h"
58#include "bcmolt_user_appl_onu_tuning_cli.h"
59#include "bcmolt_user_appl_onu_tuning.h"
60#endif /* Not RELEASE_BUILD */
61#include "bcmolt_eon.h"
62#include "bcmolt_epon_hde.h"
63#ifndef SIMULATION_BUILD
64#include "omon.h"
65#include <bcmolt_dev_ctrl_ioctl.h>
66#include <bcmtr_pcie.h>
67#endif /* #endif SIMULATION_BUILD */
68#include "bcmolt_board.h"
69#include "bcmolt_api_proxy.h"
70#include "bcmolt_remote_cli.h"
71#include "bcmolt_user_appl_epon_oam_cli.h"
72#include "bcmolt_user_appl_epon_oam.h"
73#include "bcmolt_image_transfer_cli.h"
74#include "bcmolt_sw_upgrade_cli.h"
75#include "bcmolt_user_appl_playback.h"
76#include "bcmolt_user_appl_dpoe_sec.h"
77
78#ifdef ENABLE_LOG
79static uint32_t *bcmlcli_pci_dumpptr;
80static dev_log_id user_appl_log_id;
81static dev_log_id ind_log_id[BCMTR_MAX_INSTANCES];
82static bcmcli_entry *user_dir;
83static bcmos_bool sys_mode_set[BCMTR_MAX_OLTS] = {};
84
85static void user_appl_api_msg_dump(const char *title, bcmolt_msg *msg)
86{
87 uint8_t inst = bcmolt_msg_instance(msg);
88 inst = (inst > BCMTR_MAX_INSTANCES) ? 0 : inst;
89 bcmolt_msg_log(ind_log_id[inst], msg);
90}
91
92#ifndef RELEASE_BUILD
93static bcmos_errno bcmolt_user_appl_process_exception_ind(bcmolt_devid device_id, bcmolt_auto *ind)
94{
95 switch (ind->hdr.obj_type)
96 {
97 case BCMOLT_OBJ_ID_DEVICE:
98 switch (ind->hdr.subgroup)
99 {
100 case BCMOLT_DEVICE_AUTO_CFG_ID_SW_EXCEPTION:
101 case BCMOLT_DEVICE_AUTO_CFG_ID_SW_ERROR:
102 /* Stop all user application tasks. */
103 if (bcmolt_gpon_mac_learning_appl_is_running(device_id))
104 bcmolt_gpon_mac_learning_appl_stop(device_id);
105 if (bcmolt_gpon_stress_appl_is_running(device_id))
106 bcmolt_gpon_stress_appl_stop(device_id);
107 if (bcmolt_gpon_sn_acquisition_appl_is_running(device_id))
108 bcmolt_gpon_sn_acquisition_appl_stop(device_id);
109 if (bcmolt_user_appl_gpon_statistics_is_running(device_id))
110 bcmolt_user_appl_gpon_statistics_stop(device_id);
111 if (bcmolt_gpon_ds_omci_appl_is_running(device_id))
112 bcmolt_gpon_ds_omci_appl_stop(device_id);
113 if (bcmolt_gpon_rssi_appl_is_running(device_id))
114 bcmolt_gpon_rssi_appl_stop(device_id);
115 default:
116 break;
117 }
118 break;
119 default:
120 break;
121 }
122
123 return BCM_ERR_OK;
124}
125#endif
126
127void bcmolt_user_appl_indication_cb(bcmolt_devid device_id, bcmolt_msg *msg)
128{
129 uint8_t instance = bcmolt_msg_instance(msg);
130 bcmolt_auto *ind = (bcmolt_auto *)msg;
131 bcmolt_ps_pon ps_pon = { device_id, instance };
132
133 user_appl_api_msg_dump("Indication", msg);
134 bcmolt_ps_process_ind(&ps_pon, ind);
135
136#ifndef RELEASE_BUILD
137 bcmolt_user_appl_process_exception_ind(device_id, ind);
138 /* Forward the indication to each user application. These applications will ignore indications that aren't
139 * relevant and errors will be printed to dedicated log IDs per application. */
140 bcmolt_gpon_mac_learning_process_ind(device_id, ind);
141 bcmolt_gpon_stress_process_ind(device_id, ind);
142 bcmolt_gpon_sn_acquisition_process_ind(device_id, ind);
143 bcmolt_user_appl_gpon_statistics_process_ind(device_id, ind);
144 bcmolt_gpon_ds_omci_process_ind(device_id, ind);
145 bcmolt_gpon_rssi_process_ind(device_id, ind);
146 bcmolt_onu_tuning_process_ind(device_id, ind);
147#endif /* Not RELEASE_BUILD */
148
149#ifndef SIMULATION_BUILD
150 bcmolt_user_appl_omon_handle_ind(device_id, instance, ind);
151#endif
152
153 bcmolt_api_proxy_auto_rx_cb(device_id, msg);
154 bcmolt_remote_cli_auto_rx_cb(device_id, msg);
155
156 /* Free the indication since we're done processing it */
157 bcmolt_msg_free(msg);
158}
159
160void bcmolt_user_appl_proxy_rx_cb(bcmolt_devid device_id, bcmolt_msg *msg)
161{
162 bcmolt_proxy_rx *proxy_rx = (bcmolt_proxy_rx *)msg;
163
164#ifndef RELEASE_BUILD
165 bcmolt_omci_swdl_process_proxy_rx(device_id, proxy_rx);
166
167 /* Dump RX packet if OMCI SWDL is Not running*/
168 if (!bcmolt_omci_swdl_appl_is_running(device_id))
169 {
170 user_appl_api_msg_dump("Proxy Rx", msg);
171 }
172#else
173 user_appl_api_msg_dump("Proxy Rx", msg);
174#endif /* Not RELEASE_BUILD */
175
176 bcmolt_api_proxy_auto_rx_cb(device_id, msg);
177 bcmolt_remote_cli_auto_rx_cb(device_id, msg);
178 bcmolt_user_appl_eon_process_rx(device_id, proxy_rx);
179 bcmolt_epon_hde_process_rx(device_id, bcmolt_msg_instance(msg), proxy_rx);
180 bcmolt_user_appl_epon_oam_handle_rx(device_id, proxy_rx, NULL);
181 bcmolt_user_appl_dpoe_sec_process_proxy_rx(device_id, proxy_rx);
182 bcmolt_msg_free(msg);
183}
184
185/* example on how to read the embedded logger from the host */
186static bcmos_errno _apicli_read_embedded_logger(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
187{
188 bcmolt_logger_cfg cfg;
189 bcmolt_logger_key key = {.file_id = parm[0].value.unumber, .reserved = 0};
190 int rc;
191
192 bcm_dev_log_log(
193 user_appl_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER,
194 "%s", "--------------------------------------------------------------------------------------------------\n");
195 bcm_dev_log_log(
196 user_appl_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER,
197 "| device %u logger |\n", current_device);
198 bcm_dev_log_log(user_appl_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER,
199 "%s", "|-------------------------------------------------------------------------------------------------|\n");
200
201 while (1)
202 {
203 BCMOLT_CFG_INIT(&cfg, logger, key);
204 BCMOLT_CFG_PROP_GET(&cfg, logger, buffer);
205 rc = bcmolt_cfg_get(current_device, &cfg.hdr);
206 if (rc > 0)
207 {
208 bcmos_printf("get obj error %d\n", rc);
209 }
210 bcmos_printf("%s", cfg.data.buffer.buff);
211 if (cfg.data.buffer.msg_to_read == 0)
212 {
213 break;
214 }
215 }
216 return BCM_ERR_OK;
217}
218
219/* example on how to read all the embedded log entries from the host */
220static bcmos_errno _apicli_get_all_log_entries(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
221{
222 bcmolt_log_entry_cfg cfg;
223 bcmolt_log_entry_key key = {.log_id = 0, .reserved=0};
224 int rc;
225
226 char *_log_level[] =
227 {
228 "NO_LOG",
229 "FATAL",
230 "ERROR",
231 "WARNING",
232 "INFO" ,
233 "DEBUG"
234 };
235
236 char *_log_type[] =
237 {
238 "NONE",
239 "PRINT",
240 "SAVE",
241 "BOTH"
242 };
243
244 char *_log_style[] =
245 {
246 "NORMAL",
247 "BOLD",
248 "UNDERLINE",
249 "BLIK",
250 "REVERSE_VIDEO"
251 };
252
253 bcm_dev_log_log(
254 user_appl_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER,
255 "%s", "--------------------------------------------------------------------------------------------------\n");
256 bcm_dev_log_log(
257 user_appl_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER,
258 "%s", "| LOG ID | LOG NAME | LOG level print | LOG level save | log type | log style |\n");
259 bcm_dev_log_log(user_appl_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER,
260 "%s", "|-------------------------------------------------------------------------------------------------|\n");
261
262 while (1)
263 {
264 BCMOLT_CFG_INIT(&cfg, log_entry, key);
265 BCMOLT_CFG_PROP_GET(&cfg, log_entry, all_properties);
266 rc = bcmolt_cfg_get(current_device, &cfg.hdr);
267 if (rc)
268 {
269 break;
270 }
271 bcm_dev_log_log(user_appl_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER | BCM_LOG_FLAG_CALLER_FMT,
272 "|%-8d|%-23s|%-17s|%-17s|%-10s|%-17s|\n",
273 key.log_id,
274 cfg.data.log_name.str,
275 _log_level[cfg.data.log_level_print],
276 _log_level[cfg.data.log_level_save],
277 _log_type[cfg.data.log_type],
278 _log_style[cfg.data.log_style]);
279 bcm_dev_log_log(user_appl_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER,
280 "%s", "|-------------------------------------------------------------------------------------------------|\n");
281 key.log_id++;
282
283 }
284 bcm_dev_log_log(user_appl_log_id, DEV_LOG_LEVEL_DEBUG, BCM_LOG_FLAG_NO_HEADER,
285 "%s", "|-------------------------------------------------------------------------------------------------|\n");
286 return BCM_ERR_OK;
287}
288
289static bcmos_errno _apicli_indication_handler(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
290{
291 struct bcmolt_rx_cfg rx_cfg =
292 {
293 .obj_type = BCMOLT_OBJECT_ANY,
294 .rx_cb = bcmolt_user_appl_indication_cb,
295 .flags = BCMOLT_AUTO_FLAGS_NONE,
296 .pon_ni_mask = parm[0].value.unumber
297 };
298 return bcmolt_auto_rx_cb_set(current_device, &rx_cfg);
299}
300
301static bcmos_errno _apicli_proxy_rx_handler(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
302{
303 struct bcmolt_rx_cfg rx_cfg =
304 {
305 .obj_type = BCMOLT_OBJECT_ANY,
306 .rx_cb = bcmolt_user_appl_proxy_rx_cb,
307 .flags = BCMOLT_AUTO_FLAGS_NONE,
308 .pon_ni_mask = parm[0].value.unumber
309 };
310 return bcmolt_proxy_rx_cb_set(current_device, &rx_cfg);
311}
312#endif
313
314#ifndef SIMULATION_BUILD
315static bcmos_errno _apicli_pcistat(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
316{
317 bcmos_errno rc;
318 uint8_t start;
319 bcm_pcied_stat *stat;
320
321 start = 0;
322 if (n_parms > 0)
323 {
324 if (!strncmp(parm[0].value.string, "yes", strlen("yes")))
325 start = 1;
326 }
327
328 rc = bcm_board_pci_debug(0, MAPLE_DEV_CTRL_IOCTL_OP_PCI_STAT, start, 0, bcmlcli_pci_dumpptr);
329 stat = (bcm_pcied_stat *)bcmlcli_pci_dumpptr;
330 BCMOS_TRACE_CHECK_RETURN(rc, rc, "bcm_board_pci_debug() failed\n");
331 bcmcli_session_print(session, "Received : %d\n", stat->rx_counter);
332 bcmcli_session_print(session, "Send : %d\n", stat->tx_counter);
333 bcmcli_session_print(session, "Rx Done Isr : %d\n", stat->rx_done_isr_counter);
334 bcmcli_session_print(session, "Rx Err Isr : %d\n", stat->rx_err_isr_counter);
335 bcmcli_session_print(session, "Tx Done Isr : %d\n", stat->tx_done_isr_counter);
336 bcmcli_session_print(session, "Tx Err Isr : %d\n", stat->tx_err_isr_counter);
337 bcmcli_session_print(session, "Rx empty : %d\n", stat->rx_pcie_empty_counter);
338 bcmcli_session_print(session, "Tx full : %d\n\n", stat->tx_pcie_full_counter);
339
340 return BCM_ERR_OK;
341}
342static bcmos_errno _apicli_pcidump(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
343{
344 bcmos_errno rc;
345 uint32_t command;
346 int32_t start, howmany;
347
348 start = -1;
349 howmany = 1;
350
351 if (n_parms > 1)
352 {
353 start = parm[1].value.number;
354 howmany = 1;
355 if (n_parms > 2)
356 howmany = parm[2].value.number;
357 }
358 if (!strncmp(parm[0].value.string, "tx", strlen("tx")))
359 {
360 command = MAPLE_DEV_CTRL_IOCTL_OP_PCI_DUMP_TX;
361 }
362 else if (!strncmp(parm[0].value.string, "rx", strlen("rx")))
363 {
364 command = MAPLE_DEV_CTRL_IOCTL_OP_PCI_DUMP_RX;
365 }
366 else
367 {
368 bcmcli_session_print(session, "Error - wrong command: %s\n", parm[0].value.string);
369 return BCM_ERR_PARM;
370 }
371
372 rc = bcm_board_pci_debug(0, command, start, howmany, bcmlcli_pci_dumpptr);
373 BCMOS_TRACE_CHECK_RETURN(rc, rc, "bcm_board_pci_debug() failed\n");
374 bcmcli_session_print(session, "%s", (char *)bcmlcli_pci_dumpptr);
375
376 return BCM_ERR_OK;
377}
378#endif
379
380static void bcmolt_user_appl_cli_start_epon(void)
381{
382 bcmolt_user_appl_epon_oam_init();
383 bcmolt_user_appl_epon_oam_cli_init(user_dir);
384
385 bcmolt_user_appl_eon_init();
386 bcmolt_user_appl_eon_cli_init(user_dir);
387
388#ifndef SIMULATION_BUILD
389 bcmolt_epon_omon_appl_init();
390 bcmolt_user_appl_epon_omon_cli_init(user_dir);
391
392 bcmolt_epon_hde_appl_init();
393 bcmolt_epon_hde_appl_cli_init(user_dir);
394#endif
395
396 bcmolt_user_appl_dpoe_sec_init();
397 bcmolt_user_appl_dpoe_sec_cli_init(user_dir);
398}
399
400static void bcmolt_user_appl_cli_start_gpon(bcmolt_devid dev)
401{
402 bcmolt_user_appl_gpon_utils_init(user_dir);
403
404#ifndef RELEASE_BUILD
405 bcmolt_gpon_mac_learning_appl_init(dev);
406 bcmolt_user_appl_gpon_mac_learning_cli_init(user_dir);
407
408 bcmolt_gpon_stress_appl_init(dev);
409 bcmolt_user_appl_gpon_stress_cli_init(user_dir);
410
411 bcmolt_gpon_sn_acquisition_appl_init(dev);
412 bcmolt_user_appl_gpon_sn_acquisition_cli_init(user_dir);
413
414 bcmolt_user_appl_gpon_statistics_init(dev);
415 bcmolt_user_appl_gpon_statistics_cli_init(user_dir);
416
417 bcmolt_gpon_ds_omci_appl_init(dev);
418 bcmolt_user_appl_gpon_ds_omci_cli_init(user_dir);
419
420 bcmolt_omci_swdl_appl_init(dev);
421 bcmolt_user_appl_omci_swdl_cli_init(user_dir);
422
423 bcmolt_gpon_rssi_appl_init(dev);
424 bcmolt_user_appl_gpon_rssi_cli_init(user_dir);
425#endif /* Not RELEASE_BUILD */
426}
427
428static void bcmolt_user_appl_cli_start_xgpon(bcmolt_devid dev)
429{
430 bcmolt_user_appl_gpon_utils_init(user_dir);
431
432#ifndef RELEASE_BUILD
433
434 bcmolt_gpon_stress_appl_init(dev);
435 bcmolt_user_appl_gpon_stress_cli_init(user_dir);
436
437 bcmolt_gpon_sn_acquisition_appl_init(dev);
438 bcmolt_user_appl_gpon_sn_acquisition_cli_init(user_dir);
439
440 bcmolt_user_appl_gpon_statistics_init(dev);
441 bcmolt_user_appl_gpon_statistics_cli_init(user_dir);
442
443 bcmolt_gpon_ds_omci_appl_init(dev);
444 bcmolt_user_appl_gpon_ds_omci_cli_init(user_dir);
445
446 bcmolt_gpon_rssi_appl_init(dev);
447 bcmolt_user_appl_gpon_rssi_cli_init(user_dir);
448
449 bcmolt_onu_tuning_appl_init(dev);
450 bcmolt_user_appl_onu_tuning_cli_init(user_dir);
451#endif /* Not RELEASE_BUILD */
452}
453
454void bcmolt_user_appl_cli_handle_system_mode_change(bcmolt_devid dev)
455{
456 bcmolt_system_mode sys_mode;
457
458 if (sys_mode_set[dev] == BCMOS_TRUE)
459 {
460 return; /* only run once */
461 }
462
463 sys_mode_set[dev] = BCMOS_TRUE;
464 (void)bcmolt_system_mode_get(dev, &sys_mode);
465 switch (sys_mode)
466 {
467 case BCMOLT_SYSTEM_MODE_EPON__16_X:
468 case BCMOLT_SYSTEM_MODE_EPON__8_X:
469 case BCMOLT_SYSTEM_MODE_EPON__4_X:
470 case BCMOLT_SYSTEM_MODE_EPON__8_X_COEXISTENCE_TDMA:
471 case BCMOLT_SYSTEM_MODE_EPON__4_X_COEXISTENCE_TDMA:
472 case BCMOLT_SYSTEM_MODE_EPON__8_X_10_G:
473 case BCMOLT_SYSTEM_MODE_EPON__4_X_10_G:
474 case BCMOLT_SYSTEM_MODE_EPON__2_X_10_G:
475 bcmolt_user_appl_cli_start_epon();
476 break;
477 case BCMOLT_SYSTEM_MODE_GPON__16_X:
478 case BCMOLT_SYSTEM_MODE_GPON__8_X:
479 case BCMOLT_SYSTEM_MODE_GPON__4_X:
480 bcmolt_user_appl_cli_start_gpon(dev);
481 break;
482 case BCMOLT_SYSTEM_MODE_XGPON_1__8_X:
483 case BCMOLT_SYSTEM_MODE_XGPON_1__4_X:
484 case BCMOLT_SYSTEM_MODE_XGS__2_X_10_G:
485 case BCMOLT_SYSTEM_MODE_NGPON2__2_X_10_G:
486 bcmolt_user_appl_cli_start_xgpon(dev);
487 break;
488 case BCMOLT_SYSTEM_MODE__NUM_OF: /* unconfigured */
489 sys_mode_set[dev] = BCMOS_FALSE;
490 break;
491 default:
492 /* do nothing */
493 break;
494 }
495}
496
497bcmos_errno bcmolt_user_appl_cli_init(bcmcli_entry *top_dir)
498{
499 bcmos_errno err;
500 bcmlcli_pci_dumpptr = bcmos_alloc(1024*5);
501 uint8_t inst;
502
503 if (!bcmlcli_pci_dumpptr)
504 {
505 BCMOS_CHECK_RETURN_ERROR(!bcmlcli_pci_dumpptr, BCM_ERR_NOMEM);
506 return BCM_ERR_NULL;
507 }
508#ifdef ENABLE_LOG
509 static bcmcli_enum_val enum_table_file_id[] =
510 {
511 { .name = "SRAM", .val = BCMOLT_LOG_FILE_ID_SRAM },
512 { .name = "DDR", .val = BCMOLT_LOG_FILE_ID_DDR },
513 BCMCLI_ENUM_LAST
514 };
515
516 bcmolt_msg_log_init(); /* initialize API/logger integration */
517 user_appl_log_id = bcm_dev_log_id_register("user_appl", DEV_LOG_LEVEL_DEBUG, DEV_LOG_ID_TYPE_BOTH);
518 for (inst = 0; inst < BCMTR_MAX_INSTANCES; inst++)
519 {
520 char log_name[MAX_DEV_LOG_ID_NAME];
521 sprintf(log_name, "ind_msg%u", inst);
522 ind_log_id[inst] = bcm_dev_log_id_register(log_name, DEV_LOG_LEVEL_DEBUG, DEV_LOG_ID_TYPE_BOTH);
523 }
524#endif
525 user_dir = bcmcli_dir_add(top_dir, "user", "User application", BCMCLI_ACCESS_ADMIN, NULL);
526 BCMOS_CHECK_RETURN_ERROR(!user_dir, BCM_ERR_NOMEM);
527#ifdef ENABLE_LOG
528 BCMCLI_MAKE_CMD(user_dir, "register_indication_handler", "Register indication handler", _apicli_indication_handler,
529 BCMCLI_MAKE_PARM_DEFVAL("pon_ni_mask", "PON_NI interface bitmask. 0=all", BCMCLI_PARM_UNUMBER, 0, 0));
530 BCMCLI_MAKE_CMD(user_dir, "register_proxy_rx_handler", "Register Proxy Rx handler", _apicli_proxy_rx_handler,
531 BCMCLI_MAKE_PARM_DEFVAL("pon_ni_mask", "PON_NI interface bitmask. 0=all", BCMCLI_PARM_UNUMBER, 0, 0));
532 BCMCLI_MAKE_CMD(user_dir, "read_embedded_logger", "Read embedded logger", _apicli_read_embedded_logger,
533 BCMCLI_MAKE_PARM_ENUM("file_id", "file_id", enum_table_file_id, 0));
534
535 BCMCLI_MAKE_CMD_NOPARM(user_dir, "get_all_log_entries", "Get all embedded log entries", _apicli_get_all_log_entries);
536#endif
537
538#ifndef SIMULATION_BUILD
539 BCMCLI_MAKE_CMD(user_dir, "pcistat", "Print PCIe statistics", _apicli_pcistat,
540 BCMCLI_MAKE_PARM("clear", "clear", BCMCLI_PARM_STRING, BCMCLI_PARM_FLAG_OPTIONAL));
541 BCMCLI_MAKE_CMD(user_dir, "pcidump", "Print PCIe ring", _apicli_pcidump,
542 BCMCLI_MAKE_PARM("dir", "direction: tx or rx", BCMCLI_PARM_STRING, 0),
543 BCMCLI_MAKE_PARM("from", "start index", BCMCLI_PARM_NUMBER, BCMCLI_PARM_FLAG_OPTIONAL),
544 BCMCLI_MAKE_PARM("howmany", "howmany", BCMCLI_PARM_NUMBER, BCMCLI_PARM_FLAG_OPTIONAL));
545#endif
546
547#ifndef RELEASE_BUILD
548 bcmolt_remote_logger_appl_init();
549 bcmolt_remote_logger_appl_cli_init(user_dir);
550#endif
551
552 err = bcmolt_user_appl_cli_image_transfer_init(user_dir);
553 BCMOS_CHECK_RETURN_ERROR(err != BCM_ERR_OK, err);
554
555 err = bcmolt_user_appl_cli_sw_upgrade_init(user_dir);
556 BCMOS_CHECK_RETURN_ERROR(err != BCM_ERR_OK, err);
557
558 bcmolt_ps_appl_init();
559 err = bcmolt_user_appl_ps_cli_init(user_dir);
560 BCMOS_CHECK_RETURN_ERROR(err != BCM_ERR_OK, err);
561
562 bcmolt_user_appl_playback_init();
563 bcmolt_user_appl_playback_cli_init(user_dir);
564
565 bcmolt_user_appl_cli_handle_system_mode_change(current_device);
566
567 return err;
568}