RTEMS
smpunicastaction.c
1 /*
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (C) 2019 embedded brains GmbH
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31 
32 #include <rtems/score/smpimpl.h>
33 
35  uint32_t cpu_index,
36  SMP_Action_handler handler,
37  void *arg
38 )
39 {
40  Per_CPU_Control *cpu;
41  Per_CPU_Job_context context;
42  Per_CPU_Job job;
43 
44  context.handler = handler;
45  context.arg = arg;
46  job.context = &context;
47  cpu = _Per_CPU_Get_by_index( cpu_index );
48  _Per_CPU_Add_job( cpu, &job );
50  _Per_CPU_Wait_for_job( cpu, &job );
51 }
void _SMP_Unicast_action(uint32_t cpu_index, SMP_Action_handler handler, void *arg)
Initiates an SMP action on the specified target processor.
Per_CPU_Job_handler handler
The job handler.
Definition: percpu.h:188
void _Per_CPU_Wait_for_job(const Per_CPU_Control *cpu, const Per_CPU_Job *job)
Waits for the job carried out by the specified processor.
A per-processor job.
Definition: percpu.h:209
void * arg
The job handler argument.
Definition: percpu.h:193
#define SMP_MESSAGE_PERFORM_JOBS
SMP message to perform per-processor jobs.
Definition: smpimpl.h:50
Per CPU Core Structure.
Definition: percpu.h:347
void _Per_CPU_Add_job(Per_CPU_Control *cpu, Per_CPU_Job *job)
Adds the job to the tail of the processing list of the specified processor.
Context for per-processor jobs.
Definition: percpu.h:184
const Per_CPU_Job_context * context
Pointer to the job context to get the handler and argument.
Definition: percpu.h:228
void _SMP_Send_message(uint32_t cpu_index, unsigned long message)
Sends an SMP message to a processor.
Definition: smp.c:215
SuperCore SMP Implementation.