Changeset 670
- Timestamp:
- Jul 27, 2015, 9:59:52 PM (9 years ago)
- Location:
- soft/giet_vm/giet_kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/sys_handler.c
r661 r670 142 142 &_sys_tty_read, /* 0x03 */ 143 143 &_sys_tty_alloc, /* 0x04 */ 144 &_sys_ tty_get_lock,/* 0x05 */145 &_sys_ tty_release_lock,/* 0x06 */144 &_sys_ukn, /* 0x05 */ 145 &_sys_ukn, /* 0x06 */ 146 146 &_sys_heap_info, /* 0x07 */ 147 147 &_sys_local_task_id, /* 0x08 */ … … 249 249 static_scheduler_t* psched = (static_scheduler_t*)_schedulers[x][y][p]; 250 250 251 // release private TTY peripheral if required251 // release private TTY terminal if required 252 252 if ( psched->context[ltid][CTX_TTY_ID] < NB_TTY_CHANNELS ) 253 253 { 254 254 psched->context[ltid][CTX_TTY_ID] = 0xFFFFFFFF; 255 255 _atomic_increment( &_tty_channel_allocator , 0xFFFFFFFF ); 256 } 257 258 // release private TIM channel if required 259 if ( psched->context[ltid][CTX_TIM_ID] < NB_TIM_CHANNELS ) 260 { 261 psched->context[ltid][CTX_TIM_ID] = 0xFFFFFFFF; 262 _atomic_increment( &_tim_channel_allocator , 0xFFFFFFFF ); 263 } 264 265 // release private NIC_RX channel if required 266 if ( psched->context[ltid][CTX_NIC_RX_ID] < NB_NIC_CHANNELS ) 267 { 268 psched->context[ltid][CTX_NIC_RX_ID] = 0xFFFFFFFF; 269 _atomic_increment( &_nic_rx_channel_allocator , 0xFFFFFFFF ); 270 } 271 272 // release private NIC_TX channel if required 273 if ( psched->context[ltid][CTX_NIC_TX_ID] < NB_NIC_CHANNELS ) 274 { 275 psched->context[ltid][CTX_NIC_TX_ID] = 0xFFFFFFFF; 276 _atomic_increment( &_nic_tx_channel_allocator , 0xFFFFFFFF ); 256 277 } 257 278 … … 775 796 ////////////////////////////////////////////////////////////////////////////// 776 797 777 //////////////////// 778 int _sys_tty_alloc( )798 ///////////////////////////////////////// 799 int _sys_tty_alloc( unsigned int shared ) 779 800 { 780 801 // get a new TTY terminal index … … 795 816 if ( USE_PIC ) _ext_irq_alloc( ISR_TTY_RX , channel , &unused ); 796 817 797 // update calling task index 798 _set_context_slot( CTX_TTY_ID, channel ); 818 // update CTX_TTY_ID 819 if ( shared ) // for all tasks in the same vspace 820 { 821 unsigned int vspace_id = _get_context_slot( CTX_VSID_ID ); 822 mapping_header_t *header = (mapping_header_t *)SEG_BOOT_MAPPING_BASE; 823 mapping_vspace_t *vspace = _get_vspace_base(header); 824 mapping_task_t *task = _get_task_base(header); 825 826 // scan tasks in vspace 827 unsigned int task_id; 828 for (task_id = vspace[vspace_id].task_offset; 829 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks); 830 task_id++) 831 { 832 unsigned int y_size = header->y_size; 833 unsigned int cid = task[task_id].clusterid; 834 unsigned int x = cid / y_size; 835 unsigned int y = cid % y_size; 836 unsigned int p = task[task_id].proclocid; 837 unsigned int ltid = task[task_id].ltid; 838 static_scheduler_t* psched = (static_scheduler_t*)_schedulers[x][y][p]; 839 psched->context[ltid][CTX_TTY_ID] = channel; 840 } 841 } 842 else // for calling task only 843 { 844 _set_context_slot( CTX_TTY_ID, channel ); 845 } 799 846 800 847 return 0; -
soft/giet_vm/giet_kernel/sys_handler.h
r629 r670 92 92 /////////////////////////////////////////////////////////////////////////////// 93 93 94 int _sys_coproc_alloc( unsigned int coproc_type,95 unsigned int* coproc_info );96 97 int _sys_coproc_release( unsigned int coproc_reg_index );98 99 int _sys_coproc_channel_init( unsigned int channel,100 giet_coproc_channel_t* desc );101 102 int _sys_coproc_run( unsigned int coproc_reg_index );103 104 int _sys_coproc_completed();105 106 ///////////////////////////////////////////////////////////////////////////////107 // TTY related syscall handlers108 ///////////////////////////////////////////////////////////////////////////////109 110 int _sys_tty_alloc();111 112 int _sys_tty_write( const char* buffer,113 unsigned int length,114 unsigned int channel );115 116 int _sys_tty_read( char* buffer,117 unsigned int length,118 unsigned int channel );119 120 int _sys_tty_get_lock( unsigned int channel,121 unsigned int * save_sr_ptr );122 123 int _sys_tty_release_lock( unsigned int channel,124 unsigned int * save_sr_ptr );125 126 94 int _sys_coproc_register_set( unsigned int cluster_xy, 127 95 unsigned int reg_index, … … 131 99 unsigned int reg_index, 132 100 unsigned int* buffer ); 101 102 int _sys_coproc_alloc( unsigned int coproc_type, 103 unsigned int* coproc_info ); 104 105 int _sys_coproc_release( unsigned int coproc_reg_index ); 106 107 int _sys_coproc_channel_init( unsigned int channel, 108 giet_coproc_channel_t* desc ); 109 110 int _sys_coproc_run( unsigned int coproc_reg_index ); 111 112 int _sys_coproc_completed(); 113 114 /////////////////////////////////////////////////////////////////////////////// 115 // TTY related syscall handlers 116 /////////////////////////////////////////////////////////////////////////////// 117 118 int _sys_tty_alloc( unsigned int shared ); 119 120 int _sys_tty_write( const char* buffer, 121 unsigned int length, 122 unsigned int channel ); 123 124 int _sys_tty_read( char* buffer, 125 unsigned int length, 126 unsigned int channel ); 133 127 134 128 //////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.