RTEMS  5.0.0
Macros | Functions
dbg_console.c File Reference
#include "board.h"
#include <stdio.h>
#include <stdint.h>

Macros

#define CONSOLE_BAUDRATE   115200
 
#define CONSOLE_EDBG
 
#define CONSOLE_ON_USART
 
#define PIN_USART1_RXD_DBG   {PIO_PA21A_RXD1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
 
#define PIN_USART1_TXD_DBG   {PIO_PB4D_TXD1, PIOB, ID_PIOB, PIO_PERIPH_D, PIO_DEFAULT}
 
#define PINS_USART1   PIN_USART1_TXD_DBG, PIN_USART1_RXD_DBG
 
#define CONSOLE_Usart   USART1
 
#define CONSOLE_PINS   {PINS_USART1}
 
#define CONSOLE_ID   ID_USART1
 

Functions

void DBG_Configure (uint32_t baudrate, uint32_t masterClock)
 Configures an USART peripheral with the specified parameters. More...
 
void DBG_PutChar (uint8_t c)
 Outputs a character on the UART line. More...
 
uint32_t DBG_GetChar (void)
 Input a character from the UART line. More...
 
uint32_t DBG_IsRxReady (void)
 Check if there is Input from UART line. More...
 
void DBG_DumpFrame (uint8_t *pucFrame, uint32_t dwSize)
 
void DBG_DumpMemory (uint8_t *pucBuffer, uint32_t dwSize, uint32_t dwAddress)
 
uint32_t DBG_GetInteger (int32_t *pdwValue)
 
uint32_t DBG_GetIntegerMinMax (int32_t *pdwValue, int32_t dwMin, int32_t dwMax)
 
uint32_t DBG_GetHexa32 (uint32_t *pdwValue)
 
WEAK int puts (const char *ptr)
 
WEAK char * gets (char *ptr)
 

Detailed Description

Implements UART console.

Macro Definition Documentation

◆ CONSOLE_BAUDRATE

#define CONSOLE_BAUDRATE   115200

Console baud rate always using 115200.

◆ CONSOLE_EDBG

#define CONSOLE_EDBG

EDBG used USART1 as the console, but LON support on USART1 only

◆ CONSOLE_PINS

#define CONSOLE_PINS   {PINS_USART1}

Pins description corresponding to Rxd,Txd, (Usart pins)

◆ CONSOLE_Usart

#define CONSOLE_Usart   USART1

Usart Hw interface used by the console (Usart0).

◆ PIN_USART1_RXD_DBG

#define PIN_USART1_RXD_DBG   {PIO_PA21A_RXD1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}

USART1 pin RX

◆ PIN_USART1_TXD_DBG

#define PIN_USART1_TXD_DBG   {PIO_PB4D_TXD1, PIOB, ID_PIOB, PIO_PERIPH_D, PIO_DEFAULT}

USART1 pin TX

Function Documentation

◆ DBG_Configure()

void DBG_Configure ( uint32_t  baudrate,
uint32_t  masterClock 
)

Configures an USART peripheral with the specified parameters.

Parameters
baudrateBaudrate at which the USART should operate (in Hz).
masterClockFrequency of the system master clock (in Hz).

◆ DBG_DumpFrame()

void DBG_DumpFrame ( uint8_t *  pucFrame,
uint32_t  dwSize 
)

Displays the content of the given frame on the UART0.

Parameters
pucFramePointer to the frame to dump.
dwSizeBuffer size in bytes.

◆ DBG_DumpMemory()

void DBG_DumpMemory ( uint8_t *  pucBuffer,
uint32_t  dwSize,
uint32_t  dwAddress 
)

Displays the content of the given buffer on the UART0.

Parameters
pucBufferPointer to the buffer to dump.
dwSizeBuffer size in bytes.
dwAddressStart address to display

◆ DBG_GetChar()

uint32_t DBG_GetChar ( void  )

Input a character from the UART line.

Note
This function is synchronous
Returns
character received.

◆ DBG_GetHexa32()

uint32_t DBG_GetHexa32 ( uint32_t *  pdwValue)

Reads an hexadecimal number

Parameters
pdwValuePointer to the uint32_t variable to contain the input value.

◆ DBG_GetInteger()

uint32_t DBG_GetInteger ( int32_t *  pdwValue)

Reads an integer

Parameters
pdwValuePointer to a integer variable to contain the input value.
Returns
success(1) or failure(0)

◆ DBG_GetIntegerMinMax()

uint32_t DBG_GetIntegerMinMax ( int32_t *  pdwValue,
int32_t  dwMin,
int32_t  dwMax 
)

Reads an integer and check the value

Parameters
pdwValuePointer to a integer variable to contain the input value.
dwMinMinimum value
dwMaxMaximum value
Returns
success(1) or failure(0)

◆ DBG_IsRxReady()

uint32_t DBG_IsRxReady ( void  )

Check if there is Input from UART line.

Returns
true if there is Input.

◆ DBG_PutChar()

void DBG_PutChar ( uint8_t  c)

Outputs a character on the UART line.

Note
This function is synchronous (i.e. uses polling).
Parameters
cCharacter to send.