Exemplo n.º 1
0
DEMOD_STATUS cnxt_lnb_set_tone_enable( NIM *pNIM, bool enable )
{
    #if RTOS != NOOS
        int api_error;
    #endif /* RTOS != NOOS */
    #if (LNB_22KHZ_CONTROL == LNB_22KHZ_ENABLE)
        LNBMODE lnbmode;
    #else
        LNBTONE tone;
    #endif

    #if (LNB_22KHZ_CONTROL == LNB_22KHZ_ENABLE)
        if ( enable == FALSE )
        {
            lnbmode.lnb_mode = LNBMODE_MANUAL_ZERO;
        }
        else
        {
            lnbmode.lnb_mode = LNBMODE_MANUAL_ONE;
        }
        if ( !API_SetLNBMode( pNIM, &lnbmode ) )
        {
        #if RTOS != NOOS
            trace_new( TL_ERROR, "API_SetLNBMode failed. "
                    "File: %s, line: %d\n", API_GetErrorFilename( pNIM ),
                    API_GetErrorLineNumber( pNIM ) );
            api_error = API_GetLastError( pNIM );
            trace_new( TL_ERROR, "Error %d, %s\n", api_error,
                    API_GetErrorMessage( pNIM, (APIERRNO)api_error) );
        #endif /* RTOS != NOOS */
            return DEMOD_ERROR;
        }
    #else
        if ( enable )
        {
            tone = LNBTONE_ON;
        }
        else
        {
            tone = LNBTONE_OFF;
        }
        if ( !API_SetLNBTone( pNIM, tone ) )
        {
        #if RTOS != NOOS
            trace_new( TL_ERROR, "API_SetLNBTone failed. File: %s, line: %d\n",
                    API_GetErrorFilename( pNIM ),
                    API_GetErrorLineNumber( pNIM ) );
            api_error = API_GetLastError( pNIM );
            trace_new( TL_ERROR, "Error %d, %s\n", api_error,
                    API_GetErrorMessage( pNIM, (APIERRNO)api_error) );
        #endif /* RTOS != NOOS */
            return DEMOD_ERROR;
        }
    #endif

    lnb_state.tone_enabled = enable;
    return DEMOD_SUCCESS;
}
Exemplo n.º 2
0
DEMOD_STATUS cnxt_lnb_set_polarization( NIM *pNIM,
        NIM_SATELLITE_POLARISATION polarization )
{
    #if RTOS != NOOS
      int api_error;
    #endif /* RTOS != NOOS */
    LNBPOL polarization_voltage;

    lnb_state.polarization = polarization;
    
    /* Polarization voltage is calculated the same way for all LNB types. */
    switch ( polarization )
    {
        case M_HORIZONTAL:
            polarization_voltage = (LNBPOL)(
                    lnb_parameters.horizontal_voltage == V_12VOLTS ?
                        LNB_LOW : LNB_HIGH );
            break;
        case M_LEFT:
            polarization_voltage = (LNBPOL)( lnb_parameters.left_voltage ==
                    V_12VOLTS ? LNB_LOW : LNB_HIGH );
            break;
        case M_VERTICAL:
            polarization_voltage = (LNBPOL)( lnb_parameters.vertical_voltage ==
                    V_12VOLTS ? LNB_LOW : LNB_HIGH );
            break;
        case M_RIGHT:
            polarization_voltage = (LNBPOL)( lnb_parameters.right_voltage ==
                    V_12VOLTS ? LNB_LOW : LNB_HIGH );
            break;
        default:
#if RTOS != NOOS
            error_log( ERROR_WARNING | RC_SDM_BADVAL );
#endif /* RTOS != NOOS */
            polarization_voltage = (LNBPOL)( lnb_parameters.right_voltage ==
                    V_12VOLTS ? LNB_LOW : LNB_HIGH );
            lnb_state.polarization = M_RIGHT;
    }

    if ( !API_SetLNBDC( pNIM, polarization_voltage ) )
    {
    #if RTOS != NOOS
        trace_new( TL_ERROR, "API_SetLNBDC failed. File: %s, line: %d\n",
                API_GetErrorFilename( pNIM ),
                API_GetErrorLineNumber( pNIM ) );
        api_error = API_GetLastError( pNIM );
        trace_new( TL_ERROR, "Error %d, %s\n", api_error,
                API_GetErrorMessage( pNIM, (APIERRNO)api_error) );
    #endif /* RTOS != NOOS */
        return DEMOD_ERROR;
    }
    
    return DEMOD_SUCCESS;
}
Exemplo n.º 3
0
// trace api
static int
_trace_new(lua_State *L) {
    struct trace_pool *p = lua_touserdata(L,1);
    struct trace_info *t = trace_new(p);
    lua_pushlightuserdata(L,t);
    return 1;
}
Exemplo n.º 4
0
// trace api
static int
_trace_new(lua_State *L) {
    struct trace_pool *p = lua_touserdata(L,1);
    struct trace_info *t = trace_new(p);
    if (t==NULL) {
        return luaL_error(L, "Last trace didn't close");
    }
    lua_pushlightuserdata(L,t);
    return 1;
}
Exemplo n.º 5
0
DEMOD_STATUS cnxt_lnb_set_output_enable( NIM *pNIM, bool enable )
{
    #if (INTERNAL_DEMOD == INTERNAL_COBRA_LIKE)
    #else
      #if RTOS != NOOS
        int api_error;
      #endif /* RTOS != NOOS */
    #endif

    /* Set up the LNB enable signal.  It is different for internal/external. */
    #if (INTERNAL_DEMOD == INTERNAL_COBRA_LIKE)
        /* LNB enable signal is driven from the PIO expander; set to 1 to
           enable, 0 to disable. */
        cnxt_gpio_set_output_level( PIO_LNB_ENABLE, enable );
        lnb_state.enabled = enable;
    #else
        /* Cobra GPIO4 is the enable for the external LNB signal generator;
           set to 1 to enable, 0 to disable. */
        if ( RegisterWrite( pNIM, CX24130_GPIO4VAL, enable ) == True )
        {
            lnb_state.enabled = enable;
        }
        else
        {
        #if RTOS != NOOS
            trace_new( TL_ERROR,
                    "Cobra demod failed to write to LNB signal enable"
                    " (GPIO4).\n" );
            trace_new( TL_ERROR, "File: %s, line: %d\n",
                    API_GetErrorFilename(pNIM),
                    API_GetErrorLineNumber(pNIM) );
            api_error = API_GetLastError( pNIM );
            trace_new( TL_ERROR, "Error %d, %s\n", api_error,
                    API_GetErrorMessage(pNIM, (APIERRNO)api_error) );
        #endif /* RTOS != NOOS */
            return DEMOD_ERROR;
        }
    #endif
    return DEMOD_SUCCESS;
}
Exemplo n.º 6
0
/*  is_route_legal checks to see if the route is allowed
    using the data defined above.  It could also checks to see
    if the resource is available.  

 returns 1 for legal route
           0 for busy route (optional)
          -1 for an illegal route

*/
int is_route_legal(HSDP_PORT src, HSDP_PORT dest)  {
    /* HSDP_DEMUX2 is the highest enumerated HSDP_PORT. 
       If its greater than DEMUX2 its invalid  */
    if ((src > HSDP_DEMUX2) || (dest > HSDP_DEMUX2))  {
        trace_new(TRACE_LEVEL_3 | TRACE_DPS, "HSDP: ERROR:  The source or destination is invalid.\n", src, dest);
        return(-1);
    } 
    if (legal_routes[src][dest]) {
        /* if (busy_routes[src][dest]) return(0); */
        return(1);
    } else {
        return -1;
    }
    
}
Exemplo n.º 7
0
Arquivo: main.c Projeto: 4n3w/dump
int main(int argc, char **argv) {
	if (argc < 2) {
		fprintf(stderr, "Usage: %s command [arguments ...]\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	struct trace *trace = trace_new(process_new, NULL);

	int pid = trace_execvp(trace, &argv[1]);
	char buf[1024];
	argv_join(buf, sizeof(buf), &argv[1], " ");
	fprintf(stderr, "[+] pid=%i, running: %s\n", pid, buf);

	while (trace_process_count(trace) > 0) {
		trace_read(trace);
	}

	trace_free(trace);

	return 0;
}
Exemplo n.º 8
0
/***************************************************************************
 GfxInit
***************************************************************************/
void GfxInit (u_int8 Bpp)
{

#ifdef PCI_GXA
u_int32 PixelDepth;

   /* Initialize the 2164 PCI card for GUI operations */
   InitPCICard();

   /* Setup the GUI Fifo register for no dram queue */
   mLoadReg(GFIFO_CTRL_REG,GXA_FIFO_DEFAULT)

   /* Setup the GUI config register for the optimizations, transparency,
    * and pixel depth to use.
    */
   switch (Bpp) {
      case 8:
         PixelDepth = DEPTH_8BPP;
         break;
      case 16:
         PixelDepth = DEPTH_16BPP_0565;
         break;
      case 32:
         PixelDepth = DEPTH_32BPP;
         break;
      default:
         PixelDepth = DEPTH_8BPP;
   }
   /* Setup the GXA_CONFIG register */
   mLoadReg(GXA_CFG_REG,GXA_CFG_DEFAULT|PixelDepth)

#else
   /* Setup the GXA_CONFIG register */
   mLoadReg(GXA_CFG_REG,GXA_CFG_DEFAULT)

   /* Setup the GXA_CONFIG2 register */
   mLoadReg(GXA_CFG2_REG,GXA_CFG2_DEFAULT)

#endif

   /* Initialize the blit control, line control, and dest xy increment regs */
   mLoadReg(GXA_BLT_CONTROL_REG,0)
   mLoadReg(GXA_LINE_CONTROL_REG,LINE_CONTROL_DEFAULT)
   mLoadReg(GXA_DST_XY_INC_REG,0)

   mWaitForIdle

   if ( Bpp > 8) {
      mSetFGColor(0xFFFFFFFF)
   } else {
      mSetFGColor(0x0F0F0F0F)
   }
   mSetBGColor(0)

   mSetLinePattern(0xFFFFFFFF)

   /* If GXA_Sem_Id is 0 allocate a semaphore for serializing
    * access to the GXA registers.
    */
   if ( GXA_Sem_Id == 0 )
   {
      if ((GXA_Sem_Id = sem_create(1, "GXA1")) == 0)
      {
         trace_new(TRACE_GCP,"GXA: Sem Create Failed\n");
         error_log(ERROR_FATAL|MOD_GXA);
      }
      
      /* Only initialise the ISR if this is the first call to GfxInit (as */
      /* indicated by the fact that the semaphore ID was 0)               */
    	GXAIsrInit();
   }
}
Exemplo n.º 9
0
DEMOD_STATUS cnxt_lnb_init( NIM *pNIM )
{
    #if (INTERNAL_DEMOD == INTERNAL_COBRA_LIKE)
    #else
      #if RTOS != NOOS
        int api_error;
      #endif /* RTOS != NOOS */
    #endif

    /* Set the PIO that controls the direction of the 22KHz signal for output
       as the initial setting.  Any DiSEqC input will need to change it. */
    #if PIO_LNB_22KHZ_DIRECTION != GPIO_INVALID
        /*
         * !!! HACK ALERT !!!
         * WARNING!!!!! Hack required to keep from setting this PIO on a
         * Bronco1. When Bronco1 boards disappear, so should this hack. (PIO
         * setting should become conditional only upon value of
         * PIO_LNB_22KHZ_DIRECTION != GPIO_INVALID.)
         * !!! HACK ALERT !!!
         */
        #if I2C_CONFIG_EEPROM_ADDR != NOT_PRESENT
        {
            extern int ConfigurationValid;
            extern CONFIG_TABLE config_table;

            if ( ConfigurationValid &&
                    ( config_table.board_type != 0x00 ||
                        ((config_table.board_type == 0x00) &&
                         (config_table.board_rev != 0x01)) ) )
            {
                cnxt_gpio_set_output_level( PIO_LNB_22KHZ_DIRECTION, TRUE );
            }      
        }
        #endif
        /*
         * !!! HACK ALERT !!!
         * !!! HACK ALERT !!!
         */
    #endif

    /* Set up directional control for the PIO controlling LNB enable. */
    #if (INTERNAL_DEMOD == INTERNAL_COBRA_LIKE)
        /* No direction control necessary. */
    #else
        /* Cobra GPIO4 is the enable for the external LNB signal generator;
           set as an output. */
        if ( RegisterWrite( pNIM, CX24130_GPIO4DIR, 1 ) != True )
        {
        #if RTOS != NOOS
            trace_new( TL_ERROR,
                    "Cobra demod failed to set direction of LNB signal enable"
                    " (GPIO4).\n" );
            trace_new( TL_ERROR, "File: %s, line: %d\n",
                    API_GetErrorFilename(pNIM),
                    API_GetErrorLineNumber(pNIM) );
            api_error = API_GetLastError( pNIM );
            trace_new( TL_ERROR, "Error %d, %s\n", api_error,
                    API_GetErrorMessage(pNIM, (APIERRNO)api_error) );
        #endif /* RTOS != NOOS */
            return DEMOD_ERROR;
        }
    #endif
    
    /* Actually enable LNB output unless initialization with output disabled is
       requested. */
    #ifndef LNB_INITIALLY_DISABLED
        cnxt_lnb_set_output_enable( pNIM, TRUE );
    #endif

    return DEMOD_SUCCESS;
}