예제 #1
0
// setBoardParam: Set the board Id string, mac addresses, psi size, etc...
//
int setBoardParam(void)
{
    int bChange = FALSE;
    int count = 0;
    PPARAMETER_SETTING tmpPtr = gBoardParam;    
    int memType;

    while (tmpPtr->promptName !=  NULL)
    {
        count++;
        tmpPtr++;
    }

    getBoardParam();

    while (1)
    {
        bChange = processPrompt(gBoardParam, count);
        if (strlen(gBoardParam[3].parameter) != 0)
            break;
        printf("Base Mac address is not entered.  Try it again!\n");
    }

    if (bChange)
    {
        // fill in board id string, psi and mac count
        nvramData.ulVersion = NVRAM_VERSION_NUMBER;
        nvramData.ulEnetModeFlag = 0xffffffff;          // all ffs for enet mode flag
        memset(nvramData.szBoardId, 0, NVRAM_BOARD_ID_STRING_LEN);
        memcpy(nvramData.szBoardId, gBoardParam[0].parameter, NVRAM_BOARD_ID_STRING_LEN);
        nvramData.ulPsiSize = atoi(gBoardParam[1].parameter);
        nvramData.ulNumMacAddrs = atoi(gBoardParam[2].parameter);
        parsehwaddr(gBoardParam[3].parameter, nvramData.ucaBaseMacAddr);

        // set memory type thing
        memType = atoi(gBoardParam[4].parameter);
        kerSysMemoryTypeSet((int) FLASH63XX_ADDR_BOOT_ROM, (char *)&memType, sizeof(int));

        if (nvramData.ulPsiSize != NVRAM_PSI_DEFAULT_6345)
        {
            printf("Are you REALLY sure persistent storage size is %d?", nvramData.ulPsiSize);
            if (yesno())
            {
                nvramData.ulPsiSize = NVRAM_PSI_DEFAULT_6345;
                sprintf(gBoardParam[1].parameter, "%d", nvramData.ulPsiSize);
                return 0;
            }
        }
        // save the buf to nvram
        writeNvramData();

        printf("Press any key to reset the board: \n");
        while (1)
            if (console_status())
                kerSysMipsSoftReset();
    }

    return 0;

}  // setBoardParam
예제 #2
0
int
NvramDrv::writeNvram(
    CAMERA_DUAL_CAMERA_SENSOR_ENUM a_eSensorType,
    unsigned long a_u4SensorID,
    CAMERA_DATA_TYPE_ENUM a_eNvramDataType,
	void *a_pNvramData,
	unsigned long a_u4NvramDataSize
)
{
    int err = NVRAM_NO_ERROR;

    NVRAM_DRV_LOG("[writeNvram] sensor type = %d; NVRAM data type = %d\n", a_eSensorType, a_eNvramDataType);

	if ((a_eSensorType > DUAL_CAMERA_MAIN_SECOND_SENSOR) ||
		(a_eSensorType < DUAL_CAMERA_MAIN_SENSOR) ||
		(a_eNvramDataType > CAMERA_NVRAM_DATA_LENS && (a_eNvramDataType!=CAMERA_NVRAM_DATA_STROBE)) ||
		(a_eNvramDataType < CAMERA_NVRAM_DATA_ISP) ||
		(a_pNvramData == NULL) ||
		(a_u4NvramDataSize != g_u4NvramDataSize[a_eNvramDataType])) {
        return NVRAM_WRITE_PARAMETER_ERROR;
    }

    Mutex::Autolock lock(mLock);

    err = writeNvramData(a_eSensorType, a_eNvramDataType, a_pNvramData);

    return err;
}
예제 #3
0
void setDefaultBootline(void)
{
    memset(nvramData.szBootline, 0, NVRAM_BOOTLINE_LEN);
    strncpy(nvramData.szBootline, DEFAULT_BOOTLINE_6345, strlen(DEFAULT_BOOTLINE_6345));
    printf("Use default boot line parameters: %s\n", DEFAULT_BOOTLINE_6345);
    writeNvramData();
    readNvramData();
    convertBootInfo();
}