Removed unnecessary 'session' parameter
This commit is contained in:
parent
754ec9beea
commit
b8a0ad09b7
@ -200,7 +200,7 @@ fpc_bep_result_t bmlite_receive(HCP_comm_t *hcp_comm)
|
|||||||
static fpc_bep_result_t _rx_link(HCP_comm_t *hcp_comm)
|
static fpc_bep_result_t _rx_link(HCP_comm_t *hcp_comm)
|
||||||
{
|
{
|
||||||
// Get size, msg and CRC
|
// Get size, msg and CRC
|
||||||
fpc_bep_result_t result = hcp_comm->read(4, hcp_comm->txrx_buffer, hcp_comm->phy_rx_timeout, NULL);
|
fpc_bep_result_t result = hcp_comm->read(4, hcp_comm->txrx_buffer, hcp_comm->phy_rx_timeout);
|
||||||
_HPC_pkt_t *pkt = (_HPC_pkt_t *)hcp_comm->txrx_buffer;
|
_HPC_pkt_t *pkt = (_HPC_pkt_t *)hcp_comm->txrx_buffer;
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ static fpc_bep_result_t _rx_link(HCP_comm_t *hcp_comm)
|
|||||||
return FPC_BEP_RESULT_IO_ERROR;
|
return FPC_BEP_RESULT_IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hcp_comm->read(size + 4, hcp_comm->txrx_buffer + 4, 100, NULL);
|
hcp_comm->read(size + 4, hcp_comm->txrx_buffer + 4, 100);
|
||||||
|
|
||||||
uint32_t crc = *(uint32_t *)(hcp_comm->txrx_buffer + 4 + size);
|
uint32_t crc = *(uint32_t *)(hcp_comm->txrx_buffer + 4 + size);
|
||||||
uint32_t crc_calc = fpc_crc(0, hcp_comm->txrx_buffer+4, size);
|
uint32_t crc_calc = fpc_crc(0, hcp_comm->txrx_buffer+4, size);
|
||||||
@ -231,7 +231,7 @@ static fpc_bep_result_t _rx_link(HCP_comm_t *hcp_comm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send Ack
|
// Send Ack
|
||||||
hcp_comm->write(4, (uint8_t *)&fpc_com_ack, 0, NULL);
|
hcp_comm->write(4, (uint8_t *)&fpc_com_ack, 0);
|
||||||
|
|
||||||
return FPC_BEP_RESULT_OK;
|
return FPC_BEP_RESULT_OK;
|
||||||
}
|
}
|
||||||
@ -285,11 +285,11 @@ static fpc_bep_result_t _tx_link(HCP_comm_t *hcp_comm)
|
|||||||
*(uint32_t *)(hcp_comm->txrx_buffer + pkt->lnk_size + 4) = crc_calc;
|
*(uint32_t *)(hcp_comm->txrx_buffer + pkt->lnk_size + 4) = crc_calc;
|
||||||
uint16_t size = pkt->lnk_size + 8;
|
uint16_t size = pkt->lnk_size + 8;
|
||||||
|
|
||||||
bep_result = hcp_comm->write(size, hcp_comm->txrx_buffer, 0, NULL);
|
bep_result = hcp_comm->write(size, hcp_comm->txrx_buffer, 0);
|
||||||
|
|
||||||
// Wait for ACK
|
// Wait for ACK
|
||||||
uint32_t ack;
|
uint32_t ack;
|
||||||
bep_result = hcp_comm->read(4, (uint8_t *)&ack, 500, NULL);
|
bep_result = hcp_comm->read(4, (uint8_t *)&ack, 500);
|
||||||
if (bep_result == FPC_BEP_RESULT_TIMEOUT) {
|
if (bep_result == FPC_BEP_RESULT_TIMEOUT) {
|
||||||
LOG_DEBUG("ASK read timeout\n");
|
LOG_DEBUG("ASK read timeout\n");
|
||||||
bmlite_on_error(BMLITE_ERROR_SEND_CMD, FPC_BEP_RESULT_TIMEOUT);
|
bmlite_on_error(BMLITE_ERROR_SEND_CMD, FPC_BEP_RESULT_TIMEOUT);
|
||||||
|
|||||||
@ -33,9 +33,9 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Send data to BM-Lite */
|
/** Send data to BM-Lite */
|
||||||
fpc_bep_result_t (*write) (uint16_t, const uint8_t *, uint32_t, void *);
|
fpc_bep_result_t (*write) (uint16_t, const uint8_t *, uint32_t);
|
||||||
/** Receive data from BM-Lite */
|
/** Receive data from BM-Lite */
|
||||||
fpc_bep_result_t (*read)(uint16_t, uint8_t *, uint32_t, void *);
|
fpc_bep_result_t (*read)(uint16_t, uint8_t *, uint32_t);
|
||||||
/** Receive timeout (msec). Applys ONLY to receiving packet from BM-Lite on physical layer */
|
/** Receive timeout (msec). Applys ONLY to receiving packet from BM-Lite on physical layer */
|
||||||
uint32_t phy_rx_timeout;
|
uint32_t phy_rx_timeout;
|
||||||
/** Data buffer for application layer */
|
/** Data buffer for application layer */
|
||||||
|
|||||||
@ -52,8 +52,7 @@ void platform_bmlite_reset(void)
|
|||||||
hal_timebase_busy_wait(100);
|
hal_timebase_busy_wait(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, uint32_t timeout)
|
||||||
void *session)
|
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_COMM
|
#ifdef DEBUG_COMM
|
||||||
LOG_DEBUG("-> ");
|
LOG_DEBUG("-> ");
|
||||||
@ -65,8 +64,7 @@ fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, ui
|
|||||||
return hal_bmlite_spi_write_read((uint8_t *)data, size);
|
return hal_bmlite_spi_write_read((uint8_t *)data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
fpc_bep_result_t platform_bmlite_spi_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_spi_receive(uint16_t size, uint8_t *data, uint32_t timeout)
|
||||||
void *session)
|
|
||||||
{
|
{
|
||||||
volatile uint32_t start_time = hal_timebase_get_tick();
|
volatile uint32_t start_time = hal_timebase_get_tick();
|
||||||
volatile uint32_t curr_time = start_time;
|
volatile uint32_t curr_time = start_time;
|
||||||
|
|||||||
@ -54,8 +54,7 @@ void platform_bmlite_reset(void);
|
|||||||
*
|
*
|
||||||
* @return ::fpc_com_result_t
|
* @return ::fpc_com_result_t
|
||||||
*/
|
*/
|
||||||
fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, uint32_t timeout);
|
||||||
void *session);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sends data over UART port in blocking mode.
|
* @brief Sends data over UART port in blocking mode.
|
||||||
@ -66,8 +65,7 @@ fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, ui
|
|||||||
*
|
*
|
||||||
* @return ::fpc_com_result_t
|
* @return ::fpc_com_result_t
|
||||||
*/
|
*/
|
||||||
fpc_bep_result_t platform_bmlite_uart_send(uint16_t size, const uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_uart_send(uint16_t size, const uint8_t *data, uint32_t timeout);
|
||||||
void *session);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Receives data from SPI port in blocking mode.
|
* @brief Receives data from SPI port in blocking mode.
|
||||||
@ -78,8 +76,7 @@ fpc_bep_result_t platform_bmlite_uart_send(uint16_t size, const uint8_t *data, u
|
|||||||
*
|
*
|
||||||
* @return ::fpc_com_result_t
|
* @return ::fpc_com_result_t
|
||||||
*/
|
*/
|
||||||
fpc_bep_result_t platform_bmlite_spi_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_spi_receive(uint16_t size, uint8_t *data, uint32_t timeout);
|
||||||
void *session);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Receives data from UART port in blocking mode.
|
* @brief Receives data from UART port in blocking mode.
|
||||||
@ -90,8 +87,7 @@ fpc_bep_result_t platform_bmlite_spi_receive(uint16_t size, uint8_t *data, uint3
|
|||||||
*
|
*
|
||||||
* @return ::fpc_com_result_t
|
* @return ::fpc_com_result_t
|
||||||
*/
|
*/
|
||||||
fpc_bep_result_t platform_bmlite_uart_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_uart_receive(uint16_t size, uint8_t *data, uint32_t timeout);
|
||||||
void *session);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Stops execution if a debug interface is attached.
|
* @brief Stops execution if a debug interface is attached.
|
||||||
|
|||||||
@ -43,13 +43,13 @@ static uint8_t hcp_txrx_buffer[MTU];
|
|||||||
static uint8_t hcp_data_buffer[DATA_BUFFER_SIZE];
|
static uint8_t hcp_data_buffer[DATA_BUFFER_SIZE];
|
||||||
|
|
||||||
static HCP_comm_t hcp_chain = {
|
static HCP_comm_t hcp_chain = {
|
||||||
.read = platform_bmlite_spi_receive,
|
|
||||||
.write = platform_bmlite_spi_send,
|
.write = platform_bmlite_spi_send,
|
||||||
.pkt_buffer = hcp_data_buffer,
|
.read = platform_bmlite_spi_receive,
|
||||||
.txrx_buffer = hcp_txrx_buffer,
|
|
||||||
.pkt_size = 0,
|
|
||||||
.pkt_size_max = sizeof(hcp_data_buffer),
|
|
||||||
.phy_rx_timeout = 2000,
|
.phy_rx_timeout = 2000,
|
||||||
|
.pkt_buffer = hcp_data_buffer,
|
||||||
|
.pkt_size_max = sizeof(hcp_data_buffer),
|
||||||
|
.pkt_size = 0,
|
||||||
|
.txrx_buffer = hcp_txrx_buffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void help(void)
|
static void help(void)
|
||||||
@ -253,7 +253,7 @@ int main (int argc, char **argv)
|
|||||||
uint32_t size;
|
uint32_t size;
|
||||||
res = bep_image_get_size(&hcp_chain, &size);
|
res = bep_image_get_size(&hcp_chain, &size);
|
||||||
if (res == FPC_BEP_RESULT_OK) {
|
if (res == FPC_BEP_RESULT_OK) {
|
||||||
uint8_t *buf = malloc(size);
|
uint8_t *buf = (uint8_t *)malloc(size);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
res = bep_image_get(&hcp_chain, buf, size);
|
res = bep_image_get(&hcp_chain, buf, size);
|
||||||
if (res == FPC_BEP_RESULT_OK) {
|
if (res == FPC_BEP_RESULT_OK) {
|
||||||
@ -282,7 +282,7 @@ int main (int argc, char **argv)
|
|||||||
uint32_t size;
|
uint32_t size;
|
||||||
printf("Read template from file: ");
|
printf("Read template from file: ");
|
||||||
fscanf(stdin, "%s", cmd);
|
fscanf(stdin, "%s", cmd);
|
||||||
uint8_t *buf = malloc(102400);
|
uint8_t *buf = (uint8_t *)malloc(102400);
|
||||||
FILE *f = fopen(cmd, "rb");
|
FILE *f = fopen(cmd, "rb");
|
||||||
if (f) {
|
if (f) {
|
||||||
size = fread(buf, 1, 102400, f);
|
size = fread(buf, 1, 102400, f);
|
||||||
@ -302,7 +302,7 @@ int main (int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 't': {
|
case 't': {
|
||||||
uint8_t *buf = malloc(102400);
|
uint8_t *buf = (uint8_t *)malloc(102400);
|
||||||
printf("Save template to file: ");
|
printf("Save template to file: ");
|
||||||
fscanf(stdin, "%s", cmd);
|
fscanf(stdin, "%s", cmd);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
|||||||
@ -33,9 +33,9 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Send data to BM-Lite */
|
/** Send data to BM-Lite */
|
||||||
fpc_bep_result_t (*write) (uint16_t, const uint8_t *, uint32_t, void *);
|
fpc_bep_result_t (*write) (uint16_t, const uint8_t *, uint32_t);
|
||||||
/** Receive data from BM-Lite */
|
/** Receive data from BM-Lite */
|
||||||
fpc_bep_result_t (*read)(uint16_t, uint8_t *, uint32_t, void *);
|
fpc_bep_result_t (*read)(uint16_t, uint8_t *, uint32_t);
|
||||||
/** Receive timeout (msec). Applys ONLY to receiving packet from BM-Lite on physical layer */
|
/** Receive timeout (msec). Applys ONLY to receiving packet from BM-Lite on physical layer */
|
||||||
uint32_t phy_rx_timeout;
|
uint32_t phy_rx_timeout;
|
||||||
/** Data buffer for application layer */
|
/** Data buffer for application layer */
|
||||||
|
|||||||
@ -54,8 +54,7 @@ void platform_bmlite_reset(void);
|
|||||||
*
|
*
|
||||||
* @return ::fpc_com_result_t
|
* @return ::fpc_com_result_t
|
||||||
*/
|
*/
|
||||||
fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, uint32_t timeout);
|
||||||
void *session);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sends data over UART port in blocking mode.
|
* @brief Sends data over UART port in blocking mode.
|
||||||
@ -78,8 +77,7 @@ fpc_bep_result_t platform_bmlite_uart_send(uint16_t size, const uint8_t *data, u
|
|||||||
*
|
*
|
||||||
* @return ::fpc_com_result_t
|
* @return ::fpc_com_result_t
|
||||||
*/
|
*/
|
||||||
fpc_bep_result_t platform_bmlite_spi_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_spi_receive(uint16_t size, uint8_t *data, uint32_t timeout);
|
||||||
void *session);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Receives data from UART port in blocking mode.
|
* @brief Receives data from UART port in blocking mode.
|
||||||
|
|||||||
@ -200,7 +200,7 @@ fpc_bep_result_t bmlite_receive(HCP_comm_t *hcp_comm)
|
|||||||
static fpc_bep_result_t _rx_link(HCP_comm_t *hcp_comm)
|
static fpc_bep_result_t _rx_link(HCP_comm_t *hcp_comm)
|
||||||
{
|
{
|
||||||
// Get size, msg and CRC
|
// Get size, msg and CRC
|
||||||
fpc_bep_result_t result = hcp_comm->read(4, hcp_comm->txrx_buffer, hcp_comm->phy_rx_timeout, NULL);
|
fpc_bep_result_t result = hcp_comm->read(4, hcp_comm->txrx_buffer, hcp_comm->phy_rx_timeout);
|
||||||
_HPC_pkt_t *pkt = (_HPC_pkt_t *)hcp_comm->txrx_buffer;
|
_HPC_pkt_t *pkt = (_HPC_pkt_t *)hcp_comm->txrx_buffer;
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ static fpc_bep_result_t _rx_link(HCP_comm_t *hcp_comm)
|
|||||||
return FPC_BEP_RESULT_IO_ERROR;
|
return FPC_BEP_RESULT_IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hcp_comm->read(size + 4, hcp_comm->txrx_buffer + 4, 100, NULL);
|
hcp_comm->read(size + 4, hcp_comm->txrx_buffer + 4, 100);
|
||||||
|
|
||||||
uint32_t crc = *(uint32_t *)(hcp_comm->txrx_buffer + 4 + size);
|
uint32_t crc = *(uint32_t *)(hcp_comm->txrx_buffer + 4 + size);
|
||||||
uint32_t crc_calc = fpc_crc(0, hcp_comm->txrx_buffer+4, size);
|
uint32_t crc_calc = fpc_crc(0, hcp_comm->txrx_buffer+4, size);
|
||||||
@ -231,7 +231,7 @@ static fpc_bep_result_t _rx_link(HCP_comm_t *hcp_comm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send Ack
|
// Send Ack
|
||||||
hcp_comm->write(4, (uint8_t *)&fpc_com_ack, 0, NULL);
|
hcp_comm->write(4, (uint8_t *)&fpc_com_ack, 0);
|
||||||
|
|
||||||
return FPC_BEP_RESULT_OK;
|
return FPC_BEP_RESULT_OK;
|
||||||
}
|
}
|
||||||
@ -285,11 +285,11 @@ static fpc_bep_result_t _tx_link(HCP_comm_t *hcp_comm)
|
|||||||
*(uint32_t *)(hcp_comm->txrx_buffer + pkt->lnk_size + 4) = crc_calc;
|
*(uint32_t *)(hcp_comm->txrx_buffer + pkt->lnk_size + 4) = crc_calc;
|
||||||
uint16_t size = pkt->lnk_size + 8;
|
uint16_t size = pkt->lnk_size + 8;
|
||||||
|
|
||||||
bep_result = hcp_comm->write(size, hcp_comm->txrx_buffer, 0, NULL);
|
bep_result = hcp_comm->write(size, hcp_comm->txrx_buffer, 0);
|
||||||
|
|
||||||
// Wait for ACK
|
// Wait for ACK
|
||||||
uint32_t ack;
|
uint32_t ack;
|
||||||
bep_result = hcp_comm->read(4, (uint8_t *)&ack, 500, NULL);
|
bep_result = hcp_comm->read(4, (uint8_t *)&ack, 500);
|
||||||
if (bep_result == FPC_BEP_RESULT_TIMEOUT) {
|
if (bep_result == FPC_BEP_RESULT_TIMEOUT) {
|
||||||
LOG_DEBUG("ASK read timeout\n");
|
LOG_DEBUG("ASK read timeout\n");
|
||||||
bmlite_on_error(BMLITE_ERROR_SEND_CMD, FPC_BEP_RESULT_TIMEOUT);
|
bmlite_on_error(BMLITE_ERROR_SEND_CMD, FPC_BEP_RESULT_TIMEOUT);
|
||||||
|
|||||||
@ -52,8 +52,7 @@ void platform_bmlite_reset(void)
|
|||||||
hal_timebase_busy_wait(100);
|
hal_timebase_busy_wait(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, uint32_t timeout)
|
||||||
void *session)
|
|
||||||
{
|
{
|
||||||
uint8_t buff[size];
|
uint8_t buff[size];
|
||||||
#ifdef DEBUG_COMM
|
#ifdef DEBUG_COMM
|
||||||
@ -66,8 +65,7 @@ fpc_bep_result_t platform_bmlite_spi_send(uint16_t size, const uint8_t *data, ui
|
|||||||
return hal_bmlite_spi_write_read((uint8_t *)data, buff, size, false);
|
return hal_bmlite_spi_write_read((uint8_t *)data, buff, size, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fpc_bep_result_t platform_bmlite_spi_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t platform_bmlite_spi_receive(uint16_t size, uint8_t *data, uint32_t timeout)
|
||||||
void *session)
|
|
||||||
{
|
{
|
||||||
volatile uint32_t start_time = hal_timebase_get_tick();
|
volatile uint32_t start_time = hal_timebase_get_tick();
|
||||||
volatile uint32_t curr_time = start_time;
|
volatile uint32_t curr_time = start_time;
|
||||||
|
|||||||
@ -69,8 +69,7 @@ bool rpi_com_init(char *port, int baudrate, int timeout);
|
|||||||
*
|
*
|
||||||
* @return ::fpc_bep_result_t
|
* @return ::fpc_bep_result_t
|
||||||
*/
|
*/
|
||||||
fpc_bep_result_t rpi_com_send(uint16_t size, const uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t rpi_com_send(uint16_t size, const uint8_t *data, uint32_t timeout);
|
||||||
void *session);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Receives data from communication port in blocking mode.
|
* @brief Receives data from communication port in blocking mode.
|
||||||
@ -81,8 +80,7 @@ fpc_bep_result_t rpi_com_send(uint16_t size, const uint8_t *data, uint32_t timeo
|
|||||||
*
|
*
|
||||||
* @return ::fpc_bep_result_t
|
* @return ::fpc_bep_result_t
|
||||||
*/
|
*/
|
||||||
fpc_bep_result_t rpi_com_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t rpi_com_receive(uint16_t size, uint8_t *data, uint32_t timeout);
|
||||||
void *session);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initializes SPI Physical layer.
|
* @brief Initializes SPI Physical layer.
|
||||||
|
|||||||
@ -84,8 +84,7 @@ bool rpi_com_init(char *port, int baudrate, int timeout)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fpc_bep_result_t rpi_com_send(uint16_t size, const uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t rpi_com_send(uint16_t size, const uint8_t *data, uint32_t timeout)
|
||||||
void *session)
|
|
||||||
{
|
{
|
||||||
fpc_bep_result_t res = FPC_BEP_RESULT_OK;
|
fpc_bep_result_t res = FPC_BEP_RESULT_OK;
|
||||||
int n;
|
int n;
|
||||||
@ -104,8 +103,7 @@ fpc_bep_result_t rpi_com_send(uint16_t size, const uint8_t *data, uint32_t timeo
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
fpc_bep_result_t rpi_com_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
fpc_bep_result_t rpi_com_receive(uint16_t size, uint8_t *data, uint32_t timeout)
|
||||||
void *session)
|
|
||||||
{
|
{
|
||||||
fpc_bep_result_t res = FPC_BEP_RESULT_OK;
|
fpc_bep_result_t res = FPC_BEP_RESULT_OK;
|
||||||
int n_read = 0;
|
int n_read = 0;
|
||||||
|
|||||||
@ -39,8 +39,8 @@ Platform-independent interface implemented in [platform.c](BMLite_sdk/src/platfo
|
|||||||
| :-------- | :-------- |
|
| :-------- | :-------- |
|
||||||
| fpc_bep_result_t **platform_init**(void *params) | Initilalizes hardware |
|
| fpc_bep_result_t **platform_init**(void *params) | Initilalizes hardware |
|
||||||
| void **platform_bmlite_reset**(void) | Implements BM-Lite HW Reset |
|
| void **platform_bmlite_reset**(void) | Implements BM-Lite HW Reset |
|
||||||
| fpc_bep_result_t **platform_bmlite_spi_send**(uint16_t size, const uint8_t *data, uint32_t timeout, void *session) | Send data packet to FPC BM-Lite |
|
| fpc_bep_result_t **platform_bmlite_spi_send**(uint16_t size, const uint8_t *data, uint32_t timeout) | Send data packet to FPC BM-Lite |
|
||||||
| fpc_bep_result_t **platform_bmlite_spi_receive**(uint16_t size, uint8_t *data, uint32_t timeout, void *session) | Receive data packet from FPC BM-Lite. If timeout = **0**, the function will wait for data from BM-Lite indefinitely. The waiting loop will be breaked if **hal_check_button_pressed()** returns non-zero value. It is recommended to do HW or SW reset of BM-Lite if **platform_bmlite_spi_receive()** returns **FPC_BEP_RESULT_TIMEOUT** in order to return is into known state. |
|
| fpc_bep_result_t **platform_bmlite_spi_receive**(uint16_t size, uint8_t *data, uint32_t timeout) | Receive data packet from FPC BM-Lite. If timeout = **0**, the function will wait for data from BM-Lite indefinitely. The waiting loop will be breaked if **hal_check_button_pressed()** returns non-zero value. It is recommended to do HW or SW reset of BM-Lite if **platform_bmlite_spi_receive()** returns **FPC_BEP_RESULT_TIMEOUT** in order to return is into known state. |
|
||||||
|
|
||||||
Currently **platform_bmlite_uart_send()** and **platform_bmlite_uart_receive()** are not implemented. For UART interface there is no need to wait for **IRQ** pin ready. However because in UART mode there is no signal from FPC-BM-LIte that it will send data, I would recommend to use UART interrupt or DMA to receive data from UART and store it to a separate buffer and read data in **platform_bmlite_uart_receive()** from that buffer. Activation UART data reading only inside **platform_bmlite_uart_receive()** could lead to loosing some incoming data and causing HCP protocol errors.
|
Currently **platform_bmlite_uart_send()** and **platform_bmlite_uart_receive()** are not implemented. For UART interface there is no need to wait for **IRQ** pin ready. However because in UART mode there is no signal from FPC-BM-LIte that it will send data, I would recommend to use UART interrupt or DMA to receive data from UART and store it to a separate buffer and read data in **platform_bmlite_uart_receive()** from that buffer. Activation UART data reading only inside **platform_bmlite_uart_receive()** could lead to loosing some incoming data and causing HCP protocol errors.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user