Commit 2a8d70c1 authored by Arun Gopalakrishnan's avatar Arun Gopalakrishnan Committed by Hari Kanigeri

Syslink IPC ListMP, messageQ aligned with 2_00_00_08

This patch can be used to sync with the syslink drop 2.0.0.8 for
ListMP/ListMP Shared Mem and MessageQ Transport SHM modules

The changes are limited to
1.      parameter name changes
2.      error code changes
3.      addition of error function in MessageQ Transport SHM

No major functional change in any of the functions in above
modules.
Signed-off-by: default avatarArun M G <arunmg@ti.com>
parent b938c61a
...@@ -150,7 +150,7 @@ struct listmp_elem { ...@@ -150,7 +150,7 @@ struct listmp_elem {
struct listmp_params { struct listmp_params {
bool cache_flag; bool cache_flag;
/*!< Set to 1 by the open() call. No one else should touch this! */ /*!< Set to 1 by the open() call. No one else should touch this! */
struct mutex *lock_handle; struct mutex *gate;
/*!< Lock used for critical region management of the list */ /*!< Lock used for critical region management of the list */
void *shared_addr; void *shared_addr;
/*!< shared memory address */ /*!< shared memory address */
...@@ -158,7 +158,7 @@ struct listmp_params { ...@@ -158,7 +158,7 @@ struct listmp_params {
/*!< shared memory size */ /*!< shared memory size */
char *name; char *name;
/*!< Name of the object */ /*!< Name of the object */
int resourceId; int resource_id;
/*!< /*!<
* resourceId Specifies the resource id number. * resourceId Specifies the resource id number.
* Parameter is used only when type is set to Fast List * Parameter is used only when type is set to Fast List
......
...@@ -168,7 +168,7 @@ struct listmp_sharedmemory_cmd_args { ...@@ -168,7 +168,7 @@ struct listmp_sharedmemory_cmd_args {
struct listmp_params *params; struct listmp_params *params;
u32 name_len; u32 name_len;
u32 shared_addr_srptr; u32 shared_addr_srptr;
void *knl_lock_handle; void *knl_gate;
} create; } create;
struct { struct {
...@@ -180,7 +180,7 @@ struct listmp_sharedmemory_cmd_args { ...@@ -180,7 +180,7 @@ struct listmp_sharedmemory_cmd_args {
struct listmp_params *params; struct listmp_params *params;
u32 name_len; u32 name_len;
u32 shared_addr_srptr; u32 shared_addr_srptr;
void *knl_lock_handle; void *knl_gate;
} open; } open;
struct { struct {
......
...@@ -120,6 +120,13 @@ ...@@ -120,6 +120,13 @@
#define MESSAGEQ_TRANSPORTSHM_E_HANDLE \ #define MESSAGEQ_TRANSPORTSHM_E_HANDLE \
MESSAGEQ_TRANSPORTSHM_MAKE_FAILURE(8) MESSAGEQ_TRANSPORTSHM_MAKE_FAILURE(8)
/*!
* @def MESSAGEQTRANSPORTSHM_E_NOTSUPPORTED
* @brief The specified operation is not supported.
*/
#define MESSAGEQTRANSPORTSHM_E_NOTSUPPORTED \
MESSAGEQ_TRANSPORTSHM_MAKE_FAILURE(9)
/*! /*!
* @def MESSAGEQ_TRANSPORTSHM_SUCCESS * @def MESSAGEQ_TRANSPORTSHM_SUCCESS
* @brief Operation successful. * @brief Operation successful.
...@@ -140,12 +147,45 @@ ...@@ -140,12 +147,45 @@
* Structures & Enums * Structures & Enums
* ============================================================================= * =============================================================================
*/ */
/*!
* @brief Structure defining the reason for error function being called
*/
enum MessageQTransportShm_Reason {
MessageQTransportShm_Reason_FAILEDPUT,
/*!< Failed to send the message. */
MessageQTransportShm_Reason_INTERNALERR,
/*!< An internal error occurred in the transport */
MessageQTransportShm_Reason_PHYSICALERR,
/*!< An error occurred in the physical link in the transport */
MessageQTransportShm_Reason_FAILEDALLOC
/*!< Failed to allocate a message. */
};
/*!
* @brief transport error callback function.
*
* First parameter: Why the error function is being called.
*
* Second parameter: Handle of transport that had the error. NULL denotes
* that it is a system error, not a specific transport.
*
* Third parameter: Pointer to the message. This is only valid for
* #MessageQTransportShm_Reason_FAILEDPUT.
*
* Fourth parameter: Transport specific information. Refer to individual
* transports for more details.
*/
/*! /*!
* @brief Module configuration structure. * @brief Module configuration structure.
*/ */
struct messageq_transportshm_config { struct messageq_transportshm_config {
u32 reserved; void (*err_fxn)(enum MessageQTransportShm_Reason reason,
/*!< Reserved value */ void *handle,
void *msg,
u32 info);
/*!< Asynchronous error function for the transport module */
}; };
/*! /*!
...@@ -153,6 +193,8 @@ struct messageq_transportshm_config { ...@@ -153,6 +193,8 @@ struct messageq_transportshm_config {
* instances. * instances.
*/ */
struct messageq_transportshm_params { struct messageq_transportshm_params {
u32 priority;
/*!< Priority of messages supported by this transport */
void *gate; void *gate;
/*!< Gate used for critical region management of the shared memory */ /*!< Gate used for critical region management of the shared memory */
void *shared_addr; void *shared_addr;
...@@ -165,8 +207,6 @@ struct messageq_transportshm_params { ...@@ -165,8 +207,6 @@ struct messageq_transportshm_params {
/*!< Notify event number to be used by the transport */ /*!< Notify event number to be used by the transport */
void *notify_driver; void *notify_driver;
/*!< Notify driver to be used by the transport */ /*!< Notify driver to be used by the transport */
u32 priority;
/*!< Priority of messages supported by this transport */
}; };
/*! /*!
...@@ -186,6 +226,7 @@ enum messageq_transportshm_status { ...@@ -186,6 +226,7 @@ enum messageq_transportshm_status {
*/ */
}; };
/* ============================================================================= /* =============================================================================
* APIs called by applications * APIs called by applications
* ============================================================================= * =============================================================================
...@@ -195,7 +236,7 @@ enum messageq_transportshm_status { ...@@ -195,7 +236,7 @@ enum messageq_transportshm_status {
void messageq_transportshm_get_config(struct messageq_transportshm_config *cfg); void messageq_transportshm_get_config(struct messageq_transportshm_config *cfg);
/* Function to setup the MessageQTransportShm module. */ /* Function to setup the MessageQTransportShm module. */
int messageq_transportshm_setup(struct messageq_transportshm_config *cfg); int messageq_transportshm_setup(const struct messageq_transportshm_config *cfg);
/* Function to destroy the MessageQTransportShm module. */ /* Function to destroy the MessageQTransportShm module. */
int messageq_transportshm_destroy(void); int messageq_transportshm_destroy(void);
...@@ -215,6 +256,15 @@ int messageq_transportshm_delete(void **mqtshm_handleptr); ...@@ -215,6 +256,15 @@ int messageq_transportshm_delete(void **mqtshm_handleptr);
u32 messageq_transportshm_shared_mem_req(const u32 messageq_transportshm_shared_mem_req(const
struct messageq_transportshm_params *params); struct messageq_transportshm_params *params);
/* Set the asynchronous error function for the transport module */
void messageq_transportshm_set_err_fxn(
void (*err_fxn)(
enum MessageQTransportShm_Reason reason,
void *handle,
void *msg,
u32 info));
/* ============================================================================= /* =============================================================================
* APIs called internally by MessageQ module. * APIs called internally by MessageQ module.
* ============================================================================= * =============================================================================
...@@ -223,7 +273,7 @@ u32 messageq_transportshm_shared_mem_req(const ...@@ -223,7 +273,7 @@ u32 messageq_transportshm_shared_mem_req(const
int messageq_transportshm_put(void *mqtshm_handle, void *msg); int messageq_transportshm_put(void *mqtshm_handle, void *msg);
/* Control Function */ /* Control Function */
bool messageq_transportshm_control(void *mqtshm_handle, u32 cmd, int messageq_transportshm_control(void *mqtshm_handle, u32 cmd,
u32 *cmd_arg); u32 *cmd_arg);
/* Get current status of the MessageQTransportShm */ /* Get current status of the MessageQTransportShm */
......
...@@ -178,8 +178,8 @@ static inline int listmp_sharedmemory_ioctl_create( ...@@ -178,8 +178,8 @@ static inline int listmp_sharedmemory_ioctl_create(
if (unlikely(params.shared_addr == NULL)) if (unlikely(params.shared_addr == NULL))
goto free_name; goto free_name;
/* Update lock_handle in params. */ /* Update gate in params. */
params.lock_handle = cargs->args.create.knl_lock_handle; params.gate = cargs->args.create.knl_gate;
cargs->args.create.listmp_handle = listmp_sharedmemory_create(&params); cargs->args.create.listmp_handle = listmp_sharedmemory_create(&params);
size = copy_to_user(cargs->args.create.params, &params, size = copy_to_user(cargs->args.create.params, &params,
...@@ -256,8 +256,8 @@ static inline int listmp_sharedmemory_ioctl_open( ...@@ -256,8 +256,8 @@ static inline int listmp_sharedmemory_ioctl_open(
if (unlikely(params.shared_addr == NULL)) if (unlikely(params.shared_addr == NULL))
goto free_name; goto free_name;
/* Update lock_handle in params. */ /* Update gate in params. */
params.lock_handle = cargs->args.open.knl_lock_handle; params.gate = cargs->args.open.knl_gate;
status = listmp_sharedmemory_open(&listmp_handle, &params); status = listmp_sharedmemory_open(&listmp_handle, &params);
if (status) if (status)
goto free_name; goto free_name;
......
...@@ -124,7 +124,7 @@ struct messageq_transportshm_object { ...@@ -124,7 +124,7 @@ struct messageq_transportshm_object {
*/ */
static struct messageq_transportshm_moduleobject messageq_transportshm_state = { static struct messageq_transportshm_moduleobject messageq_transportshm_state = {
.gate_handle = NULL, .gate_handle = NULL,
.def_cfg.reserved = 0, .def_cfg.err_fxn = 0,
.def_inst_params.gate = NULL, .def_inst_params.gate = NULL,
.def_inst_params.shared_addr = 0x0, .def_inst_params.shared_addr = 0x0,
.def_inst_params.shared_addr_size = 0x0, .def_inst_params.shared_addr_size = 0x0,
...@@ -206,7 +206,7 @@ exit: ...@@ -206,7 +206,7 @@ exit:
* messageq_transportshm_setup with NULL parameters. The default * messageq_transportshm_setup with NULL parameters. The default
* parameters would get automatically used. * parameters would get automatically used.
*/ */
int messageq_transportshm_setup(struct messageq_transportshm_config *cfg) int messageq_transportshm_setup(const struct messageq_transportshm_config *cfg)
{ {
int status = MESSAGEQ_TRANSPORTSHM_SUCCESS; int status = MESSAGEQ_TRANSPORTSHM_SUCCESS;
struct messageq_transportshm_config tmpCfg; struct messageq_transportshm_config tmpCfg;
...@@ -445,7 +445,7 @@ void *messageq_transportshm_create(u16 proc_id, ...@@ -445,7 +445,7 @@ void *messageq_transportshm_create(u16 proc_id,
(2 * MESSAGEQ_TRANSPORTSHM_CACHESIZE)); (2 * MESSAGEQ_TRANSPORTSHM_CACHESIZE));
listmp_params[0].shared_addr_size = \ listmp_params[0].shared_addr_size = \
listmp_sharedmemory_shared_memreq(&(listmp_params[0])); listmp_sharedmemory_shared_memreq(&(listmp_params[0]));
listmp_params[0].lock_handle = params->gate; listmp_params[0].gate = params->gate;
listmp_params[0].name = NULL; listmp_params[0].name = NULL;
listmp_params[0].list_type = listmp_type_SHARED; listmp_params[0].list_type = listmp_type_SHARED;
...@@ -457,7 +457,7 @@ void *messageq_transportshm_create(u16 proc_id, ...@@ -457,7 +457,7 @@ void *messageq_transportshm_create(u16 proc_id,
listmp_sharedmemory_shared_memreq(&(listmp_params[1])); listmp_sharedmemory_shared_memreq(&(listmp_params[1]));
listmp_params[1].name = NULL; listmp_params[1].name = NULL;
listmp_params[1].list_type = listmp_type_SHARED; listmp_params[1].list_type = listmp_type_SHARED;
listmp_params[1].lock_handle = params->gate; listmp_params[1].gate = params->gate;
handle->my_listmp_handle = listmp_sharedmemory_create handle->my_listmp_handle = listmp_sharedmemory_create
(&(listmp_params[my_index])); (&(listmp_params[my_index]));
...@@ -680,7 +680,7 @@ exit: ...@@ -680,7 +680,7 @@ exit:
* Purpose: * Purpose:
* Control Function * Control Function
*/ */
bool messageq_transportshm_control(void *mqtshm_handle, u32 cmd, u32 *cmdArg) int messageq_transportshm_control(void *mqtshm_handle, u32 cmd, u32 *cmdArg)
{ {
gt_3trace(mqtshm_debugmask, GT_ENTER, "messageq_transportshm_control", gt_3trace(mqtshm_debugmask, GT_ENTER, "messageq_transportshm_control",
mqtshm_handle, cmd, cmdArg); mqtshm_handle, cmd, cmdArg);
...@@ -688,8 +688,8 @@ bool messageq_transportshm_control(void *mqtshm_handle, u32 cmd, u32 *cmdArg) ...@@ -688,8 +688,8 @@ bool messageq_transportshm_control(void *mqtshm_handle, u32 cmd, u32 *cmdArg)
BUG_ON(mqtshm_handle == NULL); BUG_ON(mqtshm_handle == NULL);
gt_1trace(mqtshm_debugmask, GT_LEAVE, "messageq_transportshm_control", gt_1trace(mqtshm_debugmask, GT_LEAVE, "messageq_transportshm_control",
false); MESSAGEQTRANSPORTSHM_E_NOTSUPPORTED);
return false; return MESSAGEQTRANSPORTSHM_E_NOTSUPPORTED;
} }
/* /*
...@@ -784,3 +784,31 @@ exit: ...@@ -784,3 +784,31 @@ exit:
gt_0trace(mqtshm_debugmask, GT_LEAVE, gt_0trace(mqtshm_debugmask, GT_LEAVE,
"messageq_transportshm_notifyFxn"); "messageq_transportshm_notifyFxn");
} }
/*
* ======== messageq_transportshm_delete ========
* Purpose:
* This will set the asynchronous error function for the transport module
*/
void messageq_transportshm_set_err_fxn(
void (*err_fxn)(
enum MessageQTransportShm_Reason reason,
void *handle,
void *msg,
u32 info))
{
u32 key;
key = mutex_lock_interruptible(messageq_transportshm_state.gate_handle);
if (key < 0)
goto exit;
messageq_transportshm_state.cfg.err_fxn = err_fxn;
mutex_unlock(messageq_transportshm_state.gate_handle);
exit:
return;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment