summaryrefslogtreecommitdiff
path: root/cesar/host
diff options
context:
space:
mode:
authorschodet2009-04-03 15:41:24 +0000
committerschodet2009-04-03 15:41:24 +0000
commit08a311df20163177f4af6e79d6f3e94a3ff7566a (patch)
treedb50fe7a2aaf2de55b6b5815111f9a938f0f67a5 /cesar/host
parent71e06d736f65a67f6a75105b31a422727f377ce2 (diff)
* hal/phy/test/phy, mac/pbproc/test/int, host/fcall:
- added fcall param helpers. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@4390 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/host')
-rw-r--r--cesar/host/fcall/fcall.h182
1 files changed, 181 insertions, 1 deletions
diff --git a/cesar/host/fcall/fcall.h b/cesar/host/fcall/fcall.h
index 0bccac0647..e6592e1767 100644
--- a/cesar/host/fcall/fcall.h
+++ b/cesar/host/fcall/fcall.h
@@ -295,6 +295,102 @@ static inline int fcall_param_bind_short(
}
/**
+ * Helper macro to bind a variable.
+ * \param param param context
+ * \param msg sci message
+ * \param id parameter identifier
+ * \param var variable to bind
+ * \return true if successful (parameter exists and has the right size)
+ */
+#define fcall_param_bind_helper_(param, msg, id, var) \
+ (fcall_is_param ((param), (msg), (id)) \
+ && (fcall_param_bind ((param), (msg), (id), sizeof (var), &(var)) \
+ == sizeof (var)))
+
+/**
+ * Helper macro to bind a variable.
+ * \param id parameter identifier
+ * \param var variable to bind
+ * \return true if successful (parameter exists and has the right size)
+ *
+ * Variables param and msg must be defined.
+ */
+#define fcall_param_bind_helper(id, var) \
+ fcall_param_bind_helper_ (*param, *msg, (id), (var))
+
+/**
+ * Helper macro to bind a long long integer.
+ * \param param param context
+ * \param msg sci message
+ * \param id parameter identifier
+ * \param var variable to bind
+ * \return true if successful (parameter exists and has the right size)
+ */
+#define fcall_param_bind_ll_helper_(param, msg, id, var) \
+ (fcall_is_param ((param), (msg), (id)) \
+ && (fcall_param_bind_ll ((param), (msg), (id), &(var)) \
+ == sizeof (var)))
+
+/**
+ * Helper macro to bind a long long integer.
+ * \param id parameter identifier
+ * \param var variable to bind
+ * \return true if successful (parameter exists and has the right size)
+ *
+ * Variables param and msg must be defined.
+ */
+#define fcall_param_bind_ll_helper(id, var) \
+ fcall_param_bind_ll_helper_ (*param, *msg, (id), (var))
+
+/**
+ * Helper macro to bind a long integer.
+ * \param param param context
+ * \param msg sci message
+ * \param id parameter identifier
+ * \param var variable to bind
+ * \return true if successful (parameter exists and has the right size)
+ */
+#define fcall_param_bind_long_helper_(param, msg, id, var) \
+ (fcall_is_param ((param), (msg), (id)) \
+ && (fcall_param_bind_long ((param), (msg), (id), &(var)) \
+ == sizeof (var)))
+
+/**
+ * Helper macro to bind a long integer.
+ * \param id parameter identifier
+ * \param var variable to bind
+ * \return true if successful (parameter exists and has the right size)
+ *
+ * Variables param and msg must be defined.
+ */
+#define fcall_param_bind_long_helper(id, var) \
+ fcall_param_bind_long_helper_ (*param, *msg, (id), (var))
+
+/**
+ * Helper macro to bind a short integer.
+ * \param param param context
+ * \param msg sci message
+ * \param id parameter identifier
+ * \param var variable to bind
+ * \return true if successful (parameter exists and has the right size)
+ */
+#define fcall_param_bind_short_helper_(param, msg, id, var) \
+ (fcall_is_param ((param), (msg), (id)) \
+ && (fcall_param_bind_short ((param), (msg), (id), &(var)) \
+ == sizeof (var)))
+
+/**
+ * Helper macro to bind a short integer.
+ * \param id parameter identifier
+ * \param var variable to bind
+ * \return true if successful (parameter exists and has the right size)
+ *
+ * Variables param and msg must be defined.
+ */
+#define fcall_param_bind_short_helper(id, var) \
+ fcall_param_bind_short_helper_ (*param, *msg, (id), (var))
+
+/**
* add a new parameter element into the parameter context
* \param param pointer to param context where to add new parameter
* \param msg pointer to sci message to add the paramter
@@ -369,7 +465,91 @@ static inline int fcall_param_add_short(fcall_param_t *param, sci_msg_t *msg, ch
tmp = htons(*((short *)data));
return fcall_param_add(param, msg, id, sizeof(short), &tmp);
}
-
+
+/**
+ * Helper macro to add a variable.
+ * \param param param context
+ * \param msg sci message
+ * \param id parameter identifier
+ * \param var variable to add
+ */
+#define fcall_param_add_helper_(param, msg, id, var) \
+ dbg_check (fcall_param_add ((param), (msg), (id), sizeof (var), \
+ &(var)) != -1)
+
+/**
+ * Helper macro to add a variable.
+ * \param id parameter identifier
+ * \param var variable to bind
+ *
+ * Variables param and msg must be defined.
+ */
+#define fcall_param_add_helper(id, var) \
+ fcall_param_add_helper_ (&param, &msg, (id), (var))
+
+/**
+ * Helper macro to add a long long integer.
+ * \param param param context
+ * \param msg sci message
+ * \param id parameter identifier
+ * \param var variable to add
+ */
+#define fcall_param_add_ll_helper_(param, msg, id, var) \
+ dbg_check (fcall_param_add_ll ((param), (msg), (id), \
+ &(var)) != -1)
+
+/**
+ * Helper macro to add a long long integer.
+ * \param id parameter identifier
+ * \param var variable to bind
+ *
+ * Variables param and msg must be defined.
+ */
+#define fcall_param_add_ll_helper(id, var) \
+ fcall_param_add_ll_helper_ (&param, &msg, (id), (var))
+
+/**
+ * Helper macro to add a long integer.
+ * \param param param context
+ * \param msg sci message
+ * \param id parameter identifier
+ * \param var variable to add
+ */
+#define fcall_param_add_long_helper_(param, msg, id, var) \
+ dbg_check (fcall_param_add_long ((param), (msg), (id), \
+ &(var)) != -1)
+
+/**
+ * Helper macro to add a long integer.
+ * \param id parameter identifier
+ * \param var variable to bind
+ *
+ * Variables param and msg must be defined.
+ */
+#define fcall_param_add_long_helper(id, var) \
+ fcall_param_add_long_helper_ (&param, &msg, (id), (var))
+
+/**
+ * Helper macro to add a short integer.
+ * \param param param context
+ * \param msg sci message
+ * \param id parameter identifier
+ * \param var variable to add
+ */
+#define fcall_param_add_short_helper_(param, msg, id, var) \
+ dbg_check (fcall_param_add_short ((param), (msg), (id), \
+ &(var)) != -1)
+
+/**
+ * Helper macro to add a short integer.
+ * \param id parameter identifier
+ * \param var variable to bind
+ *
+ * Variables param and msg must be defined.
+ */
+#define fcall_param_add_short_helper(id, var) \
+ fcall_param_add_short_helper_ (&param, &msg, (id), (var))
+
/**
* create a new fcall context.
* \param station current station context