summaryrefslogtreecommitdiff
path: root/hifi/xaf/hifi-dpf/core/xf-isr.c
blob: 4e2add1e81850ebadcc350874453c68f7f380fcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*******************************************************************************
* Copyright (C) 2018 Cadence Design Systems, Inc.
* 
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to use this Software with Cadence processor cores only and 
* not with any other processors and platforms, subject to
* the following conditions:
* 
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

/*******************************************************************************
 * xf-isr.c
 *
 * DSP processing framework - code running from interrupt context
 *
 ******************************************************************************/

#define MODULE_TAG                      ISR

/*******************************************************************************
 * Includes
 ******************************************************************************/

#include "xf.h"

/*******************************************************************************
 * API functions definitions
 ******************************************************************************/

/* ...submit command message from interrupt context on local core */
void xf_msg_schedule_isr(xf_message_t *m)
{
    u32                 core = XF_MSG_DST_CORE(m->id);
    xf_core_data_t     *cd = XF_CORE_DATA(core);
    
    /* ...interrupt masking protocol is used for protecting local message queue */
    if (xf_msg_enqueue(&cd->queue, m))
    {
        /* ...resume local scheduler if that is the first message */
        xf_ipi_resume(core);
    }
}

/* ...complete message from interrupt handler */
void xf_msg_complete_isr(xf_message_t *m)
{
    u32                 core = XF_MSG_DST_CORE(m->id);
    xf_core_data_t     *cd = XF_CORE_DATA(core);

    /* ...place message into response queue */
    if (xf_msg_enqueue(&cd->response, m))
    {
        /* ...notify local scheduler if that is the first message */
        xf_ipi_resume(core);
    }
}