blob: c9b03b4a6049825563d60803f4cd25349567aa80 [file] [log] [blame]
/*
<:copyright-BRCM:2014:DUAL/GPL:standard
Copyright (c) 2014 Broadcom Corporation
All Rights Reserved
Unless you and Broadcom execute a separate written software license
agreement governing use of this software, this software is licensed
to you under the terms of the GNU General Public License version 2
(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
with the following added to such license:
As a special exception, the copyright holders of this software give
you permission to link this software with independent modules, and
to copy and distribute the resulting executable under terms of your
choice, provided that you also meet, for each linked independent
module, the terms and conditions of the license of that module.
An independent module is a module which is not derived from this
software. The special exception does not apply to any modifications
of the software.
Not withstanding the above, under no circumstances may you combine
this software in any way with any other Broadcom software provided
under a license other than the GPL, without Broadcom's express prior
written consent.
:>
*/
#include <bcmos_system.h>
#include <bcmcli.h>
#include <bcmolt_model_types.h>
#include <bcmolt_msg.h>
#include <bcmolt_api.h>
#include <bcm_api_cli_helpers.h>
#include "bcmolt_sw_upgrade_cli.h"
static bcmos_errno bcmolt_user_appl_cli_sw_upgrade_activate(bcmcli_session *session, const bcmcli_cmd_parm parms[], uint16_t n_parms)
{
bcmolt_device_key key = {};
bcmolt_device_sw_upgrade_activate oper_sw_upgrade_activate;
bcmolt_device_disconnect oper_disconnect;
bcmolt_device_connect oper_connect;
bcmos_errno err;
BCMOLT_OPER_INIT(&oper_sw_upgrade_activate, device, sw_upgrade_activate, key);
err = bcmolt_oper_submit(0, &oper_sw_upgrade_activate.hdr);
if (err)
return err;
BCMOLT_OPER_INIT(&oper_disconnect, device, disconnect, key);
err = bcmolt_oper_submit(0, &oper_disconnect.hdr);
if (err)
return err;
BCMOLT_OPER_INIT(&oper_connect, device, connect, key);
return bcmolt_oper_submit(0, &oper_connect.hdr);
}
bcmos_errno bcmolt_user_appl_cli_sw_upgrade_init(bcmcli_entry *top_dir)
{
bcmcli_entry *dir = bcmcli_dir_add(top_dir, "sw_upgrade",
"Software upgrade user application", BCMCLI_ACCESS_ADMIN, NULL);
BCMOS_CHECK_RETURN_ERROR(!dir, BCM_ERR_NOMEM);
BCMCLI_MAKE_CMD_NOPARM(dir, "activate", "SW upgrade image activation", bcmolt_user_appl_cli_sw_upgrade_activate);
return BCM_ERR_OK;
}