Skip to content

Commit dbc4ccd

Browse files
committed
edited ipc.h documentation
1 parent 5288f1a commit dbc4ccd

File tree

1 file changed

+105
-19
lines changed

1 file changed

+105
-19
lines changed

include/ipc.h

Lines changed: 105 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/**
2+
*
3+
* \file ipc.h
4+
*
5+
* \brief apipc declarations.
6+
*
7+
* \author Federico David Ceccarelli
8+
*
9+
* apipc is an ipc_driver library implementation for TMS320C28x Texas
10+
* Instruments cores. The api present a bunch of routines to simplify
11+
* data tranfer between cores.
12+
*/
113

214
#ifndef __IPC_H__
315
#define __IPC_H__
@@ -19,67 +31,141 @@ extern volatile tIpcController g_sIpcController1;
1931
extern volatile tIpcController g_sIpcController2;
2032

2133
/**
22-
* @fn ipc_init
34+
* \brief Initialize apipc IPC API
35+
*
36+
* apipc_init should be invoked on both cores during start up.
37+
*
38+
* To the correct functioning of the api, apipc_init sets GSxM memory blocks
39+
* privileges and configure dependencies initializing mymalloc handler to
40+
* allocate cl_r_w_data data dynamically and circular_buffer handler to manage
41+
* tIpcMessage array dynamically. Also initialize objs array to a known state.
42+
*
43+
* Funtion take care not only to initialize apipc but also ipc driver by
44+
* calling InitIpc() and initializing ipc driver controllers on IPC_INT0 &
45+
* IPC_INT1 respectively.
2346
*
24-
* @brief Initialize apipc IPC API
47+
* \note apipc_init will acknowledge the api local start and will wait until it
48+
* were also initiated on the Remote CPU blocking the process meanwhile. Fuction
49+
* is blocking.
2550
*/
2651
void apipc_init(void);
2752

2853
/**
29-
* @fn apipc_register_obj
54+
* @brief Register an apipc IPC API object
55+
*
56+
* \param[in] obj_idx object index number
57+
* \param[in] obj_type apipc obj type
58+
* \param[in] paddr pointer to data
59+
* \param[in] size data size in bytes
60+
* \param[in] startup start up flag, set as 1 to transmit obj on apipc app start
61+
* up.
62+
*
63+
* \return apipc_rc APIPC_RC_SUCCESS if registration process success and
64+
* APIPC_RC_FAIL if object couldn be registered.
65+
*
66+
* Register data as an apipc obj to be able to be tranfer between cores. Every
67+
* piece of data that user would like to transmit between cores must be
68+
* pre-registered as an object to indicate apipc how manage it.
69+
*
70+
* Registration will fail if paddr == NULL. Multiple objects registration over
71+
* the same obj_idx will cause overwriting.
3072
*
31-
* @brief Register an IPC API object
3273
*/
3374
enum apipc_rc apipc_register_obj(uint16_t obj_idx, enum apipc_obj_type obj_type,
3475
void *paddr, size_t size, uint16_t startup);
3576

3677
/**
37-
* @fn apipc_obj_state
78+
* @brief peep actual obj_sm state of obj_idx object
3879
*
39-
* @brief consult the actual state of the obj_idx object sm
80+
* \param[in] obj_idx object index number
81+
*
82+
* \return apipc_obj_sm object state machine actual state
83+
*
84+
* Every object implements and process its own state machine. Each object
85+
* process is independent respect to the others. Knowing the actual obj_sm state
86+
* could be usefull to wait the remote reception of the data or to detect
87+
* faulty transmition by pooling. Those funtions depends on the application and
88+
* arent implemented on apipc.
89+
*
90+
* \note See apipc_obj_sm for states definitios.
4091
*/
4192
enum apipc_obj_sm apipc_obj_state(uint16_t obj_idx);
4293

4394
/**
44-
* @fn apipc_send
95+
* @brief start object transmition on demand.
96+
*
97+
* \param[in] obj_idx object index number
4598
*
46-
* @brief start the transfer of an object on demand. Object should have been
47-
* inited to APIPC_OBJ_SM_STARTED
99+
* Function works evolving the obj state machine to the init transmition state
100+
* only if the object is ready to be transmited between cores.
101+
*
102+
* \return apipc_rc APIPC_RC_SUCCESS if obj transmition process could be
103+
* successfully united. APIPC_RC_FAIL if object send process couldn be started.
104+
*
105+
* \note Object should have already been inited to APIPC_OBJ_SM_IDLE
106+
48107
*/
49108
enum apipc_rc apipc_send(uint16_t obj_idx);
50109

51110
/**
52-
* @fn apipc_flags_set_bits
53-
*
54111
* @brief Sets the designated bits at the remote obj.
112+
*
113+
* \param[in] obj_idx object index number
114+
* \param[in] bmask especifies bits to be set.
115+
*
116+
* \return apipc_rc
117+
*
118+
* \note function bypass apipc normal functioning and obj sm interacting
119+
* directly with ipc diver. Use is not recomended!
120+
*
121+
* \note hint! could be used to announce a flagiged event immediately .
55122
*/
56123
enum apipc_rc apipc_flags_set_bits(uint16_t obj_idx, uint32_t bmask);
57124

58125
/**
59-
* @fn apipc_flags_clear_bits
60-
*
61126
* @brief Clear the designated bits at the remote obj.
127+
*
128+
* \param[in] obj_idx object index number
129+
* \param[in] bmask especifies bits to be clear.
130+
*
131+
* \return apipc_rc
132+
*
133+
* \note function bypass apipc normal functioning and obj sm interacting
134+
* directly with ipc diver. Use is not recomended!
135+
*
136+
* \note hint! could be used to announce a flagiged event immediately .
62137
*/
63138
enum apipc_rc apipc_flags_clear_bits(uint16_t obj_idx, uint32_t bmask);
64139

65140

66141
/**
67-
* @fn apipc_startup_remote
142+
* @brief Initialize data on local object on the remote core
143+
*
144+
* To be transmited, variables and blocks not only need to be registered as
145+
* objects but also their SM needs to be initialized. If startup flag is marked,
146+
* local core will transmit his value to remote core over obj sm startup. Thats
147+
* the apipc_startup_remote functionality.
148+
* Obj initialization is one of the task apipc_app will process when function
149+
* start to be recursively called. But may be you want to transmit obj initial
150+
* values over core initialization before main process and apipc_app starts
151+
* being called.
68152
*
69-
* @brief Start a comunication over IPC API
153+
* \note remote core should be able to process apipc messages.
154+
*
70155
*/
71156
enum apipc_rc apipc_startup_remote(void);
72157

73158
/**
74-
* @fn apipc_app
75-
*
76159
* @brief apipc application
160+
*
161+
* apipc application should be recursively called in the main while to transmit
162+
* and receive previously declared objects.
77163
*/
78164
void apipc_app(void);
79165

80166
/* IPC interrupt Handlers Functions declarations */
81-
interrupt void apipc_ipc0_isr_handler(void);
82-
interrupt void apipc_ipc1_isr_handler(void);
167+
interrupt void apipc_ipc0_isr_handler(void); /**< IPC0 interrupt Handler */
168+
interrupt void apipc_ipc1_isr_handler(void); /**< IPC1 interrupt Handler */
83169

84170
#endif
85171

0 commit comments

Comments
 (0)