Microchip® Advanced Software Framework

sam_ba_monitor.c File Reference

Monitor functions for SAM-BA on SAM0 Port of rom monitor functions from legacy sam-ba software.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include <string.h>
#include "sam_ba_monitor.h"
#include "usart_sam_ba.h"
#include "conf_board.h"

Data Structures

struct  t_monitor_if
 

Functions

void call_applet (uint32_t address)
 Execute an applet from the specified address. More...
 
void sam_ba_monitor_init (uint8_t com_interface)
 This function initializes the SAM-BA monitor. More...
 
void sam_ba_monitor_run (void)
 This function starts the SAM-BA monitor. More...
 
void sam_ba_putdata_term (uint8_t *data, uint32_t length)
 This function allows data rx by USART. More...
 

Variables

volatile bool b_terminal_mode = false
 
uint8_t command
 
uint32_t current_number
 
uint8_t data [SIZEBUFMAX]
 
uint32_t i
 
uint8_t j
 
uint32_t length
 
uint8_t * ptr
 
uint8_t * ptr_data
 
t_monitor_ifptr_monitor_if
 
const char RomBOOT_Version [] = SAM_BA_VERSION
 
volatile uint32_t sp
 
uint32_t u32tmp
 
const t_monitor_if uart_if
 
const t_monitor_if usbcdc_if
 

void call_applet ( uint32_t  address)

Execute an applet from the specified address.

Parameters
addressApplet address

References cpu_irq_disable, and sp.

Referenced by sam_ba_monitor_run().

void sam_ba_monitor_init ( uint8_t  com_interface)

This function initializes the SAM-BA monitor.

Initialize the monitor.

Parameters
com_interfaceCommunication interface to be used.

References SAM_BA_INTERFACE_USART, and SAM_BA_INTERFACE_USBCDC.

Referenced by main().

void sam_ba_monitor_run ( void  )
void sam_ba_putdata_term ( uint8_t *  data,
uint32_t  length 
)

This function allows data rx by USART.

Parameters
*dataData pointer
lengthLength of the data

References b_terminal_mode, i, and t_monitor_if::putdata.

Referenced by sam_ba_monitor_run().

volatile bool b_terminal_mode = false
uint8_t command

Referenced by sam_ba_monitor_run().

uint32_t current_number

Referenced by sam_ba_monitor_run().

uint8_t data[SIZEBUFMAX]

Referenced by putPacket(), and sam_ba_monitor_run().

uint8_t * ptr

Referenced by sam_ba_monitor_run().

uint8_t * ptr_data
t_monitor_if* ptr_monitor_if
const char RomBOOT_Version[] = SAM_BA_VERSION

Referenced by sam_ba_monitor_run().

volatile uint32_t sp

Referenced by call_applet(), and sam_ba_monitor_run().

uint32_t u32tmp

Referenced by sam_ba_monitor_run().

const t_monitor_if uart_if
Initial value:
=
uint32_t usart_putdata(void const *data, uint32_t length)
Send given data (polling)
Definition: usart_sam_ba.c:164
int usart_getc(void)
Waits and gets a value on usart line.
Definition: usart_sam_ba.c:133
uint32_t usart_getdata(void *data, uint32_t length)
Get data from com device.
Definition: usart_sam_ba.c:178
uint32_t usart_getdata_xmd(void *data, uint32_t length)
Called when a transfer from host to target is being made (considered an download).
Definition: usart_sam_ba.c:370
int usart_putc(int value)
Puts a byte on usart line The type int is used to support printf redirection from compiler LIB...
Definition: usart_sam_ba.c:125
uint32_t usart_putdata_xmd(void const *data, uint32_t length)
Called when a transfer from target to host is being made(considered an upload).
Definition: usart_sam_ba.c:290
bool usart_is_rx_ready(void)
This function checks if a character has been received on the usart line.
Definition: usart_sam_ba.c:150
const t_monitor_if usbcdc_if
Initial value:
=
iram_size_t udi_cdc_write_buf(const void *buf, iram_size_t size)
Writes a RAM buffer on CDC line.
Definition: udi_cdc.c:1136
bool udi_cdc_is_rx_ready(void)
This function checks if a character has been received on the CDC line.
Definition: udi_cdc.c:854
iram_size_t udi_cdc_read_no_polling(void *buf, iram_size_t size)
Non polling reads of a up to &#39;size&#39; data from CDC line.
Definition: udi_cdc.c:993
int udi_cdc_getc(void)
Waits and gets a value on CDC line.
Definition: udi_cdc.c:903
int udi_cdc_putc(int value)
Puts a byte on CDC line The type int is used to support printf redirection from compiler LIB...
Definition: udi_cdc.c:1083
iram_size_t udi_cdc_read_buf(void *buf, iram_size_t size)
Reads a RAM buffer on CDC line.
Definition: udi_cdc.c:998