blob: 3e638fe8e5d70fcff985d9ad4d83d59b8882cc44 [file] [log] [blame]
/* Copyright (C) 2011-2012 Humax Co., Ltd. All rights reserved.
*
* Humax Co., Ltd. ("Humax") hereby provides permission, free of charge, to any
* person obtaining a copy of this source code, to use and redistribute this
* source code with or without modification subject to the following conditions:
*
* 1. Redistributions of this source code must retain the above copyright
* notice, permission notice, this list of conditions and the following
* disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* permission notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY HUMAX "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ACCURACY, COMPLETENESS,
* CURRENCY, AVAILABILITY, TITLE OR NON-INFRINGEMENT. IN NO EVENT HUMAX OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF OR OTHER DEALINGS IN THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusion contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Humax.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Humax’s software provided under a license
* other than the above license, without Humax's express prior written consent.
*/
/*******************************************************************/
/************************* File Description ************************/
/*******************************************************************/
/* File Name: $Workfile: hmx_uprade_nvram.h $
* Version: $Revision: 1.0 $
* Original Author: Yang Hyun Uk $
* Current Author: $Author: huyang@humaxdigital.com $
* Date: $Date: 2011.11.07
* File Description: Upgrade APIs
* Module:
* Remarks:
*/
/**
* @author Hyunuk Yang(huyang@humaxdigital.com)
* @date 07 Nov 2011
*/
/*@{*/
/**
* @file hmx_upgrade_nvram.h
*/
#ifndef HMX_UPGRADE_NVRAM_H_
#define HMX_UPGRADE_NVRAM_H_
/*******************************************************************/
/**************************** Header Files**************************/
/*******************************************************************/
/* Start Including Header Files */
/* End Including Headers*/
/*******************************************************************/
/************************ Extern variables *************************/
/*******************************************************************/
/* Start Extern variablee */
extern int libupgrade_verbose;
/* End Extern variable */
/*******************************************************************/
/************************ Macro Definition *************************/
/*******************************************************************/
/* Start Macro definition */
/* End Macro definition */
/*******************************************************************/
/****************************** typedef ****************************/
/*******************************************************************/
/* Start typedef */
typedef enum tagNVRAM_FIELD {
NVRAM_FIELD_SYSTEM_ID = 0, // System Id
NVRAM_FIELD_SERIAL_NO,
NVRAM_FIELD_MAC_ADDR,
NVRAM_FIELD_HDCP_KEY,
NVRAM_FIELD_DTCP_KEY,
NVRAM_FIELD_1ST_SERIAL_NUMBER,
NVRAM_FIELD_2ND_SERIAL_NUMBER,
NVRAM_FIELD_GPN,
NVRAM_FIELD_MAC_ADDR_MOCA,
NVRAM_FIELD_MAC_ADDR_BT,
NVRAM_FIELD_GOOGLE_SSL_PEM,
NVRAM_FIELD_GOOGLE_SSL_CRT,
NVRAM_FIELD_LOADER_VERSION, // Version of boot Loader
NVRAM_FIELD_ACTIVATED_KERNEL_NUM, // ACTIVATED_KERNEL_NUM
NVRAM_FIELD_MTD_TYPE_FOR_KERNEL, // MTD_TYPE_FOR_KERNEL
NVRAM_FIELD_ACTIVATED_KERNEL_NAME, // "kernel0", lookup mtd partition
NVRAM_FIELD_PLATFORM_NAME, // Platform name, e.g. "gfhd100"
NVRAM_FIELD_EXTRA_KERNEL_OPT, // string to append to cmdline
NVRAM_FIELD_PAIRED_DISK, // serial number of the disk
NVRAM_FIELD_PARTITION_VER, // partition version
NVRAM_FIELD_HW_VER, // hardware revision
NVRAM_FIELD_MAC_ADDR_WIFI,
NVRAM_FIELD_MAC_ADDR_WAN,
NVRAM_FIELD_DUMMY = 0xFFFF
} NVRAM_FIELD_T;
/* Start global function prototypes */
typedef enum HMX_NVRAM_PARTITION_e {
HMX_NVRAM_PARTITION_RO,
HMX_NVRAM_PARTITION_RW,
HMX_NVRAM_PARTITION_W_RAWFS,
HMX_NVRAM_PARTITION_MAX
} HMX_NVRAM_PARTITION_E;
typedef enum {
DRV_OK = 0,
DRV_ERR,
DRV_ERR_INVALID_PARAMETER,
DRV_ERR_INITIALIZATION,
DRV_ERR_EVENT_INITIALIZATION,
DRV_ERR_OUTOFMEMORY,
DRV_ERR_EXTERNAL_ERROR
} DRV_Error;
/* End typedef */
/*******************************************************************/
/******************** global function prototype ********************/
/*******************************************************************/
extern int HMX_UPGRADE_NVRAM_Write(unsigned long offset, unsigned char * data,
unsigned int size );
extern int HMX_UPGRADE_NVRAM_Read(unsigned long offset, unsigned char * data,
unsigned int size );
/*******************************************************************/
/******************** global function prototype ********************/
/*******************************************************************/
DRV_Error HMX_NVRAM_Init(void);
DRV_Error HMX_NVRAM_Write(HMX_NVRAM_PARTITION_E partition,
unsigned char *pName, unsigned int offset,
unsigned char *pValue, unsigned int ulSize);
DRV_Error HMX_NVRAM_Read(HMX_NVRAM_PARTITION_E partition,
unsigned char *pName, unsigned int offset,
unsigned char *pValue, unsigned int ulSize,
unsigned int *pLen);
DRV_Error HMX_NVRAM_GetField(NVRAM_FIELD_T field, unsigned int offset,
void *data, int nDataSize);
DRV_Error HMX_NVRAM_SetField(NVRAM_FIELD_T field, unsigned int offset,
void *data, int nDataSize);
DRV_Error HMX_NVRAM_GetLength(NVRAM_FIELD_T field, int *pLen);
DRV_Error HMX_NVRAM_Remove(HMX_NVRAM_PARTITION_E partition,
unsigned char *pName);
DRV_Error HMX_NVRAM_Dir(void);
/* End global function prototypes */
#endif // HMX_UPGRADE_NVRAM_H_
/*@}*/