⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xp_osi_chann.c

📁 IBM source for pallas/vulcan/vesta
💻 C
📖 第 1 页 / 共 3 页
字号:
||  ERRORS     :  XP_ERROR_CHANNEL_INVALID      -  channel id is not defined|                XP_ERROR_CHANNEL_UNDEFINED_UT -  unload type not defined||  COMMENTS   :  defines the type of data to unload for the channel.|+----------------------------------------------------------------------------*/SHORT xp_osi_channel_get_unload_type(GLOBAL_RESOURCES *pGlobal, SHORT wChannelId,                                     XP_CHANNEL_UNLOAD_TYPE *pUnloadType){    SHORT wRc;//    xp_os_semaphore_wait();    wRc = xp_osi_channel_valid(pGlobal,wChannelId);    if(wRc == 0)    {        if(pGlobal->ChannInfo.XpChannelData[wChannelId].UnloadType ==            XP_CHANNEL_UNLOAD_UNDEFINED)        {           wRc = XP_ERROR_CHANNEL_UNDEFINED_UT;        }    }    if(wRc == 0) {        *pUnloadType = pGlobal->ChannInfo.XpChannelData[wChannelId].UnloadType;    }//    xp_os_semaphore_signal();    return(wRc);}/*----------------------------------------------------------------------------+|  xp0_channel_set_key+-----------------------------------------------------------------------------+||  DESCRIPTION:  set up a packet identifier for the channel||  PROTOTYPE  :  SHORT xp0_channel_set_key(|                SHORT wChannelId,|                XP_CHANNEL_DESCRAMBLE descram,|                USHORT keyId)||  ARGUMENTS  :  wChannelId    -  id returned from xp0_channel_allocate()|                descram       -  type of UnloadTypebling for this channel|                keyId         -  key set number for descrambling keys||  RETURNS    :  zero if successful, non-zero if an error occurs||  ERRORS     :  XP_ERROR_CHANNEL_INVALID||  COMMENTS   :  The xp0_channel_set_key() defines the descrambling type|                and key set associated with the channel.  The values of|                this API take effect on the channel with the next call|                to the xp0_channel_set_pid() function for the same channel|                id.   The 'descram' parameter defines the type of|                hardware descrambling available.  The following values|                are available:|                     XP_DESCRAMBLE_TS   -  descramble transport packets|                     XP_DESCRAMBLE_PES  -  descramble pes portion of packets|                     XP_DESCRAMBLE_OFF  -  no descrambling required|                The keyId refers to a key set which is setup using the|                xp0_key_set() or xp0_key_setall() API's.|+----------------------------------------------------------------------------*/SHORT xp_channel_set_key(          /* set the next scrambling level        */                         GLOBAL_RESOURCES *pGlobal,                         SHORT wChannelId,                         XP_CHANNEL_DESCRAMBLE Descram,      /* 0=ts level, 1=PES, 2=none            */                         USHORT uwKeyId)               /* key number to use                    */{    SHORT wRc;//    xp_os_semaphore_wait();    if(((SHORT) uwKeyId < 0) || (uwKeyId >= XP_KEY_INDEX_COUNT))    {        wRc = XP_ERROR_KEY_INDEX;    }    else    {        wRc = xp_osi_channel_valid(pGlobal,wChannelId);    }    if(wRc == 0)    {        pGlobal->ChannInfo.XpChannelData[wChannelId].Descram = Descram;        pGlobal->ChannInfo.XpChannelData[wChannelId].uwKeyId = uwKeyId;    }//    xp_os_semaphore_signal();    return(wRc);}/*----------------------------------------------------------------------------+|  xp0_channel_set_notification_fn+-----------------------------------------------------------------------------+||  DESCRIPTION:  register a callback function when data is available||  PROTOTYPE  :  SHORT xp0_channel_set_notification_fn(|                SHORT wChannelId,|||                typedef void (*XP_CHANNEL_NOTIFY_FN)|||                typedef struct xp0_channel_notify_data {|                    SHORT wChannelId;|                    ULONGmatch_word;|                    unsigned char *data;|                    ULONGlength;|                } XP_CHANNEL_NOTIFY_DATA;||  ARGUMENTS  :  wChannelId    -  the channel id as returned from the|                                 xp0_channel_allocate().|                notify_fn     -  address of the callback function||  RETURNS    :  0 if successful, or non-zero if an error occurs||  ERRORS     :  XP_ERROR_CHANNEL_INVALID  -  channel id is not defined||  COMMENTS   :  registers a function which is called when data for the|                channel has been delivered to DRAM.  The data structure|                XP_CHANNEL_NOTIFY_DATA is passed as a parameter to the|                callback function and provides:|                      wChannelId      - channel containing the data|                      match_word      - filter group id's which matched|                      data            - pointer to data in DRAM|                      length          - length of the available data|                Note:  the match_word is 0 for all types of data unloaded|                except the filtered table sections.|+----------------------------------------------------------------------------*/SHORT xp_osi_channel_set_notification_fn(GLOBAL_RESOURCES *pGlobal, SHORT wChannelId,                                         XP_CHANNEL_NOTIFY_FN notify_fn){    SHORT wRc;    ULONG ulMask;    XP_INTERRUPT_CHANNEL_FN callback_fn;//    xp_os_semaphore_wait();    wRc = xp_osi_channel_valid(pGlobal,wChannelId);    /*------------------------------------------------------------------------+    |  Make sure the unload type is defined first    +------------------------------------------------------------------------*/    if(wRc == 0)    {        if (pGlobal->ChannInfo.XpChannelData[wChannelId].UnloadType ==            XP_CHANNEL_UNLOAD_UNDEFINED)        {            wRc = XP_ERROR_CHANNEL_UNDEFINED_UT;        }    }    if (wRc == 0)    {        if(pGlobal->ChannInfo.XpChannelData[wChannelId].UnloadType < 8)        {            if(pGlobal->ChannInfo.XpChannelData[wChannelId].UnloadType == XP_CHANNEL_UNLOAD_TRANSPORT)              ulMask = XP_INTERRUPT_QSTAT_RPI | XP_INTERRUPT_QSTAT_BTI;            else              ulMask = CHANNEL_NOTIFY_STREAM_MASK;        }        else        {            ulMask = CHANNEL_NOTIFY_SECTION_MASK;        }        /*--------------------------------------------------------------------+        |  If there is a notification function specified, then setup the        |  interrupts to receive notification when table section is available        +--------------------------------------------------------------------*/        pGlobal->ChannInfo.XpChannelData[wChannelId].notify_fn = notify_fn;        callback_fn = (XP_INTERRUPT_CHANNEL_FN) channel_data_notify;        if(notify_fn == (XP_CHANNEL_NOTIFY_FN) NULL)        {            xp_osi_interrupt_channel_notify(pGlobal,XP_INTERRUPT_NOTIFY_DELETE,            wChannelId, ulMask, callback_fn);        }        else        {            xp_osi_interrupt_channel_notify(pGlobal,XP_INTERRUPT_NOTIFY_ADD,            wChannelId,ulMask, callback_fn);        }    }//    xp_os_semaphore_signal();    return(wRc);}/*----------------------------------------------------------------------------+|  xp0_channel_set_pid+-----------------------------------------------------------------------------+||  DESCRIPTION:  set up a packet identifier for the channel||  PROTOTYPE  :  SHORT xp0_channel_set_pid(|                SHORT wChannelId,|                USHORT pid)||  ARGUMENTS  :  wChannelId    -  id returned from xp0_channel_allocate()|                pid           -  packet identifier||  RETURNS    :  zero if successful, non-zero if an error occurs||  ERRORS     :  XP_ERROR_CHANNEL_INVALID||  COMMENTS   :  The xp0_channel_set_pid() updates the current pid value|                associated with the channel.  If the channel was enabled|                using the xp0_channel_control() function, then the new|                pid is written to the transport demux hardware.  If the|                channel is not currently enabled, the pid value is|                retained and written to hardware when the channel is|                enabled.|+----------------------------------------------------------------------------*/SHORT xp_osi_channel_set_pid(GLOBAL_RESOURCES *pGlobal, SHORT wChannelId, USHORT uwPid){    SHORT               wRc;    SHORT               wChid;    ULONG               ulAddr;    ULONG               ulValue=0;    XP_PID_FILTER_REGP  p;    UINT32              flag;//    xp_os_semaphore_wait();    /*------------------------------------------------------------------------+    |  Map the channel change Pid to a real pid    +------------------------------------------------------------------------*/    if(wChannelId == XP_CHANNEL_CC_AUDIO)    {        wChid = XP_CHANNEL_AUDIO;        ulAddr = XP_DCR_ADDR_ACCHNG;    }    else if(wChannelId == XP_CHANNEL_CC_VIDEO)    {        wChid = XP_CHANNEL_VIDEO;        ulAddr = XP_DCR_ADDR_VCCHNG;    }    else    {        wChid = wChannelId;        ulAddr = XP_DCR_ADDR_BASE_PID + wChid;    }    wRc = xp_osi_channel_valid(pGlobal,wChid);    if(wRc == 0)    {        p       = (XP_PID_FILTER_REGP)(void *)&ulValue;        p->kid  = pGlobal->ChannInfo.XpChannelData[wChid].uwKeyId;        p->pidv = (pGlobal->ChannInfo.XpChannelData[wChid].Status == XP_CHANNEL_ENABLED)                   ? uwPid : XP_CHANNEL_NULL_PID;        switch(pGlobal->ChannInfo.XpChannelData[wChid].Descram)        {        case XP_DESCRAMBLE_TS:            p->denbl = 1;            p->pesl  = 0;            break;        case XP_DESCRAMBLE_PES:            p->denbl = 1;            p->pesl  = 1;            break;        default:            p->denbl = 0;            p->pesl  = 0;            break;        }        pGlobal->ChannInfo.XpChannelData[wChid].uwPid = uwPid;        flag = os_enter_critical_section();        xp_atom_dcr_write(pGlobal->uDeviceIndex,ulAddr, ulValue);        os_leave_critical_section(flag);    }//    xp_os_semaphore_signal();    return(wRc);}/*----------------------------------------------------------------------------+|  xp0_channel_set_unload_type+-----------------------------------------------------------------------------+||  DESCRIPTION:  define the type of data to unload on this channel||  PROTOTYPE  :  SHORT xp0_channel_set_unload_type(|                SHORT wChannelId,|                XP_CHANNEL_UNLOAD_TYPE unload_type)||  ARGUMENTS  :  wChannelId    -  the channel id as returned from the|                                 xp0_channel_allocate().|                unload_type   -  type of data to unload||                    XP_CHANNEL_UNLOAD_TRANSPORT|                    XP_CHANNEL_UNLOAD_ADAPTATION|                    XP_CHANNEL_UNLOAD_ADAPTATION_PRIVATE|                    XP_CHANNEL_UNLOAD_PAYLOAD|                    XP_CHANNEL_UNLOAD_PAYLOAD_AND_BUCKET|                    XP_CHANNEL_UNLOAD_BUCKET|                    XP_CHANNEL_UNLOAD_PSI|                    XP_CHANNEL_UNLOAD_FILTER_PSI|                    XP_CHANNEL_UNLOAD_PSI_CRC|                    XP_CHANNEL_UNLOAD_FILTER_PSI_CRC|                    XP_CHANNEL_UNLOAD_PSI_BUCKET|                    XP_CHANNEL_UNLOAD_FILTER_PSI_BUCKET|                    XP_CHANNEL_UNLOAD_PSI_CRC_BUCKET|                    XP_CHANNEL_UNLOAD_FILTER_PSI_CRC_BUCKET||  RETURNS    :  0 if successful, or non-zero if an error occurs||  ERRORS     :  XP_ERROR_CHANNEL_INVALID  -  channel id is not defined||  COMMENTS   :  defines the type of data to unload for the channel.  The|                application should disable the channel before changing|                the unload type.|+----------------------------------------------------------------------------*/SHORT xp_osi_channel_set_unload_type(GLOBAL_RESOURCES *pGlobal,SHORT wChannelId,                                     XP_CHANNEL_UNLOAD_TYPE UnloadType){    SHORT wRc;    UINT32  flag;//    xp_os_semaphore_wait();    wRc = xp_osi_channel_valid(pGlobal,wChannelId);    if(wRc == 0)    {        if(( (int)UnloadType < XP_CHANNEL_UNLOAD_TRANSPORT) ||             (UnloadType >= XP_CHANNEL_UNLOAD_UNDEFINED))        {            wRc = XP_ERROR_CHANNEL_UNDEFINED_UT;        }    }    if(wRc == 0)    {        if(pGlobal->ChannInfo.XpChannelData[wChannelId].Status == XP_CHANNEL_ENABLED)        {            wRc = XP_ERROR_CHANNEL_ENABLED;        }    }    if(wRc == 0)    {        flag = os_enter_critical_section();        xp_atom_dcr_write_register_channel(pGlobal->uDeviceIndex, XP_QCONFIGB_REG_DTYPE,        wChannelId, UnloadType);        os_leave_critical_section(flag);        pGlobal->ChannInfo.XpChannelData[wChannelId].UnloadType = UnloadType;    }//    xp_os_semaphore_signal();    return(wRc);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -