summaryrefslogtreecommitdiff
path: root/cesar/interface/inc
diff options
context:
space:
mode:
authorlaranjeiro2008-04-14 14:46:57 +0000
committerlaranjeiro2008-04-14 14:46:57 +0000
commit600a0c5e7b5e21c78b61d623d62ca4be068de1f5 (patch)
tree2f64c77cb55504e3ea37270eec8784b1633e8da0 /cesar/interface/inc
parent37ce0b77cf6af8f4d2969a99af96eb319f5d905b (diff)
Interface :
* Updated the interface to received the MME to configure the interface module or submodules instead of giving it to the CP. * Added a thread to use the interface and a mailbox to synchronize the thread, it will be blocked on the mailbox read. * Tested. * Documentation updated. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1822 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/interface/inc')
-rw-r--r--cesar/interface/inc/context.h16
-rw-r--r--cesar/interface/inc/interface.h24
-rw-r--r--cesar/interface/inc/mme_process.h63
3 files changed, 103 insertions, 0 deletions
diff --git a/cesar/interface/inc/context.h b/cesar/interface/inc/context.h
index 27d1eab5b0..5bc1da86ae 100644
--- a/cesar/interface/inc/context.h
+++ b/cesar/interface/inc/context.h
@@ -22,6 +22,10 @@
/** module includes. */
#include "interface/sniffer/sniffer.h"
+
+#define INTERFACE_THREAD_STACK CYGNUM_HAL_STACK_SIZE_TYPICAL
+#define INTERFACE_THREAD_PRIORITY 9
+
struct interface_t
{
/** cl context. */
@@ -52,6 +56,18 @@ struct interface_t
circular_buffer_t buffers;
cyg_mutex_t buffer_mutex;
+
+ /** Thread. */
+ cyg_thread thread;
+ /** Thread handle. */
+ cyg_handle_t thread_handle;
+ /** Thread stack. */
+ u8 thread_stack [INTERFACE_THREAD_STACK];
+
+ /** Mailbox. */
+ cyg_mbox mailbox;
+ /** Mailbox handle. */
+ cyg_handle_t mbox_handle;
};
#endif /* interface_inc_context_h */
diff --git a/cesar/interface/inc/interface.h b/cesar/interface/inc/interface.h
index aec0877ff4..c13126b479 100644
--- a/cesar/interface/inc/interface.h
+++ b/cesar/interface/inc/interface.h
@@ -15,6 +15,9 @@
*/
#include "interface/interface.h"
+#include "interface/defs-mmtype.h"
+
+#include "lib/read_word.h"
/**
* The buffer shall be provided to the CP.
@@ -32,6 +35,17 @@ interface_buffer_add (interface_t *ctx, u8 *buffer);
void
interface_buffer_work_add (interface_t *ctx, u8 *buffer);
+/**
+ * Receive a data from the HLE.
+ * \param ctx the interface context.
+ * \param buffer the Message received.
+ *
+ * This will be use by the Fcall module in the interface. It can be use by
+ * anything in the future.
+ */
+void
+interface_hle_recv (interface_t *ctx, u8 *buffer);
+
/**
* Get a buffer from the list.
* \param ctx the interface context.
@@ -40,4 +54,14 @@ interface_buffer_work_add (interface_t *ctx, u8 *buffer);
u8*
interface_buffer_work_get (interface_t *ctx);
+/**
+ * Interface process, function used by the interface thread to process
+ * received MMEs.
+ *
+ * \param data the address of the interface context.
+ */
+void
+interface_process (cyg_addrword_t data);
+
+
#endif /* interface_inc_interface_h */
diff --git a/cesar/interface/inc/mme_process.h b/cesar/interface/inc/mme_process.h
new file mode 100644
index 0000000000..2e208d8683
--- /dev/null
+++ b/cesar/interface/inc/mme_process.h
@@ -0,0 +1,63 @@
+#ifndef interface_inc_mme_process_h
+#define interface_inc_mme_process_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file interface/inc/mme_process.h
+ * \brief Function to read or get the informations.
+ * \ingroup interface
+ *
+ */
+
+/**
+ * Interface read the MMtype of the MME.
+ *
+ * \param buffer the buffer to get the MMtype.
+ * \return the MME type.
+ */
+extern inline uint
+interface_mmtype_get (u8 *buffer)
+{
+ dbg_assert (buffer);
+ return read_u16_from_word (buffer + 0xF);
+}
+
+/**
+ * Get the sub module information.
+ * \param buffer the buffer containing the MME.
+ * \return the submodule id in the interface.
+ *
+ * - 0 for interface module.
+ * - 1 for sniffer module.
+ * - 2 for fcall module.
+ */
+extern inline uint
+interface_moduleid_get (u8 *buffer)
+{
+ dbg_assert (buffer);
+ return read_u8_from_word (buffer + 0x13);
+}
+
+/**
+ * Send the configuration part to the Sniffer sub module and create the
+ * response of the configuration.
+ * \param ctx the interface context.
+ * \param buffer the MME buffer containing the data and use to response.
+ *
+ * Provide the configuration byte to the sniffer sub module and reuse the
+ * buffer to create the confirm MME by replace the MMType and the payload by
+ * the ACK value.
+ * For that this will call the interface_sniffer_status which returns the
+ * corresponding value of the sniffer configuration as the same format as the
+ * one present in the MME. If the two data are equals then the ACK is
+ * positive, in the other case it will be equal to 0.
+ */
+void
+interface_sniffer_configure_and_respond (interface_t *ctx, u8 *buffer);
+
+#endif /* interface_inc_mme_process_h */