www.pudn.com > at91rm9200vxworksbsp.rar > profile.h
/* * software/app/common/include/profile.h * * Copyright (C) 2006 GRENTECH * All rights reserved. */ /* * Function: * Declare INI process function. Following function is similar Windows * corresponding API. * * NOTE: We use the character of '#' to comment the line in our INI file. * * Description: * GetProfileStr: * It is similar to GetPrivateProfileString API on windows. * WriteProfileStr: * It is similar to WritePrivateProfileString API on windows. * * Version: * 1.0.0 * * Revision History: * * 2006-12-22 Yang Lifeng * ³õʼ»¯°æ±¾ * */ #ifndef _PROFILE_H_ #define _PROFILE_H_ /*#include "rrudef.h"*/ typedef void VOID; typedef unsigned char UINT8; typedef char INT8; /*typedef char* STRING;*/ typedef unsigned short UINT16; typedef short INT16; typedef unsigned int UINT32; typedef int INT32; typedef long INT32L; #ifdef WIN32 #else typedef long long INT64; #endif typedef float FLOAT32; typedef double FLOAT64; /*================add by lubingjie 20070326======================*/ #define CONFIG_FILENAME "/boot/rru.ini" #define SEC_RRU_INFO "RRU-INFO" /* rru infomatin section */ #define ENTRY_RRU_VERSION "VersionNo" /* RRU Device version */ #define ENTRY_RRU_PROTOCOL_VERSION "ProtocolVersion" /* OM Protocol version */ #define ENTRY_RRU_FIRMWARE_VERSION "FirmwareVersion" #define ENTRY_RRU_FIRMWARE_NAME "FirmwareName" #define ENTRY_RRU_HARDWARE_VERSION "HardwareVersion" /* Hardware version */ #define ENTRY_RRU_MANUFACTURE "Manufacture" /* product corporation */ #define ENTRY_RRU_EQUIPMENT_TYPE "EquipmentType" /* type of equipment */ #define ENTRY_RRU_SERIAL_NO "SerialNo" /* serial num of equipment */ #define ENTRY_RRU_BATCH_NO "BatchNo" #define ENTRY_RRU_PRODUCT_DATE "ProductionDate" #define ENTRY_RRU_MANUFACTURE_DATE "ManufactureData" #define ENTRY_RRU_SERVICE_DATE "DateOfLastService" #define ENTRY_RRU_UNIT_POSITION "UnitPosition" #define SEC_UPDATE_APP_INFO "UPDATE-APP-INFO" /* update version software section */ #define SEC_BACKUP_APP_INFO "BACKUP-APP-INFO" /* backup version software section */ #define SEC_UPDATE_FPGA_INFO "UPDATE-FPGA-INFO" /* update version FPGA section */ #define SEC_BACKUP_FPGA_INFO "BACKUP-FPGA-INFO" /* backup version FPGA section */ #define ENTRY_NAME "Name" #define ENTRY_VERSION "Version" #define ENTRY_DATE "Date" #define ENTRY_SIZE "Size" #define ENTRY_DIRECTORY "Directory" #define ENTRY_STATUS "Status" #define SEC_MODULE_INFO "MODULE-INFO" /* */ #define ENTRY_PCB_VERSION "PCBVersion" #define ENTRY_CPU_TYPE "CpuType" #define ENTRY_MEM_SIZE "MemorySize" #define ENTRY_FLASH_SIZE "FlashSize" #define ENTRY_MONO_MANUF "MonoProcManufacture" #define ENTRY_MONO_SERIAL_NO "MonoProcSerialNo" #define ENTRY_MONO_HW_VERSION "MonoProcHwVer" #define ENTRY_MONO_FW_VERSION "MonoProcFwVer" #define ENTRY_PA_TYPE "PAType" #define ENTRY_LNA_VERSION "LNAversion" #define ENTRY_OPT0_TYPE "OPT0type" #define ENTRY_OPT1_TYPE "OPT1type" /* * Following comments copy from MSDN doc, Microsoft reserved all copyright */ /* * Parameters * * section * [in] Pointer to a null-terminated string that specifies the name of the * section containing the key name. If this parameter is NULL, the * GetPrivateProfileString function copies all section names in the file to the * supplied buffer. * * entry * [in] Pointer to the null-terminated string specifying the name of the key * whose associated string is to be retrieved. If this parameter is NULL, all * key names in the section specified by the section parameter are * copied to the buffer specified by the buffer parameter. * * def_val * [in] Pointer to a null-terminated default string. If the entry key * cannot be found in the initialization file, GetPrivateProfileString copies the * default string to the buffer. If this parameter is NULL, the * default is an empty string, "". * * Avoid specifying a default string with trailing blank characters. The * function inserts a null character in the buffer to strip any * trailing blanks. * * Although def_val is declared as a constant parameter, the system strips * any trailing blanks by inserting a null character into the def_val string * before copying it to the buffer. * * buffer * [out] Pointer to the buffer that receives the retrieved string. * The string cannot contain control characters (character code less than 32). * Strings containing control characters may be truncated. * * len * [in] Size of the buffer pointed to by the buffer parameter, in * characters. * * filename * [in] Pointer to a null-terminated string that specifies the name of the * initialization file. If this parameter does not contain a full path to the file, * the system searches for the file in the current directory. * * If this parameter is NULL. the system will open the "rru.ini" * * Return Values * The return value is the number of characters copied to the buffer, not * including the terminating null character. * * If neither section nor entry is NULL and the supplied destination * buffer is too small to hold the requested string, the string is truncated and * followed by a null character, and the return value is equal to len minus one. * * If either section or entry is NULL and the supplied destination * buffer is too small to hold all the strings, the last string is truncated and * followed by two null characters. In this case, the return value is equal to * len minus two. * */ INT32 GetProfileStr( INT8 *section, INT8 *entry, INT8 *def_val, INT8 *buffer, UINT32 len, INT8 *filename ); /* * Parameters * * section * [in] Pointer to a null-terminated string containing the name of the section * to which the string will be copied. If the section does not exist, it is created. * The name of the section is case-independent; the string can be any * combination of uppercase and lowercase letters. * * entry * [in] Pointer to the null-terminated string containing the name of the key * to be associated with a string. If the key does not exist in the specified * section, it is created. If this parameter is NULL, the entire section, * including all entries within the section, is deleted. * * string * [in] Pointer to a null-terminated string to be written to the file. If this * parameter is NULL, the key pointed to by the entry parameter is * deleted. * * The system does not support the use of the TAB (\t) character as part of * this parameter. * * filename * [in] Pointer to a null-terminated string that specifies the name of the * initialization file. * * If this parameter is NULL. the system will open the "rru.ini". * *Return Values * If the function successfully copies the string to the initialization file, the * return value is nonzero. * * If the function fails, or if it flushes the cached version of the most recently * accessed initialization file, the return value is zero. */ INT32 WriteProfileStr( INT8 *section, INT8 *entry, INT8 *string, INT8 *filename ); #endif