Ignore:
Timestamp:
Mar 28, 2018, 2:40:29 PM (4 years ago)
Author:
alain
Message:

Fix various bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_fbf.c

    r422 r437  
    22 * dev_fbf.c - FBF (Block Device Controler) generic device API implementation.
    33 *
    4  * Author  Alain Greiner    (2016)
     4 * Author  Alain Greiner    (2016,2017,2018)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    137137    error = vmm_v2p_translate( CONFIG_KERNEL_IDENTITY_MAP , buffer , &buf_paddr );
    138138 
    139     if( error )
    140     {
    141         printk("\n[ERROR] in %s : cannot translate vaddr = %p in process %x\n",
    142                __FUNCTION__ , buffer , this->process->pid );
    143         return EINVAL;
    144     }
    145 
    146     fbf_dmsg("\n[DBG] %s : thread %x in process %x / vaddr = %p / paddr = %l\n",
    147              __FUNCTION__ , this->trdid , this->process->pid , buffer , buf_paddr );
     139    // check buffer is mapped
     140    assert( (error == 0) , __FUNCTION__ ,
     141    "cannot translate vaddr = %p in process %x\n", buffer, this->process->pid );
    148142
    149143    // get extended pointer on FBF chdev descriptor
     
    162156
    163157    // check offset and length versus FBF size
    164     if( (offset + length) > (width * height) )
    165     {
    166         printk("\n[ERROR] in %s : offset = %d / length = %d / width = %d / height = %d\n",
    167                __FUNCTION__ , offset , length , width , height );
    168         return EINVAL;
    169     }
     158    assert( ((offset + length) <= (width * height)) , __FUNCTION__ ,
     159    "offset %d / length %d / width %d / height %d\n", offset, length, width, height );
    170160
    171161    // compute extended pointers on frame buffer and memory buffer
     
    186176                      uint32_t       offset )
    187177{
     178
     179#if CONFIG_DEBUG_DEV_FBF_RX
     180uint32_t cycle = (uint32_t)hal_get_cycle();
     181if( CONFIG_DEBUG_DEV_FBF_RX < cycle )
     182printk("\n[DBG] %s : thread %x enter / process %x / vaddr %x / size %x\n",
     183__FUNCTION__ , this, this->process->pid , buffer , buf_paddr );
     184#endif
     185
    188186    return dev_fbf_access( false , buffer , length , offset );
     187
     188#if CONFIG_DEBUG_DEV_FBF_RX
     189cycle = (uint32_t)hal_get_cycle();
     190if( CONFIG_DEBUG_DEV_FBF_RX < cycle )
     191printk("\n[DBG] %s : thread %x exit / process %x / vaddr %x / size %x\n",
     192__FUNCTION__ , this, this->process->pid , buffer , buf_paddr );
     193#endif
     194
    189195
    190196
     
    194200                       uint32_t       offset )
    195201{
     202
     203#if CONFIG_DEBUG_DEV_FBF_TX
     204uint32_t cycle = (uint32_t)hal_get_cycle();
     205if( CONFIG_DEBUG_DEV_FBF_TX < cycle )
     206printk("\n[DBG] %s : thread %x enter / process %x / vaddr %x / size %x\n",
     207__FUNCTION__ , this, this->process->pid , buffer , buf_paddr );
     208#endif
     209
    196210    return dev_fbf_access( true , buffer , length , offset );
     211
     212#if CONFIG_DEBUG_DEV_FBF_RX
     213cycle = (uint32_t)hal_get_cycle();
     214if( CONFIG_DEBUG_DEV_FBF_RX < cycle )
     215printk("\n[DBG] %s : thread %x exit / process %x / vaddr %x / size %x\n",
     216__FUNCTION__ , this, this->process->pid , buffer , buf_paddr );
     217#endif
     218
    197219}
Note: See TracChangeset for help on using the changeset viewer.