Esempio n. 1
0
/*
 * Function called when the module is initialized
 */
static int __init dma_module_init(void) {
    int error;
    int i = 0;


    /* Request a chain */
    chain.chain_type = OMAP_DMA_STATIC_CHAIN;
    chain.device_id = OMAP_DMA_NO_DEVICE;
    chain.data_type = OMAP_DMA_DATA_TYPE_S8;
    chain.addressing_mode = OMAP_DMA_AMODE_POST_INC;
    chain.sync_mode = OMAP_DMA_SYNC_ELEMENT;
    chain.data_burst = OMAP_DMA_DATA_BURST_DIS;
    chain.channel_count = TRANSFER_COUNT;
    set_max_rounds(TRANSFER_ROUNDS);

    error = request_dma_chain(&chain);

    if(error) {
        set_test_passed_chain(0);
        return 1;
    }

    for(i = 0; i < chain.channel_count; i++) {

        /* Create the buffers for each transfer */
        transfers[i].buffers.buf_size = (1024 * 16);
        error = create_transfer_buffers_chain(&(transfers[i].buffers));
        if( error ) {
            set_test_passed_chain(0);
            return 1;
        }
        fill_source_buffer_chain(&(transfers[i].buffers));

        /* Chain a transfer to the chain */
        error = chain_transfer(&chain, &transfers[i]);
        if( error ) {
            set_test_passed_chain(0);
            return 1;
        }

    }

    /* Setup the global dma parameters */
    setup_dma_chain(&chain);

    /* Start the chain */
    start_dma_chain(&chain);

    /* Poll if the all the transfers have finished */
    for(i = 0; i < TRANSFER_POLL_COUNT; i++) {
        if(get_transfers_finished()) {
            mdelay(TRANSFER_POLL_TIME);
            check_test_passed();
            break;
        } else {
            mdelay(TRANSFER_POLL_TIME);
        }
    }

    /* This will happen if the poll retries have been reached*/
    if(i == TRANSFER_POLL_COUNT) {
        set_test_passed_chain(0);
        return 1;
    }

    return 0;
}
/*
 * Function called when the module is initialized
 */
static int __init dma_module_init(void) {
       int error;
       int i = 0;

       transfers[0].data_type = OMAP_DMA_DATA_TYPE_S8;
       /*transfers[1].data_type = OMAP_DMA_DATA_TYPE_S16;
       transfers[2].data_type = OMAP_DMA_DATA_TYPE_S32;*/

       for(i = 0; i < TRANSFER_COUNT; i++){
           /* Create the transfer for the test */
           transfers[i].device_id = OMAP_DMA_NO_DEVICE;
           transfers[i].sync_mode = OMAP_DMA_SYNC_ELEMENT;
           transfers[i].data_burst = OMAP_DMA_DATA_BURST_DIS;
           transfers[i].endian_type = DMA_TEST_LITTLE_ENDIAN;
           transfers[i].addressing_mode = OMAP_DMA_AMODE_POST_INC;
		transfers[i].dst_addressing_mode = OMAP_DMA_AMODE_POST_INC;
           transfers[i].priority = DMA_CH_PRIO_HIGH;
           transfers[i].buffers.buf_size = (1024 * 1024);

           /* Request a dma transfer */
           error = request_dma(&transfers[i]);
           if( error ){
               set_test_passed(0);
               return 1;
           }

           /* Request 2 buffer for the transfer and fill them */
           error = create_transfer_buffers(&(transfers[i].buffers));
           if( error ){
               set_test_passed(0);
               return 1;
           }
           fill_source_buffer(&(transfers[i].buffers));

           /* Setup the dma transfer parameters */
           setup_dma_transfer(&transfers[i]);
       }

       for(i = 0; i < TRANSFER_COUNT; i++){
           /* Start the transfers */
           start_dma_transfer(&transfers[i]);
       }

       /* Poll if the all the transfers have finished */
       for(i = 0; i < TRANSFER_POLL_COUNT; i++){
            if(get_transfers_finished()){
               mdelay(TRANSFER_POLL_TIME);
               check_test_passed();
               break;
            }else{
               mdelay(TRANSFER_POLL_TIME);
            }
       }

       /* This will happen if the poll retries have been reached*/
       if(i == TRANSFER_POLL_COUNT){
           set_test_passed(0);
           return 1;
       }

       return 0;
}
/*
 * Function called when the module is initialized
 */
static int __init dma_module_init(void) {
       int error;
       int i = 0;

	wait_oswr_trigger = -1;
	for (i = 0; i < TRANSFER_COUNT; i++) {
		/* Create the transfer for the test */
		transfers[i].device_id = OMAP_DMA_NO_DEVICE;
		transfers[i].sync_mode = OMAP_DMA_SYNC_ELEMENT;
		transfers[i].data_burst = OMAP_DMA_DATA_BURST_DIS;
		transfers[i].data_type = OMAP_DMA_DATA_TYPE_S8;
		transfers[i].endian_type = DMA_TEST_LITTLE_ENDIAN;
		transfers[i].addressing_mode = OMAP_DMA_AMODE_POST_INC;
		transfers[i].dst_addressing_mode = OMAP_DMA_AMODE_POST_INC;
		transfers[i].priority = DMA_CH_PRIO_HIGH;
		transfers[i].buffers.buf_size = (128 * (i+1)*(i+1)) + i % 2;
		transfers[i].src_ei = transfers[i].dest_ei = 0;
		transfers[i].src_fi = transfers[i].dest_fi = 0;

           /* Request a dma transfer */
           error = request_dma(&transfers[i]);
           if( error ){
               set_test_passed(0);
               return 1;
           }

           /* Request 2 buffer for the transfer and fill them */
           error = create_transfer_buffers(&(transfers[i].buffers));
           if( error ){
               set_test_passed(0);
               return 1;
           }
           fill_source_buffer(&(transfers[i].buffers));

           /* Setup the dma transfer parameters */
           setup_dma_transfer(&transfers[i]);
       }

       for(i = 0; i < TRANSFER_COUNT; i++){
           /* Start the transfers */
           start_dma_transfer(&transfers[i]);

	printk("Register Dump After configuration:\n");
	printk("DMA channel number : %d\n", transfers[i].transfer_id);
	dma_channel_registers_dump(transfers[i].transfer_id, reg_dump_after_config);
       }


       /* Poll if the all the transfers have finished */
       for(i = 0; i < TRANSFER_POLL_COUNT; i++){
            if(get_transfers_finished()){
               mdelay(TRANSFER_POLL_TIME);
               check_test_passed();
               break;
            }else{
               mdelay(TRANSFER_POLL_TIME);
            }
       }

       /* This will happen if the poll retries have been reached*/
       if(i == TRANSFER_POLL_COUNT){
           set_test_passed(0);
           return 1;
       }

       return 0;
}