Commits

Andrew Cooper committed 80da7fa

Add task for SNAP processing

Comments (0)

Files changed (6)

 CSRCS = \
     main.c\
     hid_task.c\
-    uart_task.c\
+    snap_task.c\
     usb_descriptors.c\
     usb_specific_request.c\
     arch/at90usb128/lib_board/usb_key/usb_key.c\
+    arch/at90usb128/lib_mcu/usart/usart.c\
     arch/at90usb128/lib_mcu/usb/usb_drv.c\
     arch/at90usb128/lib_mcu/util/start_boot.c\
     arch/at90usb128/modules/usb/device_chap9/usb_device_task.c\
 	@echo 'Building file: $<'
 	@mkdir -p $(dir $@) 2>/dev/null
 	$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $(@)
+	@echo
 	
 # Preprocess & assemble: create object files from assembler source files.
 $(OUTPUT)/%.o: %.s
 	@echo 'Building file: $<'
 	@mkdir -p $(dir $@) 2>/dev/null
 	@$(CC) $(INCLUDES) $(ASMFLAGS) -c $< -o $(@)
+	@echo
 
 # Link: bring object files together into a final executable
 $(TARGET): $(OBJECTS)
 	@echo "Linking"
 	@$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
+	@echo
 
 # Hexify: convert executable into Intel-Hex format
 %.hex: $(TARGET)
 	@echo "Create hex file"
 	@avr-objcopy -O ihex $(HEX_FLASH_FLAGS)  $< $@
+	@echo
 
 # EEPify: convert executable into EEP format
 %.eep: $(TARGET)
 	@echo "Create eep file"
 	@avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@  || exit 0
+	@echo
 
 # LSSify: convert executable into LSS format
 %.lss: $(TARGET)
 	@echo "Create lss file"
 	@avr-objdump -h -S $< > $@
+	@echo
 
 # Size: Tell memory usage of the executable
 size: ${TARGET}

arch/at90usb128/lib_mcu/usart/usart.c

 // Modified by: AR
 
 /* Includes */
+#include <stdbool.h>
 #include <avr/io.h>
 #include <avr/interrupt.h>
 #include "config.h"
 static volatile unsigned char USART_TxHead;
 static volatile unsigned char USART_TxTail;
 
-/**
- *  Initialize USART
- */
+bool USART0_CTS( void )
+{
+    unsigned char tmphead;
+
+    /* Calculate buffer index */
+    tmphead = ( USART_TxHead + 1 ) & USART_TX_BUFFER_MASK;
+
+    /* Return 0 (false) if the transmit buffer is full */
+    return ( tmphead == USART_TxTail );
+}
+
 void USART0_Init( unsigned int baudrate )
 {
     unsigned char x;
     UCSR1B = ( ( 1 << RXCIE1 ) | ( 1 << RXEN1 ) | ( 1 << TXEN1 ) );
 
     /* Set frame format: 8 data 2stop */
-    UCSR1C = ( 1 << USBS1 ) | ( 1 << UCSZ11 ) | ( 1 << UCSZ10 ); //For devices with Extended IO
-    //UCSR0C = (1<<URSEL)|(1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);   //For devices without Extended IO
+    //For devices with Extended IO
+    UCSR1C = ( 1 << USBS1 ) | ( 1 << UCSZ11 ) | ( 1 << UCSZ10 );
+
+    //For devices without Extended IO
+    //UCSR0C = (1<<URSEL)|(1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);
 
     /* Flush receive buffer */
     x = 0;
 
     /* Read the received data */
     rxdata = UDR1;
+
     /* Calculate buffer index */
     tmphead = ( USART_RxHead + 1 ) & USART_RX_BUFFER_MASK;
-    USART_RxHead = tmphead; /* Store new index */
+
+    /* Store new index */
+    USART_RxHead = tmphead;
 
     if( tmphead == USART_RxTail )
     {
         /* ERROR! Receive buffer overflow */
     }
 
-    USART_RxBuf[tmphead] = rxdata; /* Store received data in buffer */
+    /* Store received data in buffer */
+    USART_RxBuf[tmphead] = rxdata;
 }
 
-/**
- * Interrupt handler called when USART1 is ready to send
- */
 ISR(USART1_TX_vect)
 {
     unsigned char tmptail;
     {
         /* Calculate buffer index */
         tmptail = ( USART_TxTail + 1 ) & USART_TX_BUFFER_MASK;
-        USART_TxTail = tmptail; /* Store new index */
 
-        UDR1 = USART_TxBuf[tmptail]; /* Start transmition */
+        /* Store new index */
+        USART_TxTail = tmptail;
+
+        /* Start transmition */
+        UDR1 = USART_TxBuf[tmptail];
     }
     else
     {
-        UCSR1B &= ~( 1 << UDRIE1 ); /* Disable UDRE interrupt */
+        /* Disable UDRE interrupt */
+        UCSR1B &= ~( 1 << UDRIE1 );
     }
 }
 
-/**
- * Read a byte from the data buffer. Blocks if no bytes are available.
- * @return next received byte
- */
 unsigned char USART0_Receive( void )
 {
     unsigned char tmptail;
 
+    /* Wait for incomming data */
     while( USART_RxHead == USART_RxTail )
-        /* Wait for incomming data */
         ;
-    tmptail = ( USART_RxTail + 1 ) & USART_RX_BUFFER_MASK;/* Calculate buffer index */
 
-    USART_RxTail = tmptail; /* Store new index */
+    /* Calculate buffer index */
+    tmptail = ( USART_RxTail + 1 ) & USART_RX_BUFFER_MASK;
 
-    return USART_RxBuf[tmptail]; /* Return data */
+    /* Store new index */
+    USART_RxTail = tmptail;
+
+    /* Return data */
+    return USART_RxBuf[tmptail];
 }
 
-/**
- * Add a byte to the data buffer to be transmitted. Blocks if no space is available.
- * @param txdata
- */
+bool USART0_RTR( void )
+{
+    /* Return 0 (false) if the receive buffer is empty */
+    return ( USART_RxHead != USART_RxTail );
+}
+
 void USART0_Transmit( unsigned char txdata )
 {
     unsigned char tmphead;
+
     /* Calculate buffer index */
-    tmphead = ( USART_TxHead + 1 ) & USART_TX_BUFFER_MASK; /* Wait for free space in buffer */
+    tmphead = ( USART_TxHead + 1 ) & USART_TX_BUFFER_MASK;
+
+    /* Wait for free space in buffer */
     while( tmphead == USART_TxTail )
         ;
 
-    USART_TxBuf[tmphead] = txdata; /* Store data in buffer */
-    USART_TxHead = tmphead; /* Store new index */
+    /* Store data in buffer */
+    USART_TxBuf[tmphead] = txdata;
 
-    UCSR1B |= ( 1 << UDRIE1 ); /* Enable UDRE interrupt */
+    /* Store new index */
+    USART_TxHead = tmphead;
+
+    /* Enable UDRE interrupt */
+    UCSR1B |= ( 1 << UDRIE1 );
 }
-
-/**
- *
- * @return
- */
-unsigned char DataInReceiveBuffer( void )
-{
-    return ( USART_RxHead != USART_RxTail ); /* Return 0 (false) if the receive buffer is empty */
-}

arch/at90usb128/lib_mcu/usart/usart.h

 
 //_____ I N C L U D E S ________________________________________________________
 
+#include <stdbool.h>
+
 //_____ M A C R O S ____________________________________________________________
 
 //_____ D E C L A R A T I O N __________________________________________________
 void USART0_Init( unsigned int baudrate );
 
 /**
- * Copy any received frames into data.
- *
- * @param data buffer for received frames
- * @param size of data buffer
- * @return number of frames copied
+ * Read a byte from the data buffer. Blocks if no bytes are available.
+ * @return next received byte
  */
-int USART0_Receive( unsigned char * data, int size );
+unsigned char USART0_Receive( void );
 
 /**
- * Copy frames to transmit queue.
- *
- * @param data buffer for outgoing data
- * @param size of data buffer
- * @return number of frames copied; may be less than size if queue becomes full
+ * Add a byte to the data buffer to be transmitted. Blocks if no space is available.
+ * @param txdata
  */
-int USART0_Transmit( unsigned char const * data, int size );
+void USART0_Transmit( unsigned char txdata );
+
+/**
+ * Indicates USART0 is Ready-To-Read i.e. there is data in the receive buffer
+ * @return
+ */
+bool USART0_RTR( void );
+
+/**
+ * Indicates USART0 is Clear-To-Send i.e. there is empty room in transmit buffer
+ * @return
+ */
+bool USART0_CTS( void );

conf/conf_scheduler.h

 #define Scheduler_task_1        usb_task
 #define Scheduler_task_2_init   hid_task_init
 #define Scheduler_task_2        hid_task
-#define Scheduler_task_3_init   uart_task_init
-#define Scheduler_task_3        uart_task
+#define Scheduler_task_3_init   snap_task_init
+#define Scheduler_task_3        snap_task
 
 #endif  /// _CONF_SCHEDULER_H_
+/**
+ * @file
+ *
+ * @brief Constants and structure definitions for S.N.A.P.
+ *
+ */
+
+#if !defined( _SNAP_H_ )
+#define _SNAP_H_
+
+#include <stdint.h>
+/**
+ * @brief Synchronization Byte
+ *
+ * This byte is pre-defined to 01010100b and indicates the start of each packet.
+ */
+#define SYNC ( (uint8_t) 0x54)
+
+/**
+ * @brief Header Definition Byte 2
+ *
+ * The first two bytes after the synchronization byte are called header definition bytes, they are used to
+ * define the structure of the complete packet. The name on the fields are chosen to be easy to
+ * remember.
+ *
+ * <PRE>
+ * Bit 7 6|5 4|3 2|1 0
+ *     D D|S S|P P|A A
+ *      D | S | P | A
+ *      A | A | F | C
+ *      B | B | B | K
+ * </PRE>
+ * DAB = Number of Destination Address Bytes
+ * SAB = Number of Source Address Bytes
+ * PFB = Number of Protocol specific Flag Bytes
+ * ACK = ACK/NAK bits
+ */
+union HDB2
+{
+    struct HDB2_fields
+    {
+        /** @brief Number of Destination Address Bytes
+         *
+         * These two bits defines number of destination address bytes in the packet. With the maximum size of
+         * 3 Bytes it gives a total of 16 777 215 different destination node addresses.
+         */
+        uint8_t DAB :2;
+
+        /** @brief Number of Source Address Bytes
+         *
+         * These two bits defines the number of source address bytes in the packet. With the maximum size of
+         * 3 Bytes, it gives a total of 16 777 215 different source node addresses.
+         */
+        uint8_t SAB :2;
+
+        /** @brief Number of Protocol specific Flag Bytes
+         *
+         * These two bits defines how many protocol specific flag bytes the packet includes, from 0-3 Bytes
+         * which give a total of 24 flags.
+         */
+        uint8_t PFB :2;
+
+        /** @brief ACK/NAK bits
+         *
+         * These two bits defines if the sending node requests an ACK/NAK packet in return. These bits also
+         * acts as the actual ACK/NAK response sent from the receiving node.
+         */
+        uint8_t ACK :2;
+    } fields;
+
+    /** @brief Raw Access to HDB2 byte
+     *
+     */
+    uint8_t raw;
+};
+
+/// 0 Byte destination address
+#define DAB_0   ((uint8_t) 0)
+/// 1 Byte destination address
+#define DAB_1   ((uint8_t) 1)
+/// 2 Byte destination address
+#define DAB_2   ((uint8_t) 2)
+/// 3 Byte destination address
+#define DAB_3   ((uint8_t) 3)
+
+/// 0 Byte source address
+#define SAB_0   ((uint8_t) 0)
+/// 1 Byte source address
+#define SAB_1   ((uint8_t) 1)
+/// 2 Byte source address
+#define SAB_2   ((uint8_t) 2)
+/// 3 Byte source address
+#define SAB_3   ((uint8_t) 3)
+
+/// 0 Byte flags
+#define PFB_0   ((uint8_t) 0)
+/// 1 Byte flags
+#define PFB_1   ((uint8_t) 1)
+/// 2 Byte flags
+#define PFB_2   ((uint8_t) 2)
+/// 3 Byte flags
+#define PFB_3   ((uint8_t) 3)
+
+/// No ACK request (Tx)
+#define ACK_NONE    ((uint8_t) 0)
+/// ACK request (Tx)
+#define ACK_REQ     ((uint8_t) 1)
+/// ACK response (Rx)
+#define ACK_RESP    ((uint8_t) 2)
+/// NAK response (Rx)
+#define NAK_RESP    ((uint8_t) 3)
+
+/**
+ * @brief Header Definition Byte 1
+ *
+ * The first two bytes after the synchronization byte are called header definition bytes, they are used to
+ * define the structure of the complete packet. The name on the fields are chosen to be easy to
+ * remember.
+ *
+ * <PRE>
+ * Bit 7|6 5 4|3 2 1 0
+ *     C|E E E|N N N N
+ *     C|  E  |   N
+ *     M|  D  |   D
+ *     D|  M  |   B
+ * </PRE>
+ *
+ * CMD = CoMmanD mode bit
+ * EDM = Error Detection Method
+ * NDB = Number of Data Bytes
+ */
+union HDB1
+{
+    struct HDB1_fields
+    {
+        /** @brief Bit 7 - Command mode bit
+         *
+         * This bit indicates what's called command mode. This is an optional feature and if a node is not
+         * implementing it this bit should always be set to zero (CMD=0).
+         *
+         * A node implementing this feature will be able to respond on queries from other nodes as well as
+         * send responses when for example the receiving node can't handle the packet structure in a received
+         * packet. It can be used to scan large networks for nodes and have them respond with their
+         * capabilities or for two nodes negotiating the right packet structure, among other things.
+         *
+         * If this bit is set (CMD=1) it indicates that the data in DB1 contains a command (query or a
+         * response). This results in total 256 different commands.
+         *
+         * The range is divided in two half's, commands between 1-127 are queries and commands between
+         * 128-255 are responses. The commands specified to date are the following. Note this is the value in
+         * DB1, not the actual CMD bit.
+         *
+         * There are some things to think about for this to work properly. The sending node can not use an
+         * higher address range than the receiving node. This is not a problem if the receiving nodes that are
+         * implementing this feature are capable to handle all the address range (i.e. 1-16 777 215). Another
+         * solution is to assign all masters in the network (in a master/slave network) to the low address range
+         * (i.e. between 1-255).
+         */
+        uint8_t CMD :1;
+
+        /** @brief Bit 6 to 4 - Error Detection Method (EDM)
+         *
+         * These three bits defines what kind error detecting method is being used to validate the packet. A
+         * node does not need to support any error detection method at all (i.e. EDM = 0) or you can choose to
+         * implement a subset or all of them. For more information about this topic see section 2.6.
+         *
+         * <PRE>
+         * Bit 6 5 4
+         *     0 0 0    No error detection
+         *     0 0 1    3 times re-transmission
+         *     0 1 0    8-bit checksum
+         *     0 1 1    8-bit CRC
+         *     1 0 0    16-bit CRC
+         *     1 0 1    32-bit CRC
+         *     1 1 0    FEC (specific FEC standard TBD)
+         *     1 1 1    User specified
+         * </PRE>
+         *
+         * TBD = To Be Determined
+         */
+        uint8_t EDM :3;
+
+        /** @brief Bit 3 to 0 - Number of Data Bytes (NDB)
+         *
+         * These four bits defines how many bytes data there is in the packet (0-512 Bytes).
+         *
+         * <PRE>
+         * Bit 3 2 1 0
+         *     0 0 0 0  0 Byte
+         *     0 0 0 1  1 Byte
+         *     0 0 1 0  2 Bytes
+         *     0 0 1 1  3 Bytes
+         *     0 1 0 0  4 Bytes
+         *     0 1 0 1  5 Bytes
+         *     0 1 1 0  6 Bytes
+         *     0 1 1 1  7 Bytes
+         *     1 0 0 0  8 Bytes
+         *     1 0 0 1  16 Bytes
+         *     1 0 1 0  32 Bytes
+         *     1 0 1 1  64 Bytes
+         *     1 1 0 0  128 Bytes
+         *     1 1 0 1  256 Bytes
+         *     1 1 1 0  512 Bytes
+         *     1 1 1 1  User Specified
+         * </PRE>
+         */
+        uint8_t NDB :4;
+    } fields;
+
+    /** @brief Raw Access to HDB2 byte
+     *
+     */
+    uint8_t raw;
+};
+
+/** @brief No error detection
+ *
+ * This one is obvious. Packets will be sent without any error detection information at all.
+ *
+ * @sa HDB1::EDM
+ */
+#define EDM_NONE ((uint8_t) 0)
+
+/** @brief 3 times re-transmission
+ *
+ * This is a very simple way of error detection that is very easy to implement. The sending node
+ * sends the exact same packet three times.The receiving node just compare the received packets
+ * and if 3 equal packets are received then the data is assumed to be OK.
+ *
+ * @sa HDB1::EDM
+ */
+#define EDM_3TX ((uint8_t) 1)
+
+/** @brief 8-bit checksum
+ *
+ * This method adds one byte (8-bits) containing the checksum at the end of each packet. The
+ * calculation of the checksum is simple and all that’s done is that all bytes (except the SYNC
+ * byte) is summed together and the 8-bit result is the checksum byte. This is sometimes referred
+ * as Longitudinal Redundancy Check (LRC) in some documentation.
+ *
+ * @sa HDB1::EDM
+ */
+#define EDM_CHKSUM8 ((uint8_t) 2)
+
+/** @brief 8-bit CRC
+ *
+ * This method also adds one byte (8-bits) containing the checksum at the end of each packet.
+ * The calculation of the CRC checksum is a bit more sophisticated than 8-bit checksum and
+ * therefore this is a bit more reliable.
+ *
+ * X^8+X^5+X^4+1
+ * Polynominal = h18
+ * Initial remainder = h00
+ *
+ * @sa HDB1::EDM
+ */
+#define EDM_CRC8 ((uint8_t) 3)
+
+/** @brief 16-bit CRC
+ *
+ * This method adds two bytes (16-bits) containing the checksum at the end of each packet.
+ * The calculation of the CRC checksum is similar to 8-bit CRC but a bit more reliable due to the
+ * increased size of the checksum (16-bits).
+ *
+ * X^16+X^12+X^5+1
+ * Polynominal = h1021
+ * Initial remainder = h0000
+ *
+ * @sa HDB1::EDM
+ */
+#define EDM_CRC16 ((uint8_t) 4)
+
+/** @brief 32-bit CRC
+ *
+ * This method adds four bytes (32-bits) containing the checksum at the end of each packet.
+ * The calculation of the CRC checksum is similar to 8-bit and 16-bit CRC but even more
+ * reliable.
+ *
+ * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+1
+ * Polynominal = h04C11DB7
+ * Initial reminder = hFFFFFFFF
+ *
+ * @note The result is inverted.
+ *
+ * @sa HDB1::EDM
+ */
+#define EDM_CRC32 ((uint8_t) 5)
+
+/** @brief FEC
+ *
+ * Specific FEC standard to be determined. FEC (Forward Error Correction) is often used in
+ * simplex RF links since it offers the possibility to not only detect but also to correct corrupt
+ * data. There are many different "standards" available.
+ *
+ * @sa HDB1::EDM
+ */
+#define EDM_FEC ((uint8_t) 6)
+
+/** @brief User specified
+ *
+ * If none of the above error detection methods suits your application you can use your own.
+ *
+ * @sa HDB1::EDM
+ */
+#define EDM_USER ((uint8_t) 7)
+
+/** @brief 0 bytes of data
+ *
+ */
+#define NDB_0 ((uint8_t) 0)
+
+/** @brief 1 bytes of data
+ *
+ */
+#define NDB_1 ((uint8_t) 1)
+
+/** @brief 2 bytes of data
+ *
+ */
+#define NDB_2 ((uint8_t) 2)
+
+/** @brief 3 bytes of data
+ *
+ */
+#define NDB_3 ((uint8_t) 3)
+
+/** @brief 4 bytes of data
+ *
+ */
+#define NDB_4 ((uint8_t) 4)
+
+/** @brief 5 bytes of data
+ *
+ */
+#define NDB_5 ((uint8_t) 5)
+
+/** @brief 6 bytes of data
+ *
+ */
+#define NDB_6 ((uint8_t) 6)
+
+/** @brief 7 bytes of data
+ *
+ */
+#define NDB_7 ((uint8_t) 7)
+
+/** @brief 8 bytes of data
+ *
+ */
+#define NDB_8 ((uint8_t) 8)
+
+/** @brief 16 bytes of data
+ *
+ */
+#define NDB_16 ((uint8_t) 9)
+
+/** @brief 32 bytes of data
+ *
+ */
+#define NDB_32 ((uint8_t) 10)
+
+/** @brief 64 bytes of data
+ *
+ */
+#define NDB_64 ((uint8_t) 11)
+
+/** @brief 128 bytes of data
+ *
+ */
+#define NDB_128 ((uint8_t) 12)
+
+/** @brief 256 bytes of data
+ *
+ */
+#define NDB_256 ((uint8_t) 13)
+
+/** @brief 512 bytes of data
+ *
+ */
+#define NDB_512 ((uint8_t) 14)
+
+/** @brief User specified bytes of data
+ *
+ */
+#define NDB_USER ((uint8_t) 15)
+
+/** @brief States of processing
+ *
+ * Based upon the next expected protocol member.
+ *
+ * In general, the states flow in order, though some fields in HDB1 and HDB2 can
+ * cause some states to be skipped.
+ */
+enum snap_states
+{
+    kSnapPreamble, //!< kSnapPreamble
+    kSnapSync,     //!< kSnapSync
+    kSnapHeaderDef,//!< kSnapHeaderDef
+    kDestination,  //!< kDestination
+    kSource,       //!< kSource
+    kProtocol,     //!< kProtocol
+    kData,         //!< kData
+    kCRC           //!< kCRC
+};
+
+#endif
+/**
+ * @file
+ *
+ * @brief This file manages a S.N.A.P. protocol implementation.
+ *
+ * @author               Andrew Cooper
+ *
+ *
+ *
+ */
+
+/* Copyright (c) 2010 Andrew Cooper. All rights reserved.
+ */
+
+//_____  I N C L U D E S _______________________________________________________
+
+
+#include "snap.h"
+#include "lib_mcu/usart/usart.h"
+
+//_____ M A C R O S ____________________________________________________________
+
+
+//_____ V A R I A B L E S ______________________________________________________
+
+static enum snap_states state;
+
+static union HDB2 hdb2;
+static union HDB1 hdb1;
+static short hdb_cnt;
+static short dab_cnt;
+static short sab_cnt;
+static short pfb_cnt;
+static short db_cnt;
+static short crc_cnt;
+
+//_____ D E F I N I T I O N S __________________________________________________
+
+void process_packet( void );
+
+/**
+ * @brief Initialize S.N.A.P processing task
+ */
+void snap_task_init( void )
+{
+
+}
+
+/**
+ * @brief
+ */
+void snap_task( void )
+{
+    unsigned char frame;
+
+    if( USART0_RTR() )
+    {
+        frame = USART0_Receive();
+
+        switch( state )
+        {
+            case kSnapPreamble :
+            case kSnapSync :
+                if( SYNC == frame )
+                {
+                    state = kSnapHeaderDef;
+                    hdb_cnt = 0;
+                }
+                break;
+            case kSnapHeaderDef :
+                if( 0 == hdb_cnt )
+                {
+                    hdb_cnt = 1;
+                    hdb2.raw = frame;
+                }
+                else
+                {
+                    hdb_cnt = 2;
+                    hdb1.raw = frame;
+                    if( DAB_0 == hdb2.fields.DAB )
+                    {
+                        if( SAB_0 == hdb2.fields.SAB )
+                        {
+                            if( PFB_0 == hdb2.fields.PFB )
+                            {
+                                if( NDB_0 == hdb1.fields.NDB )
+                                {
+                                    if( EDM_NONE == hdb1.fields.NDB )
+                                    {
+                                        process_packet();
+                                    }
+                                    else
+                                    {
+                                        state = kCRC;
+                                    }
+                                }
+                                else
+                                {
+                                    state = kData;
+                                }
+                            }
+                            else
+                            {
+                                state = kProtocol;
+                            }
+                        }
+                        else
+                        {
+                            state = kSource;
+                        }
+                    }
+                    else
+                    {
+                        state = kDestination;
+                    }
+
+                }
+
+            case kDestination :
+            case kSource :
+            case kProtocol :
+            case kData :
+            case kCRC :
+                break;
+        }
+    }
+}
+
+void process_packet()
+{
+}