Exemplo n.º 1
0
int __devinit mv_trace_init(void)
{
    int err;
    struct device *pd;

    err = TRC_INIT();
    if (err) {
        printk(KERN_INFO "sysfs group failed %d\n", err);
        goto out;
    }

    pd = bus_find_device_by_name(&platform_bus_type, NULL, "neta");
    if (!pd) {
        platform_device_register_simple("neta", -1, NULL, 0);
        pd = bus_find_device_by_name(&platform_bus_type, NULL, "neta");
    }

    if (!pd) {
        printk(KERN_ERR"%s: cannot find neta device\n", __func__);
        pd = &platform_bus;
    }

    err = sysfs_create_group(&pd->kobj, &mv_trace_group);
    if (err) {
        printk(KERN_INFO "sysfs group failed %d\n", err);
        goto out;
    }
out:

    return err;
}
Exemplo n.º 2
0
static int __init mp_init(void)
{
	MV_PHONE *mp;
	int i;

	printk("%s, %s\n", MP_NAME, MP_VER);

	TRC_INIT();
	TRC_REC("->%s\n",__FUNCTION__);

	/* General TDM and SLIC init */
	TRC_REC("tdm init\n");
	mvTdmInit();
	mvTdmShowProperties();

	/* per channel init */
	for(i=0; i<MV_TDM_MAX_CHANNELS; i++) {
		printk("Initializing channel %d\n",i);
		TRC_REC("ch%d init\n",i);
		mp = get_mp(i);
		mp->p.board = mp->ch = i;
		mp->p.f_op = &mp_fops;
		mp->p.open = mp_open;
		mp->irq = MP_IRQ;
        	init_waitqueue_head(&mp->poll_q);
		if(mvTdmChInit(&mp->p, i, &(mp->ch_info)) == MV_OK) {
			/*mvTdmChShowProperties(mp->ch_info);*/
			phone_register_device(&mp->p, PHONE_UNIT_ANY);
			printk("phone%d registered\n",i);
		}
		else {
			printk("%s: error, failed to init ch%d\n",__FUNCTION__,i);
		}
	}

	TRC_REC("<-%s\n",__FUNCTION__);
	return 0;
}
Exemplo n.º 3
0
int main(int argc, char **argv)
{
    int n;
    pthread_t tid;

    if(argc < 2){
        printf("usage: foo <num_msgs>\n");
        exit(1);
    }

    TRC_INIT(NULL, TRC_ENABLED, TRC_ON, TRC_ALL, UNIT_MAX, 0);
    TRC_ADD_THREAD(argv[0], 0);
    
    n = atoi(argv[1]);
    pthread_create(&tid, NULL, bar, &n);
    foo(n);
#ifndef ERR5
    pthread_join(tid, 0);
#endif

    TRC_REMOVE_THREAD(tid);
    TRC_REMOVE_THREAD(pthread_self());
    TRC_END();
}
Exemplo n.º 4
0
MV_STATUS tdm_if_init(tdm_if_register_ops_t* register_ops, tdm_if_params_t* tdm_if_params)
{
	MV_TDM_PARAMS tdm_params;
	
	printk("Loading Marvell Telephony Driver\n");

	/* Check if any SLIC module exists */
	if(mvBoardTdmDevicesCountGet() == 0) {
		mvCtrlPwrClckSet(TDM_2CH_UNIT_ID, 0, MV_FALSE);
		printk("%s: Warning, no SLIC module is connected\n",__FUNCTION__);
		return MV_OK;
	}

	/* Check that selected TDM unit is active */
	if (MV_FALSE == mvCtrlPwrClckGet(mvCtrlTdmUnitTypeGet(), 0)) {
		printk("%s: Warning, TDM is powered off\n",__FUNCTION__);
		return MV_OK;
	}


	if((register_ops == NULL) || (tdm_if_params == NULL)) {
		printk("%s: bad parameters\n",__FUNCTION__);
		return MV_ERROR;

	}

	/* Check callbacks */
	if(register_ops->tdm_if_pcm_ops.pcm_tx_callback == NULL ||
	   register_ops->tdm_if_pcm_ops.pcm_rx_callback == NULL ) {
		printk("%s: missing parameters\n",__FUNCTION__);
		return MV_ERROR;
	}

	/* Reset globals */
	rxBuff = txBuff = NULL;
#ifdef CONFIG_MV_TDM_SUPPORT
	pcm_enable = 0;
#else
	pcm_enable = 1;
#endif
	irq_init = 0;
	tdm_init = 0;

	/* Extract test enable */
	test_enable = tdm_if_params->test_enable;

	/* Calculate Rx/Tx buffer size(use in callbacks) */
	buff_size = (tdm_if_params->pcm_format * tdm_if_params->total_lines * 80 * 
				(tdm_if_params->sampling_period/MV_TDM_BASE_SAMPLING_PERIOD));

	/* Extract TDM irq number */
	irqnr = mvCtrlTdmUnitIrqGet();

	/* Start Marvell trace */
	TRC_START(); 
	TRC_INIT(NULL, NULL, 0, 0);
	TRC_REC("->%s\n",__FUNCTION__);

	/* Assign TDM parameters */
	memcpy(&tdm_params, tdm_if_params, sizeof(MV_TDM_PARAMS));

	/* Assign control callbacks */
	tdm_if_register_ops = register_ops;
	tdm_if_register_ops->tdm_if_ctl_ops.ctl_pcm_start = tdm_if_pcm_start;
	tdm_if_register_ops->tdm_if_ctl_ops.ctl_pcm_stop = tdm_if_pcm_stop;

	/* TDM init */
	if(mvSysTdmInit(&tdm_params) != MV_OK) {
			printk("%s: Error, TDM initialization failed !!!\n",__FUNCTION__);
			return MV_ERROR;
	}
	tdm_init = 1;

	/* Register TDM interrupt */
	if (request_irq(irqnr, tdm_if_isr, IRQF_DISABLED, "tdm", NULL)) {
		printk("%s: Failed to connect irq(%d)\n", __FUNCTION__, irqnr);
		return MV_ERROR;
	}
	irq_init = 1;

	/* Create TDM procFS statistics */
	tdm_stats = proc_mkdir("tdm", NULL);
	create_proc_read_entry("tdm_init", 0, tdm_stats, proc_tdm_init_read, NULL);
	create_proc_read_entry("rx_miss", 0, tdm_stats, proc_rx_miss_read, NULL);
	create_proc_read_entry("tx_miss", 0, tdm_stats, proc_tx_miss_read, NULL);
	create_proc_read_entry("rx_over", 0, tdm_stats, proc_rx_over_read, NULL);
	create_proc_read_entry("tx_under", 0, tdm_stats, proc_tx_under_read, NULL);

	TRC_REC("Marvell Telephony Driver Loaded Successfully\n");

#ifdef CONFIG_MV_COMM_UNIT_SUPPORT
	/* WA to stop the MCDMA gracefully after commUnit initialization */
	tdm_if_pcm_stop();
#endif

	TRC_REC("<-%s\n",__FUNCTION__);
	return MV_OK;
}