Example #1
0
static void input_event(struct ddk_input_handle *handle, unsigned int event_type,
						unsigned int event_code, int value)
{
	switch(event_type)
	{
		case DDK_INPUT_EV_KEY:
			/*
				value : 1 输入  2 重复  0 该键弹起 
			*/
			ifi_input_stream(IFI_DEV_STD_IN, &event_code, 1, value);
			break;
		default:
				//printk("type = %d,code = %d, value = %d\n", event_type, event_code, value);
			break;
	}
	
	//printk("type = %x.\n", event_type);
#if 0
	{
		extern struct ko_thread *tmsg;
		MSG_MAKE(2, MSG_FLAGS_ADDRESS, 0x8004b0);
		if (tmsg)
		{
			printk("Send result %d.\n", ktm_send(tmsg, pmsg));
		}
	}
#endif
}
Example #2
0
/**
	@brief Thread message slot managing
*/
static bool thread_msg(struct sysreq_thread_msg *req)
{
	bool r = false;
	struct ktm *msg;
	
	if (req->ops == SYSREQ_THREAD_MSG_SLEEP)
	{
		msg = ktm_prepare_loop();
		if (msg == NULL)
		{
			req->slot_base = NULL;
			req->slot_buffer_size = 0;
		}
		else
		{
			kt_sleep(KT_STATE_WAITING_MSG);

			req->slot_base			= (void*)msg->map->node.start;
			req->slot_buffer_size	= msg->desc.slot_buffer_size;
			r = true;
		}
	}
	else if (req->ops == SYSREQ_THREAD_MSG_SEND)
	{
		struct y_message *what = req->send.msg;
		ke_handle thread = req->send.to_thread;
		struct ko_thread *to;
		
		/* Translate thread */
		if (!(to = ke_handle_translate(thread)))
			goto end;
		
		r = ktm_send(to, what);
		
		ke_handle_put(thread, to);
	}
end:
	return r;
}