2024-03-11 01:47:50 +08:00
|
|
|
//**********************************************************************************************************************
|
|
|
|
// FileName : Personality.c
|
|
|
|
// Author(s) : Philipp Roosli, Michael Sobanko
|
|
|
|
// Description: Template for the personalization of a device.
|
|
|
|
//**********************************************************************************************************************
|
|
|
|
// Version History:
|
|
|
|
// 2011/10/14 Base release.
|
|
|
|
//**********************************************************************************************************************
|
|
|
|
|
|
|
|
#include "string.h"
|
|
|
|
#include "APPMAP_Main.h"
|
|
|
|
#include "Personality.h"
|
|
|
|
|
|
|
|
//**********************************************************************************************************************
|
|
|
|
// 设备型号及地址
|
|
|
|
//**********************************************************************************************************************
|
|
|
|
|
|
|
|
#define APP_ID_DEVICE_TYPE \
|
|
|
|
${ device.MODEL }
|
|
|
|
#define P5_ADDRESS \
|
|
|
|
${ device.ADDR }
|
|
|
|
|
2024-03-11 10:38:02 +08:00
|
|
|
#define APP_ID_1 9
|
|
|
|
#define APP_ID_2 9
|
|
|
|
#define APP_ID_3 4
|
|
|
|
#define APP_ID_4 4
|
|
|
|
|
2024-03-11 01:47:50 +08:00
|
|
|
//**********************************************************************************************************************
|
|
|
|
// Constants
|
|
|
|
//**********************************************************************************************************************
|
|
|
|
const char LogicalDeviceIdentifier[] = "X10.r4";
|
|
|
|
|
|
|
|
void RunObject(TYPE_CBL32_OBJECT *ptrObj)
|
|
|
|
{
|
|
|
|
TYPE_REG_ENTRY *RegEntry;
|
|
|
|
TYPE_CBL32_LIGHT_OUTPUT_DATA *LOData;
|
|
|
|
if (ptrObj)
|
|
|
|
{
|
|
|
|
RegEntry = ptrObj->ptrRegEntry;
|
|
|
|
LOData = (TYPE_CBL32_LIGHT_OUTPUT_DATA *)ptrObj->ptrData;
|
|
|
|
switch (RegEntry->RegGroup)
|
|
|
|
{
|
|
|
|
case (REG_GRPKEY_IO >> 8):
|
|
|
|
switch (RegEntry->RegKey)
|
|
|
|
{
|
|
|
|
case (REG_GRPKEY_DIGITAL_INPUT & 0xFF):
|
|
|
|
case (REG_GRPKEY_ANALOG_OUTPUT & 0xFF):
|
|
|
|
CBL_HELPER_DefaultIO_RunObject(ptrObj);
|
|
|
|
break;
|
|
|
|
case (REG_GRPKEY_DIGITAL_OUTPUT & 0xFF):
|
|
|
|
{
|
|
|
|
if (LOData->BOData.DriverCtrlCmd == CBL32_IRAS_CTRL_CMD_SET_VALUE)
|
|
|
|
{
|
|
|
|
switch (RegEntry->RegIdx)
|
|
|
|
{
|
|
|
|
case 1: // Pin 3
|
|
|
|
case 2: // Pin 4
|
|
|
|
case 3: // Pin 5
|
|
|
|
case 4: // Pin 6
|
|
|
|
case 5: // Pin 7
|
|
|
|
case 6: // Pin 8
|
|
|
|
case 7: // Pin 9
|
|
|
|
case 8: // Pin 10
|
|
|
|
// HW_API_02_9593_DigitalOut_Control(P5_HELPER_MapOutput_CBL_to_Pin(RegEntry->RegIdx), (BOOL)LOData->BOData.DriverCtrlValue, BOConfig->DriverConfFlags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case (REG_GRPKEY_LIGHT_OUTPUT & 0xFF):
|
|
|
|
break;
|
|
|
|
case (REG_GRPKEY_ANALOG_INPUT & 0xFF):
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BootRegistry7_1(BYTE IOMAP)
|
|
|
|
{
|
|
|
|
${ code71 }
|
|
|
|
}
|
|
|
|
|
|
|
|
void BootRegistry7_2(BYTE IOMAP)
|
|
|
|
{
|
|
|
|
${ code72 }
|
|
|
|
}
|
|
|
|
|
|
|
|
void BootRegistry7_3(BYTE IOMAP)
|
|
|
|
{
|
|
|
|
TYPE_CBL32REG_7_3_LIGHT_OUTPUT Reg;
|
|
|
|
memcpy(&Reg, (BYTE *)®BOOT_7_3_DEFAULT, sizeof(Reg));
|
|
|
|
${ code73 }
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessVFI(TYPE_VFI *VFI)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void ApplicationStartup(void)
|
|
|
|
{
|
|
|
|
BOOL flagBootAppRegistry = TRUE;
|
|
|
|
TYPE_REG_ENTRY *RegEntry = (TYPE_REG_ENTRY *)APPMAP_WRAPPER_BootLoaderSendMsg(CBL32_MSG_REGISTRY_SEARCH_UNIQUE, (REG_GRPKEY_EXT_DEV_NAME << 8), 0);
|
|
|
|
if (RegEntry)
|
|
|
|
{
|
|
|
|
if (strcmp(LogicalDeviceIdentifier, (char *)(RegEntry->RegData)) == 0)
|
|
|
|
{
|
|
|
|
flagBootAppRegistry = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (flagBootAppRegistry)
|
|
|
|
{
|
|
|
|
BootRegistry(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessP5Reply(BYTE *Data, BYTE DataLen)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void ProcessPAE(BYTE P5Addr, USHORT Param)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void ProcessP5Interceptor(TYPE_CBL32_P5_PRETTY_PACKET *P5PP, ULONG Flags)
|
|
|
|
{}
|
|
|
|
|
|
|
|
ULONG ProcessMsg(ULONG Msg, ULONG P1, ULONG P2)
|
|
|
|
{
|
|
|
|
switch (Msg)
|
|
|
|
{
|
|
|
|
case CBL32_MSG_4MSEC_TICK:
|
|
|
|
break;
|
|
|
|
case CBL32_MSG_32MSEC_TICK:
|
|
|
|
break;
|
|
|
|
case CBL32_MSG_PROCESS_VFI:
|
|
|
|
ProcessVFI((TYPE_VFI *)P1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (CBL_HELPER_DefaultIO_ProcessMsg(Msg, P1, P2));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReconfRegistry(BYTE ReconfOp)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void BootRegistry(BYTE IOMAP)
|
|
|
|
{
|
|
|
|
if (IOMAP < 1)
|
|
|
|
{
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_FLAG0, 0x10);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_FLAG1, 0x0F);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_STATION_ADDR, P5_ADDRESS);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_FLAG3, 0x0F);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_MULTICAST_MAP, 0xFF);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_MC_FOCUS_0, 0x00);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_MC_FOCUS_1, 0x00);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_APP_SERVER_0 + 0, 0x00);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_APP_SERVER_0 + 1, 0x00);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_APP_SERVER_0 + 2, 0x00);
|
|
|
|
APPMAP_EEPROM_Write(EEPROM_OFS_STD_NSPB_BLOCK_CACHED_NV + P5STM_NSPB_CACHE_APP_SERVER_0 + 3, 0x00);
|
|
|
|
REG_HELPER_FormatRegistry();
|
|
|
|
}
|
|
|
|
BootRegistry7_1(IOMAP);
|
|
|
|
BootRegistry7_2(IOMAP);
|
|
|
|
BootRegistry7_3(IOMAP);
|
|
|
|
APPMAP_RegistryCreateUKey_String((REG_GRPKEY_PROPERTY_ID << 8), (const char *)("2.17.3.15"));
|
|
|
|
APPMAP_RegistryCreateUKey_String((REG_GRPKEY_PART_NO << 8), (const char *)("01-8201.C"));
|
|
|
|
APPMAP_RegistryCreateUKey_String((REG_GRPKEY_ENGINEER << 8), (const char *)("Greg.Howard@inncom.com"));
|
|
|
|
APPMAP_RegistryCreateUKey_String((REG_GRPKEY_ENG_MEMO << 8), (const char *)(""));
|
|
|
|
APPMAP_RegistryCreateUKey_String((REG_GRPKEY_EXT_DEV_NAME << 8), LogicalDeviceIdentifier);
|
|
|
|
APPMAP_RegistryCreateUKey_String((REG_GRPKEY_INNCONTROL_OPTIONS << 8), (const char *)("Dev_LVIO_2_17_3_15.cfg"));
|
|
|
|
}
|