Software APIs
sw
device
silicon_creator
lib
xmodem.h
1
// Copyright lowRISC contributors (OpenTitan project).
2
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3
// SPDX-License-Identifier: Apache-2.0
4
5
#ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_XMODEM_H_
6
#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_XMODEM_H_
7
8
#include <
stdint.h
>
9
10
#include "
sw/device/lib/base/hardened.h
"
11
#include "sw/device/silicon_creator/lib/error.h"
12
13
/**
14
* Send the Xmodem-CRC start sequence.
15
*
16
* @param iohandle An opaque user point associated with the io device.
17
*/
18
void
xmodem_recv_start(
void
*iohandle);
19
20
/**
21
* Acknowledge an Xmodem frame.
22
*
23
* @param ack Whether to ACK (true) or NAK (false).
24
*/
25
void
xmodem_ack(
void
*iohandle,
bool
ack);
26
27
/**
28
* Send an Xmodem cancel sequence.
29
*/
30
void
xmodem_cancel(
void
*iohandle);
31
32
/**
33
* Receive a frame using Xmodem-CRC
34
*
35
* @param iohandle An opaque user point associated with the io device.
36
* @param frame The frame number expected (start at 1).
37
* @param data Buffer to receive the data into.
38
* @param rxlen The length of data recieved.
39
* @param unknown_rx The byte received when the error is kErrorXmodemUnknown.
40
* @return Error value.
41
*/
42
rom_error_t xmodem_recv_frame(
void
*iohandle, uint32_t frame, uint8_t *data,
43
size_t
*rxlen, uint8_t *unknown_rx);
44
45
/**
46
* Send data using Xmodem-CRC.
47
*
48
* Sends a buffer of data using Xmodem-CRC.
49
*
50
* @param iohandle An opaque user point associated with the io device.
51
* @param data buffer to send.
52
* @param len length of the buffer.
53
* @return Error value.
54
*/
55
rom_error_t xmodem_send(
void
*iohandle,
const
void
*data,
size_t
len);
56
57
#endif
// OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_XMODEM_H_
Return to
OpenTitan Documentation