Ignore:
Timestamp:
May 3, 2018, 5:51:22 PM (4 years ago)
Author:
alain
Message:

1/ Fix a bug in the Multithreaded "sort" applicationr:
The pthread_create() arguments must be declared as global variables.
2/ The exit syscall can be called by any thread of a process..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/drivers/soclib_bdv.c

    r438 r440  
    6666    // get client thread cluster and local pointer
    6767    cxy_t      th_cxy = GET_CXY( th_xp );
    68     thread_t * th_ptr = (thread_t *)GET_PTR( th_xp );
     68    thread_t * th_ptr = GET_PTR( th_xp );
    6969
    7070    // get command arguments and extended pointer on IOC device
     
    9191    // get IOC device cluster and local pointer
    9292    cxy_t      ioc_cxy = GET_CXY( ioc_xp );
    93     chdev_t  * ioc_ptr = (chdev_t *)GET_PTR( ioc_xp );
    94 
    95     // get extended pointer on SOCLIB-BDV peripheral
    96     xptr_t     bdv_xp = hal_remote_lw( XPTR( ioc_cxy , &ioc_ptr->base ) );
    97 
    98     // get SOCLIB_BDV device cluster and local pointer
    99     cxy_t      bdv_cxy = GET_CXY( bdv_xp );
    100     uint32_t * bdv_ptr = (uint32_t *)GET_PTR( bdv_xp );
     93    chdev_t  * ioc_ptr = GET_PTR( ioc_xp );
     94
     95    // get cluster and pointers for SOCLIB-BDV peripheral segment base
     96    xptr_t     seg_xp  = (xptr_t)hal_remote_lwd( XPTR( ioc_cxy , &ioc_ptr->base ) );
     97    cxy_t      seg_cxy = GET_CXY( seg_xp );
     98    uint32_t * seg_ptr = GET_PTR( seg_xp );
    10199
    102100    // split buffer address in two 32 bits words
     
    110108
    111109    // set SOCLIB_BDV registers to start one I/O operation
    112     hal_remote_sw( XPTR( bdv_cxy , bdv_ptr + BDV_IRQ_ENABLE_REG ) , 1       );
    113     hal_remote_sw( XPTR( bdv_cxy , bdv_ptr + BDV_BUFFER_REG     ) , buf_lsb );
    114     hal_remote_sw( XPTR( bdv_cxy , bdv_ptr + BDV_BUFFER_EXT_REG ) , buf_msb );
    115     hal_remote_sw( XPTR( bdv_cxy , bdv_ptr + BDV_LBA_REG        ) , lba     );
    116     hal_remote_sw( XPTR( bdv_cxy , bdv_ptr + BDV_COUNT_REG      ) , count   );
    117     hal_remote_sw( XPTR( bdv_cxy , bdv_ptr + BDV_OP_REG         ) , op      );
     110    hal_remote_sw( XPTR( seg_cxy , seg_ptr + BDV_IRQ_ENABLE_REG ) , 1       );
     111    hal_remote_sw( XPTR( seg_cxy , seg_ptr + BDV_BUFFER_REG     ) , buf_lsb );
     112    hal_remote_sw( XPTR( seg_cxy , seg_ptr + BDV_BUFFER_EXT_REG ) , buf_msb );
     113    hal_remote_sw( XPTR( seg_cxy , seg_ptr + BDV_LBA_REG        ) , lba     );
     114    hal_remote_sw( XPTR( seg_cxy , seg_ptr + BDV_COUNT_REG      ) , count   );
     115    hal_remote_sw( XPTR( seg_cxy , seg_ptr + BDV_OP_REG         ) , op      );
    118116
    119117    // waiting policy  depends on the command type
     
    126124        while (1)
    127125        {
    128             status = hal_remote_lw( XPTR( bdv_cxy , bdv_ptr + BDV_STATUS_REG ) );
     126            status = hal_remote_lw( XPTR( seg_cxy , seg_ptr + BDV_STATUS_REG ) );
    129127
    130128            if( status == BDV_READ_SUCCESS ) // successfully completed
Note: See TracChangeset for help on using the changeset viewer.