tracedump.c File Reference


Detailed Description

Control Panel trace dump module.

This file defines a set of functions to dump trace.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file tracedump.c.

#include <stdlib.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "serial.h"
#include "tracedump.h"

Go to the source code of this file.

Defines

#define dumpCOM2_BAUDRATE   ( ( unsigned portLONG ) 57600 )
 Baud rate used by the serial port 2.
#define dumpCOM2_BUFFER_LEN   ( ( unsigned portLONG ) 64 )
 COM Port2 buffer length.
#define DUMPCOM2_NO_BLOCK   ( ( portTickType ) 0 )
#define TRACE_MSG_BANNER   "\x0C\r\n---------- Traces Dump \r\n"
 Banner printed on the dump port.

Functions

int itracedump_Init (void)
unsigned portSHORT ustracedump_Print (const signed portCHAR *const pcString)
void v_tracedump_stopResources (void)
 Stop the tracedump module resources.
void vtracedump_PrintBlocking (const signed portCHAR *const pcString)
void vtracedump_Putchar (signed portCHAR cByte)
 Put a char to the dump port.
void vtracedump_Putchar_Block (signed portCHAR cByte)
 Put a char to the dump port.

Variables

static xComPortHandle xComPort2Hndl = (xComPortHandle)NULL
 COM Port2 handle.


Define Documentation

#define dumpCOM2_BAUDRATE   ( ( unsigned portLONG ) 57600 )

Baud rate used by the serial port 2.

Definition at line 58 of file tracedump.c.

Referenced by itracedump_Init().

#define dumpCOM2_BUFFER_LEN   ( ( unsigned portLONG ) 64 )

COM Port2 buffer length.

Definition at line 60 of file tracedump.c.

Referenced by itracedump_Init().

#define DUMPCOM2_NO_BLOCK   ( ( portTickType ) 0 )

Definition at line 66 of file tracedump.c.

Referenced by vtracedump_Putchar().

#define TRACE_MSG_BANNER   "\x0C\r\n---------- Traces Dump \r\n"

Banner printed on the dump port.

Definition at line 64 of file tracedump.c.

Referenced by itracedump_Init().


Function Documentation

int itracedump_Init ( void   ) 

This function initializes the dump port.

Returns:
DUMP_SUCCESS or DUMP_FAILURE
Warning:
FreeRTOS must already be up & running when calling this function.

Definition at line 76 of file tracedump.c.

References DUMP_FAILURE, DUMP_SUCCESS, dumpCOM2_BAUDRATE, dumpCOM2_BUFFER_LEN, serCOM2, TRACE_MSG_BANNER, vtracedump_PrintBlocking(), xComPort2Hndl, and xUsartInit().

Referenced by portTASK_FUNCTION().

00077 {
00078   int iStatus = DUMP_SUCCESS;
00079 
00080   //**
00081   //** Init the port.
00082   //**
00083   // Init the COM Port2.
00084   xComPort2Hndl = xUsartInit(serCOM2, dumpCOM2_BAUDRATE, 0, dumpCOM2_BUFFER_LEN);
00085   if(xComPort2Hndl == 0)
00086     return(DUMP_FAILURE);
00087 
00088   //**
00089   //** Dump a banner to the port.
00090   //**
00091   vtracedump_PrintBlocking((const signed portCHAR * const)TRACE_MSG_BANNER);
00092 
00093   return(iStatus);
00094 }

unsigned portSHORT ustracedump_Print ( const signed portCHAR *const   pcString  ) 

Send a string of characters to the dump port.

Parameters:
pcString The string to dump
Returns:
The number of characters that could not be sent.
Warning:
FreeRTOS must already be up & running when calling this function.

Definition at line 110 of file tracedump.c.

References usUsartPutString(), and xComPort2Hndl.

00111 {
00112   return( usUsartPutString( xComPort2Hndl, pcString, strlen( (const portCHAR * )pcString ) ) );
00113 }

void v_tracedump_stopResources ( void   ) 

Stop the tracedump module resources.

Definition at line 99 of file tracedump.c.

References vSerialClose(), and xComPort2Hndl.

Referenced by e_syscmds_reboot().

00100 {
00101   vSerialClose( xComPort2Hndl );
00102 }

void vtracedump_PrintBlocking ( const signed portCHAR *const   pcString  ) 

Send a string of characters to the dump port.

Parameters:
pcString The string to dump
Warning:
FreeRTOS must already be up & running when calling this function.

Definition at line 121 of file tracedump.c.

References usUsartPutString(), and xComPort2Hndl.

Referenced by itracedump_Init().

00122 {
00123    unsigned portSHORT usRemainChar = 0;
00124    unsigned portSHORT usMsgLen = strlen((const portCHAR * )pcString);
00125 
00126    usRemainChar = usMsgLen;
00127    do{
00128       usRemainChar = usUsartPutString( xComPort2Hndl,
00129                                        (const signed portCHAR * const)(pcString + usMsgLen - usRemainChar),
00130                                        usRemainChar );
00131    }while( usRemainChar );
00132 }

void vtracedump_Putchar ( signed portCHAR  cByte  ) 

Put a char to the dump port.

Parameters:
cByte The character to put

Definition at line 140 of file tracedump.c.

References DUMPCOM2_NO_BLOCK, xComPort2Hndl, and xUsartPutChar().

00141 {
00142    xUsartPutChar( xComPort2Hndl, cByte, DUMPCOM2_NO_BLOCK );
00143 }

void vtracedump_Putchar_Block ( signed portCHAR  cByte  ) 

Put a char to the dump port.

Parameters:
cByte The character to put

Definition at line 150 of file tracedump.c.

References xComPort2Hndl, and xUsartPutChar().

00151 {
00152    xUsartPutChar( xComPort2Hndl, cByte, -1 );
00153 }


Variable Documentation


Generated on Fri Feb 19 02:22:48 2010 for AVR32 - Control Panel demonstration. by  doxygen 1.5.5