Changeset 637 for trunk/kernel/devices
- Timestamp:
- Jul 18, 2019, 2:06:55 PM (4 years ago)
- Location:
- trunk/kernel/devices
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_dma.c
r619 r637 2 2 * dev_dma.c - DMA (Interrupt Controler Unit) generic device API implementation. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 61 61 error_t error; 62 62 63 lid_t lid = cluster_select_local_core( local_cxy ); 64 63 65 error = thread_kernel_create( &new_thread, 64 66 THREAD_DEV, 65 67 &chdev_server_func, 66 68 dma, 67 cluster_select_local_core());69 lid ); 68 70 if( error ) 69 71 { -
trunk/kernel/devices/dev_ioc.c
r626 r637 67 67 68 68 // select a core to execute the IOC server thread 69 lid_t lid = cluster_select_local_core( );69 lid_t lid = cluster_select_local_core( local_cxy ); 70 70 71 71 // bind the IOC IRQ to the selected core -
trunk/kernel/devices/dev_nic.c
r619 r637 2 2 * dev_nic.c - NIC (Network Controler) generic device API implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 58 58 59 59 // select a core to execute the NIC server thread 60 lid_t lid = cluster_select_local_core( );60 lid_t lid = cluster_select_local_core( local_cxy ); 61 61 62 62 // bind the NIC IRQ to the selected core -
trunk/kernel/devices/dev_txt.c
r626 r637 95 95 { 96 96 // select a core to execute the server thread 97 lid_t lid = cluster_select_local_core( );97 lid_t lid = cluster_select_local_core( local_cxy ); 98 98 99 99 // The unique IRQ from cluster 00's MTTY must be bound to a RX chdev … … 131 131 thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL ); 132 132 } 133 } 133 } // end dev_txt_init() 134 134 135 135 ////////////////////////////////////////////////////////////////////////////////// … … 166 166 // return I/O operation status from calling thread descriptor 167 167 return this->txt_cmd.error; 168 } 168 169 } // end dev_txt_access() 169 170 170 171 ///////////////////////////////////////// … … 173 174 uint32_t count ) 174 175 { 176 error_t error; 175 177 176 178 #if (DEBUG_SYS_WRITE & 1) … … 182 184 uint32_t cycle = (uint32_t)hal_get_cycles(); 183 185 if( DEBUG_DEV_TXT_TX < cycle ) 184 printk("\n[%s] thread[%x,%x] enters / cycle %d\n", 185 __FUNCTION__, this->process->pid, this->trdid, cycle ); 186 #endif 187 188 // get extended pointer on TXT[0] chdev 186 printk("\n[%s] thread[%x,%x] enters for <%s> / cycle %d\n", 187 __FUNCTION__, this->process->pid, this->trdid, buffer, cycle ); 188 #endif 189 190 // If we use MTTY (vci_multi_tty), we do a synchronous write on TXT[0] 191 // If we use TTY (vci_tty_tsar), we do a standard asynchronous write 192 // TODO this is not very clean ... [AG] 193 194 // get pointers on chdev 189 195 xptr_t dev_xp = chdev_dir.txt_tx[0]; 190 191 assert( (dev_xp != XPTR_NULL) , __FUNCTION__ , 192 "undefined TXT0 chdev descriptor" ); 193 194 // get TXTO chdev cluster and local pointer 195 cxy_t dev_cxy = GET_CXY( dev_xp ); 196 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 197 198 // If we use MTTYs (vci_multi_tty), we perform only sync writes 199 // Otherwise, we use vci_tty_tsar so we can use async writes 196 cxy_t dev_cxy = GET_CXY( dev_xp ); 197 chdev_t * dev_ptr = GET_PTR( dev_xp ); 200 198 201 199 if( dev_ptr->impl == IMPL_TXT_MTY ) … … 211 209 args.channel = channel; 212 210 213 // call d river function211 // call directly the driver function 214 212 aux( &args ); 215 213 216 return 0; 217 } 218 214 error = 0; 215 } 219 216 else 220 217 { 221 return dev_txt_access( TXT_WRITE , channel , buffer , count ); 218 // register command in chdev queue for an asynchronous access 219 error = dev_txt_access( TXT_WRITE , channel , buffer , count ); 220 221 if( error ) 222 { 223 printk("\n[ERROR] in %s : cannot write string %s / cycle %d\n", 224 __FUNCTION__, buffer, (uint32_t)hal_get_cycles() ); 225 } 222 226 } 223 227 … … 225 229 cycle = (uint32_t)hal_get_cycles(); 226 230 if( DEBUG_DEV_TXT_TX < cycle ) 227 printk("\n[%s] thread[%x,%x] exit / cycle %d\n",231 printk("\n[%s] thread[%x,%x] exit / cycle %d\n", 228 232 __FUNCTION__, this->process->pid, this->trdid, cycle ); 229 233 #endif … … 233 237 #endif 234 238 235 } 239 return error; 240 241 } // end dev_txt_write() 236 242 237 243 ///////////////////////////////////////// … … 239 245 char * buffer ) 240 246 { 247 error_t error; 241 248 242 249 #if (DEBUG_SYS_READ & 1) … … 252 259 #endif 253 260 254 return dev_txt_access( TXT_READ , channel , buffer , 1 ); 261 // register command in chdev queue for an asynchronous access 262 error = dev_txt_access( TXT_READ , channel , buffer , 1 ); 263 264 if( error ) 265 { 266 printk("\n[ERROR] in %s : cannot get character / cycle %d\n", 267 __FUNCTION__, (uint32_t)hal_get_cycles() ); 268 } 255 269 256 270 #if DEBUG_DEV_TXT_RX 257 271 cycle = (uint32_t)hal_get_cycles(); 258 272 if( DEBUG_DEV_TXT_RX < cycle ) 259 printk("\n[%s] thread[%x,%x] exit/ cycle %d\n",260 __FUNCTION__, this->process->pid, this->trdid, cycle );273 printk("\n[%s] thread[%x,%x] get character <%c> / cycle %d\n", 274 __FUNCTION__, this->process->pid, this->trdid, *buffer, cycle ); 261 275 #endif 262 276 … … 265 279 #endif 266 280 267 } 281 return error; 282 283 } // end dev_txt_read() 268 284 269 285 //////////////////////////////////////////////// -
trunk/kernel/devices/dev_txt.h
r626 r637 124 124 * device and the driver specific data structures when required. 125 125 * It creates the associated server thread and allocates a WTI from local ICU. 126 * It must de executed by a local thread.126 * It must be executed by a thread running in cluster containing the chdev descriptor. 127 127 ****************************************************************************************** 128 128 * @ chdev : local pointer on TXT device descriptor. … … 134 134 * by the "channel" argument. The corresponding request is actually registered in the 135 135 * chdev requests queue, and the calling thread is descheduled, blocked until 136 * transfer completion. 137 * It must be called in the client cluster. 136 * transfer completion. It can be called by any thread running in any cluster. 138 137 ****************************************************************************************** 139 138 * @ channel : TXT channel index. … … 148 147 * by the "channel" argument. The corresponding request is actually registered in the 149 148 * chdev requests queue, and the calling thread is descheduled, blocked until 150 * transfer completion. 151 * It must be called in the client cluster. 149 * transfer completion. It can be called by any thread running in any cluster. 152 150 ****************************************************************************************** 153 151 * @ channel : TXT channel index. … … 166 164 * interfering with another possible TXT access to another terminal. 167 165 * As it is used for debug, the command arguments <buffer> and <count> are registerd 168 * in a specific "txt_sy c_args_t" structure passed to the driver "aux" function.166 * in a specific "txt_sync_args_t" structure passed to the driver "aux" function. 169 167 **************************************************************************************** 170 168 * @ buffer : local pointer on source buffer containing the string.
Note: See TracChangeset
for help on using the changeset viewer.