Microchip® Advanced Software Framework

abstractSerializer.c File Reference

Usage of all declared serial interfaces.

Copyright (c) 2020 Microchip Technology Inc. and its subsidiaries.

#include <types.h>
#include <abstractSerializer.h>
#include <srecParser.h>

Macros

#define UPPER_BYTE_OFFSET   3
 

Functions

bool bootGetChar (uint8_t *p, bool flag)
 Read byte from interface. More...
 
bool bootScanInterfaces (void)
 Perform search interface activity and handshake message. More...
 
void bootSetChar (uint16_t len, uint8_t *p)
 Write byte to interface. More...
 
void bootUnInitSerializer (void)
 Clear interface setting. More...
 

Variables

static uint8_t currentInterface
 
static SerialInterface_t serialInterface []
 

#define UPPER_BYTE_OFFSET   3

Referenced by bootScanInterfaces().

bool bootGetChar ( uint8_t *  p,
bool  flag 
)

Read byte from interface.

Parameters
[out]p- pointer to data buffer;
[in]flag- flag about unlimited or limited reading time.
Returns
true - byte was read, false - byte was not read.

References currentInterface, SerialInterface_t::getByte, and result.

Referenced by srecParser(), srecWaitForAddress(), and srecWaitForType().

bool bootScanInterfaces ( void  )

Perform search interface activity and handshake message.

Returns
true - handshake was read, false - there is no activity.

References currentInterface, SerialInterface_t::getByte, HANDSHAKE_REQ, SerialInterface_t::hwInit, SerialInterface_t::hwUnInit, result, serialInterface, and UPPER_BYTE_OFFSET.

Referenced by srecHandshake().

void bootSetChar ( uint16_t  len,
uint8_t *  p 
)

Write byte to interface.

Parameters
[in]len- data length;
[in]p- pointer to data buffer.

References currentInterface, and SerialInterface_t::setByte.

Referenced by srecHandshake(), and srecProtocol().

void bootUnInitSerializer ( void  )

Clear interface setting.

References currentInterface, SerialInterface_t::hwUnInit, and lowLevelUnInit().

Referenced by srecHandshake(), and srecProtocol().

uint8_t currentInterface
static
SerialInterface_t serialInterface[]
static
Initial value:
=
{
{
.hwInit = hwInitUsart0,
.hwUnInit = hwUnInitUsart0,
.getByte = getByteUsart,
.setByte = setByteUsart
}
}
void hwInitUsart0(void)
Startup initialization of the usart0.
void hwUnInitUsart0(void)
Clear startup initialization parameters to start user application.
void setByteUsart(uint16_t len, uint8_t *p)
Transmit byte to uart.
bool getByteUsart(uint8_t *p)
Receive byte on uart.

Referenced by bootScanInterfaces().