Ignore:
Timestamp:
Jun 27, 2017, 2:07:55 PM (7 years ago)
Author:
max@…
Message:

empty out the x86 drivers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/drivers/soclib_dma.c

    r75 r76  
    2828#include <soclib_dma.h>
    2929
    30 ///////////////////////////////////////
    3130void soclib_dma_init( chdev_t * chdev )
    3231{
    33     // get hardware device cluster and local pointer
    34     cxy_t      dma_cxy  = GET_CXY( chdev->base );
    35     uint32_t * dma_ptr  = (uint32_t *)GET_PTR( chdev->base );
    3632
    37     // enable interrupts
    38         hal_remote_sw( XPTR( dma_cxy , dma_ptr + DMA_IRQ_DISABLED ) , 0 );
     33}
    3934
    40 } // soclib_dma_init()
    41 
    42 //////////////////////////////////////////////////////////////////
    4335void __attribute__ ((noinline)) soclib_dma_cmd( xptr_t thread_xp )
    4436{
    45     xptr_t     dev_xp;       // extended pointer on DMA devive
    46     xptr_t     dst_xp;       // extended pointer on destination buffer
    47     xptr_t     src_xp;       // extended pointer on source buffer
    48     uint32_t   size;         // buffer size
    4937
    50     // get client thread cluster and local pointer
    51     cxy_t      thread_cxy = GET_CXY( thread_xp );
    52     thread_t * thread_ptr = (thread_t *)GET_PTR( thread_xp );
     38}
    5339
    54     // get command arguments and extended pointer on DMA device
    55     dev_xp = (xptr_t)hal_remote_lwd( XPTR( thread_cxy , &thread_ptr->command.dma.dev_xp ) );
    56     dst_xp = (xptr_t)hal_remote_lwd( XPTR( thread_cxy , &thread_ptr->command.dma.dst_xp ) );
    57     src_xp = (xptr_t)hal_remote_lwd( XPTR( thread_cxy , &thread_ptr->command.dma.src_xp ) );
    58     size   =         hal_remote_lw ( XPTR( thread_cxy , &thread_ptr->command.dma.size   ) );
    59 
    60     // get DMA device cluster and local pointer
    61     cxy_t     dev_cxy = GET_CXY( dev_xp );
    62     chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    63 
    64     // get extended pointer on SOCLIB-DMA peripheral
    65     xptr_t     dma_xp = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->base ) );
    66 
    67     // get SOCLIB_DMA device cluster and local pointer
    68     cxy_t      dma_cxy = GET_CXY( dma_xp );
    69     uint32_t * dma_ptr = (uint32_t *)GET_PTR( dma_xp );
    70 
    71     // get DMA channel index and channel base address
    72     uint32_t * base = dma_ptr + DMA_SPAN * dev_ptr->channel;
    73 
    74     // split dst and src buffers addresses in two 32 bits words
    75     uint32_t   dst_lsb = (uint32_t)(dst_xp);
    76     uint32_t   dst_msb = (uint32_t)(dst_xp>>32);
    77     uint32_t   src_lsb = (uint32_t)(src_xp);
    78     uint32_t   src_msb = (uint32_t)(src_xp>>32);
    79 
    80     // set SOCLIB_DMA registers to start tranfer operation
    81     hal_remote_sw( XPTR( dma_cxy , base + DMA_SRC     ) , src_lsb );
    82     hal_remote_sw( XPTR( dma_cxy , base + DMA_SRC_EXT ) , src_msb );
    83     hal_remote_sw( XPTR( dma_cxy , base + DMA_DST     ) , dst_lsb );
    84     hal_remote_sw( XPTR( dma_cxy , base + DMA_DST_EXT ) , dst_msb );
    85     hal_remote_sw( XPTR( dma_cxy , base + DMA_LEN     ) , size    );
    86 
    87     // Block and deschedule server thread
    88     thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR );
    89     sched_yield();
    90    
    91 } // soclib_dma_cmd()
    92 
    93 /////////////////////////////////////////////////////////////////
    9440void __attribute__ ((noinline)) soclib_dma_isr( chdev_t * chdev )
    9541{
    96     // get extended pointer on client thread
    97     xptr_t root      = XPTR( local_cxy , &chdev->wait_root );
    98     xptr_t client_xp = XLIST_FIRST_ELEMENT( root , thread_t , wait_list );
    9942
    100     // get extended pointer on server thread
    101     xptr_t server_xp = XPTR( local_cxy , &chdev->server );
     43}
    10244
    103     // get client thread cluster and local pointer
    104     cxy_t      client_cxy = GET_CXY( client_xp );
    105     thread_t * client_ptr = (thread_t *)GET_PTR( client_xp );
    106 
    107     // get SOCLIB_DMA peripheral cluster and local pointer
    108     cxy_t      dma_cxy  = GET_CXY( chdev->base );
    109     uint32_t * dma_ptr  = (uint32_t *)GET_PTR( chdev->base );
    110 
    111     // get DMA channel base address
    112     uint32_t * base = dma_ptr + (DMA_SPAN * chdev->channel);
    113 
    114     // get DMA status register
    115         uint32_t status = hal_remote_lw( XPTR( dma_cxy , base + DMA_LEN ) );   
    116 
    117     // acknowledge IRQ
    118     hal_remote_sw( XPTR( dma_cxy , base + DMA_RESET ) , 0 );
    119 
    120     // set operation status in command
    121         error_t  error = ( status != DMA_SUCCESS );
    122     hal_remote_sw( XPTR( client_cxy , &client_ptr->command.dma.error ) , error );
    123 
    124     // unblock server thread
    125     thread_unblock( server_xp , THREAD_BLOCKED_DEV_ISR );
    126 
    127     // unblock client thread
    128     thread_unblock( client_xp , THREAD_BLOCKED_IO );
    129 
    130 } // soclib_dma_isr()
    131 
    132 
    133 
Note: See TracChangeset for help on using the changeset viewer.