Common bootloader serial definitions. See Serial for detailed documentation.

License#

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

/***************************************************************************/
#ifndef __BOOTLOADER_SERIAL_H__
#define __BOOTLOADER_SERIAL_H__

#ifndef MSD_BOOTLOADER

void serInit(void);

void serPutFlush(void);

void serPutChar(uint8_t ch);

void serPutStr(const char *str);

void serPutBuf(const uint8_t buf[], uint8_t size);

void serPutDecimal(uint16_t val);

void serPutHex(uint8_t byte);

void serPutHexInt(uint16_t word);

bool serCharAvailable(void);

uint8_t   serGetChar(uint8_t* ch);

void    serGetFlush(void);

#ifndef DOXYGEN_SHOULD_SKIP_THIS
#ifdef BTL_HAS_EZSP_SPI
extern uint8_t preSpiComBufIndex;
#define serResetCharInput() preSpiComBufIndex = 0;
#endif
#endif

#else //MSD_BOOTLOADER

// clear serial calls
#define serInit(x) {}
#define serPutFlush(x)
#define serPutChar(x)
#define serPutStr(x)
#define serPutBuf(x)
#define serPutDecimal(x)
#define serPutHex(x) x
#define serPutHexInt(x)
#define serCharAvailable(x)
#define serGetChar(x)
#define serGetFlush(x)

#endif //MSD_BOOTLOADER

#endif //__BOOTLOADER_SERIAL_H__

Functions#

void
serInit(void)

Initialize serial port.

void

Flush the transmiter.

void
serPutChar(uint8_t ch)

Transmit a character.

void
serPutStr(const char *str)

Transmit a string.

void
serPutBuf(const uint8_t buf[], uint8_t size)

Transmit a buffer.

void
serPutDecimal(uint16_t val)

Transmit a 16bit value in decimal.

void
serPutHex(uint8_t byte)

Transmit a byte as hex.

void
serPutHexInt(uint16_t word)

Transmit a 16bit integer as hex.

bool

Determine if a character is available.

uint8_t
serGetChar(uint8_t *ch)

Get a character if available, otherwise return an error.

void

Flush the receiver.

Function Documentation#

serInit#

void serInit (void )

Initialize serial port.

Parameters
N/A

Definition at line 32 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serPutFlush#

void serPutFlush (void )

Flush the transmiter.

Parameters
N/A

Definition at line 36 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serPutChar#

void serPutChar (uint8_t ch)

Transmit a character.

Parameters
N/Ach

A character.


Definition at line 41 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serPutStr#

void serPutStr (const char * str)

Transmit a string.

Parameters
N/Astr

A string.


Definition at line 46 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serPutBuf#

void serPutBuf (const uint8_t buf, uint8_t size)

Transmit a buffer.

Parameters
N/Abuf

A buffer.

N/Asize

Length of buffer.


Definition at line 52 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serPutDecimal#

void serPutDecimal (uint16_t val)

Transmit a 16bit value in decimal.

Parameters
N/Aval

The data to print.


Definition at line 57 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serPutHex#

void serPutHex (uint8_t byte)

Transmit a byte as hex.

Parameters
N/Abyte

A byte.


Definition at line 62 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serPutHexInt#

void serPutHexInt (uint16_t word)

Transmit a 16bit integer as hex.

Parameters
N/Aword

A 16bit integer.


Definition at line 67 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serCharAvailable#

bool serCharAvailable (void )

Determine if a character is available.

Parameters
N/A

Returns

  • true if a character is available, false otherwise.


Definition at line 72 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serGetChar#

uint8_t serGetChar (uint8_t * ch)

Get a character if available, otherwise return an error.

Parameters
N/Ach

Pointer to a location where the received byte will be placed.

Returns


Definition at line 78 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h

serGetFlush#

void serGetFlush (void )

Flush the receiver.

Parameters
N/A

Definition at line 82 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-serial.h