当前位置: 首页>>代码示例>>C++>>正文


C++ DBG_MSG函数代码示例

本文整理汇总了C++中DBG_MSG函数的典型用法代码示例。如果您正苦于以下问题:C++ DBG_MSG函数的具体用法?C++ DBG_MSG怎么用?C++ DBG_MSG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DBG_MSG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CHECK

//------------------------------------------------------------------------------
//!
void
BIH::create(
   const Vector<AABBoxf*>& bboxes,
   const Vector<Vec3f>&    centers,
   Vector<uint>*           ids,
   uint                    leafSize,
   uint                    maxDepth
)
{
   CHECK( bboxes.size() == centers.size() );

   DBG_BLOCK( os_bih, "Start computing BIH..." );
   DBG( Timer timer );

   // Initialization.
   DBG_MSG( os_bih, "# of elements: " << bboxes.size() << " " << centers.size() << "\n" );
   // 1. Init maximum recursion level.
   if( maxDepth == 0 )
   {
      maxDepth = (int)CGM::log2( float(centers.size()) ) * 2 + 1;
   }
   _maxDepth = CGM::min( maxDepth, (uint)100 );

   // 2. Init ids.
   if( ids == 0 )
   {
      _ids.resize( centers.size() );
      for( uint i = 0; i < _ids.size(); ++i )
      {
         _ids[i] = i;
      }
   }
   else
   {
      _ids.swap( *ids );
   }
   
   Vector<uint>  remap( centers.size() );
   for( uint i = 0; i < remap.size(); ++i )
   {
      remap[i] = i;
   }

   // 3. Init nodes and root.
   //_nodes.reserve();
   _nodes.resize(1);

   // 4. Compute bounding box.
   AABBoxf nodeBox  = AABBoxf::empty();
   for( uint i = 0; i < bboxes.size(); ++i )
   {
      nodeBox |= *bboxes[i];
   }
   AABBoxf splitBox = nodeBox;

   // 5. Stack.
   Vector<BuildStackNode> stack( maxDepth );
   uint stackID = 0;

   uint maxPrim = 0;
   uint maxD = 0;

   // Construct BIH.
   uint begin = 0;
   uint end   = uint(_ids.size());
   uint depth = 1;
   uint node  = 0;
   while( 1 )
   {
      // Do we have a root node?
      if( (end - begin <= leafSize) || depth >= maxDepth )
      {
         // Root node.
         _nodes[node]._index = (begin << 3) + 3;
         _nodes[node]._numElements = end-begin;

         maxPrim = CGM::max( maxPrim, end-begin );
         maxD = CGM::max( maxD, depth );

         // Are we done?
         if( stackID == 0 )
         {
            break;
         }
         stack[--stackID].get( node, begin, end, depth, nodeBox, splitBox );
      }
      else
      {
         // Compute split plane and axis.
         uint axis        = splitBox.longestSide();
         float splitPlane = splitBox.center( axis );

         // Partition primitives.
         AABBoxf leftNodeBox  = AABBoxf::empty();
         AABBoxf rightNodeBox = AABBoxf::empty();
         uint pivot = begin;
         for( uint i = begin; i < end; ++i )
         {
//.........这里部分代码省略.........
开发者ID:LudoSapiens,项目名称:Dev,代码行数:101,代码来源:BIH.cpp

示例2: vGet8FootnotesText

/*
 * Build the list with footnote text information for Word 8/9/10 files
 */
static void
vGet8FootnotesText(FILE *pFile, const pps_info_type *pPPS,
	const ULONG *aulBBD, size_t tBBDLen,
	const ULONG *aulSBD, size_t tSBDLen,
	const UCHAR *aucHeader)
{
	footnote_local_type	*pCurr;
	const ULONG	*aulBlockDepot;
	UCHAR	*aucBuffer;
	ULONG	ulCharPos, ulBeginOfFootnotes, ulOffset, ulBeginFootnoteText;
	size_t	tFootnoteTextLen, tBlockDepotLen, tBlockSize;
	size_t	tIndex;

	TRACE_MSG("vGet8FootnotesText");

	ulBeginOfFootnotes = ulGetLong(0x18, aucHeader); /* fcMin */
	ulBeginOfFootnotes += ulGetLong(0x4c, aucHeader); /* ccpText */
	NO_DBG_HEX(ulBeginOfFootnotes);

	ulBeginFootnoteText = ulGetLong(0xb2, aucHeader); /* fcPlcffndTxt */
	NO_DBG_HEX(ulBeginFootnoteText);
	tFootnoteTextLen =
		(size_t)ulGetLong(0xb6, aucHeader); /* lcbPlcffndTxt */
	NO_DBG_DEC(tFootnoteTextLen);

	if (tFootnoteTextLen < 12) {
		DBG_MSG("No Footnote text in this document");
		return;
	}

	NO_DBG_DEC(pPPS->tTable.ulSB);
	NO_DBG_HEX(pPPS->tTable.ulSize);
	if (pPPS->tTable.ulSize == 0) {
		DBG_MSG("No footnote text information");
		return;
	}

	if (pPPS->tTable.ulSize < MIN_SIZE_FOR_BBD_USE) {
	  	/* Use the Small Block Depot */
		aulBlockDepot = aulSBD;
		tBlockDepotLen = tSBDLen;
		tBlockSize = SMALL_BLOCK_SIZE;
	} else {
	  	/* Use the Big Block Depot */
		aulBlockDepot = aulBBD;
		tBlockDepotLen = tBBDLen;
		tBlockSize = BIG_BLOCK_SIZE;
	}
	aucBuffer = xmalloc(tFootnoteTextLen);
	if (!bReadBuffer(pFile, pPPS->tTable.ulSB,
			aulBlockDepot, tBlockDepotLen, tBlockSize,
			aucBuffer, ulBeginFootnoteText, tFootnoteTextLen)) {
		aucBuffer = xfree(aucBuffer);
		return;
	}
	NO_DBG_PRINT_BLOCK(aucBuffer, tFootnoteTextLen);

	fail(tFootnoteTextLength != 0);
	tFootnoteTextLength = tFootnoteTextLen / 4 - 2;
	fail(tFootnoteTextLength == 0);

	fail(pFootnoteText != NULL);
	pFootnoteText = xcalloc(tFootnoteTextLength,
				sizeof(footnote_local_type));

	for (tIndex = 0; tIndex < tFootnoteTextLength; tIndex++) {
		pCurr = pFootnoteText + tIndex;
		pCurr->tInfo.szText = NULL;
		ulOffset = ulGetLong(tIndex * 4, aucBuffer);
		NO_DBG_HEX(ulOffset);
		ulCharPos = ulBeginOfFootnotes + ulOffset;
		NO_DBG_HEX(ulCharPos);
		NO_DBG_HEX(ulCharPos2FileOffset(ulCharPos));
		pCurr->ulCharPosStart = ulCharPos;
		ulOffset = ulGetLong(tIndex * 4 + 4, aucBuffer);
		NO_DBG_HEX(ulOffset);
		ulCharPos = ulBeginOfFootnotes + ulOffset;
		NO_DBG_HEX(ulCharPos);
		NO_DBG_HEX(ulCharPos2FileOffset(ulCharPos));
		pCurr->ulCharPosNext = ulCharPos;
		pCurr->bUseful = pCurr->ulCharPosStart != pCurr->ulCharPosNext;
	}
	aucBuffer = xfree(aucBuffer);
} /* end of vGet8FootnotesText */
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:87,代码来源:notes.c

示例3: vGet8EndnotesInfo

/*
 * Build the list with endnote information for Word 8/9/10 files
 */
static void
vGet8EndnotesInfo(FILE *pFile, const pps_info_type *pPPS,
	const ULONG *aulBBD, size_t tBBDLen,
	const ULONG *aulSBD, size_t tSBDLen,
	const UCHAR *aucHeader)
{
	const ULONG	*aulBlockDepot;
	UCHAR	*aucBuffer;
	ULONG	ulFileOffset, ulBeginOfText, ulOffset, ulBeginEndnoteInfo;
	size_t	tEndnoteInfoLen, tBlockDepotLen, tBlockSize;
	size_t	tIndex;

	TRACE_MSG("vGet8EndnotesInfo");

	ulBeginOfText = ulGetLong(0x18, aucHeader); /* fcMin */
	NO_DBG_HEX(ulBeginOfText);
	ulBeginEndnoteInfo = ulGetLong(0x20a, aucHeader); /* fcPlcfendRef */
	NO_DBG_HEX(ulBeginEndnoteInfo);
	tEndnoteInfoLen = (size_t)ulGetLong(0x20e, aucHeader); /* lcbPlcfendRef */
	NO_DBG_DEC(tEndnoteInfoLen);

	if (tEndnoteInfoLen < 10) {
		DBG_MSG("No endnotes in this document");
		return;
	}

	NO_DBG_DEC(pPPS->tTable.ulSB);
	NO_DBG_HEX(pPPS->tTable.ulSize);
	if (pPPS->tTable.ulSize == 0) {
		DBG_MSG("No endnotes information");
		return;
	}

	if (pPPS->tTable.ulSize < MIN_SIZE_FOR_BBD_USE) {
	  	/* Use the Small Block Depot */
		aulBlockDepot = aulSBD;
		tBlockDepotLen = tSBDLen;
		tBlockSize = SMALL_BLOCK_SIZE;
	} else {
	  	/* Use the Big Block Depot */
		aulBlockDepot = aulBBD;
		tBlockDepotLen = tBBDLen;
		tBlockSize = BIG_BLOCK_SIZE;
	}
	aucBuffer = xmalloc(tEndnoteInfoLen);
	if (!bReadBuffer(pFile, pPPS->tTable.ulSB,
			aulBlockDepot, tBlockDepotLen, tBlockSize,
			aucBuffer, ulBeginEndnoteInfo, tEndnoteInfoLen)) {
		aucBuffer = xfree(aucBuffer);
		return;
	}
	NO_DBG_PRINT_BLOCK(aucBuffer, tEndnoteInfoLen);

	fail(tEndnoteListLength != 0);
	tEndnoteListLength = (tEndnoteInfoLen - 4) / 6;
	fail(tEndnoteListLength == 0);

	fail(aulEndnoteList != NULL);
	aulEndnoteList = xcalloc(tEndnoteListLength, sizeof(ULONG));

	for (tIndex = 0; tIndex < tEndnoteListLength; tIndex++) {
		ulOffset = ulGetLong(tIndex * 4, aucBuffer);
		NO_DBG_HEX(ulOffset);
		ulFileOffset = ulCharPos2FileOffset(ulBeginOfText + ulOffset);
		NO_DBG_HEX(ulFileOffset);
		aulEndnoteList[tIndex] = ulFileOffset;
	}
	aucBuffer = xfree(aucBuffer);
} /* end of vGet8EndnotesInfo */
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:72,代码来源:notes.c

示例4: Lens_Init

INT32 Lens_Init(LENS_INIT_STATE part)
{
    INT32 ERROR_STATUS;

    switch(part)
    {
        case LENS_INIT_ZOOM_PART1:
            //Step 1. Initiate zoom part1
            DBG_MSG("Start of LENS_INIT_ZOOM_PART1\r\n");
            //Callback function
            //TM_Begin(LENS_ZOOM_INIT);
            if(gLensCtrlObj.APICB!=NULL)
            {
                gLensCtrlObj.APICB(LENS_CB_INITZOOM1_START, NULL);
            }

            gLensCtrlObj.pLens->zoom_initPart1();

            //Callback function
            if(gLensCtrlObj.APICB!=NULL)
            {
                gLensCtrlObj.APICB(LENS_CB_INITZOOM1_END, NULL);
            }

            Lens_Module_SetState(LENS_STATE_INIT_PART1);
            DBG_MSG("End of LENS_STATE_INIT_PART1\r\n");    // --> LENS_STATE_INIT_PART1
            return ERR_OK;

        case LENS_INIT_ZOOM_PART2:
            //Step 2. Initiate zoom part2
            DBG_MSG("Start of LENS_INIT_ZOOM_PART2\r\n");

            //TM_Begin(LENS_ZOOM_INITWAIT);
            //Callback function
            if(gLensCtrlObj.APICB!=NULL)
            {
                gLensCtrlObj.APICB(LENS_CB_INITZOOM2_START, NULL);
            }

            ERROR_STATUS = gLensCtrlObj.pLens->zoom_initPart2();

            //Callback function
            if(gLensCtrlObj.APICB!=NULL)
            {
                gLensCtrlObj.APICB(LENS_CB_INITZOOM2_END, NULL);
            }

            //TM_End(LENS_ZOOM_INITWAIT);

            DBG_MSG("End of LENS_INIT_ZOOM_PART2\r\n");

            return ERROR_STATUS;

        case LENS_INIT_APERTURE:
            //Step 3. Initiate aperture
            DBG_MSG("Start of LENS_INIT_APERTURE\r\n");
            //TM_Begin(LENS_APER_INIT);

            //Callback function
            if(gLensCtrlObj.APICB!=NULL)
            {
                gLensCtrlObj.APICB(LENS_CB_INITAPERTURE_START, NULL);
            }
            gLensCtrlObj.pLens->aperture_init();
            //#NT#2010/09/23#Jeffery Chuang -begin
            //Add shutter init here until add new api

            gLensCtrlObj.pMotor->shutter_setState(MOTOR_SHUTTER_NORMAL,OPEN);
            //#NT#2010/09/23#Jeffery Chuang -end

            //Callback function
            if(gLensCtrlObj.APICB!=NULL)
            {
                gLensCtrlObj.APICB(LENS_CB_INITAPERTURE_END, NULL);
            }

            //TM_End(LENS_APER_INIT);

            DBG_MSG("End of LENS_INIT_APERTURE\r\n");
            return ERR_OK;

        case LENS_INIT_FOCUS:
            //TM_Begin(LENS_FOCUS_INIT);
            DBG_MSG("Start of LENS_INIT_FOCUS\r\n");

            //Callback function
            if(gLensCtrlObj.APICB!=NULL)
            {
                gLensCtrlObj.APICB(LENS_CB_INITFOCUS_START, NULL);
            }

            #if 1 // Could be migrated to other place in the near future.
            {
                PPSTORE_SECTION_HANDLE  pSection;
                INT16 iTmpIdx[15] = {0};
                UINT32 uiCalTblSize = Lens_Zoom_GetSection(ZOOM_MAX_SECTION)/* Table size of DemoKit is '11'. */, i;

                if(sizeof(iTmpIdx) >= uiCalTblSize)
                {
                    if ((pSection = PStore_OpenSection(PS_FOCUS_DATA, PS_RDWR)) != E_PS_SECHDLER)
//.........这里部分代码省略.........
开发者ID:github188,项目名称:NT9665X_GMD_V18,代码行数:101,代码来源:LensAPI.c

示例5: vGet1FontInfo

/*
 * Fill the font information block with information
 * from a WinWord 1 file.
 */
void
vGet1FontInfo(int iFodo,
	const UCHAR *aucGrpprl, size_t tBytes, font_block_type *pFont)
{
	BOOL	bIcoChange, bFtcChange, bHpsChange, bKulChange;
	USHORT	usTmp;
	UCHAR	ucTmp;
	UCHAR	aucChpx[12];

	fail(iFodo < 0 || aucGrpprl == NULL || pFont == NULL);

	if (tBytes > sizeof(aucChpx)) {
		NO_DBG_PRINT_BLOCK(aucGrpprl + iFodo, tBytes);
		return;
	}

	/* Build the CHPX structure */
	(void)memset(aucChpx, 0, sizeof(aucChpx));
	(void)memcpy(aucChpx, aucGrpprl + iFodo, min(tBytes, sizeof(aucChpx)));

	usTmp = usGetWord(0, aucChpx);
	if ((usTmp & BIT(0)) != 0) {
		pFont->usFontStyle ^= FONT_BOLD;
	}
	if ((usTmp & BIT(1)) != 0) {
		pFont->usFontStyle ^= FONT_ITALIC;
	}
	if ((usTmp & BIT(2)) != 0) {
		pFont->usFontStyle ^= FONT_STRIKE;
	}
	if ((usTmp & BIT(5)) != 0) {
		pFont->usFontStyle ^= FONT_SMALL_CAPITALS;
	}
	if ((usTmp & BIT(6)) != 0) {
		pFont->usFontStyle ^= FONT_CAPITALS;
	}
	if ((usTmp & BIT(7)) != 0) {
		pFont->usFontStyle ^= FONT_HIDDEN;
	}

	ucTmp = ucGetByte(5, aucChpx);
	if (ucTmp != 0) {
		if (ucTmp < 128) {
			pFont->usFontStyle |= FONT_SUPERSCRIPT;
			DBG_MSG("Superscript");
		} else {
			pFont->usFontStyle |= FONT_SUBSCRIPT;
			DBG_MSG("Subscript");
		}
	}

	bIcoChange = (usTmp & BIT(10)) != 0;
	bFtcChange = (usTmp & BIT(11)) != 0;
	bHpsChange = (usTmp & BIT(12)) != 0;
	bKulChange = (usTmp & BIT(13)) != 0;

	if (bFtcChange) {
		usTmp = usGetWord(2, aucChpx);
		if (usTmp <= (USHORT)UCHAR_MAX) {
			pFont->ucFontNumber = (UCHAR)usTmp;
		} else {
			pFont->ucFontNumber = 0;
		}
	}

	if (bHpsChange) {
		pFont->usFontSize = (USHORT)ucGetByte(4, aucChpx);
	}

	if (bIcoChange || bKulChange) {
		usTmp = usGetWord(6, aucChpx);
		if (bIcoChange) {
			pFont->ucFontColor = (UCHAR)((usTmp & 0x0f00) >> 8);
			if (pFont->ucFontColor <= 7) {
				/* Add 1 for compatibility with Word 2 and up */
				pFont->ucFontColor++;
			} else {
				DBG_DEC(pFont->ucFontColor);
				pFont->ucFontColor = 0;
			}
		}
		if (bKulChange) {
			usTmp = (usTmp & 0x7000) >> 12;
			DBG_DEC_C(usTmp > 4, usTmp);
			if (usTmp == 0) {
				pFont->usFontStyle &= ~FONT_UNDERLINE;
			} else {
				pFont->usFontStyle |= FONT_UNDERLINE;
			}
		}
	}
开发者ID:pocketbook-free,项目名称:antiword,代码行数:95,代码来源:prop2.c

示例6: level1_cache_flush_all

static void level1_cache_flush_all(void)
{
	DBG_MSG(4, ("meson_drm_ump_osk_msync(): Flushing the whole L1 cache\n"));
	__cpuc_flush_kern_all();
}
开发者ID:nmadrane,项目名称:linux-meson,代码行数:5,代码来源:meson_cache_control.c

示例7: ump_dmabuf_import_wrapper

int ump_dmabuf_import_wrapper(u32 __user *argument,
				struct ump_session_data  *session_data)
{
	ump_session_memory_list_element *session = NULL;
	struct ump_uk_dmabuf ump_dmabuf;
	ump_dd_handle *ump_handle;
	ump_dd_physical_block *blocks;
	struct dma_buf_attachment *attach;
	struct dma_buf *dma_buf;
	struct sg_table *sgt;
	struct scatterlist *sgl;
	unsigned long block_size;
	/* FIXME */
	struct device dev;
	unsigned int i = 0, npages;
	int ret;

	/* Sanity check input parameters */
	if (!argument || !session_data) {
		MSG_ERR(("NULL parameter.\n"));
		return -EINVAL;
	}

	if (copy_from_user(&ump_dmabuf, argument,
				sizeof(struct ump_uk_dmabuf))) {
		MSG_ERR(("copy_from_user() failed.\n"));
		return -EFAULT;
	}

	dma_buf = dma_buf_get(ump_dmabuf.fd);
	if (IS_ERR(dma_buf))
		return PTR_ERR(dma_buf);

	/*
	 * check whether dma_buf imported already exists or not.
	 *
	 * TODO
	 * if already imported then dma_buf_put() should be called
	 * and then just return dma_buf imported.
	 */

	attach = dma_buf_attach(dma_buf, &dev);
	if (IS_ERR(attach)) {
		ret = PTR_ERR(attach);
		goto err_dma_buf_put;
	}

	sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
	if (IS_ERR(sgt)) {
		ret = PTR_ERR(sgt);
		goto err_dma_buf_detach;
	}

	npages = sgt->nents;

	/* really need? */
	ump_dmabuf.ctx = (void *)session_data;

	block_size = sizeof(ump_dd_physical_block) * npages;

	blocks = (ump_dd_physical_block *)_mali_osk_malloc(block_size);

	if (NULL == blocks) {
		MSG_ERR(("Failed to allocate blocks\n"));
		ret = -ENOMEM;
		goto err_dmu_buf_unmap;
	}

	sgl = sgt->sgl;

	while (i < npages) {
		blocks[i].addr = sg_phys(sgl);
		blocks[i].size = sg_dma_len(sgl);
		sgl = sg_next(sgl);
		i++;
	}

	/*
	 * Initialize the session memory list element, and add it
	 * to the session object
	 */
	session = _mali_osk_calloc(1, sizeof(*session));
	if (!session) {
		DBG_MSG(1, ("Failed to allocate session.\n"));
		ret = -EFAULT;
		goto err_free_block;
	}

	ump_handle = ump_dd_handle_create_from_phys_blocks(blocks, i);
	if (UMP_DD_HANDLE_INVALID == ump_handle) {
		DBG_MSG(1, ("Failed to create ump handle.\n"));
		ret = -EFAULT;
		goto err_free_session;
	}

	session->mem = (ump_dd_mem *)ump_handle;

	_mali_osk_lock_wait(session_data->lock, _MALI_OSK_LOCKMODE_RW);
	_mali_osk_list_add(&(session->list),
			&(session_data->list_head_session_memory_list));
//.........这里部分代码省略.........
开发者ID:AndreiLux,项目名称:Perseus-S3,代码行数:101,代码来源:ump_ukk_ref_wrappers.c

示例8: ump_ion_import_wrapper

/*
 * IOCTL operation; Import fd to  UMP memory
 */
int ump_ion_import_wrapper(u32 __user * argument, struct ump_session_data  * session_data)
{
	_ump_uk_ion_import_s user_interaction;
	ump_dd_handle *ump_handle;
	ump_dd_physical_block * blocks;
	unsigned long num_blocks;
	struct ion_handle *ion_hnd;
	struct scatterlist *sg;
	struct scatterlist *sg_ion;
	unsigned long i = 0;

	ump_session_memory_list_element * session_memory_element = NULL;
	if (ion_client_ump==NULL)
	    ion_client_ump = ion_client_create(ion_exynos, -1, "ump");

	/* Sanity check input parameters */
	if (NULL == argument || NULL == session_data)
	{
		MSG_ERR(("NULL parameter in ump_ioctl_allocate()\n"));
		return -ENOTTY;
	}

	/* Copy the user space memory to kernel space (so we safely can read it) */
	if (0 != copy_from_user(&user_interaction, argument, sizeof(user_interaction)))
	{
		MSG_ERR(("copy_from_user() in ump_ioctl_allocate()\n"));
		return -EFAULT;
	}

	user_interaction.ctx = (void *) session_data;

	/* translate fd to secure ID*/
	ion_hnd = ion_import_fd(ion_client_ump, user_interaction.ion_fd);
	sg_ion = ion_map_dma(ion_client_ump,ion_hnd);

	blocks = (ump_dd_physical_block*)_mali_osk_malloc(sizeof(ump_dd_physical_block)*1024);

	if (NULL == blocks) {
		MSG_ERR(("Failed to allocate blocks in ump_ioctl_allocate()\n"));
		return -ENOMEM;
	}

	sg = sg_ion;
	do {
		blocks[i].addr = sg_phys(sg);
		blocks[i].size = sg_dma_len(sg);
		i++;
		if (i>=1024) {
			_mali_osk_free(blocks);
			MSG_ERR(("ion_import fail() in ump_ioctl_allocate()\n"));
			return -EFAULT;
		}
		sg = sg_next(sg);
	} while(sg);

	num_blocks = i;

	/* Initialize the session_memory_element, and add it to the session object */
	session_memory_element = _mali_osk_calloc( 1, sizeof(ump_session_memory_list_element));

	if (NULL == session_memory_element)
	{
		_mali_osk_free(blocks);
		DBG_MSG(1, ("Failed to allocate ump_session_memory_list_element in ump_ioctl_allocate()\n"));
		return -EFAULT;
	}

	ump_handle = ump_dd_handle_create_from_phys_blocks(blocks, num_blocks);
	if (UMP_DD_HANDLE_INVALID == ump_handle)
	{
		_mali_osk_free(session_memory_element);
		_mali_osk_free(blocks);
		DBG_MSG(1, ("Failed to allocate ump_session_memory_list_element in ump_ioctl_allocate()\n"));
		return -EFAULT;
	}

	session_memory_element->mem = (ump_dd_mem*)ump_handle;
	_mali_osk_lock_wait(session_data->lock, _MALI_OSK_LOCKMODE_RW);
	_mali_osk_list_add(&(session_memory_element->list), &(session_data->list_head_session_memory_list));
	_mali_osk_lock_signal(session_data->lock, _MALI_OSK_LOCKMODE_RW);
	ion_unmap_dma(ion_client_ump,ion_hnd);
	ion_free(ion_client_ump, ion_hnd);

	_mali_osk_free(blocks);

	user_interaction.secure_id = ump_dd_secure_id_get(ump_handle);
	user_interaction.size = ump_dd_size_get(ump_handle);
	user_interaction.ctx = NULL;

	if (0 != copy_to_user(argument, &user_interaction, sizeof(user_interaction)))
	{
		/* If the copy fails then we should release the memory. We can use the IOCTL release to accomplish this */

		MSG_ERR(("copy_to_user() failed in ump_ioctl_allocate()\n"));

		return -EFAULT;
	}
//.........这里部分代码省略.........
开发者ID:AndreiLux,项目名称:Perseus-S3,代码行数:101,代码来源:ump_ukk_ref_wrappers.c

示例9: _ump_ukk_allocate

_mali_osk_errcode_t _ump_ukk_allocate( _ump_uk_allocate_s *user_interaction )
{
	ump_session_data * session_data = NULL;
	ump_dd_mem *new_allocation = NULL;
	ump_session_memory_list_element * session_memory_element = NULL;
	int map_id;

	DEBUG_ASSERT_POINTER( user_interaction );
	DEBUG_ASSERT_POINTER( user_interaction->ctx );

	session_data = (ump_session_data *) user_interaction->ctx;

	session_memory_element = _mali_osk_calloc( 1, sizeof(ump_session_memory_list_element));
	if (NULL == session_memory_element)
	{
		DBG_MSG(1, ("Failed to allocate ump_session_memory_list_element in ump_ioctl_allocate()\n"));
		return _MALI_OSK_ERR_NOMEM;
	}


	new_allocation = _mali_osk_calloc( 1, sizeof(ump_dd_mem));
	if (NULL==new_allocation)
	{
		_mali_osk_free(session_memory_element);
		DBG_MSG(1, ("Failed to allocate ump_dd_mem in _ump_ukk_allocate()\n"));
		return _MALI_OSK_ERR_NOMEM;
	}

	/* Create a secure ID for this allocation */
	_mali_osk_lock_wait(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);
	map_id = ump_descriptor_mapping_allocate_mapping(device.secure_id_map, (void*)new_allocation);

	if (map_id < 0)
	{
		_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);
		_mali_osk_free(session_memory_element);
		_mali_osk_free(new_allocation);
		DBG_MSG(1, ("Failed to allocate secure ID in ump_ioctl_allocate()\n"));
		return - _MALI_OSK_ERR_INVALID_FUNC;
	}

	/* Initialize the part of the new_allocation that we know so for */
	new_allocation->secure_id = (ump_secure_id)map_id;
	_mali_osk_atomic_init(&new_allocation->ref_count,1);
	if ( 0==(UMP_REF_DRV_UK_CONSTRAINT_USE_CACHE & user_interaction->constraints) )
		 new_allocation->is_cached = 0;
	else new_allocation->is_cached = 1;

	/* special case a size of 0, we should try to emulate what malloc does in this case, which is to return a valid pointer that must be freed, but can't be dereferences */
	if (0 == user_interaction->size)
	{
		user_interaction->size = 1; /* emulate by actually allocating the minimum block size */
	}

	new_allocation->size_bytes = UMP_SIZE_ALIGN(user_interaction->size); /* Page align the size */
	new_allocation->lock_usage = UMP_NOT_LOCKED;

	/* Now, ask the active memory backend to do the actual memory allocation */
	if (!device.backend->allocate( device.backend->ctx, new_allocation ) )
	{
		DBG_MSG(3, ("OOM: No more UMP memory left. Failed to allocate memory in ump_ioctl_allocate(). Size: %lu, requested size: %lu\n", new_allocation->size_bytes, (unsigned long)user_interaction->size));
		ump_descriptor_mapping_free(device.secure_id_map, map_id);
		_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);
		_mali_osk_free(new_allocation);
		_mali_osk_free(session_memory_element);
		return _MALI_OSK_ERR_INVALID_FUNC;
	}
	new_allocation->hw_device = _UMP_UK_USED_BY_CPU;
	new_allocation->ctx = device.backend->ctx;
	new_allocation->release_func = device.backend->release;

	_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);

	/* Initialize the session_memory_element, and add it to the session object */
	session_memory_element->mem = new_allocation;
	_mali_osk_lock_wait(session_data->lock, _MALI_OSK_LOCKMODE_RW);
	_mali_osk_list_add(&(session_memory_element->list), &(session_data->list_head_session_memory_list));
	_mali_osk_lock_signal(session_data->lock, _MALI_OSK_LOCKMODE_RW);

	user_interaction->secure_id = new_allocation->secure_id;
	user_interaction->size = new_allocation->size_bytes;
	DBG_MSG(3, ("UMP memory allocated. ID: %u, size: %lu\n", new_allocation->secure_id, new_allocation->size_bytes));

	return _MALI_OSK_ERR_OK;
}
开发者ID:EddyKuo,项目名称:linux-sdk-kernel-source,代码行数:85,代码来源:ump_kernel_ref_drv.c

示例10: ump_dd_handle_create_from_phys_blocks

UMP_KERNEL_API_EXPORT ump_dd_handle ump_dd_handle_create_from_phys_blocks(ump_dd_physical_block * blocks, unsigned long num_blocks)
{
	ump_dd_mem * mem;
	unsigned long size_total = 0;
	int map_id;
	u32 i;

	/* Go through the input blocks and verify that they are sane */
	for (i=0; i < num_blocks; i++)
	{
		unsigned long addr = blocks[i].addr;
		unsigned long size = blocks[i].size;

		DBG_MSG(5, ("Adding physical memory to new handle. Address: 0x%08lx, size: %lu\n", addr, size));
		size_total += blocks[i].size;

		if (0 != UMP_ADDR_ALIGN_OFFSET(addr))
		{
			MSG_ERR(("Trying to create UMP memory from unaligned physical address. Address: 0x%08lx\n", addr));
			return UMP_DD_HANDLE_INVALID;
		}

		if (0 != UMP_ADDR_ALIGN_OFFSET(size))
		{
			MSG_ERR(("Trying to create UMP memory with unaligned size. Size: %lu\n", size));
			return UMP_DD_HANDLE_INVALID;
		}
	}

	/* Allocate the ump_dd_mem struct for this allocation */
	mem = _mali_osk_malloc(sizeof(*mem));
	if (NULL == mem)
	{
		DBG_MSG(1, ("Could not allocate ump_dd_mem in ump_dd_handle_create_from_phys_blocks()\n"));
		return UMP_DD_HANDLE_INVALID;
	}

	/* Find a secure ID for this allocation */
	_mali_osk_lock_wait(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);
	map_id = ump_descriptor_mapping_allocate_mapping(device.secure_id_map, (void*) mem);

	if (map_id < 0)
	{
		_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);
		_mali_osk_free(mem);
		DBG_MSG(1, ("Failed to allocate secure ID in ump_dd_handle_create_from_phys_blocks()\n"));
		return UMP_DD_HANDLE_INVALID;
	}

	/* Now, make a copy of the block information supplied by the user */
	mem->block_array = _mali_osk_malloc(sizeof(ump_dd_physical_block)* num_blocks);
	if (NULL == mem->block_array)
	{
		ump_descriptor_mapping_free(device.secure_id_map, map_id);
		_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);
		_mali_osk_free(mem);
		DBG_MSG(1, ("Could not allocate a mem handle for function ump_dd_handle_create_from_phys_blocks().\n"));
		return UMP_DD_HANDLE_INVALID;
	}

	_mali_osk_memcpy(mem->block_array, blocks, sizeof(ump_dd_physical_block) * num_blocks);

	/* And setup the rest of the ump_dd_mem struct */
	_mali_osk_atomic_init(&mem->ref_count, 1);
	mem->secure_id = (ump_secure_id)map_id;
	mem->size_bytes = size_total;
	mem->nr_blocks = num_blocks;
	mem->backend_info = NULL;
	mem->ctx = NULL;
	mem->release_func = phys_blocks_release;
	/* For now UMP handles created by ump_dd_handle_create_from_phys_blocks() is forced to be Uncached */
	mem->is_cached = 0;
	mem->hw_device = _UMP_UK_USED_BY_CPU;
	mem->lock_usage = UMP_NOT_LOCKED;

	_mali_osk_lock_signal(device.secure_id_map_lock, _MALI_OSK_LOCKMODE_RW);
	DBG_MSG(3, ("UMP memory created. ID: %u, size: %lu\n", mem->secure_id, mem->size_bytes));

	return (ump_dd_handle)mem;
}
开发者ID:EddyKuo,项目名称:linux-sdk-kernel-source,代码行数:80,代码来源:ump_kernel_ref_drv.c

示例11: Power_StopUSBCharge

void Power_StopUSBCharge(void)
{
    //DBG_MSG("  gIsUSBInsert=%d,gIsBattInsert=%d,gIsBattDead=%d,gIsUSBAdapter=%d\r\n",gIsUSBInsert,gIsBattInsert,gIsBattDead,gIsUSBAdapter);
    if (!gIsBattInsert)
    {
        DBG_DUMP("  NO Battery, Ignore STOP\r\n");
        return;
    }
#if _MIPS_TODO
    //#NT#2010/12/10#Jeah Yen -begin
    if((USB_GetSource() == USB_SRC_USB_ADAPTER) && (Power_GetSource() != POWER_SRC_USB_ADAPTER))
    {
        //Not charge yet, just start check low-battery
        DBG_DUMP("GxPower: Start low-battery check.\r\n");
        GxPower_SetControl(GXPWR_CTRL_BATTERY_DETECT_EN, TRUE);
    }
    //#NT#2010/12/10#Jeah Yen -end

    //#NT#2011/3/30#Jeah Yen -begin
    if((USB_GetSource() == USB_SRC_NONE) && (Power_GetSource() != POWER_SRC_USB_ADAPTER))
    {
        //Cannot charge, start check low-battery
        DBG_DUMP("GxPower: Start low-battery check.\r\n");
        GxPower_SetControl(GXPWR_CTRL_BATTERY_DETECT_EN, TRUE);
    }
    //#NT#2011/3/30#Jeah Yen -end

    if((USB_GetSource() == USB_SRC_USB_ADAPTER))
    {
        //DBG_MSG("  USB Src = Adaptor\r\n");
        GxPower_SetControl(GXPWR_CTRL_BATTERY_CHARGE_CURRENT,BATT_CHARGE_CURRENT_LOW);
        DBG_MSG("  Charge Current = %d\r\n", BATT_CHARGE_CURRENT_LOW);
    }
#endif
    if((USB_GetSource() == USB_SRC_USB_PC))
    {
        //DBG_MSG("  USB Src = PC\r\n");
        GxPower_SetControl(GXPWR_CTRL_BATTERY_CHARGE_CURRENT,BATT_CHARGE_CURRENT_LOW);
        DBG_MSG("  Charge Current = %d\r\n", BATT_CHARGE_CURRENT_LOW);
    }

    if (!GxPower_GetControl(GXPWR_CTRL_BATTERY_CHARGE_EN))
    {
        DBG_DUMP("  Already NOT Charge, Ignore STOP\r\n");
        return;
    }

    //#NT#2010/12/10#Jeah Yen -begin
    DBG_DUMP("GxPower: Stop to Charge Battery\r\n");
    GxPower_SetControl(GXPWR_CTRL_BATTERY_CHARGE_EN,FALSE);
#if _MIPS_TODO
    if(!gIsUSBChargePreCheck
        && (GxSystem_GetState(SYSTEM_STATE_POWERON) != SYSTEM_POWERON_CHARGE)
        )
    {
#if (USB_CHARGE_VERIFY == ENABLE)
#else
        GxLED_SetCtrl(KEYSCAN_LED_GREEN,SET_TOGGLE_LED,FALSE);
        GxLED_SetCtrl(KEYSCAN_LED_GREEN,TURNON_LED,TRUE);
#endif
        //GxLED_SetCtrl(KEYSCAN_LED_RED,SET_TOGGLE_LED,FALSE);
        //GxLED_SetCtrl(KEYSCAN_LED_RED,TURNON_LED,FALSE);
    }
#endif
    DBG_DUMP("GxPower: Start low-battery check.\r\n");
    GxPower_SetControl(GXPWR_CTRL_BATTERY_DETECT_EN, TRUE);
    // enable flash re-charge
    SxTimer_SetFuncActive(SX_TIMER_DET_RECHARGE_ID,TRUE);
    //#NT#2010/12/10#Jeah Yen -end

}
开发者ID:magic-gjh,项目名称:NT96655_S600_A5,代码行数:71,代码来源:SysPower_Exe.c

示例12: pOpenFontTableFile

/*
 * pOpenFontTableFile - open the Font translation file
 * Copy the file to the proper place if necessary.
 *
 * Returns the file pointer or NULL
 */
FILE *
pOpenFontTableFile(void)
{
    FILE	*pFileR, *pFileW;
    char	*szFontNamesFile;
    size_t	tSize;
    BOOL	bFailed;
    char	acBuffer[256];

    pFileR = fopen("<AntiWord$FontNamesFile>", "r");
    if (pFileR != NULL) {
        /* The font table is already in the right directory */
        return pFileR;
    }

    szFontNamesFile = getenv("AntiWord$FontNamesSave");
    if (szFontNamesFile == NULL) {
        werr(0, "Warning: Name of the FontNames file not found");
        return NULL;
    }
    DBG_MSG(szFontNamesFile);

    pFileR = fopen("<AntiWord$Dir>.Resources.Default", "r");
    if (pFileR == NULL) {
        werr(0, "I can't find 'Resources.Default'");
        return NULL;
    }
    /* Here the default font translation table is known to exist */

    if (!bMakeDirectory(szFontNamesFile)) {
        werr(0,
             "I can't make a directory for the FontNames file");
        return NULL;
    }
    /* Here the proper directory is known to exist */

    pFileW = fopen(szFontNamesFile, "w");
    if (pFileW == NULL) {
        (void)fclose(pFileR);
        werr(0, "I can't create a default FontNames file");
        return NULL;
    }
    /* Here the proper directory is known to be writeable */

    /* Copy the default FontNames file */
    bFailed = FALSE;
    while (!feof(pFileR)) {
        tSize = fread(acBuffer, 1, sizeof(acBuffer), pFileR);
        if (ferror(pFileR)) {
            DBG_MSG("Read error");
            bFailed = TRUE;
            break;
        }
        if (fwrite(acBuffer, 1, tSize, pFileW) != tSize) {
            DBG_MSG("Write error");
            bFailed = TRUE;
            break;
        }
    }
    (void)fclose(pFileW);
    (void)fclose(pFileR);
    if (bFailed) {
        DBG_MSG("Copying the FontNames file failed");
        (void)remove(szFontNamesFile);
        return NULL;
    }
    return fopen(szFontNamesFile, "r");
} /* end of pOpenFontTableFile */
开发者ID:rogerdehe,项目名称:antiword,代码行数:74,代码来源:fonts_r.c

示例13: DBG_BLOCK

//------------------------------------------------------------------------------
//!
bool
BIH::trace( const Rayf& ray, Hit& hit, IntersectFunc intersect, void* data ) const
{
   DBG_BLOCK( os_bih_trace, "BIH::trace(" << ray.origin() << ray.direction() << " hit: t=" << hit._t << " id=" << hit._id << ")" );
   if( _nodes.empty() )
   {
      return false;
   }

   Vec3f invDir = ray.direction().getInversed(); 

   // Compute traversal order.
   uint order[3];
   order[0] = invDir(0) >= 0.0f ? 0 : 1;
   order[1] = invDir(1) >= 0.0f ? 0 : 1;
   order[2] = invDir(2) >= 0.0f ? 0 : 1;

   float tmin  = 0.0f;
   float tmax  = hit._t;
   bool impact = false;


   // Traverse tree.
   Vector<TraversalStackNode> stack( _maxDepth );
   uint stackID = 0;
   const Node* node = &_nodes[0];

   while( 1 )
   {
      DBG_MSG( os_bih_trace, "Visiting " << *node );
      if( node->isInteriorNode() )
      {
         uint axis     = node->axis();
         float tplane0 = ( node->_plane[order[axis]] - ray.origin()(axis)) * invDir(axis);
         float tplane1 = ( node->_plane[1-order[axis]] - ray.origin()(axis)) * invDir(axis);

         // Clip node.
         if( node->isClipNode() )
         {
            // FIXME: we could probably do better (not traversing this node).
            node = &_nodes[node->index()];
            tmin = CGM::max( tmin, tplane0 );
            tmax = CGM::min( tmax, tplane1 );
            continue;
         }

         bool traverse0 = tmin < tplane0;
         bool traverse1 = tmax > tplane1;

         if( traverse0 )
         {
            if( traverse1 )
            {
               stack[stackID++].set(
                  &_nodes[node->index() + 1-order[axis]],
                  CGM::max( tmin, tplane1 ),
                  tmax
               );
            }
            node = &_nodes[node->index() + order[axis]];
            tmax = CGM::min( tmax, tplane0 );
         }
         else
         {
            if( traverse1 )
            {
               node = &_nodes[node->index() + 1-order[axis]];
               tmin = CGM::max( tmin, tplane1 );
            }
            else
            {
               // Unstack.
               do
               {
                  if( stackID == 0 )
                  {
                     return impact;
                  }
                  stack[--stackID].get( node, tmin, tmax );
                  tmax = CGM::min( tmax, hit._t );
               } while( tmin > tmax );
            }
         }

      }
      else
      {
         // We are in a leaf node.
         // Intersects all primitives in it.
         uint numElems = node->_numElements;
         uint id       = node->index();
         for( uint i = 0; i < numElems; ++i, ++id )
         {
            if( intersect( ray, _ids[id], hit._t, data ) )
            {
               impact  = true;
               hit._id = _ids[id];
            }
//.........这里部分代码省略.........
开发者ID:LudoSapiens,项目名称:Dev,代码行数:101,代码来源:BIH.cpp

示例14: eGet8RowInfo

/*
 * Translate the rowinfo to a member of the row_info enumeration
 */
row_info_enum
eGet8RowInfo(int iFodo,
	const UCHAR *aucGrpprl, int iBytes, row_block_type *pRow)
{
	int	iFodoOff, iInfoLen;
	int	iIndex, iSize, iCol;
	int	iPosCurr, iPosPrev;
	USHORT	usTmp;
	BOOL	bFound2416_0, bFound2416_1, bFound2417_0, bFound2417_1;
	BOOL	bFound244b_0, bFound244b_1, bFound244c_0, bFound244c_1;
	BOOL	bFoundd608;

	fail(iFodo < 0 || aucGrpprl == NULL || pRow == NULL);

	iFodoOff = 0;
	bFound2416_0 = FALSE;
	bFound2416_1 = FALSE;
	bFound2417_0 = FALSE;
	bFound2417_1 = FALSE;
	bFound244b_0 = FALSE;
	bFound244b_1 = FALSE;
	bFound244c_0 = FALSE;
	bFound244c_1 = FALSE;
	bFoundd608 = FALSE;
	while (iBytes >= iFodoOff + 2) {
		iInfoLen = 0;
		switch (usGetWord(iFodo + iFodoOff, aucGrpprl)) {
		case 0x2416:	/* fInTable */
			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {
				bFound2416_1 = TRUE;
			} else {
				bFound2416_0 = TRUE;
			}
			break;
		case 0x2417:	/* fTtp */
			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {
				bFound2417_1 = TRUE;
			} else {
				bFound2417_0 = TRUE;
			}
			break;
		case 0x244b:	/* sub-table fInTable */
			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {
				bFound244b_1 = TRUE;
			} else {
				bFound244b_0 = TRUE;
			}
			break;
		case 0x244c:	/* sub-table fTtp */
			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {
				bFound244c_1 = TRUE;
			} else {
				bFound244c_0 = TRUE;
			}
			break;
		case 0x6424:	/* brcTop */
			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
			usTmp &= 0xff00;
			NO_DBG_DEC(usTmp >> 8);
			if (usTmp == 0) {
				pRow->ucBorderInfo &= ~TABLE_BORDER_TOP;
			} else {
				pRow->ucBorderInfo |= TABLE_BORDER_TOP;
			}
			break;
		case 0x6425:	/* brcLeft */
			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
			usTmp &= 0xff00;
			NO_DBG_DEC(usTmp >> 8);
			if (usTmp == 0) {
				pRow->ucBorderInfo &= ~TABLE_BORDER_LEFT;
			} else {
				pRow->ucBorderInfo |= TABLE_BORDER_LEFT;
			}
			break;
		case 0x6426:	/* brcBottom */
			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
			usTmp &= 0xff00;
			NO_DBG_DEC(usTmp >> 8);
			if (usTmp == 0) {
				pRow->ucBorderInfo &= ~TABLE_BORDER_BOTTOM;
			} else {
				pRow->ucBorderInfo |= TABLE_BORDER_BOTTOM;
			}
			break;
		case 0x6427:	/* brcRight */
			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
			usTmp &= 0xff00;
			NO_DBG_DEC(usTmp >> 8);
			if (usTmp == 0) {
				pRow->ucBorderInfo &= ~TABLE_BORDER_RIGHT;
			} else {
				pRow->ucBorderInfo |= TABLE_BORDER_RIGHT;
			}
			break;
		case 0xd606:	/* cDefTable10 */
			DBG_MSG("0xd606: sprmTDefTable10");
//.........这里部分代码省略.........
开发者ID:pocketbook-free,项目名称:antiword,代码行数:101,代码来源:prop8.c

示例15: UIDisplay_Init

void UIDisplay_Init(UINT8 iDD, BOOL bClear, ISIZE* pDeviceSize)
{
    RESULT r;
    LAYER_INIT LayerInit;

    UINT32 uiBufAddr;
    //fixed buffer size
    UINT32 osd_w = OSD_W;
    UINT32 osd_h = OSD_H;
    //fixed buffer size
    UINT32 vdo_w = OSD_W;
    UINT32 vdo_h = OSD_H;
    //ISIZE DeviceSize;
    LAYER_INIT* pLayerInit = (LAYER_INIT*)&LayerInit; //layer init parameter
    //DeviceSize = GxVideo_GetDeviceSize(DOUT1);
    ISIZE DeviceSize = pDeviceSize[0];

    DBG_MSG("DOUT=%d\n\r",iDD>>4);
    switch(iDD & 0x0f) //check layer
    {
    case LAYER_OSD1:

        uiBufAddr = OS_GetMempoolAddr(POOL_ID_DISP_OSD1);

        pLayerInit->uiType = TYPE_FB;
        pLayerInit->uiPxlfmt = DISPLAY_OSD_FMT;
        pLayerInit->uiWidth = osd_w;
        pLayerInit->uiHeight = osd_h;
#if (OSD_USE_DOUBLE_BUFFER == ENABLE)
pLayerInit->uiBufCount = 1;
pLayerInit->uiSwapEffect = SWAPEFFECT_COPY;
#else
pLayerInit->uiBufCount = 0;
pLayerInit->uiSwapEffect = SWAPEFFECT_DISCARD;
#endif
switch(pLayerInit->uiPxlfmt)
{
case PXLFMT_INDEX1: 
pLayerInit->uiBufSize = (osd_w*osd_h)>>3; 
break;
case PXLFMT_INDEX2: 
pLayerInit->uiBufSize = (osd_w*osd_h)>>2; 
break;
case PXLFMT_INDEX4: 
pLayerInit->uiBufSize = (osd_w*osd_h)>>1; 
break;
case PXLFMT_INDEX8: 
pLayerInit->uiBufSize = (osd_w*osd_h)>>0; 
break;
}
pLayerInit->pBufAddr[0] = uiBufAddr;
#if (OSD_USE_DOUBLE_BUFFER == ENABLE)
pLayerInit->pBufAddr[1] = uiBufAddr + pLayerInit->uiBufSize;
#else
pLayerInit->pBufAddr[1] = 0;
#endif
pLayerInit->pBufAddr[2] = 0;
//dynamic window size
pLayerInit->win.x= 0;
pLayerInit->win.y = 0;
pLayerInit->win.w = DeviceSize.w;
pLayerInit->win.h = DeviceSize.h;
pLayerInit->uiWinAttr = 0;

#if (OSD_USE_ROTATE_BUFFER == ENABLE)
if(gbOsdRotate == 1)
{
DBG_MSG("^YEnable Rotate\r\n");
//prepare show DC
UINT32 buf_w = pLayerInit->uiWidth;
UINT32 buf_h = pLayerInit->uiHeight;
UINT32 win_w = pLayerInit->win.w;
UINT32 win_h = pLayerInit->win.h;
pLayerInit->uiWidth = buf_h;
pLayerInit->uiHeight = buf_w;
pLayerInit->uiBufCount = 0;
pLayerInit->uiSwapEffect = SWAPEFFECT_DISCARD;
pLayerInit->pBufAddr[0] = uiBufAddr;
pLayerInit->pBufAddr[1] = 0;
pLayerInit->pBufAddr[2] = 0;
pLayerInit->win.w = win_h;
pLayerInit->win.h = win_w;

        //prepare paint DC
        memset(pPaintDC, 0, sizeof(DC));
        GxGfx_AttachDC(pPaintDC, TYPE_FB,
                       pLayerInit->uiPxlfmt, buf_w, buf_h, buf_w,
                       (UINT8*)(uiBufAddr + pLayerInit->uiBufSize), 0, 0);
    }
    else
    {
        DBG_MSG("^YDisable Rotate\r\n");
    }
#endif

    r = GxDisplay_InitLayer(iDD, &LayerInit, bClear);
    UI_DirtyDisplaySource(iDD); //must force flush to update new swap-buffer and new swap-effect
    DBG_MSG("OSD1 buf=%08x, size=%08x\n\r",LayerInit.pBufAddr[0], LayerInit.uiBufSize);
    DBG_MSG("OSD1 buf.w=%d, buf.h=%d;\n\r",LayerInit.uiWidth, LayerInit.uiHeight);
    DBG_MSG("OSD1 win.w=%d, win.h=%d;\n\r",LayerInit.win.w, LayerInit.win.h);
//.........这里部分代码省略.........
开发者ID:magic-gjh,项目名称:NT96655_FHD6600,代码行数:101,代码来源:UIView.c


注:本文中的DBG_MSG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。