Changeset 237


Ignore:
Timestamp:
May 2, 2013, 6:38:04 PM (11 years ago)
Author:
meunier
Message:

Adding a syscall to allow a user to know the block size with which the block device has been configured.

Location:
soft/giet_vm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/libs/stdio.c

    r232 r237  
    3535#define SYSCALL_IOC_READ        0x16
    3636#define SYSCALL_IOC_COMPLETED   0x17
     37#define SYSCALL_IOC_BLOCK_SIZE  0x18
    3738#define SYSCALL_VOBJ_GET_VBASE  0x1A
    3839#define SYSCALL_NIC_WRITE       0x1B
     
    548549
    549550
     551//////////////////////////////////////////////////////////////////////////////////
     552// giet_ioc_block_size()
     553//////////////////////////////////////////////////////////////////////////////////
     554// This blocking function returns the block_size (in bytes) of the block device
     555//////////////////////////////////////////////////////////////////////////////////
     556unsigned int giet_ioc_block_size() {
     557    return sys_call(SYSCALL_IOC_BLOCK_SIZE, 0, 0, 0, 0);
     558}
     559
     560
    550561/////  Frame buffer device related system calls  /////
    551562
  • soft/giet_vm/libs/stdio.h

    r232 r237  
    3434unsigned int giet_ioc_write(unsigned int lba, void * buffer, unsigned int count);
    3535unsigned int giet_ioc_completed();
     36unsigned int giet_ioc_block_size();
    3637
    3738/* Frame buffer device related functions */
  • soft/giet_vm/sys/drivers.c

    r232 r237  
    220220//unsigned int _timer_reset_irq_cpt(unsigned int cluster_id, unsigned int local_id) {
    221221//    // parameters checking
    222 //    if ( cluster_id >= NB_CLUSTERS)    return 1;
    223 //    if ( local_id >= NB_TIMERS_MAX ) return 2;
     222//    if (cluster_id >= NB_CLUSTERS) {
     223//        return 1;
     224//    }
     225//    if (local_id >= NB_TIMERS_MAX) {
     226//        return 2;
     227//    }
    224228//
    225229//#if USE_XICU
     
    227231//#else
    228232//    unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base + (cluster_id * CLUSTER_SIZE));
    229 //
    230 //    timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 1;
     233//    unsigned int timer_period = timer_address[local_id * TIMER_SPAN + TIMER_PERIOD];
     234//
     235//    timer_address[local_id * TIMER_SPAN + TIMER_PERIOD] = timer_period;
    231236//#endif
    232237//
     
    770775    *status = ioc_address[BLOCK_DEVICE_STATUS]; // read status & reset IRQ
    771776    return 0;
     777}
     778
     779
     780///////////////////////////////////////////////////////////////////////////////
     781//     _ioc_get_block_size()
     782// This function returns the block_size with which the IOC has been configured.
     783///////////////////////////////////////////////////////////////////////////////
     784unsigned int _ioc_get_block_size() {
     785    // get IOC base address
     786    unsigned int * ioc_address = (unsigned int *) &seg_ioc_base;
     787   
     788    return  ioc_address[BLOCK_DEVICE_BLOCK_SIZE];
    772789}
    773790
     
    905922
    906923    // get page table address
    907     unsigned int user_ptab = _get_context_slot( task_id, CTX_PTAB_ID);
     924    unsigned int user_ptab = _get_context_slot(task_id, CTX_PTAB_ID);
    908925
    909926    // get peripheral buffer virtual address
    910     if ( dev_type) {
     927    if (dev_type) {
    911928        device_vaddr = (unsigned int) &seg_nic_base + offset;
    912929    }
     
    926943
    927944    // Compute user buffer physical address
    928     ko = _v2p_translate( (page_table_t*)user_ptab, (user_vaddr >> 12), &ppn, &flags);
     945    ko = _v2p_translate((page_table_t*) user_ptab, (user_vaddr >> 12), &ppn, &flags);
    929946    if (ko) {
    930947        _get_lock(&_tty_put_lock);
  • soft/giet_vm/sys/drivers.h

    r232 r237  
    1919unsigned int _timer_stop(unsigned int cluster_id, unsigned int local_id);
    2020unsigned int _timer_reset_irq(unsigned int cluster_id, unsigned int local_id);
    21 unsigned int _timer_reset_irq_cpt(unsigned int cluster_id, unsigned int local_id);
     21//unsigned int _timer_reset_irq_cpt(unsigned int cluster_id, unsigned int local_id);
    2222
    2323
     
    6060unsigned int _ioc_completed();
    6161unsigned int _ioc_get_status(unsigned int * status);
     62unsigned int _ioc_get_block_size();
    6263
    6364///////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/sys/irq_handler.c

    r231 r237  
    127127
    128128    // release DMA channel
    129     _dma_done[dma_global_id] = 1; 
     129    _dma_done[dma_global_id] = 1;
    130130#else
    131131    _puts("[GIET ERROR] NB_DMAS_MAX is set to zero\n");
  • soft/giet_vm/sys/sys_handler.c

    r232 r237  
    4646    &_ioc_read,            /* 0x16 */
    4747    &_ioc_completed,       /* 0x17 */
    48     &_sys_ukn,             /* 0x18 */
     48    &_ioc_get_block_size,  /* 0x18 */
    4949    &_sys_ukn,             /* 0x19 */
    5050    &_vobj_get_vbase,      /* 0x1A */
Note: See TracChangeset for help on using the changeset viewer.