summaryrefslogtreecommitdiff
path: root/cesar/maximus/common
diff options
context:
space:
mode:
authorCeline Buret2012-01-25 16:30:36 +0100
committerNicolas Schodet2012-02-20 10:08:48 +0100
commitb52ef10927f78ba6759a4ed131b581be66e878ae (patch)
tree02f7934497e333c4927a5a4788425cab239a0a51 /cesar/maximus/common
parentcb290f808ce494a59f80a09877f32a2a0d63de73 (diff)
cesar/maximus: apply coding rules, refs #2937
Diffstat (limited to 'cesar/maximus/common')
-rw-r--r--cesar/maximus/common/types/ethernet_types.h38
-rw-r--r--cesar/maximus/common/types/sci_types.h78
2 files changed, 63 insertions, 53 deletions
diff --git a/cesar/maximus/common/types/ethernet_types.h b/cesar/maximus/common/types/ethernet_types.h
index 78e25a996d..646edb32dc 100644
--- a/cesar/maximus/common/types/ethernet_types.h
+++ b/cesar/maximus/common/types/ethernet_types.h
@@ -31,13 +31,12 @@ The original location of this file is /home/buret/eclipse/maximus/common/types/e
#ifndef ETHERNET_TYPES_H
#define ETHERNET_TYPES_H
-#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+#include <stdint.h> /* for 'uint8_t', 'uint16_t' and 'uint32_t' types */
#define ETHERNET_VERSION 0x02
-// Ethernet_Header.flags
-//
-typedef uint8_t Ethernet_Flags; // not used
+/* Ethernet_Header.flags */
+typedef uint8_t Ethernet_Flags; /* not used */
#define ETHERNET_FLAG_NONE 0x00
#define ETHERNET_FLAG_MAX ETHERNET_FLAG_NONE
@@ -45,28 +44,29 @@ struct Ethernet_Header
{
uint8_t version;
uint8_t type;
- uint8_t flags; // not used
+ uint8_t flags; /* not used */
uint8_t reserved;
} __attribute__ ((__packed__));
-// Ethernet_Header.type
-//
+/* Ethernet_Header.type */
enum Ethernet_Type
{
ETHERNET_TYPE_NONE = 0x00,
- /* HLE_MSG_TYPE_DATA > Data or MME message type. */
- ETHERNET_TYPE_DATA = 0x01, // Ether SCI msg data contain the MSDU (Ethernet Frame)
- ETHERNET_TYPE_MME = 0x02, // Ether SCI msg data contain the MSDU (MME)
-
- /* HLE_MSG_TYPE_BUFFER_ADD > Buffer alloc message type. */
- ETHERNET_TYPE_BUFFER_ADD = 0x03, // Ether SCI msg data contain the number of buffers to allocate (uint32_t)
- // and IDs of each buffer to allocate (uint32_t)
-
- /* HLE_MSG_TYPE_SEND_DONE > Buffer dealloc message type. */
- ETHERNET_TYPE_BUFFER_RELEASED = 0x04, // Ether SCI msg data contain the ID of released buffer (uint32_t)
-
+ /* 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 /* ETHERNET_TYPES_H */
diff --git a/cesar/maximus/common/types/sci_types.h b/cesar/maximus/common/types/sci_types.h
index 81e7b6b1f1..33701a1579 100644
--- a/cesar/maximus/common/types/sci_types.h
+++ b/cesar/maximus/common/types/sci_types.h
@@ -31,7 +31,7 @@ The original location of this file is /home/buret/eclipse/maximus/common/types/s
#ifndef SCI_TYPES_H
#define SCI_TYPES_H
-#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+#include <stdint.h> /* for 'uint8_t', 'uint16_t' and 'uint32_t' types */
#define SCI_MSG_MAGIC "MAXI"
#define SCI_MSG_VERSION 0x03
@@ -39,8 +39,7 @@ The original location of this file is /home/buret/eclipse/maximus/common/types/s
#define SCI_MSG_ID_MASK 0x7fff
#define SCI_MSG_MAX_SIZE 16384
-// Used by SciServer
-//
+/* Used by SciServer. */
enum Sci_Server_Status
{
MAXIMUS_SCI_SERVER_STATUS_NONE = 0,
@@ -50,8 +49,7 @@ enum Sci_Server_Status
MAXIMUS_SCI_SERVER_STATUS_NB
};
-// Used by SciMsg
-//
+/* Used by SciMsg. */
enum Sci_Msg_Status
{
MAXIMUS_SCI_MSG_STATUS_NONE = 0,
@@ -62,28 +60,38 @@ enum Sci_Msg_Status
MAXIMUS_SCI_MSG_STATUS_NB
};
-// Common SCI message structure between station and maximus
-//
+/* Common SCI message structure between station and maximus. */
struct Sci_Msg_Header
{
- uint32_t magic_id; /* 1st field is magic id (32 bits): always “MAXI” */
- uint8_t version; /* 2nd field is version (8 bits): message protocol version */
- uint8_t type; /* 3rd field is type (8): message type; Sci_Msg_Type */
- uint16_t length; /* 4th field is length (16 bits): message length without header */
- uint16_t station_id; /* 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 msg_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 */
- uint32_t netclock_high; /* 7th field is netclock high: high part of 64 bits NetClock value */
- uint32_t netclock_low; /* 8th field is netclock low: low part of 64 bits NetClock value */
- uint16_t flags; /* 9th and last field is flags (16 bits): Sci_Msg_Flag */
- uint16_t reserved; /* 10th field is reserved (16 bits) */
+ /* 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;
} __attribute__ ((__packed__));
-// Sci_Msg_Header.type
-//
+/* Sci_Msg_Header.type */
enum Sci_Msg_Type
{
SCI_MSG_TYPE_NONE = 0x00,
@@ -95,23 +103,25 @@ enum Sci_Msg_Type
SCI_MSG_TYPE_NB
};
-// Sci_Msg_Header.station_id
-//
+/* Sci_Msg_Header.station_id */
typedef uint16_t Sci_Msg_Station_Id;
-// Sci_Msg_Header.msg_id
-//
+/* Sci_Msg_Header.msg_id */
typedef uint16_t Sci_Msg_Id;
-// Sci_Msg_Header.flags
-//
+/* Sci_Msg_Header.flags */
enum Sci_Msg_Flag
{
SCI_MSG_FLAG_NONE = 0x0000,
- SCI_MSG_FLAG_RESP = 0x0001, // if set, message is a response to a request; else, it is a request
- SCI_MSG_FLAG_ACK = 0x0002, // if set, message is an acknowledge to a request or a response
- SCI_MSG_FLAG_NEEDACK = 0x0004, // if set, an ack is requested from remote receiver
- SCI_MSG_FLAG_SYNC = 0x0008 // if set, a synchronous response is required
+ /* 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 /* SCI_TYPES_H */