Example #1
0
/**
 *
 * @brief Mailbox transfer speed test
 *
 * @return N/A
 */
void mailbox_test(void)
{
	u32_t putsize;
	u32_t puttime;
	int putcount;
	unsigned int EmptyMsgPutTime;
	GetInfo getinfo;

	PRINT_STRING(dashline, output_file);
	PRINT_STRING("|                "
				 "M A I L B O X   M E A S U R E M E N T S"
				 "                      |\n", output_file);
	PRINT_STRING(dashline, output_file);
	PRINT_STRING("| Send mailbox message to waiting high "
		 "priority task and wait                 |\n", output_file);
	PRINT_F(output_file, "| repeat for %4d times and take the "
			"average                                  |\n",
			NR_OF_MBOX_RUNS);
	PRINT_STRING(dashline, output_file);
	PRINT_HEADER();
	PRINT_STRING(dashline, output_file);
	k_sem_reset(&SEM0);
	k_sem_give(&STARTRCV);

	putcount = NR_OF_MBOX_RUNS;

	putsize = 0;
	mailbox_put(putsize, putcount, &puttime);
	/* waiting for ack */
	k_msgq_get(&MB_COMM, &getinfo, K_FOREVER);
	PRINT_ONE_RESULT();
	EmptyMsgPutTime = puttime;
	for (putsize = 8; putsize <= MESSAGE_SIZE; putsize <<= 1) {
		mailbox_put(putsize, putcount, &puttime);
		/* waiting for ack */
		k_msgq_get(&MB_COMM, &getinfo, K_FOREVER);
		PRINT_ONE_RESULT();
	}
	PRINT_STRING(dashline, output_file);
	PRINT_OVERHEAD();
	PRINT_XFER_RATE();
}
Example #2
0
void spawn_task(void *unused1, void *unused2, void *unused3)
{
	tSimpleLinkSpawnMsg slMsg;

	ARG_UNUSED(unused1);
	ARG_UNUSED(unused2);
	ARG_UNUSED(unused3);

	while (1) {
		k_msgq_get(&spawn_msgq, &slMsg, K_FOREVER);
		slMsg.pEntry(slMsg.pValue);
	}
}
Example #3
0
	DECLARE_VAR(mbox, sync_get)
	DECLARE_VAR(mbox, async_put)

	DECLARE_VAR(mbox, get_w_cxt)


	/*******************************************************************/
	/* Msg queue for put*/
	int received_data = 0;

	producer_w_cxt_switch_tid =
		k_thread_create(&my_thread, my_stack_area, STACK_SIZE,
				thread_producer_msgq_w_cxt_switch, NULL,
				NULL, NULL, 2 /*priority*/, 0, 50);

	u32_t msg_status =  k_msgq_get(&benchmark_q, &received_data, 300);

	producer_wo_cxt_switch_tid =
		k_thread_create(&my_thread_0, my_stack_area_0, STACK_SIZE,
				thread_producer_msgq_wo_cxt_switch,
				NULL, NULL, NULL, -2 /*priority*/, 0, 0);

	k_thread_abort(producer_w_cxt_switch_tid);
	k_thread_abort(producer_wo_cxt_switch_tid);
	__msg_q_put_w_cxt_end_tsc = ((u32_t)__common_var_swap_end_tsc);
	ARG_UNUSED(msg_status);

	/*******************************************************************/

	/* Msg queue for get*/