connectivitylayer/isce/isirouter_dll/inc/isihelpers.h
changeset 9 8486d82aef45
parent 0 63b37f68c1ce
--- a/connectivitylayer/isce/isirouter_dll/inc/isihelpers.h	Wed Apr 21 14:29:55 2010 +0300
+++ b/connectivitylayer/isce/isirouter_dll/inc/isihelpers.h	Tue Oct 19 13:16:20 2010 +0300
@@ -24,15 +24,63 @@
 #include <commisi.h>                    // For SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP
 #include <phonetisi.h>                  // For ISI_HEADER_SIZE
 
+
+#ifndef PN_DEV_OWN
+#define PN_DEV_OWN 0 // PN_DEV_HOST
+#endif // PN_DEV_OWN
+
+#ifndef PN_OBJ_ROUTING_REQ
+#define PN_OBJ_ROUTING_REQ 0x00
+#endif // PN_OBJ_ROUTING_REQ
+
+#ifndef PN_MEDIA_ROUTING_REQ
+#define PN_MEDIA_ROUTING_REQ 0x00
+#endif // PN_MEDIA_ROUTING_REQ
+
+#ifndef PN_OBJ_ROUTER
+#define PN_OBJ_ROUTER PN_OBJ_ROUTING_REQ
+#endif // PN_OBJ_ROUTER
+
+
+#ifndef PN_DEV_MODEM
+#define PN_DEV_MODEM        0x60
+#endif // PN_DEV_MODEM
+
+#ifndef PN_MEDIA_MODEM_HOST_IF
+#define PN_MEDIA_MODEM_HOST_IF  0x26 // Media to/from PN_DEV_MODEM
+#endif // PN_MEDIA_MODEM_HOST_IF
+
+#ifndef PN_DEV_PC
+#define PN_DEV_PC       0x10
+#endif // PN_MEDIA_TEST
+
+// not real only for testing
+#ifndef PN_DEV_DUMMYIST
+// SET equla to PN_DEV_TEST 0x3c
+#define PN_DEV_DUMMYIST     0x3c 
+#endif // PN_DEV_DUMMYIST
+
+#ifndef PN_MEDIA_TEST
+#define PN_MEDIA_TEST       0xBB
+#endif // PN_MEDIA_TEST
+// not real
+
+// <- end 
+
 // MACROS
 
 #if defined ( __WINS__ )
 #define MESSAGELENGTH_LSB 5
 #define MESSAGELENGTH_MSB 4
-#else
+#else // __WINS__
+#ifndef ISI_LENGTH_BIG_ENDIAN
 #define MESSAGELENGTH_LSB 4
 #define MESSAGELENGTH_MSB 5
-#endif
+#else  //ISI_LENGTH_BIG_ENDIAN
+#define MESSAGELENGTH_LSB 5
+#define MESSAGELENGTH_MSB 4
+#endif // ISI_LENGTH_BIG_ENDIAN
+#endif // __WINS__
 
 #define IS_DEV_HOST( dev )            ( ( dev & 0xF0 ) == 0 )
 #define GET_RECEIVER_DEV( msg )       ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] & 0xFC )
@@ -57,6 +105,60 @@
 #define SET_LENGTH( msg,len )         msg[ MESSAGELENGTH_MSB ] = ( TUint8 )( ( len ) >> 8 );msg[ MESSAGELENGTH_LSB ] = ( TUint8 )( len );
 #define GET_LENGTH( msg )             ( ( ( TUint16 )( ( msg[ MESSAGELENGTH_MSB ] ) << 8 ) ) | msg[ MESSAGELENGTH_LSB ] )
 
+
+/* PUTB8 macro writes byte value to given address.
+ * This macro is used mainly by other PUTBXX macros.
+ */
+#define PUTB8(p,v) \
+    {(*(TUint8 *)(p)) = ((TUint8)(v));}
+
+
+/* PUTB16 macro writes 16-bit value in Big Endian format
+ * to given address. 16-bit value is written as two separate
+ * bytes, and so this macro can write 16-bit value to whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define PUTB16(p,v) \
+    {PUTB8((p),(TUint16)(v)>>8); PUTB8((TUint8*)(p)+1,v);}
+
+
+/* PUTB32 macro writes 32-bit value in Big Endian format
+ * to given address. 32-bit value is written as four separate
+ * bytes, and so this macro can write 32-bit value to whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define PUTB32(p,v) \
+    {PUTB16((p),(TUint32)(v)>>16); PUTB16((TUint8*)(p)+2,(TUint32)(v));}
+
+
+/**
+ *    Big Endian to local endian type
+ */
+ /* GETB8 macro returns byte value from given address.
+ * This macro is used mainly by other GETBXX macros.
+ */
+#define GETB8(p) \
+    (*(TUint8 *)(p))
+
+
+/* GETB16 macro reads 16-bit value in Big Endian format
+ * from given address. 16-bit value is read as two separate
+ * bytes, and so this macro can read 16-bit value from whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define GETB16(p) \
+    (((TUint16) GETB8(p)<<8) | (TUint16) GETB8((TUint8 *)(p)+1))
+
+
+/* GETB32 macro reads 32-bit value in Big Endian format
+ * from given address. 32-bit value is read as four separate
+ * bytes, and so this macro can read 32-bit value from whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define GETB32(p) \
+    (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2))
+
+
 // FUNCTION PROTOTYPES
 
 // FORWARD DECLARATIONS