Esempio n. 1
0
File: ehci.c Progetto: MWDD/osdev
// ------------------------------------------------------------------------------------------------
static void ehci_remove_qh(EHCI_QH* qh)
{
    EHCI_QH* prev = link_data(qh->qh_link.prev, EHCI_QH, qh_link);

    prev->qhlp = qh->qhlp;
    link_remove(&qh->qh_link);
}
Esempio n. 2
0
File: ehci.c Progetto: MWDD/osdev
// ------------------------------------------------------------------------------------------------
static void ehci_controller_poll(USB_Controller* controller)
{
    EHCI_Controller* hc = (EHCI_Controller*)controller->hc;

    EHCI_QH* qh = link_data(hc->async_qh->qh_link.next, EHCI_QH, qh_link);
    EHCI_QH* end = hc->async_qh;
    while (qh != end)
    {
        EHCI_QH* next = link_data(qh->qh_link.next, EHCI_QH, qh_link);
        if (qh->transfer)
        {
            ehci_qh_process(hc, qh);
        }

        qh = next;
    }
}
Esempio n. 3
0
File: ehci.c Progetto: MWDD/osdev
// ------------------------------------------------------------------------------------------------
static void ehci_insert_qh(EHCI_Controller* hc, EHCI_QH* qh)
{
    EHCI_QH* list = hc->async_qh;
    EHCI_QH* end = link_data(list->qh_link.prev, EHCI_QH, qh_link);

    qh->qhlp = (u32)(uintptr_t)list | PTR_QH;
    end->qhlp = (u32)(uintptr_t)qh | PTR_QH;

    link_before(&list->qh_link, &qh->qh_link);
}
Esempio n. 4
0
static void init_commands() {
   string path;

   add_action( "cmd_hook", "", 1 );
 
   if(link_data("wizard")) {
   enable_wizard();
   path = NEW_WIZ_PATH;
   }
 
   else path = USER_CMDS;
 
      set("PATH", path, MASTER_ONLY);
}
Esempio n. 5
0
/****************************************************
EDIT_DATA
****************************************************/
void edit_data( object *root, int *choice, char *obj_name )
{
	char *l , ch[ 2 * MAX_ELEM_LENGTH ], ch1[ MAX_ELEM_LENGTH ];
	int i, counter, lag;
	object *first;

	cmd( "if {$tcl_platform(os) == \"Darwin\"} {set cwidth 9; set cbd 2 } {set cwidth 8; set cbd 2}" );

	Tcl_LinkVar( inter, "lag", ( char * ) &lag, TCL_LINK_INT );

	cmd( "if { ! [ info exists autoWidth ] } { set autoWidth 1 }" );
	cmd( "if { ! [ winfo exists .ini ] } { newtop .ini; showtop .ini topleftW 1 1 1 $hsizeI $vsizeI } { if { ! $autoWidth } { resizetop $hsizeI $vsizeI } }" );

	cmd( "set position 1.0" );
	in_edit_data = true;

	*choice = 0;
	while ( *choice == 0 )
	{
		// reset title and destroy command because may be coming from set_obj_number
		cmd( "settop .ini \"%s%s - LSD Initial Values Editor\" { set choice 1 }", unsaved_change() ? "*" : " ", simul_name  );

		first = root->search( obj_name );

		cmd( "frame .ini.b" );
		cmd( "set w .ini.b.tx" );
		cmd( "scrollbar .ini.b.ys -command \".ini.b.tx yview\"" );
		cmd( "scrollbar .ini.b.xs -command \".ini.b.tx xview\" -orient horizontal" );
		cmd( "text $w -yscrollcommand \".ini.b.ys set\" -xscrollcommand \".ini.b.xs set\" -wrap none" );
		cmd( ".ini.b.tx conf -cursor arrow" );
		
		strncpy( ch1, obj_name, MAX_ELEM_LENGTH - 1 );
		ch1[ MAX_ELEM_LENGTH - 1 ] = '\0';
		cmd( "label $w.tit_empty -width 32 -relief raised -text \"Object: %-17s \" -borderwidth 4", ch1 );
		cmd( "bind $w.tit_empty <Button-1> {set choice 4}" );
		
		if ( ! in_set_obj )				// show only if not already recursing
			cmd( "bind $w.tit_empty <Enter> {set msg \"Click to edit number of instances\"}" );
			
		cmd( "bind $w.tit_empty <Leave> {set msg \"\"}" );
		cmd( "$w window create end -window $w.tit_empty" );

		strcpy( ch, "" );
		i = 0;
		counter = 1;
		colOvflw = false;
		search_title( root, ch, &i, obj_name, &counter );
		cmd( "$w insert end \\n" );

		// explore the tree searching for each instance of such object and create:
		// - titles
		// - entry cells linked to the values
		
		set_focus = 0;
		link_data( root, obj_name );
		
		cmd( "pack .ini.b.ys -side right -fill y" );
		cmd( "pack .ini.b.xs -side bottom -fill x" );
		cmd( "pack .ini.b.tx -expand yes -fill both" );
		cmd( "pack .ini.b  -expand yes -fill both" );

		cmd( "label .ini.msg -textvariable msg" );
		cmd( "pack .ini.msg -pady 5" );

		cmd( "frame .ini.st" );
		cmd( "label .ini.st.err -text \"\"" );
		cmd( "label .ini.st.pad -text \"         \"" );
		cmd( "checkbutton .ini.st.aw -text \"Automatic width\" -variable autoWidth -command { set choice 5 }" );
		cmd( "pack .ini.st.err .ini.st.pad .ini.st.aw -side left" );
		cmd( "pack .ini.st -anchor e -padx 10 -pady 5" );

		cmd( "donehelp .ini boh { set choice 1 } { LsdHelp menudata_init.html }" );

		cmd( "$w configure -state disabled" );

		if ( set_focus == 1 )
		  cmd( "focus $initial_focus; $initial_focus selection range 0 end" );

		cmd( "bind .ini <KeyPress-Escape> {set choice 1}" );
		cmd( "bind .ini <F1> { LsdHelp menudata_init.html }" );

		// show overflow warning just once per configuration but always indicate
		if ( colOvflw )
		{
			cmd( ".ini.st.err conf -text \"OBJECTS NOT SHOWN! (> %d)\" -fg red", MAX_COLS );
			if ( ! iniShowOnce )
			{
				cmd( "update; tk_messageBox -parent .ini -type ok -title Warning -icon warning -message \"Too many objects to edit\" -detail \"LSD Initial Values editor can show only the first %d objects' values. Please use the 'Set All' button to define values for objects beyond those.\" ", MAX_COLS );
				iniShowOnce = true;
			}
		}

		noredraw:

		cmd( "if $autoWidth { resizetop .ini [ expr ( 40 + %d * ( $cwidth + 1 ) ) * [ font measure TkTextFont -displayof .ini 0 ] ] }", counter );

		// editor main command loop
		while ( ! *choice )
		{
			try
			{
				Tcl_DoOneEvent( 0 );
			}
			catch ( bad_alloc& ) 	// raise memory problems
			{
				throw;
			}
			catch ( ... )				// ignore the rest
			{
				goto noredraw;
			}
		}   

		// handle both resizing event and block object # setting while editing initial values
		if ( *choice == 5 || ( *choice == 4 && in_set_obj ) )		// avoid recursion
		{
			*choice = 0;
			goto noredraw;
		}

		// clean up

		strcpy( ch, "" );
		i = 0;
		clean_cell( root, ch, obj_name );
		cmd( "destroy .ini.b .ini.boh .ini.msg .ini.st" );


		if ( *choice == 2 )
		{
			l = ( char * ) Tcl_GetVar( inter, "var-S-A", 0 );
			strcpy( ch, l );
			
			*choice = 2;		// set data editor window parent
			set_all( choice, first, ch, lag );
			
			cmd( "bind .ini <KeyPress-Return> {}" );
			*choice = 0;
		}
		
		if ( *choice ==4 )
		{ 
			*choice = 0;
			set_obj_number( root, choice );
			*choice = 0;
		}
	}

	in_edit_data = false;

	Tcl_UnlinkVar( inter, "lag");
}