Ejemplo n.º 1
0
bool
T64File::repair()
{
    unsigned i, n;
    uint16_t noOfItems = numberOfItems();

    //
    // 1. Repair number of items, if this value is zero
    //
    
    if (noOfItems == 0) {

        while (directoryItemIsPresent(noOfItems))
            noOfItems++;

        uint16_t noOfItemsStatedInHeader = numberOfItems();
        if (noOfItems != noOfItemsStatedInHeader) {
        
            debug(1, "Repairing corrupted T64 archive: Changing number of items from %d to %d.\n",
                  noOfItemsStatedInHeader, noOfItems);
        
            data[0x24] = LO_BYTE(noOfItems);
            data[0x25] = HI_BYTE(noOfItems);
            
        }
        assert(noOfItems == numberOfItems());
    }
    
    for (i = 0; i < noOfItems; i++) {

        //
        // 2. Check relative offset information for each item
        //

        // Compute start address in file
        n = 0x48 + (i * 0x20);
        uint16_t startAddrInContainer = LO_LO_HI_HI(data[n], data[n+1], data[n+2], data[n+3]);

        if (startAddrInContainer >= size) {
            warn("T64 archive is corrupt (offset mismatch). Sorry, can't repair.\n");
            return false;
        }
    
        //
        // 3. Check for file end address mismatches (as created by CONVC64)
        //
        
        // Compute start address in memory
        n = 0x42 + (i * 0x20);
        uint16_t startAddrInMemory = LO_HI(data[n], data[n+1]);
    
        // Compute end address in memory
        n = 0x44 + (i * 0x20);
        uint16_t endAddrInMemory = LO_HI(data[n], data[n+1]);
    
        if (endAddrInMemory == 0xC3C6) {

            // Let's assume that the rest of the file data belongs to this file ...
            uint16_t fixedEndAddrInMemory = startAddrInMemory + (size - startAddrInContainer);

            debug(1, "Repairing corrupted T64 archive: Changing end address of item %d from %04X to %04X.\n",
                  i, endAddrInMemory, fixedEndAddrInMemory);

            data[n] = LO_BYTE(fixedEndAddrInMemory);
            data[n+1] = HI_BYTE(fixedEndAddrInMemory);
        }
    }
    
    return 1; // Archive repaired successfully
}
Ejemplo n.º 2
0
T64File *
T64File::makeT64ArchiveWithAnyArchive(AnyArchive *otherArchive)
{
    if (otherArchive == NULL)
        return NULL;
    
    T64File *archive  = new T64File();
    
    // Determine file size and allocate memory
    unsigned currentFiles = otherArchive->numberOfItems();
    unsigned maxFiles = (currentFiles < 30) ? 30 : currentFiles;
    archive->size = 64 /* header */ + maxFiles * 32 /* tape entries */;
    
    for (unsigned i = 0; i < currentFiles; i++) {
        archive->selectItem(i);
        archive->size += otherArchive->getSizeOfItem();
    }

    if ((archive->data = new uint8_t[archive->size]) == NULL) {
        archive->warn("Failed to allocate %d bytes of memory\n", archive->size);
        delete archive;
        return NULL;
    }
    
    // Magic bytes (32 bytes)
    uint8_t *ptr = archive->data;
    strncpy((char *)ptr, "C64 tape image file", 32);
    ptr += 32;
    
    // Version (2 bytes)
    *ptr++ = 0x00;
    *ptr++ = 0x01;
    
    // Max files (2 bytes)
    *ptr++ = LO_BYTE(maxFiles);
    *ptr++ = HI_BYTE(maxFiles);
    
    // Current files (2 bytes)
    *ptr++ = LO_BYTE(currentFiles);
    *ptr++ = HI_BYTE(currentFiles);
    
    // Reserved (2 bytes)
    *ptr++ = 0x00;
    *ptr++ = 0x00;
    
    // User description (24 bytes)
    strncpy((char *)ptr, (char *)otherArchive->getName(), 24);
    for (unsigned i = 0; i < 24; i++, ptr++)
        *ptr = ascii2pet(*ptr);
    
    // Tape entries
    uint32_t tapePosition = 64 + maxFiles * 32; // data of item 0 starts here
    memset(ptr, 0, 32 * maxFiles);
    for (unsigned n = 0; n < maxFiles; n++) {
        
        if (n >= currentFiles) {
            // Empty tape slot
            ptr += 32;
            continue;
        }
        
        otherArchive->selectItem(n);
        
        // Entry used (1 byte)
        *ptr++ = 0x01;
        
        // File type (1 byte)
        *ptr++ = 0x82;
        
        // Start address (2 bytes)
        uint16_t startAddr = otherArchive->getDestinationAddrOfItem();
        *ptr++ = LO_BYTE(startAddr);
        *ptr++ = HI_BYTE(startAddr);
        
        // Start address (2 bytes)
        uint16_t endAddr = startAddr + otherArchive->getSizeOfItem();
        *ptr++ = LO_BYTE(endAddr);
        *ptr++ = HI_BYTE(endAddr);
        
        // Reserved (2 bytes)
        ptr += 2;
        
        // Tape position (4 bytes)
        *ptr++ = LO_BYTE(tapePosition);
        *ptr++ = LO_BYTE(tapePosition >> 8);
        *ptr++ = LO_BYTE(tapePosition >> 16);
        *ptr++ = LO_BYTE(tapePosition >> 24);
        tapePosition += otherArchive->getSizeOfItem();
        
        // Reserved (4 bytes)
        ptr += 4;
        
        // File name (16 bytes)
        strncpy((char *)ptr, (char *)otherArchive->getNameOfItem(), 16);
        for (unsigned i = 0; i < 16; i++, ptr++)
            *ptr = ascii2pet(*ptr);
    }
    
    // File data
    for (unsigned n = 0; n < currentFiles; n++) {
        
        int byte;
        otherArchive->selectItem(n);
        while ((byte = otherArchive->readItem()) != EOF) {
            *ptr++ = (uint8_t)byte;
        }
        
    }
    
    otherArchive->dumpDirectory();
    archive->dumpDirectory();
    archive->debug(1, "T64 archive created with other archive of type %s.\n",
                   otherArchive->typeAsString());
    
    return archive;
}
Ejemplo n.º 3
0
void UI_UpdateCfgFile(void)
{
#if 0
    UINT32      uiKeyAct, uiKeyCode;
    FLGPTN     uiFlag;
#endif
    char*       str;
    FST_FILE    pFile;
    UINT32      uiFileSize;
    UINT8       *BgBuf;
    char        *fileName;
    URECT       Rect = {0, 0, 320, 240};
    BOOL        Ret  =TRUE ;
    ER          erReturn;

    PSTORE_SECTION_HANDLE* pSecHdl; // to save the handle of PStore section

    fileName = "A:\\NTCONFIG.bin";

    FileSys_WaitFinish();
    pFile = FileSys_OpenFile(fileName, FST_OPEN_READ);

    if (pFile == NULL)
    {
        debug_err(("open file error\r\n"));
        Ret  =FALSE;
    }

    uiFileSize = FileSys_GetFileLen(fileName);  // for small page nand
    USE_MSG(("file size = %d\r\n",uiFileSize));

    //if file is null
    if (uiFileSize == 0)
    {
        USE_MSG(("file size is 0\r\n"));
        Ret  =FALSE;
    }

    if (uiFileSize > CFG_MAX_FILESIZE)
    {
        USE_MSG(("file size is bigger = %d\r\n",uiFileSize));
        Ret  =FALSE;
    }

    //get_blk((void *)&BgBuf,  POOL_ID_SICD);
    //rel_blk(POOL_ID_SICD, BgBuf);
    //SysGetSICDAddr((UINT32*)&BgBuf);
    BgBuf = (UINT8 *)OS_GetMempoolAddr(POOL_ID_APP);
    if (FileSys_ReadFile(pFile,BgBuf,&uiFileSize,FST_FLAG_NONE,NULL)!=FST_STA_OK)
    {
        USE_MSG(("file read failed\r\n"));
        Ret  =FALSE;
    }

    FileSys_CloseFile(pFile);

    *BgBuf = LO_BYTE(LO_WORD(uiFileSize));
    *(BgBuf+1) = HI_BYTE(LO_WORD(uiFileSize));
    *(BgBuf+2) = LO_BYTE(HI_WORD(uiFileSize));
    *(BgBuf+3) = HI_BYTE(HI_WORD(uiFileSize));

    //PStore_EnablePS();
    pSecHdl = PStore_OpenSection(PS_BG_CFG, PS_RDWR | PS_CREATE);

    if (pSecHdl == E_PS_SECHDLER)
    {
        debug_err(("Section open fail\r\n"));
        PStore_CloseSection(pSecHdl);
        //PStore_DisablePS();
        Ret  =FALSE;
    }

    erReturn = PStore_WriteSection(BgBuf, 0, SYSPARAM_SYSFLAG_LEN, pSecHdl);

    PStore_CloseSection(pSecHdl);

    if (erReturn != E_PS_OK)
    {
        debug_err(("PStore program error\r\n"));
        Ret  =FALSE;
    }


    Cal_FillRect(&Rect, _OSD_INDEX_BLACK);

    Rect.x   = 56;
    Rect.y   = 108;
    Rect.w   = 212;
    Rect.h   = 24;

    if (Ret  == FALSE)
    {
        str =  "Update Cfg file error";
        Cal_ShowStringByColor(str, &Rect, _OSD_INDEX_YELLOW, _OSD_INDEX_BLACK);
    }else
    {
        str = "Update Cfg file ok";
        Cal_ShowStringByColor(str, &Rect, _OSD_INDEX_YELLOW, _OSD_INDEX_BLACK);
    }

    Delay_DelayMs(1000);

    if (Ret)
    {
       System_PowerOff(SYS_POWEROFF_NORMAL);
    }

#if 0

    clr_flg(FLG_ID_CALIBRATION, 0xffffffff);
    while (1)
    {
        wai_flg(&uiFlag, FLG_ID_CALIBRATION, 0xffffffff, TWF_ORW | TWF_CLR);

        debug_msg("^GuiFlag:%x\r\n",uiFlag);
        if (uiFlag)
            break;
    }
#else
    Delay_DelayMs(1500);
#endif
}
Ejemplo n.º 4
0
static BOOL UI_WriteLogoFileName(UINT32 logoId)
{
    FST_FILE    pFile;
    UINT32      uiFileSize;
    UINT8       *BgBuf;
    char        *fileName;
    URECT       Rect = {0, 0, 320, 240};
    ER          erReturn = E_OK;
    PSTORE_SECTION_HANDLE* pSecHdl; // to save the handle of PStore section
    char *psecnameId;

    if (logoId == UI_LOGO_POWERON)
    {
        fileName = "A:\\logo.jpg";
        psecnameId = PS_POWERON_LOGO;
    }
    else //if (logoId == UI_LOGO_POWEROFF)
    {
        fileName = "A:\\logo2.jpg";
        psecnameId = PS_POWEROFF_LOGO;
    }

    FileSys_WaitFinish();
    pFile = FileSys_OpenFile(fileName, FST_OPEN_READ);

    if (pFile == NULL)
    {
        debug_err(("open file error\r\n"));
        return FALSE;
    }

    uiFileSize = FileSys_GetFileLen(fileName);  // for small page nand

    USE_MSG(("file size = %d\r\n",uiFileSize));

    if ((uiFileSize < 1024) || (uiFileSize > LOGO_MAX_FILESIZE))
    {
        Cal_FillRect(&Rect, _OSD_INDEX_BLACK);
        Cal_ShowStringByColor("jpg size is too big or too small\n", &Rect, _OSD_INDEX_YELLOW, _OSD_INDEX_BLACK);
        Delay_DelayMs(2000);
        Cal_FillRect(&Rect, _OSD_INDEX_BLACK);
        debug_err(("Write logo error\n\r"));
        return FALSE;
    }

    BgBuf = (UINT8 *)OS_GetMempoolAddr(POOL_ID_APP);
    if (FileSys_ReadFile(pFile,(UINT8 *)(BgBuf+4),&uiFileSize,FST_FLAG_NONE,NULL)!=FST_STA_OK)
    {
        USE_MSG(("file read failed\r\n"));
        return FALSE;
    }

    FileSys_CloseFile(pFile);

    *BgBuf = LO_BYTE(LO_WORD(uiFileSize));
    *(BgBuf+1) = HI_BYTE(LO_WORD(uiFileSize));
    *(BgBuf+2) = LO_BYTE(HI_WORD(uiFileSize));
    *(BgBuf+3) = HI_BYTE(HI_WORD(uiFileSize));

    pSecHdl = PStore_OpenSection(psecnameId, PS_RDWR | PS_CREATE);

    if (pSecHdl == E_PS_SECHDLER)
    {
        debug_err(("Section open fail\r\n"));
        goto err_ret;
    }

    erReturn = PStore_WriteSection(BgBuf, 0, SYSPARAM_LOGO_LEN, pSecHdl);

    if (erReturn != E_PS_OK)
    {
        debug_err(("PStore program error\r\n"));
        goto err_ret;
    }
    //#PIC#2010/07/23#Creator -begin
    PStore_CloseSection(pSecHdl);
    //#PIC#2010/07/23#Creator -end
    return TRUE;

err_ret:
    PStore_CloseSection(pSecHdl);
    //PStore_DisablePS();
    return FALSE;
}
static ssize_t get_idac_debugfs_read(struct file *filp, char __user *buf,
		size_t count, loff_t *ppos)
{
	struct cyttsp5_device_access_debugfs_data *data = filp->private_data;
	struct cyttsp5_device_access_data *dad = data->dad;
	struct device *dev = dad->dev;
	int status = STATUS_FAIL;
	u8 cmd_status = 0;
	u8 data_format = 0;
	u16 act_length = 0;
	int length = 0;
	int rc;

	if (*ppos)
		goto exit;

	mutex_lock(&dad->sysfs_lock);

	pm_runtime_get_sync(dev);

	rc = cmd->request_exclusive(dev, CY_REQUEST_EXCLUSIVE_TIMEOUT);
	if (rc < 0) {
		dev_err(dev, "%s: Error on request exclusive r=%d\n",
				__func__, rc);
		goto put_pm_runtime;
	}

	rc = cyttsp5_suspend_scan_cmd_(dev);
	if (rc < 0) {
		dev_err(dev, "%s: Error on suspend scan r=%d\n",
				__func__, rc);
		goto release_exclusive;
	}

	rc = cyttsp5_get_data_structure_cmd_(dev, 0, PIP_CMD_MAX_LENGTH,
			dad->get_idac_data_id, &cmd_status, &data_format,
			&act_length, &dad->ic_buf[5]);
	if (rc < 0) {
		dev_err(dev, "%s: Error on get data structure r=%d\n",
				__func__, rc);
		goto resume_scan;
	}

	dad->ic_buf[0] = cmd_status;
	dad->ic_buf[1] = dad->get_idac_data_id;
	dad->ic_buf[2] = LOW_BYTE(act_length);
	dad->ic_buf[3] = HI_BYTE(act_length);
	dad->ic_buf[4] = data_format;

	length = 5 + act_length;

	status = STATUS_SUCCESS;

resume_scan:
	cyttsp5_resume_scan_cmd_(dev);

release_exclusive:
	cmd->release_exclusive(dev);

put_pm_runtime:
	pm_runtime_put(dev);

	if (status == STATUS_FAIL)
		length = 0;

	data->pr_buf_len = prepare_print_buffer(status, dad->ic_buf, length,
			data->pr_buf, sizeof(data->pr_buf));

	mutex_unlock(&dad->sysfs_lock);

exit:
	return simple_read_from_buffer(buf, count, ppos, data->pr_buf,
			data->pr_buf_len);
}
static ssize_t cyttsp5_run_and_get_selftest_result(struct device *dev,
		char *buf, size_t buf_len, u8 test_id, u16 read_length,
		bool get_result_on_pass)
{
	struct cyttsp5_device_access_data *dad
		= cyttsp5_get_device_access_data(dev);
	int status = STATUS_FAIL;
	u8 cmd_status = 0;
	u8 summary_result = 0;
	u16 act_length = 0;
	int length = 0;
	int size;
	int rc;

	mutex_lock(&dad->sysfs_lock);

	pm_runtime_get_sync(dev);

	rc = cmd->request_exclusive(dev, CY_REQUEST_EXCLUSIVE_TIMEOUT);
	if (rc < 0) {
		dev_err(dev, "%s: Error on request exclusive r=%d\n",
				__func__, rc);
		goto put_pm_runtime;
	}

	rc = cyttsp5_suspend_scan_cmd_(dev);
	if (rc < 0) {
		dev_err(dev, "%s: Error on suspend scan r=%d\n",
				__func__, rc);
		goto release_exclusive;
	}

	rc = cyttsp5_run_selftest_cmd_(dev, test_id, 0,
			&cmd_status, &summary_result, NULL);
	if (rc < 0) {
		dev_err(dev, "%s: Error on run self test for test_id:%d r=%d\n",
				__func__, test_id, rc);
		goto resume_scan;
	}

	/* Form response buffer */
	dad->ic_buf[0] = cmd_status;
	dad->ic_buf[1] = summary_result;

	length = 2;

	/* Get data if command status is success */
	if (cmd_status != CY_CMD_STATUS_SUCCESS)
		goto status_success;

	/* Get data unless test result is pass */
	if (summary_result == CY_ST_RESULT_PASS && !get_result_on_pass)
		goto status_success;

	rc = cyttsp5_get_selftest_result_cmd_(dev, 0, read_length,
			test_id, &cmd_status, &act_length, &dad->ic_buf[6]);
	if (rc < 0) {
		dev_err(dev, "%s: Error on get self test result r=%d\n",
				__func__, rc);
		goto resume_scan;
	}

	dad->ic_buf[2] = cmd_status;
	dad->ic_buf[3] = test_id;
	dad->ic_buf[4] = LOW_BYTE(act_length);
	dad->ic_buf[5] = HI_BYTE(act_length);

	length = 6 + act_length;

status_success:
	status = STATUS_SUCCESS;

resume_scan:
	cyttsp5_resume_scan_cmd_(dev);

release_exclusive:
	cmd->release_exclusive(dev);

put_pm_runtime:
	pm_runtime_put(dev);

	if (status == STATUS_FAIL)
		length = 0;

	size = prepare_print_buffer(status, dad->ic_buf, length, buf, buf_len);

	mutex_unlock(&dad->sysfs_lock);

	return size;
}
Ejemplo n.º 7
0
static ssize_t cyttsp5_opens_show(struct device *dev,
		struct cyttsp5_attribute *attr, char *buf)
{
	struct cyttsp5_device_access_data *dad
		= cyttsp5_get_device_access_data(dev);
	int status = STATUS_FAIL;
	u8 cmd_status = 0;
	u8 summary_result = 0;
	u16 act_length = 0;
	int length = 0;
	int size;
	int rc;

	mutex_lock(&dad->sysfs_lock);

	pm_runtime_get_sync(dev);

	rc = cmd->request_exclusive(dev, CY_REQUEST_EXCLUSIVE_TIMEOUT);
	if (rc < 0) {
		dev_err(dev, "%s: Error on request exclusive r=%d\n",
				__func__, rc);
		goto put_pm_runtime;
	}

	rc = cyttsp5_suspend_scan_cmd_(dev);
	if (rc < 0) {
		dev_err(dev, "%s: Error on suspend scan r=%d\n",
				__func__, rc);
		goto release_exclusive;
	}

	rc = cyttsp5_run_selftest_cmd_(dev, CY_ST_ID_OPENS, 0,
			&cmd_status, &summary_result, NULL);
	if (rc < 0) {
		dev_err(dev, "%s: Error on run self test r=%d\n",
				__func__, rc);
		goto resume_scan;
	}

	/* Form response buffer */
	dad->ic_buf[0] = cmd_status;
	dad->ic_buf[1] = summary_result;

	length = 2;

	/* Get data unless test result is success */
	if (cmd_status == CY_CMD_STATUS_SUCCESS
			&& summary_result == CY_ST_RESULT_PASS)
		goto status_success;

	/* Set length to PIP_CMD_MAX_LENGTH to read all */
	rc = cyttsp5_get_selftest_result_cmd_(dev, 0, PIP_CMD_MAX_LENGTH,
			CY_ST_ID_OPENS, &cmd_status,
			&act_length, &dad->ic_buf[6]);
	if (rc < 0) {
		dev_err(dev, "%s: Error on get self test result r=%d\n",
				__func__, rc);
		goto resume_scan;
	}

	dad->ic_buf[2] = cmd_status;
	dad->ic_buf[3] = CY_ST_ID_OPENS;
	dad->ic_buf[4] = LOW_BYTE(act_length);
	dad->ic_buf[5] = HI_BYTE(act_length);

	length = 6 + act_length;

status_success:
	status = STATUS_SUCCESS;

resume_scan:
	cyttsp5_resume_scan_cmd_(dev);

release_exclusive:
	cmd->release_exclusive(dev);

put_pm_runtime:
	pm_runtime_put(dev);

	if (status == STATUS_FAIL)
		length = 0;

	size = prepare_print_buffer(status, dad->ic_buf, length, buf);

	mutex_unlock(&dad->sysfs_lock);

	return size;
}
Ejemplo n.º 8
0
static ssize_t cyttsp5_get_idac_show(struct device *dev,
		struct cyttsp5_attribute *attr, char *buf)
{
	struct cyttsp5_device_access_data *dad
		= cyttsp5_get_device_access_data(dev);
	int status = STATUS_FAIL;
	u8 cmd_status = 0;
	u8 data_format = 0;
	u16 act_length = 0;
	int length = 0;
	int size;
	int rc;

	mutex_lock(&dad->sysfs_lock);

	pm_runtime_get_sync(dev);

	rc = cmd->request_exclusive(dev, CY_REQUEST_EXCLUSIVE_TIMEOUT);
	if (rc < 0) {
		dev_err(dev, "%s: Error on request exclusive r=%d\n",
				__func__, rc);
		goto put_pm_runtime;
	}

	rc = cyttsp5_suspend_scan_cmd_(dev);
	if (rc < 0) {
		dev_err(dev, "%s: Error on suspend scan r=%d\n",
				__func__, rc);
		goto release_exclusive;
	}

	rc = cyttsp5_get_data_structure_cmd_(dev, 0, PIP_CMD_MAX_LENGTH,
			dad->get_idac_data_id, &cmd_status, &data_format,
			&act_length, &dad->ic_buf[5]);
	if (rc < 0) {
		dev_err(dev, "%s: Error on get data structure r=%d\n",
				__func__, rc);
		goto resume_scan;
	}

	dad->ic_buf[0] = cmd_status;
	dad->ic_buf[1] = dad->get_idac_data_id;
	dad->ic_buf[2] = LOW_BYTE(act_length);
	dad->ic_buf[3] = HI_BYTE(act_length);
	dad->ic_buf[4] = data_format;

	length = 5 + act_length;

	status = STATUS_SUCCESS;

resume_scan:
	cyttsp5_resume_scan_cmd_(dev);

release_exclusive:
	cmd->release_exclusive(dev);

put_pm_runtime:
	pm_runtime_put(dev);

	if (status == STATUS_FAIL)
		length = 0;

	size = prepare_print_buffer(status, dad->ic_buf, length, buf);

	mutex_unlock(&dad->sysfs_lock);

	return size;
}
Ejemplo n.º 9
0
UINT32 UserPS_WriteUniFontFile(CHAR *pFilename)
{
    PPSTORE_SECTION_HANDLE  pSection;
    HNVT_FILE               *pFile;
    UINT32                  uiFileSize, uiWriteSize;
    UINT8                   *pMemPool;

    FilesysWaitInitFinish(FST_TIME_INFINITE);
    FilesysWaitCmdFinish(FST_TIME_INFINITE);

    pFile = Filesys_fopen((char *)pFilename, "R");
    if(pFile == NULL)
    {
        debug_err(("UserPS: Error opening %s\r\n", pFilename));
        return E_USERPS_FILE;
    }

    uiFileSize = pFile->fileSize;
    uiWriteSize = uiFileSize;
    debug_err(("UserPS: File size = %ld\r\n", uiFileSize));
    FilesysCloseActFile();

    if(uiFileSize > POOL_SIZE_UNIFONT)
    {
        debug_err(("UserPS: File size too large!\r\n"));
        return E_USERPS_FILE;
    }

    get_blk((void *)&pMemPool, POOL_ID_CAPTURE);
    rel_blk(POOL_ID_CAPTURE, pMemPool);

    pMemPool = (pMemPool + POOL_SIZE_CAPTURE - POOL_SIZE_UNIFONT);
    FilesysReadWriteByName2(FST_CMD_READ_BY_NAME, pFilename, (UINT8 *)(pMemPool+4),
                            &uiWriteSize, 0, FST_TIME_INFINITE);
    FilesysWaitCmdFinish(FST_TIME_INFINITE);
    debug_err(("UserPS: Gotta write file size = %ld\r\n", uiWriteSize));

    *pMemPool = LO_BYTE(LO_WORD(uiWriteSize));
    *(pMemPool+1) = HI_BYTE(LO_WORD(uiWriteSize));
    *(pMemPool+2) = LO_BYTE(HI_WORD(uiWriteSize));
    *(pMemPool+3) = HI_BYTE(HI_WORD(uiWriteSize));

    //PStore_EnablePS();

    if((pSection = PStore_OpenSection(PS_UNIFONT_DATA, PS_RDWR | PS_CREATE)) != E_PS_SECHDLER)
    {
        if(PStore_WriteSection(pMemPool, 0, (uiWriteSize+4), pSection) != E_PS_OK)
        {
            debug_err(("UserPS: PStore write Unicode font data fail\r\n"));
        }
        PStore_CloseSection(pSection);
        //PStore_DisablePS();
    }
    else
    {
        debug_err(("UserPS: PStore open section fail\r\n"));
        //PStore_DisablePS();
        return E_USERPS_PSECTION;
    }

    return E_USERPS_OK;
}