Using the µVision Socket Interface: UVSOCK Data Types

| Using the µVision Socket Interface Application Note 198 Control and monitor µVision via the built-in TCP/IP interface

- Main Page
- Usage and Description
- Reference

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
UVSOCK Data Types

The UVSOCK data types are designed for easy implementation on a x86-based architecture without conversion. The table lists the types.

Data types and size

Data Type | Width (bits)
--- | ---
bit | 1
(unsigned) char | 8
(unsigned) short | 16
(unsigned) short int | 16
(unsigned) int | 32
(unsigned) long | 32
(unsigned) long int | 32
(unsigned) int64 | 64
float | 32
double | 64
ptr | 32
union | 32
struct | 32
func | 32
string | 32
enum | 32
field | 32

Endianness
All types use the conventions of x86 processors. That is, they are byte little endian.

Integer Signing
Negative integer numbers are represented as 2's complement.

Floating Point Encoding
Floating point numbers are represented according to IEEE 754 Standard for Binary Floating-Point Arithmetic (IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985)).

The Variant Data Type
The Variant Data Type is returned by several functions in UVSOCK and defined in VTT_TYPE. It contains a raw value that should be interpreted as indicated by the Value Type (vType). This is necessary because in some cases the result type is not known beforehand, for example, when reading a Virtual Register (VTR).

C declaration of the Variant Data Type:

typedef struct tval {
int vType; // VTREG Result-Type
union { // member depends on ''vType'
unsigned long ul;
signed char sc;
unsigned char uc;
signed short i16;
unsigned short u16;
signed long l;
int i;
__int64 i64;
unsigned __int64 u64;
float f;
double d;
} v;
} TVAL;

Definitions of the Value Type (vType):

//Type // Element access in C union:
#define VTT_void 0 // ---
#define VTT_bit 1 // v.i &amp; 1
#define VTT_char 2 // v.sc
#define VTT_uchar 3 // v.uc
#define VTT_int 4 // v.i
#define VTT_uint 5 // v.ul
#define VTT_short 6 // v.i16
#define VTT_ushort 7 // v.u16
#define VTT_long 8 // v.l
#define VTT_ulong 9 // v.ul
#define VTT_float 10 // v.f
#define VTT_double 11 // v.d
#define VTT_ptr 12 // v.ul
#define VTT_union 13 // ---
#define VTT_struct 14 // ---
#define VTT_func 15 // ---
#define VTT_string 16 // ---
#define VTT_enum 17 // ---
#define VTT_field 18 // ---
#define VTT_int64 19 // v.i64
#define VTT_uint64 20 // v.u64