AM64x MCU+ SDK  08.02.00
pru_ipc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * 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
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef PRU_IPC_H_
34 #define PRU_IPC_H_
35 
45 /* ========================================================================== */
46 /* Include Files */
47 /* ========================================================================== */
48 
49 #include <drivers/pruicss.h>
50 #include <kernel/dpl/SystemP.h>
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 /* ========================================================================== */
57 /* Macros & Typedefs */
58 /* ========================================================================== */
59 
64 typedef struct PRU_IPC_Config_s *PRU_IPC_Handle;
65 
70 typedef void (*PRU_IPC_CallbackFxn)(void *args);
71 
72 /* ========================================================================== */
73 /* Structure Declarations */
74 /* ========================================================================== */
75 
76 typedef struct PRU_IPC_Attrs_s {
77  uint16_t dataSize;
78  uint16_t blockSize;
79  uint16_t noOfBlocks;
80  uint16_t noOfBuffers;
81  uint32_t *bufferAddrs;
82  uint32_t configMemAddr;
83  uint32_t enableRxInt;
84  uint32_t pruEvtoutNum;
85  uint32_t sysEventNum;
86  uint32_t r5fIntrNum;
87  uint32_t enableTxInt;
88  uint32_t txEventNum;
89  uint32_t blockSizeBytes;
91 
92 typedef struct PRU_IPC_Params_s {
98 
99 typedef struct PRU_IPC_Object_s {
103 
107 typedef struct PRU_IPC_Config_s {
113 
114 /* ========================================================================== */
115 /* Function Declarations */
116 /* ========================================================================== */
117 
121 void PRU_IPC_init(void);
122 
126 void PRU_IPC_deinit(void);
127 
134 
144 
151 
160 
170 int32_t PRU_IPC_getData(PRU_IPC_Handle handle, void *container);
171 
181 int32_t PRU_IPC_sendData(PRU_IPC_Handle handle, void *container);
182 
185 #ifdef __cplusplus
186 }
187 #endif
188 
189 #endif /* #ifndef PRU_IPC_H_ */
PRU_IPC_sendData
int32_t PRU_IPC_sendData(PRU_IPC_Handle handle, void *container)
Send/Write data to the configured shared memory (generates interrupt to PRU if it is enabled)
PRU_IPC_Attrs::dataSize
uint16_t dataSize
Definition: pru_ipc.h:77
PRU_IPC_Attrs::enableTxInt
uint32_t enableTxInt
Definition: pru_ipc.h:87
PRU_IPC_Handle
struct PRU_IPC_Config_s * PRU_IPC_Handle
A handle that is returned from a PRU_IPC_open() call. This handle is required for calling other PRU_I...
Definition: pru_ipc.h:64
PRU_IPC_Attrs
Definition: pru_ipc.h:76
SystemP.h
PRU_IPC_Attrs::pruEvtoutNum
uint32_t pruEvtoutNum
Definition: pru_ipc.h:84
PRU_IPC_Config::object
PRU_IPC_Object * object
Definition: pru_ipc.h:109
PRU_IPC_Attrs::txEventNum
uint32_t txEventNum
Definition: pru_ipc.h:88
PRU_IPC_getData
int32_t PRU_IPC_getData(PRU_IPC_Handle handle, void *container)
Reads the data from the configured shared memory.
pruicss.h
PRU_IPC_Params::transferCallbackFxn
PRU_IPC_CallbackFxn transferCallbackFxn
Definition: pru_ipc.h:96
PRU_IPC_Attrs::blockSize
uint16_t blockSize
Definition: pru_ipc.h:78
PRU_IPC_Params_init
void PRU_IPC_Params_init(PRU_IPC_Params *params)
Function to set default values of PRU_IPC_Params in params.
PRU_IPC_Attrs::bufferAddrs
uint32_t * bufferAddrs
Definition: pru_ipc.h:81
PRU_IPC_Attrs::configMemAddr
uint32_t configMemAddr
Definition: pru_ipc.h:82
PRU_IPC_close
void PRU_IPC_close(PRU_IPC_Handle handle)
To stop/end PRU_IPC instance.
PRU_IPC_Config::attrs
PRU_IPC_Attrs const * attrs
Definition: pru_ipc.h:111
PRU_IPC_deinit
void PRU_IPC_deinit(void)
This function deinitializes the PRU_IPC module.
PRU_IPC_Object
Definition: pru_ipc.h:99
PRU_IPC_Attrs::noOfBlocks
uint16_t noOfBlocks
Definition: pru_ipc.h:79
PRU_IPC_open
PRU_IPC_Handle PRU_IPC_open(uint32_t idx, PRU_IPC_Params *params)
To initialize and configure PRU_IPC instance.
PRU_IPC_Config
This struct is used to store configurables for PRU_IPC.
Definition: pru_ipc.h:107
PRU_IPC_Params
Definition: pru_ipc.h:92
PRU_IPC_Attrs::sysEventNum
uint32_t sysEventNum
Definition: pru_ipc.h:85
PRU_IPC_getBlockId
uint16_t PRU_IPC_getBlockId(PRU_IPC_Handle handle)
Reads the id of last written block by PRU from the PRU-Config memory.
PRU_IPC_Attrs::blockSizeBytes
uint32_t blockSizeBytes
Definition: pru_ipc.h:89
PRU_IPC_init
void PRU_IPC_init(void)
This function initializes the PRU_IPC module.
PRU_IPC_Attrs::noOfBuffers
uint16_t noOfBuffers
Definition: pru_ipc.h:80
PRU_IPC_Params::pruicssHandle
PRUICSS_Handle pruicssHandle
Definition: pru_ipc.h:94
PRU_IPC_CallbackFxn
void(* PRU_IPC_CallbackFxn)(void *args)
A Callback function required to register callback on data receive if receive interrupt is enabled.
Definition: pru_ipc.h:70
PRU_IPC_Attrs::enableRxInt
uint32_t enableRxInt
Definition: pru_ipc.h:83
PRUICSS_Handle
struct PRUICSS_Config_s * PRUICSS_Handle
A handle that is returned from a PRUICSS_open() call. This handle is required for calling other APIs.
Definition: pruicss/g_v0/pruicss.h:234
PRU_IPC_Attrs::r5fIntrNum
uint32_t r5fIntrNum
Definition: pru_ipc.h:86
PRU_IPC_Object::pruIpcParams
PRU_IPC_Params pruIpcParams
Definition: pru_ipc.h:101