Microchip® Advanced Software Framework

srecParser.c File Reference

Implementation of real time srec parser.

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

#include <types.h>
#include <abstractSerializer.h>
#include <bootStructure.h>
#include <flashLoader.h>
#include <eepromLoader.h>
#include "asf.h"
#include "uartSerializer.h"
#include <appEntry.h>
#include "app_info.h"

Macros

#define EEPROM_PAGE_SIZE   256u
 

Functions

void jumpToApplication (void)
 
void srecHandshake (void)
 Handshake procedure. More...
 
static bool srecParser (void)
 Real time parser of srec format. More...
 
void srecProtocol (void)
 Communication support between host and mcu. More...
 
static uint8_t srecWaitForAddress (uint8_t addressLength)
 Waiting for a field of the type from the internal address. More...
 
static void srecWaitForType (SrecordType_t *srecType)
 Waiting for a field of the type from the serial interface. More...
 

Variables

app_info_t checkapp_info
 
BootBuffer_t dataBuffer
 
static uint32_t handshakeConf = HANDSHAKE_CONF
 
static uint32_t previousAddress = 0xFFFFFFFF
 
static uint32_t srecACK = ACK
 
static uint32_t srecNACK = NACK
 

#define EEPROM_PAGE_SIZE   256u

void jumpToApplication ( void  )
void srecHandshake ( void  )
static bool srecParser ( void  )
static

Real time parser of srec format.

Returns
false - parse error true - parse ok

References bootGetChar(), CHECKSUM_AREA_SIZE, BootBuffer_t::data, BootBuffer_t::dataSize, INFINITE, BootBuffer_t::recordType, S0, S1, S19, S2, S3, S5, S7, S9, SREC_DATA_LENGTH, srecWaitForAddress(), and srecWaitForType().

Referenced by srecProtocol().

static uint8_t srecWaitForAddress ( uint8_t  addressLength)
static

Waiting for a field of the type from the internal address.

Parameters
[in]addressLength- length of address field;
Returns
checksum with address field

References BootBuffer_t::address, bootGetChar(), and INFINITE.

Referenced by srecParser().

static void srecWaitForType ( SrecordType_t srecType)
static

Waiting for a field of the type from the serial interface.

Parameters
[out]srecType- pointer to buffer;

References bootGetChar(), INFINITE, and S_SYMBOL.

Referenced by srecParser().

app_info_t checkapp_info
BootBuffer_t dataBuffer
uint32_t handshakeConf = HANDSHAKE_CONF
static

Referenced by srecHandshake().

uint32_t previousAddress = 0xFFFFFFFF
static

Referenced by srecProtocol().

uint32_t srecACK = ACK
static

Referenced by srecProtocol().

uint32_t srecNACK = NACK
static

Referenced by srecProtocol().