コード例 #1
0
ファイル: winutils.c プロジェクト: rdebath/sgt
/* Callback function to launch context help. */
static VOID CALLBACK message_box_help_callback(LPHELPINFO lpHelpInfo)
{
    if (help_path) {
	char *context = NULL;
#define CHECK_CTX(name) \
	do { \
	    if (lpHelpInfo->dwContextId == WINHELP_CTXID_ ## name) \
		context = WINHELP_CTX_ ## name; \
	} while (0)
	CHECK_CTX(errors_hostkey_absent);
	CHECK_CTX(errors_hostkey_changed);
	CHECK_CTX(errors_cantloadkey);
	CHECK_CTX(option_cleanup);
	CHECK_CTX(pgp_fingerprints);
#undef CHECK_CTX
	if (context) {
	    /* We avoid using malloc, in case we're in a situation where
	     * it would be awkward to do so. */
	    char cmd[WINHELP_CTX_MAXLEN+10];
	    sprintf(cmd, "JI(`',`%.*s')", WINHELP_CTX_MAXLEN, context);
	    WinHelp(hwnd, help_path, HELP_COMMAND, (DWORD)cmd);
	    requested_help = TRUE;
	}
    }
}
コード例 #2
0
ファイル: winutils.c プロジェクト: burlen/visit_vtk_7_src
/* Callback function to launch context help. */
static VOID CALLBACK message_box_help_callback(LPHELPINFO lpHelpInfo)
{
    char *context = NULL;
#define CHECK_CTX(name) \
    do { \
	if (lpHelpInfo->dwContextId == WINHELP_CTXID_ ## name) \
	    context = WINHELP_CTX_ ## name; \
    } while (0)
    CHECK_CTX(errors_hostkey_absent);
    CHECK_CTX(errors_hostkey_changed);
    CHECK_CTX(errors_cantloadkey);
    CHECK_CTX(option_cleanup);
    CHECK_CTX(pgp_fingerprints);
#undef CHECK_CTX
    if (context)
	launch_help(hwnd, context);
}
コード例 #3
0
/*
 * Dispatch enable/disable 
 */
SYSCALL ER tk_dis_dsp_impl( void )
{
	CHECK_CTX(!in_loc());

	knl_dispatch_disabled = DDS_DISABLE;

	return E_OK;
}
コード例 #4
0
/*
 * Dispatch enable 
 */
SYSCALL ER tk_ena_dsp_impl( void )
{
	CHECK_CTX(!in_loc());

	knl_dispatch_disabled = DDS_ENABLE;
	if ( knl_ctxtsk != knl_schedtsk ) {
		knl_dispatch();
	}

	return E_OK;
}
コード例 #5
0
ファイル: cpu_calls.c プロジェクト: kidasan/tkernel
/*
 * Dispatch enable
 */
SYSCALL ER _tk_ena_dsp( void )
{
	CHECK_CTX(!in_loc());

	BEGIN_CRITICAL_SECTION
	dispatch_disabled[get_prid()] = DDS_ENABLE;
	ready_queue_top(&ready_queue, schedtsk);
	END_CRITICAL_SECTION

	return E_OK;
}
コード例 #6
0
ファイル: cpu_calls.c プロジェクト: kidasan/tkernel
/*
 * Dispatch enable/disable
 */
SYSCALL ER _tk_dis_dsp( void )
{
	BOOL	done = FALSE;
	UINT	prid;

	CHECK_CTX(!in_loc());

  retry:
	BEGIN_CRITICAL_SECTION;
	prid = get_prid();
	if ( (ctxtsk[prid]->state & TS_SUSPEND) == 0 ) {
		dispatch_disabled[prid] = DDS_DISABLE;
		done = TRUE;
	}
	END_CRITICAL_NO_DISPATCH;
	if ( !done ) {
		goto retry;
	}

	return E_OK;
}
コード例 #7
0
ファイル: doscom_user.c プロジェクト: Michael-bochi/training
/*
 * doscom_init
 */
int
doscom_init(doscom_mask_t fifoch_mask, doscom_time_t timeout)
{
	int ret, i;
	void *p_sregion;
	doscom_fifoch_t *p_fifoch;
	doscom_smemch_t *p_smemch;

	uint32_t num_blocks[DOSCOM_NUM_FIFOCHS] = DOSCOM_FIFOCH_NUM_BLOCKS;
	uint32_t block_size[DOSCOM_NUM_FIFOCHS] = DOSCOM_FIFOCH_BLOCK_SIZES;
	uint32_t fifoch_offsets[DOSCOM_NUM_FIFOCHS] = DOSCOM_SREGION_FIFOCH_OFFSETS;
	uint32_t buffer_size[DOSCOM_NUM_SMEMCHS] = DOSCOM_SMEMCH_BUFFER_SIZES;
	uint32_t smemch_offsets[DOSCOM_NUM_SMEMCHS]  = DOSCOM_SREGION_SMEMCH_OFFSETS;

	CHECK_CTX();
	CHECK_FIFOCHMASK(fifoch_mask);

	if(the_doscom_user.initialized == true)  return DOSCOM_SUCCESS;

	// 1.- create shared memory object and map it and 0 clean.
	ret = __doscom_kernel_sregion_init(&p_sregion);
	if (ret != 0) return ret;

	// 2.- initialize all fifo channels
	for(i=0; i < DOSCOM_NUM_FIFOCHS; i++) {
		p_fifoch = get_fifoch(i);

#ifdef DOSCOM_NT
		//skip initialize in case of a fifo channel is not assignd
		if ((fifoch_mask & (1 << i)) == 0) {
			p_fifoch->assigned = false;
			continue;
		}
#endif /* DOSCOM_NT */

		// local variables
		p_fifoch->assigned = true;
		p_fifoch->block_size = block_size[i];
		p_fifoch->num_blocks = num_blocks[i];
		p_fifoch->t2nt_fifo.num_elements = p_fifoch->num_blocks + 1;
		p_fifoch->nt2t_fifo.num_elements = p_fifoch->num_blocks + 1;
		// initialize pointers to shared memory
		p_fifoch->t2nt_fifo.p_write  = p_sregion + fifoch_offsets[i];
		p_fifoch->t2nt_fifo.p_read   = p_fifoch->t2nt_fifo.p_write  + 1;
		p_fifoch->t2nt_fifo.p_buffer = p_fifoch->t2nt_fifo.p_read   + 1;
		p_fifoch->nt2t_fifo.p_write  = p_fifoch->t2nt_fifo.p_buffer + p_fifoch->t2nt_fifo.num_elements;
		p_fifoch->nt2t_fifo.p_read   = p_fifoch->nt2t_fifo.p_write  + 1;
		p_fifoch->nt2t_fifo.p_buffer = p_fifoch->nt2t_fifo.p_read   + 1;
		p_fifoch->p_t2nt_filter_id   = (doscom_id_t*)(p_fifoch->nt2t_fifo.p_buffer + p_fifoch->nt2t_fifo.num_elements);
		p_fifoch->p_nt2t_filter_id   = (doscom_id_t*)(p_fifoch->p_t2nt_filter_id   + 1);
		p_fifoch->p_blocks_buffer    = (uint32_t*)(p_fifoch->p_nt2t_filter_id   + 1); 

#ifdef DOSCOM_T
		// initialize 
		__doscom_fifoch_init(i);
#endif /* DOSCOM_T */
	}

	// 2.- initialize all smemchs
	for(i=0; i<DOSCOM_NUM_SMEMCHS; i++) {
		p_smemch = get_smemch(i);
		p_smemch->buffer_size = buffer_size[i];
		p_smemch->p_lock = p_sregion + smemch_offsets[i];
		p_smemch->p_buffer = p_smemch->p_lock + 1;
	}

	__doscom_debug_print_all();

	// 4.- init events and wait for the Destinataion OS to initialize (with a timeout)
	ret = __doscom_kernel_init(fifoch_mask, timeout, p_sregion);
	if (ret != 0) return ret;

	the_doscom_user.initialized = true;

	return DOSCOM_SUCCESS;
}