AM243x MCU+ SDK  09.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 
81 typedef struct {
82  uint16_t blockId;
83  uint8_t dataSize;
84  uint8_t noOfBuffers;
85  uint16_t blockSize;
86  uint16_t noOfBlocks;
87  uint32_t bufferAddrs;
91 typedef struct PRU_IPC_Attrs_s {
92  uint16_t dataSize;
93  uint16_t blockSize;
94  uint16_t noOfBlocks;
95  uint16_t noOfBuffers;
96  uint32_t *bufferAddrs;
98  uint32_t enableRxInt;
99  uint32_t pruEvtoutNum;
100  uint32_t sysEventNum;
101  uint32_t r5fIntrNum;
102  uint32_t enableTxInt;
103  uint32_t txEventNum;
104  uint32_t blockSizeBytes;
105 } PRU_IPC_Attrs;
106 
107 typedef struct PRU_IPC_Params_s {
113 
114 typedef struct PRU_IPC_Object_s {
118 
122 typedef struct PRU_IPC_Config_s {
128 
129 /* ========================================================================== */
130 /* Function Declarations */
131 /* ========================================================================== */
132 
136 void PRU_IPC_init(void);
137 
141 void PRU_IPC_deinit(void);
142 
149 
159 
166 
175 
185 int32_t PRU_IPC_getData(PRU_IPC_Handle handle, void *container);
186 
196 int32_t PRU_IPC_sendData(PRU_IPC_Handle handle, void *container);
197 
200 #ifdef __cplusplus
201 }
202 #endif
203 
204 #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:92
PRU_IPC_Attrs::enableTxInt
uint32_t enableTxInt
Definition: pru_ipc.h:102
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
Config_Mem_Struct::noOfBlocks
uint16_t noOfBlocks
Definition: pru_ipc.h:86
Config_Mem_Struct::bufferAddrs
uint32_t bufferAddrs
Definition: pru_ipc.h:87
Config_Mem_Struct::dataSize
uint8_t dataSize
Definition: pru_ipc.h:83
PRU_IPC_Attrs
Definition: pru_ipc.h:91
SystemP.h
PRU_IPC_Attrs::pruEvtoutNum
uint32_t pruEvtoutNum
Definition: pru_ipc.h:99
PRU_IPC_Config::object
PRU_IPC_Object * object
Definition: pru_ipc.h:124
PRU_IPC_Attrs::txEventNum
uint32_t txEventNum
Definition: pru_ipc.h:103
PRU_IPC_Attrs::config
Config_Mem_Struct * config
Definition: pru_ipc.h:97
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:111
PRU_IPC_Attrs::blockSize
uint16_t blockSize
Definition: pru_ipc.h:93
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:96
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:126
PRU_IPC_deinit
void PRU_IPC_deinit(void)
This function deinitializes the PRU_IPC module.
PRU_IPC_Object
Definition: pru_ipc.h:114
PRU_IPC_Attrs::noOfBlocks
uint16_t noOfBlocks
Definition: pru_ipc.h:94
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:122
PRU_IPC_Params
Definition: pru_ipc.h:107
PRU_IPC_Attrs::sysEventNum
uint32_t sysEventNum
Definition: pru_ipc.h:100
Config_Mem_Struct::blockId
uint16_t blockId
Definition: pru_ipc.h:82
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.
Config_Mem_Struct::blockSize
uint16_t blockSize
Definition: pru_ipc.h:85
PRU_IPC_Attrs::blockSizeBytes
uint32_t blockSizeBytes
Definition: pru_ipc.h:104
PRU_IPC_init
void PRU_IPC_init(void)
This function initializes the PRU_IPC module.
Config_Mem_Struct::noOfBuffers
uint8_t noOfBuffers
Definition: pru_ipc.h:84
Config_Mem_Struct
Definition: pru_ipc.h:81
PRU_IPC_Attrs::noOfBuffers
uint16_t noOfBuffers
Definition: pru_ipc.h:95
PRU_IPC_Params::pruicssHandle
PRUICSS_Handle pruicssHandle
Definition: pru_ipc.h:109
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:98
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:235
PRU_IPC_Attrs::r5fIntrNum
uint32_t r5fIntrNum
Definition: pru_ipc.h:101
PRU_IPC_Object::pruIpcParams
PRU_IPC_Params pruIpcParams
Definition: pru_ipc.h:116