Changeset 670 for soft/giet_vm/giet_kernel/sys_handler.c
- Timestamp:
- Jul 27, 2015, 9:59:52 PM (9 years ago)
- File:
-
- 1 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;
Note: See TracChangeset
for help on using the changeset viewer.