예제 #1
0
파일: nim_null.c 프로젝트: alkap007/ali3606
INT32 f_null_attach(struct COFDM_TUNER_CONFIG_API *ptrCOFDM_Tuner)
{
	struct nim_device *dev;
	void  *priv_mem;

	ALI_PRINTF("Enter f_null_attach()...\n");

	dev = (struct nim_device *)dev_alloc(nim_null_name, HLD_DEV_TYPE_NIM, sizeof(struct nim_device));
	if (dev == NULL)
	{
		NIM_PRINTF("f_null_attach(): Error, Alloc nim device error!\n");
		return ERR_NO_MEM;
	}

	/* Alloc structure space of private */
	priv_mem = (void *)MALLOC(sizeof(struct nim_null_private));
	if (priv_mem == NULL)
	{
		dev_free(dev);
		NIM_PRINTF("f_null_attach(): Alloc nim device prive memory error!\n");
		return ERR_NO_MEM;
	}

	MEMCPY(priv_mem, ptrCOFDM_Tuner, sizeof(struct nim_null_private));
	dev->priv = priv_mem;

	/* Function point init */
	//dev->base_addr = 0x80;
	dev->init = f_null_attach;
	dev->open = f_null_open;
	dev->stop = f_null_close;
	dev->disable = f_null_disable;
	dev->do_ioctl = f_null_ioctl;
	dev->channel_change = f_null_channel_change;
	dev->channel_search = f_null_channel_search;
	dev->get_lock = f_null_get_lock_status;
	dev->get_freq = f_null_get_freq;
	dev->get_FEC = f_null_get_code_rate;
	dev->get_AGC = f_null_get_AGC;
	dev->get_SNR = f_null_get_SNR;
	dev->get_BER = f_null_get_BER;

	//added for DVB-T additional elements
	dev->get_guard_interval = f_null_get_GI;
	dev->get_fftmode = f_null_get_fftmode;
	dev->get_modulation = f_null_get_modulation;
	dev->get_spectrum_inv = f_null_get_specinv;

	/* Add this device to queue */
	if (dev_register(dev) != SUCCESS)
	{
		NIM_PRINTF("f_null_attach(): Error, Register nim device error!\n");
		FREE(priv_mem);
		dev_free(dev);
		return ERR_NO_DEV;
	}

	NIM_PRINTF("Exit f_null_attach() normally.\n");
	return SUCCESS;
}
예제 #2
0
INT32 venc_m3327_init()
{
	struct venc_device *dev;
	struct venc_m3327_private *tp;
	void *priv_mem;
	dev = dev_alloc(venc_m3327_name,HLD_DEV_TYPE_VENC,sizeof(struct venc_device));
	if (dev == NULL)
	{
		VENC_PRINTF("Error: Alloc video vencplay device error!\n");
		return RET_FAILURE;
	}

	/* Alloc structure space of private */
	priv_mem = (void *)MALLOC(sizeof(struct venc_m3327_private));
	if (priv_mem == NULL)
	{
		dev_free(dev);
		VENC_PRINTF("Alloc vencplay device prive memory error!/n");
		return RET_FAILURE;
	}

	MEMSET(priv_mem, 0, sizeof(struct venc_m3327_private));
	dev->priv =  tp = priv_mem;


       dev->next = NULL;
       dev->flags = 0;
	/* Function point init */
	dev->init = venc_m3327_init;

	dev->open = venc_m3327_open;
	dev->close = venc_m3327_close;

	//dev->ioctl = venc_m3327_ioctl;
	//dev->i_frame = venc_m3327_i_frame;
	//dev->start = venc_m3327_start;
	//dev->stop = venc_m3327_stop;

	dev->mp2enc = venc_m3327_mp2enc;
	/* Add this device to queue */
	if (dev_register(dev) != RET_SUCCESS)
	{
		VENC_PRINTF("Error: Register vencplay device error!\n");
		FREE(priv_mem);
		dev_free(dev);
		return RET_FAILURE;
	}
	
	VENC_PRINTF("VENC Attached!\n");
	
	return RET_SUCCESS;
}
예제 #3
0
static SANE_Status
list_one_device (SANE_String_Const devname)
{
  struct device *dev;
  SANE_Status status;
  transport *tr;

  DBG (4, "%s: %s\n", __FUNCTION__, devname);

  for (dev = devices_head; dev; dev = dev->next) {
    if (strcmp (dev->sane.name, devname) == 0)
      return SANE_STATUS_GOOD;
  }

  tr = tr_from_devname(devname);

  dev = calloc (1, sizeof (struct device));
  if (dev == NULL)
    return SANE_STATUS_NO_MEM;

  dev->sane.name = strdup (devname);
  dev->io = tr;
  status = tr->dev_open (dev);
  if (status != SANE_STATUS_GOOD) {
    dev_free (dev);
    return status;
  }

/*  status = dev_cmd (dev, CMD_ABORT);*/
  status = dev_inquiry (dev);
  tr->dev_close (dev);
  if (status != SANE_STATUS_GOOD) {
    DBG (1, "%s: dev_inquiry(%s): %s\n", __FUNCTION__,
	 dev->sane.name, sane_strstatus (status));
    dev_free (dev);
    return status;
  }

  /* good device, add it to list */
  dev->next = devices_head;
  devices_head = dev;
  return SANE_STATUS_GOOD;
}
예제 #4
0
파일: device.c 프로젝트: GlitchMasta47/pce
void dev_del (device_t *dev)
{
	if (dev == NULL) {
		return;
	}

	if (dev->del != NULL) {
		dev->del (dev);
	}
	else {
		dev_free (dev);
		free (dev->ext);
		free (dev);
	}
}
예제 #5
0
static void
free_devices (void)
{
  int i;
  struct device *next;
  struct device *dev;

  if (devlist) {
    free (devlist);
    devlist = NULL;
  }
  for (i = 0, dev = devices_head; dev; dev = next) {
    next = dev->next;
    dev_free (dev);
  }
  devices_head = NULL;
}
예제 #6
0
*****************************************************************************/
INT32 f_TC90512_attach(struct COFDM_TUNER_CONFIG_API *ptrCOFDM_Tuner)	//51117-01Angus
{

	struct nim_device *dev;
	struct nim_TC90512_private * priv_mem;
	UINT32 tuner_id=0;
	

	if ((ptrCOFDM_Tuner == NULL))	
	{
		NIM_PRINTF("Tuner Configuration API structure is NULL!/n");
		return ERR_NO_DEV;
	}

	dev = (struct nim_device *)dev_alloc(nim_TC90512_name, HLD_DEV_TYPE_NIM, sizeof(struct nim_device));
	if (dev == NULL)
	{
		NIM_PRINTF("Error: Alloc nim device error!\n");
		return ERR_NO_MEM;
	}

	/* Alloc structure space of private */
	priv_mem = (struct nim_TC90512_private *)MALLOC(sizeof(struct nim_TC90512_private));	
	if ((void*)priv_mem == NULL)
	{
		dev_free(dev);
		
		NIM_TC90512_PRINTF("Alloc nim device prive memory error!/n");
		return ERR_NO_MEM;
	}
	MEMCPY((void*)&(priv_mem->Tuner_Control), (void*)ptrCOFDM_Tuner, sizeof(struct COFDM_TUNER_CONFIG_API));	
	dev->priv = (void*)priv_mem;

	/* Function point init */
	
	dev->base_addr = SYS_COFDM_TC90512_CHIP_ADRRESS;   //please check here
	dev->init = f_TC90512_attach;
	dev->open = f_TC90512_open;
	dev->stop = f_TC90512_close;	
	dev->do_ioctl = NULL;
	dev->channel_change = f_TC90512_channel_change;
	dev->channel_search = f_TC90512_channel_search;
	dev->get_lock = f_TC90512_get_lock;
	dev->get_freq = f_TC90512_get_freq;
	dev->get_FEC = f_TC90512_get_code_rate;
	dev->get_AGC = f_TC90512_get_AGC;
	dev->get_SNR = f_TC90512_get_SNR;
	//dev->get_BER = f_TC90512_get_BER;
	dev->get_guard_interval = f_TC90512_get_GI;
	dev->get_fftmode = f_TC90512_get_fftmode;
	dev->get_modulation = f_TC90512_get_modulation;
	dev->get_spectrum_inv = NULL;
	//dev->get_HIER= f_TC90512_get_hier_mode;
	//dev->get_priority=f_TC90512_priority;
	dev->get_freq_offset =	NULL;

	f_IIC_Sema_ID=osal_semaphore_create(1);

	/*if((((struct nim_TC90512_private*)dev->priv)->Tuner_Control.tuner_config.cChip)!=Tuner_Chip_QUANTEK )
	{
		ptrCOFDM_Tuner->tuner_config.Tuner_Write=NULL;			
		ptrCOFDM_Tuner->tuner_config.Tuner_Read=NULL;			
	}*/

	/* Add this device to queue */
	if (dev_register(dev) != SUCCESS)
	{
		NIM_PRINTF("Error: Register nim device error!\n");
		FREE(priv_mem);
		dev_free(dev);
		return ERR_NO_DEV;
	}

	if (((struct nim_TC90512_private*)dev->priv)->Tuner_Control.nim_Tuner_Init != NULL)	
	{
		if((((struct nim_TC90512_private*)dev->priv)->Tuner_Control.tuner_config.cChip)==Tuner_Chip_QUANTEK || (((struct nim_TC90512_private*)dev->priv)->Tuner_Control.tuner_config.cChip)==Tuner_Chip_MAXLINEAR)
		{
			f_TC90512_PassThrough(dev,TRUE);
		
			
			//if (((struct nim_TC90512_private*)dev->priv)->Tuner_Control.nim_Tuner_Init(&((struct nim_TC90512_private*)dev->priv)->tuner_id, &(ptrCOFDM_Tuner->tuner_config)) != SUCCESS)
			if (((struct nim_TC90512_private*)dev->priv)->Tuner_Control.nim_Tuner_Init(&tuner_id, &(ptrCOFDM_Tuner->tuner_config)) != SUCCESS)	
			{
				NIM_PRINTF("Error: Init Tuner Failure!\n");
				
				f_TC90512_PassThrough(dev,FALSE);				

				return ERR_NO_DEV;
			}	
		
			f_TC90512_PassThrough(dev,FALSE);
		}
		else
		{
			if (((struct nim_TC90512_private*)dev->priv)->Tuner_Control.nim_Tuner_Init(&tuner_id, &(ptrCOFDM_Tuner->tuner_config)) != SUCCESS)	
			{
				NIM_PRINTF("Error: Init Tuner Failure!\n");
				
				return ERR_NO_DEV;
			}

		}

	}


	return SUCCESS;
예제 #7
0
void osd_dev_api_attach(struct ge_device *ge_dev, UINT32 osd_layer_id)
{
    struct osd_device *dev;
    const char *name;

    if (ge_dev)
        m_osddrv_ge_dev = ge_dev;

    if (osd_layer_id >= 3)
        return;

    if (osd_layer_id == 0)
        name = "OSD_DEV_0";
    else if (osd_layer_id == 1)
        name = "OSD_DEV_1";
    else
        name = "OSD_DEV_2";

    dev = (struct osd_device *)dev_alloc((INT8 *)name,HLD_DEV_TYPE_OSD,sizeof(struct osd_device));
    if (dev == NULL)
    {
        return ;
    }

    dev->priv = (void *)osd_layer_id;

    dev->next = NULL;
    dev->flags = 0;
    dev->sema_opert_osd = osal_mutex_create();
    if(OSAL_INVALID_ID == dev->sema_opert_osd)
    {
		PRINTF("OSD Can not create mutex!!!\n");
		ASSERT(0);
    }


    /* Function point init */
#if 0
    dev->open = OSDDrv_Open;
    dev->close = OSDDrv_Close;
    dev->ioctl = OSDDrv_IoCtl;
    dev->get_para = OSDDrv_GetPara;
    dev->show_onoff = OSDDrv_ShowOnOff;   
    dev->region_show = OSDDrv_RegionShow;   
    dev->set_pallette = OSDDrv_SetPallette;
    dev->get_pallette = OSDDrv_GetPallette;
    dev->modify_pallette = OSDDrv_ModifyPallette;
    dev->create_region = OSDDrv_CreateRegion;
    dev->delete_region = OSDDrv_DeleteRegion;
    dev->set_region_pos = OSDDrv_SetRegionPos;
    dev->get_region_pos = OSDDrv_GetRegionPos;

    dev->region_write = OSDDrv_RegionWrite;
    dev->region_read = OSDDrv_RegionRead;
    dev->region_fill = OSDDrv_RegionFill;
    dev->region_write2 = OSDDrv_RegionWrite2;

    dev->draw_hor_line = OSDDrv_DrawHorLine;

    dev->scale = OSDDrv_Scale;

    dev->set_clip = OSDDrv_SetClip;
    dev->clear_clip = OSDDrv_ClearClip;
    dev->get_region_addr = OSDDrv_GetRegionAddr;
#endif

    /* Add this device to queue */
    if (dev_register(dev) != RET_SUCCESS)
    {
        dev_free(dev);
        return ;
    }

    return ;
}
예제 #8
0
/********************************************
* NAME: vbi_cc_init
*       init cc parameters and set callback fucn of vpo_isr to excute push user data for cc using
*
* Returns : BOOL
*              1 		: RET_FAILURE
*              0		: RET_SUCCESS
* Parameter     				Flow    Description
* ------------------------------------------------------------------------------
* None
* ------------------------------------------------------------------------------
* Additional information:
******************************************/
__ATTRIBUTE_REUSE_
INT32 vbi_cc_init()
{
	struct vbi_device *dev;
	struct vbi_m3327_private *tp;
	void *priv_mem;
	
	g_vbi_m3327_name = (char *)ccvbi_m3327_name;
	
	dev = dev_alloc(g_vbi_m3327_name,HLD_DEV_TYPE_VBI,sizeof(struct vbi_device));
	if (dev == NULL)
	{
		VBI_PRINTF("Error: Alloc video vbiplay device error!\n");
		return RET_FAILURE;
	}
	/* Alloc structure space of private */
	priv_mem = (void *)MALLOC(sizeof(struct vbi_m3327_private));
	if (priv_mem == NULL)
	{
		dev_free(dev);
		VBI_PRINTF("Alloc vbiplay device prive memory error!/n");
		return RET_FAILURE;
	}
	MEMSET(priv_mem, 0, sizeof(struct vbi_m3327_private));
	
	g_vbi_priv = dev->priv =  tp = (struct vbi_m3327_private *)priv_mem;

	ccg_vbi27_pconfig_par = &(g_vbi_priv->config_par);
	ccg_vbi27_ttx_by_osd = &(g_vbi_priv->ttx_by_osd);
	ccg_vbi27_cc_by_osd = &(g_vbi_priv->cc_by_osd);
	//======================================
#ifdef CC_BY_OSD
	ccg_vbi27_dtvcc_by_osd=&(g_vbi_priv->dtvcc_by_osd);//hbchen
#endif
	//======================================
	/*according the macro , config the VBI driver*/
  //vbi_data_array = (struct vbi_data_array_t *)MALLOC((VBI_QUEUE_DEPTH)*sizeof(struct vbi_data_array_t));
  //MEMSET(vbi_data_array, 0, (VBI_QUEUE_DEPTH)*sizeof(struct vbi_m3327_private));	
	

	*ccg_vbi27_ttx_by_osd = FALSE;
	g_vbi_priv->init_ttx_decoder = NULL;

#ifdef	CC_BY_OSD
	*ccg_vbi27_cc_by_osd = TRUE;
	g_vbi_priv->init_cc_decoder = vbi_m3327_init_cc_decoder;
	g_vbi_priv->vbi_line21_push_by_cc = vbi_line21_push;
	g_vbi_priv->vbi_line21_push_by_dtvcc = vbi_line21_push_dtvcc;//xing for DTVCC
#else
	*ccg_vbi27_cc_by_osd = FALSE;
#endif


#ifdef	CC_BY_VBI
	ccg_vbi27_pconfig_par->cc_by_vbi = TRUE;
#else
	ccg_vbi27_pconfig_par->cc_by_vbi = FALSE;
#endif

	//dev->setoutput = vbi_m3327_setoutput;

	dev->next = NULL;
       dev->flags = 0;
	/* Function point init */
	dev->init = vbi_cc_init;

	dev->open = vbi_cc_open;
	dev->close = NULL;
	dev->request_write = NULL;
	dev->update_write = NULL;
	dev->setoutput = ccvbi_m3327_setoutput;
	dev->start = NULL;
	dev->stop = NULL;

	/* Add this device to queue */
	if(dev_register(dev) != RET_SUCCESS)
	{
		VBI_PRINTF("Error: Register vbiplay device error!\n");
		FREE(priv_mem);
		dev_free(dev);
		return RET_FAILURE;
	}
	return RET_SUCCESS;
}
예제 #9
0
/**********************************************************
 * 	Name		:   	hcdi_s3602_attach
 *	Description	:   	usb host controller s3602 device attach
 *	Parameter	:	notify: HC event notify callback to USBD
 *	Return		:	RET_SUCCESS: success
 * 					RET_FAILURE: error
 ***********************************************************/
RET_CODE hcdi_s3602_attach_ex(HC_NOTIFY_CB notify)
{
	struct usb_hc_device* dev;
	struct hc_s3602_private* priv ;	
	void* priv_mem_ctrl;
	void* priv_mem_bulk;
	void* priv_mem_bulk_out;
	void* priv_mem_opt_bulk;
	void* priv_mem_int_c;
	void* priv_mem_int_d;
	UINT32 base_address;
	UINT16 i = 0;


	dev = (struct usb_hc_device *) dev_alloc(hc_s3602_name_ex,
									HLD_DEV_TYPE_USB_HOST,
									sizeof(struct usb_hc_device));
	if (dev == NULL)
	{
		HCDI_CMD_PRINTF("Error: Alloc usb host controller device error!\n");
		HCDI_CMD_ASSERT(0);
		return RET_FAILURE;
	}

	/* Alloc structure space of private  ctrl*/
	priv_mem_ctrl = (void *) MALLOC(sizeof(struct hc_s3602_private) + 0x0f);
	if (priv_mem_ctrl == NULL)
	{
		dev_free(dev);
		HCDI_CMD_PRINTF("Alloc usb host controller device prive memory error!\n");
		HCDI_CMD_ASSERT(0);
		return RET_FAILURE;
	}
	/* Private date struct 16 bytes aligen */
	dev->priv_ctrl= priv = (void *) (((UINT32) priv_mem_ctrl+ 0x0f) & (~0x0f));
	/* Init priv element */
	MEMSET((UINT8 *) priv, 0, sizeof(struct hc_s3602_private));
	priv->priv_addr = priv_mem_ctrl;		/* Unaligned address of struct real located */
	priv->priv_type = USB_CONTROL_TRANSFER_MODE ;


	/* Alloc structure space of private bulk */
	priv_mem_bulk = (void *) MALLOC(sizeof(struct hc_s3602_private) + 0x0f);
	if (priv_mem_bulk== NULL)
	{
		FREE(priv_mem_ctrl);
		dev_free(dev);
		HCDI_CMD_PRINTF("Alloc usb host controller device prive memory error!\n");
		HCDI_CMD_ASSERT(0);
		return RET_FAILURE;
	}
	/* Private date struct 16 bytes aligen */
	dev->priv_bulk= priv = (void *) (((UINT32) priv_mem_bulk+ 0x0f) & (~0x0f));
	/* Init priv element */
	MEMSET((UINT8 *) priv, 0, sizeof(struct hc_s3602_private));
	priv->priv_addr = priv_mem_bulk;		/* Unaligned address of struct real located */
	priv->priv_type = USB_BULK_IN_TRANSFER_MODE ;


	/* Alloc structure space of private bulk_out */
	priv_mem_bulk_out = (void *) MALLOC(sizeof(struct hc_s3602_private) + 0x0f);
	if (priv_mem_bulk_out== NULL)
	{
		FREE(priv_mem_ctrl);
		FREE(priv_mem_bulk);
		dev_free(dev);
		HCDI_CMD_PRINTF("Alloc usb host controller device prive memory error!\n");
		HCDI_CMD_ASSERT(0);
		return RET_FAILURE;
	}
	/* Private date struct 16 bytes aligen */
	dev->priv_bulk_out= priv = (void *) (((UINT32) priv_mem_bulk_out+ 0x0f) & (~0x0f));
	/* Init priv element */
	MEMSET((UINT8 *) priv, 0, sizeof(struct hc_s3602_private));
	priv->priv_addr = priv_mem_bulk_out;		/* Unaligned address of struct real located */
	priv->priv_type = USB_BULK_OUT_TRANSFER_MODE ;

	
	/* Alloc structure space of private opt_bulk */
	priv_mem_opt_bulk = (void *) MALLOC(sizeof(struct hc_s3602_private) + 0x0f);
	if (priv_mem_opt_bulk== NULL)
	{
		FREE(priv_mem_ctrl);
		FREE(priv_mem_bulk);
		FREE(priv_mem_bulk_out);
		dev_free(dev);
		HCDI_CMD_PRINTF("Alloc usb host controller device prive memory error!\n");
		HCDI_CMD_ASSERT(0);
		return RET_FAILURE;
	}
	/* Private date struct 16 bytes aligen */
	dev->priv_opt_bulk = priv = (void *) (((UINT32) priv_mem_opt_bulk+ 0x0f) & (~0x0f));
	/* Init priv element */
	MEMSET((UINT8 *) priv, 0, sizeof(struct hc_s3602_private));
	priv->priv_addr = priv_mem_opt_bulk;		/* Unaligned address of struct real located */
	priv->priv_type = USB_OPT_BULK_TRANSFER_MODE ;
	

	/* Alloc structure space of private int_c*/
	priv_mem_int_c= (void *) MALLOC(sizeof(struct hc_s3602_private) + 0x0f);
	if (priv_mem_int_c == NULL)
	{
		
		FREE(priv_mem_bulk);
		FREE(priv_mem_ctrl);
		dev_free(dev);
		HCDI_CMD_PRINTF("Alloc usb host controller device prive memory error!\n");
		HCDI_CMD_ASSERT(0);
		return RET_FAILURE;
	}
	/* Private date struct 16 bytes aligen */
	dev->priv_int_c= priv = (void *) (((UINT32) priv_mem_int_c+ 0x0f) & (~0x0f));
	/* Init priv element */
	MEMSET((UINT8 *) priv, 0, sizeof(struct hc_s3602_private));
	priv->priv_addr = priv_mem_int_c;		/* Unaligned address of struct real located */
	priv->priv_type = USB_INTERRUPT_TRANSFER_MODE ;


	/* Alloc structure space of private int d*/
	priv_mem_int_d= (void *) MALLOC(sizeof(struct hc_s3602_private) + 0x0f);
	if (priv_mem_int_d == NULL)
	{
		FREE(priv_mem_int_c);
		FREE(priv_mem_bulk);
		FREE(priv_mem_ctrl);
		dev_free(dev);
		HCDI_CMD_PRINTF("Alloc usb host controller device prive memory error!\n");
		HCDI_CMD_ASSERT(0);
		return RET_FAILURE;
	}
	/* Private date struct 16 bytes aligen */
	dev->priv_int_d= priv = (void *) (((UINT32) priv_mem_int_d+ 0x0f) & (~0x0f));
	/* Init priv element */
	MEMSET((UINT8 *) priv, 0, sizeof(struct hc_s3602_private));
	priv->priv_addr = priv_mem_int_d;		/* Unaligned address of struct real located */
	priv->priv_type = USB_HUB_TRANSFER_MODE ;

	/* Function point init */
	if( (sys_ic_get_chip_id() == ALI_M3329E)&&(sys_ic_get_rev_id() >=IC_REV_5))
		dev->base_addr = HC_S3329E5_BASE_ADDR;
	else  if (sys_ic_get_chip_id() == ALI_S3602)
		dev->base_addr = HC_S3602_BASE_ADDR;
	else
		return !RET_SUCCESS; // usb invalid chip id
		

	//dev->base_addr = base_address;
	dev->init = hcdi_s3602_attach_ex;
	dev->open = hcdi_s3602_open_ex;
	dev->close = hcdi_s3602_close_ex;

	dev->submit_upt = hcdi_s3602_submit_upt_ex;
	dev->cancel_upt = hcdi_s3602_cancel_upt_ex;
	dev->suspend = hcdi_s3602_suspend_ex;
	dev->resume = hcdi_s3602_resume_ex;
	dev->reset = hcdi_s3602_reset_ex;
	dev->io_control = hcdi_s3602_ioctl_ex;

	dev->hc_notify_uplayer = notify;

	dev->rh_port_num = 1;
	//dev->curr_upt = NULL;
	dev->curr_upt_bulk= NULL;
	dev->curr_upt_ctl= NULL;
	dev->curr_upt_int_c= NULL;
	dev->curr_upt_int_d= NULL;

	for (i = 0; i < USB_MAX_DEVICES; i++)
		dev->adrsVec[i] = 0;

	dev->pRoot = NULL ;

	dev->nanSeconds = 0;

	/* Add this device to queue */
	if (dev_register(dev) != SUCCESS)
	{
		HCDI_CMD_PRINTF("Error: Register usb host controller device error!\n");
		FREE(priv_mem_int_d);
		FREE(priv_mem_int_c);
		FREE(priv_mem_bulk);
		FREE(priv_mem_ctrl);
		dev_free(dev);
		HCDI_CMD_ASSERT(0);
		return RET_FAILURE;
	}

	return RET_SUCCESS;
}
예제 #10
0
__ATTRIBUTE_REUSE_
INT32 pan_direct_gpio_attach(struct pan_configuration *config)
{
	struct pan_device *dev;
	struct pan_hw_info *tp;

  	if (config == NULL || config->hw_info == NULL)
	{
		return ERR_FAILUE;
	}

	dev = dev_alloc(pan_direct_gpio_name, HLD_DEV_TYPE_PAN, sizeof(struct pan_device));

	if (dev == NULL)
	{
		PRINTF("Error: Alloc front panel device error!\n");
		return ERR_NO_MEM;
	}

	dev->priv = config->hw_info;
	
	tp = (struct pan_hw_info*)dev->priv;
	
#ifdef SUPPORT_FIRMWARE_CONFIG
	POS_GPIO_POWER_LED 		= tp->lbd[0].position;
    POS_GPIO_POWER_LED_POLAR = tp->lbd[0].polar;

	POS_GPIO_STANDBY_LED		= tp->lbd[2].position;	
    POS_GPIO_STANDBY_LED_POLAR = tp->lbd[2].polar;	
    
	POS_GPIO_LOCK_LED		= tp->lbd[1].position;

	POS_GPIO_STANDBY_KEY		= tp->flatch.position;
    //POS_GPIO_STANDBY_KEY_POLAR = tp->flatch.polar;
    
	POS_GPIO_CHANNEL_UP_KEY		= tp->fclock.position;
    //POS_GPIO_CHANNEL_UP_KEY_POLAR = tp->fclock.polar;
    
	POS_GPIO_CHANNEL_DOWN_KEY	= tp->fdata.position;
    //POS_GPIO_CHANNEL_DOWN_KEY_POLAR = tp->fdata.polar;

    //keypress_repeat = tp->intv_repeat;
#endif  


	/* Function point init */
	dev->init = pan_direct_gpio_attach;
	dev->open = pan_direct_gpio_open;
	dev->stop = pan_direct_gpio_close;
	dev->do_ioctl = pan_direct_gpio_ioctl;
	dev->display =	pan_direct_gpio_display;
		
	/* Add this device to queue */
	if (dev_register(dev) != SUCCESS)
	{
		PRINTF("Error: Register panel device error!\n");
		dev_free(dev);
		return ERR_NO_DEV;
	}
    	 
	return SUCCESS;
}