Atmel Software Framework

oven_classb.h File Reference

Class B application error insertion.

Copyright (C) 2010-2015 Atmel Corporation. All rights reserved.

Functions

void oven_classb_display_error (void)
 Print error message depending on the value of classb_error. More...
 
void oven_classb_error_insertion (void)
 Show menu for error insertion and handle user's selection. More...
 
void oven_classb_init_tests (void)
 Initialize Class B tests. More...
 
void oven_classb_run_tests (void)
 Run all Class B tests. More...
 

void oven_classb_error_insertion ( void  )

Show menu for error insertion and handle user's selection.

This function changes device configurations and does some hacks to make the device behave incorrectly.

The menu entries are

  • Change clock frequency: Changes the peripheral clock divider, simulating that the clock system has malfunctioned. This should be detected by the Class B frequency consistency test.
  • Mess with test timer: Changes how often periodic tests are performed, simulating an error with an interrupt timer. This should be detected by the Class B interrupt monitor.
  • Change a Flash section: Changes the string for the menu title stored in program memory to "Out of cheese", simulating Flash memory corruption. This can be changed back by selecting the menu item again. This should be detected by the Class B Flash CRC test.
  • Scramble SRAM section: Starts a continuous DMA transfer in the background to a memory location, simulating transient SRAM corruption. This should be detected by the periodic and power-on Class B SRAM test.
  • Enter infinite loop: Simulates a runaway program counter by looping forever. This should be detected by the watchdog timer system which is tested on device power-up.
  • Change ADC reference: Enables a callback function for the ADC, which will change the voltage reference after the next completed conversion. This will cause the analog IO test to fail when user turns up the power to the plate.

References ADC_CH0, ADC_CH2, adc_foul_callback(), adc_set_callback(), adcch_enable_interrupt(), adcch_read_configuration(), adcch_write_configuration(), GFX_MONO_MENU_EVENT_EXIT, GFX_MONO_MENU_EVENT_IDLE, gfx_mono_menu_init(), gfx_mono_menu_process_key(), keyboard_get_key_state(), KEYBOARD_RELEASE, keyboard_event::keycode, oven_classb_flash_corrupter(), OVEN_PERIODIC_TEMPTEST_TC, oven_wdt_periodic_reset, sysclk_set_prescalers(), keyboard_event::type, and variable_for_sram_error.

Referenced by main().

void oven_classb_init_tests ( void  )

Initialize Class B tests.

Set up timers, timer callbacks, initialize interrupt monitor, add interrupts to be monitored.

References classb_freq_setup_timer(), classb_freq_tc_callback(), CLASSB_FREQTEST_TC, classb_intmon_reg_int(), classb_rtc_callback(), CLASSB_RTC_INT_PERIOD, PER_CLASSB_TESTS, RTC32, rtc_set_alarm_relative(), rtc_set_callback(), tc_enable(), tc_set_overflow_interrupt_callback(), and TEMP_SANITY_TEST.

Referenced by main().

void oven_classb_run_tests ( void  )

Run all Class B tests.

Destructively test ADC and DAC; modules must be reinitialized for application use. Then test the SRAM, CPU registers and CRC of Flash (if enabled).

References adc_enable(), classb_analog_io_test(), classb_error, CLASSB_ERROR_NONE, CLASSB_NSECS, classb_register_test(), classb_sram_test(), dac_enable(), oven_ui_set_status_leds(), S_GREEN, S_ORANGE, and S_RED.

Referenced by ovenctl_turn_on_plate().