summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaranjeiro2008-08-28 08:32:03 +0000
committerlaranjeiro2008-08-28 08:32:03 +0000
commit404b931062d845caf3b167ccafc4648b0b5aba68 (patch)
tree14c034906966d65fbb496f24c6f54bb0ed76f143
parent96f561bac173928a0c4a3fc73568919b05234588 (diff)
cp2/beacon: Replace the circular buffer by a chained beacon list.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2781 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/cp2/beacon/doc/beacons.xmi53
-rw-r--r--cesar/cp2/beacon/inc/beacon.h9
-rw-r--r--cesar/cp2/beacon/src/beacon.c21
-rw-r--r--cesar/cp2/beacon/test/src/beacon.c7
4 files changed, 46 insertions, 44 deletions
diff --git a/cesar/cp2/beacon/doc/beacons.xmi b/cesar/cp2/beacon/doc/beacons.xmi
index d51d0da83f..be471344f3 100644
--- a/cesar/cp2/beacon/doc/beacons.xmi
+++ b/cesar/cp2/beacon/doc/beacons.xmi
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-07-03T10:49:08" xmi.version="1.2" >
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-08-28T10:33:16" xmi.version="1.2" >
<XMI.header>
<XMI.documentation>
<XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
@@ -13,6 +13,7 @@
<UML:Namespace.ownedElement>
<UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
<UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
<UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
<UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
<UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
@@ -72,7 +73,8 @@
</UML:Package>
<UML:Class comment="Beacon module. Use to generate and read a beacon." isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="NiCCTMNHialM" isRoot="false" isAbstract="false" name="cp_beacon_t" >
<UML:Classifier.feature>
- <UML:Attribute comment="Circular buffer of beacons." isSpecification="false" visibility="private" xmi.id="ztR22PRRfzxc" type="v6WaaUrdS1Jv" name="list" />
+ <UML:Attribute comment="Circular buffer of beacons." isSpecification="false" visibility="private" xmi.id="ztR22PRRfzxc" type="sSOkyZ3vfjJC" name="list" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="684" type="sSOkyZ3vfjJC" name="list_tail" />
<UML:Attribute comment="table of beacon received." isSpecification="false" visibility="private" xmi.id="oloPbj9IOHgn" type="2pjetCZaTBxu" name="beacon_list[10]" />
<UML:Attribute comment="Bentry manager." isSpecification="false" visibility="private" xmi.id="16U2YvTJxiuS" type="l6bOvueVxeym" name="bentry" />
<UML:Attribute comment="Central beacon environment." isSpecification="false" visibility="private" xmi.id="mUavKhrt5Qso" type="S9eUo7DcuX3j" name="central" />
@@ -386,7 +388,7 @@ If next tei is 0. the CCo shall send a discover beacon." isSpecification="false"
<UML:Operation comment="Compute the interval in beacon periods." isSpecification="false" isLeaf="false" visibility="public" xmi.id="eNjKLEQ0IyQG" isRoot="false" isAbstract="false" isQuery="false" name="compute_interval" />
<UML:Operation comment="Verify if any request shall be done." isSpecification="false" isLeaf="false" visibility="public" xmi.id="PA7gKfvNEW2s" isRoot="false" isAbstract="false" isQuery="false" name="need_to_request" >
<UML:BehavioralFeature.parameter>
- <UML:Parameter kind="return" xmi.id="502" type="cnaRv3q3OkSQ" />
+ <UML:Parameter kind="return" xmi.id="1343" type="cnaRv3q3OkSQ" />
<UML:Parameter comment="The TEI to request.
0 = The CCo shall send a discover beacon." isSpecification="false" visibility="private" xmi.id="I5AS7ZUmxD4G" value="" type="jPVvvXoCdyei" name="tei" />
</UML:BehavioralFeature.parameter>
@@ -429,46 +431,46 @@ If next tei is 0. the CCo shall send a discover beacon." isSpecification="false"
</widgets>
<messages/>
<associations>
- <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="3" indexb="2" linewidth="none" widgetbid="l6bOvueVxeym" widgetaid="NiCCTMNHialM" xmi.id="16U2YvTJxiuS" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="BRZRZeOQHv7A" widgetaid="l6bOvueVxeym" xmi.id="r6p2osooXEU8" linecolor="none" >
+ <linepath>
+ <startpoint startx="467" starty="230" />
+ <endpoint endx="506" endy="124" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="tp3zqQkaUmuu" widgetaid="l6bOvueVxeym" xmi.id="dKCSOea5360x" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="167" starty="454" />
+ <endpoint endx="161" endy="483" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="70" usesdiagramusefillcolour="1" x="163" y="461" linewidth="none" posttext="" role="710" fillcolour="none" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="133" text="discover" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="201" totalcountb="3" indexb="2" linewidth="none" widgetbid="l6bOvueVxeym" widgetaid="NiCCTMNHialM" xmi.id="16U2YvTJxiuS" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
<linepath>
<startpoint startx="373" starty="623" />
<endpoint endx="317" endy="454" />
</linepath>
- <floatingtext usesdiagramfillcolour="1" width="53" usesdiagramusefillcolour="1" x="378" y="456" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="+" isinstance="0" xmi.id="129" text="bentry" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="48" usesdiagramusefillcolour="1" x="319" y="456" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="822" showstereotype="1" text="bentry" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
- <assocwidget totalcounta="4" indexa="1" visibilityB="200" totalcountb="4" indexb="1" linewidth="none" widgetbid="S9eUo7DcuX3j" widgetaid="NiCCTMNHialM" xmi.id="mUavKhrt5Qso" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <assocwidget totalcounta="4" indexa="1" visibilityB="201" totalcountb="4" indexb="1" linewidth="none" widgetbid="S9eUo7DcuX3j" widgetaid="NiCCTMNHialM" xmi.id="mUavKhrt5Qso" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
<linepath>
<startpoint startx="741" starty="771" />
<endpoint endx="826" endy="706" />
</linepath>
- <floatingtext usesdiagramfillcolour="1" width="56" usesdiagramusefillcolour="1" x="901" y="796" linewidth="none" posttext="" role="710" fillcolour="none" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="130" text="central" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="51" usesdiagramusefillcolour="1" x="839" y="708" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="827" showstereotype="1" text="central" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
- <assocwidget totalcounta="4" indexa="2" visibilityB="200" totalcountb="4" indexb="2" linewidth="none" widgetbid="S9eUo7DcuX3j" widgetaid="NiCCTMNHialM" xmi.id="ZTjeucQLNU0V" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <assocwidget totalcounta="4" indexa="2" visibilityB="201" totalcountb="4" indexb="2" linewidth="none" widgetbid="S9eUo7DcuX3j" widgetaid="NiCCTMNHialM" xmi.id="ZTjeucQLNU0V" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
<linepath>
<startpoint startx="741" starty="919" />
<endpoint endx="892" endy="706" />
</linepath>
- <floatingtext usesdiagramfillcolour="1" width="65" usesdiagramusefillcolour="1" x="910" y="760" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="+" isinstance="0" xmi.id="131" text="discover" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="60" usesdiagramusefillcolour="1" x="873" y="708" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="832" text="discover" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
- <assocwidget totalcounta="4" indexa="3" visibilityB="200" totalcountb="4" indexb="3" linewidth="none" widgetbid="S9eUo7DcuX3j" widgetaid="NiCCTMNHialM" xmi.id="ZMhwrhPy4npv" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <assocwidget totalcounta="4" indexa="3" visibilityB="201" totalcountb="4" indexb="3" linewidth="none" widgetbid="S9eUo7DcuX3j" widgetaid="NiCCTMNHialM" xmi.id="ZMhwrhPy4npv" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
<linepath>
<startpoint startx="741" starty="1067" />
<endpoint endx="957" endy="706" />
</linepath>
- <floatingtext usesdiagramfillcolour="1" width="48" usesdiagramusefillcolour="1" x="910" y="708" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="+" isinstance="0" xmi.id="132" text="proxy" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
- </assocwidget>
- <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="BRZRZeOQHv7A" widgetaid="l6bOvueVxeym" xmi.id="r6p2osooXEU8" linecolor="none" >
- <linepath>
- <startpoint startx="467" starty="230" />
- <endpoint endx="506" endy="124" />
- </linepath>
- </assocwidget>
- <assocwidget totalcounta="3" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="tp3zqQkaUmuu" widgetaid="l6bOvueVxeym" xmi.id="dKCSOea5360x" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
- <linepath>
- <startpoint startx="167" starty="454" />
- <endpoint endx="161" endy="483" />
- </linepath>
- <floatingtext usesdiagramfillcolour="1" width="70" usesdiagramusefillcolour="1" x="163" y="461" linewidth="none" posttext="" role="710" fillcolour="none" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="133" text="discover" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="43" usesdiagramusefillcolour="1" x="912" y="708" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="837" showstereotype="1" text="proxy" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
</associations>
</diagram>
@@ -494,7 +496,7 @@ If next tei is 0. the CCo shall send a discover beacon." isSpecification="false"
</UML:Model>
</XMI.content>
<XMI.extensions xmi.extender="umbrello" >
- <docsettings viewid="u4iNIXCkUpAT" documentation="" uniqueid="502" />
+ <docsettings viewid="u4iNIXCkUpAT" documentation="" uniqueid="1343" />
<listview>
<listitem open="1" type="800" label="Views" >
<listitem open="1" type="801" id="Logical View" >
@@ -576,6 +578,7 @@ If next tei is 0. the CCo shall send a discover beacon." isSpecification="false"
</listitem>
<listitem open="1" type="813" id="NiCCTMNHialM" >
<listitem open="0" type="814" id="ztR22PRRfzxc" />
+ <listitem open="0" type="814" id="684" />
<listitem open="0" type="814" id="oloPbj9IOHgn" />
<listitem open="0" type="814" id="16U2YvTJxiuS" />
<listitem open="0" type="814" id="mUavKhrt5Qso" />
diff --git a/cesar/cp2/beacon/inc/beacon.h b/cesar/cp2/beacon/inc/beacon.h
index 0d295395c8..2c16994d8e 100644
--- a/cesar/cp2/beacon/inc/beacon.h
+++ b/cesar/cp2/beacon/inc/beacon.h
@@ -28,19 +28,14 @@
#include "cp2/beacon/inc/common.h"
#include "cp2/beacon/inc/beacon_work.h"
-/** Define the size of the circular buffer. */
-#define CP_BEACON_LIST_SIZE 10
-
/**
* Beacon module. Use to generate and read a beacon.
*/
struct cp_beacon_t
{
/** circular list manager for the beacon reception. */
- circular_buffer_t list;
-
- /** Beacon list for the list manager. */
- cp_beacon_desc_t *beacon_list[CP_BEACON_LIST_SIZE];
+ cp_beacon_desc_t *list;
+ cp_beacon_desc_t *list_tail;
/** Bentry manager. */
cp_beacon_bentry_mgr_t bentry;
diff --git a/cesar/cp2/beacon/src/beacon.c b/cesar/cp2/beacon/src/beacon.c
index 8659816ab4..aafcae7c17 100644
--- a/cesar/cp2/beacon/src/beacon.c
+++ b/cesar/cp2/beacon/src/beacon.c
@@ -31,7 +31,6 @@
#include "mac/common/timings.h"
#include "mac/common/ntb.h"
-
#include "cp2/beacon/inc/beacon.h"
#include "cp2/beacon/inc/beacon_work.h"
#include "cp2/beacon/inc/bentry_msg.h"
@@ -66,10 +65,6 @@ cp_beacon_init (cp_t *ctx)
&ctx->beacon.alarm_handle,
&ctx->beacon.alarm);
- // Initialise the list.
- circular_buffer_init (&ctx->beacon.list,
- ctx->beacon.beacon_list, CP_BEACON_LIST_SIZE);
-
// Initialise the central beacon common data.
cp_beacon_common_init (&ctx->beacon.central);
cp_beacon_common_init (&ctx->beacon.discover);
@@ -101,11 +96,13 @@ cp_beacon_uninit (cp_t *ctx)
cyg_counter_delete (ctx->beacon.ecos_timer_handle);
// Release all the beacon in the context.
- while ((beacon = circular_buffer_get(&ctx->beacon.list)))
+ while ((beacon = ctx->beacon.list))
{
+ ctx->beacon.list = ctx->beacon.list->next;
// Release the current one.
blk_release_desc ( (blk_t *) beacon);
}
+ ctx->beacon.list_tail = NULL;
// Uninitialise the central beacon common data.
cp_beacon_common_uninit (&ctx->beacon.central, ctx);
@@ -278,7 +275,14 @@ cp_beacon_receive (cp_t *ctx, cp_beacon_desc_t * beacon)
dbg_assert (ctx);
dbg_assert (beacon);
- circular_buffer_add (&ctx->beacon.list, beacon);
+ beacon->next = NULL;
+ if (ctx->beacon.list)
+ ctx->beacon.list_tail = beacon;
+ else
+ {
+ ctx->beacon.list = beacon;
+ ctx->beacon.list_tail = beacon;
+ }
}
/**
@@ -557,7 +561,8 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
dbg_assert (ctx);
- beacon = circular_buffer_get (&ctx->beacon.list);
+ beacon = ctx->beacon.list;
+ ctx->beacon.list = ctx->beacon.list->next;
dbg_check (beacon);
// Read the variant fields of the beacon.
diff --git a/cesar/cp2/beacon/test/src/beacon.c b/cesar/cp2/beacon/test/src/beacon.c
index 74f4f700da..c9cdd1f99f 100644
--- a/cesar/cp2/beacon/test/src/beacon.c
+++ b/cesar/cp2/beacon/test/src/beacon.c
@@ -34,8 +34,6 @@ test_case_beacon_common_init_uninit (test_t test, cp_t *cp)
{
test_begin (test, "verify")
{
- test_fail_if (circular_buffer_peek(&cp->beacon.list) != NULL,
- "Beacon list shall be null");
test_fail_if (cp->beacon.event_cb != NULL,
"Event call back shall be null");
test_fail_if (cp->beacon.event_user_data != NULL,
@@ -125,8 +123,9 @@ test_case_beacon_uninit (test_t test)
cp.mac_store = mac_store_init ();
// Add a beacon.
- circular_buffer_add (&cp.beacon.list, blk_alloc_desc ());
- circular_buffer_add (&cp.beacon.list, blk_alloc_desc ());
+ cp.beacon.list = (cp_beacon_desc_t *) blk_alloc_desc ();
+ cp.beacon.list->next =(cp_beacon_desc_t *) blk_alloc_desc ();
+ cp.beacon.list->next->next =(cp_beacon_desc_t *) NULL;
// Add a central beacon.
cp.beacon.central.mfs = mac_store_mfs_add_tx (cp.mac_store, true, false,