summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlacour2009-04-14 15:30:01 +0000
committerlacour2009-04-14 15:30:01 +0000
commit160853e355b949b64baa66e55c9414cdd911e090 (patch)
treee1eaa029cc2a0ec0297b1021c14197e4c2db8a3b
parentfb0dacd59fb5df928f39f81f6465af3363201810 (diff)
[CE] Integration au CP.
- ce_init becomes rxce_init. - Split rx.h in ce/rx.h and ce/inc/rx.h (and tx) - Use bitstream to create/read CEI MME. - Integration of txce in CP and its fsm. - Fill other tonemap field (ble, bitperpb...). - Add Maximus test : Description : CCO/STA association. Data exchange. Bitloading. (initial step) CEI exchange. Tonemap used. TODO : Provide chandata_dma header table as interface with pbproc. Wait for development of chandata loading by pbproc. Check computation, exchange, and use of tonemap in the test. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@4456 017c9cb6-072f-447c-8318-d5b54f68fe89
-rwxr-xr-xcesar/ce/inc/cei.h109
-rwxr-xr-xcesar/ce/inc/rx.h14
-rwxr-xr-xcesar/ce/inc/tx.h42
-rw-r--r--cesar/ce/rx.h36
-rwxr-xr-xcesar/ce/src/mpdu_measure_store.c1
-rwxr-xr-xcesar/ce/src/rx.c69
-rwxr-xr-xcesar/ce/src/tx.c50
-rwxr-xr-xcesar/ce/test/common/src/print_utils.c20
-rw-r--r--cesar/ce/test/common/tonemap_utils.h5
-rw-r--r--cesar/ce/test/maximus/test1/Config1
-rw-r--r--cesar/ce/test/maximus/test1/Makefile30
-rw-r--r--cesar/ce/test/maximus/test1/common/Module1
-rw-r--r--cesar/ce/test/maximus/test1/common/src/bw_stub.c237
-rw-r--r--cesar/ce/test/maximus/test1/common/src/ntb_stub.c22
-rw-r--r--cesar/ce/test/maximus/test1/common/src/pbproc_scf_stub.c22
-rw-r--r--cesar/ce/test/maximus/test1/common/src/region_stub.c107
-rw-r--r--cesar/ce/test/maximus/test1/common/src/station.c113
-rw-r--r--cesar/ce/test/maximus/test1/ecos.ecc.sh5
-rw-r--r--cesar/ce/test/maximus/test1/py/test_integr_ce.py52
-rw-r--r--cesar/ce/test/rx/general/overide/cp/inc/context.h11
-rw-r--r--cesar/ce/test/rx/general/overide/cp/sta/mgr/src/sta_mgr.c11
-rwxr-xr-xcesar/ce/test/rx/general/src/test_cei.c22
-rwxr-xr-xcesar/ce/test/rx/general/src/test_sar_integration.c3
-rwxr-xr-xcesar/ce/test/tx/host-Makefile2
-rw-r--r--cesar/ce/test/tx/overide/cp/fsm/src/fsm.c8
-rw-r--r--cesar/ce/test/tx/overide/cp/inc/context.h3
-rw-r--r--cesar/ce/test/tx/src/test_expiration.c5
-rwxr-xr-xcesar/ce/test/tx/src/test_tx.c13
-rw-r--r--cesar/ce/tx.h67
-rw-r--r--cesar/cp/fsm/src/fsm/cp.fsm2
-rw-r--r--cesar/cp/inc/context.h4
-rw-r--r--cesar/cp/msg/src/msg.c6
-rw-r--r--cesar/cp/src/cp.c3
-rw-r--r--cesar/cp/sta/action/info.h13
-rw-r--r--cesar/cp/sta/action/src/info.c6
-rw-r--r--cesar/hal/phy/maximus/src/maximus_phy_ctrl.c2
-rw-r--r--cesar/hal/phy/pbdma.h2
-rw-r--r--cesar/mac/common/src/tonemap.c2
-rw-r--r--cesar/mac/common/tonemap.h3
-rw-r--r--cesar/station/src/station.c4
-rw-r--r--cesar/test_general/station/common/Module2
-rw-r--r--cesar/test_general/station/common/override/ce/inc/tx.h28
-rw-r--r--cesar/test_general/station/common/override/ce/tx.h30
-rw-r--r--cesar/test_general/station/common/src/ce_stub.c4
-rw-r--r--cesar/test_general/station/common/src/txce_stub.c30
45 files changed, 1039 insertions, 183 deletions
diff --git a/cesar/ce/inc/cei.h b/cesar/ce/inc/cei.h
index 5f701c21c9..8f2cd5c931 100755
--- a/cesar/ce/inc/cei.h
+++ b/cesar/ce/inc/cei.h
@@ -25,6 +25,8 @@
//TODO Accelerate access in tonemap and tonemask management.
+static u8 BITS_PER_MOD[8] = {0,1,2,3,4,6,8,10};
+
struct cei_created_status_t
{
/** Length of mm_entry. */
@@ -56,15 +58,17 @@ STREAM_WRITE (bitstream_t *ptr, uint val, uint length)
*
*/
static uint
-cei_tmdata_encode (bitstream_t *ctx_stream, blk_t *tm, u32 *mask)
+cei_tmdata_encode (bitstream_t *ctx_stream, tonemap_t *tm, u32 *mask)
{
uint nibbles[1155];
int c=0;
uint i, nibble, next_nibble;
int consecutive_nb = 0;
int entry_nb = 0;
- u32 *tm_data = (u32 *) tm->data;
+ u32 *tm_data = (u32 *) tm->tmdma_desc_head->data;
uint carrier_nb = tonemask_carrier_nb (mask);
+ uint bps = 0;
+ // TODO (128 + 17)*8 = 1155 + epsilon . Be less dependant of 1155.
for (i=0; i<128; i++)
{
uint eight_nibble = *(tm_data++);
@@ -74,13 +78,15 @@ cei_tmdata_encode (bitstream_t *ctx_stream, blk_t *tm, u32 *mask)
{
if ( (local_mask & 0x01) == 0x00 )
{
- nibbles[c++] = eight_nibble & 0x0F;
+ nibbles[c] = eight_nibble & 0x0F;
+ bps+=BITS_PER_MOD[nibbles[c]];
+ c++;
}
eight_nibble = eight_nibble >> 4;
local_mask = local_mask >> 1;
}
}
- tm_data = (u32 *) tm->next->data;
+ tm_data = (u32 *) tm->tmdma_desc_head->next->data;
for (i=0; i<17; i++)
{
uint k = i + 128;
@@ -91,7 +97,9 @@ cei_tmdata_encode (bitstream_t *ctx_stream, blk_t *tm, u32 *mask)
{
if ( (local_mask & 0x01) == 0x00 )
{
- nibbles[c++] = eight_nibble & 0x0F;
+ nibbles[c] = eight_nibble & 0x0F;
+ bps+=BITS_PER_MOD[nibbles[c]];
+ c++;
}
eight_nibble = eight_nibble >> 4;
local_mask = local_mask >> 1;
@@ -137,6 +145,10 @@ cei_tmdata_encode (bitstream_t *ctx_stream, blk_t *tm, u32 *mask)
nibble = next_nibble;
}
bitstream_finalise (ctx_stream);
+ tm->bits_per_symbol = bps;
+ tm->bits_per_pb[PHY_PB_SIZE_136] = tonemap_bits_per_pb (PHY_MOD_TM, tm->fecrate, PHY_PB_SIZE_136, bps);
+ tm->bits_per_pb[PHY_PB_SIZE_520] = tonemap_bits_per_pb (PHY_MOD_TM, tm->fecrate, PHY_PB_SIZE_520, bps);
+ tm->ble = tonemap_ble (bps, tm->fecrate, 0, tm->gil);
return (entry_nb);
}
@@ -181,9 +193,9 @@ cei_create (u8 *mme_buffer, bitstream_t *mme_stream_writer, u32 *mask, tonemaps_
STREAM_WRITE(mme_stream_writer, (u8)rx_tonemaps->scl_cp, 8);
STREAM_WRITE(mme_stream_writer, (u8)rx_tonemaps->scl_cfp, 8);
STREAM_WRITE(mme_stream_writer, valid_tm_list_lg, 8);
- for (i=0; i<TONEMAP_INDEX_NB; i++) if (rx_tonemaps->tm[i])
+ for (i=NEGOCIATED_TONEMAP_INDEX_FIRST; i<TONEMAP_INDEX_NB; i++) if (rx_tonemaps->tm[i])
{
- STREAM_WRITE(mme_stream_writer, i+4, 8);
+ STREAM_WRITE(mme_stream_writer, i, 8);
}
tonemap_intervals_t *intervals = rx_tonemaps->intervals;
@@ -193,18 +205,18 @@ cei_create (u8 *mme_buffer, bitstream_t *mme_stream_writer, u32 *mask, tonemaps_
STREAM_WRITE(mme_stream_writer, intervals->interval[i].end_offset_atu, 16);
STREAM_WRITE(mme_stream_writer, intervals->interval[i].tmi, 8);
}
- if(new_tmi != TONEMAP_INDEX_NULL)
+ if(IS_NEGOCIATED_TONEMAP_INDEX(new_tmi ))
{
new_tm=rx_tonemaps->tm[new_tmi];
dbg_assert_ptr (new_tm);
- STREAM_WRITE(mme_stream_writer, new_tmi+4, 8);
+ STREAM_WRITE(mme_stream_writer, new_tmi, 8);
STREAM_WRITE(mme_stream_writer, new_tm->cpf, 8);
STREAM_WRITE(mme_stream_writer, new_tm->fecrate, 8);
STREAM_WRITE(mme_stream_writer, new_tm->gil, 8);
STREAM_WRITE(mme_stream_writer, 0x01, 8);
u32 entry_nb_offset = bitstream_written_bits (mme_stream_writer);
STREAM_WRITE(mme_stream_writer, 0xDEAD, 16);
- entry_nb = cei_tmdata_encode (mme_stream_writer, new_tm->tmdma_desc_head, mask);
+ entry_nb = cei_tmdata_encode (mme_stream_writer, new_tm, mask);
bitstream_direct_write (mme_buffer, entry_nb_offset, entry_nb, 16);
}
mme_len = (bitstream_finalise (mme_stream_writer) + 7) / 8;
@@ -238,11 +250,12 @@ cei_tone_write (bitstream_t *stream_writer, uint tone, uint *write_nb, u8 *next_
* \return the valid tonemap. [A32...A0] bits set if valid.
*/
static u32 // valid_tonemap u32 as 32 tonemap max.
-cei_decode (tonemaps_t *tx_tonemaps_to_update, int mm_type, u8 *mm_entry, u32 *mask)
+cei_decode (tonemaps_t *tx_tonemaps_to_update, int mm_type, bitstream_t *stream_reader, u32 *mask)
{
//TODO switch MMTYPE
int i,j;
int new_tmi;
+ uint bps = 0;
int valid_nb; // nb tonemap valid announced by mme
u32 tonemaps_valid_status; //return value : tonemap_valid_status that must be kept for release_old_tonemap done under lock_it
u32 sort; // local tonemap_valid_status that must be kept for release_old_tonemap done under lock_it
@@ -251,38 +264,38 @@ cei_decode (tonemaps_t *tx_tonemaps_to_update, int mm_type, u8 *mm_entry, u32 *m
int mod; //modulation
int codage;
int tmp_default_tmi;
- bitstream_t stream_reader;
bitstream_t stream_writer;
uint read;
uint write_nb = 0;
- bitstream_init (&stream_reader, mm_entry, 1518, BITSTREAM_READ);
- bitstream_access (&stream_reader, &read, 16);
+
+ bitstream_access (stream_reader, &read, 16);
tx_tonemaps_to_update->max_fl_av = read;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tx_tonemaps_to_update->rifs_av_one_sym_tck = read*MAC_TCK_PER_FL;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tx_tonemaps_to_update->rifs_av_two_sym_tck = read*MAC_TCK_PER_FL;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tx_tonemaps_to_update->rifs_av_g2_sym_tck = read*MAC_TCK_PER_FL;
- bitstream_access (&stream_reader, &read, 8);
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tx_tonemaps_to_update->max_tm = read;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tmp_default_tmi = read;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tx_tonemaps_to_update->scl_cp = read;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tx_tonemaps_to_update->scl_cfp = read;
- bitstream_access (&stream_reader, &valid_nb, 8);
+ bitstream_access (stream_reader, &valid_nb, 8);
tonemaps_valid_status = 0;
for (i=0; i<valid_nb; i++)
{
- bitstream_access (&stream_reader, &read, 8);
- tonemaps_valid_status = tonemaps_valid_status | ( 1 << (read - 4) );
+ bitstream_access (stream_reader, &read, 8);
+ tonemaps_valid_status = tonemaps_valid_status | ( 1 << read );
}
sort = tonemaps_valid_status;
- for (i=0; i<TONEMAP_INDEX_NB; i++)
+ sort = sort >> NEGOCIATED_TONEMAP_INDEX_FIRST;
+ for (i=NEGOCIATED_TONEMAP_INDEX_FIRST; i<TONEMAP_INDEX_NB; i++)
{
if ( ((sort & 0x01) == 0x01) && (!tx_tonemaps_to_update->tm[i]) )
{
@@ -294,45 +307,40 @@ cei_decode (tonemaps_t *tx_tonemaps_to_update, int mm_type, u8 *mm_entry, u32 *m
tonemap_intervals_t *intervals = tx_tonemaps_to_update->intervals;
if (intervals != tx_tonemaps_to_update->swap_intervals) intervals++;
//intervals->intervals_nb = READ_U8;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
intervals->intervals_nb = read;
for (i=0; i<(int)intervals->intervals_nb; i++)
{
- //intervals->interval[i].end_offset_atu = (READ_U8 <<8);
- //intervals->interval[i].end_offset_atu += READ_U8;
- bitstream_access (&stream_reader, &read, 16);
+ bitstream_access (stream_reader, &read, 16);
intervals->interval[i].end_offset_atu = read;
- //intervals->interval[i].tmi = READ_U8;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
intervals->interval[i].tmi = read;
}
- bitstream_access (&stream_reader, &new_tmi, 8);
- if(new_tmi>=4)
+ bitstream_access (stream_reader, &new_tmi, 8);
+ if(IS_NEGOCIATED_TONEMAP_INDEX(new_tmi))
{
- new_tmi-=4;
dbg_assert (tx_tonemaps_to_update->tm[new_tmi]);
dbg_assert (tx_tonemaps_to_update->tm[new_tmi]->tmdma_desc_head);
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tx_tonemaps_to_update->tm[new_tmi]->cpf = read;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tx_tonemaps_to_update->tm[new_tmi]->fecrate = read;
- bitstream_access (&stream_reader, &read, 8);
+ bitstream_access (stream_reader, &read, 8);
tx_tonemaps_to_update->tm[new_tmi]->gil = read;
- bitstream_access (&stream_reader, &codage, 8);
+ bitstream_access (stream_reader, &codage, 8);
if (codage == 1 || codage == 0) // ABSOLUTE CODE(SAME DECODE IF COMPRESSED OR NOT)
{
- bitstream_access (&stream_reader, &entry_nb, 16);
+ bitstream_access (stream_reader, &entry_nb, 16);
bitstream_init (&stream_writer, tx_tonemaps_to_update->tm[new_tmi]->tmdma_desc_head->data, BLK_SIZE, BITSTREAM_WRITE);
u8 *next_data = tx_tonemaps_to_update->tm[new_tmi]->tmdma_desc_head->next->data;
- bitstream_access (&stream_reader, &mod, 4);
-
+ bitstream_access (stream_reader, &mod, 4);
int c=0;
for (i=0; i<entry_nb; i++)
{
- bitstream_access (&stream_reader, &next_nibble, 4);
+ bitstream_access (stream_reader, &next_nibble, 4);
if (next_nibble < 8 )
{
while ( ((mask[c/32] & (1<<(c%32)))) == (u32)(1<<(c%32)))
@@ -341,12 +349,13 @@ cei_decode (tonemaps_t *tx_tonemaps_to_update, int mm_type, u8 *mm_entry, u32 *m
c++;
}
cei_tone_write (&stream_writer, mod, &write_nb, next_data);
+ bps += BITS_PER_MOD[mod];
c++;
mod = next_nibble;
}
else
{
- bitstream_access (&stream_reader, &next_next_nibble, 4);
+ bitstream_access (stream_reader, &next_next_nibble, 4);
if (next_next_nibble < 8)
{
for (j=0; j<next_nibble-5; j++)
@@ -357,6 +366,7 @@ cei_decode (tonemaps_t *tx_tonemaps_to_update, int mm_type, u8 *mm_entry, u32 *m
c++;
}
cei_tone_write (&stream_writer, mod, &write_nb, next_data);
+ bps += BITS_PER_MOD[mod];
c++;
}
mod = next_next_nibble;
@@ -372,9 +382,11 @@ cei_decode (tonemaps_t *tx_tonemaps_to_update, int mm_type, u8 *mm_entry, u32 *m
c++;
}
cei_tone_write (&stream_writer, mod, &write_nb, next_data);
+ bps += BITS_PER_MOD[mod];
c++;
}
- bitstream_access (&stream_reader, &mod, 4);
+ // Don't access one time more.
+ if ((i+1) < entry_nb) bitstream_access (stream_reader, &mod, 4);
}
}
}
@@ -384,13 +396,18 @@ cei_decode (tonemaps_t *tx_tonemaps_to_update, int mm_type, u8 *mm_entry, u32 *m
{
// TODO: RELATIVE CODAGE
}
+ bitstream_finalise (&stream_writer);
}
- bitstream_finalise (&stream_writer);
// ATOMIC switch intervals
tx_tonemaps_to_update->intervals = intervals;
// ATOMIC set tonemap default;
tx_tonemaps_to_update->default_tmi = tmp_default_tmi;
tx_tonemaps_to_update->expiration_rtc_date = cyg_current_time() + S_TO_RTC (TONEMAPS_LIFE_DURATION_S);
+ tonemap_t *new_tm = tx_tonemaps_to_update->tm[new_tmi];
+ new_tm->bits_per_symbol = bps;
+ new_tm->bits_per_pb[PHY_PB_SIZE_136] = tonemap_bits_per_pb (PHY_MOD_TM, new_tm->fecrate, PHY_PB_SIZE_136, bps);
+ new_tm->bits_per_pb[PHY_PB_SIZE_520] = tonemap_bits_per_pb (PHY_MOD_TM, new_tm->fecrate, PHY_PB_SIZE_520, bps);
+ new_tm->ble = tonemap_ble (bps, new_tm->fecrate, 0, new_tm->gil);
return (tonemaps_valid_status);
}
#endif
diff --git a/cesar/ce/inc/rx.h b/cesar/ce/inc/rx.h
index 050f9ee82c..617d39484c 100755
--- a/cesar/ce/inc/rx.h
+++ b/cesar/ce/inc/rx.h
@@ -19,8 +19,7 @@
#include "ce/inc/mpdu_measure_store.h"
#include "cyg/kernel/kapi.h"
#include "lib/trace.h"
-#include "mac/sar/sar.h"
-#include "cp/cp.h"
+#include "ce/rx.h"
#ifdef MAXIMUS_TEST
#define TXCE
@@ -81,7 +80,6 @@ struct rxce_t
char pipe_out_name[1024];
#endif
};
-typedef struct rxce_t rxce_t;
#ifdef EXPIRATION_TEST
typedef void ( *test_cb_t) (int);
@@ -96,16 +94,6 @@ test_cb_t expiration_test;
BEGIN_DECLS
/**
- * Initialize the global structure of rxce context.
- * \param mac_store_ctx Access to the sta.
- * \param mac_config_ctx Access to the tonemask.
- * \return the rxce context.
- *
- */
-rxce_t *
-rxce_init (sar_t *sar_ctx, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx, cp_t *cp_ctx);
-
-/**
* Callback called by pbproc when it need to have a SCF i.e when it receives a
* sound frame. If CE is late, pbproc returns a SCF to false.
* \param tei tei of station that has sent the sound frame.
diff --git a/cesar/ce/inc/tx.h b/cesar/ce/inc/tx.h
index 9b9713e284..190faad94d 100755
--- a/cesar/ce/inc/tx.h
+++ b/cesar/ce/inc/tx.h
@@ -15,9 +15,7 @@
*
*/
-#include "mac/common/store.h"
-#include "mac/common/config.h"
-#include "cyg/kernel/kapi.h"
+#include "ce/tx.h"
/** Global structure for txce context */
@@ -34,7 +32,6 @@ struct txce_t
cyg_alarm alarm_obj;
};
-typedef struct txce_t txce_t;
BEGIN_DECLS
@@ -53,43 +50,6 @@ 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);
-
-/**
- * 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 reload 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.
diff --git a/cesar/ce/rx.h b/cesar/ce/rx.h
new file mode 100644
index 0000000000..2f3bbefb58
--- /dev/null
+++ b/cesar/ce/rx.h
@@ -0,0 +1,36 @@
+#ifndef ce_rx_h
+#define ce_rx_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file ce/rx.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+#include "mac/sar/sar.h"
+#include "cp/cp.h"
+
+typedef struct rxce_t rxce_t;
+
+/**
+ * Initialize the global structure of rxce context.
+ * \param mac_store_ctx Access to the sta.
+ * \param mac_config_ctx Access to the tonemask.
+ * \return the rxce context.
+ *
+ */
+rxce_t *
+rxce_init (sar_t *sar_ctx, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx, cp_t *cp_ctx);
+
+void
+rxce_uninit (rxce_t *rxce);
+
+#endif /*ce_rx_h */
diff --git a/cesar/ce/src/mpdu_measure_store.c b/cesar/ce/src/mpdu_measure_store.c
index c1f6d051e5..7b55e8df82 100755
--- a/cesar/ce/src/mpdu_measure_store.c
+++ b/cesar/ce/src/mpdu_measure_store.c
@@ -152,6 +152,7 @@ mpdu_measure_store_append (mpdu_measure_store_t *ctx, pbproc_rx_params_t *rx_par
}
else
{
+ // TODO Check if rx_params has changed.
mpdu_measure_t *measure = &ctx->store[ctx->tail];
measure->rx_params = rx_params;
if (pb_nb) mpdu_measure_pb_add (measure, pb_nb, pb_first, pb_last, blk_offset);
diff --git a/cesar/ce/src/rx.c b/cesar/ce/src/rx.c
index 6b58c75f41..e67446b99a 100755
--- a/cesar/ce/src/rx.c
+++ b/cesar/ce/src/rx.c
@@ -30,6 +30,16 @@
#include "cp/sta/mgr/sta_mgr.h"
#include "cp/msg/msg.h"
+#ifdef AUTOSTART_RXCE_PROCESS
+#include <cyg/infra/diag.h>
+#include "cyg/kernel/kapi.h"
+#include "cyg/hal/hal_arch.h"
+#define RXCE_PRIORITY 15
+cyg_thread rxce_thread;
+cyg_handle_t rxce_handle;
+unsigned char rxce_stack[CYGNUM_HAL_STACK_SIZE_TYPICAL];
+#endif
+
static rxce_t ce_global;
#ifdef EXPIRATION_TEST
@@ -64,11 +74,23 @@ rxce_init (sar_t *sar, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx,
sar_init_measure_context (sar, ctx);
sar_init_measurement_cb (sar, rxce_mpdu_measurement_add);
#endif
+#ifdef AUTOSTART_RXCE_PROCESS
+ cyg_thread_create (RXCE_PRIORITY, &rxce_process, (cyg_addrword_t) ctx, "rxce",
+ rxce_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL,
+ &rxce_handle, &rxce_thread);
+ cyg_thread_resume (rxce_handle);
+#endif
RXCE_TRACE (INIT, mac_ntb());
return (ctx);
}
void
+rxce_uninit (rxce_t *rxce)
+{
+ dbg_assert (rxce);
+}
+
+void
pbproc_need_scf_cb (uint tei, uint reason_code)
{
dbg_assert (&ce_global);
@@ -88,19 +110,27 @@ bool
rxce_mpdu_measurement_add (void *user, pbproc_rx_params_t *rx_params,
uint pb_nb, blk_t **f, blk_t **l, pb_t *noise, uint n, uint *blk_offset)
{
+ bool b;
dbg_assert (user);
rxce_t *ctx = (rxce_t *) user;
RXCE_TRACE (SAR_MEASUREMENT_CB, mac_ntb());
dbg_assert (rx_params);
- bool b;
- pb_measure_blk_t **first = (pb_measure_blk_t **) f;
- pb_measure_blk_t **last = (pb_measure_blk_t **) l;
- // Allocate block if necessary. The SAR will fill blocks after !couldn't be stopped by RXCE!.
- b = mpdu_measure_store_append (ctx->mpdu_measure_store_ctx, rx_params, pb_nb, first, last, (phy_chandata_t *) noise, n, blk_offset);
- // Give 'job' to RXCE that will process the previous frame.
- if (b) cyg_semaphore_post (&(ctx->job));
- else RXCE_TRACE (MEASURE_DROPPED, mac_ntb());
- return (b);
+ blk_addref (rx_params);
+ if (cp_sta_own_data_get_authenticated_status (ctx->cp_ctx))
+ {
+ pb_measure_blk_t **first = (pb_measure_blk_t **) f;
+ pb_measure_blk_t **last = (pb_measure_blk_t **) l;
+ // Allocate block if necessary. The SAR will fill blocks after !couldn't be stopped by RXCE!.
+ b = mpdu_measure_store_append (ctx->mpdu_measure_store_ctx, rx_params, pb_nb, first, last, (phy_chandata_t *) noise, n, blk_offset);
+ // Give 'job' to RXCE that will process the previous frame.
+ if (b) cyg_semaphore_post (&(ctx->job));
+ else RXCE_TRACE (MEASURE_DROPPED, mac_ntb());
+ return b;
+ }
+ else
+ {
+ return false;
+ }
}
/** todo Cf SPEC HPAV HPAV-FrameControl -- SoundVariantField -- SoundReasonCode */
@@ -156,9 +186,11 @@ void
rxce_next_measurement_compute (rxce_t *ctx)
{
dbg_assert (ctx);
+ bitloading_modification_t bl ;
mpdu_measure_t *measure = mpdu_measure_store_get (ctx->mpdu_measure_store_ctx);
dbg_assert (measure);
- bitloading_modification_t bl = bitloading_run (ctx->mac_store_ctx, measure);
+ bl = bitloading_run (ctx->mac_store_ctx, measure);
+
#ifdef RXCE_MONITORING
uint toto = 9 + sizeof (pbproc_rx_params_t);
write (ctx->pipe_out_fd, &toto, sizeof(toto));
@@ -175,12 +207,12 @@ rxce_next_measurement_compute (rxce_t *ctx)
{
write (ctx->pipe_out_fd, measure->pb_head->next->data, measure->pb_head->next->pb_nb * 4);
}
-
- //write (ctx->pipe_out_fd, measure->pb_head->data, 512);
-
#endif
mpdu_measure_store_release (ctx->mpdu_measure_store_ctx, measure);
- if (bl.changed_tonemaps ) rxce_job_cei_add (ctx, bl.stei, bl.changed_tonemaps, bl.new_tmi, bl.old_tmi);
+ if (bl.changed_tonemaps )
+ {
+ rxce_job_cei_add (ctx, bl.stei, bl.changed_tonemaps, bl.new_tmi, bl.old_tmi);
+ }
}
@@ -267,6 +299,7 @@ rxce_process (cyg_addrword_t data)
cp_sta_t *cp_sta;
cp_mme_tx_t *mme;
cp_mme_peer_t peer;
+ cei_created_status_t cei_status;
RXCE_TRACE (CEI_PROCESS, mac_ntb());
cei_param_t *param = cei_param_get ();
dbg_assert (param);
@@ -280,12 +313,14 @@ rxce_process (cyg_addrword_t data)
expiration_test (param->dtei);
#endif
#ifdef MAXIMUS_TEST
- cei_created_status_t cei_status = cei_create (mme->p_mme, &mme->bitstream, ctx->mask, param->tms, param->new_tmi, param->old_tmi);
+ cei_status = cei_create (mme->p_mme, &mme->bitstream, ctx->mask, param->tms, param->new_tmi, param->old_tmi);
cp_msg_mme_send (ctx->cp_ctx, mme);
sta_t *sta = mac_store_sta_get (ctx->mac_store_ctx, param->dtei);
- cei_decode (sta->tx_tonemaps, cei_status.mm_type, mme->p_mme, ctx->mask);
+ bitstream_t reader;
+ bitstream_read_init (&reader, mme->p_mme, 1536);
+ cei_decode (sta->tx_tonemaps, cei_status.mm_type, &reader, ctx->mask);
#else
- cei_create (mme->p_mme, &mme->bitstream, ctx->mask, param->tms, param->new_tmi, param->old_tmi);
+ cei_status = cei_create (mme->p_mme, &mme->bitstream, ctx->mask, param->tms, param->new_tmi, param->old_tmi);
cp_msg_mme_send (ctx->cp_ctx, mme);
#endif
}
diff --git a/cesar/ce/src/tx.c b/cesar/ce/src/tx.c
index 6d16cff6ca..f8dd2e65a5 100755
--- a/cesar/ce/src/tx.c
+++ b/cesar/ce/src/tx.c
@@ -14,14 +14,17 @@
*/
#include "common/std.h"
#include <stdio.h>
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "ce/tx.h"
#include "ce/inc/tx.h"
#define TXCE
#include "ce/inc/cei.h"
static txce_t txce_global;
-txce_t *
-txce_init (mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx)
+void
+txce_init (cp_t *cp_ctx, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx)
{
dbg_assert (mac_store_ctx);
dbg_assert (mac_config_ctx);
@@ -31,8 +34,27 @@ txce_init (mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx)
cyg_handle_t sys_clk = cyg_real_time_clock();
cyg_handle_t counter_hdl;
cyg_clock_to_counter (sys_clk, &counter_hdl);
- cyg_alarm_create (counter_hdl, alarm_cb, (cyg_addrword_t) ctx, &ctx->alarm_hdl, &ctx->alarm_obj);
- return (ctx);
+ cyg_alarm_create (counter_hdl, alarm_cb, (cyg_addrword_t) cp_ctx, &ctx->alarm_hdl, &ctx->alarm_obj);
+ cp_ctx->txce = ctx;
+}
+
+void
+txce (cp_t *cp_ctx, uint stei, u32 mmtype, bitstream_t *stream_reader)
+{
+ dbg_assert (cp_ctx);
+ txce_t *ctx = cp_ctx->txce;
+ if (stream_reader)
+ {
+ dbg_assert (mmtype == CM_CHAN_EST_IND || mmtype == CM_TM_UPDATE_IND);
+ dbg_assert (stei>=MAC_TEI_STA_MIN && stei<=MAC_TEI_STA_MAX);
+ // Get concerned tonemaps from stei.
+ sta_t *source_sta = mac_store_sta_get (ctx->mac_store_ctx, stei);
+ tonemaps_t *source_tms = source_sta->tx_tonemaps;
+ cei_decode (source_tms, mmtype, stream_reader, ctx->tonemask);
+ blk_release (source_sta);
+ }
+ cyg_tick_count_t next_expiration = txce_expiration_tonemaps_management (ctx);
+ cyg_alarm_initialize (ctx->alarm_hdl, next_expiration, 0);
}
cyg_tick_count_t
@@ -76,27 +98,9 @@ txce_expiration_tonemaps_management (txce_t *ctx)
}
void
-txce (txce_t *ctx, uint stei, u32 mmtype, u8 *mm_entry)
-{
- dbg_assert (ctx);
- if (mm_entry)
- {
- dbg_assert (mmtype == CM_CHAN_EST_IND || mmtype == CM_TM_UPDATE_IND);
- dbg_assert (stei>=MAC_TEI_STA_MIN && stei<=MAC_TEI_STA_MAX);
- // Get concerned tonemaps from stei.
- sta_t *source_sta = mac_store_sta_get (ctx->mac_store_ctx, stei);
- tonemaps_t *source_tms = source_sta->tx_tonemaps;
- cei_decode (source_tms, mmtype, mm_entry, ctx->tonemask);
- blk_release (source_sta);
- }
- cyg_tick_count_t next_expiration = txce_expiration_tonemaps_management (ctx);
- cyg_alarm_initialize (ctx->alarm_hdl, next_expiration, 0);
-}
-
-void
alarm_cb (cyg_handle_t alarm_hdl, cyg_addrword_t data)
{
dbg_assert (data);
- txce_t *ctx = (txce_t *) data;
+ cp_t *ctx = (cp_t *) data;
txce (ctx, 0, 0, NULL);
}
diff --git a/cesar/ce/test/common/src/print_utils.c b/cesar/ce/test/common/src/print_utils.c
index 7f47ea786f..9a7eb63f04 100755
--- a/cesar/ce/test/common/src/print_utils.c
+++ b/cesar/ce/test/common/src/print_utils.c
@@ -56,7 +56,7 @@ ce_print_buffer (u8 *buf, int length)
{
if ((i%8)==0) ce_print("\n%d\t|", i);
//ce_print_byte (*(buf+i));
- ce_print ("%8x|", *(browser++));
+ ce_print ("%.8x|", *(browser++));
}
ce_print("\n\n");
}
@@ -103,7 +103,7 @@ ce_print_tonemaps (tonemaps_t *tms)
{
if (tms->tm[i])
{
- ce_print("indice %d (%d) ",i,i+4);
+ ce_print("indice %d ",i);
ce_print_tonemap(tms->tm[i]);
}
}
@@ -121,7 +121,7 @@ ce_print_tonemaps (tonemaps_t *tms)
void
ce_print_rx_params (pbproc_rx_params_t *rx_params)
{
- ce_print ("rx_params @ 0x%x -> 0x%x : ", rx_params, *rx_params);
+ ce_print ("rx_params @ 0x%x = 0x%2.x%2.x%2.x : ", rx_params, *rx_params, *(rx_params+1), *(rx_params+2));
ce_print ("tei %d, lid %d, ble %d, tmi_av %d\n",
rx_params->tei, rx_params->lid, rx_params->ble, rx_params->tmi_av);
}
@@ -137,7 +137,7 @@ ce_print_chandata_list (phy_chandata_t *f)
{
while (f)
{
- ce_print("{size:%d, last:%d, type:%d, @0x%x}",f->size, f->last, f->type, f->address);
+ ce_print("{blk%p, size:%d, last:%d, type:%d, @0x%x}", f, f->size, f->last, f->type, f->address);
f = (phy_chandata_t *) f->blk.next;
if (f) ce_print ("->");
}
@@ -175,13 +175,13 @@ ce_print_mpdu_measure (mpdu_measure_t *measure)
{
ce_print_pb_measurement ((pb_measurement_t *)(measure->pb_head->data + j));
}
- }
- if (measure->pb_head->next)
- {
- ce_print ("%d ber_stock suite @ 0x%x\n", measure->pb_head->next->pb_nb, &measure->pb_head->next);
- for (j=0; j<measure->pb_head->next->pb_nb; j++)
+ if (measure->pb_head->next)
{
- ce_print_pb_measurement ((pb_measurement_t *)(measure->pb_head->next->data + j));
+ ce_print ("%d ber_stock suite @ 0x%x\n", measure->pb_head->next->pb_nb, &measure->pb_head->next);
+ for (j=0; j<measure->pb_head->next->pb_nb; j++)
+ {
+ ce_print_pb_measurement ((pb_measurement_t *)(measure->pb_head->next->data + j));
+ }
}
}
for (j=0; j<PHY_CHANDATA_TYPE_NB; j++)
diff --git a/cesar/ce/test/common/tonemap_utils.h b/cesar/ce/test/common/tonemap_utils.h
index d1727099a2..f10e16323c 100644
--- a/cesar/ce/test/common/tonemap_utils.h
+++ b/cesar/ce/test/common/tonemap_utils.h
@@ -18,6 +18,7 @@
#include "lib/test.h"
#include "lib/rnd.h"
#include "lib/bitstream.h"
+#include "hal/phy/defs.h"
lib_rnd_t rnd;
@@ -30,8 +31,8 @@ create_tm (tonemaps_t *tms, u32 *mask, uint tmi, uint max_rnd, uint offset)
tms->default_tmi = 0;
tms->tm[tmi] = tonemap_alloc ();
tms->tm[tmi]->cpf = 1;
- tms->tm[tmi]->fecrate = 2;
- tms->tm[tmi]->gil = 3;
+ tms->tm[tmi]->fecrate = PHY_FEC_RATE_1_2;
+ tms->tm[tmi]->gil = PHY_GIL_567;
bitstream_init (&stream, tms->tm[tmi]->tmdma_desc_head->data, 512, BITSTREAM_WRITE);
for (i=0; i<PHY_CARRIER_NB+1; i++)
{
diff --git a/cesar/ce/test/maximus/test1/Config b/cesar/ce/test/maximus/test1/Config
new file mode 100644
index 0000000000..dc2b3fd1bf
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/Config
@@ -0,0 +1 @@
+CONFIG_TRACE=y
diff --git a/cesar/ce/test/maximus/test1/Makefile b/cesar/ce/test/maximus/test1/Makefile
new file mode 100644
index 0000000000..b4f2cc7fd7
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/Makefile
@@ -0,0 +1,30 @@
+BASE = ../../../..
+
+ECOS = y
+
+EXTRA_TARGET_CFLAGS=-DRXCE_WITH_SAR -DAUTOSTART_RXCE_PROCESS -DRXCE_PBPROC_MAXIMUS_TEST
+
+TARGET_PROGRAMS= ce_test1
+
+ce_test1_SOURCES =
+ce_test1_MODULES = lib mac/common mac cl hle interface cp hal station ce \
+ host test_general/station/fcall cp/beacon/stub \
+ ce/test/maximus/test1/common ce/test/common
+
+mac_sar_MODULE_SOURCES = sar.c \
+ sar_expiration.c sar_mfs.c sar_mf.c bridge_dma.c \
+ $(if $(filter y,$(CONFIG_TRACE)),trace.c,)
+
+mac_pbproc_MODULE_SOURCES = mfs.c pbproc.c fc.c prep_mpdu.c fsm.c fsm_top.c \
+ fsm_handle_fc.c\
+ fsm_rx_data.c\
+ fsm_rx_beacon.c \
+ fsm_tx_data.c \
+ sacki_enc.c sacki_dec.c \
+ $(if $(filter y,$(CONFIG_TRACE)),trace.c,)
+
+
+include $(BASE)/common/make/top.mk
+
+$(call src2obj,src/region_stub.c,target): $(BASE)/cp/fsm/fsm.h
+
diff --git a/cesar/ce/test/maximus/test1/common/Module b/cesar/ce/test/maximus/test1/common/Module
new file mode 100644
index 0000000000..272503fb17
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/common/Module
@@ -0,0 +1 @@
+SOURCES := station.c ntb_stub.c region_stub.c bw_stub.c pbproc_scf_stub.c
diff --git a/cesar/ce/test/maximus/test1/common/src/bw_stub.c b/cesar/ce/test/maximus/test1/common/src/bw_stub.c
new file mode 100644
index 0000000000..ca0f0e2fa7
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/common/src/bw_stub.c
@@ -0,0 +1,237 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test/src/bw.c
+ * \brief BW stub
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+
+#include "lib/list.h"
+#include "cp/cco/bw/bw.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "string.h"
+
+/**
+ * Init of the BW manager.
+ * \param ctx Control Plane Context
+ *
+ */
+void
+cp_cco_bw_init (cp_t* ctx)
+{
+ dbg_assert (ctx);
+
+ memset (&ctx->bw, 0, sizeof (cp_cco_bw_t));
+
+ list_init (&ctx->bw.finalised_schedule);
+}
+
+/**
+ * uninit the bandwidth manager allocations.
+ * \param ctx control plane context
+ *
+ */
+void
+cp_cco_bw_uninit (cp_t* ctx)
+{
+ uint persistence;
+ cp_cco_bw_alloc_t *alloc;
+ dbg_assert (ctx);
+
+
+ persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ while (!list_empty (&ctx->bw.finalised_schedule))
+ {
+ alloc = cp_cco_bw_get_first_alloc (ctx, persistence);
+ if (alloc)
+ cp_cco_bw_alloc_remove (ctx, alloc);
+ else
+ persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ }
+}
+
+/**
+ * Return the first element of schedule persistent or not
+ * persistent.
+ * \param ctx Control Plane Context
+ * \param persistence persistent or not persistent
+ * \return the first element of the schedule
+ *
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc (cp_t *ctx, cp_cco_bw_persistence_t persistence)
+{
+ list_node_t *node;
+ cp_cco_bw_alloc_t *alloc;
+
+ if (list_empty (&ctx->bw.finalised_schedule))
+ return NULL;
+
+ node = list_begin (&ctx->bw.finalised_schedule);
+
+ while (node != list_end(&ctx->bw.finalised_schedule))
+ {
+ alloc = PARENT_OF (cp_cco_bw_alloc_t, node, node);
+
+ if (persistence == alloc->persistence)
+ {
+ blk_addref (alloc);
+ return alloc;
+ }
+ else
+ node = list_next (node);
+ }
+
+ return NULL;
+}
+
+/**
+ * Return the next allocation persistent or not
+ * \param ctx control plane context
+ * \param prev_alloc previous allocation
+ * \return the next allocation
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc (cp_t *ctx, cp_cco_bw_alloc_t *prev_alloc)
+{
+ list_node_t *node;
+ cp_cco_bw_alloc_t *alloc;
+
+ node = &prev_alloc->node;
+
+ while (node != list_end(&ctx->bw.finalised_schedule))
+ {
+ node = list_next (node);
+
+ if (node == list_end(&ctx->bw.finalised_schedule))
+ return NULL;
+
+ alloc = PARENT_OF (cp_cco_bw_alloc_t, node, node);
+
+ if (prev_alloc->persistence == alloc->persistence)
+ return alloc;
+ else
+ node = list_next (node);
+ }
+
+ return NULL;
+}
+
+
+/**
+ * Return the number of allocation persistent or not
+ * \param ctx control plane context
+ * \param persistence persistent or not persistent
+ * \return return the number of allocation
+ *
+ */
+u16
+cp_cco_bw_get_nb_alloc(cp_t *ctx, cp_cco_bw_persistence_t persistence)
+{
+ dbg_assert (ctx);
+
+ if(persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ return ctx->bw.nb_alloc_pers_finalised;
+ else
+ return ctx->bw.nb_alloc_no_pers_finalised;
+}
+
+/** Add an allocation
+ * \param ctx the control plane context.
+ * \param alloc the allocation.
+ */
+void
+cp_cco_bw_alloc_add (cp_t *ctx, cp_cco_bw_alloc_t *alloc)
+{
+ dbg_assert (ctx);
+ dbg_assert (alloc);
+
+ list_init_node (&alloc->node);
+ list_push (&ctx->bw.finalised_schedule, &alloc->node);
+
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_finalised ++;
+ else
+ ctx->bw.nb_alloc_no_pers_finalised ++;
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_alloc_get(cp_t *ctx, u16 cid)
+{
+ cp_cco_bw_alloc_t* alloc;
+
+ alloc = PARENT_OF(cp_cco_bw_alloc_t, node,
+ list_begin(&ctx->bw.actual_schedule));
+
+ while(PARENT_OF(cp_cco_bw_alloc_t, node ,&alloc->node)->cid != cid)
+ alloc = PARENT_OF(cp_cco_bw_alloc_t, node, list_next(&alloc->node));
+
+ /*We reached the last alloc and didn't find the one we need*/
+ if(alloc->cid != cid)
+ alloc = NULL;
+
+ return alloc;
+}
+
+/** Remove an allocation
+ * \param ctx the control plane context.
+ * \param alloc the allocation.
+ */
+void
+cp_cco_bw_alloc_remove_cid (cp_t *ctx, u16 cid)
+{
+ cp_cco_bw_alloc_t *alloc;
+
+ dbg_assert (ctx);
+
+ alloc = cp_cco_bw_alloc_get(ctx, cid);
+
+ list_remove (&ctx->bw.finalised_schedule, &alloc->node);
+
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_finalised --;
+ else
+ ctx->bw.nb_alloc_no_pers_finalised --;
+
+ blk_release (alloc);
+}
+
+void
+cp_cco_bw_alloc_remove(cp_t *ctx, cp_cco_bw_alloc_t *alloc)
+{
+ dbg_assert (ctx);
+ dbg_assert (alloc);
+
+ list_remove (&ctx->bw.finalised_schedule, &alloc->node);
+
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_finalised --;
+ else
+ ctx->bw.nb_alloc_no_pers_finalised --;
+
+ blk_release (alloc);
+}
+
+bool
+cp_cco_bw_schedules_is_empty (set_t *set)
+{
+ dbg_assert (set);
+
+ return set_empty (set);
+}
+
+void
+cp_cco_bw_finalise_sched (cp_t *ctx)
+{
+}
diff --git a/cesar/ce/test/maximus/test1/common/src/ntb_stub.c b/cesar/ce/test/maximus/test1/common/src/ntb_stub.c
new file mode 100644
index 0000000000..e608f9c446
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/common/src/ntb_stub.c
@@ -0,0 +1,22 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/ntb_stuc.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/beacon/ntb/ntb_clock_sync.h"
+
+void
+cp_beacon_ntb_clk_sync( cp_t *cp_ctx, unsigned long beacon_bts, unsigned long beacon_sys_ltmr, unsigned long beacon_sta_ltmr )
+{
+}
diff --git a/cesar/ce/test/maximus/test1/common/src/pbproc_scf_stub.c b/cesar/ce/test/maximus/test1/common/src/pbproc_scf_stub.c
new file mode 100644
index 0000000000..be5a4f475b
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/common/src/pbproc_scf_stub.c
@@ -0,0 +1,22 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file common/src/pbproc_scf_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+void
+pbproc_scf (void)
+{
+ ;
+}
+
diff --git a/cesar/ce/test/maximus/test1/common/src/region_stub.c b/cesar/ce/test/maximus/test1/common/src/region_stub.c
new file mode 100644
index 0000000000..f4d2687c90
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/common/src/region_stub.c
@@ -0,0 +1,107 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/region_stub.c
+ * \brief Region manager stub
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+
+#include "cp/defs.h"
+#include "cp/cp.h"
+#include "cp/cco/region/region.h"
+
+#include "cp/inc/context.h"
+#include "cp/pwl/pwl.h"
+
+#include "string.h"
+
+static cp_cco_region_inl_alloc_t alloc;
+
+/**
+ * Init region
+ * \param ctx the CP context.
+ */
+void
+cp_cco_region_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset (&ctx->region, 0, sizeof(cp_cco_region_t));
+}
+
+/**
+ * Uninit region
+ * \param ctx the CP context.
+ */
+void
+cp_cco_region_uninit(cp_t *ctx)
+{
+ cp_cco_region_inl_alloc_t *current;
+ cp_cco_region_inl_alloc_t *next;
+ dbg_assert (ctx);
+
+ current = ctx->region.inl_alloc;
+ while (current)
+ {
+ next = current->next;
+ blk_release (current);
+ current = next;
+ }
+}
+
+/**
+ * Returns the number of regions
+ * \param ctx the module context.
+ * \return number of regions
+ *
+ */
+u16
+cp_cco_region_get_nb_region (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ /* One region declared as CSMA only. */
+ return 1;
+}
+
+/**
+ * create the schedule to create the region BENTRY.
+ * \param ctx the module context.
+ *
+ */
+cp_cco_region_inl_alloc_t*
+cp_cco_region_get_region (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ /* Fill the allocation. */
+ alloc.et = MAC_TCK_TO_ATU (ctx->pwl.bp_ntb);
+ alloc.state = CP_CCO_REGION_ALLOC_STATE_CSMA;
+
+ return &alloc;
+}
+
+/**
+ * fonction that returns the next element allocated
+ * \param ctx the module context.
+ * \param actual_alloc actual alloc
+ * \return next allocation
+ */
+cp_cco_region_inl_alloc_t*
+cp_cco_region_get_next_alloc (cp_t *ctx,
+ cp_cco_region_inl_alloc_t* actual_alloc)
+{
+ dbg_assert (ctx);
+ dbg_assert (actual_alloc);
+
+ return actual_alloc->next;
+}
+
+
diff --git a/cesar/ce/test/maximus/test1/common/src/station.c b/cesar/ce/test/maximus/test1/common/src/station.c
new file mode 100644
index 0000000000..68ff0b8af0
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/common/src/station.c
@@ -0,0 +1,113 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/station.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "common/defs/ethernet.h"
+#include "lib/trace.h"
+
+#include "station/station.h"
+#include "cp/cp.h"
+#include "hle/hle.h"
+#include "cl/cl.h"
+#include "mac/sar/sar.h"
+#include "mac/pbproc/pbproc.h"
+
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/cco/bw/bw.h"
+
+#include <stdio.h>
+
+#include "host/station/station.h"
+
+#include "test_general/station/fcall/fcall.h"
+
+/** Private include never use it in the station source code outside the own
+ * module. **/
+#include "cl/inc/context.h"
+#include "mac/pbproc/inc/context.h"
+#include "mac/sar/inc/sar_context.h"
+#include "hal/phy/maximus/inc/maximus_phy_ctx.h"
+#include <stdio.h>
+
+
+extern station_ctx_t my_station;
+
+static cesar_t *cesar;
+
+static cp_cco_bw_alloc_t *alloc;
+
+/***************** Cesar *******************/
+
+int
+cyg_user_start (void)
+{
+ cesar = cesar_init ();
+
+ /* Create an allocation for the station. */
+ alloc = blk_alloc ();
+ alloc->stpf = false;
+ alloc->et_atu = 3907; // For 50 Hz.
+ alloc->glid = MAC_LID_SHARED_CSMA;
+ alloc->persistence = true;
+
+ cp_cco_bw_alloc_add (cesar->cp, alloc);
+
+
+ fcall_register (my_station.fcall, "fc_sta_own_data_public",
+ &fc_sta_own_data_public, cesar);
+
+ fcall_register (my_station.fcall, "fc_sta_own_data_private",
+ &fc_sta_own_data_private, cesar);
+
+ fcall_register (my_station.fcall, "fc_cc_leave_req",
+ &fc_cc_leave_req, cesar);
+
+ fcall_register (my_station.fcall, "fc_sta_mgr_get_unassoc_sta",
+ &fc_sta_mgr_get_unassoc_sta, cesar);
+
+ fcall_register (my_station.fcall, "fc_sta_is_mac_bridged",
+ &fc_sta_is_mac_bridged, cesar);
+ fcall_register (my_station.fcall, "fc_sta_get_mac_to_tei_entry",
+ &fc_sta_get_mac_to_tei_entry, cesar);
+
+ fcall_register (my_station.fcall, "fc_mac_store_sta_peer_is_authenticated",
+ &fc_mac_store_sta_peer_is_authenticated, cesar->mac_store);
+
+ fcall_register (my_station.fcall, "fc_cco_change_snid",
+ &fc_cco_change_snid, cesar);
+
+ fcall_register (my_station.fcall, "fc_cco_change_hm",
+ &fc_cco_change_hm, cesar);
+
+#if CONFIG_TRACE
+ fcall_register (my_station.fcall, "fc_sta_trace_dump_cl",
+ &fc_sta_trace_dump, &cesar->cl->trace);
+
+ fcall_register (my_station.fcall, "fc_sta_trace_dump_phy",
+ &fc_sta_trace_dump, &cesar->pbproc->phy->trace);
+
+ fcall_register (my_station.fcall, "fc_sta_trace_dump_sar",
+ &fc_sta_trace_dump, &cesar->sar->trace);
+
+ fcall_register (my_station.fcall, "fc_sta_trace_dump_all",
+ &fc_sta_trace_dump_all, NULL);
+#endif
+
+ //station_log_set_level(&my_station, STATION_LOG_INFO);
+ //station_log_set_mask(&my_station, STATION_LOGTYPE_PHY);
+ my_station.pipe_log_fd = 1;
+
+ return 0;
+}
+
diff --git a/cesar/ce/test/maximus/test1/ecos.ecc.sh b/cesar/ce/test/maximus/test1/ecos.ecc.sh
new file mode 100644
index 0000000000..e0278271fe
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new maximus default
+cat >> $config <<'EOF'
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/ce/test/maximus/test1/py/test_integr_ce.py b/cesar/ce/test/maximus/test1/py/test_integr_ce.py
new file mode 100644
index 0000000000..3a379cee7c
--- /dev/null
+++ b/cesar/ce/test/maximus/test1/py/test_integr_ce.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+# Create two AVLN and cause a SNID conflict.
+
+import os
+import unittest
+import sys
+sys.path.append ('../../../../maximus/python/tools/csi/')
+sys.path.append ('../../../../maximus/python/obj/')
+sys.path.append ('../../../../maximus/python/')
+sys.path.append ('../../../../maximus/python/lib/cesar')
+
+from csicore import *
+from beacon import *
+
+csi = csiCore (1234)
+
+
+# Creating an AVLN.
+avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
+
+sta1_debug = False
+sta2_debug = False
+
+# Adding the stations.
+stas = list ()
+stas.append (avln1.sta_add ("00:00:00:00:01:01", False, False,
+ "HomePlug_AVLN1_Station1", "spc300_sta1", "station1", 1, sta1_debug))
+stas.append (avln1.sta_add ("00:00:00:00:01:02", False, False,
+ "HomePlug_AVLN1_Station2", "spc300_sta2", "station2", 1, sta2_debug))
+csi.process_init (sys.argv + ['-e', 'obj/ce_test1.elf'])
+# disturb channel with 2 to force maximus to send Noise before Mpdu. (waiting
+# for PBPROC get chandata...)
+csi.get_maximus().disturb_channel(2)
+csi.get_maximus().set_snr(0)
+csi.process_avlns_launch ()
+csi.process_wait_association (15)
+csi.process_wait_authentication (15)
+csi.authentication_status (avln1)
+
+# traffic
+for i in range(1,5):
+ packets = csi.avln_create_traffic (avln1, 10)
+ csi.process_data_send_traffic (packets);
+ csi.process_wait_sec (0.1)
+# print "next"
+
+# TODO : test failed if no tonemap and if tonemap of sta vs cco are differents and if
+# pbprob don't used it...
+csi.process_avlns_remove ()
+
+sys.exit (1)
diff --git a/cesar/ce/test/rx/general/overide/cp/inc/context.h b/cesar/ce/test/rx/general/overide/cp/inc/context.h
new file mode 100644
index 0000000000..cb6888a736
--- /dev/null
+++ b/cesar/ce/test/rx/general/overide/cp/inc/context.h
@@ -0,0 +1,11 @@
+#ifndef overide_cp_inc_context_h
+#define overide_cp_inc_context_h
+#include "ce/tx.h"
+#include "ce/inc/tx.h"
+
+struct cp_t
+{
+ txce_t *txce;
+};
+
+#endif /* overide_cp_inc_context_h */
diff --git a/cesar/ce/test/rx/general/overide/cp/sta/mgr/src/sta_mgr.c b/cesar/ce/test/rx/general/overide/cp/sta/mgr/src/sta_mgr.c
index 64566fbf96..dbab541119 100644
--- a/cesar/ce/test/rx/general/overide/cp/sta/mgr/src/sta_mgr.c
+++ b/cesar/ce/test/rx/general/overide/cp/sta/mgr/src/sta_mgr.c
@@ -27,3 +27,14 @@ cp_sta_mgr_get_our_avln (cp_t *ctx)
return 0;
}
+mac_t
+cp_sta_own_data_get_mac_address (cp_t *ctx)
+{
+ return 0xbbccddee00;
+}
+
+bool
+cp_sta_own_data_get_authenticated_status (cp_t *ctx)
+{
+ return true;
+}
diff --git a/cesar/ce/test/rx/general/src/test_cei.c b/cesar/ce/test/rx/general/src/test_cei.c
index 76b4c44904..f31e92b6ba 100755
--- a/cesar/ce/test/rx/general/src/test_cei.c
+++ b/cesar/ce/test/rx/general/src/test_cei.c
@@ -27,14 +27,14 @@ test_exchange (test_t test, tonemaps_t *rx_tms, tonemaps_t *tx_tms,
{
u8 buffer[1536];
bitstream_t bitstream_ctx;
+ bitstream_t reader;
int i; for (i=0; i<1536; i++) buffer[i]=0;
bitstream_write_init (&bitstream_ctx, buffer, 1536);
create_tm (rx_tms, mask, tmi, max_rnd, offset);
ce_print_tonemaps (rx_tms);
cei_create (buffer, &bitstream_ctx, mask, rx_tms, tmi, TONEMAP_INDEX_NULL);
- ce_print_buffer (buffer, 1024);
- cei_decode (tx_tms, CM_CHAN_EST_IND, buffer, mask);
- ce_print_tonemaps (tx_tms);
+ bitstream_read_init (&reader, buffer, 1536);
+ cei_decode (tx_tms, CM_CHAN_EST_IND, &reader, mask);
compare_tonemaps (test, rx_tms, tx_tms, mask);
}
@@ -51,10 +51,10 @@ main (int argc, char **argv)
tonemaps_t *rx_tms = tonemaps_alloc();
tonemaps_t *tx_tms = tonemaps_alloc();
test_case_begin (test, "CE-cei-full mask");
- test_exchange (test, rx_tms, tx_tms, mask, 0, 3, 1);
- test_exchange (test, rx_tms, tx_tms, mask, 1, 2, 6);
- test_exchange (test, rx_tms, tx_tms, mask, 2, 1, 3);
- test_exchange (test, rx_tms, tx_tms, mask, 3, 0, 3);
+ test_exchange (test, rx_tms, tx_tms, mask, 4, 3, 1);
+ test_exchange (test, rx_tms, tx_tms, mask, 5, 2, 6);
+ test_exchange (test, rx_tms, tx_tms, mask, 6, 1, 3);
+ test_exchange (test, rx_tms, tx_tms, mask, 7, 0, 3);
tonemaps_release (rx_tms);
tonemaps_release (tx_tms);
test_begin (test, "check alloc/free")
@@ -66,10 +66,10 @@ main (int argc, char **argv)
tx_tms = tonemaps_alloc();
tonemask_default (mask);
test_case_begin (test, "CE-cei-default mask");
- test_exchange (test, rx_tms, tx_tms, mask, 0, 3, 1);
- test_exchange (test, rx_tms, tx_tms, mask, 1, 2, 6);
- test_exchange (test, rx_tms, tx_tms, mask, 2, 1, 3);
- test_exchange (test, rx_tms, tx_tms, mask, 3, 0, 3);
+ test_exchange (test, rx_tms, tx_tms, mask, 4, 3, 1);
+ test_exchange (test, rx_tms, tx_tms, mask, 5, 2, 6);
+ test_exchange (test, rx_tms, tx_tms, mask, 6, 1, 3);
+ test_exchange (test, rx_tms, tx_tms, mask, 7, 0, 3);
tonemaps_release (rx_tms);
tonemaps_release (tx_tms);
test_begin (test, "check alloc/free")
diff --git a/cesar/ce/test/rx/general/src/test_sar_integration.c b/cesar/ce/test/rx/general/src/test_sar_integration.c
index 8290a61060..69f1e608d3 100755
--- a/cesar/ce/test/rx/general/src/test_sar_integration.c
+++ b/cesar/ce/test/rx/general/src/test_sar_integration.c
@@ -109,6 +109,7 @@ emul_reassembly (int pb_nb, uint date, pbproc_rx_params_t **rx_params,
(*rx_params)->tei = 1;
(*rx_params)->lid = 1;
}
+
void
run_one_reassembly (sar_t *sar_ctx, uint pb_nb)
{
@@ -210,7 +211,6 @@ frame_process (cyg_addrword_t data)
}
} test_end;
END (sar_ctx, sta, ca);
-
test_case_begin (test, "Several sound frames and rxce late");
START (&sar_ctx, &sta, &ca);
test_begin (test, "check rxce status")
@@ -261,7 +261,6 @@ frame_process (cyg_addrword_t data)
}
} test_end;
END (sar_ctx, sta, ca);
-
mac_store_uninit (mac_store_ctx);
rxce_trace_print (rxce_ctx);
rxce_trace_uninit (rxce_ctx);
diff --git a/cesar/ce/test/tx/host-Makefile b/cesar/ce/test/tx/host-Makefile
index b589f95a9a..b101c3df55 100755
--- a/cesar/ce/test/tx/host-Makefile
+++ b/cesar/ce/test/tx/host-Makefile
@@ -3,7 +3,7 @@ BASE = ../../..
INCLUDES = ce/test/tx
INCLUDES+= ce/test/common
INCLUDES+= ce/test/common/ecos_overide
-INCLUDES += ce/test/rx/general/overide
+INCLUDES+= ce/test/rx/general/overide
HOST_PROGRAMS = test_tx
test_tx_SOURCES = test_tx.c
diff --git a/cesar/ce/test/tx/overide/cp/fsm/src/fsm.c b/cesar/ce/test/tx/overide/cp/fsm/src/fsm.c
index cbd9c56236..33dee0da47 100644
--- a/cesar/ce/test/tx/overide/cp/fsm/src/fsm.c
+++ b/cesar/ce/test/tx/overide/cp/fsm/src/fsm.c
@@ -34,18 +34,20 @@ cp_emul_cei_reception (cp_t *ctx)
}
for (i=0; i<alea_new_mme; i++)
{
- uint rnd_tmi = lib_rnd_uniform (&rnd, TONEMAP_INDEX_NB);
+ uint rnd_tmi = lib_rnd_uniform (&rnd, TONEMAP_INDEX_NB - NEGOCIATED_TONEMAP_INDEX_FIRST) + NEGOCIATED_TONEMAP_INDEX_FIRST;
uint rnd_tei = lib_rnd_uniform (&rnd, MAC_TEI_STA_MAX) + MAC_TEI_STA_MIN;
mac_store_sta_add (ctx->mac_store , rnd_tei);
sta_t *lsta = mac_store_sta_get (ctx->mac_store, rnd_tei);
if (lsta->tx_tonemaps->tm[rnd_tmi] == NULL)
{
bitstream_t writer;
+ bitstream_t reader;
u32 *tonemask = ctx->mac_config->tonemask_info.tonemask;
bitstream_write_init (&writer, ctx->fsm.rx_cei_buffer, 1536);
create_tm (lsta->tx_tonemaps, tonemask, rnd_tmi, 1, 4);
cei_create (ctx->fsm.rx_cei_buffer, &writer, tonemask, lsta->tx_tonemaps, rnd_tmi, TONEMAP_INDEX_NULL);
- txce (ctx->fsm.txce_ctx, rnd_tei, CM_CHAN_EST_IND, ctx->fsm.rx_cei_buffer);
+ bitstream_init (&reader, ctx->fsm.rx_cei_buffer, 2000, BITSTREAM_READ);
+ txce (ctx, rnd_tei, CM_CHAN_EST_IND, &reader);
}
}
}
@@ -71,7 +73,7 @@ cp_fsm_uninit (cp_t *ctx)
void
cp_fsm_init (cp_t *cp_ctx)
{
- cp_ctx->fsm.txce_ctx = txce_init (cp_ctx->mac_store, cp_ctx->mac_config);
+ txce_init (cp_ctx, cp_ctx->mac_store, cp_ctx->mac_config);
lib_rnd_init (&rnd, 123);
}
diff --git a/cesar/ce/test/tx/overide/cp/inc/context.h b/cesar/ce/test/tx/overide/cp/inc/context.h
index cdd7b52fa9..e0762be25c 100644
--- a/cesar/ce/test/tx/overide/cp/inc/context.h
+++ b/cesar/ce/test/tx/overide/cp/inc/context.h
@@ -125,6 +125,9 @@ struct cp_t
/** Random generator. */
lib_rnd_t rnd;
+
+ /** TXCE context. */
+ txce_t *txce;
};
#endif /* cp_inc_cp_h */
diff --git a/cesar/ce/test/tx/src/test_expiration.c b/cesar/ce/test/tx/src/test_expiration.c
index d2e42b6d28..f352c210db 100644
--- a/cesar/ce/test/tx/src/test_expiration.c
+++ b/cesar/ce/test/tx/src/test_expiration.c
@@ -48,7 +48,6 @@ test_process (cyg_addrword_t data)
// tonemap that should have been expirated is still in mac_store.
while (n++<S_TO_RTC (TONEMAPS_LIFE_DURATION_S*2))
{
- //printf ("%d\n",n);
cyg_thread_delay(1);
for (i=MAC_TEI_STA_MIN; i<MAC_TEI_STA_MAX; i++)
{
@@ -56,7 +55,7 @@ test_process (cyg_addrword_t data)
if (lsta)
{
has_tonemap = false;
- for (tmi=0; tmi<TONEMAP_INDEX_NB; tmi++)
+ for (tmi=NEGOCIATED_TONEMAP_INDEX_FIRST; tmi<TONEMAP_INDEX_NB; tmi++)
{
if (lsta->tx_tonemaps->tm[tmi] != NULL)
{
@@ -80,7 +79,7 @@ test_process (cyg_addrword_t data)
sta_t *lsta = mac_store_sta_get (mac_store_ctx, i);
if (lsta)
{
- for (tmi=0; tmi<TONEMAP_INDEX_NB; tmi++)
+ for (tmi=NEGOCIATED_TONEMAP_INDEX_FIRST; tmi<TONEMAP_INDEX_NB; tmi++)
{
if (lsta->tx_tonemaps->tm[tmi] != NULL)
{
diff --git a/cesar/ce/test/tx/src/test_tx.c b/cesar/ce/test/tx/src/test_tx.c
index 4647a27d6b..a30410cbd9 100755
--- a/cesar/ce/test/tx/src/test_tx.c
+++ b/cesar/ce/test/tx/src/test_tx.c
@@ -19,6 +19,8 @@
#include "ce/test/common/print_utils.h"
#include "mac/common/store.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
#include "ce/inc/tx.h"
#include "mac/common/tonemask.h"
#include "ce/inc/cei.h"
@@ -35,6 +37,7 @@ main (int argc, char **argv)
{
uint i;
test_t test;
+ cp_t cp_ctx;
mac_config_t mac_config;
test_init (test, argc, argv);
mac_config_init (&mac_config);
@@ -58,6 +61,7 @@ main (int argc, char **argv)
u8 rx_mm_entry[MME_BUFFER_SIZE];
bitstream_t stream;
bitstream_t *writer = &stream;
+ bitstream_t reader;
bitstream_init (writer, rx_mm_entry, MME_BUFFER_SIZE, BITSTREAM_WRITE);
bitstream_access (writer, &MAX_FL_FL, 16);
bitstream_access (writer, &RIFS1, 8);
@@ -89,12 +93,13 @@ main (int argc, char **argv)
bitstream_finalise(writer);
ce_print_buffer (rx_mm_entry, 1024);
+ bitstream_init (&reader, rx_mm_entry, MME_BUFFER_SIZE, BITSTREAM_READ);
mac_store_t *mac_store_ctx = mac_store_init();
mac_store_sta_add (mac_store_ctx, STEI);
sta_t *sta = mac_store_sta_get (mac_store_ctx, STEI);
- txce_t *txce_ctx = txce_init (mac_store_ctx, &mac_config);
- txce (txce_ctx, STEI, CM_CHAN_EST_IND, rx_mm_entry);
+ txce_init (&cp_ctx, mac_store_ctx, &mac_config);
+ txce (&cp_ctx, STEI, CM_CHAN_EST_IND, &reader);
ce_print_tonemaps (sta->tx_tonemaps);
test_case_begin (test, "CE-create tonemap from cei received");
test_begin (test, "No encodage")
@@ -111,10 +116,10 @@ main (int argc, char **argv)
test_fail_if (nint != TM_VALID_NB);
u32 *mask = (mac_config.tonemask_info.tonemask);
u8 tmp[PHY_CARRIER_NB];
- u8 *tm_data = sta->tx_tonemaps->tm[DEFAULT_TMI-4]->tmdma_desc_head->data;
+ u8 *tm_data = sta->tx_tonemaps->tm[DEFAULT_TMI]->tmdma_desc_head->data;
for (i=0; i<PHY_CARRIER_NB; i++)
{
- if (i==1024) tm_data = sta->tx_tonemaps->tm[DEFAULT_TMI-4]->tmdma_desc_head->next->data;
+ if (i==1024) tm_data = sta->tx_tonemaps->tm[DEFAULT_TMI]->tmdma_desc_head->next->data;
uint n1 = (uint) *tm_data++;
uint n2 = n1>>4;
n1 = n1&0xF;
diff --git a/cesar/ce/tx.h b/cesar/ce/tx.h
new file mode 100644
index 0000000000..8ab68e414d
--- /dev/null
+++ b/cesar/ce/tx.h
@@ -0,0 +1,67 @@
+#ifndef ce_tx_h
+#define ce_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/cp.h"
+#include "lib/bitstream.h"
+
+
+typedef struct txce_t txce_t;
+
+BEGIN_DECLS
+
+/**
+ * Initialize the global structure of txce context.
+ * \param mac_store_ctx Access to the sta.
+ * \param mac_config_ctx Access to the tonemask.
+ *
+ */
+void
+txce_init (cp_t *cp_ctx, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx);
+
+/**
+ * Control Plane function called when a mme arrives and correspond to a cei
+ * mmtype or when CP manages a TXCE_EVENT.
+ * \param ctx CP context.
+ * \param stei Source station of message received.
+ * \param mmtype Message type CM_TM_UPDATE.IND or CM_CHAN_EST.IND
+ * \param stream_reader bitstream_access provided by CP at 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 reload 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 (cp_t *cp_ctx, uint stei, u32 mmtype, bitstream_t *stream_reader);
+
+END_DECLS
+
+#endif /* ce_tx_h */
diff --git a/cesar/cp/fsm/src/fsm/cp.fsm b/cesar/cp/fsm/src/fsm/cp.fsm
index 8b0c5d286f..4576b35340 100644
--- a/cesar/cp/fsm/src/fsm/cp.fsm
+++ b/cesar/cp/fsm/src/fsm/cp.fsm
@@ -497,6 +497,8 @@ CCO, AUTHENTICATED, SC_CCO:
CM_BRG_INFO_CNF -> . [cp_sta_action_process_cm_brg_info_cnf]
CM_BRG_INFO_REQ -> . [cp_sta_action_process_cm_brg_info_req]
first_com_with_auth_sta -> . [cp_sta_action_bridge_first_com]
+ CM_CHAN_EST_IND -> . [cp_sta_action_process__cm_chan_est_ind]
+ CM_TM_UPDATE_IND -> . [cp_sta_action_process__cm_chan_est_ind]
SC_IDLE:
sc_start_add -> SC_ADD [NULL]
diff --git a/cesar/cp/inc/context.h b/cesar/cp/inc/context.h
index 9b58019663..bfd72baeab 100644
--- a/cesar/cp/inc/context.h
+++ b/cesar/cp/inc/context.h
@@ -51,6 +51,7 @@
#include "cp/msg/inc/context.h"
#include "cp/fsm/inc/context.h"
#include "cp/pwl/inc/pwl.h"
+#include "ce/inc/tx.h"
enum cp_handover_reason_t
@@ -155,6 +156,9 @@ struct cp_t
/** Handover context. */
struct cp_handover_t handover;
+
+ /** TXCE context. */
+ txce_t *txce;
};
#endif /* cp_inc_cp_h */
diff --git a/cesar/cp/msg/src/msg.c b/cesar/cp/msg/src/msg.c
index 317ef78ed8..5ebed15205 100644
--- a/cesar/cp/msg/src/msg.c
+++ b/cesar/cp/msg/src/msg.c
@@ -316,6 +316,12 @@ cp_msg_dispatch (cp_t *ctx, cp_mme_rx_t *mme)
case CM_BRG_INFO_CNF:
type = CP_FSM_EVENT_TYPE_CM_BRG_INFO_CNF;
break;
+ case CM_CHAN_EST_IND:
+ type = CP_FSM_EVENT_TYPE_CM_CHAN_EST_IND;
+ break;
+ case CM_TM_UPDATE_IND:
+ type = CP_FSM_EVENT_TYPE_CM_TM_UPDATE_IND;
+ break;
case CC_HANDOVER_REQ:
type = CP_FSM_EVENT_TYPE_CC_HANDOVER_REQ;
break;
diff --git a/cesar/cp/src/cp.c b/cesar/cp/src/cp.c
index 5c216f15cb..3d0923b96f 100644
--- a/cesar/cp/src/cp.c
+++ b/cesar/cp/src/cp.c
@@ -94,6 +94,9 @@ cp_init (mac_config_t * mac_config, interface_t * interface,
/* Init the random generator. */
lib_rnd_init (&cp_global.rnd, seed ^ 0x87543571);
+ /* Init TXCE context. */
+ txce_init (&cp_global, mac_store, mac_config);
+
return &cp_global;
}
diff --git a/cesar/cp/sta/action/info.h b/cesar/cp/sta/action/info.h
index 74cbd62f95..3202ca13ff 100644
--- a/cesar/cp/sta/action/info.h
+++ b/cesar/cp/sta/action/info.h
@@ -48,6 +48,19 @@ cp_sta_action_process_cc_set_tei_map_ind (cp_t *ctx, cp_mme_rx_t *mme);
void
cp_sta_action_process_cm_unassociated_sta_ind (cp_t *ctx, cp_mme_rx_t *mme);
+/**
+ * Process a CM_CHAN_EST.IND or CM_TM_UPDATE.IND, 11.5.10.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Update the mac_store tonemaps list.
+ *
+ * Update:
+ * - tonemaps.
+ */
+void
+cp_sta_action_process__cm_chan_est_ind (cp_t *ctx, cp_mme_rx_t *mme);
+
END_DECLS
#endif /* cp_sta_action_info_h */
diff --git a/cesar/cp/sta/action/src/info.c b/cesar/cp/sta/action/src/info.c
index 7e1a087371..c0dd0f5d03 100644
--- a/cesar/cp/sta/action/src/info.c
+++ b/cesar/cp/sta/action/src/info.c
@@ -18,6 +18,7 @@
#include "cp/sta/mgr/sta_mgr.h"
#include "cp/fsm/fsm.h"
#include "lib/slab.h"
+#include "ce/tx.h"
void
cp_sta_action_process_cc_set_tei_map_ind (cp_t *ctx, cp_mme_rx_t *mme)
@@ -113,3 +114,8 @@ cp_sta_action_process_cm_unassociated_sta_ind (cp_t *ctx, cp_mme_rx_t *mme)
}
}
+void
+cp_sta_action_process__cm_chan_est_ind (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ txce (ctx, mme->peer.tei, mme->mmtype, &mme->bitstream);
+}
diff --git a/cesar/hal/phy/maximus/src/maximus_phy_ctrl.c b/cesar/hal/phy/maximus/src/maximus_phy_ctrl.c
index 6c72aa6c0c..153618a33c 100644
--- a/cesar/hal/phy/maximus/src/maximus_phy_ctrl.c
+++ b/cesar/hal/phy/maximus/src/maximus_phy_ctrl.c
@@ -1268,7 +1268,9 @@ maximus_phy_recv_noise (phy_t *ctx, sci_msg_t *msg)
* or if 'phy_pbdma_start_chandata()' has been called,
* a chandata end interrupt is simulated by calling phy_pbdma_cb callback. */
ctx->pbdma.status_word.end_chandata = 1;
+#ifndef RXCE_PBPROC_MAXIMUS_TEST
maximus_pending_isrs |= (1 << PHY_HAL_INTERRUPT_PBDMA);
+#endif
}
else // ctx->pbdma.chandata_transfer = false
{
diff --git a/cesar/hal/phy/pbdma.h b/cesar/hal/phy/pbdma.h
index 693a2d6aba..f812438faa 100644
--- a/cesar/hal/phy/pbdma.h
+++ b/cesar/hal/phy/pbdma.h
@@ -56,7 +56,7 @@ typedef struct phy_pb_rx_t phy_pb_rx_t;
* Cf DATA_CHANNEL_MUX SPECIFICATIONS.
* PLEASE, if any changement appears here, adapt initialisation of
* mpdu_measure_store.c in mpdu_measurement_store_init about
- * mpdu_measure_chandata_blk_nb[PHY_CHANDATZ_TYPE_NB].
+ * mpdu_measure_chandata_blk_nb[PHY_CHANDATA_TYPE_NB].
*/
enum phy_chandata_type_t
{
diff --git a/cesar/mac/common/src/tonemap.c b/cesar/mac/common/src/tonemap.c
index 700abacb6e..b5e6e199de 100644
--- a/cesar/mac/common/src/tonemap.c
+++ b/cesar/mac/common/src/tonemap.c
@@ -39,7 +39,7 @@ tonemap_set_first_free (tonemaps_t *tms, tonemap_t *tm)
{
int i;
dbg_assert (tms);
- for (i = 0; i < TONEMAP_INDEX_NB; i++)
+ for (i = NEGOCIATED_TONEMAP_INDEX_FIRST; i < TONEMAP_INDEX_NB; i++)
{
if (!tms->tm[i])
{
diff --git a/cesar/mac/common/tonemap.h b/cesar/mac/common/tonemap.h
index 964b97a765..8d19b809da 100644
--- a/cesar/mac/common/tonemap.h
+++ b/cesar/mac/common/tonemap.h
@@ -39,6 +39,9 @@ enum tonemap_index_t
TONEMAP_INDEX_INTERVAL_SOUND_COMPLETE = 0xf0,
};
+#define NEGOCIATED_TONEMAP_INDEX_FIRST 4
+#define IS_NEGOCIATED_TONEMAP_INDEX(tmi) ( (tmi >= NEGOCIATED_TONEMAP_INDEX_FIRST) && (tmi< TONEMAP_INDEX_NB))
+
/** Maximum number of tonemap intervals. */
#define TONEMAP_INTERVAL_NB 32
diff --git a/cesar/station/src/station.c b/cesar/station/src/station.c
index 1e3f761a0e..c9d05f006b 100644
--- a/cesar/station/src/station.c
+++ b/cesar/station/src/station.c
@@ -72,7 +72,7 @@ cesar_init (void)
cesar.pbproc, cesar.mac_store, cesar.sar, cesar.cl,
seed);
- cesar.rxce = ce_init(cesar.sar);
+ cesar.rxce = rxce_init(cesar.sar, cesar.mac_store, &cesar.mac_config, cesar.cp);
// start HLE...
hle_activate(cesar.hle, true);
@@ -94,7 +94,7 @@ cesar_uninit (cesar_t *ctx)
cl_uninit (ctx->cl);
sar_uninit (ctx->sar);
pbproc_uninit (ctx->pbproc);
- ce_uninit (ctx->rxce);
+ rxce_uninit (ctx->rxce);
mac_store_uninit (ctx->mac_store);
hal_timer_uninit (cesar.hal_timer);
diff --git a/cesar/test_general/station/common/Module b/cesar/test_general/station/common/Module
index 067ecd9cc4..d09877d1fd 100644
--- a/cesar/test_general/station/common/Module
+++ b/cesar/test_general/station/common/Module
@@ -1 +1 @@
-SOURCES := station.c ntb_stub.c region_stub.c ce_stub.c bw_stub.c
+SOURCES := station.c ntb_stub.c region_stub.c ce_stub.c bw_stub.c txce_stub.c
diff --git a/cesar/test_general/station/common/override/ce/inc/tx.h b/cesar/test_general/station/common/override/ce/inc/tx.h
new file mode 100644
index 0000000000..c6029a8506
--- /dev/null
+++ b/cesar/test_general/station/common/override/ce/inc/tx.h
@@ -0,0 +1,28 @@
+#ifndef ce_inc_tx_h
+#define ce_inc_tx_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 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
+ *
+ * « long description »
+ */
+
+#include "ce/tx.h"
+
+/** Global structure for txce context */
+struct txce_t
+{
+ uint test;
+};
+
+
+#endif /* ce_inc_tx_h */
diff --git a/cesar/test_general/station/common/override/ce/tx.h b/cesar/test_general/station/common/override/ce/tx.h
new file mode 100644
index 0000000000..7b085af37a
--- /dev/null
+++ b/cesar/test_general/station/common/override/ce/tx.h
@@ -0,0 +1,30 @@
+#ifndef ______common_override_ce_inc_tx_h
+#define ______common_override_ce_inc_tx_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file ../../common/override/ce/inc/tx.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+#include "cp/cp.h"
+
+typedef struct txce_t txce_t;
+
+
+txce_t *
+txce_init (cp_t *cp, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx);
+
+void
+txce (txce_t *ctx, uint stei, u32 mmtype, u8 *mm_entry);
+
+
+#endif /* ______common_override_ce_inc_tx_h */
diff --git a/cesar/test_general/station/common/src/ce_stub.c b/cesar/test_general/station/common/src/ce_stub.c
index fcc7d67c10..e8af97a9eb 100644
--- a/cesar/test_general/station/common/src/ce_stub.c
+++ b/cesar/test_general/station/common/src/ce_stub.c
@@ -14,7 +14,7 @@
*/
#include "common/std.h"
#include "ce/rx.h"
-
+#include "cp/cp.h"
#include "mac/sar/sar.h"
static rxce_t rxce;
@@ -35,7 +35,7 @@ ce_measurement (void *user, pbproc_rx_params_t *rx_params,
}
rxce_t *
-ce_init (sar_t *sar)
+rxce_init (sar_t *sar, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx, cp_t *cp_ctx)
{
sar_init_measure_context (sar, &rxce);
sar_init_measurement_cb (sar, ce_measurement);
diff --git a/cesar/test_general/station/common/src/txce_stub.c b/cesar/test_general/station/common/src/txce_stub.c
new file mode 100644
index 0000000000..6dc1896edd
--- /dev/null
+++ b/cesar/test_general/station/common/src/txce_stub.c
@@ -0,0 +1,30 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file ../../common/override/ce/src/txce.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "ce/inc/tx.h"
+
+txce_t *
+txce_init (cp_t *cp, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx)
+{
+ return NULL;
+}
+
+void
+txce (txce_t *ctx, uint stei, u32 mmtype, u8 *mm_entry)
+{
+ return;
+}
+