Changeset 212
- Timestamp:
- Jul 17, 2017, 1:24:58 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_ioc.c
r211 r212 1 1 /* 2 2 * dev_ioc.c - IOC (Block Device Controler) generic device API implementation. 3 * 3 * 4 4 * Author Alain Greiner (2016) 5 5 * … … 8 8 * This file is part of ALMOS-MK 9 9 * 10 * ALMOS-MKH .is free software; you can redistribute it and/or modify it10 * ALMOS-MKH is free software; you can redistribute it and/or modify it 11 11 * under the terms of the GNU General Public License as published by 12 12 * the Free Software Foundation; version 2.0 of the License. 13 13 * 14 * ALMOS-MKH .is distributed in the hope that it will be useful, but14 * ALMOS-MKH is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU … … 18 18 * 19 19 * 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, 21 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 22 */ … … 27 27 #include <soclib_bdv.h> 28 28 #include <soclib_hba.h> 29 //#include <soclib_sdc.h>30 //#include <soclib_spi.h>31 //#include <soclib_rdk.h>32 29 #include <thread.h> 33 30 #include <printk.h> … … 88 85 &chdev_sequencial_server, 89 86 ioc, 90 lid ); 87 lid ); 91 88 92 89 assert( (error == 0) , __FUNCTION__ , "cannot create server thread" ); … … 94 91 // set "server" field in ioc descriptor 95 92 ioc->server = new_thread; 96 93 97 94 // start server thread 98 95 thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL ); 99 96 100 97 } // end dev_ioc_init() 101 98 … … 114 111 115 112 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 , 118 115 lba , (intptr_t)buffer , hal_get_cycles() ); 119 116 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 ) 122 119 { 123 120 if ( cmd_type == IOC_READ ) dev_mmc_inval( XPTR( local_cxy , buffer ) , count<<9 ); … … 143 140 144 141 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", 146 143 __FUNCTION__ , this->trdid , this->process->pid , 147 144 this->command.ioc.error , hal_get_cycles() ); 148 145 149 146 // return I/O operation status 150 return this->command.ioc.error; 147 return this->command.ioc.error; 151 148 152 149 } // end dev_ioc_access() … … 157 154 uint32_t count ) 158 155 { 159 return dev_ioc_access( IOC_READ , buffer , lba , count ); 160 } 156 return dev_ioc_access( IOC_READ , buffer , lba , count ); 157 } 161 158 162 159 //////////////////////////////////////////// … … 165 162 uint32_t count ) 166 163 { 167 return dev_ioc_access( IOC_WRITE , buffer , lba , count ); 164 return dev_ioc_access( IOC_WRITE , buffer , lba , count ); 168 165 } 169 166 … … 173 170 uint32_t count ) 174 171 { 175 // get pointer on calling thread 172 // get pointer on calling thread 176 173 thread_t * this = CURRENT_THREAD; 177 174 178 // software L2/L3 cache coherence for memory buffer 175 // software L2/L3 cache coherence for memory buffer 179 176 if( chdev_dir.iob ) dev_mmc_inval( XPTR( local_cxy , buffer ) , count<<9 ); 180 177 181 // get extended pointer on IOC[0] chdev 178 // get extended pointer on IOC[0] chdev 182 179 xptr_t dev_xp = chdev_dir.ioc[0]; 183 180 … … 191 188 this->command.ioc.count = count; 192 189 193 // get driver command function 190 // get driver command function 194 191 cxy_t dev_cxy = GET_CXY( dev_xp ); 195 192 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); … … 202 199 dev_pic_disable_irq( lid , dev_xp ); 203 200 204 // call directly driver command 201 // call directly driver command 205 202 cmd( XPTR( local_cxy , this ) ); 206 203
Note: See TracChangeset
for help on using the changeset viewer.