##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.11A/W32               20/Jul/2004  18:58:48 #
# Copyright 1999-2004 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  arm                                                  #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  C:\medusa\xmodem.c                                   #
#    Command line    =  -I "C:\Program Files\IAR Systems\Embedded Workbench  #
#                       4.0\ARM\INC\" -lc C:\medusa\Debug\List\ -la          #
#                       C:\medusa\Debug\List\ -o C:\medusa\Debug\Obj\ -s2    #
#                       --no_cse --no_unroll --no_inline --no_code_motion    #
#                       --no_tbaa --no_clustering --no_scheduling --debug    #
#                       --cpu_mode arm --endian little --cpu ARM7TDMI-S      #
#                       --stack_align 4 -e --fpu None                        #
#                       "-D_DLIB_CONFIG_FILE=C:\Program Files\IAR            #
#                       Systems\Embedded Workbench                           #
#                       4.0\ARM\LIB\dl4tpannl8n.h" C:\medusa\xmodem.c        #
#    List file       =  C:\medusa\Debug\List\xmodem.lst                      #
#    Object file     =  C:\medusa\Debug\Obj\xmodem.r79                       #
#                                                                            #
#                                                                            #
##############################################################################

C:\medusa\xmodem.c
      1          #include "archinc.h"
      2          /* #include "timer0.h" // for 3-second delay */
      3          /* #include "uart0.h" */
      4          #include "crc16.h"

  #ifndef __CRC16_H__
                    ^
"C:\medusa\crc16.h",1  Warning[Pa050]: non-native end of line sequence
          detected (this diagnostic is only issued once)
      5          #include "xmodem.h"
      6          
      7          #ifdef CONFIG_INCLUDE_XMODEM
      8          
      9          /*
     10           * This is a simple, xmodem receive-only module. It recei
     11           */
     12          #define XMODEM_SOH (0x01) // Start of Header
     13          #define XMODEM_EOT (0x04) // End of Transmission
     14          #define XMODEM_ACK (0x06) // Acknowledge
     15          #define XMODEM_NAK (0x15) // Negative Acknowledge
     16          #define XMODEM_C   (0x43) // ASCII 'C'
     17          
     18          #define XMODEM_PACKET_SIZE (256)
     19          #define XMODEM_MAX_SYNC_RETRIES (10)
     20          
     21          static unsigned char packetSeqNum;
     22          
     23          static char packet[XMODEM_PACKET_SIZE];
     24          
     25          typedef enum {expectSOH, expectPktSeqNum, expectPsnCksum, expectCRC} xmodemReceiverState;
     26          
     27          static xmodemReceiverState rcvState;
     28          
     29          static void flushReceive(void)
     30          {
     31          }
     32          
     33          void xmodemInit(void)
     34          {
     35            rcvState  = expectSOH;
     36            packetSeqNum = 0;
     37          }
     38          
     39          int xmodemReceive(char * rcvMem)
     40          {
     41            int syncRetryCount = 0;
     42          
     43            // switch console RX events to receiveEventHandler()
     44          
     45            // flush console receive buffer
     46          
     47            // TODO: need some sort of a timeout here
     48            while ((rcvState == expectSOH) && 
     49                   (syncRetryCount < XMODEM_MAX_SYNC_RETRIES)) {
     50              // TODO: send XMODEM_C
     51              // check to see if we have received characters
     52              // if (chars received) exit and let the event handler take over
     53              // else wait 3 seconds bump retry count and send XMODEM_C again
     54              }
     55          
     56            return ((rcvState == expectSOH) ? -1 : 0);
     57          }
     58          
     59          void receiveEventHandler(void)
     60          {
     61            char inCh;
     62          
     63            // TODO: get character
     64          
     65            switch(rcvState) {
     66              case expectSOH:
     67                if (inCh == XMODEM_SOH) {
     68                  rcvState = expectPktSeqNum;
     69                  }
     70                break;
     71              case expectPktSeqNum:
     72                // TODO: check to see that seq num received is not a duplicate
     73                rcvState = expectPsnCksum;
     74                break;
     75              case expectPsnCksum:
     76                break;
     77              case expectCRC:
     78                break;
     79              }
     80          }
     81          
     82          #endif /* CONFIG_INCLUDE_XMODEM */
     83          


   Segment part sizes:

     Function/Label Bytes
     -------------- -----

 
 
 0 bytes of memory

Errors: none
Warnings: 1
