Exemple #1
0
/*****************************************************************************
 *     _ddekit_minix_queue_msg                                               *
 ****************************************************************************/
static void 
_ddekit_minix_queue_msg(struct ddekit_minix_msg_q *mq, message *m)
{
	int full;
	full = ddekit_sem_down_try(mq->msg_w_sem);

	if (full) {
		/* Our message queue is full... inform the sender. */
		int result;
		DDEBUG_MSG_WARN("Receive queue is full. Ommiting ingoing msg.\n");

		m->m_type = TASK_REPLY;
		m->REP_STATUS = EAGAIN;
		result = asynsend(m->m_source, m);
		
		if (result != 0) {
			ddekit_panic("unable to send reply to %d: %d\n",
					m->m_source, result);
		}

	} else {
		/* queue the message */
		memcpy(&mq->messages[mq->msg_w_pos], m, sizeof(message));

		if (++mq->msg_w_pos == MESSAGE_QUEUE_SIZE) {
			mq->msg_w_pos = 0;
		}
		DDEBUG_MSG_VERBOSE("ddekit_minix_queue_msg: queueing msg %x\n",
		                    m->m_type);
		ddekit_sem_up(mq->msg_r_sem);
	}
}
Exemple #2
0
static void raise_softirq_irqoff_cpu(unsigned int nr, unsigned int cpu)
{
	CHECK_INITVAR(dde26_softirq);

	/* mark softirq scheduled */
	__raise_softirq_irqoff(nr);
	/* wake softirq thread */
	ddekit_sem_up(dde_softirq_sem);
}
Exemple #3
0
/***
 * try_to_wake_up - wake up a thread
 * @p: the to-be-woken-up thread
 * @state: the mask of task states that can be woken
 * @sync: do a synchronous wakeup?
 */
int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
{
	Assert(p);
	dde26_thread_data *t = lxtask_to_ddethread(p);

	Assert(t);
	Assert(SLEEP_LOCK(t));

	p->state = TASK_RUNNING;
	ddekit_sem_up(SLEEP_LOCK(t));

	return 0;
}
Exemple #4
0
/*****************************************************************************
 *        ddekit_minix_rcv                                                   *
 ****************************************************************************/
void ddekit_minix_rcv(struct ddekit_minix_msg_q *mq, message *m) 
{
	DDEBUG_MSG_VERBOSE("waiting for message");
	
	ddekit_sem_down(mq->msg_r_sem);

	memcpy(m, &mq->messages[mq->msg_r_pos], sizeof(message));

	if (++mq->msg_r_pos == MESSAGE_QUEUE_SIZE) {
		mq->msg_r_pos = 0;
	}
	
	DDEBUG_MSG_VERBOSE("unqueing message");
	
	ddekit_sem_up(mq->msg_w_sem);
}
Exemple #5
0
void ddekit_shutdown() 
{
	ddekit_sem_up(exit_sem);
}
Exemple #6
0
/*****************************************************************************
 *   _ddekit_timer_interrupt                                                 *
 ****************************************************************************/
void _ddekit_timer_interrupt(void)
{
	jiffies = get_current_clock(); 
	DDEBUG_MSG_VERBOSE("now: %d", jiffies);
	ddekit_sem_up(pending_timer_ints);
}