zephyr/kernel/microkernel/k_nop.c
Peter Mitsis 59c21a5f62 microkernel: Fibers and ISRs may invoke microkernel no-op
Adds support that allows fibers and ISRs to invoke the microkernel
no-op kernel service request. This is useful for cases when the
nanokernel needs to invoke the microkernel task scheduler.

Change-Id: I1f4b2a39ac6b5e44bb1b6c6b3cd6034262bbada8
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-05-04 22:51:35 +00:00

80 lines
1.8 KiB
C

/*
* Copyright (c) 1997-2014 Wind River Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief "do nothing" kernel service
*
* This module provides a "do nothing" kernel service.
*
* This service is primarily used by other kernel services that need a way to
* resume the execution of a kernel request that could not be completed in a
* single invocation of the _k_server fiber. However, it can also be used by
* a task to measure the overhead involved in issuing a kernel service request.
*/
#include <micro_private.h>
#include <toolchain.h>
#include <sections.h>
/**
*
* @brief Perform "do nothing" kernel request
*
* @return N/A
*/
void _k_nop(struct k_args *A)
{
if (A->alloc) {
FREEARGS(A);
}
}
/**
*
* @brief "do nothing" kernel request
*
* This routine is a request for the _k_server to run a "do nothing" routine.
*
* @return N/A
*/
void _task_nop(void)
{
struct k_args A;
A.Comm = _K_SVC_NOP;
KERNEL_ENTRY(&A);
}
/**
* @brief "do nothing" kernel request
*
* This routine is a request for the _k_server to run a "do nothing" routine.
* It is invoked by the nanokernel internals to trigger the microkernel task
* scheduler.
*
* @return N/A
*/
void _nano_nop(void)
{
struct k_args *A;
GETARGS(A);
A->Comm = _K_SVC_NOP;
A->alloc = true;
SENDARGS(A);
}