summaryrefslogtreecommitdiff
path: root/cesar/cp2/beacon
diff options
context:
space:
mode:
authorlaranjeiro2008-05-30 16:49:06 +0000
committerlaranjeiro2008-05-30 16:49:06 +0000
commite7add1ad9ae6d85446a6aa98564d020973da27f1 (patch)
treed5035cff254a20e050d004b929dfe84396d3a829 /cesar/cp2/beacon
parent21f8781eac5efb73589c9bd7f8fe20a2119d0d24 (diff)
beacon: Wrote the function to process a discover beacon of our avln ot
not. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2181 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp2/beacon')
-rw-r--r--cesar/cp2/beacon/doc/beacon-spec.odtbin271760 -> 296171 bytes
-rw-r--r--cesar/cp2/beacon/doc/beacons.xmi58
-rw-r--r--cesar/cp2/beacon/doc/processingbeacon.sdl13
-rw-r--r--cesar/cp2/beacon/inc/beacon.h32
-rw-r--r--cesar/cp2/beacon/inc/bentry.h3
-rw-r--r--cesar/cp2/beacon/ntb/ntb_clock_sync.h13
-rw-r--r--cesar/cp2/beacon/src/beacon.c129
-rw-r--r--cesar/cp2/beacon/src/bentry.c6
-rw-r--r--cesar/cp2/beacon/test/src/bentry.c5
9 files changed, 201 insertions, 58 deletions
diff --git a/cesar/cp2/beacon/doc/beacon-spec.odt b/cesar/cp2/beacon/doc/beacon-spec.odt
index 0c53a8ac78..0a8be0543b 100644
--- a/cesar/cp2/beacon/doc/beacon-spec.odt
+++ b/cesar/cp2/beacon/doc/beacon-spec.odt
Binary files differ
diff --git a/cesar/cp2/beacon/doc/beacons.xmi b/cesar/cp2/beacon/doc/beacons.xmi
index 6e2856e082..0c8899c235 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-05-30T10:06:52" xmi.version="1.2" >
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-05-30T18:15:03" xmi.version="1.2" >
<XMI.header>
<XMI.documentation>
<XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
@@ -110,6 +110,7 @@ Once the count down of the snid reach 1, the snid is inserted in the station own
<UML:Parameter comment="The new SNID." isSpecification="false" visibility="public" xmi.id="O2bshvJCONUu" value="" type="oDq9Iugm7iv1" name="snid" />
</UML:BehavioralFeature.parameter>
</UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Poq0pI6lwlc6" isRoot="false" isAbstract="false" isQuery="false" name="get_and_process_beacon" />
<UML:Operation comment="The beacon received from the AVLN. Add the beacon to the list of received beacon, and raise the flag beacon received in STA_CORE." isSpecification="false" isLeaf="false" visibility="private" xmi.id="rOBKdX15uXBI" isRoot="false" isAbstract="false" isQuery="false" name="receive" >
<UML:BehavioralFeature.parameter>
<UML:Parameter comment="The beacon received." isSpecification="false" visibility="public" xmi.id="x8gQXtHc1NIQ" value="" type="sSOkyZ3vfjJC" name="beacon" />
@@ -171,7 +172,25 @@ write = false." isSpecification="false" visibility="private" xmi.id="7i3l7xWNQeU
<UML:Parameter comment="The becon period start time offset read in a central beacon. 0 if the station is CCo." isSpecification="false" visibility="private" xmi.id="kAIhwELP95oq" value="" type="9VyLxLpjMhQd" name="bpsto" />
</UML:BehavioralFeature.parameter>
</UML:Operation>
- <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Poq0pI6lwlc6" isRoot="false" isAbstract="false" isQuery="false" name="get_and_process_beacon" />
+ <UML:Operation comment="Process the central or proxy beacon." isSpecification="false" isLeaf="false" visibility="private" xmi.id="Er0c4eQx1VrR" isRoot="false" isAbstract="false" isQuery="false" name="process_central_proxy" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon previously received." isSpecification="false" visibility="private" xmi.id="9qpkwgA3yDB0" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ <UML:Parameter comment="The variant fields of the beacon previously read." isSpecification="false" visibility="private" xmi.id="MNc1S97e08H4" value="" type="aXm9AJGoGfHX" name="beacon_vf" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process the discover beacon." isSpecification="false" isLeaf="false" visibility="private" xmi.id="Er0c4eQx1VrR" isRoot="false" isAbstract="false" isQuery="false" name="process_discover" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon previously received." isSpecification="false" visibility="private" xmi.id="9qpkwgA3yDB0" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ <UML:Parameter comment="The variant fields of the beacon previously read." isSpecification="false" visibility="private" xmi.id="MNc1S97e08H4" value="" type="aXm9AJGoGfHX" name="beacon_vf" />
+ <UML:Parameter comment="The network previously added." isSpecification="false" visibility="private" xmi.id="iAy2aNnKGVXd" value="" type="MTWZA8u8WYSg" name="net" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read the regions of the central beacon from another AVLN." isSpecification="false" isLeaf="false" visibility="private" xmi.id="Er0c4eQx1VrR" isRoot="false" isAbstract="false" isQuery="false" name="cp_beacon_process_central_read_regions" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon previously received." isSpecification="false" visibility="private" xmi.id="9qpkwgA3yDB0" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ <UML:Parameter comment="The variant fields of the beacon previously read." isSpecification="false" visibility="private" xmi.id="MNc1S97e08H4" value="" type="aXm9AJGoGfHX" name="beacon_vf" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
</UML:Classifier.feature>
</UML:Class>
<UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="dEeErjr5mvtk" isRoot="false" isAbstract="false" name="cp_beacon_type_t" >
@@ -306,8 +325,8 @@ If shall determine the beacon type by reading it in the beacon payload." isSpeci
</UML:Class>
<UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="47rF58Y2yD87" name="" >
<UML:Association.connection>
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="yQpwJu3Tx6d6" aggregation="none" type="NiCCTMNHialM" name="" />
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="50D40z5dma0w" aggregation="none" type="Cgf1eAHBCkYy" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="10BoMmmcNMfE" aggregation="none" type="NiCCTMNHialM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zitCAsyGCazF" aggregation="none" type="Cgf1eAHBCkYy" name="" />
</UML:Association.connection>
</UML:Association>
<UML:Class comment="Schedules index corresponding to the one in the Channel Access." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="S9eUo7DcuX3j" isRoot="false" isAbstract="false" name="cp_beacon_common_t" >
@@ -352,44 +371,44 @@ If shall determine the beacon type by reading it in the beacon payload." isSpeci
</UML:Namespace.ownedElement>
<XMI.extension xmi.extender="umbrello" >
<diagrams>
- <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="973" snapy="10" showatts="1" xmi.id="u4iNIXCkUpAT" documentation="" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1211" >
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="973" snapy="10" showatts="1" xmi.id="u4iNIXCkUpAT" documentation="" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1275" >
<widgets>
- <classwidget usesdiagramfillcolor="0" width="709" showattsigs="601" x="14" fillcolor="#ffffc0" y="711" showopsigs="601" linewidth="none" height="512" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="NiCCTMNHialM" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,1,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="736" showattsigs="601" x="14" fillcolor="#ffffc0" y="711" showopsigs="601" linewidth="none" height="560" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="NiCCTMNHialM" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
<enumwidget usesdiagramfillcolor="0" width="205" x="23" fillcolor="#ffffc0" y="21" linewidth="none" height="80" usefillcolor="1" isinstance="0" xmi.id="dEeErjr5mvtk" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
<classwidget usesdiagramfillcolor="0" width="456" showattsigs="601" x="286" fillcolor="#ffffc0" y="16" showopsigs="601" linewidth="none" height="656" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="l6bOvueVxeym" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
<classwidget usesdiagramfillcolor="0" width="262" showattsigs="601" x="10" fillcolor="#ffffc0" y="135" showopsigs="601" linewidth="none" height="144" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="S9eUo7DcuX3j" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
- <classwidget usesdiagramfillcolor="0" width="154" showattsigs="601" x="740" fillcolor="#ffffc0" y="707" showopsigs="601" linewidth="none" height="88" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="KyQ6lKdcy6SY" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
- <classwidget usesdiagramfillcolor="0" width="196" showattsigs="601" x="728" fillcolor="#ffffc0" y="853" showopsigs="601" linewidth="none" height="264" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="6rRf6PlfSsWH" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="154" showattsigs="601" x="768" fillcolor="#ffffc0" y="675" showopsigs="601" linewidth="none" height="88" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="KyQ6lKdcy6SY" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="196" showattsigs="601" x="759" fillcolor="#ffffc0" y="854" showopsigs="601" linewidth="none" height="264" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="6rRf6PlfSsWH" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
</widgets>
<messages/>
<associations>
<assocwidget totalcounta="5" indexa="4" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="l6bOvueVxeym" widgetaid="NiCCTMNHialM" xmi.id="16U2YvTJxiuS" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
<linepath>
- <startpoint startx="581" starty="711" />
+ <startpoint startx="602" starty="711" />
<endpoint endx="514" endy="672" />
</linepath>
- <floatingtext usesdiagramfillcolor="1" width="52" x="520" fillcolor="none" y="674" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="0Hh1bEJpk41O" text="bentry" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="52" x="520" fillcolor="none" y="674" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="Jt29HKMPJ8uf" text="bentry" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
<assocwidget totalcounta="5" 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" >
<linepath>
- <startpoint startx="155" starty="711" />
+ <startpoint startx="161" starty="711" />
<endpoint endx="75" endy="279" />
</linepath>
- <floatingtext usesdiagramfillcolor="1" width="56" x="143" fillcolor="none" y="281" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="RI5mlp7Dd4Pz" text="central" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="56" x="143" fillcolor="none" y="281" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="YczhBUxdvUDy" text="central" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
<assocwidget totalcounta="5" 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" >
<linepath>
- <startpoint startx="297" starty="711" />
+ <startpoint startx="308" starty="711" />
<endpoint endx="141" endy="279" />
</linepath>
- <floatingtext usesdiagramfillcolor="1" width="64" x="186" fillcolor="none" y="281" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="3XWUwFYuUFv6" text="discover" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="64" x="186" fillcolor="none" y="281" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="z4r6XVgqOgxf" text="discover" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
<assocwidget totalcounta="5" 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" >
<linepath>
- <startpoint startx="439" starty="711" />
+ <startpoint startx="455" starty="711" />
<endpoint endx="206" endy="279" />
</linepath>
- <floatingtext usesdiagramfillcolor="1" width="45" x="208" fillcolor="none" y="281" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="RCv9HuXgDbQw" text="proxy" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="45" x="208" fillcolor="none" y="281" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="0J2IQxxyXufh" text="proxy" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
</associations>
</diagram>
@@ -415,7 +434,7 @@ If shall determine the beacon type by reading it in the beacon payload." isSpeci
</UML:Model>
</XMI.content>
<XMI.extensions xmi.extender="umbrello" >
- <docsettings viewid="u4iNIXCkUpAT" documentation="" uniqueid="Poq0pI6lwlc6" />
+ <docsettings viewid="u4iNIXCkUpAT" documentation="" uniqueid="iAy2aNnKGVXd" />
<listview>
<listitem open="1" type="800" label="Vues" >
<listitem open="1" type="801" id="Logical View" >
@@ -500,6 +519,7 @@ If shall determine the beacon type by reading it in the beacon payload." isSpeci
<listitem open="0" type="815" id="7Q51o9CCSKS6" />
<listitem open="0" type="815" id="7A7gOonaDENp" />
<listitem open="0" type="815" id="My0G0MlRzsZO" />
+ <listitem open="0" type="815" id="Poq0pI6lwlc6" />
<listitem open="0" type="815" id="rOBKdX15uXBI" />
<listitem open="0" type="815" id="tsreDSBVehfS" />
<listitem open="0" type="815" id="zv9gFq6tPba0" />
@@ -509,7 +529,9 @@ If shall determine the beacon type by reading it in the beacon payload." isSpeci
<listitem open="0" type="815" id="7s0yntoKC3vi" />
<listitem open="0" type="815" id="zaQX1Lk61lp6" />
<listitem open="0" type="815" id="Tv64jV1zxtAU" />
- <listitem open="0" type="815" id="Poq0pI6lwlc6" />
+ <listitem open="0" type="815" id="Er0c4eQx1VrR" />
+ <listitem open="0" type="815" id="Er0c4eQx1VrR" />
+ <listitem open="0" type="815" id="Er0c4eQx1VrR" />
</listitem>
<listitem open="1" type="813" id="6rRf6PlfSsWH" >
<listitem open="0" type="814" id="xxZKgCnZi49D" />
diff --git a/cesar/cp2/beacon/doc/processingbeacon.sdl b/cesar/cp2/beacon/doc/processingbeacon.sdl
index c587fb2ef9..f6130d018e 100644
--- a/cesar/cp2/beacon/doc/processingbeacon.sdl
+++ b/cesar/cp2/beacon/doc/processingbeacon.sdl
@@ -4,21 +4,18 @@
| Get sta own data | -> <tracked AVLN>
<tracked AVLN> -yes-> ||NTB sync||
-||NTB sync|| -> <conflict snid>
+||NTB sync|| -> | add AVLN |
-<tracked AVLN> -no-> | get our AVLN |
-| get our AVLN | -> <conflict snid>
+<tracked AVLN> -no-> | add AVLN |
+| add AVLN | -> < our AVLN >
-<conflict snid> -yes-> |post event \n snid conflict>
-|post event \n snid conflict> -> <sta is CCo>
-
-<conflict snid> -no-> <sta is CCo>
+< our AVLN > -no-> <sta is CCo>
<sta is CCo> -no-> (idle)
<sta is CCo> -yes-> ||read regions||
||read regions|| -> (idle)
-<conflict snid> -our avln-> <beacon type>
+< our AVLN > -yes-> <beacon type>
<beacon type> -central beacon-> ||central beacon||
<beacon type> -discover beacon-> ||discover beacon||
<beacon type> -proxy beacon-> ||proxy beacon||
diff --git a/cesar/cp2/beacon/inc/beacon.h b/cesar/cp2/beacon/inc/beacon.h
index 97e7b696a7..ada038b76a 100644
--- a/cesar/cp2/beacon/inc/beacon.h
+++ b/cesar/cp2/beacon/inc/beacon.h
@@ -21,6 +21,7 @@
// Public ones.
#include "hal/timer/timer.h"
+#include "cp2/sta/mgr/net.h"
// Private ones.
#include "cp2/beacon/inc/bentry.h"
@@ -205,13 +206,38 @@ cp_beacon_compute_ca_schedules (cp_t *ctx, cp_beacon_common_t *common,
uint bpsto);
/**
- * Process the received beacon or countdown the counters if the beacon as
- * not been received.
+ * Process a central or proxy beacon.
*
* \param ctx the beacon context.
* \param beacon the beacon received.
+ * \param beacon_vf the variant fields previously read from the beacon.
*/
void
-cp_beacon_process_central (cp_beacon_t *ctx, cp_beacon_desc_t *beacon);
+cp_beacon_process_central_proxy (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf);
+
+/**
+ * Process a discover beacon.
+ *
+ * \param ctx the beacon context.
+ * \param beacon the beacon received.
+ * \param beacon_vf the variant fields previously read from the beacon.
+ * \param net the AVLN previously found
+ */
+void
+cp_beacon_process_discover (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf,
+ cp_net_t *net);
+
+/**
+ * Read the regions of the central beacon from another AVLN.
+ *
+ * \param ctx the Module context.
+ * \param beacon the beacon to process.
+ * \param beacon_vf the variant fields previously read.
+ */
+void
+cp_beacon_process_central_read_regions (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf);
#endif /* cp2_beacon_inc_beacon_h */
diff --git a/cesar/cp2/beacon/inc/bentry.h b/cesar/cp2/beacon/inc/bentry.h
index a0892f82ab..019f675035 100644
--- a/cesar/cp2/beacon/inc/bentry.h
+++ b/cesar/cp2/beacon/inc/bentry.h
@@ -235,7 +235,6 @@ cp_beacon_bentry_mgr_regions (cp_t *ctx, cp_beacon_bentry_t *bentry);
/**
* Read or write the mac address in the beacon.
- * \param ctx the module context.
* \param bentry The address of the start of the bentry.
* \param mac_address The mac address to store or the variable to set when
* it is reading a mac address bentry.
@@ -245,7 +244,7 @@ cp_beacon_bentry_mgr_regions (cp_t *ctx, cp_beacon_bentry_t *bentry);
* in the bentry in the parameter provided
*/
void
-cp_beacon_bentry_mgr_mac_address (cp_t *ctx, cp_beacon_bentry_t *bentry,
+cp_beacon_bentry_mgr_mac_address (cp_beacon_bentry_t *bentry,
mac_t * mac_address);
/**
diff --git a/cesar/cp2/beacon/ntb/ntb_clock_sync.h b/cesar/cp2/beacon/ntb/ntb_clock_sync.h
index a34d1f65c4..609c9e7428 100644
--- a/cesar/cp2/beacon/ntb/ntb_clock_sync.h
+++ b/cesar/cp2/beacon/ntb/ntb_clock_sync.h
@@ -18,6 +18,7 @@
* (and set or update the NTB offset in the MAC Config)
*
*/
+#include "cp2/cp.h"
/* HAL-PHY functions dedicated to NTB clock management
* (access to dedicated PRATIC registers) */
@@ -59,7 +60,7 @@ typedef enum
e_cnt
} e_ntb_histo;
-struct ntb_histo_t
+struct cp_beacon_ntb_ntb_histo_t
{
/* k Factor value for "w" weighting constant (w = 1 / 2^k). */
unsigned long k;
@@ -118,7 +119,7 @@ struct ntb_histo_t
unsigned long sta_count_samples_for_average_deriv[e_cnt];
};
-typedef struct ntb_histo_t ntb_histo_t;
+typedef struct cp_beacon_ntb_ntb_histo_t cp_beacon_ntb_ntb_histo_t;
/* ntb context data structure. */
struct ntb_t
@@ -126,7 +127,7 @@ struct ntb_t
/* NTB sample history (beacon time stamp data and synchronization
* data being calculated). */
- ntb_histo_t ntb_histo;
+ cp_beacon_ntb_ntb_histo_t ntb_histo;
/* count of beacons. */
unsigned long long beacon_count;
@@ -205,7 +206,7 @@ struct ntb_t
double sta_clk_frequ_sync_ratio[NTB_SMAX - 1][count_of_beacons];
# endif
};
-typedef struct ntb_t ntb_t;
+typedef struct cp_beacon_ntb_t cp_beacon_ntb_t;
BEGIN_DECLS
/*
@@ -213,8 +214,6 @@ BEGIN_DECLS
*
* \param cp_ctx pointer to CP context
*
- * \return pointer to ntb_t NTB context data structure
- *
* following contexts are needed and found in the CP context passed in argument
* pointer to phy context (phy_t *phy_ctx)
* pointer to mac config (mac_config_t *mac_config)
@@ -222,7 +221,7 @@ BEGIN_DECLS
* by the calling application to be retrieved through the CP context pointer
* passed in argument to other NTB API function calls
*/
-ntb_t *
+void
cp_beacon_ntb_init (cp_t * cp_ctx);
/**
diff --git a/cesar/cp2/beacon/src/beacon.c b/cesar/cp2/beacon/src/beacon.c
index 2ecc53b6fa..ee60a35259 100644
--- a/cesar/cp2/beacon/src/beacon.c
+++ b/cesar/cp2/beacon/src/beacon.c
@@ -274,19 +274,6 @@ cp_beacon_receive (cp_t *ctx, cp_beacon_desc_t * beacon)
}
/**
- * Verify the conflict of SNID.
- * \param ctx the module context.
- * \param beacon_snid The beacon's SNID beeing process.
- * \param beacons_nid The beacon's NID.
- *
- * If the snid corresponds too our SNID and the NID does not match, it
- * shall post a message in the FSM to prevent the CCo Core
- */
-void
-cp_beacon_detect_snid_conficts (cp_beacon_t *ctx, u8 beacon_snid,
- u64 beacons_nid);
-
-/**
* Update the hrybrid mode in the station.
* \param ctx the module context.
* \param hm The new value of the hybrid mode.
@@ -521,6 +508,8 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
cp_beacon_desc_t *beacon;
cp_beacon_work_beacon_t beacon_vf;
cp_sta_own_data_t *own_sta;
+ cp_net_t *net;
+ cp_net_t *our_net;
u64 nid;
dbg_assert (ctx);
@@ -544,5 +533,119 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
beacon->payload->fc.preamble_date,
beacon->payload->fc.preamble_sysdate);
}
+
+ // Add the AVLN to the net list.
+ net = cp_sta_mgr_add_avln (ctx, beacon->payload->fc.snid, nid);
+
+ // Get our network.
+ our_net = cp_sta_mgr_get_our_avln (ctx);
+
+ if (our_net == net)
+ {
+ if ((beacon_vf.bt == CP_BEACON_CENTRAL_BEACON)
+ || (beacon_vf.bt == CP_BEACON_PROXY_BEACON))
+ cp_beacon_process_central_proxy (ctx, beacon, &beacon_vf);
+ else
+ cp_beacon_process_discover (ctx, beacon, &beacon_vf, net);
+ }
+ else if (own_sta->is_cco)
+ {
+ cp_beacon_process_central_read_regions (ctx, beacon, &beacon_vf);
+ }
+
+ blk_release_desc ((blk_t *) beacon);
+}
+
+/**
+ * Process a central or proxy beacon.
+ *
+ * \param ctx the beacon context.
+ * \param beacon the beacon received.
+ * \param beacon_vf the variant fields previously read from the beacon.
+ */
+void
+cp_beacon_process_central_proxy (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (beacon_vf);
+}
+
+/**
+ * Process a discover beacon.
+ *
+ * \param ctx the beacon context.
+ * \param beacon the beacon received.
+ * \param beacon_vf the variant fields previously read from the beacon.
+ * \param net the AVLN previously found
+ */
+void
+cp_beacon_process_discover (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf,
+ cp_net_t *net)
+{
+ uint nbe;
+ uint stop;
+ cp_beacon_bentry_t bentry;
+ mac_t mac_address;
+ cp_bentry_discover_info_struct_t info_struct;
+ cp_sta_t *sta;
+
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (beacon_vf);
+ dbg_assert (net);
+
+ // Get the number of beacon entries.
+ nbe = read_u8_from_word(beacon->payload->bmis);
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = beacon->payload->bmis + 1;
+
+ for (stop = 0; nbe && (stop < 2); nbe--)
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ if (bentry.header == CP_BENTRY_MAC_ADDRESS)
+ {
+ cp_beacon_bentry_mgr_mac_address (&bentry, &mac_address);
+ stop ++;
+ }
+ else if (bentry.header == CP_BENTRY_DISCOVER_INFO)
+ {
+ cp_beacon_bentry_mgr_discover_info_bentry (&bentry, &info_struct);
+ stop ++;
+ }
+ }
+
+ sta = cp_net_sta_add (net, beacon_vf->stei, mac_address,
+ info_struct.authentication,
+ info_struct.cco_status,
+ info_struct.pco_status,
+ info_struct.backup_cco_status);
+
+ sta->cco_cap = beacon_vf->cco_cap;
+ sta->pco_cap = info_struct.proxy_net_cap;
+ sta->backup_cco_cap = info_struct.backup_cco_cap;
+ sta->numDisSta = info_struct.num_dis_sta;
+ sta->numDisNet = info_struct.num_dis_net;
+
+ blk_release (sta);
}
+
+/**
+ * Read the regions of the central beacon from another AVLN.
+ *
+ * \param ctx the Module context.
+ * \param beacon the beacon to process.
+ * \param beacon_vf the variant fields previously read.
+ */
+void
+cp_beacon_process_central_read_regions (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (beacon_vf);
+}
diff --git a/cesar/cp2/beacon/src/bentry.c b/cesar/cp2/beacon/src/bentry.c
index cd3328680b..84004c48fa 100644
--- a/cesar/cp2/beacon/src/bentry.c
+++ b/cesar/cp2/beacon/src/bentry.c
@@ -271,16 +271,14 @@ cp_beacon_bentry_mgr_regions (cp_t *ctx, cp_beacon_bentry_t *bentry)
/**
* Read or write the mac address in the beacon.
- * \param ctx the module context.
* \param bentry The address of the start of the bentry.
* \param mac_address The mac address to store or the variable to set when
* it is reading a mac address bentry.
*/
void
-cp_beacon_bentry_mgr_mac_address (cp_t *ctx, cp_beacon_bentry_t *bentry,
+cp_beacon_bentry_mgr_mac_address (cp_beacon_bentry_t *bentry,
mac_t * mac_address)
{
- dbg_assert (ctx);
dbg_assert (bentry);
dbg_assert (mac_address);
@@ -593,7 +591,7 @@ cp_beacon_bentry_mgr_beacon_write (cp_t *ctx, cp_beacon_desc_t *beacon,
// Mac address
sta_own_data = cp_sta_mgr_get_sta_own_data (ctx);
mac_address = cp_sta_own_data_get_mac_address (sta_own_data);
- cp_beacon_bentry_mgr_mac_address (ctx, &bentry, &mac_address);
+ cp_beacon_bentry_mgr_mac_address (&bentry, &mac_address);
// BPSTO
cp_beacon_bentry_mgr_bpsto (&bentry, (u8**) &ctx->beacon.central.bpsto);
diff --git a/cesar/cp2/beacon/test/src/bentry.c b/cesar/cp2/beacon/test/src/bentry.c
index 37de6f694f..f701d48639 100644
--- a/cesar/cp2/beacon/test/src/bentry.c
+++ b/cesar/cp2/beacon/test/src/bentry.c
@@ -845,7 +845,6 @@ test_case_bentry_non_persistent_schedules (test_t test)
void
test_case_bentry_mac_address (test_t test)
{
- cp_t cp;
cp_beacon_bentry_t bentry;
u8 buffer[256] __attribute__((aligned(256)));
uint data;
@@ -871,7 +870,7 @@ test_case_bentry_mac_address (test_t test)
bentry.bentry_addr = buffer + 2;
bentry.read_write = CP_BEACON_BENTRY_READ;
- cp_beacon_bentry_mgr_mac_address (&cp, &bentry, &mac_address);
+ cp_beacon_bentry_mgr_mac_address (&bentry, &mac_address);
test_begin (test, "verify")
{
@@ -891,7 +890,7 @@ test_case_bentry_mac_address (test_t test)
bentry.length = ETH_MAC_ADDRESS_SIZE;
bentry.read_write = CP_BEACON_BENTRY_WRITE;
- cp_beacon_bentry_mgr_mac_address (&cp, &bentry, &mac_address);
+ cp_beacon_bentry_mgr_mac_address (&bentry, &mac_address);
test_begin (test, "Verify")
{