Esempio n. 1
0
bool    AddModRecord(event  ev)
{
  if (IsRecordDisabled(ev)) return true;

  uint i = OpenRecord(MOD_RECORD, cdwModRecord);

  reCurr.ti = *GetCurrTimeDate();
  reCurr.cdwRecord = cdwModRecord++; SaveCache(&chModRecord);
  reCurr.ev = ev;

  PutChar(0, ibDig);

  switch (ev)
  {
    case EVE_MODEM_PROFILEOPEN:
    case EVE_MODEM_SPECIALOPEN:  Put(1, (uchar *) &mpdiDigital[ibDig], sizeof(digital)); break;

    case EVE_MODEM_PROFILE:      PutInt(1, mpcwStopCan[ibDig]); break;

    case EVE_MODEM_PROFILEOK:    PutInt(1, cwHouRead);
                                 PutInt(3, mpcwStopCan[ibDig]); break;

    case EVE_MODEM_PROFILEERROR2:PutInt(1, GetCurr());
                                 PutChar(3, mpSerial[ibPort]); break;
  }

  CloseRecord(MOD_RECORD, i);

  return CloseOut();
}
int main()
{
  PutInt(ForkExec("step4_ForkExec_helloworld"));
  PutChar('\n');
  PutInt(ForkExec("step4_ForkExec_helloworld"));
  PutChar('\n');
  return 0;
}
Esempio n. 3
0
/*! \brief Transmits the global config struct to QTouch Studio.
 */
void Transmit_Global_Config(void)
{
#ifdef DEF_TOUCH_QDEBUG_ENABLE_MUTLCAP
	touch_config_t *p_touch_config = &touch_config;
	touch_mutlcap_config_t *p_mutlcap_config
		= p_touch_config->p_mutlcap_config;
	touch_ret_t touch_ret = TOUCH_SUCCESS;

	/* get the global parameters from the library and transmit the global
	 * parameters to the Qtouch Studio */
	touch_ret = QDEBUG_GET_GLOBAL_PARAM_FUNC(&p_mutlcap_config->global_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

	PutChar(QT_GLOBAL_CONFIG);
	PutChar(p_mutlcap_config->global_param.recal_threshold);
	PutChar(p_mutlcap_config->global_param.di);
	PutChar(p_mutlcap_config->global_param.drift_hold_time);
	PutChar(p_mutlcap_config->global_param.max_on_duration);
	PutChar(p_mutlcap_config->global_param.tch_drift_rate);
	PutChar(p_mutlcap_config->global_param.atch_drift_rate);
	PutChar(p_mutlcap_config->global_param.atch_recal_delay);
#endif
#ifdef DEF_TOUCH_QDEBUG_ENABLE_SELFCAP
	touch_config_t *p_touch_config = &touch_config;
	touch_selfcap_config_t *p_selfcap_config
		= p_touch_config->p_selfcap_config;
	touch_ret_t touch_ret = TOUCH_SUCCESS;

	/* get the global parameters from the library and transmit the global
	 * parameters to the Qtouch Studio */
	touch_ret = QDEBUG_GET_GLOBAL_PARAM_FUNC(&p_selfcap_config->global_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

	PutChar(QT_GLOBAL_CONFIG);
	PutChar(p_selfcap_config->global_param.recal_threshold);
	PutChar(p_selfcap_config->global_param.di);
	PutChar(p_selfcap_config->global_param.drift_hold_time);
	PutChar(p_selfcap_config->global_param.max_on_duration);
	PutChar(p_selfcap_config->global_param.tch_drift_rate);
	PutChar(p_selfcap_config->global_param.atch_drift_rate);
	PutChar(p_selfcap_config->global_param.atch_recal_delay);
#endif
	PutInt(touch_time.measurement_period_ms);
	PutInt(0);                      /* TICKS_PER_MS */
	PutChar(0);             /* Time_Setting */

	Send_Message();
}
int main()
{
    int heap_addr = 0;
    int new_heap_addr = 0;
    int i;

    heap_addr = AllocPageHeap();
    if (heap_addr == -1)
    {
        PutString("Error while asking for heap page\n");
        return -1;
    }

    // Test one write/read inside new heap
    *(int *)heap_addr = 42;
    PutInt(*(int *)heap_addr);

    for (i = 1; i < HEAP_PAGE_NUMBER; i++)
        heap_addr = AllocPageHeap();

    // This one should fail
    new_heap_addr = AllocPageHeap();
    if (new_heap_addr == -1)
        PutString(" ok1 ");

    heap_addr += PAGE_SIZE;
    
    // Go down one page by one
    for (i = 0; i < HEAP_PAGE_NUMBER; i++)
    {
        new_heap_addr = FreePageHeap();
        if (new_heap_addr + PAGE_SIZE != heap_addr)
        {
            PutString("new_heap_addr = ");
            PutInt(new_heap_addr);
            PutString(" heap_addr = ");
            PutInt(heap_addr);
            PutString("\n");
            return -1;
        }

        heap_addr = new_heap_addr;
    }

    PutString("ok2 ");

    // Should not change current pointer
    new_heap_addr = FreePageHeap();
    if (new_heap_addr == heap_addr)
        PutString("ok3 ");

    return 0;
}
Esempio n. 5
0
void *my_mem_alloc(size_t s) {
    void *result = mem_alloc(s);
    sizes[position] = s;
    allocs[position++] = result;
    PutString("Allocation de ");
    PutInt((unsigned long) s);
    PutString("octets en ");
    PutInt((unsigned long) result);
    PutChar('\n');
    mem_align |= (unsigned int)result;
    return result;
}
Esempio n. 6
0
// Save
void
Prefs::Save()
{
	if (!PutBool("interlaced", &interlaced)) return;
	if (!PutBool("usetransparent", &usetransparent)) return;
	if (!PutBool("usetransparentauto", &usetransparentauto)) return;
	if (!PutBool("usedithering", &usedithering)) return;
	if (!PutInt("palettemode", &palettemode)) return;
	if (!PutInt("palettesize", &palette_size_in_bits)) return;
	if (!PutInt("transparentred", &transparentred)) return;
	if (!PutInt("transparentgreen", &transparentgreen)) return;
	if (!PutInt("transparentblue", &transparentblue)) return;
}
Esempio n. 7
0
void afficher_zone(void *adresse, size_t taille, int free) {
    decompte_zone(adresse, taille, free);
    PutString("\n");
    PutString("zone ");
    if(free)
    	PutString(" libre ");
    else
    	PutString(" occupee ");
    PutString(" adresse : ");
    PutInt((unsigned int)adresse);
    PutString(" taille : ");
    PutInt(taille);
    PutString("\n");
}
Esempio n. 8
0
/**
 * @brief Transmits the global config struct to QTouch Studio
 * @ingroup  QDebug-Remote
 */
void Transmit_Global_Config(void)
{
   PutChar(QT_GLOBAL_CONFIG);
   PutChar(qt_config_data.qt_recal_threshold);
   PutChar(qt_config_data.qt_di);
   PutChar(qt_config_data.qt_drift_hold_time);
   PutChar(qt_config_data.qt_max_on_duration);
   PutChar(qt_config_data.qt_neg_drift_rate);
   PutChar(qt_config_data.qt_pos_drift_rate);
   PutChar(qt_config_data.qt_pos_recal_delay);
   PutInt(qt_measurement_period_msec);
   PutInt(TICKS_PER_MS);
   PutChar(0); // Time_Setting
   Send_Message();
}
Esempio n. 9
0
/**
 * @brief Transmits the sign on packet to QTouch Studio
 * @ingroup  QDebug-Remote
 */
void Transmit_Sign_On(void)
{
   PutChar(QT_SIGN_ON);
   PutInt(PROJECT_ID);
   PutChar(0x01);                       // Simulated as TWI interface
   PutChar(1);                         //PROTOCOL_TYPE
   PutChar(2);                         //PROTOCOL_VERSION
   PutChar(lib_siginfo.lib_sig_lword);	//LIB_TYPE
   PutInt(lib_siginfo.library_version);//LIB_VERSION
   PutInt(0);                          //LIB_VARIANT
   PutChar(QT_NUM_CHANNELS);
   //PutInt(delivery);    // subscription info
   PutInt(7);
   Send_Message();
}
Esempio n. 10
0
int
main() {
    char c1 = 'a';
    char c2 = 'b';
    char c3 = 'c';
    char c4 = 'd';
    int j;
    int tid1;
    int tid2;
    int tid3;
    int tid4;

    tid1 = UserThreadCreate(SimpleThread, (void*) &c1);
    tid2 = UserThreadCreate(SimpleThread, (void*) &c2);
    tid3 = UserThreadCreate(SimpleThread, (void*) &c3);
    tid4 = UserThreadCreate(SimpleThread, (void*) &c4);

    for (j = 0; j < 10; j++) {
        PutChar('m');
        PutInt(j);
        PutChar('\n');
    }

    UserThreadJoin(tid1);
    UserThreadJoin(tid2);
    UserThreadJoin(tid3);
    UserThreadJoin(tid4);

    /* not reached */
    return 0;
}
Esempio n. 11
0
void *fun(void* arg)
{
	PutString("Child start\n");
	PutInt(*(int*)arg);
	PutString("\nChild finish\n");
	UserThreadExit(0);
    return 0;
}
Esempio n. 12
0
void printInt(int m, int n)
{
  int i;
  for (i = 0; i < n; i++) {
    PutInt(m + i);
  }
  PutChar('\n');
}
Esempio n. 13
0
  void CopySingles(Everything &ev)
  {
    for (unsigned i=0;i<brInt.size();i++)
      PutInt(brInt[i],ev.GetInt(brInt[i]));
    for (unsigned i=0;i<brFloat.size();i++)
      PutFloat(brFloat[i],ev.GetFloat(brFloat[i]));

  }
Esempio n. 14
0
void f(void* arg)
{
	PutString("Thread 2\n");
	PutChar('b');
	PutString("\n");
	PutInt(2);
	PutString("\n");
	UserThreadExit(0);
}
Esempio n. 15
0
/*! \brief Transmits the sign on packet to QTouch Studio.
 */
void Transmit_Sign_On(void)
{
	PutChar(QT_SIGN_ON);
	PutInt(PROJECT_ID);
	PutChar(INTERFACE);
	PutChar(1);             /* PROTOCOL_TYPE */
	PutChar(2);             /* PROTOCOL_VERSION */
#if DEF_TOUCH_MUTLCAP == 1
	PutChar(1);             /* LIB_TYPE    Mutual Cap */
#else
	PutChar(0);             /* LIB_TYPE    Self Cap */
#endif
	PutInt(QDEBUG_LIBINFO.fw_version); /* LIB_VERSION */
	PutInt(0);              /* LIB_VARIANT */
	PutChar(QDEBUG_NUM_CHANNELS);
	PutInt(delivery);       /* subscription info */
	Send_Message();
}
Esempio n. 16
0
void f(void* arg)
{
	int n = *((int*)arg);
	SemWait(&s);
	PutInt(n);
	PutString("\n");
	SemPost(&s);
	UserThreadExit(0);
}
Esempio n. 17
0
int main()
{
	UserThreadCreate(f, 0);
	PutString("Thread main\n");
	PutChar('a');
	PutString("\n");
	PutInt(1);
	PutString("\n");
    return 0;
}
Esempio n. 18
0
/**
 * @ingroup SipSpeed
 * @brief 멤버변수를 설정 파일로 저장한다.
 * @return 성공하면 true 를 리턴하고 실패하면 false 를 리턴한다.
 */
bool CSetup::Put()
{
	PutString( ST_SIP_SERVER_IP, m_strSipServerIp.c_str() );
	PutInt( ST_SIP_SERVER_PORT, m_iSipServerPort );
	PutString( ST_SIP_DOMAIN, m_strSipDomain.c_str() );
	PutString( ST_CALLER_ID, m_strCallerId.c_str() );
	PutString( ST_CALLER_PW, m_strCallerPassWord.c_str() );
	PutString( ST_CALLEE_ID, m_strCalleeId.c_str() );
	PutString( ST_CALLEE_PW, m_strCalleePassWord.c_str() );
	PutInt( ST_CALL_TOTAL_COUNT, m_iCallTotalCount );
	PutInt( ST_CALL_CONCURRENT_COUNT, m_iCallConcurrentCount );
	PutInt( ST_TEST_TYPE, m_iTestType );

	bool bRes = PutFile();

	m_clsMap.clear();

	return bRes;
}
Esempio n. 19
0
void SimpleThread(void* which) {
    char* ch = (char*) which;
    int i;
    for (i = 0; i < 10; i++) {
        PutChar(*ch);
        PutInt(i);
        PutChar('\n');
    }
    UserThreadExit();
}
void* fun()
{

    int i;
    for(i=0; i<10;i ++)
    {
        PutInt(i);
    }
    return 0;
}
void* last_killed_thread()
{

    int i;
    for(i=0; i<2;i ++)
    {
        PutInt(i);
    }
    return 0;
}
Esempio n. 22
0
void f(void* arg)
{
	int* n = (int*)arg;
	int i;
	for(i = 0 ; i < 50 ; i++)
	{
		PutInt(*n);
	}
	PutString("\n");
	UserThreadExit(0);
}
/*! \brief Transmits the sign on packet to QTouch Studio.
 */
void Transmit_Sign_On(void)
{
	PutChar(QT_SIGN_ON);
	PutInt(PROJECT_ID);
	PutChar(INTERFACE);
	PutChar(1);             /* PROTOCOL_TYPE */
	PutChar(2);             /* PROTOCOL_VERSION */

#if DEF_TOUCH_QDEBUG_ENABLE_QM == 1
	PutChar(1);             /* LIB_TYPE    QMatrix */
#elif ((DEF_TOUCH_QDEBUG_ENABLE_AT == 1) ||\
	(DEF_TOUCH_QDEBUG_ENABLE_QTA == 1)      ||\
	(DEF_TOUCH_QDEBUG_ENABLE_QTB == 1))
	PutChar(0);             /* LIB_TYPE    QTouch */
#endif
	PutInt(QDEBUG_LIBINFO.fw_version); /* LIB_VERSION */
	PutInt(0);              /* LIB_VARIANT */
	PutChar(QDEBUG_NUM_CHANNELS);
	PutInt(delivery);       /* subscription info */
	Send_Message();
}
Esempio n. 24
0
/*============================================================================
Name    :   Transmit_Sign_On
------------------------------------------------------------------------------
Purpose :   Transmits the sign on packet to QTouch Studio
Input   :   n/a
Output  :   n/a
Notes   :
============================================================================*/
void Transmit_Sign_On(void)
{
      PutChar(QT_SIGN_ON);
      PutInt(PROJECT_ID);
      PutChar(INTERFACE);
      PutChar(1);                         //PROTOCOL_TYPE
      PutChar(1);                         //PROTOCOL_VERSION

#if DEF_TOUCH_QMATRIX == 1
      PutChar(1);			  //LIB_TYPE	QMatrix
#elif ((DEF_TOUCH_AUTONOMOUS_QTOUCH == 1) || \
       (DEF_TOUCH_QTOUCH_GRP_A == 1)      || \
       (DEF_TOUCH_QTOUCH_GRP_B == 1))
      PutChar(0);			  //LIB_TYPE	QTouch
#endif
      PutInt(QDEBUG_LIBINFO.fw_version);  //LIB_VERSION
      PutInt(0);                          //LIB_VARIANT
      PutChar(QDEBUG_NUM_CHANNELS);
      PutInt(delivery);                   // subscription info
      Send_Message();
}
Esempio n. 25
0
void Thread(void* arg) {
	int* i = (int*) arg;
	PutChar('T');
	PutInt(*i);
	PutChar('\n');
	(*i)--;
	if (*i > 0) {
		int tid = UserThreadCreate(Thread, arg);
		UserThreadJoin(tid);
	}
	UserThreadExit();
}
Esempio n. 26
0
int main()
{
	PutString("\n-----------------------------------------\n");
	PutString("Lancement du test testFin : \n");
	PutString("Teste la terminaison des threads sans appel explicite a UserThreadExit.\n");
	PutString("-----------------------------------------\n");
	PutString("Main, Tid : \n");
	PutInt(GetTid());
	PutString("\n");
	UserThreadCreate(f, 0);
	UserThreadCreate(g, 0);
	UserThreadCreate(fin, 0);
    return 0;
}
int main()
{
    int *retCode;
    int tid = 0;

	PutString("Parent start\n");
	tid = UserThreadCreate(&fun, 0);
    UserThreadJoin(tid, (void **)(&retCode));

    PutString("Exit code of child is ");
    PutInt((int)retCode);

	PutString("\nParent finish\n");
	return 0;
}
Esempio n. 28
0
void Transmit_Time_Stamps(void)
{
    PutInt(timestamp1_hword);
    PutInt(timestamp1_lword);
    PutInt(timestamp2_hword);
    PutInt(timestamp2_lword);
    PutInt(timestamp3_hword);
    PutInt(timestamp3_lword);
    Send_Message();
}
Esempio n. 29
0
bool
Prefs::Save()
{
	if (fFatalError)
		return false;

	if (!PutInt("window_mode", &window_mode)
		|| !PutRect("normal_window_rect", &normal_window_rect)
		|| !PutRect("mini_window_rect", &mini_window_rect)
		|| !PutRect("prefs_window_rect", &prefs_window_rect)
		|| !PutInt("normal_bar_color", &normal_bar_color)
		|| !PutInt("mini_active_color", &mini_active_color)
		|| !PutInt("mini_idle_color", &mini_idle_color)
		|| !PutInt("mini_frame_color", &mini_frame_color)
		|| !PutInt("deskbar_active_color", &deskbar_active_color)
		|| !PutInt("deskbar_idle_color", &deskbar_idle_color)
		|| !PutInt("deskbar_frame_color", &deskbar_frame_color)
		|| !PutBool("normal_fade_colors", &normal_fade_colors)
		|| !PutInt("deskbar_icon_width", &deskbar_icon_width))
		return false;

	return true;
}
int main()
{
    unsigned int pid;
    int val;

    pid = ForkExec("run2");
    if (pid < 0)
    {
        PutString("Error while Fork\n");
        return -1;
    }

    Waitpid(pid, &val);

    PutString("Child exit code was ");
    PutInt(val);
    PutChar('\n');

    return 0;
}