Changeset 647 for trunk/kernel
- Timestamp:
- Oct 22, 2019, 1:48:51 PM (5 years ago)
- Location:
- trunk/kernel
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/Makefile
r641 r647 19 19 $(HAL_ARCH)/build/drivers/soclib_nic.o \ 20 20 $(HAL_ARCH)/build/drivers/soclib_dma.o \ 21 $(HAL_ARCH)/build/drivers/soclib_fbf.o \ 21 22 $(HAL_ARCH)/build/drivers/soclib_iob.o 22 23 … … 190 191 build/syscalls/sys_get_best_core.o \ 191 192 build/syscalls/sys_get_nb_cores.o \ 192 build/syscalls/sys_get_thread_info.o 193 build/syscalls/sys_get_thread_info.o \ 194 build/syscalls/sys_fbf.o 193 195 194 196 VFS_OBJS = build/fs/vfs.o \ … … 231 233 232 234 233 ############################## 235 ###################################### 234 236 # rules to compile the drivers and hal 235 237 $(HAL_ARCH)/build/%: -
trunk/kernel/devices/dev_dma.c
r637 r647 41 41 void dev_dma_init( chdev_t * dma ) 42 42 { 43 // get implementation & channel from DMA dma descriptor 44 uint32_t impl = dma->impl; 43 // get channel from chdev descriptor 45 44 uint32_t channel = dma->channel; 46 45 … … 49 48 50 49 // call driver init function 51 hal_drivers_dma_init( dma , impl);50 hal_drivers_dma_init( dma ); 52 51 53 52 // bind IRQ to the core defined by the DMA channel … … 104 103 xptr_t dev_xp = chdev_dir.dma[channel]; 105 104 106 assert( (dev_xp != XPTR_NULL) , "undefined DMA chdev descriptor" ); 105 // check DMA chdev definition 106 assert( (dev_xp != XPTR_NULL) , "undefined DMA chdev descriptor" ); 107 107 108 108 // register command in calling thread descriptor -
trunk/kernel/devices/dev_dma.h
r565 r647 36 36 * to/from remote clusters. The burst size is defined by the cache line size. 37 37 * Each DMA channel is described by a specific chdev descriptor, handling its private 38 * waiting threads queue. 39 * It implement one single command : move data from a (remote) source buffer 40 * to a (remote) destination buffer. 38 * waiting threads queue. It implement one single command : move data from a (remote) 39 * source buffer to a (remote) destination buffer. 41 40 ****************************************************************************************/ 42 41 -
trunk/kernel/devices/dev_fbf.c
r565 r647 1 1 /* 2 * dev_fbf.c - FBF ( Block Device Controler) generic device API implementation.2 * dev_fbf.c - FBF (Frame Buffer) 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 … … 25 25 #include <hal_kernel_types.h> 26 26 #include <hal_gpt.h> 27 #include <hal_drivers.h> 27 28 #include <thread.h> 28 29 #include <printk.h> … … 37 38 extern chdev_directory_t chdev_dir; // allocated in kernel_init.c 38 39 40 /////////////////////////////////////////// 41 char * dev_fbf_cmd_str( uint32_t cmd_type ) 42 { 43 if ( cmd_type == FBF_READ ) return "READ"; 44 else if( cmd_type == FBF_WRITE ) return "WRITE"; 45 else if( cmd_type == FBF_GET_CONFIG ) return "GET_CONFIG"; 46 else return "undefined"; 47 } 48 39 49 //////////////////////////////////// 40 void dev_fbf_init( chdev_t * chdev)50 void dev_fbf_init( chdev_t * fbf ) 41 51 { 42 // set FBF chdev extension fields43 // TODO this should be done in the implementation44 // TODO specific part, as these parameters must be obtained from the hardware.45 chdev->ext.fbf.width = CONFIG_FBF_WIDTH;46 chdev->ext.fbf.height = CONFIG_FBF_HEIGHT;47 48 // get implementation49 uint32_t impl = chdev->impl;50 51 52 // set chdev name 52 strcpy( chdev->name, "fbf" );53 strcpy( fbf->name, "fbf" ); 53 54 54 55 // call driver init function 55 if( impl == IMPL_FBF_SCL ) 56 { 57 printk("\n[WARNING] Soclib FBF driver not implemented yet\n"); 58 } 59 else 60 { 61 assert( false , "undefined FBF device implementation" ); 62 } 56 hal_drivers_fbf_init( fbf ); 63 57 64 58 } // end dev_fbf_init() 65 59 66 ///////////////////////////////////////// 67 void dev_fbf_get_size( uint32_t * width, 68 uint32_t * height ) 60 ////////////////////////////////////////// 61 void dev_fbf_get_config( uint32_t * width, 62 uint32_t * height, 63 uint32_t * type ) 69 64 { 70 65 // get extended pointer on FBF chdev descriptor … … 80 75 *width = hal_remote_l32( XPTR( dev_cxy , &dev_ptr->ext.fbf.width ) ); 81 76 *height = hal_remote_l32( XPTR( dev_cxy , &dev_ptr->ext.fbf.height ) ); 77 *type = hal_remote_l32( XPTR( dev_cxy , &dev_ptr->ext.fbf.subsampling ) ); 82 78 83 } // end dev_fbf_get_ size()79 } // end dev_fbf_get_config() 84 80 85 ///////////////////////////// 86 error_t dev_fbf_alloc( void ) 81 ///////////////////////////////////////////////////// 82 error_t dev_fbf_move_data( uint32_t cmd_type, 83 void * user_buffer, 84 uint32_t length, 85 uint32_t offset ) 87 86 { 88 // get extended pointer on FBF chdev descriptor89 // xptr_t dev_xp = chdev_dir.fbf[0];87 // get pointer on calling thread 88 thread_t * this = CURRENT_THREAD; 90 89 91 // assert( (dev_xp != XPTR_NULL) , "undefined FBF chdev descriptor" ); 90 #if DEBUG_DEV_FBF 91 uint32_t cycle = (uint32_t)hal_get_cycles(); 92 if( DEBUG_DEV_FBF < cycle ) 93 printk("\n[%s] thread[%x,%x] : %s / buffer %x / length %d / offset %x / cycle %d\n", 94 __FUNCTION__ , this->process->pid, this->trdid, 95 dev_fbf_cmd_str(cmd_type), user_buffer, length, offset, cycle ); 96 #endif 92 97 93 // get FBF chdev cluster and local pointer 94 // cxy_t dev_cxy = GET_CXY( dev_xp ); 95 // chdev_t * dev_ptr = GET_PTR( dev_xp ); 98 // get pointers on FBF chdev 99 xptr_t fbf_xp = chdev_dir.fbf[0]; 100 cxy_t fbf_cxy = GET_CXY( fbf_xp ); 101 chdev_t * fbf_ptr = GET_PTR( fbf_xp ); 96 102 97 // try to get FBF ownership 103 // check fbf_xp definition 104 assert( (fbf_xp != XPTR_NULL) , "undefined FBF chdev descriptor" ); 98 105 99 assert( false , "not implemented yet" ); 100 101 } // end dev_fbf_alloc() 102 103 ///////////////////////// 104 void dev_fbf_free( void ) 105 { 106 // get extended pointer on FBF chdev descriptor 107 // xptr_t dev_xp = chdev_dir.fbf[0]; 108 109 // assert( (dev_xp != XPTR_NULL) , "undefined FBF chdev descriptor" ); 110 111 // get FBF chdev cluster and local pointer 112 // cxy_t dev_cxy = GET_CXY( dev_xp ); 113 // chdev_t * dev_ptr = (GET_PTR( dev_xp ); 114 115 // release FBF ownership 116 117 assert( false , "not implemented yet" ); 118 119 } // end dev_fbf_free() 120 121 ////////////////////////////////////////////////////////////////////////////////// 122 // This static function is called by dev_fbf_read() & dev_fbf_write() functions. 123 // It builds and registers the command in the calling thread descriptor. 124 // Then, it registers the calling thread in the relevant DMA chdev waiting queue. 125 // Finally it blocks on the THREAD_BLOCKED_DEV condition and deschedule. 126 ////////////////////////////////////i///////////////////////////////////////////// 127 static error_t dev_fbf_access( bool_t to_fbf, 128 char * buffer, 129 uint32_t length, 130 uint32_t offset ) 131 { 132 133 // get extended pointer on FBF chdev descriptor 134 xptr_t fbf_xp = chdev_dir.fbf[0]; 135 136 assert( (fbf_xp != XPTR_NULL) , "undefined FBF chdev descriptor" ); 137 138 // get FBF chdev cluster and local pointer 139 cxy_t fbf_cxy = GET_CXY( fbf_xp ); 140 chdev_t * fbf_ptr = (chdev_t *)GET_PTR( fbf_xp ); 141 142 // get frame buffer base address, width and height 143 xptr_t base = hal_remote_l64( XPTR( fbf_cxy , &fbf_ptr->base ) ); 106 // get frame buffer width and height 144 107 uint32_t width = hal_remote_l32 ( XPTR( fbf_cxy , &fbf_ptr->ext.fbf.width ) ); 145 108 uint32_t height = hal_remote_l32 ( XPTR( fbf_cxy , &fbf_ptr->ext.fbf.height ) ); 146 109 147 148 149 110 // check offset and length versus FBF size 111 assert( ((offset + length) <= (width * height)) , 112 "offset %d / length %d / width %d / height %d\n", offset, length, width, height ); 150 113 151 // compute extended pointers on frame buffer and memory buffer 152 xptr_t mem_buf_xp = XPTR( local_cxy , buffer ); 153 xptr_t fbf_buf_xp = base + offset; 114 // register command in calling thread descriptor 115 this->fbf_cmd.dev_xp = fbf_xp; 116 this->fbf_cmd.type = cmd_type; 117 this->fbf_cmd.buffer = user_buffer; 118 this->fbf_cmd.offset = offset; 119 this->fbf_cmd.length = length; 154 120 155 // register command in DMA chdev 156 if( to_fbf ) dev_dma_remote_memcpy( fbf_buf_xp , mem_buf_xp , length ); 157 else dev_dma_remote_memcpy( mem_buf_xp , fbf_buf_xp , length ); 121 // get driver command function 122 dev_cmd_t * cmd = (dev_cmd_t *)hal_remote_lpt( XPTR( fbf_cxy , &fbf_ptr->cmd ) ); 158 123 159 return 0; 124 // call driver 125 cmd( XPTR( local_cxy , this ) ); 160 126 161 } // end dev_fbf_access() 127 error_t error = this->fbf_cmd.error; 162 128 163 //////////////////////////////////////////// 164 error_t dev_fbf_read( char * buffer, 165 uint32_t length, 166 uint32_t offset ) 167 { 168 169 #if DEBUG_DEV_FBF_RX 170 uint32_t cycle = (uint32_t)hal_get_cycles(); 171 if( DEBUG_DEV_FBF_RX < cycle ) 172 printk("\n[DBG] %s : thread %x enter / process %x / vaddr %x / size %x\n", 173 __FUNCTION__ , this, this->process->pid , buffer , buf_paddr ); 129 #if DEBUG_DEV_FBF 130 cycle = (uint32_t)hal_get_cycles(); 131 if( DEBUG_DEV_FBF < cycle ) 132 printk("\n[%s] thread[%x,%x] completes %s / error = %d / cycle %d\n", 133 __FUNCTION__ , this->process->pid, this->trdid, 134 dev_fbf_cmd_str(cmd_type), error , cycle ); 174 135 #endif 175 136 176 return dev_fbf_access( false , buffer , length , offset ); 137 // return I/O operation status 138 return error; 177 139 178 #if DEBUG_DEV_FBF_RX 179 cycle = (uint32_t)hal_get_cycles(); 180 if( DEBUG_DEV_FBF_RX < cycle ) 181 printk("\n[DBG] %s : thread %x exit / process %x / vaddr %x / size %x\n", 182 __FUNCTION__ , this, this->process->pid , buffer , buf_paddr ); 183 #endif 184 185 } 186 187 //////////////////////////////////////////// 188 error_t dev_fbf_write( char * buffer, 189 uint32_t length, 190 uint32_t offset ) 191 { 192 193 #if DEBUG_DEV_FBF_TX 194 uint32_t cycle = (uint32_t)hal_get_cycles(); 195 if( DEBUG_DEV_FBF_TX < cycle ) 196 printk("\n[DBG] %s : thread %x enter / process %x / vaddr %x / size %x\n", 197 __FUNCTION__ , this, this->process->pid , buffer , buf_paddr ); 198 #endif 199 200 return dev_fbf_access( true , buffer , length , offset ); 201 202 #if DEBUG_DEV_FBF_RX 203 cycle = (uint32_t)hal_get_cycles(); 204 if( DEBUG_DEV_FBF_RX < cycle ) 205 printk("\n[DBG] %s : thread %x exit / process %x / vaddr %x / size %x\n", 206 __FUNCTION__ , this, this->process->pid , buffer , buf_paddr ); 207 #endif 208 209 } 140 } // end dev_fbf_move_data() -
trunk/kernel/devices/dev_fbf.h
r483 r647 2 2 * dev_fbf.h - FBF (Block Device Controler) generic device API definition. 3 3 * 4 * Author Alain Greiner (2016 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 26 26 27 27 #include <hal_kernel_types.h> 28 #include <shared_fbf.h> 28 29 29 30 /**** Forward declarations ****/ … … 36 37 * This device provide access to an external graphic display, that is seen 37 38 * as a fixed size frame buffer, mapped in the kernel address space. 38 * Each pixel takes one byte defining 256 levels of gray.39 * The supported pixel encoding types are defined in the <shared_fbf.h> file. 39 40 * 40 * It supports five command types: 41 * - SIZE : return the Frame buffer width and height. 42 * - ALLOC : give exclusive ownership of the frame buffer to the requesting process. 43 * - FREE : release the exclusive ownership to the kernel. 44 * - READ : move a given number of bytes from the frame buffer to a memory buffer. 45 * - WRITE : move a given number of bytes from a memory buffer to the frame buffer. 41 * It supports three command types: 42 * GET_CONFIG : return frame buffer size and type. 43 * READ : move bytes from frame buffer to memory / deschedule the calling thread. 44 * WRITE : move bytes from memory to frame buffer / deschedule the calling thread. 46 45 * 47 * It does not creates the associated server thread. 48 * - The SIZE, ALLOC, FREE commands are directly handled by the FBF device. 49 * - The READ & WRITE commands are actually registered in the DMA device waiting queue, 50 * using the local DMA channel defined by the calling core lid. 46 * The READ and WRITE operations do not use the FBF device waiting queue, 47 * the server thread, and the IOC IRQ. The client thread does not deschedule: 48 * it registers the command in the thread descriptor, and calls directly the FBF driver. 49 * that makes a (user <-> kernel) memcpy. 50 * 51 * Note: As we don't use any external DMA to move data, but a purely software approach, 52 * there is no L2/L3 coherence issue. 51 53 *****************************************************************************************/ 52 54 … … 57 59 typedef struct fbf_extend_s 58 60 { 59 uint32_t width; /*! number of pixels per line. */ 60 uint32_t height; /*! total number of lines. */ 61 uint32_t width; /*! number of pixels per line. */ 62 uint32_t height; /*! total number of lines. */ 63 uint32_t subsampling; /*! pixel encoding type. */ 61 64 } 62 65 fbf_extend_t; … … 71 74 IMPL_FBF_SCL = 0, 72 75 IMPL_FBF_I86 = 1, 73 } 76 } 74 77 fbf_impl_t; 75 76 /******************************************************************************************77 * This defines the (implementation independant) command passed to the driver.78 *****************************************************************************************/79 78 80 79 typedef struct fbf_command_s 81 80 { 82 xptr_t dev_xp; /*! extended pointer on device descriptor*/83 uint32_t t o_fbf; /*! requested operation type.*/84 uint32_t length; /*! number of bytes.*/85 uint32_t offset; /*! offset in frame buffer (bytes)*/86 xptr_t buf_xp; /*! extended pointer on memory buffer*/87 uint32_t error; /*! operation status (0 if success)*/81 xptr_t dev_xp; /*! extended pointer on device descriptor */ 82 uint32_t type; /*! requested operation type. */ 83 uint32_t length; /*! number of bytes. */ 84 uint32_t offset; /*! offset in frame buffer (bytes) */ 85 void * buffer; /*! pointer on memory buffer in user space */ 86 uint32_t error; /*! operation status (0 if success) */ 88 87 } 89 88 fbf_command_t; 89 90 91 /****************************************************************************************** 92 * This function returns a printable string for a given FBF command <cmd_type>. 93 ****************************************************************************************** 94 * @ cmd_type : FBF command type (defined in shared_fbf.h file). 95 * @ returns a string pointer. 96 *****************************************************************************************/ 97 char * dev_fbf_cmd_str( uint32_t cmd_type ); 90 98 91 99 /****************************************************************************************** 92 100 * This function completes the FBF chdev descriptor initialisation. 93 101 * It calls the specific driver initialisation function, to initialise the hardware 94 * device and the specific data structures when required by the implementation. 95 * It must be called by a local thread. 96 * 97 * TODO In this first approach, the "width" and "height" parameters are defined 98 * by the CONFIG_FBF_WIDTH & CONFIG_FBF_HEIGHT in the kernel_config.h file. 99 * These parameters should be provided by the driver, accessing dedicated 100 * adressable registers in the FBF controler. 102 * device and the chdev extension. It must be called by a local thread. 101 103 ****************************************************************************************** 102 104 * @ chdev : pointer on FBF chdev descriptor. … … 105 107 106 108 /****************************************************************************************** 107 * This function returns the fixed size frame buffer features. 109 * This function returns the frame buffer size and type. 110 * It does NOT access the hardware, as the size and type have been registered 111 * in the chdev descriptor extension. 108 112 ****************************************************************************************** 109 * @ width : number of pixels (bytes) per line. 110 * @ heigth : total number of lines. 113 * @ width : [out] number of pixels per line. 114 * @ height : [out] total number of lines. 115 * @ type : [out] pixel encoding type. 111 116 *****************************************************************************************/ 112 void dev_fbf_get_size( uint32_t * width, 113 uint32_t * height ); 117 void dev_fbf_get_config( uint32_t * width, 118 uint32_t * height, 119 uint32_t * type ); 114 120 115 121 /****************************************************************************************** 116 * This function try to get the exclusive ownership of the frame buffer. 122 * This blocking function moves <length> bytes between the frame buffer, starting from 123 * byte defined by <offset>, and an user buffer defined by the <user_buffer> argument. 124 * It can be called by a client thread running in any cluster. 125 * The transfer direction are defined by the <cmd_type> argument. 126 * The request is registered in the client thread descriptor, but the client thread is 127 * not descheduled, and calls directly the FBF driver. 117 128 ****************************************************************************************** 118 * @ return 0 if success / return EINVAL if frame buffer already allocated. 119 *****************************************************************************************/ 120 error_t dev_fbf_alloc( void ); 121 122 /****************************************************************************************** 123 * This function releases the exclusive ownership of the frame buffer. 124 *****************************************************************************************/ 125 void dev_fbf_free( void ); 126 127 /****************************************************************************************** 128 * This blocking function try to tranfer <length> bytes from the frame buffer, starting 129 * from <offset>, to the memory buffer defined by <buffer> argument. 130 * The corresponding request is actually registered in the local DMA device waiting 131 * queue that has the same index as the calling core. The calling thread is descheduled, 132 * waiting on transfer completion. It will be resumed by the DMA IRQ signaling completion. 133 ****************************************************************************************** 134 * @ buffer : local pointer on target buffer in memory. 135 * @ length : number of bytes. 136 * @ offset : first byte in frame buffer. 129 * @ cmd_type : FBF_READ / FBF_WRITE / FBF_SYNC_READ / FBF_SYN_WRITE. 130 * @ user_buffer : pointer on memory buffer in user space. 131 * @ length : number of bytes. 132 * @ offset : first byte in frame buffer. 137 133 * @ returns 0 if success / returns EINVAL if error. 138 134 *****************************************************************************************/ 139 error_t dev_fbf_read( char * buffer, 140 uint32_t length, 141 uint32_t offset ); 142 143 /****************************************************************************************** 144 * This blocking function try to tranfer <length> bytes from a memory buffer defined 145 * by <buffer> argument, to the frame buffer, starting from <offset>. 146 * The corresponding request is actually registered in the local DMA device waiting 147 * queue, that has the same index as the calling core. The calling thread is descheduled, 148 * waiting on transfer completion. It will be resumed by the DMA IRQ signaling completion. 149 ****************************************************************************************** 150 * @ buffer : local pointer on source buffer in memory. 151 * @ length : number of bytes. 152 * @ offset : first byte in frame buffer. 153 * @ returns 0 if success / returns EINVAL if error. 154 *****************************************************************************************/ 155 error_t dev_fbf_write( char * buffer, 156 uint32_t length, 157 uint32_t offset ); 135 error_t dev_fbf_move_data( uint32_t cmd_type, 136 void * user_buffer, 137 uint32_t length, 138 uint32_t offset ); 158 139 159 140 #endif /* _DEV_FBF_H */ -
trunk/kernel/devices/dev_iob.c
r565 r647 35 35 void dev_iob_init( chdev_t * chdev ) 36 36 { 37 // get implementation38 uint32_t impl = chdev->impl;39 40 37 // set chdev name 41 38 strcpy( chdev->name , "iob" ); 42 39 43 40 // call driver init function 44 hal_drivers_iob_init( chdev , impl);41 hal_drivers_iob_init( chdev ); 45 42 } 46 43 -
trunk/kernel/devices/dev_ioc.c
r637 r647 50 50 void dev_ioc_init( chdev_t * ioc ) 51 51 { 52 // the PIC chdev must be initialized before the IOC chdev, because 53 // the IOC chdev initialisation requires the routing of an external IRQ 54 xptr_t pic_xp = chdev_dir.pic; 55 56 assert( (pic_xp != XPTR_NULL) , "PIC not initialised before IOC" ); 57 58 // get implementation and channel from chdev descriptor 59 uint32_t impl = ioc->impl; 52 // get channel from chdev descriptor 60 53 uint32_t channel = ioc->channel; 61 54 … … 64 57 65 58 // call driver init function 66 hal_drivers_ioc_init( ioc , impl);59 hal_drivers_ioc_init( ioc ); 67 60 68 61 // select a core to execute the IOC server thread … … 90 83 ioc->server = new_thread; 91 84 92 // set "chdev field in thread descriptor85 // set "chdev" field in thread descriptor 93 86 new_thread->chdev = ioc; 94 87 … … 98 91 } // end dev_ioc_init() 99 92 100 ////////////////////////////////////////////////////////////////////////////////// 101 // This static function is called by dev_ioc_read() & dev_ioc_write() functions. 102 // It builds and registers the command in the calling thread descriptor. 103 // Then, it registers the calling thead in IOC chdev waiting queue. 104 // Finally it blocks on the THREAD_BLOCKED_IO condition and deschedule. 105 ////////////////////////////////////i///////////////////////////////////////////// 106 static error_t dev_ioc_access( uint32_t cmd_type, 107 uint8_t * buffer, 108 uint32_t lba, 109 uint32_t count ) 93 /////////////////////////////////////////////// 94 error_t dev_ioc_move_data( uint32_t cmd_type, 95 xptr_t buffer_xp, 96 uint32_t lba, 97 uint32_t count ) 110 98 { 111 99 thread_t * this = CURRENT_THREAD; // pointer on client thread 112 100 113 #if ( DE V_IOC_RX ||DEV_IOC_TX )101 #if ( DEBUG_DEV_IOC_RX || DEBUG_DEV_IOC_TX ) 114 102 uint32_t cycle = (uint32_t)hal_get_cycles(); 115 103 #endif … … 118 106 if( chdev_dir.iob ) 119 107 { 120 if (cmd_type == IOC_READ) dev_mmc_inval( XPTR( local_cxy , buffer ) , count<<9 ); 121 else dev_mmc_sync ( XPTR( local_cxy , buffer ) , count<<9 ); 108 if( (cmd_type == IOC_SYNC_READ) || (cmd_type == IOC_READ) ) 109 { 110 dev_mmc_inval( buffer_xp , count<<9 ); 111 } 112 else // (cmd_type == IOC_SYNC_WRITE) or (cmd_type == IOC_WRITE) 113 { 114 dev_mmc_sync ( buffer_xp , count<<9 ); 115 } 122 116 } 123 117 124 118 // get extended pointer on IOC chdev descriptor 125 xptr_t dev_xp= chdev_dir.ioc[0];119 xptr_t ioc_xp = chdev_dir.ioc[0]; 126 120 127 121 // check dev_xp 128 assert( (dev_xp != XPTR_NULL) , "undefined IOC chdev descriptor" );129 130 // register command in calling thread descriptor131 this->ioc_cmd.dev_xp = dev_xp;132 this->ioc_cmd.type = cmd_type;133 this->ioc_cmd.buf_xp = XPTR( local_cxy , buffer );134 this->ioc_cmd.lba = lba;135 this->ioc_cmd.count = count;136 137 // register client thread in IOC chdev waiting queue, activate server thread,138 // block client thread on THREAD_BLOCKED_IO and deschedule.139 // it is re-activated by the ISR signaling IO operation completion.140 chdev_register_command( dev_xp );141 142 #if(DEV_IOC_RX & 1)143 if( (DEV_IOC_RX < cycle) && (cmd_type != IOC_WRITE) )144 printk("\n[%s] thread[%x,%x] resumes for RX\n",145 __FUNCTION__, this->process->pid , this->trdid )146 #endif147 148 #if(DEV_IOC_TX & 1)149 if( (DEV_IOC_RX < cycle) && (cmd_type == IOC_WRITE) )150 printk("\n[%s] thread[%x,%x] resumes for TX\n",151 __FUNCTION__, this->process->pid , this->trdid )152 #endif153 154 // return I/O operation status155 return this->ioc_cmd.error;156 157 } // end dev_ioc_access()158 159 ////////////////////////////////////////////160 error_t dev_ioc_read( uint8_t * buffer,161 uint32_t lba,162 uint32_t count )163 {164 165 #if DEBUG_DEV_IOC_RX166 uint32_t cycle = (uint32_t)hal_get_cycles();167 thread_t * this = CURRENT_THREAD;168 if( DEBUG_DEV_IOC_RX < cycle )169 printk("\n[%s] thread[%x,%x] enters / lba %x / buffer %x / cycle %d\n",170 __FUNCTION__ , this->process->pid, this->trdid, lba, buffer, cycle );171 #endif172 173 return dev_ioc_access( IOC_READ , buffer , lba , count );174 }175 176 ////////////////////////////////////////////177 error_t dev_ioc_write( uint8_t * buffer,178 uint32_t lba,179 uint32_t count )180 {181 182 #if DEBUG_DEV_IOC_TX183 uint32_t cycle = (uint32_t)hal_get_cycles();184 thread_t * this = CURRENT_THREAD;185 if( DEBUG_DEV_IOC_TX < cycle )186 printk("\n[%s] thread[%x,%x] enters / lba %x / buffer %x / cycle %d\n",187 __FUNCTION__ , this->process->pid, this->trdid, lba, buffer, cycle );188 #endif189 190 return dev_ioc_access( IOC_WRITE , buffer , lba , count );191 }192 193 194 195 196 197 //////////////////////////////////////////////////////////////////////////////////198 // This static function is called by dev_ioc_sync_read() & dev_ioc_sync_write().199 // It builds and registers the command in the calling thread descriptor, and200 // calls directly the blocking IOC driver command, that returns only when the201 // IO operation is completed.202 ////////////////////////////////////i/////////////////////////////////////////////203 error_t dev_ioc_sync_access( uint32_t cmd_type,204 xptr_t buffer_xp,205 uint32_t lba,206 uint32_t count )207 {208 // get pointer on calling thread209 thread_t * this = CURRENT_THREAD;210 211 // software L2/L3 cache coherence for memory buffer212 if( chdev_dir.iob )213 {214 if (cmd_type == IOC_SYNC_READ) dev_mmc_inval( buffer_xp , count<<9 );215 else dev_mmc_sync ( buffer_xp , count<<9 );216 }217 218 // get extended pointer on IOC[0] chdev219 xptr_t ioc_xp = chdev_dir.ioc[0];220 221 // check ioc_xp222 122 assert( (ioc_xp != XPTR_NULL) , "undefined IOC chdev descriptor" ); 223 123 … … 229 129 this->ioc_cmd.count = count; 230 130 231 // get driver command function 232 cxy_t ioc_cxy = GET_CXY( ioc_xp ); 233 chdev_t * ioc_ptr = GET_PTR( ioc_xp ); 234 dev_cmd_t * cmd = (dev_cmd_t *)hal_remote_lpt( XPTR( ioc_cxy , &ioc_ptr->cmd ) ); 235 236 // get core local index for the core handling the IOC IRQ 237 thread_t * server = (thread_t *)hal_remote_lpt( XPTR( ioc_cxy , &ioc_ptr->server ) ); 238 core_t * core = (core_t *)hal_remote_lpt( XPTR( ioc_cxy , &server->core ) ); 239 lid_t lid = (lid_t)hal_remote_l32( XPTR( ioc_cxy , &core->lid ) ); 240 241 // mask the IRQ 242 dev_pic_disable_irq( lid , ioc_xp ); 243 244 // call driver function 245 cmd( XPTR( local_cxy , this ) ); 246 247 // unmask the IRQ 248 dev_pic_enable_irq( lid , ioc_xp ); 249 250 // return I/O operation status from calling thread descriptor 131 // for a synchronous acces, the driver is directly called by the client thread 132 if( (cmd_type == IOC_SYNC_READ) || (cmd_type == IOC_SYNC_WRITE) ) 133 { 134 135 #if DEBUG_DEV_IOC_RX 136 uint32_t cycle = (uint32_t)hal_get_cycles(); 137 if( (DEBUG_DEV_IOC_RX < cycle) && (cmd_type == IOC_SYNC_READ) ) 138 printk("\n[%s] thread[%x,%x] enters for SYNC_READ / lba %x / buffer[%x,%x] / cycle %d\n", 139 __FUNCTION__ , this->process->pid, this->trdid, lba, 140 GET_CXY(buffer_xp), GET_PTR(buffer_xp), cycle ); 141 #endif 142 143 #if DEBUG_DEV_IOC_TX 144 uint32_t cycle = (uint32_t)hal_get_cycles(); 145 if( (DEBUG_DEV_IOC_TX < cycle) && (cmd_type == IOC_SYNC_WRITE) ) 146 printk("\n[%s] thread[%x,%x] enters for SYNC_WRITE / lba %x / buffer[%x,%x] / cycle %d\n", 147 __FUNCTION__ , this->process->pid, this->trdid, lba, 148 GET_CXY(buffer_xp), GET_PTR(buffer_xp), cycle ); 149 #endif 150 // get driver command function 151 cxy_t ioc_cxy = GET_CXY( ioc_xp ); 152 chdev_t * ioc_ptr = GET_PTR( ioc_xp ); 153 dev_cmd_t * cmd = (dev_cmd_t *)hal_remote_lpt( XPTR( ioc_cxy , &ioc_ptr->cmd ) ); 154 155 // call driver function 156 cmd( XPTR( local_cxy , this ) ); 157 158 #if DEBUG_DEV_IOC_RX 159 if( (DEBUG_DEV_IOC_RX < cycle) && (cmd_type == IOC_SYNC_READ) ) 160 printk("\n[%s] thread[%x,%x] resumes for IOC_SYNC_READ\n", 161 __FUNCTION__, this->process->pid , this->trdid ) 162 #endif 163 164 #if DEBUG_DEV_IOC_TX 165 if( (DEBUG_DEV_IOC_RX < cycle) && (cmd_type == IOC_SYNC_WRITE) ) 166 printk("\n[%s] thread[%x,%x] resumes for IOC_SYNC_WRITE\n", 167 __FUNCTION__, this->process->pid , this->trdid ) 168 #endif 169 170 } 171 // for an asynchronous access, the client thread registers in the chdev waiting queue, 172 // activates server thread, blocks on THREAD_BLOCKED_IO and deschedules. 173 // It is re-activated by the server thread after IO operation completion. 174 else // (cmd_type == IOC_READ) || (cmd_type == IOC_WRITE) 175 { 176 177 #if DEBUG_DEV_IOC_RX 178 uint32_t cycle = (uint32_t)hal_get_cycles(); 179 if( (DEBUG_DEV_IOC_RX < cycle) && (cmd_type == IOC_READ) ) 180 printk("\n[%s] thread[%x,%x] enters for READ / lba %x / buffer[%x,%x] / cycle %d\n", 181 __FUNCTION__ , this->process->pid, this->trdid, lba, 182 GET_CXY(buffer_xp), GET_PTR(buffer_xp), cycle ); 183 #endif 184 185 #if DEBUG_DEV_IOC_TX 186 uint32_t cycle = (uint32_t)hal_get_cycles(); 187 if( (DEBUG_DEV_IOC_TX < cycle) && (cmd_type == IOC_WRITE) ) 188 printk("\n[%s] thread[%x,%x] enters for WRITE / lba %x / buffer[%x,%x] / cycle %d\n", 189 __FUNCTION__ , this->process->pid, this->trdid, lba, 190 GET_CXY(buffer_xp), GET_PTR(buffer_xp), cycle ); 191 #endif 192 chdev_register_command( ioc_xp ); 193 194 #if(DEBUG_DEV_IOC_RX ) 195 if( (DEBUG_DEV_IOC_RX < cycle) && (cmd_type == IOC_READ) ) 196 printk("\n[%s] thread[%x,%x] resumes for IOC_READ\n", 197 __FUNCTION__, this->process->pid , this->trdid ) 198 #endif 199 200 #if(DEBUG_DEV_IOC_TX & 1) 201 if( (DEBUG_DEV_IOC_RX < cycle) && (cmd_type == IOC_WRITE) ) 202 printk("\n[%s] thread[%x,%x] resumes for IOC_WRITE\n", 203 __FUNCTION__, this->process->pid , this->trdid ) 204 #endif 205 206 } 207 208 // return I/O operation status 251 209 return this->ioc_cmd.error; 252 210 253 } // end dev_ioc_sync_access() 254 255 //////////////////////////////////////////////// 256 error_t dev_ioc_sync_read( xptr_t buffer_xp, 257 uint32_t lba, 258 uint32_t count ) 259 { 260 261 #if DEBUG_DEV_IOC_RX 262 thread_t * this = CURRENT_THREAD; 263 uint32_t cycle = (uint32_t)hal_get_cycles(); 264 if( DEBUG_DEV_IOC_RX < cycle ) 265 printk("\n[%s] thread[%x,%x] : lba %x / buffer(%x,%x) / count %d / cycle %d\n", 266 __FUNCTION__ , this->process->pid, this->trdid, 267 lba, GET_CXY(buffer_xp), GET_PTR(buffer_xp), count, cycle ); 268 #endif 269 270 return dev_ioc_sync_access( IOC_SYNC_READ , buffer_xp , lba , count ); 271 } 272 273 ///////////////////////////////////////////////// 274 error_t dev_ioc_sync_write( xptr_t buffer_xp, 275 uint32_t lba, 276 uint32_t count ) 277 { 278 279 #if DEBUG_DEV_IOC_TX 280 thread_t * this = CURRENT_THREAD; 281 uint32_t cycle = (uint32_t)hal_get_cycles(); 282 if( DEBUG_DEV_IOC_TX < cycle ) 283 printk("\n[%s] thread[%x,%x] : lba %x / buffer(%x,%x) / count %d / cycle %d\n", 284 __FUNCTION__ , this->process->pid, this->trdid, 285 lba, GET_CXY(buffer_xp), GET_PTR(buffer_xp), count, cycle ); 286 #endif 287 288 return dev_ioc_sync_access( IOC_SYNC_WRITE , buffer_xp , lba , count ); 289 } 290 211 } // end dev_ioc_move_data() 212 213 -
trunk/kernel/devices/dev_ioc.h
r627 r647 38 38 * magnetic hard disk or a SD card, that can store blocks of data in a linear array 39 39 * of sectors indexed by a simple lba (logic block address). 40 * 40 41 * It supports four command types: 41 42 * - READ : move blocks from device to memory, with a descheduling policy. … … 43 44 * - SYNC_READ : move blocks from device to memory, with a busy waiting policy. 44 45 * - SYNC_WRITE : move blocks from memory to device, with a busy waiting policy. 45 46 * The READ or WRITE operations require dynamic ressource allocation. The calling thread 47 * is descheduled, and the work is done by the server thread associated to IOC device. 48 * The general scenario is detailed below. 49 * A) the client thread start the I/O operation, by calling the dev_ioc_read() 50 * or the dev_ioc_write() kernel functions that perform the following actions: 51 * 1) it get a free WTI mailbox from the client cluster WTI allocator. 52 * 2) it enables the WTI IRQ on the client cluster ICU and update interrupt vector. 53 * 3) it access the PIC to link the WTI mailbox to the IOC IRQ. 54 * 4) it builds the command descriptor. 55 * 5) it registers in the IOC device waiting queue. 56 * 6) itblock on the THREAD_BLOCKED_IO condition and deschedule. 57 * B) The server thread attached to the IOC device descriptor handles the commands 58 * registered in the waiting queue, calling the IOC driver function. 59 * Most hardware implementation have a DMA capability, but some implementations, 60 * such as the RDK (Ram Disk) implementation does not use DMA. 61 * C) The ISR signaling the I/O operation completion reactivates the client thread, 62 * that releases the allocated resources: 63 * 1) access the PIC to unlink the IOC IRQ. 64 * 2) disable the WTI IRQ in the client cluster ICU and update interrupt vector. 65 * 3) release the WTI mailbox to the client cluster WTI allocator. 46 * 47 * For the he READ or WRITE operations, the client thread is descheduled, and the work 48 * is done by the server thread associated to the IOC device: 49 * The client thread calls the dev_ioc_move_data() kernel functions that (i) registers 50 * the command in the client thread descriptor, (ii) registers the client thread 51 * in the IOC device waiting queue, and (iii) blocks on the THREAD_BLOCKED_IO condition 52 * and deschedules. 53 * The server thread attached to the IOC device descriptor handles the commands 54 * registered in the waiting queue, calling the IOC driver function. 55 * Most IOC device implementations have a DMA capability, but some implementations, 56 * such as the RDK (Ram Disk) implementation does not use DMA. 57 * When the server thread completes an I/O operation, it reactivates the client thread. 66 58 * 67 59 * The SYNC_READ and SYNC_WRITE operations are used by the kernel in the initialisation 68 60 * phase, to update the FAT (both the FAT mapper and the FAT on IOC device), or to update 69 61 * a directory on IOC device when a new file is created. 70 * -These synchronous operations do not not use the IOC device waiting queue,71 * the server thread, and the IOC IRQ, but implement a busy-waiting policy72 * for the calling thread.73 * - As the work62 * These synchronous operations do not not use the IOC device waiting queue, 63 * the server thread, and the IOC IRQ. The client thread does not deschedules: 64 * it registers the command in the thread descriptor, calls directly the IOC driver, 65 * and uses a busy-waiting policy to poll the IOC device status. 74 66 *****************************************************************************************/ 75 67 … … 116 108 { 117 109 xptr_t dev_xp; /*! extended pointer on IOC device descriptor */ 118 uint32_t type; /*! IOC_READ / IOC_WRITE / IOC_SYNC_READ*/110 uint32_t type; /*! command type above */ 119 111 uint32_t lba; /*! first block index */ 120 112 uint32_t count; /*! number of blocks */ … … 146 138 147 139 /****************************************************************************************** 148 * This blocking function moves one or several contiguous blocks of data 149 * from the block device to a local memory buffer. The corresponding request is actually 150 * registered in the device pending request queue, and the calling thread is descheduled, 151 * waiting on transfer completion. It will be resumed by the IRQ signaling completion. 152 * It must be called by a local thread. 140 * This blocking function moves <count> contiguous blocks of data between the block device 141 * starting from block defined by the <lba> argument and a kernel memory buffer, defined 142 * by the <buffer_xp> argument. The transfer direction and mode are defined by the 143 * <cmd_type> argument. The request is always registered in the calling thread descriptor. 144 * - In synchronous mode, the calling thread is not descheduled, and directly calls the 145 * IOC driver, polling the IOC status to detect transfer completion. 146 * - In asynchronous mode, the calling thread blocks and deschedules, and the IOC driver 147 * is called by the server thread associated to the IOC device. 153 148 ****************************************************************************************** 154 * @ buffer : local pointer on target buffer in memory (must be block aligned). 149 * @ cmd_type : IOC_READ / IOC_WRITE / IOC_SYNC_READ / IOC_SYN_WRITE. 150 * @ buffer_xp : extended pointer on kernel buffer in memory (must be block aligned). 155 151 * @ lba : first block index on device. 156 152 * @ count : number of blocks to transfer. 157 153 * @ returns 0 if success / returns -1 if error. 158 154 *****************************************************************************************/ 159 error_t dev_ioc_read( uint8_t * buffer, 160 uint32_t lba, 161 uint32_t count ); 162 163 /****************************************************************************************** 164 * This blocking function moves one or several contiguous blocks of data 165 * from a local memory buffer to the block device. The corresponding request is actually 166 * registered in the device pending request queue, and the calling thread is descheduled, 167 * waiting on transfer completion. It will be resumed by the IRQ signaling completion. 168 * It must be called by a local thread. 169 ****************************************************************************************** 170 * @ buffer : local pointer on source buffer in memory (must be block aligned). 171 * @ lba : first block index on device. 172 * @ count : number of blocks to transfer. 173 * @ returns 0 if success / returns -1 if error. 174 *****************************************************************************************/ 175 error_t dev_ioc_write( uint8_t * buffer, 176 uint32_t lba, 177 uint32_t count ); 178 179 /****************************************************************************************** 180 * This blocking function moves one or several contiguous blocks of data 181 * from the block device to a - possibly remote - memory buffer. 182 * It uses an extended pointer, because the target buffer is generally a remote mapper. 183 * It does not uses the IOC device waiting queue and server thread, and does not use 184 * the IOC IRQ, but call directly the relevant IOC driver, implementing a busy-waiting 185 * policy for the calling thread. 186 * It can be called by a thread running in any cluster. 187 ****************************************************************************************** 188 * @ buffer_xp : extended pointer on target buffer in memory (must be block aligned). 189 * @ lba : first block index on device. 190 * @ count : number of blocks to transfer. 191 * @ returns 0 if success / returns -1 if error. 192 *****************************************************************************************/ 193 error_t dev_ioc_sync_read( xptr_t buffer_xp, 194 uint32_t lba, 195 uint32_t count ); 196 197 /****************************************************************************************** 198 * This blocking function moves one or several contiguous blocks of data 199 * from a - possibly remote - memory buffer to the block device. 200 * It uses an extended pointer, because the target buffer is generally a remote mapper. 201 * It does not uses the IOC device waiting queue and server thread, and does not use 202 * the IOC IRQ, but call directly the relevant IOC driver, implementing a busy-waiting 203 * policy for the calling thread. 204 * It can be called by a thread running in any cluster. 205 ****************************************************************************************** 206 * @ buffer_xp : extended pointer on source buffer in memory (must be block aligned). 207 * @ lba : first block index on device. 208 * @ count : number of blocks to transfer. 209 * @ returns 0 if success / returns -1 if error. 210 *****************************************************************************************/ 211 error_t dev_ioc_sync_write( xptr_t buffer_xp, 212 uint32_t lba, 213 uint32_t count ); 155 error_t dev_ioc_move_data( uint32_t cmd_type, 156 xptr_t buffer_xp, 157 uint32_t lba, 158 uint32_t count ); 214 159 215 160 #endif /* _DEV_IOC_H */ -
trunk/kernel/devices/dev_mmc.c
r626 r647 40 40 void dev_mmc_init( chdev_t * mmc ) 41 41 { 42 // get implementation from device descriptor43 uint32_t impl = mmc->impl;44 45 42 // set mmc name 46 43 snprintf( mmc->name , 16 , "mmc_%x" , local_cxy ); 47 44 48 45 // call driver init function 49 hal_drivers_mmc_init( mmc , impl);46 hal_drivers_mmc_init( mmc ); 50 47 51 48 // bind IRQ to CP0 -
trunk/kernel/devices/dev_nic.c
r637 r647 39 39 void dev_nic_init( chdev_t * nic ) 40 40 { 41 // the PIC chdev must be initialized before the NIC chdev, because 42 // the NIC chdev initialisation requires the routing of an external IRQ. 43 xptr_t pic_xp = chdev_dir.pic; 44 45 assert( (pic_xp != XPTR_NULL) , "ICU not initialised before NIC" ); 46 47 // get "impl" , "channel" , "is_rx" fields from chdev descriptor 48 uint32_t impl = nic->impl; 41 // get "channel" & "is_rx" fields from chdev descriptor 49 42 uint32_t channel = nic->channel; 50 43 bool_t is_rx = nic->is_rx; … … 55 48 56 49 // call driver init function 57 hal_drivers_nic_init( nic , impl);50 hal_drivers_nic_init( nic ); 58 51 59 52 // select a core to execute the NIC server thread -
trunk/kernel/devices/dev_pic.c
r565 r647 43 43 void dev_pic_init( chdev_t * pic ) 44 44 { 45 // get implementation46 uint32_t impl = pic->impl;47 48 45 // set chdev name 49 46 strcpy( pic->name , "pic" ); 50 47 51 48 // call the implementation-specific PIC driver 52 hal_drivers_pic_init( pic, impl);49 hal_drivers_pic_init( pic ); 53 50 } 54 51 -
trunk/kernel/devices/dev_txt.c
r637 r647 87 87 88 88 // call driver init function 89 hal_drivers_txt_init( txt, impl);89 hal_drivers_txt_init( txt ); 90 90 91 91 // no server thread and no IRQ routing for TXT0 -
trunk/kernel/fs/fatfs.c
r635 r647 575 575 576 576 // update the FS_INFO sector on IOC device 577 return dev_ioc_ sync_write(fs_info_buffer_xp , fs_info_lba , 1 );577 return dev_ioc_move_data( IOC_SYNC_WRITE , fs_info_buffer_xp , fs_info_lba , 1 ); 578 578 579 579 } // end fatfs_update_ioc_fsinfo() … … 1115 1115 1116 1116 // load the BOOT record from device 1117 error = dev_ioc_ sync_read(buffer_xp , 0 , 1 );1117 error = dev_ioc_move_data( IOC_SYNC_READ , buffer_xp , 0 , 1 ); 1118 1118 1119 1119 if ( error ) … … 1175 1175 1176 1176 // load the FS_INFO record from device 1177 error = dev_ioc_ sync_read(buffer_xp , fs_info_lba , 1 );1177 error = dev_ioc_move_data( IOC_SYNC_READ , buffer_xp , fs_info_lba , 1 ); 1178 1178 1179 1179 if ( error ) … … 2394 2394 2395 2395 // copy FS_INFO sector from IOC to local buffer 2396 error = dev_ioc_ sync_read(tmp_buf_xp , fs_info_lba , 1 );2396 error = dev_ioc_move_data( IOC_SYNC_READ , tmp_buf_xp , fs_info_lba , 1 ); 2397 2397 2398 2398 if ( error ) … … 2431 2431 2432 2432 // update the FS_INFO sector on IOC device 2433 error = dev_ioc_ sync_write(fs_info_buffer_xp , fs_info_lba , 1 );2433 error = dev_ioc_move_data( IOC_SYNC_WRITE , fs_info_buffer_xp , fs_info_lba , 1 ); 2434 2434 2435 2435 if ( error ) … … 2750 2750 // get page base address 2751 2751 xptr_t buffer_xp = ppm_page2base( page_xp ); 2752 uint8_t * buffer_ptr = (uint8_t *)GET_PTR( buffer_xp );2753 2752 2754 2753 // get inode pointer from mapper … … 2759 2758 printk("\n[%s] thread[%x,%x] enters : %s / cxy %x / mapper %x / inode %x / page %x\n", 2760 2759 __FUNCTION__, this->process->pid, this->trdid, 2761 dev_ioc_cmd_str( cmd_type ), page_cxy, mapper_ptr, inode_ptr, buffer_ptr);2760 dev_ioc_cmd_str( cmd_type ), page_cxy, mapper_ptr, inode_ptr, GET_PTR(buffer_xp) ); 2762 2761 #endif 2763 2762 … … 2768 2767 uint32_t lba = fatfs_ctx->fat_begin_lba + (page_id << 3); 2769 2768 2770 // access device 2771 if (cmd_type == IOC_SYNC_READ ) error = dev_ioc_sync_read ( buffer_xp , lba , 8 ); 2772 else if(cmd_type == IOC_SYNC_WRITE) error = dev_ioc_sync_write( buffer_xp , lba , 8 ); 2773 else if(cmd_type == IOC_READ ) error = dev_ioc_read ( buffer_ptr , lba , 8 ); 2774 else if(cmd_type == IOC_WRITE ) error = dev_ioc_write ( buffer_ptr , lba , 8 ); 2775 else error = -1; 2769 // access IOC device 2770 error = dev_ioc_move_data( cmd_type , buffer_xp , lba , 8 ); 2776 2771 2777 2772 if( error ) … … 2831 2826 uint32_t lba = fatfs_lba_from_cluster( fatfs_ctx , searched_cluster ); 2832 2827 2833 // access device 2834 if (cmd_type == IOC_SYNC_READ ) error = dev_ioc_sync_read ( buffer_xp , lba , 8 ); 2835 else if(cmd_type == IOC_SYNC_WRITE) error = dev_ioc_sync_write( buffer_xp , lba , 8 ); 2836 else if(cmd_type == IOC_READ ) error = dev_ioc_read ( buffer_ptr , lba , 8 ); 2837 else if(cmd_type == IOC_WRITE ) error = dev_ioc_write ( buffer_ptr , lba , 8 ); 2838 else error = -1; 2828 // access IOC device 2829 error = dev_ioc_move_data( cmd_type , buffer_xp , lba , 8 ); 2839 2830 2840 2831 if( error ) -
trunk/kernel/fs/vfs.c
r635 r647 681 681 process_t * process = this->process; 682 682 683 #if DEBUG_VFS_OPEN684 uint32_t cycle = (uint32_t)hal_get_cycles();685 if( DEBUG_VFS_OPEN < cycle )686 printk("\n[%s] thread[%x,%x] enter for <%s> / root_inode (%x,%x) / cycle %d\n",687 __FUNCTION__, process->pid, this->trdid, path, GET_CXY(root_xp), GET_PTR(root_xp), cycle );688 #endif689 690 683 // compute lookup working mode 691 684 lookup_mode = VFS_LOOKUP_OPEN; … … 694 687 if( (flags & O_EXCL ) ) lookup_mode |= VFS_LOOKUP_EXCL; 695 688 689 #if DEBUG_VFS_OPEN 690 uint32_t cycle = (uint32_t)hal_get_cycles(); 691 if( DEBUG_VFS_OPEN < cycle ) 692 printk("\n[%s] thread[%x,%x] enter for <%s> / root_inode (%x,%x) / cycle %d\n", 693 __FUNCTION__, process->pid, this->trdid, path, GET_CXY(root_xp), GET_PTR(root_xp), cycle ); 694 #endif 695 696 696 // compute attributes for the created file 697 697 file_attr = 0; -
trunk/kernel/kern/do_syscall.c
r641 r647 111 111 sys_get_nb_cores, // 54 112 112 sys_get_thread_info, // 55 113 sys_fbf, // 56 113 114 }; 114 115 … … 179 180 case SYS_GET_NB_CORES: return "GET_NB_CORES"; // 54 180 181 case SYS_GET_THREAD_INFO: return "GET_THREAD_INFO"; // 55 182 case SYS_FBF: return "FBF"; // 56 181 183 182 184 default: return "undefined"; -
trunk/kernel/kern/kernel_init.c
r640 r647 561 561 if( target_cxy == local_cxy ) 562 562 { 563 564 #if( DEBUG_KERNEL_INIT & 0x3 ) 565 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 566 printk("\n[%s] : found chdev %s / channel = %d / rx = %d / cluster %x\n", 567 __FUNCTION__ , chdev_func_str( func ), channel , rx , local_cxy ); 568 #endif 563 569 chdev = chdev_create( func, 564 570 impl, … … 608 614 } 609 615 610 #if( DEBUG_KERNEL_INIT & 0x 1)616 #if( DEBUG_KERNEL_INIT & 0x3 ) 611 617 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 612 printk("\n[%s] : create chdev %s / channel = %d / rx = %d / cluster %x / chdev = %x\n",618 printk("\n[%s] : created chdev %s / channel = %d / rx = %d / cluster %x / chdev = %x\n", 613 619 __FUNCTION__ , chdev_func_str( func ), channel , rx , local_cxy , chdev ); 614 620 #endif -
trunk/kernel/kern/thread.c
r641 r647 942 942 uint32_t global_one = global_nr ? (global_cost / global_nr) : 0; 943 943 944 printk("\n***** thread[%x,%x] page -faults\n"944 printk("\n***** thread[%x,%x] page faults\n" 945 945 " - false : %d events / cost %d cycles / max %d cycles\n" 946 946 " - local : %d events / cost %d cycles / max %d cycles\n" -
trunk/kernel/kern/thread.h
r641 r647 183 183 mmc_command_t mmc_cmd; /*! MMC device generic command */ 184 184 dma_command_t dma_cmd; /*! DMA device generic command */ 185 fbf_command_t fbf_cmd; /*! FBF device generic command */ 185 186 186 187 xptr_t rpc_client_xp; /*! client thread (for a RPC thread only) */ -
trunk/kernel/kernel_config.h
r641 r647 56 56 #define DEBUG_DEV_NIC_RX 0 57 57 #define DEBUG_DEV_NIC_RX 0 58 #define DEBUG_DEV_FBF_RX 0 59 #define DEBUG_DEV_FBF_TX 0 58 #define DEBUG_DEV_FBF 1 60 59 #define DEBUG_DEV_DMA 0 61 60 #define DEBUG_DEV_MMC 0 … … 105 104 #define DEBUG_HAL_TXT_RX 0 106 105 #define DEBUG_HAL_TXT_TX 0 106 #define DEBUG_HAL_FBF 1 107 107 #define DEBUG_HAL_USPACE 0 108 108 #define DEBUG_HAL_VMM 0 … … 134 134 #define DEBUG_PROCESS_GET_LOCAL_COPY 0 135 135 #define DEBUG_PROCESS_INIT_CREATE 0 136 #define DEBUG_PROCESS_MAKE_EXEC 0137 #define DEBUG_PROCESS_MAKE_FORK 0136 #define DEBUG_PROCESS_MAKE_EXEC 1 137 #define DEBUG_PROCESS_MAKE_FORK 1 138 138 #define DEBUG_PROCESS_REFERENCE_INIT 0 139 139 #define DEBUG_PROCESS_SIGACTION 0 … … 184 184 #define DEBUG_SYS_CONDVAR 0 185 185 #define DEBUG_SYS_DISPLAY 0 186 #define DEBUG_SYS_EXEC 0186 #define DEBUG_SYS_EXEC 2 187 187 #define DEBUG_SYS_EXIT 0 188 #define DEBUG_SYS_FBF 0 188 189 #define DEBUG_SYS_FG 0 189 #define DEBUG_SYS_FORK 0190 #define DEBUG_SYS_FORK 2 190 191 #define DEBUG_SYS_GET_CONFIG 0 191 192 #define DEBUG_SYS_GETCWD 0 -
trunk/kernel/syscalls/sys_fbf.c
r642 r647 173 173 #if DEBUG_SYS_FBF 174 174 if( DEBUG_SYS_FBF < tm_end ) 175 printk("\n[ DBG] %s : thread %x in process %xexit for %s / cost = %d / cycle %d\n",176 __FUNCTION__, this->trdid, process->pid, dev_fbf_cmd_str( operation ),175 printk("\n[%s] thread[%x,%x] exit for %s / cost = %d / cycle %d\n", 176 __FUNCTION__, process->pid, this->trdid, dev_fbf_cmd_str( operation ), 177 177 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 178 178 #endif
Note: See TracChangeset
for help on using the changeset viewer.