summaryrefslogtreecommitdiff
path: root/ce
diff options
context:
space:
mode:
authorlacour2008-03-05 10:28:14 +0000
committerlacour2008-03-05 10:28:14 +0000
commitc7c7c71c69433a4fc41de859863072e90a0dd227 (patch)
treec62391d35bb21ad26950ede827872dabfa63e4a0 /ce
parent3e0fdc23dcdbbb760093be551cb5e99ffa64a462 (diff)
CEI interface update.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1560 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'ce')
-rwxr-xr-xce/inc/cei.h125
-rwxr-xr-xce/src/rx.c4
-rwxr-xr-xce/src/tx.c2
-rw-r--r--ce/test/rx/general/overide/cp/src/cp.c10
-rwxr-xr-xce/test/rx/general/src/test_cei.c7
5 files changed, 79 insertions, 69 deletions
diff --git a/ce/inc/cei.h b/ce/inc/cei.h
index 98a1634fb5..3a831035b4 100755
--- a/ce/inc/cei.h
+++ b/ce/inc/cei.h
@@ -14,7 +14,7 @@
*
*/
-#include "ce/inc/cei_param.h"
+//#include "ce/inc/cei_param.h"
#include "mac/common/tonemask.h"
#include "mac/common/timings.h"
#include "ce/test/common/print_utils.h"
@@ -27,6 +27,15 @@
//TODO Accelerate access in tonemap and tonemask management.
+struct cei_created_information_t
+{
+ /** Length of mm_entry. */
+ uint length;
+ /** type of created CEI to send.*/
+ uint mm_type;
+};
+typedef struct cei_created_information_t cei_created_information_t;
+
BEGIN_DECLS
@@ -49,7 +58,7 @@ STREAM_WRITE (bitstream_t *ptr, uint val, uint length)
*
*/
static uint
-cei_encode_tm (bitstream_t *ctx_stream, blk_t *tm, u8 *mask)
+cei_tmdata_encode (bitstream_t *ctx_stream, blk_t *tm, u8 *mask)
{
uint nibbles[1155];
int c=0;
@@ -135,18 +144,24 @@ cei_encode_tm (bitstream_t *ctx_stream, blk_t *tm, u8 *mask)
/**
* Write a cei message in a buffer. // Only mmentry.
- * \param param define the set and index of tonemap concerned to create a
- * cei message.
- * \param dest_buffer start of mmentry buffer.
- * \param mask tonemask
- * \return length of the mmentry
+ * \param dest_mm_entry start of mmentry buffer.
+ * \param mask tonemask.
+ * \param rx_tonemaps Set of tonemap used to create the CEI.
+ * \param new_tmi Tonemap index of set whose data must be sent. If no tonemap
+ * data must be sent, new_tmi must be TONEMAP_INDEX_NULL.
+ * \param old_tmi Tonemap index from which the new tonemap has been computed.
+ * If old_tmi is TONEMAP_INDEX_NULL, a CM_CHAN_EST.IND must be created,
+ * else a CM_UPDATE_TM.IND must be created.
+ * \return cei_created_information necessary to send CEI via the CP.
*
- * function calls encode_tm for the Run Length Encoding. Encoding is done
+ * function calls cei_tmdata_encode for the Run Length Encoding. Encoding is done
* every time even if it is not interresting because it can be worst. (except
* for time ).
+ * TODO : Management of old_tmi to create a CM_UPDATE_TM.IND instead of
+ * CM_CHAN_EST.IND
*/
-static uint // length of the mmentry.
-cei_tonemaps_to_mme (cei_param_t *param, u8 *dest_buffer, u8 *mask)
+static cei_created_information_t
+cei_create (u8 *dest_mm_entry, u8 *mask, tonemaps_t *rx_tonemaps, uint new_tmi, uint old_tmi)
{
bitstream_t stream_writer;
bitstream_t *w_ptr = &stream_writer;
@@ -154,41 +169,37 @@ cei_tonemaps_to_mme (cei_param_t *param, u8 *dest_buffer, u8 *mask)
u8 valid_tm_list_lg=0;
u8 respt = 0x00;
uint mme_len;
- tonemaps_t *tms;
- uint new_tmi;
tonemap_t *new_tm;
uint entry_nb;
- dbg_assert (dest_buffer);
- tms = param->tms;
- dbg_assert (tms);
- valid_tm_list_lg = tonemap_valid_nb (tms);
- bitstream_init (w_ptr, dest_buffer, 1518, BITSTREAM_WRITE );
- STREAM_WRITE (w_ptr, tms->max_fl_av, 16);
- STREAM_WRITE (w_ptr, tms->rifs_av_one_sym_tck / MAC_TCK_PER_FL, 8);
- STREAM_WRITE (w_ptr, tms->rifs_av_two_sym_tck / MAC_TCK_PER_FL, 8);
- STREAM_WRITE (w_ptr, tms->rifs_av_g2_sym_tck / MAC_TCK_PER_FL, 8);
+ dbg_assert (dest_mm_entry);
+ dbg_assert (rx_tonemaps);
+ valid_tm_list_lg = tonemap_valid_nb (rx_tonemaps);
+ bitstream_init (w_ptr, dest_mm_entry, 1518, BITSTREAM_WRITE );
+ STREAM_WRITE (w_ptr, rx_tonemaps->max_fl_av, 16);
+ STREAM_WRITE (w_ptr, rx_tonemaps->rifs_av_one_sym_tck / MAC_TCK_PER_FL, 8);
+ STREAM_WRITE (w_ptr, rx_tonemaps->rifs_av_two_sym_tck / MAC_TCK_PER_FL, 8);
+ STREAM_WRITE (w_ptr, rx_tonemaps->rifs_av_g2_sym_tck / MAC_TCK_PER_FL, 8);
STREAM_WRITE(w_ptr, respt, 8);
- STREAM_WRITE(w_ptr, tms->max_tm, 8);
- STREAM_WRITE(w_ptr, tms->default_tmi, 8);
- STREAM_WRITE(w_ptr, (u8)tms->scl_cp, 8);
- STREAM_WRITE(w_ptr, (u8)tms->scl_cfp, 8);
+ STREAM_WRITE(w_ptr, rx_tonemaps->max_tm, 8);
+ STREAM_WRITE(w_ptr, rx_tonemaps->default_tmi, 8);
+ STREAM_WRITE(w_ptr, (u8)rx_tonemaps->scl_cp, 8);
+ STREAM_WRITE(w_ptr, (u8)rx_tonemaps->scl_cfp, 8);
STREAM_WRITE(w_ptr, valid_tm_list_lg, 8);
- for (i=0; i<TONEMAP_INDEX_NB; i++) if (tms->tm[i])
+ for (i=0; i<TONEMAP_INDEX_NB; i++) if (rx_tonemaps->tm[i])
{
STREAM_WRITE(w_ptr, i+4, 8);
}
- tonemap_intervals_t *intervals = tms->intervals;
+ tonemap_intervals_t *intervals = rx_tonemaps->intervals;
STREAM_WRITE(w_ptr, intervals->intervals_nb, 8);
for (i=0; i<(int)intervals->intervals_nb; i++)
{
STREAM_WRITE(w_ptr, intervals->interval[i].end_offset_atu, 16);
STREAM_WRITE(w_ptr, intervals->interval[i].tmi, 8);
}
- new_tmi = param->new_tmi;
if(new_tmi != TONEMAP_INDEX_NULL)
{
- new_tm=tms->tm[new_tmi];
+ new_tm=rx_tonemaps->tm[new_tmi];
dbg_assert_ptr (new_tm);
STREAM_WRITE(w_ptr, new_tmi+4, 8);
STREAM_WRITE(w_ptr, new_tm->cpf, 8);
@@ -198,13 +209,15 @@ cei_tonemaps_to_mme (cei_param_t *param, u8 *dest_buffer, u8 *mask)
u32 *entry_nb_address = stream_writer.stream;
u32 entry_nb_offset = stream_writer.bit_offset;
STREAM_WRITE(w_ptr, 0xFFFF, 16);
- entry_nb = cei_encode_tm (&stream_writer, new_tm->tmdma_desc_head, mask);
+ entry_nb = cei_tmdata_encode (&stream_writer, new_tm->tmdma_desc_head, mask);
bitstream_direct_write (entry_nb_address, entry_nb_offset, entry_nb, 16);
}
bitstream_finalise (&stream_writer);
mme_len = ((u32) stream_writer.stream) - ((u32)stream_writer.start) + ((stream_writer.bit_offset+7)/8);
- param->length = mme_len;
- return(mme_len);
+ cei_created_information_t ret;
+ ret.length = mme_len;
+ ret.mm_type = CM_CHAN_EST_IND;
+ return(ret);
}
#endif
@@ -224,14 +237,14 @@ cei_tone_write (bitstream_t *stream_writer, uint tone, uint *write_nb, u8 *next_
/**
* Update a set of tonemap from cei message.
- * \param tms set of tonemaps to update.
+ * \param tx_tonemaps_to_update set of tonemaps to update.
* \param mm_type type of cei message
* \param mm_entry start address of mmentry.
* \param mask tonemask
* \return the valid tonemap. [A32...A0] bits set if valid.
*/
static u32 // valid_tonemap u32 as 32 tonemap max.
-cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
+cei_decode (tonemaps_t *tx_tonemaps_to_update, int mm_type, u8 *mm_entry, u8 *mask)
{
//TODO switch MMTYPE
int i,j;
@@ -250,22 +263,22 @@ cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
uint write_nb = 0;
bitstream_init (&stream_reader, mm_entry, 1518, BITSTREAM_READ);
bitstream_access (&stream_reader, &read, 16);
- tms->max_fl_av = read;
+ tx_tonemaps_to_update->max_fl_av = read;
bitstream_access (&stream_reader, &read, 8);
- tms->rifs_av_one_sym_tck = read*MAC_TCK_PER_FL;
+ tx_tonemaps_to_update->rifs_av_one_sym_tck = read*MAC_TCK_PER_FL;
bitstream_access (&stream_reader, &read, 8);
- tms->rifs_av_two_sym_tck = read*MAC_TCK_PER_FL;
+ tx_tonemaps_to_update->rifs_av_two_sym_tck = read*MAC_TCK_PER_FL;
bitstream_access (&stream_reader, &read, 8);
- tms->rifs_av_g2_sym_tck = read*MAC_TCK_PER_FL;
+ 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);
- tms->max_tm = read;
+ tx_tonemaps_to_update->max_tm = read;
bitstream_access (&stream_reader, &read, 8);
tmp_default_tmi = read;
bitstream_access (&stream_reader, &read, 8);
- tms->scl_cp = read;
+ tx_tonemaps_to_update->scl_cp = read;
bitstream_access (&stream_reader, &read, 8);
- tms->scl_cfp = read;
+ tx_tonemaps_to_update->scl_cfp = read;
bitstream_access (&stream_reader, &valid_nb, 8);
tonemaps_valid_status = 0;
@@ -277,15 +290,15 @@ cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
sort = tonemaps_valid_status;
for (i=0; i<TONEMAP_INDEX_NB; i++)
{
- if ( ((sort & 0x01) == 0x01) && (!tms->tm[i]) )
+ if ( ((sort & 0x01) == 0x01) && (!tx_tonemaps_to_update->tm[i]) )
{
- tms->tm[i] = tonemap_alloc();
+ tx_tonemaps_to_update->tm[i] = tonemap_alloc();
}
- if ( ((sort & 0x01) == 0x00) && (tms->tm[i]) ) tonemap_release (tms, i);
+ if ( ((sort & 0x01) == 0x00) && (tx_tonemaps_to_update->tm[i]) ) tonemap_release (tx_tonemaps_to_update, i);
sort = sort >> 1;
}
- tonemap_intervals_t *intervals = tms->intervals;
- if (intervals != tms->swap_intervals) intervals++;
+ 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);
intervals->intervals_nb = read;
@@ -304,22 +317,22 @@ cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
if(new_tmi>=4)
{
new_tmi-=4;
- dbg_assert (tms->tm[new_tmi]);
- dbg_assert (tms->tm[new_tmi]->tmdma_desc_head);
+ 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);
- tms->tm[new_tmi]->cpf = read;
+ tx_tonemaps_to_update->tm[new_tmi]->cpf = read;
bitstream_access (&stream_reader, &read, 8);
- tms->tm[new_tmi]->fecrate = read;
+ tx_tonemaps_to_update->tm[new_tmi]->fecrate = read;
bitstream_access (&stream_reader, &read, 8);
- tms->tm[new_tmi]->gil = read;
+ tx_tonemaps_to_update->tm[new_tmi]->gil = read;
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_init (&stream_writer, tms->tm[new_tmi]->tmdma_desc_head->data, BLK_SIZE, BITSTREAM_WRITE);
- u8 *next_data = tms->tm[new_tmi]->tmdma_desc_head->next->data;
+ 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);
int c=0;
@@ -380,10 +393,10 @@ cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
}
bitstream_finalise (&stream_writer);
// ATOMIC switch intervals
- tms->intervals = intervals;
+ tx_tonemaps_to_update->intervals = intervals;
// ATOMIC set tonemap default;
- tms->default_tmi = tmp_default_tmi;
- tms->expiration_rtc_date = cyg_current_time() + S_TO_RTC (TONEMAPS_LIFE_DURATION_S);
+ 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);
return (tonemaps_valid_status);
}
#endif
diff --git a/ce/src/rx.c b/ce/src/rx.c
index 6e171a9b31..57c93d117d 100755
--- a/ce/src/rx.c
+++ b/ce/src/rx.c
@@ -302,12 +302,12 @@ rxce_process (cyg_addrword_t data)
#ifdef EXPIRATION_TEST
expiration_test (param->dtei);
#endif
- cei_tonemaps_to_mme (param, buf, ctx->mask);
+ cei_create (buf, ctx->mask, param->tms, param->new_tmi, param->old_tmi);
ce_print_buffer (buf, ETH_PACKET_MAX_SIZE);
interf_send (buf, param->length, param->dtei, param->priority);
#ifdef MAXIMUS_TEST
sta_t *sta = mac_store_sta_get (ctx->mac_store_ctx, param->dtei);
- cei_decoding (sta->tx_tonemaps, CM_CHAN_EST_IND, buf, ctx->mask);
+ cei_decode (sta->tx_tonemaps, CM_CHAN_EST_IND, buf, ctx->mask);
#endif
}
else
diff --git a/ce/src/tx.c b/ce/src/tx.c
index aa48a7801b..4617da328f 100755
--- a/ce/src/tx.c
+++ b/ce/src/tx.c
@@ -91,7 +91,7 @@ txce_rcv_mme (txce_t *ctx, uint stei, u32 mmtype, u8 *mm_entry)
// 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_decoding (source_tms, mmtype, mm_entry, ctx->tonemask);
+ cei_decode (source_tms, mmtype, mm_entry, ctx->tonemask);
blk_release (source_sta);
}
cyg_tick_count_t next_expiration = txce_expiration_tonemaps_management (ctx);
diff --git a/ce/test/rx/general/overide/cp/src/cp.c b/ce/test/rx/general/overide/cp/src/cp.c
index 4f2cc8ba0f..7efb105e8a 100644
--- a/ce/test/rx/general/overide/cp/src/cp.c
+++ b/ce/test/rx/general/overide/cp/src/cp.c
@@ -75,14 +75,14 @@ cp_emul_cei_reception (cp_t *ctx)
uint rnd_tei = lib_rnd_uniform (&rnd, MAC_TEI_STA_MAX) + MAC_TEI_STA_MIN;
mac_store_sta_add (ctx->mac_store_ctx, rnd_tei);
sta_t *lsta = mac_store_sta_get (ctx->mac_store_ctx, rnd_tei);
- cei_param_t param;
- param.tms = lsta->tx_tonemaps;
+ //cei_param_t param;
+ //param.tms = lsta->tx_tonemaps;
if (lsta->tx_tonemaps->tm[rnd_tmi] == NULL)
{
- param.new_tmi = rnd_tmi;
+ //param.new_tmi = rnd_tmi;
ce_print ("adding sta[%d]->tx_tonemaps->tm[%d] @%llu\n", rnd_tei, rnd_tmi, cyg_current_time());
- create_tm (param.tms, ctx->tonemask, rnd_tmi, 1, 4);
- cei_tonemaps_to_mme (&param, ctx->cei_buffer, ctx->tonemask);
+ create_tm (lsta->tx_tonemaps, ctx->tonemask, rnd_tmi, 1, 4);
+ cei_create (ctx->cei_buffer, ctx->tonemask, lsta->tx_tonemaps, rnd_tmi, TONEMAP_INDEX_NULL);
txce_rcv_mme (ctx->txce_ctx, rnd_tei, CM_CHAN_EST_IND, ctx->cei_buffer);
}
}
diff --git a/ce/test/rx/general/src/test_cei.c b/ce/test/rx/general/src/test_cei.c
index e60c7b45a1..d356acff17 100755
--- a/ce/test/rx/general/src/test_cei.c
+++ b/ce/test/rx/general/src/test_cei.c
@@ -26,14 +26,11 @@ test_exchange (test_t test, tonemaps_t *rx_tms, tonemaps_t *tx_tms,
{
u8 buffer[1536];
int i; for (i=0; i<1536; i++) buffer[i]=0;
- cei_param_t param;
- param.tms = rx_tms;
- param.new_tmi = tmi;
create_tm (rx_tms, mask, tmi, max_rnd, offset);
ce_print_tonemaps (rx_tms);
- cei_tonemaps_to_mme (&param, buffer, mask);
+ cei_create (buffer, mask, rx_tms, tmi, TONEMAP_INDEX_NULL);
ce_print_buffer (buffer, 512);
- cei_decoding (tx_tms, CM_CHAN_EST_IND, buffer, mask);
+ cei_decode (tx_tms, CM_CHAN_EST_IND, buffer, mask);
ce_print_tonemaps (tx_tms);
compare_tonemaps (test, rx_tms, tx_tms, mask);
}