Ignore:
Timestamp:
Jul 17, 2017, 1:24:58 PM (7 years ago)
Author:
max@…
Message:

style

File:
1 edited

Legend:

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

    r211 r212  
    11/*
    22 * dev_ioc.c - IOC (Block Device Controler) generic device API implementation.
    3  * 
     3 *
    44 * Author  Alain Greiner    (2016)
    55 *
     
    88 * This file is part of ALMOS-MK
    99 *
    10  * ALMOS-MKH.is free software; you can redistribute it and/or modify it
     10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
    1111 * under the terms of the GNU General Public License as published by
    1212 * the Free Software Foundation; version 2.0 of the License.
    1313 *
    14  * ALMOS-MKH.is distributed in the hope that it will be useful, but
     14 * ALMOS-MKH is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1616 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     
    1818 *
    1919 * You should have received a copy of the GNU General Public License
    20  * along with ALMOS-kernel; if not, write to the Free Software Foundation,
     20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
    2121 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    2222 */
     
    2727#include <soclib_bdv.h>
    2828#include <soclib_hba.h>
    29 //#include <soclib_sdc.h>
    30 //#include <soclib_spi.h>
    31 //#include <soclib_rdk.h>
    3229#include <thread.h>
    3330#include <printk.h>
     
    8885                                  &chdev_sequencial_server,
    8986                                  ioc,
    90                                   lid ); 
     87                                  lid );
    9188
    9289    assert( (error == 0) , __FUNCTION__ , "cannot create server thread" );
     
    9491    // set "server" field in ioc descriptor
    9592    ioc->server = new_thread;
    96    
     93
    9794    // start server thread
    9895    thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
    99  
     96
    10097}  // end dev_ioc_init()
    10198
     
    114111
    115112    ioc_dmsg("\n[INFO] in %s : thread %x in process %x"
    116              " for lba = %x / buffer = %x / at cycle %d\n", 
    117              __FUNCTION__ , this->trdid , this->process->pid , 
     113             " for lba = %x / buffer = %x / at cycle %d\n",
     114             __FUNCTION__ , this->trdid , this->process->pid ,
    118115             lba , (intptr_t)buffer , hal_get_cycles() );
    119116
    120     // software L2/L3 cache coherence for memory buffer 
    121     if( chdev_dir.iob ) 
     117    // software L2/L3 cache coherence for memory buffer
     118    if( chdev_dir.iob )
    122119    {
    123120        if ( cmd_type == IOC_READ ) dev_mmc_inval( XPTR( local_cxy , buffer ) , count<<9 );
     
    143140
    144141    ioc_dmsg("\n[INFO] in %s : thread %x in process %x"
    145              " completes / error = %d / at cycle %d\n", 
     142             " completes / error = %d / at cycle %d\n",
    146143             __FUNCTION__ , this->trdid , this->process->pid ,
    147144             this->command.ioc.error , hal_get_cycles() );
    148145
    149146    // return I/O operation status
    150     return this->command.ioc.error; 
     147    return this->command.ioc.error;
    151148
    152149}  // end dev_ioc_access()
     
    157154                      uint32_t       count )
    158155{
    159     return dev_ioc_access( IOC_READ , buffer , lba , count ); 
    160 } 
     156    return dev_ioc_access( IOC_READ , buffer , lba , count );
     157}
    161158
    162159////////////////////////////////////////////
     
    165162                       uint32_t      count )
    166163{
    167     return dev_ioc_access( IOC_WRITE , buffer , lba , count ); 
     164    return dev_ioc_access( IOC_WRITE , buffer , lba , count );
    168165}
    169166
     
    173170                           uint32_t   count )
    174171{
    175     // get pointer on calling thread 
     172    // get pointer on calling thread
    176173    thread_t * this = CURRENT_THREAD;
    177174
    178     // software L2/L3 cache coherence for memory buffer 
     175    // software L2/L3 cache coherence for memory buffer
    179176    if( chdev_dir.iob ) dev_mmc_inval( XPTR( local_cxy , buffer ) , count<<9 );
    180177
    181     // get extended pointer on IOC[0] chdev 
     178    // get extended pointer on IOC[0] chdev
    182179    xptr_t  dev_xp = chdev_dir.ioc[0];
    183180
     
    191188    this->command.ioc.count     = count;
    192189
    193     // get driver command function 
     190    // get driver command function
    194191    cxy_t       dev_cxy = GET_CXY( dev_xp );
    195192    chdev_t   * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
     
    202199    dev_pic_disable_irq( lid , dev_xp );
    203200
    204     // call directly driver command 
     201    // call directly driver command
    205202    cmd( XPTR( local_cxy , this ) );
    206203
Note: See TracChangeset for help on using the changeset viewer.