server/client

Dependencies:   mbed NetServicesMin

Committer:
recotana
Date:
Thu Feb 23 02:38:05 2012 +0000
Revision:
1:6e61ee662fd3
added standalone test mode

Who changed what in which revision?

UserRevisionLine numberNew contents of line
recotana 1:6e61ee662fd3 1 /*----------------------------------------------------------------------------*/
recotana 1:6e61ee662fd3 2 /* File Information */
recotana 1:6e61ee662fd3 3 /*----------------------------------------------------------------------------*/
recotana 1:6e61ee662fd3 4 /* Name : types.h */
recotana 1:6e61ee662fd3 5 /* Type : C Programming Language Header */
recotana 1:6e61ee662fd3 6 /*----------------------------------------------------------------------------*/
recotana 1:6e61ee662fd3 7 /*----------------------------------------------------------------------------*/
recotana 1:6e61ee662fd3 8
recotana 1:6e61ee662fd3 9 #ifndef __TYPES_H__
recotana 1:6e61ee662fd3 10 #define __TYPES_H__
recotana 1:6e61ee662fd3 11
recotana 1:6e61ee662fd3 12 #include "stdint.h"
recotana 1:6e61ee662fd3 13 /*
recotana 1:6e61ee662fd3 14 typedef char int8_t;
recotana 1:6e61ee662fd3 15 typedef unsigned char uint8_t;
recotana 1:6e61ee662fd3 16 typedef signed short int16_t;
recotana 1:6e61ee662fd3 17 typedef unsigned short uint16_t;
recotana 1:6e61ee662fd3 18 typedef signed int int32_t;
recotana 1:6e61ee662fd3 19 typedef unsigned int uint32_t;
recotana 1:6e61ee662fd3 20 typedef signed long long int64_t;
recotana 1:6e61ee662fd3 21 typedef unsigned long long uint64_t;
recotana 1:6e61ee662fd3 22 */
recotana 1:6e61ee662fd3 23 //typedef bool bool_t;
recotana 1:6e61ee662fd3 24 typedef enum{TRUE, FALSE} bool_t;
recotana 1:6e61ee662fd3 25
recotana 1:6e61ee662fd3 26 //=========================================================================
recotana 1:6e61ee662fd3 27 // byte bit access
recotana 1:6e61ee662fd3 28 //=========================================================================
recotana 1:6e61ee662fd3 29 typedef union{ // BYTE/NIBBLE/BIT access
recotana 1:6e61ee662fd3 30 uint8_t byte; // Byte access
recotana 1:6e61ee662fd3 31 struct{ // Nibble access
recotana 1:6e61ee662fd3 32 uint8_t lo : 4; // lower(Bit0 - 3)
recotana 1:6e61ee662fd3 33 uint8_t hi : 4; // upper(Bit4 - 7)
recotana 1:6e61ee662fd3 34 }nibble;
recotana 1:6e61ee662fd3 35 struct{ // Bit access
recotana 1:6e61ee662fd3 36 uint8_t b0 : 1; // Bit0
recotana 1:6e61ee662fd3 37 uint8_t b1 : 1; // Bit1
recotana 1:6e61ee662fd3 38 uint8_t b2 : 1; // Bit2
recotana 1:6e61ee662fd3 39 uint8_t b3 : 1; // Bit3
recotana 1:6e61ee662fd3 40 uint8_t b4 : 1; // Bit4
recotana 1:6e61ee662fd3 41 uint8_t b5 : 1; // Bit5
recotana 1:6e61ee662fd3 42 uint8_t b6 : 1; // Bit6
recotana 1:6e61ee662fd3 43 uint8_t b7 : 1; // Bit7
recotana 1:6e61ee662fd3 44 }bits;
recotana 1:6e61ee662fd3 45 }byte_t;
recotana 1:6e61ee662fd3 46
recotana 1:6e61ee662fd3 47 //=========================================================================
recotana 1:6e61ee662fd3 48 // word bit access
recotana 1:6e61ee662fd3 49 //=========================================================================
recotana 1:6e61ee662fd3 50 typedef union{ // WORD/BYTE/NIBBLE/BIT access
recotana 1:6e61ee662fd3 51 uint16_t word; // Word access
recotana 1:6e61ee662fd3 52 struct{ // Byte access
recotana 1:6e61ee662fd3 53 uint8_t b0; // upper byte
recotana 1:6e61ee662fd3 54 uint8_t b1; // lower byte
recotana 1:6e61ee662fd3 55 }byte;
recotana 1:6e61ee662fd3 56 struct { // Nibble access
recotana 1:6e61ee662fd3 57 uint8_t n0 : 4; // lower byte low(Bit 0 - 3)
recotana 1:6e61ee662fd3 58 uint8_t n1 : 4; // lower byte up (Bit 4 - 7)
recotana 1:6e61ee662fd3 59 uint8_t n2 : 4; // upper byte low(Bit 8 - 11)
recotana 1:6e61ee662fd3 60 uint8_t n3 : 4; // upper byte up (Bit12 - 15)
recotana 1:6e61ee662fd3 61 }nibble;
recotana 1:6e61ee662fd3 62 struct{ // Bit acces
recotana 1:6e61ee662fd3 63 uint8_t b0 : 1; // Bit0
recotana 1:6e61ee662fd3 64 uint8_t b1 : 1; // Bit1
recotana 1:6e61ee662fd3 65 uint8_t b2 : 1; // Bit2
recotana 1:6e61ee662fd3 66 uint8_t b3 : 1; // Bit3
recotana 1:6e61ee662fd3 67 uint8_t b4 : 1; // Bit4
recotana 1:6e61ee662fd3 68 uint8_t b5 : 1; // Bit5
recotana 1:6e61ee662fd3 69 uint8_t b6 : 1; // Bit6
recotana 1:6e61ee662fd3 70 uint8_t b7 : 1; // Bit7
recotana 1:6e61ee662fd3 71 uint8_t b8 : 1; // Bit8
recotana 1:6e61ee662fd3 72 uint8_t b9 : 1; // Bit9
recotana 1:6e61ee662fd3 73 uint8_t b10: 1; // Bit10
recotana 1:6e61ee662fd3 74 uint8_t b11: 1; // Bit11
recotana 1:6e61ee662fd3 75 uint8_t b12: 1; // Bit12
recotana 1:6e61ee662fd3 76 uint8_t b13: 1; // Bit13
recotana 1:6e61ee662fd3 77 uint8_t b14: 1; // Bit14
recotana 1:6e61ee662fd3 78 uint8_t b15: 1; // Bit15
recotana 1:6e61ee662fd3 79 }bits;
recotana 1:6e61ee662fd3 80 }word_t;
recotana 1:6e61ee662fd3 81
recotana 1:6e61ee662fd3 82
recotana 1:6e61ee662fd3 83 //=========================================================================
recotana 1:6e61ee662fd3 84 // ascii code
recotana 1:6e61ee662fd3 85 //=========================================================================
recotana 1:6e61ee662fd3 86 #define Z_NUL (0x00)
recotana 1:6e61ee662fd3 87 #define Z_SOH (0x01)
recotana 1:6e61ee662fd3 88 #define Z_STX (0x02)
recotana 1:6e61ee662fd3 89 #define Z_ETX (0x03)
recotana 1:6e61ee662fd3 90 #define Z_EOT (0x04)
recotana 1:6e61ee662fd3 91 #define Z_ENQ (0x05)
recotana 1:6e61ee662fd3 92 #define Z_ACK (0x06)
recotana 1:6e61ee662fd3 93 #define Z_BEL (0x07)
recotana 1:6e61ee662fd3 94
recotana 1:6e61ee662fd3 95 #define Z_BS (0x08)
recotana 1:6e61ee662fd3 96 #define Z_HT (0x09)
recotana 1:6e61ee662fd3 97 #define Z_LF (0x0A)
recotana 1:6e61ee662fd3 98 #define Z_HM (0x0B)
recotana 1:6e61ee662fd3 99 #define Z_FF (0x0C)
recotana 1:6e61ee662fd3 100 #define Z_CR (0x0D)
recotana 1:6e61ee662fd3 101 #define Z_SO (0x0E)
recotana 1:6e61ee662fd3 102 #define Z_SI (0x0F)
recotana 1:6e61ee662fd3 103
recotana 1:6e61ee662fd3 104 #define Z_DLE (0x10)
recotana 1:6e61ee662fd3 105 #define Z_DC1 (0x11)
recotana 1:6e61ee662fd3 106 #define Z_DC2 (0x12)
recotana 1:6e61ee662fd3 107 #define Z_DC3 (0x13)
recotana 1:6e61ee662fd3 108 #define Z_DC4 (0x14)
recotana 1:6e61ee662fd3 109 #define Z_NAK (0x15)
recotana 1:6e61ee662fd3 110 #define Z_SYN (0x16)
recotana 1:6e61ee662fd3 111 #define Z_ETB (0x17)
recotana 1:6e61ee662fd3 112
recotana 1:6e61ee662fd3 113
recotana 1:6e61ee662fd3 114 #endif /* __TYPES_H__*/