2015-04-11 07:44:37 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012, 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* 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
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* 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.
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2015-08-30 00:57:26 +08:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Microkernel command packet library
|
2015-07-02 05:22:39 +08:00
|
|
|
*/
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
#include <nanokernel.h>
|
2015-05-29 01:56:47 +08:00
|
|
|
#include <arch/cpu.h>
|
2015-06-19 22:09:45 +08:00
|
|
|
#include <microkernel/command_packet.h>
|
2015-06-19 22:56:52 +08:00
|
|
|
#include <micro_private.h>
|
2015-04-11 07:44:37 +08:00
|
|
|
#include <sections.h>
|
|
|
|
|
2015-08-30 00:57:26 +08:00
|
|
|
/**
|
|
|
|
* Generate build error by defining a negative-size array if the hard-coded
|
2015-06-02 04:52:13 +08:00
|
|
|
* command packet size differs from the actual size; otherwise, define
|
2015-05-14 05:29:14 +08:00
|
|
|
* a zero-element array that gets thrown away by linker
|
|
|
|
*/
|
|
|
|
uint32_t _k_test_cmd_pkt_size
|
2015-06-02 04:52:13 +08:00
|
|
|
[0 - ((CMD_PKT_SIZE_IN_WORDS * sizeof(uint32_t)) != sizeof(struct k_args))];
|
2015-05-14 05:29:14 +08:00
|
|
|
|
2015-07-02 05:22:39 +08:00
|
|
|
/**
|
|
|
|
*
|
2015-08-13 03:37:58 +08:00
|
|
|
* @brief Send command packet to be processed by _k_server
|
2015-08-30 00:57:26 +08:00
|
|
|
* @param cmd_packet Arguments
|
2015-07-02 05:29:04 +08:00
|
|
|
* @return N/A
|
2015-07-02 05:22:39 +08:00
|
|
|
*/
|
2015-05-09 06:12:50 +08:00
|
|
|
void _k_task_call(struct k_args *cmd_packet)
|
2015-05-08 21:08:26 +08:00
|
|
|
{
|
2015-05-09 06:12:50 +08:00
|
|
|
cmd_packet->alloc = false;
|
2015-08-24 23:48:18 +08:00
|
|
|
_k_current_task->args = cmd_packet;
|
2015-05-09 06:12:50 +08:00
|
|
|
nano_task_stack_push(&_k_command_stack, (uint32_t)cmd_packet);
|
2015-05-08 21:08:26 +08:00
|
|
|
}
|