summaryrefslogtreecommitdiff
path: root/cesar/ce/inc/tx.h
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/ce/inc/tx.h')
-rwxr-xr-xcesar/ce/inc/tx.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/cesar/ce/inc/tx.h b/cesar/ce/inc/tx.h
new file mode 100755
index 0000000000..240ce9c083
--- /dev/null
+++ b/cesar/ce/inc/tx.h
@@ -0,0 +1,108 @@
+#ifndef ce_inc_tx_h
+#define ce_inc_tx_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file tx.h
+ * \brief Sub - Function of Control Plane task that update the set of
+ * tonemaps versus several cei message received.
+ * \ingroup cp
+ *
+ */
+
+#include "mac/common/store.h"
+#include "mac/common/config.h"
+#include "cyg/kernel/kapi.h"
+#include "cp/interf/interf.h"
+
+
+/** Global structure for txce context */
+struct txce_t
+{
+ /** Access to sta and set of tonemaps (TODO ??and mac address) from
+ * rx_params-tei.*/
+ mac_store_t *mac_store_ctx;
+ /** Pointer to global tonemask */
+ u8 *tonemask;
+ /** interf context allowing to add event in CP. */
+ interf_t *interf_ctx;
+ /** Handle to alarm. */
+ cyg_handle_t alarm_hdl;
+ /** Pointer to the alarm object. */
+ cyg_alarm alarm_obj;
+
+};
+typedef struct txce_t txce_t;
+
+BEGIN_DECLS
+
+/**
+ * Expire all tonemaps with an expiration date greater than the current date.
+ * And detect the next expiration date.
+ * \param ctx txce context.
+ * \return the next expiration date.
+ *
+ * Dates are expressed in rtc, real-time clock is ecos context, i.e. the tick
+ * ecos. (certainly 10ms).
+ * Algorithm runs stupidly all tonemaps. An optimized algorithm with a
+ * management of a tree could be envisaged.
+ */
+cyg_tick_count_t
+txce_expiration_tonemaps_management (txce_t *ctx);
+
+/**
+ * Initialize the global structure of txce context.
+ * \param mac_store_ctx Access to the sta.
+ * \param mac_config_ctx Access to the tonemask.
+ * \return the txce context.
+ *
+ */
+txce_t *
+txce_init (mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx, interf_t *interf);
+
+/**
+ * Control Plane function called when a mme arrives and correspond to a cei
+ * mmtype or when CP manages a TXCE_EVENT.
+ * \param ctx txce context.
+ * \param stei Source station of message received.
+ * \param mmtype Message type CM_TM_UPDATE.IND or CM_CHAN_EST.IND
+ * \param mm_entry Pointer to the start of mm_entry or NULL if launched from a TXCE_EVENT.
+ *
+ * At first, the function computes the cei message (if there is) and update
+ * the set of tonemap concerned and its new expiration date.
+ * Then, function runs the txce_expiration_tonemaps and reprogram the next
+ * alarm date. If alarm occurs, this function will be called without message.
+ * So the function runs the txce_expiration_tonemaps and reprogram the next
+ * alarm date...
+ *
+ * Keep careful : The PBproc can read-access to the set of tonemap while this
+ * function is updating it.
+ * Notices :
+ * - A tonemap is always added, never replaces another.
+ * - Intervals can be modified. Intervals description
+ * is duplicate, and a pointer points to the currents intervals. Change it
+ * atomically.
+ * - Releasing tonemap : Counter reference should protect the situation.
+ */
+void
+txce (txce_t *ctx, uint stei, u32 mmtype, u8 *mm_entry);
+
+/**
+ * function called when alarm occurs.
+ * \param alarm_hdl handle to the alarm.
+ * \param data allows to pass the txce context.
+ *
+ * This function add an TXCE_EVENT in CP in order that CP recall txce_rcv_mme
+ * function with an mm_entry NULL.
+ */
+void
+alarm_cb (cyg_handle_t alarm_hdl, cyg_addrword_t data);
+
+END_DECLS
+
+#endif /* ce_inc_tx_h */