亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? frambufmgr.c

?? 6410BSP3
?? C
字號:
//
// Copyright (c) Samsung Electronics. Co. LTD.  All rights reserved.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

*/


#include "MfcMemory.h"
#include "FramBufMgr.h"
#include "MfcTypes.h"
#include "LogMsg.h"


// The size in bytes of the BUF_SEGMENT.
// The buffers are fragemented into the segment unit of this size.
#define BUF_SEGMENT_SIZE    1024


typedef struct
{
    unsigned char *pBaseAddr;
    int            idx_commit;
} SEGMENT_INFO;


typedef struct
{
    int index_base_seg;
    int num_segs;
} COMMIT_INFO;


static SEGMENT_INFO  *_p_segment_info = NULL;
static COMMIT_INFO   *_p_commit_info  = NULL;


static unsigned char *_pBufferBase  = NULL;
static int            _nBufferSize  = 0;
static int            _nNumSegs        = 0;


//
// int FramBufMgrInit(unsigned char *pBufBase, int nBufSize)
//
// Description
//        This function initializes the MfcFramBufMgr(Buffer Segment Manager)
// Parameters
//        pBufBase [IN]: pointer to the buffer which will be managed by this MfcFramBufMgr functions.
//        nBufSize [IN]: buffer size in bytes
// Return Value
//        1 : Success
//        0 : Fail
//
BOOL FramBufMgrInit(unsigned char *pBufBase, int nBufSize)
{
    int   i;

    // check parameters
    if (pBufBase == NULL || nBufSize == 0)
        return FALSE;


    // If the frame buffer is already initialized
    // (1) and the result of initialization equals input parameters,
    //     You have to return 1 immediately because this function is called by misatake.
    // (2) and the result of initialization does not equal input parameters,
    //     You have to re-initialize after finalize.
    if ((_pBufferBase != NULL) && (_nBufferSize != 0)) {
        if ((pBufBase == _pBufferBase) && (nBufSize == _nBufferSize))
            return TRUE;

        FramBufMgrFinal();
    }


    _pBufferBase = pBufBase;
    _nBufferSize = nBufSize;
    _nNumSegs = nBufSize / BUF_SEGMENT_SIZE;

    _p_segment_info = (SEGMENT_INFO *) Mem_Alloc(_nNumSegs * sizeof(SEGMENT_INFO));
    for (i=0; i<_nNumSegs; i++) {
        _p_segment_info[i].pBaseAddr   = pBufBase  +  (i * BUF_SEGMENT_SIZE);
        _p_segment_info[i].idx_commit  = 0;
    }

    _p_commit_info  = (COMMIT_INFO *) Mem_Alloc(_nNumSegs * sizeof(COMMIT_INFO));
    for (i=0; i<_nNumSegs; i++) {
        _p_commit_info[i].index_base_seg  = -1;
        _p_commit_info[i].num_segs        = 0;
    }


    return TRUE;
}


//
// void FramBufMgrFinal()
//
// Description
//        This function finalizes the MfcFramBufMgr(Buffer Segment Manager)
// Parameters
//        None
// Return Value
//        None
//
void FramBufMgrFinal()
{
    if (_p_segment_info != NULL) {
        Mem_Free(_p_segment_info);
        _p_segment_info = NULL;
    }

    if (_p_commit_info != NULL) {
        Mem_Free(_p_commit_info);
        _p_commit_info = NULL;
    }


    _pBufferBase  = NULL;
    _nBufferSize  = 0;
    _nNumSegs       = 0;
}


//
// unsigned char *FramBufMgrCommit(int idx_commit, int commit_size)
//
// Description
//        This function requests the commit for commit_size buffer to be reserved.
// Parameters
//        idx_commit  [IN]: pointer to the buffer which will be managed by this MfcFramBufMgr functions.
//        commit_size [IN]: commit size in bytes
// Return Value
//        NULL : Failed to commit (Wrong parameters, commit_size too big, and so on.)
//        Otherwise it returns the pointer which was committed.
//
unsigned char *FramBufMgrCommit(int idx_commit, int commit_size)
{
    int  i, j;

    int  num_fram_buf_seg;        // The number of Segment for frame buffer


    // Check Initialization
    if (_p_segment_info == NULL || _p_commit_info == NULL) {
        return NULL;
    }

    // check parameters
    if (idx_commit < 0 || idx_commit >= _nNumSegs)
        return NULL;
    if (commit_size <= 0 || commit_size > _nBufferSize)
        return NULL;

    // Check idx_commit'th value in COMMIT_INFO array is free or did alreay commit
    if (_p_commit_info[idx_commit].index_base_seg != -1)
        return NULL;


    // Get the number of required FRAM_BUF_SEGMENT
    // If the required size of Instance FRAM_BUF excess the FRAM_BUF_SEGMENT_SIZE unit,
    // You do need one more FRAM_BUF_SEGMENT.
    if ((commit_size % BUF_SEGMENT_SIZE) == 0)
        num_fram_buf_seg = commit_size / BUF_SEGMENT_SIZE;
    else
        num_fram_buf_seg = (commit_size / BUF_SEGMENT_SIZE)  +  1;

    for (i=0; i<(_nNumSegs - num_fram_buf_seg); i++) {
        // Check until finding a item that it didn't commit in SEGMENT
        if (_p_segment_info[i].idx_commit != 0)
            continue;

        for (j=0; j<num_fram_buf_seg; j++) {
            if (_p_segment_info[i+j].idx_commit != 0)
                break;
        }

        // If it is no commited SEGMENT from j = 0 to j = num_fram_buf_seg,
        // Commit here.
        if (j == num_fram_buf_seg) {

            for (j=0; j<num_fram_buf_seg; j++) {
                _p_segment_info[i+j].idx_commit = 1;
            }

            _p_commit_info[idx_commit].index_base_seg  = i;
            _p_commit_info[idx_commit].num_segs        = num_fram_buf_seg;

            return _p_segment_info[i].pBaseAddr;
        }
        else
        {
            // When there is a empty space between instance buffers,
            // if available space is very small for allocating new instance,
            // You have to skip this empty space and find other empty space.
            i = i + j - 1;
        }
    }

    return NULL;
}


//
// void FramBufMgrFree(int idx_commit)
//
// Description
//        This function frees the committed region of buffer.
// Parameters
//        idx_commit  [IN]: pointer to the buffer which will be managed by this MfcFramBufMgr functions.
// Return Value
//        None
//
void FramBufMgrFree(int idx_commit)
{
    int  i;

    int  index_base_seg;        // The index of base segment committed
    int  num_fram_buf_seg;      // The number of Segment for frame buffer


    // Check Initialization
    if (_p_segment_info == NULL || _p_commit_info == NULL)
        return;

    // check parameters
    if (idx_commit < 0 || idx_commit >= _nNumSegs)
        return;

    // Check idx_commit'th value in COMMIT_INFO array is free or did alreay commit
    if (_p_commit_info[idx_commit].index_base_seg == -1)
        return;


    index_base_seg    =  _p_commit_info[idx_commit].index_base_seg;
    num_fram_buf_seg  =  _p_commit_info[idx_commit].num_segs;

    for (i=0; i<num_fram_buf_seg; i++) {
        _p_segment_info[index_base_seg + i].idx_commit = 0;
    }


    _p_commit_info[idx_commit].index_base_seg  =  -1;
    _p_commit_info[idx_commit].num_segs        =  0;

}




//
// unsigned char *FramBufMgrGetBuf(int idx_commit)
//
// Description
//        This function obtains the committed buffer of 'idx_commit'.
// Parameters
//        idx_commit  [IN]: commit index of the buffer which will be obtained
// Return Value
//        NULL : Failed to get the indicated buffer (Wrong parameters, not committed, and so on.)
//        Otherwise it returns the pointer which was committed.
//
unsigned char *FramBufMgrGetBuf(int idx_commit)
{
    int index_base_seg;

    // Check Initialization
    if (_p_segment_info == NULL || _p_commit_info == NULL)
        return NULL;

    // check parameters
    if (idx_commit < 0 || idx_commit >= _nNumSegs)
        return NULL;

    // Check idx_commit'th value in COMMIT_INFO array is free or did alreay commit
    if (_p_commit_info[idx_commit].index_base_seg == -1)
        return NULL;


    index_base_seg  =  _p_commit_info[idx_commit].index_base_seg;

    return _p_segment_info[index_base_seg].pBaseAddr;
}

//
// int FramBufMgrGetBufSize(int idx_commit)
//
// Description
//        This function obtains the size of the committed buffer of 'idx_commit'.
// Parameters
//        idx_commit  [IN]: commit index of the buffer which will be obtained
// Return Value
//        0 : Failed to get the size of indicated buffer (Wrong parameters, not committed, and so on.)
//        Otherwise it returns the size of the buffer.
//        Note that the size is multiples of the BUF_SEGMENT_SIZE.
//
int FramBufMgrGetBufSize(int idx_commit)
{
    // Check Initialization
    if (_p_segment_info == NULL || _p_commit_info == NULL)
        return 0;

    // check parameters
    if (idx_commit < 0 || idx_commit >= _nNumSegs)
        return 0;

    // Check idx_commit'th value in COMMIT_INFO array is free or did alreay commit 
    if (_p_commit_info[idx_commit].index_base_seg == -1)
        return 0;


    return (_p_commit_info[idx_commit].num_segs * BUF_SEGMENT_SIZE);
}


//
// void FramBufMgrPrintCommitInfo()
//
// Description
//        This function prints the commited information on the console screen.
// Parameters
//        None
// Return Value
//        None
//
void FramBufMgrPrintCommitInfo()
{
    int  i;

    // Check Initialization
    if (_p_segment_info == NULL || _p_commit_info == NULL) {
        LOG_MSG(LOG_TRACE, "FramBufMgrPrintCommitInfo", "\n The FramBufMgr is not initialized.\n");
        return;
    }


    for (i=0; i<_nNumSegs; i++) {
        if (_p_commit_info[i].index_base_seg != -1)  {
            LOG_MSG(LOG_TRACE, "FramBufMgrPrintCommitInfo", "\n\nCOMMIT INDEX = [%03d], BASE_SEG_IDX = %d", i, _p_commit_info[i].index_base_seg);
            LOG_MSG(LOG_TRACE, "FramBufMgrPrintCommitInfo", "\nCOMMIT INDEX = [%03d], NUM OF SEGS  = %d", i, _p_commit_info[i].num_segs);
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美刺激脚交jootjob| 国产尤物一区二区| 欧美日韩综合一区| 亚洲成在人线免费| 日韩欧美视频一区| 国产福利精品一区| 中国av一区二区三区| 日本高清视频一区二区| 婷婷久久综合九色综合伊人色| 欧美日韩黄色一区二区| 久久99精品一区二区三区三区| www日韩大片| av在线播放成人| 亚洲成人手机在线| 精品国产区一区| 99精品欧美一区二区三区综合在线| 樱花草国产18久久久久| 91精品国产综合久久精品app| 激情久久五月天| 国产精品久久久久9999吃药| 欧美性猛交xxxx黑人交| 国内一区二区在线| 亚洲另类春色校园小说| 日韩三级视频在线看| 成人免费观看av| 三级影片在线观看欧美日韩一区二区| 精品国产a毛片| 色欧美片视频在线观看在线视频| 免费欧美高清视频| 国产精品夫妻自拍| 日韩网站在线看片你懂的| 99久久免费精品| 麻豆成人免费电影| 亚洲美女在线一区| 精品国产凹凸成av人导航| 色综合天天综合色综合av| 精品一区二区日韩| 亚洲国产中文字幕| 欧美激情一区二区在线| 欧美一区二区三区免费视频| 成人在线一区二区三区| 日韩av一区二区在线影视| 国产精品免费av| 精品999在线播放| 欧美伊人久久久久久久久影院| 国产美女主播视频一区| 午夜精品在线看| 亚洲欧美日韩电影| 久久久不卡网国产精品一区| 欧美日本视频在线| 一本色道久久综合亚洲91| 国产精品一卡二卡| 老司机精品视频一区二区三区| 亚洲激情一二三区| 中文字幕精品一区 | 成人福利视频网站| 卡一卡二国产精品| 亚洲第一福利一区| 亚洲女与黑人做爰| 中文一区在线播放| 久久综合久久综合久久综合| 日韩欧美中文字幕一区| 欧美人妖巨大在线| 欧美日韩免费不卡视频一区二区三区| 国产mv日韩mv欧美| 国产91精品免费| 极品美女销魂一区二区三区| 日产国产欧美视频一区精品| 亚洲国产精品一区二区久久恐怖片| 国产精品欧美一级免费| 国产欧美日韩视频一区二区| 精品国产乱码久久久久久蜜臀| 91精品久久久久久久91蜜桃| 欧美日本精品一区二区三区| 欧美性色综合网| 欧美日韩国产欧美日美国产精品| 欧美在线综合视频| 欧美怡红院视频| 欧美日韩电影一区| 91精品婷婷国产综合久久| 91精品欧美久久久久久动漫| 欧美剧在线免费观看网站 | 欧美日韩一区中文字幕| 91福利视频在线| 欧美三级三级三级爽爽爽| 欧美日韩国产成人在线91| 91精品国产免费| 欧美电视剧在线看免费| 久久精品视频免费| 亚洲国产成人私人影院tom| 国产精品国模大尺度视频| 综合av第一页| 亚洲成a人片在线不卡一二三区| 亚洲国产另类精品专区| 日韩av一级片| 国产精品夜夜嗨| 成人97人人超碰人人99| 色婷婷久久一区二区三区麻豆| 欧美日韩中文字幕一区| 91麻豆精品91久久久久久清纯 | 日韩经典中文字幕一区| 日本一区中文字幕| 韩国一区二区视频| 99久久精品国产一区| 欧美亚洲精品一区| 精品少妇一区二区| 国产精品久久久久三级| 亚洲一区二区三区视频在线 | 亚洲精品老司机| 天堂av在线一区| 国产一区日韩二区欧美三区| 9i在线看片成人免费| 欧美日韩在线电影| 亚洲国产电影在线观看| 亚洲国产精品自拍| 国产成a人亚洲| 日韩欧美电影一区| 国产欧美日韩久久| 天天射综合影视| 国产成人精品综合在线观看| 色视频欧美一区二区三区| 日韩精品一区在线观看| 综合av第一页| 裸体歌舞表演一区二区| 91美女精品福利| 久久综合视频网| 一区二区三区电影在线播| 国产精品一级片在线观看| 欧美日韩一区二区三区免费看| 国产午夜精品久久久久久久| 亚洲午夜av在线| 成人网页在线观看| 日韩欧美在线网站| 亚洲一区在线视频观看| 高清av一区二区| 欧美一区二区在线免费播放| 亚洲人成网站精品片在线观看| 麻豆91在线观看| 欧美日韩国产小视频在线观看| 国产农村妇女精品| 久久99深爱久久99精品| 精品视频在线看| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 一区二区三区在线免费视频| 国产一区不卡在线| 日韩一区二区在线观看| 亚洲超碰97人人做人人爱| 风间由美中文字幕在线看视频国产欧美| 91精品国产一区二区人妖| 一区二区三区中文字幕精品精品| 国产宾馆实践打屁股91| 欧美电视剧免费观看| 日韩高清一区在线| 欧美日韩国产精品成人| 亚洲国产精品自拍| 色妞www精品视频| 综合色天天鬼久久鬼色| 成+人+亚洲+综合天堂| 日本一区二区三区久久久久久久久不 | 日韩福利视频导航| 欧洲亚洲精品在线| 一区二区在线免费| 色婷婷综合久久久久中文| 亚洲欧洲99久久| 9色porny自拍视频一区二区| 亚洲欧洲日韩女同| 99久久精品99国产精品| 国产精品国产三级国产aⅴ中文| 岛国精品一区二区| 国产精品乱码人人做人人爱| 国产sm精品调教视频网站| 中文在线一区二区| 色综合咪咪久久| 一区二区三区四区国产精品| 91久久人澡人人添人人爽欧美| 亚洲男人的天堂在线观看| 欧美综合色免费| 午夜欧美2019年伦理| 欧美一级黄色录像| 国产在线一区二区| 亚洲国产成人在线| 95精品视频在线| 亚洲成人一二三| 日韩免费视频一区| 高清成人在线观看| 亚洲色图欧美激情| 在线播放91灌醉迷j高跟美女| 日韩av在线免费观看不卡| 亚洲精品一区二区三区在线观看 | 中文字幕国产一区| 色一区在线观看| 天天影视涩香欲综合网| 精品国产亚洲在线| 成人国产一区二区三区精品| 一区二区三区在线不卡| 亚洲综合一区在线| 国产伦精品一区二区三区在线观看| 欧美日韩另类一区| 精品一区二区三区的国产在线播放| 国产欧美日韩一区二区三区在线观看|