Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame^] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * <:copyright-BRCM:2016:DUAL/GPL:standard |
| 4 | * |
| 5 | * Copyright (c) 2016 Broadcom |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * Unless you and Broadcom execute a separate written software license |
| 9 | * agreement governing use of this software, this software is licensed |
| 10 | * to you under the terms of the GNU General Public License version 2 |
| 11 | * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| 12 | * with the following added to such license: |
| 13 | * |
| 14 | * As a special exception, the copyright holders of this software give |
| 15 | * you permission to link this software with independent modules, and |
| 16 | * to copy and distribute the resulting executable under terms of your |
| 17 | * choice, provided that you also meet, for each linked independent |
| 18 | * module, the terms and conditions of the license of that module. |
| 19 | * An independent module is a module which is not derived from this |
| 20 | * software. The special exception does not apply to any modifications |
| 21 | * of the software. |
| 22 | * |
| 23 | * Not withstanding the above, under no circumstances may you combine |
| 24 | * this software in any way with any other Broadcom software provided |
| 25 | * under a license other than the GPL, without Broadcom's express prior |
| 26 | * written consent. |
| 27 | * |
| 28 | * :> |
| 29 | * |
| 30 | *****************************************************************************/ |
| 31 | |
| 32 | /** |
| 33 | * @file bal_cli_app.c |
| 34 | * @brief BAL CLI application |
| 35 | * @addtogroup ctrlr |
| 36 | */ |
| 37 | |
| 38 | /*@{*/ |
| 39 | |
| 40 | #include <bcmos_system.h> |
| 41 | #include <bal_core.h> |
| 42 | #include <bal_cli.h> |
| 43 | |
| 44 | #ifdef OMCI_SVC |
| 45 | #include <omci_svc.h> |
| 46 | #include <omci_svc_cli.h> |
| 47 | #endif |
| 48 | |
| 49 | |
| 50 | /*****************************************************************************/ |
| 51 | /** |
| 52 | * @brief The main entry point for the Bal Core |
| 53 | * |
| 54 | * A function to initialize and start the Bal Core. The user |
| 55 | * supplied command line arguments are processed, the internal CLI is |
| 56 | * initialized, as are all of the components in the Core. User input to |
| 57 | * the CLI is then processed. This function does not return until the |
| 58 | * user quits the CLI, at which time the BAL core terminates operation. |
| 59 | * |
| 60 | * Errors encountered during the execution of this function are considered |
| 61 | * to be fatal. |
| 62 | * |
| 63 | * @param argc command line argument count |
| 64 | * |
| 65 | * @param argv pointer to command line argument list |
| 66 | * |
| 67 | * @returns 0 on success, or -EINVAL when an error is encountered |
| 68 | * |
| 69 | *****************************************************************************/ |
| 70 | int main(int argc, char *argv[]) |
| 71 | { |
| 72 | bcmos_errno ret; |
| 73 | |
| 74 | do |
| 75 | { |
| 76 | /* Init BAL components */ |
| 77 | ret = bcmbal_init_all(argc, argv, NULL); |
| 78 | if (BCM_ERR_OK != ret) |
| 79 | break; |
| 80 | |
| 81 | /* Execute init script if any */ |
| 82 | ret = bcmbal_cli_exec_init_script(); |
| 83 | if (BCM_ERR_OK != ret) |
| 84 | break; |
| 85 | |
| 86 | /* Let everything run until CLI terminates */ |
| 87 | while (!bcmbal_cli_is_terminated()) |
| 88 | bcmos_usleep(1000000); |
| 89 | } |
| 90 | while (0); |
| 91 | |
| 92 | /* Cleanup */ |
| 93 | bcmbal_cli_finish(); |
| 94 | bcmbal_finish(); |
| 95 | bcmos_exit(); |
| 96 | |
| 97 | return (BCM_ERR_OK == ret) ? 0 : -1; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | /*@}*/ |