| /*******************************************************************/ |
| /************************* File Description ************************/ |
| /*******************************************************************/ |
| /* File Name: $Workfile: hmx_uprade.h $ |
| * Version: $Revision: 1.0 $ |
| * Original Author: Yang Hyun Uk $ |
| * Current Author: $Author: huyang@humaxdigital.com $ |
| * Date: $Date: 2011.09.30 |
| * File Description: Upgrade APIs |
| * Module: |
| * Remarks: |
| */ |
| |
| /** |
| * @defgroup UPGRADE Upgrade APIs |
| */ |
| |
| /** |
| * @author Hyunuk Yang(huyang@humaxdigital.com) |
| * @date 30 Sept 2011 |
| */ |
| |
| /** |
| * @note |
| * Copyright (C) 2011 Humax Corporation. All Rights Reserved. <br> |
| * This software is the confidential and proprietary information |
| * of Humax Corporation. You may not use or distribute this software |
| * except in compliance with the terms and conditions of any applicable license |
| * agreement in writing between Humax Corporation and you. |
| */ |
| |
| /*@{*/ |
| |
| /** |
| * @file hmx_upgrade.h |
| */ |
| |
| /*******************************************************************/ |
| /**************************** Header Files**************************/ |
| /*******************************************************************/ |
| /* Start Including Header Files */ |
| #include <stdio.h> |
| #include <string.h> |
| #include <stdlib.h> |
| #include <pthread.h> |
| #include <errno.h> |
| #include <assert.h> |
| #include <sys/queue.h> |
| #include <unistd.h> |
| #include <fcntl.h> |
| #include "hmx_upgrade_system.h" |
| #include "hmx_upgrade_flash.h" |
| /* End Including Headers*/ |
| |
| /*******************************************************************/ |
| /************************ Extern variables *************************/ |
| /*******************************************************************/ |
| /* Start Extern variablee */ |
| |
| /* End Extern variable */ |
| |
| |
| /*******************************************************************/ |
| /************************ Macro Definition *************************/ |
| /*******************************************************************/ |
| /* Start Macro definition */ |
| /* End Macro definition */ |
| |
| |
| |
| /*******************************************************************/ |
| /****************************** typedef ****************************/ |
| /*******************************************************************/ |
| /* Start typedef */ |
| |
| typedef enum |
| { |
| HMX_UPGRADE_START, /**< */ |
| HMX_UPGRADE_STOP, /**< */ |
| HMX_UPGRADE_FETCH, /**< */ |
| }HMX_UPGRADE_COMMAND_e; |
| |
| typedef struct |
| { |
| HMX_UPGRADE_COMMAND_e command; |
| unsigned char * file_path; |
| }HMX_UPGRADE_COMMAND_t; |
| |
| /** |
| * HMX_UPGRADE Status cases. |
| */ |
| typedef enum |
| { |
| HMX_UPGRADE_STARTED, /**< Upgrade Module is just started */ |
| HMX_UPGRADE_GET_VERSION, /**< this comes with version information */ |
| HMX_UPGRADE_READING, /**< reading file. Upgrade is in progress. */ |
| HMX_UPGRADE_FLASHING, /**< Flashing. Upgrade is in progress. */ |
| HMX_UPGRADE_DONE, /**< Upgrade is done without any error, After this message, Upgrade module will be destroy itself. */ |
| HMX_UPGRADE_STOPED_BY_USER, /**< Upgrade is stopped by user. After this message, Upgrade module will be destroy itself. */ |
| HMX_UPGRADE_FAILED, /**< Upgrade is failed, it shouldn't happen. After this message, Upgrade module will be destroy itself.*/ |
| HMX_UPGRADE_VERSION_FAILED, /**< Upgrade is failed, version problem. */ |
| HMX_UPGRADE_FILE_NOT_EXIST, /**< Upgrade is failed, there is no file exist */ |
| HMX_UPGRADE_FILE_FORMAT_ERROR, /**< Upgrade is failed, file is not HDF Format */ |
| |
| }HMX_UPGRADE_EVENT_e; |
| |
| |
| /** |
| * HMX_UPGRADE_Status_Messages |
| */ |
| typedef struct |
| { |
| HMX_UPGRADE_EVENT_e event; /**< event from Upgrade module */ |
| unsigned int percentage; /**< percentage progress */ |
| unsigned int current_version; /**< version current */ |
| unsigned int version_to_upgrade; /**< version to upgrade */ |
| } HMX_UPGRADE_STATUS_Msg_t; |
| |
| /** |
| * Prototype of upgrade event callback function <br> |
| * Callback can be added by HMX_UPGRADE_Start <br><br> |
| * HMX_UPGRADE_READING, HMX_UPGRADE_FLASHING events always comes with value of percentage. |
| */ |
| typedef void (*HMX_UpgradeEventCallback) (HMX_UPGRADE_STATUS_Msg_t * UpgradeStatusMessages); |
| |
| /* End typedef */ |
| |
| |
| /*******************************************************************/ |
| /******************** global function prototype ********************/ |
| /*******************************************************************/ |
| /* Start global function prototypes */ |
| extern HMX_UpgradeEventCallback g_fUpgradeStatusCallback; |
| /* End global function prototypes */ |
| |
| int HMX_UPGRADE_Start( HMX_UpgradeEventCallback callback, unsigned char * file); |
| int HMX_UPGRADE_Stop( void); |
| |
| /*@}*/ |