2014-07-30 19:32:00 +00:00
|
|
|
/*
|
|
|
|
* C stubs for verification suite test cases
|
|
|
|
* Copyright (C) 2014 Richard Meadows <richardeoin>
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* CTypes just gets confused by function attributes... */
|
|
|
|
#ifdef CTYPESGEN
|
|
|
|
#define __verification__
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define __verification__ \
|
|
|
|
__attribute__ ((section(".text.verif"))) \
|
|
|
|
__attribute__ ((optimize("O0"))) \
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-03-13 19:07:24 +00:00
|
|
|
/***************************** test cases *******************************/
|
2014-07-30 19:32:00 +00:00
|
|
|
|
2015-03-13 19:07:24 +00:00
|
|
|
#include "times_two.h"
|
2015-03-13 19:42:01 +00:00
|
|
|
#include "osc8m_calib.h"
|
2015-06-07 21:22:24 +00:00
|
|
|
#include "location_aprs.h"
|
2015-07-22 21:33:51 +00:00
|
|
|
#include "location_telemetry.h"
|
2015-06-28 19:06:45 +00:00
|
|
|
#include "mem_write_page.h"
|
2015-06-28 21:26:33 +00:00
|
|
|
#include "mem_write_all.h"
|
2015-06-29 21:06:58 +00:00
|
|
|
#include "location_aprs_file.h"
|
2015-07-01 18:17:55 +00:00
|
|
|
#include "backlog_write_read.h"
|
2015-07-25 00:54:24 +00:00
|
|
|
#include "backlog_read.h"
|
2015-07-01 18:17:55 +00:00
|
|
|
#include "mem_erase_all.h"
|
2015-07-03 11:46:33 +00:00
|
|
|
#include "adc_battery_solar_read.h"
|
2015-07-14 20:46:03 +00:00
|
|
|
#include "gps_baud_error.h"
|
2015-07-18 20:25:52 +00:00
|
|
|
#include "crc32_gen_buf.h"
|
2015-06-28 19:06:45 +00:00
|
|
|
/* [new_tc] */
|
|
|
|
|
2014-07-30 19:32:00 +00:00
|
|
|
|
2015-03-13 19:07:24 +00:00
|
|
|
/******************************* tc_main ********************************/
|
2014-07-30 19:32:00 +00:00
|
|
|
|
2015-07-12 13:54:20 +00:00
|
|
|
#include "init.h"
|
|
|
|
|
2014-08-01 19:46:36 +00:00
|
|
|
typedef void (*tc_ptr_type)(void);
|
|
|
|
volatile tc_ptr_type tc_ptr;
|
|
|
|
|
2014-07-30 19:32:00 +00:00
|
|
|
/**
|
2014-08-23 21:18:49 +00:00
|
|
|
* Runs a test case
|
2014-08-03 13:59:38 +00:00
|
|
|
*/
|
2014-08-23 21:18:49 +00:00
|
|
|
__verification__ void tc_run() {
|
|
|
|
(*tc_ptr)();
|
|
|
|
}
|
2014-08-03 13:59:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to trigger the test case run
|
2014-07-30 19:32:00 +00:00
|
|
|
*/
|
|
|
|
__verification__ void tc_main(void) {
|
|
|
|
|
|
|
|
/* Wait forever while test cases execute */
|
2014-08-01 19:46:36 +00:00
|
|
|
while (1) {
|
2014-08-23 21:18:49 +00:00
|
|
|
tc_run();
|
2014-08-01 19:46:36 +00:00
|
|
|
}
|
2014-07-30 19:32:00 +00:00
|
|
|
}
|
2015-03-13 19:42:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prelude to main loop
|
|
|
|
*/
|
|
|
|
__verification__ void tc_prelude(void) {
|
|
|
|
|
|
|
|
/* Initialise the board */
|
2015-07-12 13:54:20 +00:00
|
|
|
init(NULL, INIT_TESTCASE);
|
2015-03-13 19:42:01 +00:00
|
|
|
|
|
|
|
/* Proceed to main loop */
|
|
|
|
tc_main();
|
|
|
|
}
|