Esempio n. 1
0
// SLOT
// start an acquisition running
void
QEpicsAcqLocal::Start()
{
	if( running || master->globalState != AS_OFF)
		return;
	acqMonitor_init(master);
	running = TRUE;
	showMode(AS_STANDBY);
	if( Standby_mode( master) != 1)
	{
		running = FALSE;
		showMode(AS_FAULT);
		return;
	}
	if( Run_mode( master) != 0)	// note: Run_mode() currently has no error return!
	{
		running = FALSE;
		showMode(AS_FAULT);
		return;
	}
	threadTimerLock.lock();
	// emit onStart();
	signalOnStart = TRUE;
	threadTimerLock.unlock();

	showMode(AS_RUN);

	monitorTimer.start(master->MsecDelay);

}
Esempio n. 2
0
// SLOT
// stop the active acquisition
void
QEpicsAcqLocal::Stop()
{
	master->globalPause = 0;
	master->globalShutdown = 1;
	showMode(AS_OFF);
}
Esempio n. 3
0
File: stat.c Progetto: knaka/src
int
main (
  int argc,
  char * * argv ) {
  const char * pszFile;
  struct stat stat1;
    pszFile = argv[1];
    if (lstat(pszFile, & stat1) != 0) {
        fprintf(stderr, "lstat failed\n");
        return (1);
    }
    printf("st_dev: %04x\n", (int) (dev_t) stat1.st_dev);
    printf("st_ino: %d\n", (int) (ino_t) stat1.st_ino);
    printf("st_mode: "); showMode((mode_t) stat1.st_mode); printf("\n");
    printf("st_nlink: %d\n", (int) (nlink_t) stat1.st_nlink);
    printf("st_uid: %d\n", (int) (uid_t) stat1.st_uid);
    printf("st_gid: %d\n", (int) (gid_t) stat1.st_gid);
    printf("st_rdev(%d): %04x\n", sizeof (dev_t), (int) (dev_t) stat1.st_rdev);
    printf("st_size(%d): %d\n", sizeof (off_t), (int) (off_t) stat1.st_size);
    printf("st_blksize: %ld\n", (unsigned long) stat1.st_blksize);
    printf("st_blocks: %ld\n", (unsigned long) stat1.st_blocks);
    printf("st_atime: %s %d\n", ctime((time_t *) & stat1.st_atime), (int) stat1.st_atime);
    printf("st_mtime: %s", ctime((time_t *) & stat1.st_mtime));
    printf("st_ctime: %s", ctime((time_t *) & stat1.st_ctime));

    return (0);
}
Esempio n. 4
0
//
// SLOT
// pause/resume the running acquisition
void
QEpicsAcqLocal::Pause( int mode)
{
	if( !running)
		return;
	master->globalPause = mode;
	if( mode)
		showMode( AS_STANDBY);
	else
		showMode( AS_RUN);

	threadTimerLock.lock();
	// emit onPause(mode);
	argOnPause = mode;
	signalOnPause = TRUE;
	threadTimerLock.unlock();
}
Esempio n. 5
0
//
// SLOT
// load up a configuration file
void
QEpicsAcqLocal::setConfigFile( const QString &cfname)
{
	if( running)		// software fails miserably if an attempt is made to rebuild the
		return;		// scan configuration while tasks are runnning!

	if( cfname.isEmpty() )	// can't delete by setting a null file name.
		return;
	char expand[512];
	config_file = cfname;
	macro_expand(cfname.toAscii().constData(), expand, NULL);
	acq_file_load( expand, master);
	showMode(AS_OFF);
	threadTimerLock.lock();
	// emit onNewConfig();
	signalOnNewConfig = TRUE;
	threadTimerLock.unlock();
}
Esempio n. 6
0
// Current settings
// Saved as profile entry 0 (profile OFF)
void getScreen3()
{
    gv_sc4mode = SHOW_PSET;

    if (!gv_prof_set) {
        switch(gv_scr3npstate) {
            case SC3NPNULL:
                if (!gv_show3Aonce) {
                    Screen3(SHOW_ALL);
                    gv_show3Aonce = true;
                }

                if (gv_short_sw) {
                    nextSC3NP(SC3NPTEMP);
                }
                break;
            case SC3NPTEMP:         // Set target temp
                blinkCursor(0, 0, true);

                if (gv_rot_active) {
                    gv_rot_active = false;
                    if (gv_rot_pos) {
                        gv_rot_pos = false;
                        if (gv_curr_scale == SCALE_F)
                            gv_temp_set += 0.59;
                        else
                            gv_temp_set += 1;
                    }
                    if (gv_rot_neg) {
                        gv_rot_neg = false;
                        if (gv_curr_scale == SCALE_F)
                            gv_temp_set -= 0.59;
                        else
                            gv_temp_set -= 1;
                    }

                    lcd->setCursor(2, 0);
                    lcd->print(convtemp(gv_temp_set));
                }

                if (gv_short_sw) {
                    nextSC3NP(SC3NPCYCL);
                }
                break;
            case SC3NPCYCL:         // Set hyst range
                lcd->setCursor(0, 1);
                blinkCursor(0, 1, true);

                if (gv_rot_active) {
                    gv_rot_active = false;
                    if (gv_rot_pos) {
                        gv_rot_pos = false;
                        if (gv_curr_scale == SCALE_F)
                            gv_hyst_set += 0.59;
                        else
                            gv_hyst_set += 1.0;
                    }
                    if (gv_rot_neg) {
                        gv_rot_neg = false;
                        if (gv_curr_scale == SCALE_F)
                            gv_hyst_set -= 0.59;
                        else
                            gv_hyst_set -= 1.0;
                    }

                    if (gv_hyst_set == NULL)
                        gv_hyst_set = 0.0;
                    if (gv_hyst_set > 9.0)
                        gv_hyst_set = 0.0;
                    if (gv_hyst_set < 0.0)
                        gv_hyst_set = 9.0;

//        gv_hyst_set = 4.0;
                    lcd->setCursor(2, 1);
                    lcd->print(convrange(gv_hyst_set));
                }
//                    lcd->setCursor(4, 1);
//                    lcd->print(gv_hyst_set);

                if (gv_short_sw) {
                    nextSC3NP(SC3NPTSCL);
                }
                break;
            case SC3NPTSCL:         // Set display scale (C or F)
                blinkCursor(5, 0, true);

                if (gv_rot_active) {
                    gv_rot_active = false;
                    if (gv_rot_pos || gv_rot_neg) {
                        gv_rot_pos = false;
                        gv_rot_neg = false;
                        if (gv_curr_scale == SCALE_F)
                            gv_curr_scale = SCALE_C;
                        else
                            gv_curr_scale = SCALE_F;
                    }
                    lcd->setCursor(5,0);
                    if (gv_curr_scale == SCALE_F)
                        lcd->print("F");
                    else
                        lcd->print("C");
                }

                if (gv_short_sw) {
                    nextSC3NP(SC3NPOVRT);
                }
                break;
            case SC3NPOVRT:
                blinkCursor(6, 1, true);

                if (gv_rot_active) {
                    gv_rot_active = false;
                    if (gv_rot_pos) {
                        gv_rot_pos = false;
                        gv_over_time++;
                    }
                    if (gv_rot_neg) {
                        gv_rot_neg = false;
                        gv_over_time--;
                    }

                    lcd->setCursor(8, 1);
                    lcd->print(gv_over_time);
                }

                if (gv_short_sw) {
                    nextSC3NP(SC3NPMODE);
                }
                break;
            case SC3NPMODE:         // Set operation mode
                blinkCursor(13, 0, true);

                if (gv_rot_active) {
                    gv_rot_active = false;
                    if (gv_rot_pos) {
                        gv_rot_pos = false;
                        gv_mode_set++;
                    }
                    if (gv_rot_neg) {
                        gv_rot_neg = false;
                        gv_mode_set--;
                    }

                    if (gv_mode_set > MODE_AUTO)
                        gv_mode_set = MODE_OFF;
                    if (gv_mode_set < MODE_OFF)
                        gv_mode_set = MODE_AUTO;

                    showMode(8, 0);

                    lcd->setCursor(15,0);
                    lcd->print(gv_mode_set);
                }

                lcd->setCursor(15,0);
                lcd->print(gv_mode_set);
                lcd->setCursor(13,0);

                if (gv_short_sw) {
                    nextSC3NP(SC3NPPROF);
                }
                break;
            case SC3NPPROF:         // Set profile number
                blinkCursor(13, 1, true);

                if (gv_rot_active) {
                    gv_rot_active = false;
                    if (gv_rot_pos) {
                        gv_rot_pos = false;
                        gv_prof_set++;
                    }
                    if (gv_rot_neg) {
                        gv_rot_neg = false;
                        gv_prof_set--;
                    }

                    if (gv_prof_set > PROF_WKND)
                        gv_prof_set = PROF_OFF;
                    if (gv_prof_set < PROF_OFF)
                        gv_prof_set = PROF_WKND;

                    showProf(15, 1);
                    if (gv_prof_set != PROF_OFF) {
                        gv_show3Bonce = false;
                    }
                }

                if (gv_short_sw) {
                    nextSC3NP(SC3NPSET);
                }
                break;

            case SC3NPSET:
                if (gv_prof_set == PROF_OFF) {
                    gv_profile[gv_prof_set].op_mode   = gv_mode_set;
                    gv_profile[gv_prof_set].start_hr  = 0;
                    gv_profile[gv_prof_set].start_min = 0;
                    gv_profile[gv_prof_set].duration  = gv_over_time;
                    gv_profile[gv_prof_set].tset      = gv_temp_set;
                    gv_profile[gv_prof_set].hystrange = gv_hyst_set;

                    lcd->clear();
                    lcd->setCursor(0,0);
                    lcd->print("Settings saved");
                    saveProf(gv_prof_set);
                    saveGVData();
                    gv_inputchange = true;
                    delay(2000);
                }

                Screen3(SHOW_ALL);
                nextSC3NP(SC3NPNULL);
                break;
        }
    }
    else {
        // If any profile is active then only allow edit of the
        // temp units and the profile number
        if (!gv_show3Bonce) {
            Screen3(SHOW_SUB);
            gv_show3Bonce = true;
        }
        switch(gv_scr3prstate) {
            case SC3PRNULL:
                if (gv_short_sw) {
                    nextSC3PR(SC3PRTSCL);
                }
                break;
            case SC3PRTSCL:         // Set display scale (C or F)
                blinkCursor(5, 0, true);

                if (gv_rot_active) {
                    gv_rot_active = false;
                    if (gv_rot_pos || gv_rot_neg) {
                        gv_rot_pos = false;
                        gv_rot_neg = false;
                        if (gv_curr_scale == SCALE_F)
                            gv_curr_scale = SCALE_C;
                        else
                            gv_curr_scale = SCALE_F;
                    }
                    lcd->setCursor(5,0);
                    if (gv_curr_scale == SCALE_F)
                        lcd->print("F");
                    else
                        lcd->print("C");
                }

                if (gv_short_sw) {
                    nextSC3PR(SC3PRPROF);
                }
                break;
            case SC3PRPROF:         // Set profile number
                blinkCursor(13, 1, true);

                if (gv_rot_active) {
                    gv_rot_active = false;
                    if (gv_rot_pos) {
                        gv_rot_pos = false;
                        gv_prof_set++;
                    }
                    if (gv_rot_neg) {
                        gv_rot_neg = false;
                        gv_prof_set--;
                    }

                    if (gv_prof_set > PROF_WKND)
                        gv_prof_set = PROF_OFF;
                    if (gv_prof_set < PROF_OFF)
                        gv_prof_set = PROF_WKND;

                    showProf(15, 1);

                    if (gv_prof_set == PROF_OFF) {
                        gv_show3Aonce = false;
                    }
                }

                if (gv_short_sw) {
                    gv_inputchange = true;
                    nextSC3PR(SC3PRNULL);
                }
                break;
        }
    }
}
Esempio n. 7
0
void FindDialog::showReplaceMode()
{
	setWindowTitle(tr("Replace"));
	showMode(true);
}
Esempio n. 8
0
void FindDialog::showFindMode()
{
	setWindowTitle(tr("Find"));
	showMode(false);
}
Esempio n. 9
0
//
//  By default, user_init is called before the remote hosts are spawned,
//  so any changes to "non-shared" data items that are performed here get
//  propagated to the children.
//
//  Note: you CAN NOT create threads here, because the remote hosts have
// not been created.  Basically, this should contain the sequential
// initialization code for the program.
//
//
int main(unsigned argc, char **argv){
    char 	hostname[128];
    char 	*cp;
    unsigned 	start_time, start_clicks, end_time, end_clicks;
    unsigned 	init_time, init_clicks;
    double 	total_time, create_time, compute_time;
    int 	i, j, c;
    extern char	*optarg;
	int rc, status;
	ParamStruct param[NPROCS];
	
    while ((c = getopt(argc, argv, "s:vb:dDpqB")) != -1) {
		int done = 0;
		
		switch (c) {
			case 's':
		    	if ((size = atoi(optarg)) > MAX_SORT_SIZE) {
					//Tmk_errexit("Max sort size is %d\n", MAX_SORT_SIZE);
					char buffer[100];
					memset(buffer, '\0', 100);
					sprintf(buffer, "Max sort size is %d\n", MAX_SORT_SIZE);
					pthread_errexit(buffer);
		    	}
		    	done++; 
		    	break;
		  	case 'b': 
		  		BubbleThresh = atoi(optarg); done++; 
		  		break;
		  	case 'h': 
		  		usage();
		  		break;
		  	case 'B': 
		  		bubble = 1; 
		  		break;
		  	case 'd': 
		  		debug++; 
		  		break;
		  	case 'D': 
		  		dump_array++; 
		  		break;
		  	case 'p': 
		  		performance = 1; 
		  		break;
		  	case 'q': 
		  		quiet = 1; 
		  		break;
		  	case 'v': 
		  		verify = 1; 
		  		break;
		}
    }
	//Tmk_startup(argc, argv);
    
    Sequential = (Tmk_nprocs == 1);
	showMode(Sequential);
    
	InitData();    
    
// 
//	REAL work starts here
//	
	// build PThreads' parameters' list
	for(i= 0; i< NPROCS; i++){
		param[i].threadID  = i;
	}

	// create parallel threads to work on the tasks
	for(i= 0; i< NPROCS; i++){
		pthread_create(&pthreads[i], NULL, thread_work, (void *) (&param[i]));
		// code inside thread_work starts parallel work
	}

/*
	pthread_barrier();
	
    gettimeofday(&start, NULL);

    Worker();

    pthread_barrier();
    
    gettimeofday(&finish, NULL);
    printf("Elapsed time: %.2f seconds\n",
		   (((finish.tv_sec * 1000000.0) + finish.tv_usec) -
	    	((start.tv_sec * 1000000.0) + start.tv_usec)) / 1000000.0);
*/

	// wait for all threads to finish their work before continue
	for(i=0; i < NPROCS; i++){
		rc = pthread_join(pthreads[i], (void **)&status);
	
		if (rc){
			printf("ERROR; return code from pthread_join() of thread %d is %d\n", i, rc);
			exit(-1);
		}

	}

	// all pthreads joined, sequential mode resumed
    if (dump_array) {
    	DumpArray();
    }
    
    if (verify) {
		VerifyArray();
    }

//
//	REAL work ends here
//
	ClearData();
	return 0;
	
}