summaryrefslogtreecommitdiffstats
blob: e824618eb3ad0d1bebcce4211d212ac55223f4ee (plain) (blame)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
 * Copyright (c) 2017-present, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
/** ============================================================================
 *  @file       RegisterIntr.h
 *
 *  @brief      Interrupt register routines
 *
 *
 *  ============================================================================
 */

#ifndef ti_osal_RegisterIntr__include
#define ti_osal_RegisterIntr__include

#include <ti/osal/EventCombinerP.h>
#include <ti/osal/HwiP.h>
#include <ti/osal/MuxIntcP.h>

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
/*!
 *  @brief  Interrupt Configuration parameters for the corepac (c6x/a15/m5/a8/a9)
 */
typedef struct {
    char    *name; /* Name of the instance for debugging purposes, could be set to NULL */
    int32_t corepacEventNum; /* Event number going in to the corepac */
    int32_t intVecNum; /* Interrupt vector */
    void (*isrRoutine)(uintptr_t arg); /* The ISR routine to hook the corepacEventNum to */
    uintptr_t arg; /* Argument to the ISR routine */
    uint32_t priority;
    uint32_t triggerSensitivity;
} OsalRegisterIntParams_corepac_t;

/* For C6x, if intVec=16, then event combiner is to be used */
#define OSAL_REGINT_INTVEC_EVENT_COMBINER (16) 

/*!
 *  @brief  Interrupt Configuration parameters for soc mux prior to reaching the core
 */
typedef struct {
   MuxIntcP_inParams *muxInParams;
   MuxIntcP_outParams *muxOutParams;
} OsalRegisterIntParams_socmux_t;

/*!
 *  @brief  Interrupt Configuration parameters for soc mux prior to reaching the core
 *          This is the data structure used to configure the interrupts in the system.
 *   coreConfig: This part configures the interrupt for corepac such as c66x, arm, m4
 *   socMuxConfig: This part configures the interrupt path for any SOC level mux such as CIC/GIC or cross bar,
 *                 leading up to the corepac
 */
typedef struct {
    OsalRegisterIntParams_corepac_t corepacConfig;
    OsalRegisterIntParams_socmux_t  socMuxConfig;
} OsalRegisterIntrParams_t;

/**
 *  \anchor OsalInterruptRetCode_e
 *  \name Osal Interrupt return Codes
 *  @{
 */
/*!
 *  @brief  Return error codes for  Osal Interrupt functions
 */
typedef int32_t OsalInterruptRetCode_e;
#define  OSAL_INT_SUCCESS                       ((int32_t) 0)
/* Success return code */
#define  OSAL_INT_ERR_INVALID_PARAMS            ((int32_t) -1)
/* Invalid input parameters */
#define  OSAL_INT_ERR_HWICREATE                 ((int32_t) -2)
/* Error while registering the Hwi object */
#define  OSAL_INT_ERR_EVENTCOMBINER_REG         ((int32_t) -3)
/* Error while registering the event combiner to the defaults */
#define  OSAL_INT_ERR_DELETE                    ((int32_t) -4)
/* Failed to delete a Interrupt handle. */
/* @} */

void Osal_RegisterInterrupt_initParams(OsalRegisterIntrParams_t *interruptRegParams);
/*!
 *  @brief  Function to initialize the interrupt registration configuration data structure
 *
 */
OsalInterruptRetCode_e Osal_RegisterInterrupt(OsalRegisterIntrParams_t *interruptRegParams,HwiP_Handle *hwiPHandlePtr);
/*!
 *  @brief  Function to register interrupt with parameters provided
 *
 */
OsalInterruptRetCode_e Osal_DeleteInterrupt(HwiP_Handle handle,int32_t corepacEventNum);
/*!
 *  @brief  Function to delete interrupt corresponding to an event number
 *
 */
void Osal_EnableInterrupt(int32_t corepacEvent,int32_t interruptNum);
/*!
 *  @brief  Function to enable the interrupt corresponding to an event number
 *
 */
void Osal_DisableInterrupt(int32_t corepacEvent,int32_t interruptNum);
/*!
 *  @brief  Function to disable the  interrupt corresponding to an event number
 *
 */
void Osal_ClearInterrupt(int32_t corepacEvent,int32_t interruptNum);
/*!
 *  @brief  Function to clear the interrupts corresponding to an event number
 *
 */

#ifdef __cplusplus
}
#endif

#endif /* ti_osal_RegisterIntr__include */