Example #1
0
static __attribute__ ((unused)) void omap2_mcbsp_free(unsigned int id)
{
	struct omap_mcbsp *mcbsp = mcbsp_ptr[id];

	if (!cpu_is_omap2420()) {
		if (mcbsp->dma_rx_lch != -1) {
			omap_free_dma_chain(mcbsp->dma_rx_lch);
			 mcbsp->dma_rx_lch = -1;
		}

	if (mcbsp->dma_tx_lch != -1) {
			omap_free_dma_chain(mcbsp->dma_tx_lch);
			mcbsp->dma_tx_lch = -1;
		}
	}
	return;
}
/*
 * Function called when the module is removed
 */
static void __exit dma_module_exit(void) {
       int i, ret;

       if(chain.request_success){
	       ret = omap_stop_dma_chain_transfers(chain.chain_id);
	       if (ret) {
			printk("DMA stop chain failed\n");
			set_test_passed_chain(0);
	       }
	       ret = omap_free_dma_chain(chain.chain_id);
	       if (ret) {
			printk("DMA Chain Free failed for id : %d\n",
				chain.chain_id);
			set_test_passed_chain(0);
	       }
       }

       for(i = 0; i < chain.channel_count; i++)
		stop_dma_transfer_chain(&transfers[i]);
}
/*
 * Function called when the module is initialized
 */
static int __init dma_module_init(void)
{
	int t_count, stress_count = 0;
	int i, ret;

	while ( stress_count++ < STRESS_COUNT) {
		create_dma_threads();

		printk(KERN_INFO "stress count : %d\n", stress_count);

		/* Wait till all the thread finish data transfer */
		while(count < MAX_THREADS)
			msleep(10);

		for (t_count = 0; t_count < MAX_THREADS; t_count++) {
			if (cht[t_count].chain.request_success) {
				ret = omap_stop_dma_chain_transfers(cht[t_count].
								chain.chain_id);
				if (ret) {
					printk("DMA stop chain failed\n");
					set_test_passed_chain(0);
				}
				ret = omap_free_dma_chain(cht[t_count].chain.chain_id);
				if (ret) {
					printk("DMA Chain Free failed for id : %d\n",
					cht[t_count].chain.chain_id);
					set_test_passed_chain(0);
				}
				for (i = 0; i < cht[t_count].current_transfer; i++)
					stop_dma_transfer_chain(&(cht[t_count].
									transfers[i]));
			}
		}
		count = 0;
	}
	return 0;
}