Microchip® Advanced Software Framework

preparser.c File Reference

Implementation of converting byte stream to string for common
bootloader part.

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

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

Macros

#define ASCII_0   0x30
 
#define ASCII_8   0x38
 
#define ASCII_9   0x39
 
#define ASCII_A   0x41
 
#define DIFF_ASCII   0x37
 
#define SIZE_PREBUFFER   64
 

Functions

static uint8_t asciiToDig (uint8_t symbol)
 Convert ascii to digital. More...
 
void convertStreamToNumbers (uint8_t *stream, uint8_t size)
 Waiting for a field of the type from the internal address. More...
 
bool readFromPreBuffer (uint8_t *data)
 Read data byte from preparser buffer. More...
 

Variables

static uint8_t placed
 
static uint8_t poR
 
static uint8_t preBuffer [SIZE_PREBUFFER]
 
bool srecFinished = false
 

#define ASCII_0   0x30
#define ASCII_8   0x38

Referenced by convertStreamToNumbers().

#define ASCII_9   0x39

Referenced by asciiToDig().

#define ASCII_A   0x41

Referenced by asciiToDig().

#define DIFF_ASCII   0x37

Referenced by asciiToDig().

#define SIZE_PREBUFFER   64

static uint8_t asciiToDig ( uint8_t  symbol)
static

Convert ascii to digital.

Parameters
[in]symbol- ascii code;
Returns
digital

References ASCII_0, ASCII_9, ASCII_A, and DIFF_ASCII.

Referenced by convertStreamToNumbers().

void convertStreamToNumbers ( uint8_t *  stream,
uint8_t  size 
)

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

Parameters
[in]stream- byte stream from usb;
[in]size- size of the converted stream;

References ASCII_0, ASCII_8, asciiToDig(), placed, preBuffer, S_SYMBOL, and srecFinished.

bool readFromPreBuffer ( uint8_t *  data)

Read data byte from preparser buffer.

Parameters
[in]data- pointer to memory for data byte;
Returns
true - there is data byte; false - preparser buffer is empty

References placed, poR, and preBuffer.

uint8_t placed
static
uint8_t poR
static

Referenced by readFromPreBuffer().

uint8_t preBuffer[SIZE_PREBUFFER]
static
bool srecFinished = false

Referenced by convertStreamToNumbers().