Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages

All the debugging functions currently supported by the DSP library.

Macros

#define dsp_debug_initialization(x)   dsp_debug_initialization__(__DATE__, __TIME__, x)
 This define permits to print the date and the time of the last compilation of the dsp_debug_initialization__ function. More...
 

Functions

void dsp_debug_print_fct (char *str)
 This function is used to print a string through the peripheral used by the debugging module. More...
 
int dsp_debug_sprint_after_radix (char **out, unsigned int num, unsigned int den, int nb_digits)
 This functions permits to copy the digits after the radix of a division's result in the specified buffer. More...
 

Peripheral function

These function are used to make an abstraction of the driver used to control the debugging peripheral.

void dsp_debug_init (int fosc)
 This function permits to initialize the peripheral that is used to debug. It is automatically called by the dsp_debug_initialization__ function. More...
 
void dsp_debug_write_fct (char c)
 This function is used to print a character through the peripheral used by the debugging module. More...
 
char dsp_debug_read_fct ()
 This function is used to get a character through the peripheral used by the debugging module. More...
 

Q formatted number printing functions

These function permits to print a signed fixed point Q formatted number.

void dsp_debug_print (int nb_bits, int q, int n)
 Generic function to print all kind of Q formatted numbers. More...
 
int dsp_debug_sprint (char **out, int nb_bits, int q, int i)
 Generic function to print all kind of Q formatted numbers. More...
 
void dsp16_debug_print (dsp16_t n)
 This functions permits to print a dsp16_t typed number. More...
 
void dsp32_debug_print (dsp32_t n)
 This functions permits to print a dsp32_t typed number. More...
 

Complex number printing functions

These function permits to print a complex signed fixed point Q formatted number.

void dsp_debug_print_complex (int nb_bits, int q, int real, int imag)
 Generic function to print all kind of complex Q formatted numbers. More...
 
void dsp16_debug_print_complex (dsp16_complex_t *n)
 This functions permits to print a dsp16_complex_t typed number. More...
 
void dsp32_debug_print_complex (dsp32_complex_t *n)
 This functions permits to print a dsp32_complex_t typed number. More...
 

Vector printing functions

These function permits to print vectors.
All these functions print a vector the same way.

1 0.02556
2 -0.60125
...

For a real type vector.

1 0.02556 + -0.08965i
2 -0.65064 + 0.i
...

For a complex type vector.

void dsp16_debug_print_vect (dsp16_t *vect, int size)
 This functions permits to print a dsp16_t typed vector. More...
 
void dsp32_debug_print_vect (dsp32_t *vect, int size)
 This functions permits to print a dsp32_t typed vector. More...
 
void dsp16_debug_print_complex_vect (dsp16_complex_t *vect, int size)
 This functions permits to print a dsp16_complex_t typed vector. More...
 
void dsp32_debug_print_complex_vect (dsp32_complex_t *vect, int size)
 This functions permits to print a dsp32_complex_t typed vector. More...
 

Printf functions

These function permits to print any data on a printing device.
These functions work as the printf function, except that they include the fixed point Q formatted format notion. The following attributes are currently implemented:

  • s : The const char * argument is expected to be a pointer to an array of character type (pointer to a string). Characters from the array are written up to (but not including) a terminating null byte ('\0'); if a precision is specified, no more than the number specified are written. If a precision is given, no null byte need be present; if the precision is not specified, or is greater than the size of the array, the array must contain a terminating null byte.
  • d ,i : The int argument is converted to signed decimal notation. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty.
  • o ,u ,x ,X : The unsigned int argument is converted to unsigned octal (o ), unsigned decimal (u ), or unsigned hexadecimal (x and X ) notation. The letters abcdef are used for x conversions; the letters ABCDEF are used for X conversions. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty.
  • c : The int argument is converted to an unsigned char, and the resulting character is written.
  • f : The fixed point argument is converted to decimal notation in the style [-]ddd.ddd, [THE FOLLOWING IS NOT IMPLEMENTED YET!] where the number of digits after the decimal-point character is equal to the precision specification. If the precision is missing, it is taken as 6; if the precision is explicitly zero, no decimal-point character appears. If a decimal point appears, at least one digit appears before it.
int dsp16_debug_printf (const char *format,...)
 This function is the printf version for 16-bit Q formatted signed numbers. More...
 
int dsp32_debug_printf (const char *format,...)
 This function is the printf version for 32-bit Q formatted signed numbers. More...
 
int dsp16_debug_sprintf (char *out, const char *format,...)
 This function is the sprintf version for 16-bit Q formatted signed numbers. More...
 
int dsp32_debug_sprintf (char *out, const char *format,...)
 This function is the sprintf version for 32-bit Q formatted signed numbers. More...
 

#define dsp_debug_initialization (   x)    dsp_debug_initialization__(__DATE__, __TIME__, x)

This define permits to print the date and the time of the last compilation of the dsp_debug_initialization__ function.

Referenced by main().

void dsp16_debug_print ( dsp16_t  n)
inline

This functions permits to print a dsp16_t typed number.

Parameters
nThe 16 bits signed fixed point Q formatted number to print.
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References DSP16_QA, and dsp_debug_print().

Referenced by dsp16_debug_print_vect().

void dsp16_debug_print_complex ( dsp16_complex_t n)
inline

This functions permits to print a dsp16_complex_t typed number.

Parameters
nThe 16 bits signed fixed point Q formatted complex number to print.
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References DSP16_QA, dsp_debug_print_complex(), dsp16_complex_t::imag, and dsp16_complex_t::real.

Referenced by dsp16_debug_print_complex_vect().

void dsp16_debug_print_complex_vect ( dsp16_complex_t vect,
int  size 
)

This functions permits to print a dsp16_complex_t typed vector.

Parameters
vectthe vector to print.
sizeThe size of the vector (vect).
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References dsp16_debug_print_complex(), dsp_debug_print_fct(), dsp_debug_print_ui(), and i.

Referenced by main().

void dsp16_debug_print_vect ( dsp16_t vect,
int  size 
)

This functions permits to print a dsp16_t typed vector.

Parameters
vectthe vector to print.
sizeThe size of the vector (vect).
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References dsp16_debug_print(), dsp_debug_print_fct(), dsp_debug_print_ui(), and i.

Referenced by main().

int dsp16_debug_printf ( const char *  format,
  ... 
)

This function is the printf version for 16-bit Q formatted signed numbers.

Parameters
formatThe number of bits of the complex number to print.
Returns
The number of characters written
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References dsp_debug_buffer, dsp_debug_print_fct(), n, and print().

Referenced by int_division(), int_multiplication(), main(), real_addition(), and real_subtraction().

int dsp16_debug_sprintf ( char *  out,
const char *  format,
  ... 
)

This function is the sprintf version for 16-bit Q formatted signed numbers.

Parameters
outThe output buffer where the result will be stored.
formatThe number of bits of the complex number to print.
Returns
The number of characters written
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References n, out, and print().

void dsp32_debug_print ( dsp32_t  n)
inline

This functions permits to print a dsp32_t typed number.

Parameters
nThe 32 bits signed fixed point Q formatted number to print.
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References DSP32_QA, and dsp_debug_print().

Referenced by dsp32_debug_print_vect().

void dsp32_debug_print_complex ( dsp32_complex_t n)
inline

This functions permits to print a dsp32_complex_t typed number.

Parameters
nThe 32 bits signed fixed point Q formatted complex number to print.
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References DSP32_QA, dsp_debug_print_complex(), dsp32_complex_t::imag, and dsp32_complex_t::real.

Referenced by dsp32_debug_print_complex_vect().

void dsp32_debug_print_complex_vect ( dsp32_complex_t vect,
int  size 
)

This functions permits to print a dsp32_complex_t typed vector.

Parameters
vectthe vector to print.
sizeThe size of the vector (vect).
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References dsp32_debug_print_complex(), dsp_debug_print_fct(), dsp_debug_print_ui(), and i.

void dsp32_debug_print_vect ( dsp32_t vect,
int  size 
)

This functions permits to print a dsp32_t typed vector.

Parameters
vectthe vector to print.
sizeThe size of the vector (vect).
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References dsp32_debug_print(), dsp_debug_print_fct(), dsp_debug_print_ui(), and i.

Referenced by main().

int dsp32_debug_printf ( const char *  format,
  ... 
)

This function is the printf version for 32-bit Q formatted signed numbers.

Parameters
formatThe number of bits of the complex number to print.
Returns
The number of characters written
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References dsp_debug_buffer, dsp_debug_print_fct(), n, and print().

Referenced by addition(), convolution(), copy(), dot_division(), dot_multiplication(), main(), maximum(), minimum(), negate(), partial_convolution(), power(), real_division(), real_multiplication(), subtraction(), and zero_padding().

int dsp32_debug_sprintf ( char *  out,
const char *  format,
  ... 
)

This function is the sprintf version for 32-bit Q formatted signed numbers.

Parameters
outThe output buffer where the result will be stored.
formatThe number of bits of the complex number to print.
Returns
The number of characters written
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References n, out, and print().

Referenced by main().

void dsp_debug_init ( int  fosc)

This function permits to initialize the peripheral that is used to debug. It is automatically called by the dsp_debug_initialization__ function.

Parameters
foscThe frequency of the oscillator.

This function permits to initialize the peripheral that is used to debug. It is automatically called by the dsp_debug_initialization__ function.

References usart_options_t::baudrate, dsp_debug_print_fct(), EXAMPLE_USART, EXAMPLE_USART_BAUDRATE, EXAMPLE_USART_BITSPERCHAR, EXAMPLE_USART_PARITY, EXAMPLE_USART_RX_FUNCTION, EXAMPLE_USART_RX_PIN, EXAMPLE_USART_STOPBIT, EXAMPLE_USART_TX_FUNCTION, EXAMPLE_USART_TX_PIN, gpio_enable_module(), USART_GPIO_MAP, usart_init_rs232(), USART_NORMAL_CHMODE, and USART_OPTIONS.

Referenced by dsp_debug_initialization__().

void dsp_debug_print ( int  nb_bits,
int  q,
int  n 
)

Generic function to print all kind of Q formatted numbers.

Parameters
nb_bitsThe number of bits of the number to print.
qThe a parameter of a Qa.b formatted number.
nThe signed fixed point Q formatted number to print.
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References dsp_debug_buffer, dsp_debug_print_fct(), and dsp_debug_sprint().

Referenced by dsp16_debug_print(), dsp32_debug_print(), and dsp_debug_print_complex().

void dsp_debug_print_complex ( int  nb_bits,
int  q,
int  real,
int  imag 
)

Generic function to print all kind of complex Q formatted numbers.

Parameters
nb_bitsThe number of bits of the complex number to print.
qThe a parameter of a Qa.b formatted number.
realThe real part of the signed fixed point Q formatted complex number to print.
imagThe imaginary part of the signed fixed point Q formatted complex number to print.
Note
This function print the data on the printing device specified in the initialization function.
Precondition
The dsp_debug_initialization__ function has to be called before using this function.

References dsp_debug_print(), and dsp_debug_print_fct().

Referenced by dsp16_debug_print_complex(), and dsp32_debug_print_complex().

void dsp_debug_print_fct ( char *  str)

This function is used to print a string through the peripheral used by the debugging module.

Parameters
strThe string to print.
Precondition
It has to be used after having initializing the peripheral.

References dsp_debug_write_fct().

Referenced by dsp16_debug_print_complex_vect(), dsp16_debug_print_vect(), dsp16_debug_printf(), dsp32_debug_print_complex_vect(), dsp32_debug_print_vect(), dsp32_debug_printf(), dsp_debug_init(), dsp_debug_print(), and dsp_debug_print_complex().

char dsp_debug_read_fct ( )

This function is used to get a character through the peripheral used by the debugging module.

Returns
The received character.
Precondition
It has to be used after having initializing the peripheral.

This function is used to get a character through the peripheral used by the debugging module.

References EXAMPLE_USART, and usart_getchar().

Referenced by dsp_debug_read(), dsp_debug_read_q(), dsp_debug_read_ui(), and main().

int dsp_debug_sprint ( char **  out,
int  nb_bits,
int  q,
int  i 
)

Generic function to print all kind of Q formatted numbers.

Parameters
outThe buffer that received the printed number.
nb_bitsThe number of bits of the number to print.
qThe a parameter of a Qa.b formatted number.
iThe signed fixed point Q formatted number to print.

References dsp_debug_print_ui(), dsp_debug_sprint_after_radix(), dsp_debug_sprint_fct(), i, and n.

Referenced by dsp_debug_print(), and print().

int dsp_debug_sprint_after_radix ( char **  out,
unsigned int  num,
unsigned int  den,
int  nb_digits 
)

This functions permits to copy the digits after the radix of a division's result in the specified buffer.

Parameters
outThe buffer that received the digits after the radix.
numThe numerator of the division.
denThe denominator of the division.
nb_digitsThe number of digits to print.
Returns
the number of characters written.

References den, dsp_debug_sprint_fct(), i, n, and temp.

Referenced by dsp_debug_sprint().

void dsp_debug_write_fct ( char  c)

This function is used to print a character through the peripheral used by the debugging module.

Parameters
cThe character to print.
Precondition
It has to be used after having initializing the peripheral.

This function is used to print a character through the peripheral used by the debugging module.

References EXAMPLE_USART, and usart_putchar().

Referenced by dsp_debug_print_fct().