|
@@ -197,17 +197,38 @@ typedef struct shellmatta_cmd
|
|
|
*/
|
|
|
typedef enum
|
|
|
{
|
|
|
- INACTIVE, /* YModem module not initialised */
|
|
|
- WAIT_FOR_START, /* waiting for start of header */
|
|
|
- RECEIVE_PACKET, /* currently receiving a packet */
|
|
|
+ SHELLMATTA_YMODEM_INACTIVE, /**< YModem module not initialised */
|
|
|
+ SHELLMATTA_YMODEM_WAIT_FOR_START, /**< waiting for start of header */
|
|
|
+ SHELLMATTA_YMODEM_RECEIVE_HEADER, /**< reading header data */
|
|
|
+ SHELLMATTA_YMODEM_RECEIVE_DATA, /**< reading payload */
|
|
|
+ SHELLMATTA_YMODEM_RECEIVE_CRC /**< reading crc */
|
|
|
} shellmatta_ymodem_state_t;
|
|
|
|
|
|
+/** @brief packet structure that holds several information about its content */
|
|
|
typedef struct
|
|
|
{
|
|
|
- void (*yModemCancelCallback)(void);
|
|
|
- void (*yModemRecvPacketCallback)(void);
|
|
|
- void (*ymodemTransmissionCompleteCallback)(void);
|
|
|
-} shellmatta_ymodem_callbacks_t;
|
|
|
+ uint16_t size; /**< site of the packet (128 or 1024) */
|
|
|
+ uint8_t packetNumber; /**< packet number in this packet */
|
|
|
+ uint8_t* packetData; /**< pointer to the data of this packet */
|
|
|
+ uint16_t crc; /**< crc checksum in this packet */
|
|
|
+} shellmatta_ymodem_packet_t;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief definition of shellmatta ymodem instance
|
|
|
+ */
|
|
|
+typedef struct
|
|
|
+{
|
|
|
+ shellmatta_ymodem_state_t state;
|
|
|
+ uint32_t byteCounter;
|
|
|
+ uint32_t packetCounter;
|
|
|
+ uint32_t totalBytesReceived;
|
|
|
+ char *fileName;
|
|
|
+ uint32_t fileSize;
|
|
|
+ shellmatta_ymodem_packet_t packet;
|
|
|
+ void (*cancelCallback)(void);
|
|
|
+ void (*recvPacketCallback)(void);
|
|
|
+ void (*transmissionCompleteCallback)(void);
|
|
|
+} shellmatta_ymodem_t;
|
|
|
|
|
|
#ifdef SHELLMATTA_TRANSPORT
|
|
|
|
|
@@ -319,7 +340,7 @@ typedef struct
|
|
|
bool cmdListIsConst; /**< true if the #cmdList was passed during
|
|
|
initialization */
|
|
|
shellmatta_opt_t optionParser; /**< option parser sructure */
|
|
|
- shellmatta_ymodem_state_t ymodemState; /**< current state of the ymodem module */
|
|
|
+ shellmatta_ymodem_t ymodem; /**< ymodem instance */
|
|
|
#ifdef SHELLMATTA_AUTHENTICATION
|
|
|
shellmatta_auth_state_t loginState; /**< state variable of the login cmd */
|
|
|
shellmatta_cmd_t loginCmd; /**< login command structure */
|
|
@@ -446,14 +467,12 @@ shellmatta_retCode_t shellmatta_auth_chpasswd( shellmatta_handle_t
|
|
|
|
|
|
uint8_t shellmatta_ymodem( shellmatta_handle_t handle,
|
|
|
uint8_t* buffer,
|
|
|
- uint32_t* fileSize,
|
|
|
- uint16_t* packetSize,
|
|
|
- shellmatta_ymodem_callbacks_t callbacks);
|
|
|
+ void (*cancelCallback)(void),
|
|
|
+ void (*recvPacketCallback)(void),
|
|
|
+ void (*transmissionCompleteCallback)(void));
|
|
|
|
|
|
void shellmatta_ymodem_cancel( shellmatta_handle_t handle);
|
|
|
|
|
|
-bool shellmatta_ymodem_is_active(void);
|
|
|
-
|
|
|
#endif
|
|
|
|
|
|
/** @} */
|