summaryrefslogtreecommitdiff
path: root/cesar/maximus/common
diff options
context:
space:
mode:
authorThierry Carré2012-10-16 12:45:48 +0200
committerThierry Carré2013-01-31 15:04:48 +0100
commit4452a8abe0d135b1f690b530a3bb4b1e495d7b65 (patch)
treeffa06423693d00cdaccd3d8a51d3c6c61ec2b2f3 /cesar/maximus/common
parent83441de4ab01355295cfe6a6e389ad5bc66fd361 (diff)
cesar/maximus: C++ maximus refactoring, closes #3336, closes #3098
Feedback on new performance on tests inside: test_general/station Ratio = Test duration before this commit divided by new duration. |--------------------------------------------|-------| | Unit test | Ratio | |--------------------------------------------|-------| | maximus/py/sc01_long_simu.py | 6.5 | | maximus/py/sc02_long_simu.py | 4.5 | | scenario/av/py/sc01_assoc_auth.py | 3.3 | | scenario/av/py/sc02_stas_communication.py | 4.5 | | scenario/av/py/sc03_two_avln_coexisting.py | 2.1 | | scenario/av/py/sc04_cc_whoru.py | 2.1 | | scenario/av/py/sc05_cc_leave.py | 2.3 | | scenario/av/py/sc06_discover_procedure.py | 2.3 | | scenario/av/py/sc07_bridge.py | 2.2 | | scenario/av/py/sc08_bentry_change.py | 2.1 | | scenario/av/py/sc09_simple_connect.py | 2.2 | | scenario/av/py/sc10_short_messages.py | 5.7 | | scenario/av/py/sc11_cm_nw_info.py | 4.7 | | scenario/av/py/sc12_change_nmk.py | 5.5 | | scenario/av/py/sc14_igmp.py | 4.0 | | scenario/av/py/sc15_hide.py | 6.0 | | compliance/py/sc01_dut_as_a_cco.py | 5.8 | | tonemap/py/sc01_bl_initial.py | 2.3 | | tonemap/py/sc02_vs_get_tonemap.py | 2.3 | |--------------------------------------------|-------| | Average speed improvement of Maximus is | 4.9 | |--------------------------------------------|-------| Many tickets have been opened to continue the refactoring. Titles begin by "[Maximus][Refactoring]" in pessac's trac. For this reason #3336 is close. #3098 is really fixed.
Diffstat (limited to 'cesar/maximus/common')
-rw-r--r--cesar/maximus/common/interfaces/Maximus.h360
-rw-r--r--cesar/maximus/common/interfaces/Msg.h312
-rw-r--r--cesar/maximus/common/interfaces/Sta.h169
-rw-r--r--cesar/maximus/common/types.h24
-rw-r--r--cesar/maximus/common/types/channel_types.h70
-rw-r--r--cesar/maximus/common/types/ethernet_types.h88
-rw-r--r--cesar/maximus/common/types/functioncall_types.h70
-rw-r--r--cesar/maximus/common/types/hal_phy_types.h55
-rw-r--r--cesar/maximus/common/types/networkclock_types.h79
-rw-r--r--cesar/maximus/common/types/phy_types.h140
-rw-r--r--cesar/maximus/common/types/sci_types.h168
-rw-r--r--cesar/maximus/common/types/system_types.h72
12 files changed, 327 insertions, 1280 deletions
diff --git a/cesar/maximus/common/interfaces/Maximus.h b/cesar/maximus/common/interfaces/Maximus.h
deleted file mode 100644
index ef29b1cfe3..0000000000
--- a/cesar/maximus/common/interfaces/Maximus.h
+++ /dev/null
@@ -1,360 +0,0 @@
-/************************************************************************
- Maximus.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/interfaces/Maximus.h
-**************************************************************************/
-
-#ifndef MAXIMUS_H
-#define MAXIMUS_H
-
-#include "IPhy.h" // for 'PhyMpduCb'
-#include "IEthernet.h" // for 'EtherCb'
-
-#include "networkclock_types.h" // for 'tick_t'
-#include "channel_types.h" // for 'MAXIMUS_CHANNEL_INTERVAL_MAX_NB'
-#include "sci_types.h" // for 'Sci_Msg_Station_Id'
-#include "system_types.h" // for 'File_Descriptor'
-
-#include <fstream> // for 'std::ofstream'
-#include <string> // for 'std::string'
-#include <vector> // for 'std::vector'
-
-#define catchFunction(p_maximus) \
-catch ( Error & e ) \
-{ \
- e.display(); \
- p_maximus->stop(); \
- throw; \
-}
-
-class CoreEngine;
-class ISystem;
-class IFunctionCall;
-class INetworkClock;
-class ISci;
-class IChannel;
-class Sta;
-class Msg;
-class PhySciMsgMpdu;
-
-class Error;
-
-typedef Network_Clock_Tick tick_t;
-
-typedef std::vector<Msg *> MsgsList;
-typedef std::vector<Sta *> StasList;
-
-
-/**
- * class Maximus
- */
-
-class Maximus
-{
-
-public:
-
- // Constructors/Destructors
- //
-
- /**
- * Empty Constructor
- */
- Maximus ( );
-
- /**
- * Empty Destructor
- */
- virtual ~Maximus ( );
-
- // public methods
- //
-
- /**
- * @param argc
- * @param argv
- * Initialize Maximus with main program arguments.
- */
- void init ( int argc, char * argv[] );
-
- /**
- * @param interface_cb
- * Initialize PHY with an interface callback function for PHY SCI message MPDU reception.
- */
- void init_phy ( PhyMpduCb interface_cb );
-
- /**
- * Initializes Ethernet with an interface callback function for Ether SCI message reception,
- * and creates a TAP.
- * @param ether_cb the interface Ethernet reception callback function
- * @return mEtherLogFileDescriptor
- */
- File_Descriptor init_ether ( EtherCb interface_cb );
-
- /**
- * This method handles messages reception and events processing.
- * When called, Maximus processes:
- * - received messages from all simulated stations at the current tick;
- * - all Maximus simulator events of the current tick.
- */
- void process ( );
-
- /**
- * @return Sta &
- * @param station_executable the station executable to run
- * @param seed may be needed for Cesar initialization
- * Create a new station.
- * Return a reference on a station object.
- */
- Sta & create_sta ( const std::string & station_executable = std::string(), uint32_t seed = 0 );
-
- /**
- * @return Msg &
- * @param name
- * Create a function message, which name is set to name.
- * Return a reference on a message object.
- */
- Msg & create_fc ( const std::string & name );
-
- /**
- * @return Msg &
- * Create a probe message.
- * Return a reference on a message object.
- */
- Msg & create_probe ( );
-
- /**
- * Creates a PHY SCI message MPDU.
- * Returns a pointer to a PHY SCI message MPDU object.
- * @return PhySciMsgMpdu *
- */
- PhySciMsgMpdu * create_mpdu ( );
-
- /**
- * Sends an already configured PHY SCI message MPDU.
- * @param p_mpdu
- * @return bool
- */
- void send_mpdu ( PhySciMsgMpdu * p_mpdu );
-
- /**
- * Creates an Ether SCI message.
- * Returns a pointer to an Ether SCI message object.
- * @return EtherSciMsg *
- */
- EtherSciMsg * create_ether ( );
-
- /**
- * Sends an already configured Ether SCI message.
- * @param ether
- * @return bool
- */
- void send_ether ( EtherSciMsg & ether );
-
- /**
- * @param value
- * Wait until (Maximus current tick + value) is reached.
- */
- void wait ( const tick_t value );
-
- /**
- * Wait until all responses to sent function messages in asynchronous mode are received.
- */
- void wait ( );
-
- /**
- * Enable or disable the channel perturbation.
- */
- void disturb_channel ( const bool enable = true );
-
- /**
- * Get the Network Clock current tick.
- */
- tick_t get_date ( );
-
- /**
- * Set the power line frequency.
- */
- void set_freq ( const float frequency );
-
- /**
- * Get the power line frequency.
- */
- float get_freq ( );
-
- /**
- * Set the SNR.
- */
- void set_snr ( const float snr_value );
- void set_snr ( const std::string & snr_file );
- void set_snr_from_src ( const float snr_value, const Sta & src, const bool both_directions );
- void set_snr_from_src ( const std::string & snr_file, const Sta & src, const bool both_directions );
- void set_snr_to_dst ( const float snr_value, const Sta & dst, const bool both_directions );
- void set_snr_to_dst ( const std::string & snr_file, const Sta & dst, const bool both_directions );
- void set_snr_from_src_to_dst ( const float snr_value, const Sta & src, const Sta & dst, const bool both_directions );
- void set_snr_from_src_to_dst ( const std::string & snr_file, const Sta & src, const Sta & dst, const bool both_directions );
-
- /**
- * Activate wrong preambles transmission.
- * @param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
- * @param std_deviation the standard deviation
- */
- void activate_false_alarm ( const Network_Clock_Tick average_duration, const float std_deviation );
-
- /**
- * Deactivate wrong preambles transmission.
- */
- void deactivate_false_alarm ( );
-
- /**
- * Indicate if the station is IDLE or not.
- * @param station_id the ID of the station
- * @return 'true' if the station is IDLE, 'false' otherwise
- */
- bool is_station_idle ( Sci_Msg_Station_Id station_id );
-
- /**
- * Authorize or not PLC communication between 2 stations.
- * @param sta1 one of the concerned stations (order has no importance)
- * @param sta2 the second station
- * @param hidden indicates if the stations have to be hidden or visible from each other
- */
- void hide_sta (const Sta & sta1, const Sta & sta2, bool hidden);
-
-private:
-
- // private attributes
- //
-
- CoreEngine * mpCoreEngine;
- std::ofstream mMaximusLogFile;
- Network_Clock_Tick mMaxTickValue;
- Network_Clock_Tick mWaitTickValue;
- MsgsList mListOfMsgs;
- StasList mListOfStas;
-
- bool mIsWireshark;
- File_Descriptor mEtherLogFileDescriptor;
-
- // private methods
- //
-
- /**
- * @return CoreEngine *
- */
- CoreEngine * getCoreEngine ( );
-
- /**
- * @return ISystem *
- */
- ISystem * getSystemManager ( );
-
- /**
- * @return IFunctionCall *
- */
- IFunctionCall * getFunctionCallManager ( );
-
- /**
- * @return INetworkClock *
- */
- INetworkClock * getNetworkClockProcessor ( );
-
- /**
- * @return IPhy *
- */
- IPhy * getPhyProcessor ( );
-
- /**
- * @return ISci *
- */
- ISci * getSciServer ( );
-
- /**
- * Gets a pointer to Channel.
- * @return mpCoreEngine->mpChannel
- */
- IChannel * getChannel ( );
-
- /**
- * Gets a pointer to Ethernet.
- * @return mpCoreEngine->mpEthernet
- */
- IEthernet * getEthernet ( );
-
- /**
- * @return Network_Clock_Tick
- */
- Network_Clock_Tick getMaxTickValue ( ) const;
-
- /**
- * @return bool
- * @param max_tick_value
- */
- bool setMaxTickValue ( const Network_Clock_Tick max_tick_value );
-
- /**
- * @return Network_Clock_Tick
- */
- Network_Clock_Tick getWaitTickValue ( ) const;
-
- /**
- * @return bool
- * @param wait_tick_value
- */
- bool setWaitTickValue ( const Network_Clock_Tick wait_tick_value );
-
- /**
- * @param snr_file the SNR file to read
- * @param the SNR array read from the SNR file
- * @return bool
- */
- bool readSnrFile ( const std::string & snr_file, float snr_array[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1] );
-
- /**
- * Indicates if Wireshark is enabled or not.
- * @return 'true' if Wireshark is enabled, 'false' otherwise
- */
- bool isWireshark ( ) const;
-
-public:
-
- // public methods
- //
-
- /**
- * Constructor (FOR UNITARY TESTS ONLY)
- */
- Maximus ( CoreEngine * p_core_engine );
-
- static void wrapper ( int n );
-
- void stop ( );
-
-};
-
-
-#endif // MAXIMUS_H
diff --git a/cesar/maximus/common/interfaces/Msg.h b/cesar/maximus/common/interfaces/Msg.h
deleted file mode 100644
index 907703dcc6..0000000000
--- a/cesar/maximus/common/interfaces/Msg.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/************************************************************************
- Msg.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/interfaces/Msg.h
-**************************************************************************/
-
-#ifndef MSG_H
-#define MSG_H
-
-#include "sci_types.h" // for 'Sci_Msg_Station_Id'
-#include "functioncall_types.h" // for 'PROBE_ID' and 'FUNCTION_CALL_PARAM_MAX_SIZE'
-#include "FunctionSciMsg.h" // for 'ParametersList'
-#include "FunctionCallParameter.h" // for 'ParametersList'
-
-#include <boost/function.hpp> // for 'cb_t'
-#include <string>
-
-class Sta;
-class IFunctionCall;
-class ISystem;
-class Maximus;
-class Msg;
-
-typedef boost::function <void (Msg &)> cb_t;
-
-
-/**
- * class Msg
- */
-
-class Msg
-{
-
-public:
-
- // Constructors/Destructors
- //
-
- /**
- * Constructor
- */
- Msg ( Maximus * p_maximus,
- IFunctionCall * p_function_call_manager,
- ISystem * p_system_manager,
- const std::string & name = PROBE_ID );
-
- /**
- * Copy constructor
- */
- Msg ( const Msg & msg );
-
- /**
- * Empty Destructor
- */
- virtual ~Msg ( );
-
- // public methods
- //
-
- /**
- * @return Msg &
- * @param msg
- */
- Msg & operator= ( const Msg & msg );
-
- /**
- * @return Msg &
- * @param name
- * Add a void parameter named name to an existing message,
- * i.e. its length is set to 0 and its value is set to NULL.
- * Return the message.
- */
- Msg & add_param ( const std::string & name );
-
- /**
- * @return Msg &
- * @param name
- * @param length
- * @param value
- * Add a parameter named name to an existing message.
- * Its length is set to length and its value is set to value.
- * Return the message.
- */
- Msg & add_param ( const std::string & name, const unsigned long length, const unsigned char * p_value );
-
- /**
- * @return Msg &
- * @param name
- * @param value
- * Add a parameter named name to an existing message.
- * Its length is set to the size of value string and its value is set to value.
- * Return the message.
- */
- Msg & add_param ( const std::string & name, const std::string & value );
-
- /**
- * @return Msg &
- * @param name
- * @param value
- * Add a parameter named name to an existing message.
- * Its length is set to the size of value type and its value is set to value.
- * Return the message.
- */
- template <typename T> Msg & add_param ( const std::string & name, T const & value );
-
- /**
- * @return Msg &
- * @param name
- * Remove the parameter named name from an existing message.
- * Return the message.
- */
- Msg & remove_param ( const std::string & name );
-
- /**
- * @return Msg &
- * @param user_cb
- * Register a callback function to an existing function message.
- * This callback will be called when the function message response will be received.
- * If a callback had already been set, it is replaced by the new one.
- * Return the message.
- */
- Msg & set_cb ( const cb_t & user_cb );
-
- /**
- * @return Msg &
- * Remove a registered callback from an existing function message.
- * Return the message.
- */
- Msg & remove_cb ( );
-
- /**
- * @return Msg &
- * @param sta
- * Set destination station to sta for an existing message.
- * If a destination station had already been set, it is replaced by the new one.
- * Return the message.
- */
- Msg & set_sta ( Sta & sta );
-
- /**
- * Send an existing function message in the asynchronous mode,
- * i.e. Maximus does not wait for function message response reception before continuing its execution.
- * Note that before sending a function message via this method,
- * user has to set its destination station.
- */
- void send_async ( );
-
- /**
- * @param sta
- * Send an existing function message to the station sta,
- * in the asynchronous mode.
- */
- void send_async ( Sta & sta );
-
- /**
- * Send an existing message in the synchronous mode,
- * i.e. Maximus will wait for function message response reception before continuing its execution.
- * Return the received message.
- * Note that before sending a message via this method,
- * user has to set its destination station.
- */
- Msg & send ( );
-
- /**
- * @param sta
- * Send an existing message to the station sta,
- * in the synchronous mode.
- * Return the received message.
- */
- Msg & send ( Sta & sta );
-
-
- /**
- * @return bool
- * @param name
- * Return 'true' if the parameter named name exists in the message.
- */
- bool is_param ( const std::string & name ) const;
-
- /**
- * @return unsigned char *
- * @param name
- * @param length
- * @param p_data
- * Retrieve contents of the parameter named name.
- * Return updated length of the received parameter via length and a pointer to its value via p_data.
- * Return NULL if the parameter named name does not exist in the message, else return p_data.
- * Note that user has to allocate enough memory for parameter value.
- * If parameter value length is unknown, user has to allocate FUNCTION_CALL_PARAM_MAX_SIZE bytes.
- */
- unsigned char * bind_param ( const std::string & name, unsigned long & length, unsigned char * p_data ) const;
-
- /**
- * @param name
- * Return the value of the parameter named name.
- */
- template <typename T> T & bind_param ( const std::string & name ) const;
-
- /**
- * @return Function_Call_Msg_Id
- * Return mpFunctionSciMsg->mSpecializedSciMsgId.
- */
- Function_Call_Msg_Id get_tx_msg_id ( ) const;
-
- /**
- * @return Function_Call_Msg_Id
- * Return mpFunctionSciMsg->mpSpecializedSciMsgHeader->msg_id.
- */
- Function_Call_Msg_Id get_rx_msg_id ( ) const;
-
-private:
-
- // private attributes
- //
-
- Maximus * mpMaximus;
- IFunctionCall * mpFunctionCallManager;
- ISystem * mpSystemManager;
- cb_t mCallback;
- FunctionSciMsg * mpFunctionSciMsg;
- bool mResponseReceived;
-
- // private methods
- //
-
- // private attributes accessor methods
- //
-
- /**
- * @return Maximus *
- */
- Maximus * getMaximus ( ) const;
-
- /**
- * @return IFunctionCall *
- */
- IFunctionCall * getFunctionCallManager ( ) const;
-
- /**
- * @return ISystem *
- */
- ISystem * getSystemManager ( ) const;
-
- /**
- * @return cb_t
- */
- cb_t getCallback ( ) const;
-
- /**
- * @return bool
- * @param cb_t
- */
- bool setCallback ( const cb_t callback );
-
- /**
- * @return FunctionSciMsg *
- */
- FunctionSciMsg * getFunctionSciMsg ( ) const;
-
- /**
- * @return bool
- * @param function_sci_msg
- */
- bool setFunctionSciMsg ( const FunctionSciMsg & function_sci_msg );
-
- /**
- * @return bool
- */
- bool isResponseReceived ( ) const;
-
- /**
- * @return bool
- * @param bool
- */
- bool setResponseReceived ( const bool response_received );
-
-public:
-
- void receiveResponse ( const FunctionSciMsg & function_sci_msg );
-
- void receiveAsynchronousResponse ( const FunctionSciMsg & function_sci_msg );
-
-};
-
-
-#include "Msg.tpp"
-
-#endif // MSG_H
diff --git a/cesar/maximus/common/interfaces/Sta.h b/cesar/maximus/common/interfaces/Sta.h
deleted file mode 100644
index a137474e75..0000000000
--- a/cesar/maximus/common/interfaces/Sta.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/************************************************************************
- Sta.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/interfaces/Sta.h
-**************************************************************************/
-
-#ifndef STA_H
-#define STA_H
-
-#include "sci_types.h" // for 'Sci_Msg_Station_Id'
-
-#include <map> // for 'map'
-#include <string>
-
-class Maximus;
-class ISystem;
-
-typedef std::map<const Sci_Msg_Station_Id, unsigned short int> StaCounter;
-
-
-
-/**
- * class Sta
- */
-
-class Sta
-{
-
-public:
-
- // Constructors/Destructors
- //
-
- /**
- * Constructor
- */
- Sta ( Maximus * p_maximus, ISystem * p_system_manager, const std::string & station_executable, uint32_t seed = 0 );
-
- /**
- * Copy constructors
- */
- Sta ( const Sta & sta );
-
- /**
- * Empty Destructor
- */
- virtual ~Sta ( );
-
- // public methods
- //
-
- /**
- * @return Sta &
- * @param sta
- */
- Sta & operator= ( const Sta & sta );
-
- /**
- * Remove an existing station.
- */
- void remove ( );
-
- /**
- * Deactivate an existing station,
- * i.e. the station will not receive Maximus messages anymore, until it will be reactivated.
- */
- void deactivate ( );
-
- /**
- * Reactivate a deactivated station.
- */
- void activate ( );
-
- /**
- * Launch a debugger attached to the station executable,
- * with arguments passed to main program.
- */
- void debug ( );
-
- /**
- * Indicate if the station is IDLE or not.
- */
- bool is_idle ( ) const;
-
- /**
- * Set the station name.
- */
- void set_name ( const std::string & station_name );
-
-private:
-
- // private attributes
- //
-
- Maximus * mpMaximus; // used for 'Maximus::process()' method only
- ISystem * mpSystemManager;
- Sci_Msg_Station_Id mStationId;
-
- /* Each 'Sta' instance points to an eCos process (via 'mStationId').
- * When a 'Sta' is created from a Python script,
- * the 'Sta' copy constructor is called by the Boost.Python interface.
- * Thus, several 'Sta' instances point to the same eCos process.
- * The eCos process has to be stopped only when the last 'Sta' pointing to it is deleted,
- * i.e. when the station counter defined below equals 1. */
- static StaCounter mStaCounter;
-
- // private methods
- //
-
- // private attribute accessor methods
- //
-
- /**
- * Gets a pointer to Maximus.
- * @return mpMaximus
- */
- Maximus * getMaximus ( ) const;
-
- /**
- * @return ISystem *
- */
- ISystem * getSystemManager ( ) const;
-
- /**
- * @return bool
- */
- bool resetStationId ( );
-
-public:
-
- // public methods
- //
-
- // private attribute accessor methods
- //
-
- /**
- * @return Sci_Msg_Station_Id
- */
- Sci_Msg_Station_Id getStationId ( ) const;
-
-};
-
-
-#endif // STA_H
diff --git a/cesar/maximus/common/types.h b/cesar/maximus/common/types.h
new file mode 100644
index 0000000000..b9c9252e53
--- /dev/null
+++ b/cesar/maximus/common/types.h
@@ -0,0 +1,24 @@
+#ifndef maximus_common_types_h
+#define maximus_common_types_h
+/* Maximus project {{{
+ *
+ * Copyright (C) 2012 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file maximus/common/types.h
+ * \ingroup maximus_common
+ *
+ */
+#include "maximus/common/types/channel_types.h"
+#include "maximus/common/types/functioncall_types.h"
+#include "maximus/common/types/networkclock_types.h"
+#include "maximus/common/types/sci_types.h"
+#include "maximus/common/types/ethernet_types.h"
+#include "maximus/common/types/hal_phy_types.h"
+#include "maximus/common/types/phy_types.h"
+#include "maximus/common/types/system_types.h"
+
+#endif /* maximus_common_types_h */
diff --git a/cesar/maximus/common/types/channel_types.h b/cesar/maximus/common/types/channel_types.h
index 86552d77d8..9f925a1fd1 100644
--- a/cesar/maximus/common/types/channel_types.h
+++ b/cesar/maximus/common/types/channel_types.h
@@ -1,35 +1,17 @@
-/************************************************************************
- channel_types.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/types/channel_types.h
-**************************************************************************/
-
-#ifndef CHANNEL_TYPES_H
-#define CHANNEL_TYPES_H
+#ifndef maximus_common_types_channel_types_h
+#define maximus_common_types_channel_types_h
+/* Maximus project {{{
+ *
+ * Copyright (C) 2012 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file maximus/common/types/channel_types.h
+ * \ingroup maximus_common_types
+ *
+ */
#define MAXIMUS_CHANNEL_VALUE_MAX_NB 32
#define MAXIMUS_CHANNEL_I_Q_MAX_VALUE 31
@@ -37,20 +19,20 @@ The original location of this file is /home/buret/eclipse/maximus/common/types/c
#define MAXIMUS_CHANNEL_CODE_MAX_VALUE 0x3FF // 0b1111111111 in QAM1024
#define MAXIMUS_CHANNEL_Q_QAM8_ABSOLUTE_VALUE 1.29f
-#define MAXIMUS_CHANNEL_INTERVAL_MAX_NB 128
+#define MAXIMUS_CHANNEL_INTERVAL_MAX_NB 128
enum Channel_Mod
{
- MAXIMUS_CHANNEL_MOD_NONE = 0x00,
- MAXIMUS_CHANNEL_MOD_BPSK = 0x01,
- MAXIMUS_CHANNEL_MOD_QPSK = 0x02,
- MAXIMUS_CHANNEL_MOD_QAM8 = 0x03,
- MAXIMUS_CHANNEL_MOD_QAM16 = 0x04,
- MAXIMUS_CHANNEL_MOD_QAM64 = 0x05,
- MAXIMUS_CHANNEL_MOD_QAM256 = 0x06,
- MAXIMUS_CHANNEL_MOD_QAM1024 = 0x07,
- MAXIMUS_CHANNEL_MOD_NB = 0x08,
- MAXIMUS_CHANNEL_I_Q_VALUE = MAXIMUS_CHANNEL_MOD_NONE
+ MAXIMUS_CHANNEL_MOD_NONE = 0x00,
+ MAXIMUS_CHANNEL_MOD_BPSK = 0x01,
+ MAXIMUS_CHANNEL_MOD_QPSK = 0x02,
+ MAXIMUS_CHANNEL_MOD_QAM8 = 0x03,
+ MAXIMUS_CHANNEL_MOD_QAM16 = 0x04,
+ MAXIMUS_CHANNEL_MOD_QAM64 = 0x05,
+ MAXIMUS_CHANNEL_MOD_QAM256 = 0x06,
+ MAXIMUS_CHANNEL_MOD_QAM1024 = 0x07,
+ MAXIMUS_CHANNEL_MOD_NB = 0x08,
+ MAXIMUS_CHANNEL_I_Q_VALUE = MAXIMUS_CHANNEL_MOD_NONE
};
-#endif // CHANNEL_TYPES_H
+#endif // maximus_common_types_channel_types_h
diff --git a/cesar/maximus/common/types/ethernet_types.h b/cesar/maximus/common/types/ethernet_types.h
index 646edb32dc..3006e04ebb 100644
--- a/cesar/maximus/common/types/ethernet_types.h
+++ b/cesar/maximus/common/types/ethernet_types.h
@@ -1,35 +1,17 @@
-/************************************************************************
- ethernet_types.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/types/ethernet_types.h
-**************************************************************************/
-
-#ifndef ETHERNET_TYPES_H
-#define ETHERNET_TYPES_H
+#ifndef maximus_common_types_ethernet_types_h
+#define maximus_common_types_ethernet_types_h
+/* Maximus project {{{
+ *
+ * Copyright (C) 2012 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file maximus/common/types/ethernet_types.h
+ * \ingroup maximus_common_types
+ *
+ */
#include <stdint.h> /* for 'uint8_t', 'uint16_t' and 'uint32_t' types */
@@ -42,31 +24,31 @@ typedef uint8_t Ethernet_Flags; /* not used */
struct Ethernet_Header
{
- uint8_t version;
- uint8_t type;
- uint8_t flags; /* not used */
- uint8_t reserved;
+ uint8_t version;
+ uint8_t type;
+ uint8_t flags; /* not used */
+ uint8_t reserved;
} __attribute__ ((__packed__));
/* Ethernet_Header.type */
enum Ethernet_Type
{
- ETHERNET_TYPE_NONE = 0x00,
-
- /* IPMBOX_MSG_DATA > Data message type.
- * Ether SCI msg data contain the MSDU (Ethernet Frame). */
- ETHERNET_TYPE_DATA = 0x01,
- /* IPMBOX_MSG_MBX > MME message type.
- * Ether SCI msg data contain the MSDU (MME). */
- ETHERNET_TYPE_MME = 0x02,
- /* IPMBOX_MSG_EMPTY_BUF > Buffer alloc message type.
- * Ether SCI msg data contain the number of buffers to allocate (uint32_t)
- * and IDs of each buffer to allocate (uint32_t). */
- ETHERNET_TYPE_BUFFER_ADD = 0x03,
- /* IPMBOX_MSG_EMPTY_BUF > Buffer dealloc message type.
- * Ether SCI msg data contain the ID of released buffer (uint32_t). */
- ETHERNET_TYPE_BUFFER_RELEASED = 0x04,
- ETHERNET_TYPE_NB
+ ETHERNET_TYPE_NONE = 0x00,
+
+ /* IPMBOX_MSG_DATA > Data message type.
+ * Ether SCI msg data contain the MSDU (Ethernet Frame). */
+ ETHERNET_TYPE_DATA = 0x01,
+ /* IPMBOX_MSG_MBX > MME message type.
+ * Ether SCI msg data contain the MSDU (MME). */
+ ETHERNET_TYPE_MME = 0x02,
+ /* IPMBOX_MSG_EMPTY_BUF > Buffer alloc message type.
+ * Ether SCI msg data contain the number of buffers to allocate (uint32_t)
+ * and IDs of each buffer to allocate (uint32_t). */
+ ETHERNET_TYPE_BUFFER_ADD = 0x03,
+ /* IPMBOX_MSG_EMPTY_BUF > Buffer dealloc message type.
+ * Ether SCI msg data contain the ID of released buffer (uint32_t). */
+ ETHERNET_TYPE_BUFFER_RELEASED = 0x04,
+ ETHERNET_TYPE_NB
};
-#endif /* ETHERNET_TYPES_H */
+#endif /* maximus_common_types_ethernet_types_h */
diff --git a/cesar/maximus/common/types/functioncall_types.h b/cesar/maximus/common/types/functioncall_types.h
index 0a6484eb85..2f29b2b72a 100644
--- a/cesar/maximus/common/types/functioncall_types.h
+++ b/cesar/maximus/common/types/functioncall_types.h
@@ -1,35 +1,17 @@
-/************************************************************************
- functioncall_types.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/types/functioncall_types.h
-**************************************************************************/
-
-#ifndef FUNCTIONCALL_TYPES_H
-#define FUNCTIONCALL_TYPES_H
+#ifndef maximus_common_types_functioncall_types_h
+#define maximus_common_types_functioncall_types_h
+/* Maximus project {{{
+ *
+ * Copyright (C) 2012 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file maximus/common/types/functioncall_types.h
+ * \ingroup maximus_common_types
+ *
+ */
#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
@@ -50,22 +32,22 @@ typedef uint8_t Function_Call_Flags;
struct Function_Call_Header
{
- uint8_t version;
- uint8_t type;
- uint16_t msg_id;
- uint8_t param_nb;
- uint8_t flags;
- uint16_t reserved;
+ uint8_t version;
+ uint8_t type;
+ uint16_t msg_id;
+ uint8_t param_nb;
+ uint8_t flags;
+ uint16_t reserved;
} __attribute__ ((__packed__));
// Function_Call_Header.type
//
enum Function_Call_Type
{
- FUNCTION_CALL_TYPE_NONE = 0x00,
- FUNCTION_CALL_TYPE_REQ = 0x01,
- FUNCTION_CALL_TYPE_RSP = 0x02,
- FUNCTION_CALL_TYPE_NB
+ FUNCTION_CALL_TYPE_NONE = 0x00,
+ FUNCTION_CALL_TYPE_REQ = 0x01,
+ FUNCTION_CALL_TYPE_RSP = 0x02,
+ FUNCTION_CALL_TYPE_NB
};
// Function_Call_Header.msg_id
@@ -74,6 +56,6 @@ typedef uint16_t Function_Call_Msg_Id;
// Function_Call_Header.param_nb
//
-typedef unsigned int Function_Call_Parameters_Number;
+typedef uint8_t Function_Call_Parameters_Number;
-#endif // FUNCTIONCALL_TYPES_H
+#endif // maximus_common_types_functioncall_types_h
diff --git a/cesar/maximus/common/types/hal_phy_types.h b/cesar/maximus/common/types/hal_phy_types.h
index 030ed92e95..60dd62e8e0 100644
--- a/cesar/maximus/common/types/hal_phy_types.h
+++ b/cesar/maximus/common/types/hal_phy_types.h
@@ -1,40 +1,19 @@
-/************************************************************************
- hal_phy_types.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/types/hal_phy_types.h
-**************************************************************************/
-
-#ifndef HAL_PHY_TYPES_H
-#define HAL_PHY_TYPES_H
-
-#include "common/std.h"
-#include "hal/phy/defs.h" // for 'phy_fc_mode_t', 'phy_mod_t', 'phy_fecrate_t', and 'phy_gil_t'
-
-#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+#ifndef maximus_common_types_hal_phy_types_h
+#define maximus_common_types_hal_phy_types_h
+/* Maximus project {{{
+ *
+ * Copyright (C) 2012 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file maximus/common/types/hal_phy_types.h
+ * \ingroup maximus_common_types
+ *
+ */
+#include "hal/phy/defs.h"
+#include <stdint.h>
// Phy_Header.pb_nb
//
@@ -72,4 +51,4 @@ typedef uint16_t Phy_Tx_Id;
//
typedef uint32_t Phy_Nb_Of_Symbols;
-#endif // HAL_PHY_TYPES_H
+#endif // maximus_common_types_hal_phy_types_h
diff --git a/cesar/maximus/common/types/networkclock_types.h b/cesar/maximus/common/types/networkclock_types.h
index bc276c6fdf..c074d57de4 100644
--- a/cesar/maximus/common/types/networkclock_types.h
+++ b/cesar/maximus/common/types/networkclock_types.h
@@ -1,35 +1,18 @@
-/************************************************************************
- networkclock_types.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/types/networkclock_types.h
-**************************************************************************/
-
-#ifndef NETWORKCLOCK_TYPES_H
-#define NETWORKCLOCK_TYPES_H
+#ifndef maximus_common_types_networkclock_types_h
+#define maximus_common_types_networkclock_types_h
+
+/* Maximus project {{{
+ *
+ * Copyright (C) 2012 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file maximus/common/types/networkclock_types.h
+ * \ingroup maximus_common
+ *
+ */
#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
@@ -38,27 +21,27 @@ The original location of this file is /home/buret/eclipse/maximus/common/types/n
struct Network_Clock_Header
{
- uint8_t version;
- uint8_t type;
- uint16_t id;
- uint16_t flags;
- uint16_t reserved;
- uint32_t tick_high;
- uint32_t tick_low;
+ uint8_t version;
+ uint8_t type;
+ uint16_t id;
+ uint16_t flags;
+ uint16_t reserved;
+ uint32_t tick_high;
+ uint32_t tick_low;
} __attribute__ ((__packed__));
// Network_Clock_Header.type
//
enum Network_Clock_Type
{
- NETWORK_CLOCK_TYPE_NONE = 0x00,
- NETWORK_CLOCK_TYPE_REMOVE = 0x01,
- NETWORK_CLOCK_TYPE_STATION = 0x02,
- NETWORK_CLOCK_TYPE_FUNCTION_CALL = 0x03,
- NETWORK_CLOCK_TYPE_PHY = 0x04,
- NETWORK_CLOCK_TYPE_SYSTEM = 0x05,
- NETWORK_CLOCK_TYPE_ETHERNET = 0x06,
- NETWORK_CLOCK_TYPE_NB
+ NETWORK_CLOCK_TYPE_NONE = 0x00,
+ NETWORK_CLOCK_TYPE_REMOVE = 0x01,
+ NETWORK_CLOCK_TYPE_STATION = 0x02,
+ NETWORK_CLOCK_TYPE_FUNCTION_CALL = 0x03,
+ NETWORK_CLOCK_TYPE_PHY = 0x04,
+ NETWORK_CLOCK_TYPE_SYSTEM = 0x05,
+ NETWORK_CLOCK_TYPE_ETHERNET = 0x06,
+ NETWORK_CLOCK_TYPE_NB
};
// Network_Clock_Header.id
@@ -70,4 +53,4 @@ typedef uint16_t Network_Clock_Id;
//
typedef unsigned long long Network_Clock_Tick;
-#endif // NETWORKCLOCK_TYPES_H
+#endif // maximus_common_types_networkclock_types_h
diff --git a/cesar/maximus/common/types/phy_types.h b/cesar/maximus/common/types/phy_types.h
index 0df4e0dd97..9eab2d93c0 100644
--- a/cesar/maximus/common/types/phy_types.h
+++ b/cesar/maximus/common/types/phy_types.h
@@ -1,37 +1,19 @@
-/************************************************************************
- phy_types.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/types/phy_types.h
-**************************************************************************/
-
-#ifndef PHY_TYPES_H
-#define PHY_TYPES_H
-
-#include "sci_types.h"
+#ifndef maximus_common_types_phy_types_h
+#define maximus_common_types_phy_types_h
+/* Maximus project {{{
+ *
+ * Copyright (C) 2012 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file maximus/common/types/phy_types.h
+ * \ingroup maximus_common_types
+ *
+ */
+
+#include "maximus/common/types/sci_types.h"
#include "mac/common/defs.h" // for 'MAC_PB520_BYTES'
#include "mac/common/timings.h"
@@ -39,8 +21,8 @@ The original location of this file is /home/buret/eclipse/maximus/common/types/p
#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
#define PHY_VERSION 0x02
-#define PHY_PB_MAX_NB (SCI_MSG_MAX_SIZE/MAC_PB520_BYTES - 1) // = 31 per MPDU (-1 because of PHY header size)
-#define PHY_MSG_MAX_NB_PER_MPDU (MAC_MAX_PB_PER_MPDU/PHY_PB_MAX_NB + 1)
+#define PHY_PB_MAX_NB MAC_MAX_PB_PER_MPDU
+#define PHY_MSG_MAX_NB_PER_MPDU 2
/** Length of PB header and ICV in bytes. */
#define PHY_PB_HDR_SIZE 4
@@ -69,60 +51,60 @@ typedef uint16_t Phy_Flags;
struct Phy_Header
{
- uint8_t version;
- uint8_t type;
- uint8_t mpdu_format; // delimiter type that indicates PHY SCI msg format in case of PHY_TYPE_MPDU_PAYLOAD
- uint8_t pb_nb; // if PB size is set to 128 octets, there is only one PB
- uint8_t msg_nb; // total number of messages needed to transmit the MPDU (in case of PHY_TYPE_MPDU_PAYLOAD)
- uint8_t fc_mode; // phy_fc_mode_t
- uint8_t short_ppdu; // bool
- uint8_t mod; // phy_mod_t
- uint8_t fecrate; // phy_fecrate_t
- uint8_t gil; // phy_gil_t
- uint8_t tonemap_index;
- uint8_t reserved;
- uint16_t tx_id; // unique ID incremented for each transmission
- uint16_t flags;
- uint32_t symbol_nb; // uint
- uint32_t iv[3];
- uint32_t nek[4];
- uint32_t pb_measurement[PHY_PB_MAX_NB]; // 32 bits per PB for:
- // ber (Bit Error Rate) -> 16 bits
- // halfit -> 5 bits
- // crc_error -> 1 bit
- uint32_t pb_header[PHY_PB_MAX_NB]; // 4 octets per PB
+ uint8_t version;
+ uint8_t type;
+ uint8_t mpdu_format; // delimiter type that indicates PHY SCI msg format in case of PHY_TYPE_MPDU_PAYLOAD
+ uint8_t pb_nb; // if PB size is set to 128 octets, there is only one PB
+ uint8_t msg_nb; // total number of messages needed to transmit the MPDU (in case of PHY_TYPE_MPDU_PAYLOAD)
+ uint8_t fc_mode; // phy_fc_mode_t
+ uint8_t short_ppdu; // bool
+ uint8_t mod; // phy_mod_t
+ uint8_t fecrate; // phy_fecrate_t
+ uint8_t gil; // phy_gil_t
+ uint8_t tonemap_index;
+ uint8_t reserved;
+ uint16_t tx_id; // unique ID incremented for each transmission
+ uint16_t flags;
+ uint32_t symbol_nb; // uint
+ uint32_t iv[3];
+ uint32_t nek[4];
+ uint32_t pb_measurement[MAC_MAX_PB_PER_MPDU]; // 32 bits per PB for:
+ // ber (Bit Error Rate) -> 16 bits
+ // halfit -> 5 bits
+ // crc_error -> 1 bit
+ uint32_t pb_header[MAC_MAX_PB_PER_MPDU]; // 4 octets per PB
} __attribute__ ((__packed__));
// Phy_Header.type
//
enum Phy_Type
{
- PHY_TYPE_NONE = 0x00,
- PHY_TYPE_PREAMBLE = 0x01, // PHY SCI msg data are empty
- PHY_TYPE_FC_HYBRID_MODE = 0x02, // PHY SCI msg data contain HP1.0.1 Frame Control (25 bits => on 4 octets) and AV Frame Control (128 bits)
- PHY_TYPE_FC_AV_ONLY_MODE = 0x03, // PHY SCI msg data only contain AV Frame Control (128 bits)
- PHY_TYPE_PRS = 0x04, // PHY SCI msg data contain PRS0 or PRS1 symbol (on 1 octet)
- PHY_TYPE_MPDU_PAYLOAD = 0x05, // PHY SCI msg data only contain MPDU payload ('nb_of_pbs' PBs of 128 or 512 octets depending on PHY_FLAG_PB512)
- PHY_TYPE_TONEMASK = 0x06, // PHY SCI msg data contain 'uint carrier_nb' and the tonemask (uses 1 block)
- PHY_TYPE_TONEMAP = 0x07, // PHY SCI msg data contain tonemap (uses 2 blocks)
- PHY_TYPE_NOISE = 0x08, // PHY SCI msg data contain 'uint16_t frequency_noise[PHY_CARRIER_NB]' and 'uint16_t time_noise[MAC_MAX_SYMB_PER_MPDU]'
- PHY_TYPE_RX = 0x09, // PHY SCI msg data contain the source station ID of the expected transmission
- PHY_TYPE_ZERO_CROSS = 0x0A, // PHY SCI msg data are empty
- PHY_TYPE_NB
+ PHY_TYPE_NONE = 0x00,
+ PHY_TYPE_PREAMBLE = 0x01, // PHY SCI msg data are empty
+ PHY_TYPE_FC_HYBRID_MODE = 0x02, // PHY SCI msg data contain HP1.0.1 Frame Control (25 bits => on 4 octets) and AV Frame Control (128 bits)
+ PHY_TYPE_FC_AV_ONLY_MODE = 0x03, // PHY SCI msg data only contain AV Frame Control (128 bits)
+ PHY_TYPE_PRS = 0x04, // PHY SCI msg data contain PRS0 or PRS1 symbol (on 1 octet)
+ PHY_TYPE_MPDU_PAYLOAD = 0x05, // PHY SCI msg data only contain MPDU payload ('nb_of_pbs' PBs of 128 or 512 octets depending on PHY_FLAG_PB512)
+ PHY_TYPE_TONEMASK = 0x06, // PHY SCI msg data contain 'uint carrier_nb' and the tonemask (uses 1 block)
+ PHY_TYPE_TONEMAP = 0x07, // PHY SCI msg data contain tonemap (uses 2 blocks)
+ PHY_TYPE_NOISE = 0x08, // PHY SCI msg data contain 'uint16_t frequency_noise[PHY_CARRIER_NB]' and 'uint16_t time_noise[MAC_MAX_SYMB_PER_MPDU]'
+ PHY_TYPE_RX = 0x09, // PHY SCI msg data contain the source station ID of the expected transmission
+ PHY_TYPE_ZERO_CROSS = 0x0A, // PHY SCI msg data are empty
+ PHY_TYPE_NB
};
// Phy_Header.mpdu_format
//
enum Phy_Mpdu_Format
{
- PHY_MPDU_FORMAT_NONE = 0x00,
- PHY_MPDU_FORMAT_BEACON = 0x01, // Beacon => Long MPDU
- PHY_MPDU_FORMAT_SOF = 0x02, // Start Of Frame => Long MPDU
- PHY_MPDU_FORMAT_SACK = 0x03, // Selective ACKnowledgement => Short MPDU (i.e. there is no payload)
- PHY_MPDU_FORMAT_RTS_CTS = 0x04, // Request To Send / Clear To Send => Short MPDU (i.e. there is no payload)
- PHY_MPDU_FORMAT_SOUND = 0x05, // Sound => Long MPDU
- PHY_MPDU_FORMAT_RSOF = 0x06, // Reverse Start Of Frame => Long MPDU
- PHY_MPDU_FORMAT_NB
+ PHY_MPDU_FORMAT_NONE = 0x00,
+ PHY_MPDU_FORMAT_BEACON = 0x01, // Beacon => Long MPDU
+ PHY_MPDU_FORMAT_SOF = 0x02, // Start Of Frame => Long MPDU
+ PHY_MPDU_FORMAT_SACK = 0x03, // Selective ACKnowledgement => Short MPDU (i.e. there is no payload)
+ PHY_MPDU_FORMAT_RTS_CTS = 0x04, // Request To Send / Clear To Send => Short MPDU (i.e. there is no payload)
+ PHY_MPDU_FORMAT_SOUND = 0x05, // Sound => Long MPDU
+ PHY_MPDU_FORMAT_RSOF = 0x06, // Reverse Start Of Frame => Long MPDU
+ PHY_MPDU_FORMAT_NB
};
-#endif // PHY_TYPES_H
+#endif // maximus_common_types_phy_types_h
diff --git a/cesar/maximus/common/types/sci_types.h b/cesar/maximus/common/types/sci_types.h
index 33701a1579..af3bc6c81e 100644
--- a/cesar/maximus/common/types/sci_types.h
+++ b/cesar/maximus/common/types/sci_types.h
@@ -1,106 +1,98 @@
-/************************************************************************
- sci_types.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/types/sci_types.h
-**************************************************************************/
-
-#ifndef SCI_TYPES_H
-#define SCI_TYPES_H
+#ifndef maximus_common_types_sci_types_h
+#define maximus_common_types_sci_types_h
+/* Maximus project {{{
+ *
+ * Copyright (C) 2012 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file maximus/common/types/sci_types.h
+ * \ingroup maximus_common
+ *
+ */
#include <stdint.h> /* for 'uint8_t', 'uint16_t' and 'uint32_t' types */
+#include "mac/common/defs.h" // for 'MAC_PB520_BYTES'
#define SCI_MSG_MAGIC "MAXI"
#define SCI_MSG_VERSION 0x03
#define SCI_MSG_ID_STATION 0x8000
#define SCI_MSG_ID_MASK 0x7fff
-#define SCI_MSG_MAX_SIZE 16384
+
+/* In maximus code, sometimes max size allowed include the sci header.
+ * Specific header size vary from few bytes to many bytes (more than 2kB).
+ *
+ * SCI_PATCH_HEADER is a dirty way to avoid memory corruption. All definitions
+ * about different size must be clarify to remove this define.
+ */
+#define SCI_PATCH_HEADER 8
+#define SCI_MSG_MAX_SIZE ((MAC_MAX_PB_PER_MPDU + SCI_PATCH_HEADER) \
+ * MAC_PB520_BYTES)
/* Used by SciServer. */
enum Sci_Server_Status
{
- MAXIMUS_SCI_SERVER_STATUS_NONE = 0,
- MAXIMUS_SCI_SERVER_STATUS_RUNNING = 1,
- MAXIMUS_SCI_SERVER_STATUS_STOP = 2,
- MAXIMUS_SCI_SERVER_STATUS_STOPPED = 3,
- MAXIMUS_SCI_SERVER_STATUS_NB
+ MAXIMUS_SCI_SERVER_STATUS_NONE = 0,
+ MAXIMUS_SCI_SERVER_STATUS_RUNNING = 1,
+ MAXIMUS_SCI_SERVER_STATUS_STOP = 2,
+ MAXIMUS_SCI_SERVER_STATUS_STOPPED = 3,
+ MAXIMUS_SCI_SERVER_STATUS_NB
};
/* Used by SciMsg. */
enum Sci_Msg_Status
{
- MAXIMUS_SCI_MSG_STATUS_NONE = 0,
- MAXIMUS_SCI_MSG_STATUS_TO_SEND = 1,
- MAXIMUS_SCI_MSG_STATUS_SENT = 2,
- MAXIMUS_SCI_MSG_STATUS_RECEIVED = 3,
- MAXIMUS_SCI_MSG_STATUS_PROCESSED = 4,
- MAXIMUS_SCI_MSG_STATUS_NB
+ MAXIMUS_SCI_MSG_STATUS_NONE = 0,
+ MAXIMUS_SCI_MSG_STATUS_TO_SEND = 1,
+ MAXIMUS_SCI_MSG_STATUS_SENT = 2,
+ MAXIMUS_SCI_MSG_STATUS_RECEIVED = 3,
+ MAXIMUS_SCI_MSG_STATUS_PROCESSED = 4,
+ MAXIMUS_SCI_MSG_STATUS_NB
};
/* Common SCI message structure between station and maximus. */
struct Sci_Msg_Header
{
- /* 1st field is magic id (32 bits): always “MAXI”. */
- uint32_t magic_id;
- /* 2nd field is version (8 bits): message protocol version. */
- uint8_t version;
- /* 3rd field is type (8): message type; Sci_Msg_Type. */
- uint8_t type;
- /* 4th field is length (16 bits): message length without header. */
- uint16_t length;
- /* 5th field is station id (16 bits): source or destination station id;
- * in general, the process id of the simulated station.
- * For PHY SCI messages, station id is the source station id or the Maximus pid.
- * For all other messages, station id is the destination station id. */
- uint16_t station_id;
- /* 6th field is msg id (16 bits): unique message id for each
- * station – simulator transaction.
- * 0x0001-0x7fff: request created by simulator
- * 0x8000-0xffff: request created by a station */
- uint16_t msg_id;
- /* 7th field is netclock high: high part of 64 bits NetClock value */
- uint32_t netclock_high;
- /* 8th field is netclock low: low part of 64 bits NetClock value */
- uint32_t netclock_low;
- /* 9th and last field is flags (16 bits): Sci_Msg_Flag */
- uint16_t flags;
- /* 10th field is reserved (16 bits) */
- uint16_t reserved;
+ /* 1st field is magic id (32 bits): always “MAXI”. */
+ uint32_t magic_id;
+ /* 2nd field is version (8 bits): message protocol version. */
+ uint8_t version;
+ /* 3rd field is type (8): message type; Sci_Msg_Type. */
+ uint8_t type;
+ /* 4th field is length (32 bits): message length without header. */
+ uint32_t length;
+ /* 5th field is station id (16 bits): source or destination station id;
+ * in general, the process id of the simulated station.
+ * For PHY SCI messages, station id is the source station id or the Maximus pid.
+ * For all other messages, station id is the destination station id. */
+ uint16_t station_id;
+ /* 6th field is msg id (16 bits): unique message id for each
+ * station – simulator transaction.
+ * 0x0001-0x7fff: request created by simulator
+ * 0x8000-0xffff: request created by a station */
+ uint16_t msg_id;
+ /* 7th field is netclock high: high part of 64 bits NetClock value */
+ uint32_t netclock_high;
+ /* 8th field is netclock low: low part of 64 bits NetClock value */
+ uint32_t netclock_low;
+ /* 9th and last field is flags (16 bits): Sci_Msg_Flag */
+ uint16_t flags;
+ /* 10th field is reserved (16 bits) */
+ uint16_t reserved;
} __attribute__ ((__packed__));
/* Sci_Msg_Header.type */
enum Sci_Msg_Type
{
- SCI_MSG_TYPE_NONE = 0x00,
- SCI_MSG_TYPE_NETWORK_CLOCK = 0x01,
- SCI_MSG_TYPE_FUNCTION_CALL = 0x02,
- SCI_MSG_TYPE_PHY = 0x03,
- SCI_MSG_TYPE_SYSTEM = 0x04,
- SCI_MSG_TYPE_ETHERNET = 0x05,
- SCI_MSG_TYPE_NB
+ SCI_MSG_TYPE_NONE = 0x00,
+ SCI_MSG_TYPE_NETWORK_CLOCK = 0x01,
+ SCI_MSG_TYPE_FUNCTION_CALL = 0x02,
+ SCI_MSG_TYPE_PHY = 0x03,
+ SCI_MSG_TYPE_SYSTEM = 0x04,
+ SCI_MSG_TYPE_ETHERNET = 0x05,
+ SCI_MSG_TYPE_NB
};
/* Sci_Msg_Header.station_id */
@@ -112,16 +104,16 @@ typedef uint16_t Sci_Msg_Id;
/* Sci_Msg_Header.flags */
enum Sci_Msg_Flag
{
- SCI_MSG_FLAG_NONE = 0x0000,
- /* If set, message is a response to a request;
- * else, it is a request. */
- SCI_MSG_FLAG_RESP = 0x0001,
- /* If set, message is an acknowledge to a request or a response. */
- SCI_MSG_FLAG_ACK = 0x0002,
- /* If set, an ack is requested from remote receiver. */
- SCI_MSG_FLAG_NEEDACK = 0x0004,
- /* If set, a synchronous response is required. */
- SCI_MSG_FLAG_SYNC = 0x0008
+ SCI_MSG_FLAG_NONE = 0x0000,
+ /* If set, message is a response to a request;
+ * else, it is a request. */
+ SCI_MSG_FLAG_RESP = 0x0001,
+ /* If set, message is an acknowledge to a request or a response. */
+ SCI_MSG_FLAG_ACK = 0x0002,
+ /* If set, an ack is requested from remote receiver. */
+ SCI_MSG_FLAG_NEEDACK = 0x0004,
+ /* If set, a synchronous response is required. */
+ SCI_MSG_FLAG_SYNC = 0x0008
};
-#endif /* SCI_TYPES_H */
+#endif /* maximus_common_types_sci_types_h */
diff --git a/cesar/maximus/common/types/system_types.h b/cesar/maximus/common/types/system_types.h
index d3877760d7..c3b23ea278 100644
--- a/cesar/maximus/common/types/system_types.h
+++ b/cesar/maximus/common/types/system_types.h
@@ -1,35 +1,17 @@
-/************************************************************************
- system_types.h - Copyright buret
-
-Here you can write a license for your code, some comments or any other
-information you want to have in your generated code. To to this simply
-configure the "headings" directory in uml to point to a directory
-where you have your heading files.
-
-or you can just replace the contents of this file with your own.
-If you want to do this, this file is located at
-
-/usr/share/apps/umbrello/headings/heading.h
-
--->Code Generators searches for heading files based on the file extension
- i.e. it will look for a file name ending in ".h" to include in C++ header
- files, and for a file name ending in ".java" to include in all generated
- java code.
- If you name the file "heading.<extension>", Code Generator will always
- choose this file even if there are other files with the same extension in the
- directory. If you name the file something else, it must be the only one with that
- extension in the directory to guarantee that Code Generator will choose it.
-
-you can use variables in your heading files which are replaced at generation
-time. possible variables are : author, date, time, filename and filepath.
-just write %variable_name%
-
-This file was generated on %date% at %time%
-The original location of this file is /home/buret/eclipse/maximus/common/types/system_types.h
-**************************************************************************/
-
-#ifndef SYSTEM_TYPES_H
-#define SYSTEM_TYPES_H
+#ifndef maximus_common_types_system_types_h
+#define maximus_common_types_system_types_h
+/* Maximus project {{{
+ *
+ * Copyright (C) 2012 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file maximus/common/types/system_types.h
+ * \ingroup maximus_common_types
+ *
+ */
#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
@@ -38,11 +20,11 @@ The original location of this file is /home/buret/eclipse/maximus/common/types/s
enum Station_Status
{
- MAXIMUS_STATION_STATUS_NONE = 0,
- MAXIMUS_STATION_STATUS_IDLE = 1,
- MAXIMUS_STATION_STATUS_BUSY = 2,
- MAXIMUS_STATION_STATUS_DEACTIVATED = 3,
- MAXIMUS_STATION_STATUS_NB
+ MAXIMUS_STATION_STATUS_NONE = 0,
+ MAXIMUS_STATION_STATUS_IDLE = 1,
+ MAXIMUS_STATION_STATUS_BUSY = 2,
+ MAXIMUS_STATION_STATUS_DEACTIVATED = 3,
+ MAXIMUS_STATION_STATUS_NB
};
typedef int File_Descriptor;
@@ -51,19 +33,19 @@ typedef int Error_Id;
struct System_Header
{
- uint8_t version;
- uint8_t type;
- uint16_t flags;
+ uint8_t version;
+ uint8_t type;
+ uint16_t flags;
} __attribute__ ((__packed__));
// System_Header.type
//
enum System_Type
{
- SYSTEM_TYPE_NONE = 0x00,
- SYSTEM_TYPE_IDLE = 0x01,
- SYSTEM_TYPE_STATION_NAME = 0x02, // System SCI msg data contain 'char station_name[SYSTEM_STATION_NAME_MAX_SIZE]'
- SYSTEM_TYPE_NB
+ SYSTEM_TYPE_NONE = 0x00,
+ SYSTEM_TYPE_IDLE = 0x01,
+ SYSTEM_TYPE_STATION_NAME = 0x02, // System SCI msg data contain 'char station_name[SYSTEM_STATION_NAME_MAX_SIZE]'
+ SYSTEM_TYPE_NB
};
-#endif // SYSTEM_TYPES_H
+#endif // maximus_common_types_system_types_h