text: /******************************************************************************
   * @file    ymodem.h
   * @author  MM32 AE
   * @version V1.00
   * @date    10-June-2020
   * @brief   ......
   ******************************************************************************
   *  @attention
   * 
   *  THE EXISTING FIRMWARE IS ONLY FOR REFERENCE, WHICH IS DESIGNED TO PROVIDE
   *  CUSTOMERS WITH CODING INFORMATION ABOUT THEIR PRODUCTS SO THEY CAN SAVE
   *  TIME. THEREFORE, MINDMOTION SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT OR
   *  CONSEQUENTIAL DAMAGES ABOUT ANY CLAIMS ARISING OUT OF THE CONTENT OF SUCH
   *  HARDWARE AND/OR THE USE OF THE CODING INFORMATION CONTAINED HEREIN IN
   *  CONNECTION WITH PRODUCTS MADE BY CUSTOMERS.
   *  <H2><CENTER>&COPY; COPYRIGHT 2020 MINDMOTION </CENTER></H2>
  ******************************************************************************/
  
  
  /* Define to prevent recursive inclusion -------------------------------------*/
  #ifndef _YMODEM_H_
  #define _YMODEM_H_
  
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  
  #undef  EXTERN
  
  
  #ifdef  __YMODEM_C__
  #define EXTERN
  #else
  #define EXTERN extern
  #endif
  
  /* Includes ------------------------------------------------------------------*/
  
  
  /* Exported variables -------------------------------------------------------*/
  /* Exported function prototypes ---------------------------------------------*/
  /* Exported macro ---------------------------------------------*/
  /* Exported constants -------------------------------------------------------*/
  
  #define PACKET_SEQNO_INDEX      (1)
  #define PACKET_SEQNO_COMP_INDEX (2)
  
  #define PACKET_HEADER           (3)
  #define PACKET_TRAILER          (2)
  #define PACKET_OVERHEAD         (PACKET_HEADER + PACKET_TRAILER)
  #define PACKET_SIZE             (128)
  #define PACKET_1K_SIZE          (1024)
  
  #define FILE_NAME_LENGTH        (256)
  #define FILE_SIZE_LENGTH        (16)
  
  #define SOH                     (0x01)  /* start of 128-byte data packet */
  #define STX                     (0x02)  /* start of 1024-byte data packet */
  #define EOT                     (0x04)  /* end of transmission */
  #define ACK                     (0x06)  /* acknowledge */
  #define NAK                     (0x15)  /* negative acknowledge */
  /* two of these in succession aborts transfer */
  #define CA                      (0x18)  
  #define CRC16                   (0x43)  /* 'C' == 0x43, request 16-bit CRC */
  
  #define ABORT1                  (0x41)  /* 'A' == 0x41, abort by user */
  #define ABORT2                  (0x61)  /* 'a' == 0x61, abort by user */
  
  #define NAK_TIMEOUT             (0x100000)
  #define MAX_ERRORS              (5)
  
  /* Exported functions prototypes -------------------------------------------- */
  EXTERN uint8_t Ymodem_Receive(void);
  
  	
  #ifdef __cplusplus
  }
  #endif
  
  
  #endif 
  
  /******************* (C) COPYRIGHT 2020 ************************END OF FILE***/
  