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

📄 mv_itv.c

📁 tuner扫描
💻 C
📖 第 1 页 / 共 2 页
字号:
/*==========================================================================*/
/*     (Copyright (C) 2003 Koninklijke Philips Electronics N.V.             */
/*     All rights reserved.                                                 */
/*     This source code and any compilation or derivative thereof is the    */
/*     proprietary information of Koninklijke Philips Electronics N.V.      */
/*     and is confidential in nature.                                       */
/*     Under no circumstances is this software to be exposed to or placed   */
/*     under an Open Source License of any type without the expressed       */
/*     written permission of Koninklijke Philips Electronics N.V.           */
/*==========================================================================*/
/*==========================================================================*/
/*
       SOURCE_FILE:    MV_INT.C.C

       PACKAGE:        ITV
       COMPONENT:      MV

       (C) 1998: Philips Semiconductors
                                                                            */
/*==========================================================================*/
/*==========================================================================*/
/*       I N C L U D E S                                                    */
/*==========================================================================*/
#include <standard.h>   /* Standard type declarations                  */
#include "tmosal.h"
#include "mv_drv.h"     /* Register layer                              */
#include "mv_itvl.h"    /* externals for this package                  */
#include "ipvd_dbgl.h"    /* DEBUG package                               */


#define MV_ITV_PRIORITY_INTERRUPT 8
/*==========================================================================*/
/*       G L O B A L   D A T A   D E C L A R A T I O N S                    */
/*==========================================================================*/

unsigned long GV_itv_video_status;
unsigned long GV_itv_error_event;
unsigned long GV_itv_fbm_event;
unsigned long GV_itv_video_event;
unsigned long GV_itv_system_event;


/*==========================================================================*/
/*       L O C A L   S Y M B O L   D E F I N I T I O N S                    */
/*==========================================================================*/
typedef struct MV_ITV_ISR_TABLE_STRUCT
{
     void     (*isr)(void);
} MV_ITV_ISR_TABLE;

typedef struct MV_ITV_STATUS_STRUCT
{
    volatile unsigned long irpt_mask_video;

#ifdef DV_DEBUG
    volatile unsigned long irpt_debug_mask_video;
#endif

    MV_ITV_ISR_TABLE       isr_table[MV_ITV_MAX_INDEX];

} MV_ITV_STATUS;

/*==========================================================================*/
/*       L O C A L   D A T A   D E C L A R A T I O N S                      */
/*==========================================================================*/

static MV_ITV_STATUS       LV_MV_ITV_status;
static tmosalIntHandle_t LV_handle;

/*==========================================================================*/
/*       L O C A L   F U N C T I O N S   P R O T O T Y P E S                */
/*==========================================================================*/
static void LF_isr     ( void *);
static void LF_dummy_isr ( void );

/*==========================================================================*/
/*       G L O B A L  F U N C T I O N S                                     */
/*==========================================================================*/

/*MPF=======================================================================*/
/*
    FUNCTION NAME:  MV_ITV_init
    DESCRIPTION:
        Set up the interrupt driver.

    RETURNS:
    CALLING SEQUENCE:
*/
void
MV_ITV_init(
void )
/*EMP=======================================================================*/
{
   tmErrorCode_t error;
   tmosalIntDescriptor_t setup;

   MV_ITV_set_defaults();

   error = tmosalIntCreate("VIDEO", &LV_handle, tmosalIntCreateFlagNone);

   if (error == TM_OK)
   {
      setup.interruptible = False;
      setup.enabled = True;
      setup.pHandler = (void (*)(void *))LF_isr;
      setup.priority = MV_ITV_PRIORITY_INTERRUPT;
      setup.pContextArgument = Null;

      tmosalIntInstanceSetup(LV_handle, &setup);
   }
   else
   {
      DV_DBG_STORE_EVENT(IPVD_DBG_EV_TMOSAL_ERROR,
                         IPVD_DBG_MAJOR_BEHAVIOR_LEVEL,
                         IPVD_INT_CREATE, error, 0, 0); // Log the error
   }
   
} /* End MV_ITV_init */

/*MPF=======================================================================*/
/*
    FUNCTION NAME:  MV_ITV_set_defaults
    DESCRIPTION:
        Returns the MV_ITV package to it's default settings.

    RETURNS:
    CALLING SEQUENCE:
*/
void
MV_ITV_set_defaults(
void )
/*EMP=======================================================================*/
{
   unsigned long lv_index;

    /* Set the masks initially to zero */
   LV_MV_ITV_status.irpt_mask_video = 0;

   MV_drv_set_video_int_enable(0);

   /* Initialize ISR table */
   for ( lv_index = 0; lv_index < MV_ITV_MAX_INDEX; lv_index++ )
   {
      /* Install for all interrupts the dummy ISR */
      LV_MV_ITV_status.isr_table[lv_index].isr = LF_dummy_isr;
   }

} /* End MV_ITV_set_defaults */

/*MPF=======================================================================*/
/*
    FUNCTION NAME:  MV_ITV_term
    DESCRIPTION:
        Frees all resources allocated by the MV_ITV package. After this
        call only MV_ITV_init() may be called.

    RETURNS:
    CALLING SEQUENCE:
*/
void
MV_ITV_term(
void )
/*EMP=======================================================================*/
{   
   tmErrorCode_t error;

   /* Deinstall ISR */
   error = tmosalIntDestroy(LV_handle);
   
   if (error != TM_OK)
   {
      DV_DBG_STORE_EVENT(IPVD_DBG_EV_TMOSAL_ERROR,
                         IPVD_DBG_MAJOR_BEHAVIOR_LEVEL,
                         IPVD_INT_DESTROY, error, 0, 0); // Log the error
   }      
    
} /* End MV_ITV_term */

/*MPF=======================================================================*/
/*
    FUNCTION NAME:    MV_ITV_install_isr
    DESCRIPTION:
        Install an interrupt service routine for an
        interrupt source in the interrupt status register.
        The installed service routine will be called when the
        specified source causes an interrupt.

    NOTES:
        The irpt source can be enabled by setting 'enable' to
        TRUE, and can be disabled and enabled by calling
        MV_ITV_enable_irpt and MV_ITV_disable_irpt.
        For the interrupt to occur the irpt source must be enabled.

    RETURNS:
    CALLING SEQUENCE:
*/
void
MV_ITV_install_isr(
void            (*in_isr_ptr)(void),  /* In: Irpt service routine           */
MV_ITV         in_index,             /* In: Irpt source for isr            */
BOOLEAN        in_enable             /* In: Irpt initialy enabled          */
)
/*EMP=======================================================================*/
{
    UInt32 lv_protection_level;

    tmosalDisableInterruptsNoSysCall(&lv_protection_level);

    /* Install ISR */
    LV_MV_ITV_status.isr_table[in_index].isr = in_isr_ptr;

    /* Enable the interrupt source for the IRQ */
    if ( in_enable == TRUE )
    {
       LV_MV_ITV_status.irpt_mask_video |= (0x0001 << in_index);
       MV_drv_set_video_int_enable( LV_MV_ITV_status.irpt_mask_video);

    }

    tmosalEnableInterruptsNoSysCall(lv_protection_level);
}

/*MPF=======================================================================*/
/*
    FUNCTION NAME:    MV_ITV_deinstall_isr
    DESCRIPTION:
        De-install an interrupt service routine for an
        interrupt source in the interrupt status register.

    RETURNS:
    CALLING SEQUENCE:
*/
void
MV_ITV_deinstall_isr(
MV_ITV         in_index             /* In: Irpt source for isr */
)
/*EMP=======================================================================*/
{
    UInt32 lv_protection_level;

    tmosalDisableInterruptsNoSysCall(&lv_protection_level);

        /* Install dummy ISR */
    LV_MV_ITV_status.isr_table[in_index].isr = LF_dummy_isr;

    /* Disable the interrupt source for the IRQ */
    LV_MV_ITV_status.irpt_mask_video &= ~(0x0001 << in_index);
    MV_drv_set_video_int_enable ( LV_MV_ITV_status.irpt_mask_video);

    tmosalEnableInterruptsNoSysCall(lv_protection_level);
}

/*MPF=======================================================================*/
/*
    FUNCTION NAME:    MV_ITV_enable_irpt
    DESCRIPTION:
        Enable an interrupt source.

    RETURNS:
    CALLING SEQUENCE:
*/
void
MV_ITV_enable_irpt(
MV_ITV         in_index  /* In: Irpt source for isr  */

⌨️ 快捷键说明

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