Exemple #1
0
CmsRet devCtl_setOpticalParams(unsigned char * pOpticalData)
{
    
    unsigned char NvramData[NVRAM_LENGTH] = {0};    
    NVRAM_DATA *pNvramData;
    CmsRet Ret;


    if (CMSRET_SUCCESS == (Ret = devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, NVRAM, NvramData, NVRAM_LENGTH, 0, "")))
    {
        //set local copy of NVRAM
        pNvramData = (NVRAM_DATA *)NvramData;

        //update local copy of NVRAM
        memcpy (pNvramData->OpticalParams, pOpticalData, NVRAM_OPTICAL_PARAMS_SIZE);

        //recalc CRC for NVRAM
        pNvramData->ulCheckSum=0;
        pNvramData->ulCheckSum = cmsCrc_getCrc32(NvramData, NVRAM_LENGTH, CRC_INITIAL_VALUE);

        //update NVRAM in FLASH
        if (CMSRET_SUCCESS != (Ret = devCtl_boardIoctl(BOARD_IOCTL_FLASH_WRITE, NVRAM, NvramData, NVRAM_LENGTH, 0, "")))
        {
            cmsLog_error("Unable to write optical params to NVRAM\n");
        }
    }
    else
    {
        cmsLog_error("Unable to read optical params in NVRAM\n");
    }

    return Ret;

}
Exemple #2
0
CmsRet cmsPsp_set(const char *key, const void *buf, UINT32 bufLen)
{
    char *currBuf;
    SINT32 count;

    if ((currBuf = cmsMem_alloc(bufLen, 0)) == NULL)
    {
        return CMSRET_RESOURCE_EXCEEDED;
    }

    /*
     * Writing to the scratch pad is a non-preemptive time consuming
     * operation that should be avoided.
     * Check if the new data is the same as the old data.
     */
    count = devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD,
                              (char *) key, 0, (SINT32) bufLen, currBuf);
    if (count == (SINT32) bufLen)
    {
        if (memcmp(currBuf, buf, bufLen) == 0)
        {
            cmsMem_free(currBuf);
            /* set is exactly the same as the orig data, no set needed */
            return CMSRET_SUCCESS;
        }

        cmsMem_free(currBuf);
    }


    return (devCtl_boardIoctl(BOARD_IOCTL_FLASH_WRITE, SCRATCH_PAD,
                              (char *) key, 0, (SINT32) bufLen, (void *) buf));
}
Exemple #3
0
CmsRet AEI_writeDualPartition(char *imagePtr, UINT32 imageLen, void *msgHandle, int partition)
{
   CmsImageFormat format;
   CmsRet ret;
   
   if ((format = cmsImg_validateImage(imagePtr, imageLen, msgHandle)) == CMS_IMAGE_FORMAT_INVALID)
   {
      ret = CMSRET_INVALID_IMAGE;
   }
#if defined(AEI_VDSL_CUSTOMER_CENTURYLINK)
   else if(format == CMS_IMAGE_FORMAT_CORRUPTED)
   {
      ret = CMSRET_INVALID_IMAGE;
   }
#endif
   else if(format == CMS_IMAGE_FORMAT_FLASH)
   {
        ret = devCtl_boardIoctl(BOARD_IOCTL_PARTITION_WRITE,
									   partition,
									   imagePtr,
									   imageLen-TOKEN_LEN,
									   0, 0);
   }
   return ret;
}
Exemple #4
0
CmsRet cmsPsp_getRawdata(char *buf, int type)
{
    CmsRet ret = CMSRET_SUCCESS;
    int r = 0;
    ret = devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD_RAWDATA, buf, 0, type, &r);
    return ret;
}
Exemple #5
0
int AEI_devCtl_getBoardID(char *boardid)
{
    char board_id[NVRAM_BOARD_ID_STRING_LEN]={0};
    FILE *fp = NULL;
    if(boardid==NULL)
        return -1;

    if((fp=fopen("/var/boardid", "r")) != NULL)
    {   
        fgets(board_id,sizeof(board_id),fp);
        fclose(fp);
    }
    else
    {
        devCtl_boardIoctl(BOARD_IOCTL_GET_ID, 0, board_id, sizeof(board_id), 0, NULL);
        if((fp=fopen("/var/boardid", "w")) != NULL)
        {    
            fprintf(fp,"%s",board_id);
            fclose(fp);
        }
    }
    strncpy(boardid,board_id,sizeof(board_id));

    return 0;

}
Exemple #6
0
CmsRet cmsPsp_clearAll(void)
{

    return (devCtl_boardIoctl(BOARD_IOCTL_FLASH_WRITE, SCRATCH_PAD,
                              "", -1, -1, ""));

}
Exemple #7
0
CmsRet devCtl_getDefaultOpticalParams(unsigned char * pOpticalData)
{    
    int Ret;
    
    Ret = devCtl_boardIoctl(BOARD_IOCTL_GET_DEFAULT_OPTICAL_PARAMS, 0, pOpticalData, NVRAM_OPTICAL_PARAMS_SIZE, 0, "");

    return (Ret);
}
Exemple #8
0
CmsRet devCtl_getGponOpticsType(void)
{    
    UINT32 OpticsType = 0;
    int Ret;
    
    Ret = devCtl_boardIoctl(BOARD_IOCTL_GET_GPON_OPTICS_TYPE, 0, "", 0, 0, &OpticsType);

    return (Ret == CMSRET_SUCCESS ? OpticsType : -1);
}
Exemple #9
0
CmsRet devCtl_getMacAddress(UINT8 *macAddrNum)
{
   return(devCtl_boardIoctl(BOARD_IOCTL_GET_MAC_ADDRESS,
                            0,
                            (char *) macAddrNum,
                            MAC_ADDR_LEN,
                            0,
                            ""));
}
Exemple #10
0
CmsRet devCtl_releaseMacAddress(UINT8 *macAddrNum)
{
   return(devCtl_boardIoctl(BOARD_IOCTL_RELEASE_MAC_ADDRESS,
                            0,
                            (char *) macAddrNum,
                            MAC_ADDR_LEN,
                            0,
                            ""));
}
Exemple #11
0
UINT32 AEI_devCtl_getPowerLedStatus(void)        // 1:green;2:amber and green alternative; 3:amber blink;   
{
   UINT32 num;
   CmsRet ret;

   ret = devCtl_boardIoctl(BOARD_IOCTL_GET_POWERLED_STATUS,
                           0, NULL,
                           0, 0, &num);
   return (ret == CMSRET_SUCCESS ? num : 0);
}
Exemple #12
0
UINT32 devCtl_getNumEnetPorts(void)
{
   UINT32 num;
   CmsRet ret;
   
   ret = devCtl_boardIoctl(BOARD_IOCTL_GET_NUM_ENET_PORTS,
                           0, NULL,
                           0, 0, &num);
   return (ret == CMSRET_SUCCESS ? num : 0);
}
Exemple #13
0
UINT32 devCtl_getSdramSize(void)
{
   UINT32 size;
   CmsRet ret;
#ifdef DESKTOP_LINUX
   size = 32*1024*1024;
   ret = CMSRET_SUCCESS;
#else   
   ret = devCtl_boardIoctl(BOARD_IOCTL_GET_SDRAM_SIZE,
                           0, NULL,
                           0, 0, &size);
#endif
   return (ret == CMSRET_SUCCESS ? size : 0);
}
Exemple #14
0
CmsRet devCtl_getOpticalParams(unsigned char * pOpticalData)
{
    char NvramData[NVRAM_LENGTH]={0};
    CmsRet Ret;
    NVRAM_DATA *pNvramData;
    

    if (CMSRET_SUCCESS == (Ret = devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, NVRAM, NvramData, NVRAM_LENGTH, 0, "")))
    {       
        pNvramData = (NVRAM_DATA *) NvramData;

        memcpy (pOpticalData, pNvramData->OpticalParams, NVRAM_OPTICAL_PARAMS_SIZE);
    }
    else
    {
        cmsLog_error("Unable to read optical params in NVRAM\n");
    }
    
    return Ret;
}
Exemple #15
0
CmsRet cmsPsp_callTrace(void)
{
    return devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD_CALLTRACE, NULL, 0, 0, NULL);
}
Exemple #16
0
CmsRet cmsPsp_add_delKeyword(char *key, int add)
{
    return devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD_ADDDEL_KEYWORD, key, 0, add, NULL);
}
Exemple #17
0
int devCtl_getBootedImageId(void)
{
    return( (int) devCtl_boardIoctl(BOARD_IOCTL_BOOT_IMAGE_OPERATION, 0, "", 0, BOOT_GET_BOOTED_IMAGE_ID, "") );
}
Exemple #18
0
int devCtl_getImageVersion(int partition, char *verStr, int verStrSize)
{
    return( (int) devCtl_boardIoctl(BOARD_IOCTL_BOOT_IMAGE_OPERATION, partition, verStr, verStrSize, BOOT_GET_IMAGE_VERSION, "") );
}
Exemple #19
0
UINT32 cmsPsp_getScratchPadAvailableSize(void)
{
    int r = 0;
    devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD_AVAILABLE_SIZE, NULL, 0, 0, &r);
    return r;
}
Exemple #20
0
UINT32 cmsPsp_getBootCount(int bySerial)
{
    int r = 0;
    devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD_BOOTCOUNT, NULL, bySerial, 0, &r);
    return r;
}
Exemple #21
0
CmsRet devCtl_getChipId(UINT32 *chipId)
{
    return( devCtl_boardIoctl(BOARD_IOCTL_GET_CHIP_ID, 0, "", 0, 0, chipId) );
}
Exemple #22
0
CmsRet cmsPsp_getKeywordList(char *buf)
{
    int r = 0;
    devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD_GET_KEYWORD_LIST, buf, 0, 0, &r);
    return r;
}
Exemple #23
0
int AEI_save_syslog()
{
    return devCtl_boardIoctl(BOARD_IOCTL_FLASH_WRITE,SYSLOGONREBOOT,NULL,0,0,0);
}
Exemple #24
0
SINT32 cmsPsp_get(const char *key, void *buf, UINT32 bufLen)
{

    return ((SINT32) devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD,
                                       (char *) key, 0, (SINT32) bufLen, buf));
}
Exemple #25
0
CmsRet cmsPsp_clearAllPad(int deleteLowerAlso)
{
    return devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD_CLEARALLPAD, NULL, 0, deleteLowerAlso, NULL);
}
Exemple #26
0
CmsRet devCtl_setImageState(int state)
{
    return( devCtl_boardIoctl(BOARD_IOCTL_BOOT_IMAGE_OPERATION, 0, "", 0, state, "") );
}
Exemple #27
0
UINT32 cmsPsp_getBootDataAndSize(char *buf, int bootn, int bySerial)
{
    int r = 0;
    devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD_BOOTDATAANDSIZE, buf, bySerial, bootn, &r);
    return r;
}
Exemple #28
0
int devCtl_getImageState(void)
{
    return( (int) devCtl_boardIoctl(BOARD_IOCTL_BOOT_IMAGE_OPERATION, 0, "", 0, BOOT_GET_BOOT_IMAGE_STATE, "") );
}
Exemple #29
0
UINT32 cmsPsp_getScratchPadStartSector(void)
{
    int r = 0;
    devCtl_boardIoctl(BOARD_IOCTL_FLASH_READ, SCRATCH_PAD_STARTSECTOR, NULL, 0, 0, &r);
    return r;
}
Exemple #30
0
SINT32 cmsPsp_list(char *buf, UINT32 bufLen)
{

    return ((SINT32) devCtl_boardIoctl(BOARD_IOCTL_FLASH_LIST, SCRATCH_PAD,
                                       NULL, 0, (SINT32) bufLen, buf));
}