Compare commits

...

6 Commits

1133 changed files with 520704 additions and 114 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "wamr"]
path = wamr
url = ssh://git@gitea.local.chriphost.de:222/christoph/wamr.git
[submodule "tacle-converter"]
path = tacle-converter
url = https://gitos.rrze.fau.de/i4/openaccess/tacle-bench-wasm-converter

144
flake.nix
View File

@ -6,31 +6,27 @@ rec {
flake-utils.url = "github:numtide/flake-utils";
};
# TODO: Rewrite all perl scripts -> modularize common code and unify menu actions
outputs =
{
self,
nixpkgs,
flake-utils,
}:
# Create a shell (and possibly package) for each possible system, not only x86_64-linux
outputs = {
self,
nixpkgs,
flake-utils,
}:
# Create a shell (and possibly package) for each possible system, not only x86_64-linux
flake-utils.lib.eachDefaultSystem (
system:
let
system: let
# =========================================================================================
# Define pkgs/stdenvs
# =========================================================================================
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ ];
overlays = [];
};
i386_pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ ];
overlays = [];
# Build crosscompiler
crossSystem = {
@ -41,23 +37,23 @@ rec {
boost_pkgs =
import
(builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/824421b1796332ad1bcb35bc7855da832c43305f.tar.gz";
sha256 = "sha256:1w6cjnakz1yi66rs8c6nmhymsr7bj82vs2hz200ipi1sfiq8dy4y";
})
{
inherit system;
};
(builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/824421b1796332ad1bcb35bc7855da832c43305f.tar.gz";
sha256 = "sha256:1w6cjnakz1yi66rs8c6nmhymsr7bj82vs2hz200ipi1sfiq8dy4y";
})
{
inherit system;
};
libdwarf_pkgs =
import
(builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/f597e7e9fcf37d8ed14a12835ede0a7d362314bd.tar.gz";
sha256 = "sha256:1l79hh7jh7m8yc5mvc8dbg6s8rf30bgm994kf07xriqbzwfn158r";
})
{
inherit system;
};
(builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/f597e7e9fcf37d8ed14a12835ede0a7d362314bd.tar.gz";
sha256 = "sha256:1l79hh7jh7m8yc5mvc8dbg6s8rf30bgm994kf07xriqbzwfn158r";
})
{
inherit system;
};
inherit (pkgs) lib stdenv;
@ -66,39 +62,38 @@ rec {
# =========================================================================================
# Setup the shell when entering the "nix develop" environment (bash script).
shellHook =
let
# Add project-local fish abbrs here
abbrs = {
fail = "perl ./scripts/menu.pl";
shellHook = let
# Add project-local fish abbrs here
abbrs = {
fail = "perl ./scripts/menu.pl";
# C/C++:
# cmake-debug = "${cmakeDebug}";
# cmake-release = "${cmakeRelease}";
# build-debug = "${buildDebug}";
# build-release = "${buildRelease}";
};
# C/C++:
# cmake-debug = "${cmakeDebug}";
# cmake-release = "${cmakeRelease}";
# build-debug = "${buildDebug}";
# build-release = "${buildRelease}";
};
eraseAbbr = name: value: "abbr --erase ${name} 2>/dev/null";
createAbbr = name: value: ''abbr -a ${name} "${value}"'';
eraseAbbr = name: value: "abbr --erase ${name} 2>/dev/null";
createAbbr = name: value: ''abbr -a ${name} "${value}"'';
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets unset
unloadProjectShell = pkgs.writers.writeFish "unload-shell.fish" ''
echo "Unloading \"${description}\" environment..."
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets unset
unloadProjectShell = pkgs.writers.writeFish "unload-shell.fish" ''
echo "Unloading \"${description}\" environment..."
${builtins.concatStringsSep "\n" (lib.mapAttrsToList eraseAbbr abbrs)}
'';
${builtins.concatStringsSep "\n" (lib.mapAttrsToList eraseAbbr abbrs)}
'';
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets set
initProjectShell = pkgs.writers.writeFish "init-shell.fish" ''
# Unload just in case, to not have redefinition errors
source ${unloadProjectShell}
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets set
initProjectShell = pkgs.writers.writeFish "init-shell.fish" ''
# Unload just in case, to not have redefinition errors
source ${unloadProjectShell}
echo "Sourcing \"${description}\" environment..."
echo "Sourcing \"${description}\" environment..."
${builtins.concatStringsSep "\n" (lib.mapAttrsToList createAbbr abbrs)}
'';
in
${builtins.concatStringsSep "\n" (lib.mapAttrsToList createAbbr abbrs)}
'';
in
builtins.concatStringsSep "\n" [
# Launch into pure fish shell
''
@ -119,12 +114,14 @@ rec {
# ===========================================================================================
python = pkgs.python314.withPackages (
p: with p; [
setuptools
flask
flask-mysqldb
pyyaml
]
p:
with p; [
setuptools
flask
flask-mysqldb
pyyaml
tabulate
]
);
# perl = pkgs.perl.withPackages (p:
@ -166,10 +163,9 @@ rec {
pname = "wasi-sdk";
version = "29";
src =
let
baseurl = "https://github.com/WebAssembly/wasi-sdk/releases/download";
in
src = let
baseurl = "https://github.com/WebAssembly/wasi-sdk/releases/download";
in
builtins.fetchTarball {
url = "${baseurl}/${pname}-${version}/${pname}-${version}.0-x86_64-linux.tar.gz";
sha256 = "sha256:16afis71iqfvwiny4dz0lk9f7wbary0wa67ybwyhywr8g57ss6hq";
@ -199,10 +195,9 @@ rec {
pname = "iwasm";
version = "2.4.4";
src =
let
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
in
src = let
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
in
builtins.fetchTarball {
url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz";
sha256 = "sha256:05irihz3yf7hpc0a59qz9i62imhrsni9xy9nxwsn6b8s92c1yzrp";
@ -234,10 +229,9 @@ rec {
pname = "wamrc";
version = "2.4.4";
src =
let
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
in
src = let
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
in
builtins.fetchTarball {
url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz";
sha256 = "sha256:0264arh03gc35z0zdvw07qdvqgfvsxr3qgl1aszghwicmdmh4sqj";
@ -302,7 +296,7 @@ rec {
# Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime:
# - Libraries used by compilers, for example zlib
# - Interpreters needed by patchShebangs for scripts which are installed, which can be the case for e.g. perl
buildInputs = with pkgs; [ ];
buildInputs = with pkgs; [];
# ===========================================================================================
# Define buildable + installable packages
@ -357,8 +351,7 @@ rec {
runHook postInstall
'';
};
in
{
in {
# Provide package for "nix build"
packages = {
default = fail-bin;
@ -368,7 +361,7 @@ rec {
wamrc = wamrc;
};
apps = {
default = flake-utils.lib.mkApp { drv = fail-bin; };
default = flake-utils.lib.mkApp {drv = fail-bin;};
fail = fail-bin;
wasi-sdk = wasi-sdk;
iwasm = iwasm;
@ -391,6 +384,7 @@ rec {
# Those are read by compile.pl / build.pl
FAIL_SHARE = "${fail-bin}/share";
FAIL_PYTHON = "${python}/bin/python";
WASI_ROOT = wasi-sdk;
WAMR_ROOT = "/home/christoph/Notes/TU/MastersThesis/FailNix/wamr";
CROSS_CC = "${i386_pkgs.stdenv.cc}/bin/i386-elf-gcc";

View File

@ -0,0 +1,71 @@
package Modules::Filters;
use strict;
use warnings;
use diagnostics;
use FindBin;
use lib $FindBin::Bin;
use Util;
my %CONFIGS = (
no_aot => {
label => "Exclude WAMR AOT array",
regions => [ [ '_wamr_aot_start', '_wamr_aot_end' ] ],
},
no_mmap => {
label => "Exclude WAMR mmap",
regions => [ [ '_wamr_mmap_start', '_wamr_mmap_end' ] ],
},
no_runtime_pool => {
label => "Exclude WAMR runtime pool",
regions => [ [ '_wamr_runtime_pool_start', '_wamr_runtime_pool_end' ] ],
},
no_linear_pool => {
label => "Exclude WAMR linear pool",
regions => [ [ '_wamr_linear_pool_start', '_wamr_linear_pool_end' ] ],
},
no_global_heap => {
label => "Exclude WAMR global heap",
regions => [ [ '_wamr_global_heap_start', '_wamr_global_heap_end' ] ],
},
);
# Those will be executed automatically by runner.pl (+ no filter at all)
my @DEFAULT_CONFIGS = ('no_aot');
sub get_configs {
return \%CONFIGS;
}
sub get_default_configs {
return @DEFAULT_CONFIGS;
}
sub build_filter_clause {
my ( $experiment_dir, $config_name ) = @_;
return "" unless defined $config_name && length($config_name) > 0;
my $regions = $CONFIGS{$config_name}{regions};
return "" unless defined $regions;
return ""
unless defined $experiment_dir && -f "$experiment_dir/system.elf";
my @filters;
for my $pair (@$regions) {
my ( $start_sym, $end_sym ) = @$pair;
my $start =
Util::elf_sym_addr( "$experiment_dir/system.elf", $start_sym );
my $end = Util::elf_sym_addr( "$experiment_dir/system.elf", $end_sym );
next unless defined $start && defined $end && $end > $start;
push @filters,
"p.injection_instr_absolute NOT BETWEEN $start AND @{[$end - 1]}";
}
return "" unless @filters;
return "\nAND " . join( "\nAND ", @filters );
}
1;

View File

@ -126,7 +126,9 @@ sub find_subdirs {
}
sub execute_query {
my ( $experiment, $queryname, $db_conf, $builds_dir, $do_notify_file ) = @_;
my ( $experiment, $queryname, $db_conf, $builds_dir, $do_notify_file,
$filter_config_name )
= @_;
my $module = "Queries::$queryname";
my $file = "$module.pm";
@ -140,9 +142,10 @@ sub execute_query {
my $postprocess = $module->can('postprocess')
or die "$module can't postprocess()";
my $querystring = $query->($experiment);
my $querystring =
$query->( $experiment, "$builds_dir/$experiment", $filter_config_name );
my $argsstring = $args->();
my $filenamestring = $filename->();
my $filenamestring = $filename->($filter_config_name);
# TODO: Pass the values instead of rewriting db.conf.
# Can also use DBI's database handle directly.
@ -171,6 +174,13 @@ sub format_number_sep {
return $number;
}
sub elf_sym_addr {
my ($elffile, $sym) = @_;
my $line = qx{nm "$elffile" 2>/dev/null | grep " $sym\$"};
return undef unless $line =~ /^([0-9a-f]+)/i;
return hex($1);
}
sub elf_read_sections {
my ($elffile) = @_;

View File

@ -4,10 +4,21 @@ use strict;
use warnings;
use diagnostics;
sub query {
my ($experiment) = @_;
use FindBin;
use lib "$FindBin::Bin/..";
use lib "$FindBin::Bin/../Modules";
use Modules::Filters;
return "SELECT
use feature 'say';
sub query {
my ( $experiment, $experiment_dir, $filter_config_name ) = @_;
$filter_config_name //= '';
my $filters = Modules::Filters::build_filter_clause( $experiment_dir,
$filter_config_name );
my $querystring = "SELECT
benchmark, resulttype, SUM(t.time2 - t.time1 + 1) AS faults,
CONCAT('0x', HEX(p.injection_instr_absolute)) AS fault_address
FROM variant v
@ -15,14 +26,23 @@ JOIN trace t ON v.id = t.variant_id
JOIN fspgroup g ON g.variant_id = t.variant_id AND g.instr2 = t.instr2 AND g.data_physical_address = t.data_physical_address
JOIN result_GenericExperimentMessage r ON r.pilot_id = g.pilot_id
JOIN fsppilot p ON r.pilot_id = p.id
WHERE v.variant = '$experiment'
WHERE v.variant = '$experiment'$filters
GROUP BY benchmark, resulttype, p.injection_instr_absolute
ORDER BY benchmark, resulttype, SUM(t.time2 - t.time1 + 1) DESC;";
say $querystring;
return $querystring;
}
sub args { return "--batch --raw"; }
sub filename { return "faults.csv"; }
sub filename {
my ($filter_config_name) = @_;
$filter_config_name //= '';
my $suffix = length($filter_config_name) ? "_$filter_config_name" : "";
return "faults${suffix}.csv";
}
sub postprocess { $_[0] =~ s/\t/,/g; }

View File

@ -4,24 +4,44 @@ use strict;
use warnings;
use diagnostics;
sub query {
my ($experiment) = @_;
use FindBin;
use lib "$FindBin::Bin/..";
use lib "$FindBin::Bin/../Modules";
use Modules::Filters;
return "SELECT
use feature 'say';
sub query {
my ( $experiment, $experiment_dir, $filter_config_name ) = @_;
$filter_config_name //= '';
my $extra = Modules::Filters::build_filter_clause( $experiment_dir,
$filter_config_name );
my $querystring = "SELECT
benchmark, resulttype, sum(t.time2 - t.time1 + 1) AS faults
FROM variant v
JOIN trace t ON v.id = t.variant_id
JOIN fspgroup g ON g.variant_id = t.variant_id AND g.instr2 = t.instr2 AND g.data_physical_address = t.data_physical_address
JOIN result_GenericExperimentMessage r ON r.pilot_id = g.pilot_id
JOIN fsppilot p ON r.pilot_id = p.id
WHERE v.variant = '$experiment'
WHERE v.variant = '$experiment'$extra
GROUP BY v.id, resulttype
ORDER BY variant, benchmark, resulttype;";
say $querystring;
return $querystring;
}
sub args { return "-t"; }
sub filename { return "results.txt"; }
sub filename {
my ($filter_config_name) = @_;
$filter_config_name //= '';
my $suffix = length($filter_config_name) ? "_filtered_$filter_config_name" : "";
return "results${suffix}.txt";
}
sub postprocess { }

View File

@ -4,24 +4,44 @@ use strict;
use warnings;
use diagnostics;
sub query {
my ($experiment) = @_;
use FindBin;
use lib "$FindBin::Bin/..";
use lib "$FindBin::Bin/../Modules";
use Modules::Filters;
return "SELECT
use feature 'say';
sub query {
my ( $experiment, $experiment_dir, $filter_config_name ) = @_;
$filter_config_name //= '';
my $extra = Modules::Filters::build_filter_clause( $experiment_dir,
$filter_config_name );
my $querystring = "SELECT
benchmark, resulttype, sum(t.time2 - t.time1 + 1) AS faults
FROM variant v
JOIN trace t ON v.id = t.variant_id
JOIN fspgroup g ON g.variant_id = t.variant_id AND g.instr2 = t.instr2 AND g.data_physical_address = t.data_physical_address
JOIN result_GenericExperimentMessage r ON r.pilot_id = g.pilot_id
JOIN fsppilot p ON r.pilot_id = p.id
WHERE v.variant = '$experiment'
WHERE v.variant = '$experiment'$extra
GROUP BY v.id, resulttype
ORDER BY variant, benchmark, resulttype;";
say $querystring;
return $querystring;
}
sub args { return "--batch --raw"; }
sub filename { return "resultsdata.csv"; }
sub filename {
my ($filter_config_name) = @_;
$filter_config_name //= '';
my $suffix = length($filter_config_name) ? "_filtered_$filter_config_name" : "";
return "resultsdata${suffix}.csv";
}
sub postprocess { $_[0] =~ s/\t/,/g; }

View File

@ -147,7 +147,7 @@ make_heatmap <- function(target_resulttype, target_benchmark) {
}
aggregated <- filtered |>
select(.data$fault_address, .data$faults)
select(fault_address, faults)
# ===========================================================================
# ADDRESS HEX -> INT
@ -386,7 +386,7 @@ make_heatmap <- function(target_resulttype, target_benchmark) {
xmin = -0.5,
xmax = row_width - 0.5,
fill = NA,
linewidth = 1.0,
linewidth = 1.5,
inherit.aes = FALSE
) +
scale_colour_brewer(name = "Region", palette = "Dark2")

View File

@ -11,6 +11,7 @@ use lib "$FindBin::Bin/Modules";
use Util;
use Mars;
use TUI;
use Modules::Filters;
use Text::CSV_XS;
use feature 'say';
@ -85,15 +86,43 @@ my %handlers = (
TUI::select_from_list( "Select Queries to Run", 1, @queries );
die "No query selected" unless @selected_queries;
# Select filter configs
my @filter_choices = ("None");
my %filter_label_name;
my @filter_configs;
my $configs = Modules::Filters::get_configs();
foreach my $name ( sort keys %$configs ) {
my $label = $configs->{$name}{label};
push @filter_choices, $label;
$filter_label_name{$label} = $name;
}
my @selected_filter_labels =
TUI::select_from_list( "Select Filters to Apply", 1,
@filter_choices );
die "No filter selected" unless @selected_filter_labels;
@filter_configs = ();
foreach my $label (@selected_filter_labels) {
if ( $label eq "None" ) {
push @filter_configs, '';
}
else {
push @filter_configs, $filter_label_name{$label};
}
}
# Run queries on databases
foreach my $db (@selected_dbs) {
foreach my $query (@selected_queries) {
Util::rewrite_file( $local_db_conf, "database=",
"database=$db\n" );
foreach my $config (@filter_configs) {
Util::rewrite_file( $local_db_conf, "database=",
"database=$db\n" );
say "Running $query on $db...";
Util::execute_query( $db =~ s/smchurla_//r,
$query, $local_db_conf, $local_archive_dir, 0 );
my $config_label = length($config) ? " ($config)" : "";
say "Running $query$config_label on $db...";
Util::execute_query( $db =~ s/smchurla_//r,
$query, $local_db_conf, $local_archive_dir, 0,
$config );
}
}
}
},

View File

@ -6,10 +6,10 @@ use diagnostics;
use FindBin;
use lib $FindBin::Bin;
use lib "$FindBin::Bin/../../scripts";
use lib "$FindBin::Bin/../../scripts/Modules";
use lib "$FindBin::Bin/Modules";
use Util;
use Modules::Filters;
use Modules::Util;
use feature 'say';
@ -209,9 +209,10 @@ sub inject {
# Read catch flags written by build.pl into the experiment directory
my $runner_flags_file = "$remote_builds_dir/$experiment/runner_flags";
my @catch_flags = ();
my @catch_flags = ();
if ( -e $runner_flags_file ) {
open( my $rfh, '<', $runner_flags_file ) or die "Cannot open $runner_flags_file: $!";
open( my $rfh, '<', $runner_flags_file )
or die "Cannot open $runner_flags_file: $!";
@catch_flags = map { chomp; "-Wf,$_" } grep { /\S/ } <$rfh>;
close($rfh);
}
@ -272,16 +273,15 @@ sub inject {
sub results {
my ($experiment) = @_;
my @queries = Util::find_files("$remote_root/scripts/Queries");
my @queries =
map { s/\.pm//gr } Util::find_files("$remote_root/scripts/Queries");
my @configs = ( '', Modules::Filters::get_default_configs() );
foreach (@queries) {
my $query = $_;
$query =~ s/\.pm//g;
# Util::notify("Running query $query for $experiment...");
Util::execute_query( $experiment, $query,
$remote_db_conf, $remote_builds_dir, 1 );
for my $query (@queries) {
for my $config (@configs) {
Util::execute_query( $experiment, $query,
$remote_db_conf, $remote_builds_dir, 1, $config );
}
}
}

1
tacle-converter Submodule

Submodule tacle-converter added at ff9c74cae5

View File

@ -0,0 +1,27 @@
# ~~~
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2026, Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU)
# ~~~
cmake_minimum_required(VERSION 3.20)
project(lift)
set(TACLEBENCH_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../..")
set(REPOSITORY_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
set(APP_TARGET_NAME "${CMAKE_PROJECT_NAME}")
if(DEFINED TACLEBENCH_VARIANT AND "${TACLEBENCH_VARIANT}" STREQUAL "inline")
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/inline/lift.c")
else()
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/default/lift.c"
"generated/modified_sources/default/liftlibcontrol.c"
"generated/modified_sources/default/liftlibio.c")
endif()
include(${REPOSITORY_ROOT_PATH}/cmake/taclebench_wasm.cmake)

View File

@ -0,0 +1,31 @@
Lift Controller
===============
This is a port of Martin Schoeberl's Lift Controller [1] to C. The orignal
version is an embedded Java program that controls a lift in a factory in Turkey.
Benedikt Huber has ported the controller to C and Lucid [3]. It has been used in
various research projects, including T-CREST[3] and the F-Shell test generator
[4].
Overview
--------
The sensors of the system consist of several buttons, a load sensor (to detect
if the lift is positioned at the load), sensors to detect bottom and top
position, and an index sensor for the motor. The motor is controlled using two
digital outputs, one for its direction and one to turn it off or on.
The controller itself consists of an initialization routine ctrl_init(), the
controller step ctrl_loop(), which should be invoked every 10ms. Outside a test
environment, ctrl_get_vals() should be called to read sensors before the
controller runs, and ctrl_set_vals() should be called to set actuators after the
controller ran.
The digital IO interface (9 digital inputs, 2 digital outputs and 14 LEDs are
used) is realized as global volatile variables (simio_in, simio_out, simio_led),
that can be modified and read by test drivers or by the runtime environment.
[1] http://www.jopdesign.com/doc/jembench.pdf
[2] https://github.com/visq/99lifts
[3] http://www.t-crest.org
[4] http://forsyte.at/software/fshell/

View File

@ -0,0 +1,46 @@
File: duff.c
Original provenience: Lift Controller, see README file
2015-12-21:
- replaced defines, introduced 4 enums to replace #define statements
(enum Direction, Sensor, Motor, Command)
- renamed libs to fit general naming scheme: lift_io -> liftio
- benchmark consisted of two benchmarks, test_lift and run_lift,
only run_lift remains, i.e., test_lift.data.c/h and test_lift.c removed.
- Makefile removed, file can now be compiled using 'gcc lift.c'
- 'uint16_t' replaced by 'unsigned short int' to get rid of 'stdint.h;
- changed LEVEL_POS_LENGTH from 14 to 16 (16 values were initialized).
- added an additional global variable 'int checksum'
- added function pre-fix 'lift_' to each function
- added function int lift_return() returning the checksum and lift_init()
- global variable checksum filled in function 'lift_ctrl_set_vals()'
and initialized to 0 in 'lift_init()'
- Added forward declarations of all functions before the declarations of global
variables
- in function lift_main, explicit initialization 'int i = 0' added.
- Re-ordered functions to fit template-order
- Applied code formatting according to the following rules
(incomplete, to be discussed; I basically used astyle with the attached
options file):
- Lines shall not be wider than 80 characters; whenever possible, appropriate
line breaks shall be inserted to keep lines below 80 characters
- Indentation is done using whitespaces only, no tabs. Code is indented by
two whitespaces
- Two empty lines are put between any two functions
- In non-empty lists or index expressions, opening '(' and '[' are followed by
one whitespace, closing ')' and ']' are preceded by one whitespace
- In comma- or colon-separated argument lists, one whitespace is put after
each comma/colon
- Names of functions and global variables all start with a benchmark-specific
prefix (here: st_) followed by lowercase letter (e.g., st_square)
- For pointer types, one whitespace is put before the '*'
- Operators within expressions shall be preceded and followed by one
whitespace
- Code of then- and else-parts of if-then-else statements shall be put in
separate lines, not in the same lines as the if-condition or the keyword
"else"
- Opening braces '{' denoting the beginning of code for some if-else or loop
body shall be put at the end of the same line where the keywords "if",
"else", "for", "while" etc. occur
- Added general TACLeBench header to beginning of source code

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: lift
Author: Martin Schoeberl, Benedikt Huber
Function: Lift Controler
Source: C-Port from http://www.jopdesign.com/doc/jembench.pdf
Original name: run_lift.c
Changes: no major functional changes
License: GPL version 3 or later
*/
/*
Include section
*/
#include "liftlibcontrol.h"
#include "liftlibio.h"
/*
Forward declaration of functions
*/
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
void lift_controller();
void lift_init();
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
lift_main();
int lift_return();
/*
Declaration of global variables
*/
int lift_checksum; /* Checksum */
/*
Initialization- and return-value-related functions
*/
void
lift_init() {
unsigned int i;
unsigned char *p;
volatile char bitmask = 0;
/*
Apply volatile XOR-bitmask to entire input array.
*/
p = (unsigned char *) &lift_ctrl_io_in[0];
__pragma_loopbound(40, 40);
for (i = 0; i < sizeof(lift_ctrl_io_in); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &lift_ctrl_io_out[0];
__pragma_loopbound(16, 16);
for (i = 0; i < sizeof(lift_ctrl_io_out); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &lift_ctrl_io_analog[0];
__pragma_loopbound(16, 16);
for (i = 0; i < sizeof(lift_ctrl_io_analog); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &lift_ctrl_io_led[0];
__pragma_loopbound(64, 64);
for (i = 0; i < sizeof(lift_ctrl_io_led); ++i, ++p)
*p ^= bitmask;
lift_checksum = 0;
lift_ctrl_init();
}
int
lift_return() {
return (lift_checksum - 4005888 != 0);
}
/*
Algorithm core functions
*/
void
lift_controller() {
lift_ctrl_get_vals();
lift_ctrl_loop();
lift_ctrl_set_vals();
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
lift_main() {
int i = 0;
__pragma_loopbound(1001, 1001);
while (1) {
/* zero input stimulus */
lift_simio_in = 0;
lift_simio_adc1 = 0;
lift_simio_adc2 = 0;
lift_simio_adc3 = 0;
/* run lift_controller */
lift_controller();
if (i++ >= 1000)
break;
}
}
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
lift_init();
lift_main();
return (lift_return());
}

View File

@ -0,0 +1,267 @@
#include "liftlibcontrol.h"
#include "liftlibio.h"
/* Global variables */
int lift_levelPos[16];
int lift_one_level;
/**
Is the counter valid for level positioning?
*/
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
int lift_cntValid;
/**
Position absolute or relative<.
*/
int lift_cnt;
/**
Last stoped level (1..13) if position is absolute else 0.
*/
int lift_level;
/**
load position in level, 0 means we don't know
*/
int lift_loadLevel;
/**
we're going TOP or BOTTOM, but stop at load position.
*/
int lift_loadPending;
/**
we're waiting for the load sensor to go.
*/
int lift_loadSensor;
/**
cmd keeps the value of the command until the command is finished.
It is only updated by the switches if it's current value is CMD_NONE.
*/
int lift_cmd;
int lift_timMotor;
int lift_timImp;
/**
Remember last direction for impuls count after motor off;
*/
int lift_directionUp;
/**
Last value of impuls sensor.
*/
int lift_lastImp;
int lift_dbgCnt;
/**
stop value for the counter.
*/
int lift_endCnt;
void
lift_ctrl_init() {
int i;
lift_checksum = 0;
lift_io_init();
lift_cntValid = 0;
lift_cnt = 0;
lift_cmd = lift_CMD_NONE;
lift_timMotor = 0;
lift_timImp = 0;
lift_directionUp = 1;
lift_lastImp = 0;
lift_loadLevel = 0;
lift_loadPending = 0;
lift_loadSensor = 0;
i = 0;
lift_levelPos[i++] = 0;
lift_levelPos[i++] = 58;
lift_levelPos[i++] = 115;
lift_levelPos[i++] = 173;
lift_levelPos[i++] = 230;
lift_levelPos[i++] = 288;
lift_levelPos[i++] = 346;
lift_levelPos[i++] = 403;
lift_levelPos[i++] = 461;
lift_levelPos[i++] = 518;
lift_levelPos[i++] = 576;
lift_levelPos[i++] = 634;
lift_levelPos[i++] = 691;
lift_levelPos[i++] = 749;
lift_levelPos[i++] = 806;
lift_levelPos[i++] = 864;
lift_one_level = lift_levelPos[1];
}
void
lift_ctrl_loop() {
if (lift_cmd == lift_CMD_NONE)
lift_check_cmd();
else {
lift_do_impulse(lift_ctrl_io_in[lift_SENS_IMPULS],
lift_ctrl_io_out[lift_MOTOR_ON],
lift_ctrl_io_in[lift_SENS_BOTTOM]);
lift_do_cmd();
}
lift_check_level();
lift_ctrl_io_led[13] = (lift_dbgCnt & 0x80) != 0;
++lift_dbgCnt;
}
void
lift_check_level() {
int i;
int middle = lift_one_level >> 2;
if (lift_cntValid) {
__pragma_loopbound(14, 14);
for (lift_level = 1; lift_level < 14; ++lift_level) {
if (lift_cnt < lift_levelPos[lift_level] - middle)
break;
}
} else
lift_level = 0;
__pragma_loopbound(14, 14);
for (i = 0; i < 14; ++i)
lift_ctrl_io_led[i] = (i == lift_level - 1);
}
void
lift_check_cmd() {
if (lift_loadPending) {
if (lift_ctrl_io_in[lift_SENS_BOTTOM])
lift_cmd = lift_CMD_TOP;
} else if (lift_ctrl_io_in[lift_GO_UP]) {
if (!lift_ctrl_io_in[lift_SENS_TOP] && lift_level != 14)
lift_cmd = lift_CMD_UP;
} else if (lift_ctrl_io_in[lift_GO_DOWN]) {
if (!lift_ctrl_io_in[lift_SENS_BOTTOM] && lift_level != 1)
lift_cmd = lift_CMD_DOWN;
} else if (lift_ctrl_io_in[lift_GO_LOAD]) {
if (lift_loadLevel != 0 && lift_level < lift_loadLevel)
lift_cmd = lift_CMD_TOP;
else
lift_cmd = lift_CMD_BOTTOM;
lift_loadPending = 1;
lift_loadSensor = 0;
} else if (lift_ctrl_io_in[lift_GO_TOP]) {
if (!lift_ctrl_io_in[lift_SENS_TOP])
lift_cmd = lift_CMD_TOP;
} else if (lift_ctrl_io_in[lift_GO_BOTTOM]) {
if (!lift_ctrl_io_in[lift_SENS_BOTTOM])
lift_cmd = lift_CMD_BOTTOM;
}
if (lift_cmd != lift_CMD_NONE)
lift_timMotor = 50;
}
void
lift_do_impulse(int val, int motor, int reset) {
if (val && !lift_lastImp) {
if (motor || lift_timImp > 0) {
if (lift_directionUp)
++lift_cnt;
else
--lift_cnt;
}
}
if (reset) {
lift_cnt = 0;
lift_cntValid = 1;
}
lift_lastImp = val;
if (lift_timImp > 0) {
--lift_timImp;
if (lift_timImp == 0 && lift_cmd != lift_CMD_NONE)
lift_cmd = lift_CMD_NONE;
}
}
void
lift_do_cmd() {
int run = 0;
if (lift_timMotor > 0)
lift_wait_for_motor_start();
else {
run = lift_check_run();
if (lift_ctrl_io_out[lift_MOTOR_ON] && !run) {
/* motor stopped: */
lift_cmd = 99;
lift_timImp = 50;
}
lift_ctrl_io_out[lift_MOTOR_ON] = run;
}
}
void
lift_wait_for_motor_start() {
int newLevel = 0;
--lift_timMotor;
lift_directionUp = (lift_cmd == lift_CMD_UP || lift_cmd == lift_CMD_TOP);
lift_ctrl_io_out[lift_MOTOR_UP] = lift_directionUp;
if (!lift_cntValid) {
lift_cnt = 0; /* use relative counter */
if (lift_cmd == lift_CMD_UP)
lift_endCnt = lift_one_level;
else
lift_endCnt = -lift_one_level;
} else {
lift_endCnt = lift_cnt;
newLevel = -99;
if (lift_cmd == lift_CMD_UP)
newLevel = lift_level + 1;
else if (lift_cmd == lift_CMD_DOWN)
newLevel = lift_level - 1;
--newLevel; /* lift_level is one based */
if (newLevel >= 0 && newLevel < 14)
lift_endCnt = lift_levelPos[newLevel];
}
}
int
lift_check_run() {
if (lift_cmd == lift_CMD_UP) {
if (lift_cnt < lift_endCnt - 1 && !lift_ctrl_io_in[lift_SENS_TOP])
return 1;
} else if (lift_cmd == lift_CMD_DOWN) {
if (lift_cnt > lift_endCnt + 1 && !lift_ctrl_io_in[lift_SENS_BOTTOM])
return 1;
} else if (lift_cmd == lift_CMD_TOP) {
if (lift_loadPending && lift_ctrl_io_in[lift_SENS_LOAD]) {
/* we are at lift_load position */
lift_loadLevel = lift_level;
lift_loadPending = 0;
return 0;
}
if (!lift_ctrl_io_in[lift_SENS_TOP])
return 1;
/* safe fallback if lift_load sensor does not work */
lift_loadPending = 0;
} else if (lift_cmd == lift_CMD_BOTTOM) {
if (lift_loadPending) {
if (lift_loadSensor) {
if (!lift_ctrl_io_in[lift_SENS_LOAD]) {
lift_loadSensor = 0;
/* we are at lift_load position */
lift_loadPending = 0;
lift_loadLevel = lift_level;
return 0;
}
}
lift_loadSensor = lift_ctrl_io_in[lift_SENS_LOAD];
}
if (!lift_ctrl_io_in[lift_SENS_BOTTOM])
return 1;
}
return 0;
}

View File

@ -0,0 +1,62 @@
#ifndef LIFTLIBCONTROL_H
#define LIFTLIBCONTROL_H
enum lift_Direction {
lift_GO_LOAD = 8,
lift_GO_TOP = 6,
lift_GO_BOTTOM = 7,
lift_GO_UP = 4,
lift_GO_DOWN = 5
};
enum lift_Sensor {
lift_SENS_IMPULS = 0,
lift_SENS_TOP = 1,
lift_SENS_BOTTOM = 2,
lift_SENS_LOAD = 3
};
enum lift_Motor { lift_MOTOR_ON = 0, lift_MOTOR_UP = 1 };
enum lift_Command {
lift_CMD_NONE = 0,
lift_CMD_TOP = 1,
lift_CMD_BOTTOM = 2,
lift_CMD_UP = 3,
lift_CMD_DOWN = 4
};
/* Global variables */
extern int lift_levelPos[16];
extern int lift_one_level;
extern int lift_cntValid;
extern int lift_cnt;
extern int lift_level;
extern int lift_loadLevel;
extern int lift_loadPending;
extern int lift_loadSensor;
extern int lift_cmd;
extern int lift_timMotor;
extern int lift_timImp;
extern int lift_directionUp;
extern int lift_lastImp;
extern int lift_dbgCnt;
extern int lift_endCnt;
/* Checksum */
extern int lift_checksum;
/* prototypes */
void lift_ctrl_init();
void lift_ctrl_loop();
/* internal prototypes */
int lift_check_run();
void lift_wait_for_motor_start();
void lift_do_cmd();
void lift_do_impulse(int val, int motor, int reset);
void lift_check_cmd();
void lift_check_level();
#endif

View File

@ -0,0 +1,69 @@
#include "liftlibio.h"
/* Global variables */
int lift_ctrl_io_in[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int lift_ctrl_io_out[4] = {0, 0, 0, 0};
int lift_ctrl_io_analog[4] = {0, 0, 0, 0};
int lift_ctrl_io_led[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int lift_ctrl_dly1;
int lift_ctrl_dly2;
/* Simulated hardware */
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
volatile int lift_simio_in;
volatile int lift_simio_out;
volatile int lift_simio_led;
volatile int lift_simio_adc1;
volatile int lift_simio_adc2;
volatile int lift_simio_adc3;
void
lift_io_init() {
lift_ctrl_dly1 = 0;
lift_ctrl_dly2 = 0;
}
void
lift_ctrl_set_vals() {
int val = 0, i;
__pragma_loopbound(4, 4);
for (i = 4 - 1; i >= 0; --i) {
val <<= 1;
val |= lift_ctrl_io_out[i] ? 1 : 0;
}
lift_simio_out = val;
__pragma_loopbound(14, 14);
for (i = 14 - 1; i >= 0; --i) {
val <<= 1;
val |= lift_ctrl_io_led[i] ? 1 : 0;
}
lift_simio_led = val;
lift_checksum += val;
}
void
lift_ctrl_get_vals() {
int i;
unsigned short int in0 = lift_simio_in;
unsigned short int in1 = lift_ctrl_dly1;
unsigned short int in2 = lift_ctrl_dly2;
lift_ctrl_dly2 = lift_ctrl_dly1;
lift_ctrl_dly1 = in0;
/* majority voting for input values
delays input value change by one period */
__pragma_loopbound(10, 10);
for (i = 0; i < 10; ++i) {
lift_ctrl_io_in[i] = ((in0 & 1) + (in1 & 1) + (in2 & 1)) > 1;
in0 >>= 1;
in1 >>= 1;
in2 >>= 1;
}
lift_ctrl_io_analog[0] = lift_simio_adc1;
lift_ctrl_io_analog[1] = lift_simio_adc2;
lift_ctrl_io_analog[2] = lift_simio_adc3;
}

View File

@ -0,0 +1,28 @@
#ifndef LIFTLIBIO_H
#define LIFTLIBIO_H
/* Global variables */
extern int lift_ctrl_io_in[10];
extern int lift_ctrl_io_out[4];
extern int lift_ctrl_io_analog[4];
extern int lift_ctrl_io_led[16];
extern int lift_ctrl_dly1, lift_ctrl_dly2;
/* Simulated hardware */
extern volatile int lift_simio_in;
extern volatile int lift_simio_out;
extern volatile int lift_simio_led;
extern volatile int lift_simio_adc1;
extern volatile int lift_simio_adc2;
extern volatile int lift_simio_adc3;
/* Checksum */
extern int lift_checksum;
/* prototypes */
void lift_io_init(void);
void lift_ctrl_get_vals(void);
void lift_ctrl_set_vals(void);
#endif

View File

@ -0,0 +1,138 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: lift
Author: Martin Schoeberl, Benedikt Huber
Function: Lift Controler
Source: C-Port from http://www.jopdesign.com/doc/jembench.pdf
Original name: run_lift.c
Changes: no major functional changes
License: GPL version 3 or later
*/
/*
Include section
*/
#include "liftlibcontrol.h"
#include "liftlibio.h"
/*
Forward declaration of functions
*/
// Wasm loop bounds
#include "liftlibcontrol.c"
#include "liftlibio.c"
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
__attribute__((always_inline)) static inline void lift_controller();
__attribute__((always_inline)) static inline void lift_init();
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
lift_main();
__attribute__((always_inline)) static inline int lift_return();
/*
Declaration of global variables
*/
int lift_checksum; /* Checksum */
/*
Initialization- and return-value-related functions
*/
__attribute__((always_inline)) static inline void
lift_init() {
unsigned int i;
unsigned char *p;
volatile char bitmask = 0;
/*
Apply volatile XOR-bitmask to entire input array.
*/
p = (unsigned char *) &lift_ctrl_io_in[0];
__pragma_loopbound(40, 40);
for (i = 0; i < sizeof(lift_ctrl_io_in); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &lift_ctrl_io_out[0];
__pragma_loopbound(16, 16);
for (i = 0; i < sizeof(lift_ctrl_io_out); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &lift_ctrl_io_analog[0];
__pragma_loopbound(16, 16);
for (i = 0; i < sizeof(lift_ctrl_io_analog); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &lift_ctrl_io_led[0];
__pragma_loopbound(64, 64);
for (i = 0; i < sizeof(lift_ctrl_io_led); ++i, ++p)
*p ^= bitmask;
lift_checksum = 0;
lift_ctrl_init();
}
__attribute__((always_inline)) static inline int
lift_return() {
return (lift_checksum - 4005888 != 0);
}
/*
Algorithm core functions
*/
__attribute__((always_inline)) static inline void
lift_controller() {
lift_ctrl_get_vals();
lift_ctrl_loop();
lift_ctrl_set_vals();
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
lift_main() {
int i = 0;
__pragma_loopbound(1001, 1001);
while (1) {
/* zero input stimulus */
lift_simio_in = 0;
lift_simio_adc1 = 0;
lift_simio_adc2 = 0;
lift_simio_adc3 = 0;
/* run lift_controller */
lift_controller();
if (i++ >= 1000)
break;
}
}
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
lift_init();
lift_main();
return (lift_return());
}

View File

@ -0,0 +1,267 @@
#include "liftlibcontrol.h"
#include "liftlibio.h"
/* Global variables */
int lift_levelPos[16];
int lift_one_level;
/**
Is the counter valid for level positioning?
*/
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
int lift_cntValid;
/**
Position absolute or relative<.
*/
int lift_cnt;
/**
Last stoped level (1..13) if position is absolute else 0.
*/
int lift_level;
/**
load position in level, 0 means we don't know
*/
int lift_loadLevel;
/**
we're going TOP or BOTTOM, but stop at load position.
*/
int lift_loadPending;
/**
we're waiting for the load sensor to go.
*/
int lift_loadSensor;
/**
cmd keeps the value of the command until the command is finished.
It is only updated by the switches if it's current value is CMD_NONE.
*/
int lift_cmd;
int lift_timMotor;
int lift_timImp;
/**
Remember last direction for impuls count after motor off;
*/
int lift_directionUp;
/**
Last value of impuls sensor.
*/
int lift_lastImp;
int lift_dbgCnt;
/**
stop value for the counter.
*/
int lift_endCnt;
__attribute__((always_inline)) static inline void
lift_ctrl_init() {
int i;
lift_checksum = 0;
lift_io_init();
lift_cntValid = 0;
lift_cnt = 0;
lift_cmd = lift_CMD_NONE;
lift_timMotor = 0;
lift_timImp = 0;
lift_directionUp = 1;
lift_lastImp = 0;
lift_loadLevel = 0;
lift_loadPending = 0;
lift_loadSensor = 0;
i = 0;
lift_levelPos[i++] = 0;
lift_levelPos[i++] = 58;
lift_levelPos[i++] = 115;
lift_levelPos[i++] = 173;
lift_levelPos[i++] = 230;
lift_levelPos[i++] = 288;
lift_levelPos[i++] = 346;
lift_levelPos[i++] = 403;
lift_levelPos[i++] = 461;
lift_levelPos[i++] = 518;
lift_levelPos[i++] = 576;
lift_levelPos[i++] = 634;
lift_levelPos[i++] = 691;
lift_levelPos[i++] = 749;
lift_levelPos[i++] = 806;
lift_levelPos[i++] = 864;
lift_one_level = lift_levelPos[1];
}
__attribute__((always_inline)) static inline void
lift_ctrl_loop() {
if (lift_cmd == lift_CMD_NONE)
lift_check_cmd();
else {
lift_do_impulse(lift_ctrl_io_in[lift_SENS_IMPULS],
lift_ctrl_io_out[lift_MOTOR_ON],
lift_ctrl_io_in[lift_SENS_BOTTOM]);
lift_do_cmd();
}
lift_check_level();
lift_ctrl_io_led[13] = (lift_dbgCnt & 0x80) != 0;
++lift_dbgCnt;
}
__attribute__((always_inline)) static inline void
lift_check_level() {
int i;
int middle = lift_one_level >> 2;
if (lift_cntValid) {
__pragma_loopbound(14, 14);
for (lift_level = 1; lift_level < 14; ++lift_level) {
if (lift_cnt < lift_levelPos[lift_level] - middle)
break;
}
} else
lift_level = 0;
__pragma_loopbound(14, 14);
for (i = 0; i < 14; ++i)
lift_ctrl_io_led[i] = (i == lift_level - 1);
}
__attribute__((always_inline)) static inline void
lift_check_cmd() {
if (lift_loadPending) {
if (lift_ctrl_io_in[lift_SENS_BOTTOM])
lift_cmd = lift_CMD_TOP;
} else if (lift_ctrl_io_in[lift_GO_UP]) {
if (!lift_ctrl_io_in[lift_SENS_TOP] && lift_level != 14)
lift_cmd = lift_CMD_UP;
} else if (lift_ctrl_io_in[lift_GO_DOWN]) {
if (!lift_ctrl_io_in[lift_SENS_BOTTOM] && lift_level != 1)
lift_cmd = lift_CMD_DOWN;
} else if (lift_ctrl_io_in[lift_GO_LOAD]) {
if (lift_loadLevel != 0 && lift_level < lift_loadLevel)
lift_cmd = lift_CMD_TOP;
else
lift_cmd = lift_CMD_BOTTOM;
lift_loadPending = 1;
lift_loadSensor = 0;
} else if (lift_ctrl_io_in[lift_GO_TOP]) {
if (!lift_ctrl_io_in[lift_SENS_TOP])
lift_cmd = lift_CMD_TOP;
} else if (lift_ctrl_io_in[lift_GO_BOTTOM]) {
if (!lift_ctrl_io_in[lift_SENS_BOTTOM])
lift_cmd = lift_CMD_BOTTOM;
}
if (lift_cmd != lift_CMD_NONE)
lift_timMotor = 50;
}
__attribute__((always_inline)) static inline void
lift_do_impulse(int val, int motor, int reset) {
if (val && !lift_lastImp) {
if (motor || lift_timImp > 0) {
if (lift_directionUp)
++lift_cnt;
else
--lift_cnt;
}
}
if (reset) {
lift_cnt = 0;
lift_cntValid = 1;
}
lift_lastImp = val;
if (lift_timImp > 0) {
--lift_timImp;
if (lift_timImp == 0 && lift_cmd != lift_CMD_NONE)
lift_cmd = lift_CMD_NONE;
}
}
__attribute__((always_inline)) static inline void
lift_do_cmd() {
int run = 0;
if (lift_timMotor > 0)
lift_wait_for_motor_start();
else {
run = lift_check_run();
if (lift_ctrl_io_out[lift_MOTOR_ON] && !run) {
/* motor stopped: */
lift_cmd = 99;
lift_timImp = 50;
}
lift_ctrl_io_out[lift_MOTOR_ON] = run;
}
}
__attribute__((always_inline)) static inline void
lift_wait_for_motor_start() {
int newLevel = 0;
--lift_timMotor;
lift_directionUp = (lift_cmd == lift_CMD_UP || lift_cmd == lift_CMD_TOP);
lift_ctrl_io_out[lift_MOTOR_UP] = lift_directionUp;
if (!lift_cntValid) {
lift_cnt = 0; /* use relative counter */
if (lift_cmd == lift_CMD_UP)
lift_endCnt = lift_one_level;
else
lift_endCnt = -lift_one_level;
} else {
lift_endCnt = lift_cnt;
newLevel = -99;
if (lift_cmd == lift_CMD_UP)
newLevel = lift_level + 1;
else if (lift_cmd == lift_CMD_DOWN)
newLevel = lift_level - 1;
--newLevel; /* lift_level is one based */
if (newLevel >= 0 && newLevel < 14)
lift_endCnt = lift_levelPos[newLevel];
}
}
__attribute__((always_inline)) static inline int
lift_check_run() {
if (lift_cmd == lift_CMD_UP) {
if (lift_cnt < lift_endCnt - 1 && !lift_ctrl_io_in[lift_SENS_TOP])
return 1;
} else if (lift_cmd == lift_CMD_DOWN) {
if (lift_cnt > lift_endCnt + 1 && !lift_ctrl_io_in[lift_SENS_BOTTOM])
return 1;
} else if (lift_cmd == lift_CMD_TOP) {
if (lift_loadPending && lift_ctrl_io_in[lift_SENS_LOAD]) {
/* we are at lift_load position */
lift_loadLevel = lift_level;
lift_loadPending = 0;
return 0;
}
if (!lift_ctrl_io_in[lift_SENS_TOP])
return 1;
/* safe fallback if lift_load sensor does not work */
lift_loadPending = 0;
} else if (lift_cmd == lift_CMD_BOTTOM) {
if (lift_loadPending) {
if (lift_loadSensor) {
if (!lift_ctrl_io_in[lift_SENS_LOAD]) {
lift_loadSensor = 0;
/* we are at lift_load position */
lift_loadPending = 0;
lift_loadLevel = lift_level;
return 0;
}
}
lift_loadSensor = lift_ctrl_io_in[lift_SENS_LOAD];
}
if (!lift_ctrl_io_in[lift_SENS_BOTTOM])
return 1;
}
return 0;
}

View File

@ -0,0 +1,63 @@
#ifndef LIFTLIBCONTROL_H
#define LIFTLIBCONTROL_H
enum lift_Direction {
lift_GO_LOAD = 8,
lift_GO_TOP = 6,
lift_GO_BOTTOM = 7,
lift_GO_UP = 4,
lift_GO_DOWN = 5
};
enum lift_Sensor {
lift_SENS_IMPULS = 0,
lift_SENS_TOP = 1,
lift_SENS_BOTTOM = 2,
lift_SENS_LOAD = 3
};
enum lift_Motor { lift_MOTOR_ON = 0, lift_MOTOR_UP = 1 };
enum lift_Command {
lift_CMD_NONE = 0,
lift_CMD_TOP = 1,
lift_CMD_BOTTOM = 2,
lift_CMD_UP = 3,
lift_CMD_DOWN = 4
};
/* Global variables */
extern int lift_levelPos[16];
extern int lift_one_level;
extern int lift_cntValid;
extern int lift_cnt;
extern int lift_level;
extern int lift_loadLevel;
extern int lift_loadPending;
extern int lift_loadSensor;
extern int lift_cmd;
extern int lift_timMotor;
extern int lift_timImp;
extern int lift_directionUp;
extern int lift_lastImp;
extern int lift_dbgCnt;
extern int lift_endCnt;
/* Checksum */
extern int lift_checksum;
/* prototypes */
__attribute__((always_inline)) static inline void lift_ctrl_init();
__attribute__((always_inline)) static inline void lift_ctrl_loop();
/* internal prototypes */
__attribute__((always_inline)) static inline int lift_check_run();
__attribute__((always_inline)) static inline void lift_wait_for_motor_start();
__attribute__((always_inline)) static inline void lift_do_cmd();
__attribute__((always_inline)) static inline void
lift_do_impulse(int val, int motor, int reset);
__attribute__((always_inline)) static inline void lift_check_cmd();
__attribute__((always_inline)) static inline void lift_check_level();
#endif

View File

@ -0,0 +1,69 @@
#include "liftlibio.h"
/* Global variables */
int lift_ctrl_io_in[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int lift_ctrl_io_out[4] = {0, 0, 0, 0};
int lift_ctrl_io_analog[4] = {0, 0, 0, 0};
int lift_ctrl_io_led[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int lift_ctrl_dly1;
int lift_ctrl_dly2;
/* Simulated hardware */
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
volatile int lift_simio_in;
volatile int lift_simio_out;
volatile int lift_simio_led;
volatile int lift_simio_adc1;
volatile int lift_simio_adc2;
volatile int lift_simio_adc3;
__attribute__((always_inline)) static inline void
lift_io_init() {
lift_ctrl_dly1 = 0;
lift_ctrl_dly2 = 0;
}
__attribute__((always_inline)) static inline void
lift_ctrl_set_vals() {
int val = 0, i;
__pragma_loopbound(4, 4);
for (i = 4 - 1; i >= 0; --i) {
val <<= 1;
val |= lift_ctrl_io_out[i] ? 1 : 0;
}
lift_simio_out = val;
__pragma_loopbound(14, 14);
for (i = 14 - 1; i >= 0; --i) {
val <<= 1;
val |= lift_ctrl_io_led[i] ? 1 : 0;
}
lift_simio_led = val;
lift_checksum += val;
}
__attribute__((always_inline)) static inline void
lift_ctrl_get_vals() {
int i;
unsigned short int in0 = lift_simio_in;
unsigned short int in1 = lift_ctrl_dly1;
unsigned short int in2 = lift_ctrl_dly2;
lift_ctrl_dly2 = lift_ctrl_dly1;
lift_ctrl_dly1 = in0;
/* majority voting for input values
delays input value change by one period */
__pragma_loopbound(10, 10);
for (i = 0; i < 10; ++i) {
lift_ctrl_io_in[i] = ((in0 & 1) + (in1 & 1) + (in2 & 1)) > 1;
in0 >>= 1;
in1 >>= 1;
in2 >>= 1;
}
lift_ctrl_io_analog[0] = lift_simio_adc1;
lift_ctrl_io_analog[1] = lift_simio_adc2;
lift_ctrl_io_analog[2] = lift_simio_adc3;
}

View File

@ -0,0 +1,28 @@
#ifndef LIFTLIBIO_H
#define LIFTLIBIO_H
/* Global variables */
extern int lift_ctrl_io_in[10];
extern int lift_ctrl_io_out[4];
extern int lift_ctrl_io_analog[4];
extern int lift_ctrl_io_led[16];
extern int lift_ctrl_dly1, lift_ctrl_dly2;
/* Simulated hardware */
extern volatile int lift_simio_in;
extern volatile int lift_simio_out;
extern volatile int lift_simio_led;
extern volatile int lift_simio_adc1;
extern volatile int lift_simio_adc2;
extern volatile int lift_simio_adc3;
/* Checksum */
extern int lift_checksum;
/* prototypes */
__attribute__((always_inline)) static inline void lift_io_init(void);
__attribute__((always_inline)) static inline void lift_ctrl_get_vals(void);
__attribute__((always_inline)) static inline void lift_ctrl_set_vals(void);
#endif

View File

@ -0,0 +1,132 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: lift
Author: Martin Schoeberl, Benedikt Huber
Function: Lift Controler
Source: C-Port from http://www.jopdesign.com/doc/jembench.pdf
Original name: run_lift.c
Changes: no major functional changes
License: GPL version 3 or later
*/
/*
Include section
*/
#include "liftlibio.h"
#include "liftlibcontrol.h"
/*
Forward declaration of functions
*/
void lift_controller();
void lift_init();
void lift_main();
int lift_return();
/*
Declaration of global variables
*/
int lift_checksum;/* Checksum */
/*
Initialization- and return-value-related functions
*/
void lift_init()
{
unsigned int i;
unsigned char *p;
volatile char bitmask = 0;
/*
Apply volatile XOR-bitmask to entire input array.
*/
p = ( unsigned char * ) &lift_ctrl_io_in[ 0 ];
_Pragma( "loopbound min 40 max 40" )
for ( i = 0; i < sizeof( lift_ctrl_io_in ); ++i, ++p )
*p ^= bitmask;
p = ( unsigned char * ) &lift_ctrl_io_out[ 0 ];
_Pragma( "loopbound min 16 max 16" )
for ( i = 0; i < sizeof( lift_ctrl_io_out ); ++i, ++p )
*p ^= bitmask;
p = ( unsigned char * ) &lift_ctrl_io_analog[ 0 ];
_Pragma( "loopbound min 16 max 16" )
for ( i = 0; i < sizeof( lift_ctrl_io_analog ); ++i, ++p )
*p ^= bitmask;
p = ( unsigned char * ) &lift_ctrl_io_led[ 0 ];
_Pragma( "loopbound min 64 max 64" )
for ( i = 0; i < sizeof( lift_ctrl_io_led ); ++i, ++p )
*p ^= bitmask;
lift_checksum = 0;
lift_ctrl_init();
}
int lift_return()
{
return ( lift_checksum - 4005888 != 0 );
}
/*
Algorithm core functions
*/
void lift_controller()
{
lift_ctrl_get_vals();
lift_ctrl_loop();
lift_ctrl_set_vals();
}
/*
Main functions
*/
void _Pragma( "entrypoint" ) lift_main()
{
int i = 0;
_Pragma( "loopbound min 1001 max 1001" )
while ( 1 ) {
/* zero input stimulus */
lift_simio_in = 0;
lift_simio_adc1 = 0;
lift_simio_adc2 = 0;
lift_simio_adc3 = 0;
/* run lift_controller */
lift_controller();
if ( i++ >= 1000 )
break;
}
}
int main( void )
{
lift_init();
lift_main();
return ( lift_return() );
}

View File

@ -0,0 +1,277 @@
#include "liftlibio.h"
#include "liftlibcontrol.h"
/* Global variables */
int lift_levelPos[ 16 ];
int lift_one_level;
/**
Is the counter valid for level positioning?
*/
int lift_cntValid;
/**
Position absolute or relative<.
*/
int lift_cnt;
/**
Last stoped level (1..13) if position is absolute else 0.
*/
int lift_level;
/**
load position in level, 0 means we don't know
*/
int lift_loadLevel;
/**
we're going TOP or BOTTOM, but stop at load position.
*/
int lift_loadPending;
/**
we're waiting for the load sensor to go.
*/
int lift_loadSensor;
/**
cmd keeps the value of the command until the command is finished.
It is only updated by the switches if it's current value is CMD_NONE.
*/
int lift_cmd;
int lift_timMotor;
int lift_timImp;
/**
Remember last direction for impuls count after motor off;
*/
int lift_directionUp;
/**
Last value of impuls sensor.
*/
int lift_lastImp;
int lift_dbgCnt;
/**
stop value for the counter.
*/
int lift_endCnt;
void lift_ctrl_init()
{
int i;
lift_checksum = 0;
lift_io_init();
lift_cntValid = 0;
lift_cnt = 0;
lift_cmd = lift_CMD_NONE;
lift_timMotor = 0;
lift_timImp = 0;
lift_directionUp = 1;
lift_lastImp = 0;
lift_loadLevel = 0;
lift_loadPending = 0;
lift_loadSensor = 0;
i = 0;
lift_levelPos[ i++ ] = 0;
lift_levelPos[ i++ ] = 58;
lift_levelPos[ i++ ] = 115;
lift_levelPos[ i++ ] = 173;
lift_levelPos[ i++ ] = 230;
lift_levelPos[ i++ ] = 288;
lift_levelPos[ i++ ] = 346;
lift_levelPos[ i++ ] = 403;
lift_levelPos[ i++ ] = 461;
lift_levelPos[ i++ ] = 518;
lift_levelPos[ i++ ] = 576;
lift_levelPos[ i++ ] = 634;
lift_levelPos[ i++ ] = 691;
lift_levelPos[ i++ ] = 749;
lift_levelPos[ i++ ] = 806;
lift_levelPos[ i++ ] = 864;
lift_one_level = lift_levelPos[ 1 ];
}
void lift_ctrl_loop()
{
if ( lift_cmd == lift_CMD_NONE )
lift_check_cmd();
else {
lift_do_impulse( lift_ctrl_io_in[ lift_SENS_IMPULS ],
lift_ctrl_io_out[ lift_MOTOR_ON ],
lift_ctrl_io_in[ lift_SENS_BOTTOM ] );
lift_do_cmd();
}
lift_check_level();
lift_ctrl_io_led[ 13 ] = ( lift_dbgCnt & 0x80 ) != 0;
++lift_dbgCnt;
}
void lift_check_level()
{
int i;
int middle = lift_one_level >> 2;
if ( lift_cntValid ) {
_Pragma( "loopbound min 14 max 14" )
for ( lift_level = 1; lift_level < 14; ++lift_level ) {
if ( lift_cnt < lift_levelPos[ lift_level ] - middle )
break;
}
} else
lift_level = 0;
_Pragma( "loopbound min 14 max 14" )
for ( i = 0; i < 14; ++i )
lift_ctrl_io_led[ i ] = ( i == lift_level - 1 );
}
void lift_check_cmd()
{
if ( lift_loadPending ) {
if ( lift_ctrl_io_in[ lift_SENS_BOTTOM ] )
lift_cmd = lift_CMD_TOP;
} else
if ( lift_ctrl_io_in[ lift_GO_UP ] ) {
if ( !lift_ctrl_io_in[ lift_SENS_TOP ] && lift_level != 14 )
lift_cmd = lift_CMD_UP;
} else
if ( lift_ctrl_io_in[ lift_GO_DOWN ] ) {
if ( !lift_ctrl_io_in[ lift_SENS_BOTTOM ] && lift_level != 1 )
lift_cmd = lift_CMD_DOWN;
} else
if ( lift_ctrl_io_in[ lift_GO_LOAD ] ) {
if ( lift_loadLevel != 0 && lift_level < lift_loadLevel )
lift_cmd = lift_CMD_TOP;
else
lift_cmd = lift_CMD_BOTTOM;
lift_loadPending = 1;
lift_loadSensor = 0;
} else
if ( lift_ctrl_io_in[ lift_GO_TOP ] ) {
if ( !lift_ctrl_io_in[ lift_SENS_TOP ] )
lift_cmd = lift_CMD_TOP;
} else
if ( lift_ctrl_io_in[ lift_GO_BOTTOM ] ) {
if ( !lift_ctrl_io_in[ lift_SENS_BOTTOM ] )
lift_cmd = lift_CMD_BOTTOM;
}
if ( lift_cmd != lift_CMD_NONE )
lift_timMotor = 50;
}
void lift_do_impulse( int val, int motor, int reset )
{
if ( val && !lift_lastImp ) {
if ( motor || lift_timImp > 0 ) {
if ( lift_directionUp )
++lift_cnt;
else
--lift_cnt;
}
}
if ( reset ) {
lift_cnt = 0;
lift_cntValid = 1;
}
lift_lastImp = val;
if ( lift_timImp > 0 ) {
--lift_timImp;
if ( lift_timImp == 0 && lift_cmd != lift_CMD_NONE )
lift_cmd = lift_CMD_NONE;
}
}
void lift_do_cmd()
{
int run = 0;
if ( lift_timMotor > 0 )
lift_wait_for_motor_start();
else {
run = lift_check_run();
if ( lift_ctrl_io_out[ lift_MOTOR_ON ] && !run ) {
/* motor stopped: */
lift_cmd = 99;
lift_timImp = 50;
}
lift_ctrl_io_out[ lift_MOTOR_ON ] = run;
}
}
void lift_wait_for_motor_start()
{
int newLevel = 0;
--lift_timMotor;
lift_directionUp = ( lift_cmd == lift_CMD_UP || lift_cmd == lift_CMD_TOP );
lift_ctrl_io_out[ lift_MOTOR_UP ] = lift_directionUp;
if ( !lift_cntValid ) {
lift_cnt = 0; /* use relative counter */
if ( lift_cmd == lift_CMD_UP )
lift_endCnt = lift_one_level;
else
lift_endCnt = -lift_one_level;
} else {
lift_endCnt = lift_cnt;
newLevel = -99;
if ( lift_cmd == lift_CMD_UP )
newLevel = lift_level + 1;
else
if ( lift_cmd == lift_CMD_DOWN )
newLevel = lift_level - 1;
--newLevel; /* lift_level is one based */
if ( newLevel >= 0 && newLevel < 14 )
lift_endCnt = lift_levelPos[ newLevel ];
}
}
int lift_check_run()
{
if ( lift_cmd == lift_CMD_UP ) {
if ( lift_cnt < lift_endCnt - 1 && !lift_ctrl_io_in[ lift_SENS_TOP ] )
return 1;
} else
if ( lift_cmd == lift_CMD_DOWN ) {
if ( lift_cnt > lift_endCnt + 1 && !lift_ctrl_io_in[ lift_SENS_BOTTOM ] )
return 1;
} else
if ( lift_cmd == lift_CMD_TOP ) {
if ( lift_loadPending && lift_ctrl_io_in[ lift_SENS_LOAD ] ) {
/* we are at lift_load position */
lift_loadLevel = lift_level;
lift_loadPending = 0;
return 0;
}
if ( !lift_ctrl_io_in[ lift_SENS_TOP ] )
return 1;
/* safe fallback if lift_load sensor does not work */
lift_loadPending = 0;
} else
if ( lift_cmd == lift_CMD_BOTTOM ) {
if ( lift_loadPending ) {
if ( lift_loadSensor ) {
if ( !lift_ctrl_io_in[ lift_SENS_LOAD ] ) {
lift_loadSensor = 0;
/* we are at lift_load position */
lift_loadPending = 0;
lift_loadLevel = lift_level;
return 0;
}
}
lift_loadSensor = lift_ctrl_io_in[ lift_SENS_LOAD ];
}
if ( !lift_ctrl_io_in[ lift_SENS_BOTTOM ] )
return 1;
}
return 0;
}

View File

@ -0,0 +1,64 @@
#ifndef LIFTLIBCONTROL_H
#define LIFTLIBCONTROL_H
enum lift_Direction {
lift_GO_LOAD = 8,
lift_GO_TOP = 6,
lift_GO_BOTTOM = 7,
lift_GO_UP = 4,
lift_GO_DOWN = 5
};
enum lift_Sensor {
lift_SENS_IMPULS = 0,
lift_SENS_TOP = 1,
lift_SENS_BOTTOM = 2,
lift_SENS_LOAD = 3
};
enum lift_Motor {
lift_MOTOR_ON = 0,
lift_MOTOR_UP = 1
};
enum lift_Command {
lift_CMD_NONE = 0,
lift_CMD_TOP = 1,
lift_CMD_BOTTOM = 2,
lift_CMD_UP = 3,
lift_CMD_DOWN = 4
};
/* Global variables */
extern int lift_levelPos[ 16 ];
extern int lift_one_level;
extern int lift_cntValid;
extern int lift_cnt;
extern int lift_level;
extern int lift_loadLevel;
extern int lift_loadPending;
extern int lift_loadSensor;
extern int lift_cmd;
extern int lift_timMotor;
extern int lift_timImp;
extern int lift_directionUp;
extern int lift_lastImp;
extern int lift_dbgCnt;
extern int lift_endCnt;
/* Checksum */
extern int lift_checksum;
/* prototypes */
void lift_ctrl_init();
void lift_ctrl_loop();
/* internal prototypes */
int lift_check_run();
void lift_wait_for_motor_start();
void lift_do_cmd();
void lift_do_impulse( int val, int motor, int reset );
void lift_check_cmd();
void lift_check_level();
#endif

View File

@ -0,0 +1,65 @@
#include "liftlibio.h"
/* Global variables */
int lift_ctrl_io_in[ 10 ] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int lift_ctrl_io_out[ 4 ] = {0, 0, 0, 0};
int lift_ctrl_io_analog[ 4 ] = {0, 0, 0, 0};
int lift_ctrl_io_led[ 16 ] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int lift_ctrl_dly1;
int lift_ctrl_dly2;
/* Simulated hardware */
volatile int lift_simio_in;
volatile int lift_simio_out;
volatile int lift_simio_led;
volatile int lift_simio_adc1;
volatile int lift_simio_adc2;
volatile int lift_simio_adc3;
void lift_io_init()
{
lift_ctrl_dly1 = 0;
lift_ctrl_dly2 = 0;
}
void lift_ctrl_set_vals()
{
int val = 0, i;
_Pragma( "loopbound min 4 max 4" )
for ( i = 4 - 1; i >= 0; --i ) {
val <<= 1;
val |= lift_ctrl_io_out[ i ] ? 1 : 0;
}
lift_simio_out = val;
_Pragma( "loopbound min 14 max 14" )
for ( i = 14 - 1; i >= 0; --i ) {
val <<= 1;
val |= lift_ctrl_io_led[ i ] ? 1 : 0;
}
lift_simio_led = val;
lift_checksum += val;
}
void lift_ctrl_get_vals()
{
int i;
unsigned short int in0 = lift_simio_in;
unsigned short int in1 = lift_ctrl_dly1;
unsigned short int in2 = lift_ctrl_dly2;
lift_ctrl_dly2 = lift_ctrl_dly1;
lift_ctrl_dly1 = in0;
/* majority voting for input values
delays input value change by one period */
_Pragma( "loopbound min 10 max 10" )
for ( i = 0; i < 10; ++i ) {
lift_ctrl_io_in[ i ] = ( ( in0 & 1 ) + ( in1 & 1 ) + ( in2 & 1 ) ) > 1;
in0 >>= 1;
in1 >>= 1;
in2 >>= 1;
}
lift_ctrl_io_analog[ 0 ] = lift_simio_adc1;
lift_ctrl_io_analog[ 1 ] = lift_simio_adc2;
lift_ctrl_io_analog[ 2 ] = lift_simio_adc3;
}

View File

@ -0,0 +1,27 @@
#ifndef LIFTLIBIO_H
#define LIFTLIBIO_H
/* Global variables */
extern int lift_ctrl_io_in[ 10 ];
extern int lift_ctrl_io_out[ 4 ];
extern int lift_ctrl_io_analog[ 4 ];
extern int lift_ctrl_io_led[ 16 ];
extern int lift_ctrl_dly1, lift_ctrl_dly2;
/* Simulated hardware */
extern volatile int lift_simio_in;
extern volatile int lift_simio_out;
extern volatile int lift_simio_led;
extern volatile int lift_simio_adc1;
extern volatile int lift_simio_adc2;
extern volatile int lift_simio_adc3;
/* Checksum */
extern int lift_checksum;
/* prototypes */
void lift_io_init( void );
void lift_ctrl_get_vals( void );
void lift_ctrl_set_vals( void );
#endif

View File

@ -0,0 +1,35 @@
# ~~~
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2026, Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU)
# ~~~
cmake_minimum_required(VERSION 3.20)
project(powerwindow)
set(TACLEBENCH_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../..")
set(REPOSITORY_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
set(APP_TARGET_NAME "${CMAKE_PROJECT_NAME}")
if(DEFINED TACLEBENCH_VARIANT AND "${TACLEBENCH_VARIANT}" STREQUAL "inline")
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/inline/powerwindow.c")
else()
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/default/powerwindow.c"
"generated/modified_sources/default/powerwindow_PW_Control_DRV.c"
"generated/modified_sources/default/powerwindow_PW_Control_PSG_BackL.c"
"generated/modified_sources/default/powerwindow_PW_Control_PSG_BackR.c"
"generated/modified_sources/default/powerwindow_PW_Control_PSG_Front.c"
"generated/modified_sources/default/powerwindow_const_params.c"
"generated/modified_sources/default/powerwindow_controlexclusion.c"
"generated/modified_sources/default/powerwindow_debounce.c"
"generated/modified_sources/default/powerwindow_inputs.c"
"generated/modified_sources/default/powerwindow_powerwindow_control.c"
"generated/modified_sources/default/wcclib.c")
endif()
include(${REPOSITORY_ROOT_PATH}/cmake/taclebench_wasm.cmake)

View File

@ -0,0 +1,42 @@
Adjusted the original files to tacle benchmark requirements
Created the input serials in void powerwindow_input_initialize(void) to cover the real life scenarios
23-03-2016:
Deleted folder powerwindow_SourceFiles moved all the contained c files to PowerWindow folder
Created headerfile powerwindow.h
Added
#ifndef NULL
#define NULL ((void *) 0)
#endif
to header file powerwindow.h
Deleted #include <stdio.h> in all files replaced with headerfile powerwindow.h
Deleted function powerwindow_GetErrorStatus(void) and the related code
Commented
long tic, toc, tictoc;
tic = powerwindow_get_cycles();
toc = powerwindow_get_cycles();
tictoc = toc-tic;
printf("%ld\n",tictoc );
in the int main(void). Uncomment can print the execution time of the powerwindow benchmark.
Adjusted the description of all the files
21-04-2016
Adjusted the author and license
18-04-2017:
Annotated powerwindow_main as entry-point for timing analysis
10-07-2017
- Fix changelog order so dates are correctly sorted.
- Fix input array length to avoid possible buffer overflow.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,782 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow
Author: CoSys-Lab, University of Antwerp
Function: powerwindow implement the powerwindow that can be seen in cars
nowadays. The window can be controlled by either driver or passenger. When an
object is detected between the window frame and the glass during the raising
of the glass, the glass will lower down for some distance. This benchmark
contains 4 tasks which includes the driver side powerwindow, front passenger
side powerwindow, back-left passenger side powerwindow, back-right passenger
side powerwindow. These 4 tasks can be easily adjusted to execute in
sequential order parallel on single or muti core.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow.c
Changes: a brief summary of major functional changes and formatting)
* 2023-12-07: Added loop bounds
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_DRV.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front.h"
#include "powerwindow_HeaderFiles/powerwindow_controlexclusion.h" /* Control Model's header file */
#include "powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "powerwindow_HeaderFiles/powerwindow_powerwindow_control.h" /* PW passenger control Model's header file */
#include "powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
/*
Forward declaration of functions
*/
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
void powerwindow_Booleaninputarray_initialize(powerwindow_boolean_T *,
powerwindow_boolean_T *);
void powerwindow_Uint8inputarray_initialize(powerwindow_uint8_T *,
powerwindow_uint8_T *);
void powerwindow_init();
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
powerwindow_main();
int powerwindow_return();
__attribute__((noinline)) __attribute__((export_name("main"))) int main(void);
// DRV
void powerwindow_init_DRV(int);
void powerwindow_input_initialize_DRV(void);
void powerwindow_initialize_DRV(void);
void powerwindow_return_DRV(void);
void powerwindow_DRV_main(void);
// PSG_Front
void powerwindow_init_PSG_Front(int);
void powerwindow_input_initialize_PSG_Front(void);
void powerwindow_initialize_PSG_Front(void);
void powerwindow_return_PSG_Front(void);
void powerwindow_PSG_Front_main(void);
// PSG_BackL
void powerwindow_init_PSG_BackL(int);
void powerwindow_input_initialize_PSG_BackL(void);
void powerwindow_initialize_PSG_BackL(void);
void powerwindow_return_PSG_BackL(void);
void powerwindow_PSG_BackL_main(void);
// PSG_BackR
void powerwindow_init_PSG_BackR(int);
void powerwindow_input_initialize_PSG_BackR(void);
void powerwindow_initialize_PSG_BackR(void);
void powerwindow_return_PSG_BackR(void);
void powerwindow_PSG_BackR_main(void);
/*
Declaration of global variables
*/
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_powerwindow_PW_C powerwindow_PW_Control_DRV_U;
extern powerwindow_ExternalOutputs_powerwindow_PW_ powerwindow_PW_Control_DRV_Y;
extern powerwindow_ExternalInputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_U;
extern powerwindow_ExternalInputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_U;
extern powerwindow_ExternalInputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_U;
powerwindow_boolean_T
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_Front_U_Up_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_Front_U_Down_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_BackL_U_Up_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_BackL_U_Down_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_BackR_U_Up_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_BackR_U_Down_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Input_DRV
[powerwindow_input_length];
powerwindow_uint8_T powerwindow_powerwindow_control_U_currentsense_Input_DRV
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_Front_U_Up_Input_Front_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_Front_U_Down_Input_Front_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_BackL_U_Up_Input_BackL_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_BackR_U_Up_Input_BackR_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_BackR_U_Down_Input_BackR_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_DRV_Array
[powerwindow_input_length];
extern powerwindow_uint8_T
powerwindow_powerwindow_control_U_currentsense_DRV_Array
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_controlexclusion_U_Up_DRV_Input_Front
[powerwindow_input_length]; /* Here applied a push-down button, the signal
is high when the button is not pressed. */
powerwindow_boolean_T powerwindow_controlexclusion_U_Down_DRV_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_Front_U_Up_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_Front_U_Down_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Input_Front
[powerwindow_input_length];
powerwindow_uint8_T powerwindow_powerwindow_control_U_currentsense_Input_Front
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_passenger_Front_U_Up_Front_Array
[powerwindow_input_length]; /* Here applied a push-down button, the
signal is high when the button is not
pressed. */
extern powerwindow_boolean_T
powerwindow_debounce_passenger_Front_U_Down_Front_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Front_Array
[powerwindow_input_length];
extern powerwindow_uint8_T
powerwindow_powerwindow_control_U_currentsense_Front_Array
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_controlexclusion_U_Up_DRV_Input_BackL
[powerwindow_input_length]; /* Here applied a push-down button, the signal
is high when the button is not pressed. */
powerwindow_boolean_T powerwindow_controlexclusion_U_Down_DRV_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_BackL_U_Up_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_BackL_U_Down_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackL
[powerwindow_input_length];
powerwindow_uint8_T powerwindow_powerwindow_control_U_currentsense_Input_BackL
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_passenger_BackL_U_Up_BackL_Array
[powerwindow_input_length]; /* Here applied a push-down button, the
signal is high when the button is not
pressed. */
extern powerwindow_boolean_T
powerwindow_debounce_passenger_BackL_U_Down_BackL_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_BackL_Array
[powerwindow_input_length];
extern powerwindow_uint8_T
powerwindow_powerwindow_control_U_currentsense_BackL_Array
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_controlexclusion_U_Up_DRV_Input_BackR
[powerwindow_input_length]; /* Here applied a push-down button, the signal
is high when the button is not pressed. */
powerwindow_boolean_T powerwindow_controlexclusion_U_Down_DRV_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_BackR_U_Up_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_BackR_U_Down_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackR
[powerwindow_input_length];
powerwindow_uint8_T powerwindow_powerwindow_control_U_currentsense_Input_BackR
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_passenger_BackR_U_Up_BackR_Array
[powerwindow_input_length]; /* Here applied a push-down button, the
signal is high when the button is not
pressed. */
extern powerwindow_boolean_T
powerwindow_debounce_passenger_BackR_U_Down_BackR_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_BackR_Array
[powerwindow_input_length];
extern powerwindow_uint8_T
powerwindow_powerwindow_control_U_currentsense_BackR_Array
[powerwindow_input_length];
int powerwindow_main_inputcyclecounter;
/*
Initialization- and return-value-related functions
*/
void
powerwindow_init_DRV(int i) {
powerwindow_PW_Control_DRV_U.In1 =
powerwindow_powerwindow_control_U_endofdetectionrange_Input_DRV
[i]; /* The when the window reaches the end of the range, the
endofdetectionrange changes to 0. */
powerwindow_PW_Control_DRV_U.In3 =
powerwindow_powerwindow_control_U_currentsense_Input_DRV
[i]; /* When the currentsense is higher than 92 (based on
experiments), one object is stuck between the window and the
frame. Pinch is set to True.*/
powerwindow_PW_Control_DRV_U.In2 =
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In4 =
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In5 =
powerwindow_debounce_Driver_Front_U_Up_Input_Front
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In6 =
powerwindow_debounce_Driver_Front_U_Down_Input_Front
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In9 =
powerwindow_debounce_Driver_BackL_U_Up_Input_BackL
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In10 =
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In7 =
powerwindow_debounce_Driver_BackR_U_Up_Input_BackR
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In8 =
powerwindow_debounce_Driver_BackR_U_Down_Input_BackR
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
}
void
powerwindow_init_PSG_Front(int i) {
powerwindow_PW_Control_PSG_Front_U.Up_DRV =
powerwindow_PW_Control_DRV_Y
.Out6; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_PSG_Front_U.Down_DRV =
powerwindow_PW_Control_DRV_Y
.Out7; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lower the window. */
powerwindow_PW_Control_PSG_Front_U.Up_PSG_Front =
powerwindow_debounce_passenger_Front_U_Up_Input_Front[i];
powerwindow_PW_Control_PSG_Front_U.Down_PSG_Front =
powerwindow_debounce_passenger_Front_U_Down_Input_Front
[i]; /* '<Root>/Down'. Here applied a push-down button, the signal
is high when the button is not pressed. Change to 0 to lower
the window. */
powerwindow_PW_Control_PSG_Front_U.endofdetectionrange =
powerwindow_powerwindow_control_U_endofdetectionrange_Input_Front
[i]; /* The when the window reaches the end of the range, the
endofdetectionrange changes to 0. */
powerwindow_PW_Control_PSG_Front_U.currentsense =
powerwindow_powerwindow_control_U_currentsense_Input_Front
[i]; /* When the currentsense is higher than 92 (based on
experiments), one object is stuck between the window and the
frame. Pinch is set to True.*/
}
void
powerwindow_init_PSG_BackL(int i) {
powerwindow_PW_Control_PSG_BackL_U.Up_DRV =
powerwindow_PW_Control_DRV_Y
.Out10; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_PSG_BackL_U.Down_DRV =
powerwindow_PW_Control_DRV_Y
.Out11; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lower the window.
*/
powerwindow_PW_Control_PSG_BackL_U.Up_PSG_BackL =
powerwindow_debounce_passenger_BackL_U_Up_Input_BackL[i];
powerwindow_PW_Control_PSG_BackL_U.Down_PSG_BackL =
powerwindow_debounce_passenger_BackL_U_Down_Input_BackL
[i]; /* '<Root>/Down'. Here applied a push-down button, the signal
is high when the button is not pressed. Change to 0 to lower
the window. */
powerwindow_PW_Control_PSG_BackL_U.endofdetectionrange =
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackL
[i]; /* The when the window reaches the end of the range, the
endofdetectionrange changes to 0. */
powerwindow_PW_Control_PSG_BackL_U.currentsense =
powerwindow_powerwindow_control_U_currentsense_Input_BackL
[i]; /* When the currentsense is higher than 92 (based on
experiments), one object is stuck between the window and the
frame. Pinch is set to True.*/
}
void
powerwindow_init_PSG_BackR(int i) {
powerwindow_PW_Control_PSG_BackR_U.Up_DRV =
powerwindow_PW_Control_DRV_Y
.Out8; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_PSG_BackR_U.Down_DRV =
powerwindow_PW_Control_DRV_Y
.Out9; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lower the window. */
powerwindow_PW_Control_PSG_BackR_U.Up_PSG_BackR =
powerwindow_debounce_passenger_BackR_U_Up_Input_BackR[i];
powerwindow_PW_Control_PSG_BackR_U.Down_PSG_BackR =
powerwindow_debounce_passenger_BackR_U_Down_Input_BackR
[i]; /* '<Root>/Down'. Here applied a push-down button, the signal
is high when the button is not pressed. Change to 0 to lower
the window. */
powerwindow_PW_Control_PSG_BackR_U.endofdetectionrange =
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackR
[i]; /* The when the window reaches the end of the range, the
endofdetectionrange changes to 0. */
powerwindow_PW_Control_PSG_BackR_U.currentsense =
powerwindow_powerwindow_control_U_currentsense_Input_BackR
[i]; /* When the currentsense is higher than 92 (based on
experiments), one object is stuck between the window and the
frame. Pinch is set to True.*/
}
void
powerwindow_input_initialize_DRV(void) {
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV,
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV,
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_Front_U_Up_Input_Front,
powerwindow_debounce_Driver_Front_U_Up_Input_Front_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_Front_U_Down_Input_Front,
powerwindow_debounce_Driver_Front_U_Down_Input_Front_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_BackL_U_Up_Input_BackL,
powerwindow_debounce_Driver_BackL_U_Up_Input_BackL_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL,
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL,
powerwindow_debounce_Driver_BackR_U_Up_Input_BackR_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_BackR_U_Down_Input_BackR,
powerwindow_debounce_Driver_BackR_U_Down_Input_BackR_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_powerwindow_control_U_endofdetectionrange_Input_DRV,
powerwindow_powerwindow_control_U_endofdetectionrange_DRV_Array);
powerwindow_Uint8inputarray_initialize(
powerwindow_powerwindow_control_U_currentsense_DRV_Array,
powerwindow_powerwindow_control_U_currentsense_DRV_Array);
}
void
powerwindow_input_initialize_PSG_Front(void) {
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_Front_U_Up_Input_Front,
powerwindow_debounce_passenger_Front_U_Up_Front_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_Front_U_Down_Input_Front,
powerwindow_debounce_passenger_Front_U_Down_Front_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_powerwindow_control_U_endofdetectionrange_Input_Front,
powerwindow_powerwindow_control_U_endofdetectionrange_Front_Array);
powerwindow_Uint8inputarray_initialize(
powerwindow_powerwindow_control_U_currentsense_Input_Front,
powerwindow_powerwindow_control_U_currentsense_Front_Array);
}
void
powerwindow_input_initialize_PSG_BackL(void) {
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_BackL_U_Up_Input_BackL,
powerwindow_debounce_passenger_BackL_U_Up_BackL_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_BackL_U_Down_Input_BackL,
powerwindow_debounce_passenger_BackL_U_Down_BackL_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackL,
powerwindow_powerwindow_control_U_endofdetectionrange_BackL_Array);
powerwindow_Uint8inputarray_initialize(
powerwindow_powerwindow_control_U_currentsense_Input_BackL,
powerwindow_powerwindow_control_U_currentsense_BackL_Array);
}
void
powerwindow_input_initialize_PSG_BackR(void) {
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_BackR_U_Up_Input_BackR,
powerwindow_debounce_passenger_BackR_U_Up_BackR_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_BackR_U_Down_Input_BackR,
powerwindow_debounce_passenger_BackR_U_Down_BackR_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackR,
powerwindow_powerwindow_control_U_endofdetectionrange_BackR_Array);
powerwindow_Uint8inputarray_initialize(
powerwindow_powerwindow_control_U_currentsense_Input_BackR,
powerwindow_powerwindow_control_U_currentsense_BackR_Array);
}
void
powerwindow_Booleaninputarray_initialize(powerwindow_boolean_T *arrayA,
powerwindow_boolean_T *arrayB) {
register int i;
__pragma_loopbound(977, 977);
for (i = 0; i < powerwindow_input_length; i++)
arrayA[i] = arrayB[i];
}
void
powerwindow_Uint8inputarray_initialize(powerwindow_uint8_T *arrayA,
powerwindow_uint8_T *arrayB) {
register int i;
__pragma_loopbound(977, 977);
for (i = 0; i < powerwindow_input_length; i++)
arrayA[i] = arrayB[i];
}
void
powerwindow_initialize_DRV(void) {
/* Initialize model */
powerwindow_PW_Control_DRV_initialize();
}
void
powerwindow_initialize_PSG_Front(void) {
/* Initialize model */
powerwindow_PW_Control_PSG_Front_initialize();
}
void
powerwindow_initialize_PSG_BackL(void) {
/* Initialize model */
powerwindow_PW_Control_PSG_BackL_initialize();
}
void
powerwindow_initialize_PSG_BackR(void) {
/* Initialize model */
powerwindow_PW_Control_PSG_BackR_initialize();
}
void
powerwindow_return_DRV(void) {
/* Terminate model */
powerwindow_PW_Control_DRV_terminate();
}
void
powerwindow_return_PSG_Front(void) {
/* Terminate model */
powerwindow_PW_Control_PSG_Front_terminate();
}
void
powerwindow_return_PSG_BackL(void) {
/* Terminate model */
powerwindow_PW_Control_PSG_BackL_terminate();
}
void
powerwindow_return_PSG_BackR(void) {
/* Terminate model */
powerwindow_PW_Control_PSG_BackR_terminate();
}
/*
Main functions
*/
/*
Associating powerwindow_main with a real-time clock or interrupt service
routine is what makes the generated code "real-time". The function
powerwindow_main is always associated with the base rate of the model.
Subrates are managed by the base rate from inside the generated code.
Enabling/disabling interrupts and floating point context switches are target
specific. This example code indicates where these should take place relative
to executing the generated code step function. Overrun behavior should be
tailored to your application needs. This example simply sets an error status
in the real-time model and returns from powerwindow_main.
*/
void
powerwindow_DRV_main(void) {
static powerwindow_boolean_T OverrunFlag = 0;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
powerwindow_PW_DRV_rtmSetErrorStatus(powerwindow_PW_Control_DRV_M,
"Overrun"); //////////
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
powerwindow_PW_Control_DRV_main();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
/*
The example "main" function illustrates what is required by your
application code to initialize, execute, and terminate the generated code.
Attaching powerwindow_main to a real-time clock is target specific. This
example illustates how you do this relative to initializing the model.
*/
void
powerwindow_PSG_Front_main(void) {
static powerwindow_boolean_T OverrunFlag = 0;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
powerwindow_PW_PSG_Front_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_Front_M, "Overrun");
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
powerwindow_PW_Control_PSG_Front_main();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
void
powerwindow_PSG_BackL_main(void) {
static powerwindow_boolean_T OverrunFlag = 0;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
powerwindow_PW_PSG_BackL_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_BackL_M, "Overrun");
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
powerwindow_PW_Control_PSG_BackL_main();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
void
powerwindow_PSG_BackR_main(void) {
static powerwindow_boolean_T OverrunFlag = 0;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
powerwindow_PW_PSG_BackR_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_BackR_M, "Overrun");
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
powerwindow_PW_Control_PSG_BackR_main();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
void
powerwindow_init(void) {
powerwindow_initialize_DRV();
powerwindow_initialize_PSG_Front();
powerwindow_initialize_PSG_BackL();
powerwindow_initialize_PSG_BackR();
powerwindow_main_inputcyclecounter = 0;
}
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
powerwindow_main(void) {
/* Attach powerwindow_main to a timer or interrupt service routine with
period 0.005 seconds (the model's base sample time) here. The
call syntax for powerwindow_main is
powerwindow_main();
*/
// Task 1: Driver side window
powerwindow_input_initialize_DRV();
powerwindow_input_initialize_PSG_Front();
powerwindow_input_initialize_PSG_BackL();
powerwindow_input_initialize_PSG_BackR();
__pragma_loopbound(977, 977);
while (powerwindow_main_inputcyclecounter < powerwindow_input_length) {
powerwindow_init_DRV(powerwindow_main_inputcyclecounter);
powerwindow_DRV_main();
// Task 2: Front passenger side window
powerwindow_init_PSG_Front(powerwindow_main_inputcyclecounter);
powerwindow_PSG_Front_main();
// Task 3: Back left passenger side window
powerwindow_init_PSG_BackL(powerwindow_main_inputcyclecounter);
powerwindow_PSG_BackL_main();
// Task 4: Back right passenger side window
powerwindow_init_PSG_BackR(powerwindow_main_inputcyclecounter);
powerwindow_PSG_BackR_main();
powerwindow_main_inputcyclecounter++;
}
}
int
powerwindow_return(void) {
powerwindow_return_DRV();
powerwindow_return_PSG_Front();
powerwindow_return_PSG_BackL();
powerwindow_return_PSG_BackR();
return 0;
}
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
powerwindow_init();
powerwindow_main();
return powerwindow_return();
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,23 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef NULL
#define NULL ((viod *) 0)
#endif

View File

@ -0,0 +1,328 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_DRV.c
Author: CoSys-Lab, University of Antwerp
Function: PW_Control_DRV realizes the functionality of driver side
powerwindow. It connects the 3 smaller modules together.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow//powerwindow_powerwindow_control.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_DRV.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_DRV_private.h"
#include "wcclib.h"
/*
Forward declaration of functions
*/
void powerwindow_PW_Control_DRV_initialize(void);
void powerwindow_PW_Control_DRV_terminate(void);
void powerwindow_PW_Control_DRV_main(void);
/* Block states (auto storage) */
powerwindow_D_Work_powerwindow_PW_Control_D powerwindow_PW_Control_DR_DWork;
/* External inputs (root inport signals with auto storage) */
powerwindow_ExternalInputs_powerwindow_PW_C powerwindow_PW_Control_DRV_U;
/* External outputs (root outports fed by signals with auto storage) */
powerwindow_ExternalOutputs_powerwindow_PW_ powerwindow_PW_Control_DRV_Y;
/* Real-time model */
powerwindow_RT_MODEL_PW_Control_DRV powerwindow_PW_Control_DRV_M_;
powerwindow_RT_MODEL_PW_Control_DRV *const powerwindow_PW_Control_DRV_M =
&powerwindow_PW_Control_DRV_M_;
/* Model step function */
void
powerwindow_PW_Control_DRV_main(void) {
/* local block i/o variables */
powerwindow_boolean_T rtb_Debounce_Up_DRV;
powerwindow_boolean_T rtb_Debounce_Down_DRV;
/* ModelReference: '<S2>/Debounce_Up_DRV' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In2, &rtb_Debounce_Up_DRV,
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Down_DRV' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In4, &rtb_Debounce_Down_DRV,
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In9, &powerwindow_PW_Control_DRV_Y.Out10,
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In10, &powerwindow_PW_Control_DRV_Y.Out11,
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1
.rtzce));
/* ModelReference: '<S2>/Debounce_Up_PSG_Front' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In5, &powerwindow_PW_Control_DRV_Y.Out6,
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Down_PSG_Front' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In6, &powerwindow_PW_Control_DRV_Y.Out7,
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1
.rtzce));
/* ModelReference: '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In7, &powerwindow_PW_Control_DRV_Y.Out8,
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In8, &powerwindow_PW_Control_DRV_Y.Out9,
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1
.rtzce));
/* ModelReference: '<S1>/PW_DRV' */
powerwindow_powerwindow_control_main(
&rtb_Debounce_Up_DRV, &rtb_Debounce_Down_DRV,
&powerwindow_PW_Control_DRV_U.In1, &powerwindow_PW_Control_DRV_U.In3,
&powerwindow_PW_Control_DRV_Y.Out1, &powerwindow_PW_Control_DRV_Y.Out2,
&powerwindow_PW_Control_DRV_Y.Out3, &powerwindow_PW_Control_DRV_Y.Out4,
&powerwindow_PW_Control_DRV_Y.Out5,
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtzce));
}
/* Model initialize function */
void
powerwindow_PW_Control_DRV_initialize(void) {
/* Registration code */
/* states (dwork) */
(void) wcclib_memset((void *) &powerwindow_PW_Control_DR_DWork, 0,
sizeof(powerwindow_D_Work_powerwindow_PW_Control_D));
/* external inputs */
(void) wcclib_memset((void *) &powerwindow_PW_Control_DRV_U, 0,
sizeof(powerwindow_ExternalInputs_powerwindow_PW_C));
/* external outputs */
(void) wcclib_memset((void *) &powerwindow_PW_Control_DRV_Y, 0,
sizeof(powerwindow_ExternalOutputs_powerwindow_PW_));
/* Model Initialize fcn for ModelReference Block: '<S2>/Debounce_Down_DRV'
*/
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1
.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1
.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Down_PSG_Front' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1
.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S2>/Debounce_Up_DRV' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Up_PSG_Front' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S1>/PW_DRV' */
powerwindow_powerwindow_control_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtzce));
/* Start for ModelReference: '<S2>/Debounce_Up_DRV' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Down_DRV' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Up_PSG_Front' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Down_PSG_Front' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtdw));
/* Start for ModelReference: '<S1>/PW_DRV' */
powerwindow_powerwindow_control_Start(
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Up_DRV' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Down_DRV' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Up_PSG_Front' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Down_PSG_Front' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S1>/PW_DRV' */
powerwindow_powerwindow_control_Init(
&powerwindow_PW_Control_DRV_Y.Out1, &powerwindow_PW_Control_DRV_Y.Out2,
&powerwindow_PW_Control_DRV_Y.Out3, &powerwindow_PW_Control_DRV_Y.Out4,
&powerwindow_PW_Control_DRV_Y.Out5,
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtdw));
}
/* Model terminate function */
void
powerwindow_PW_Control_DRV_terminate(void) {
/* (no terminate code required) */
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,154 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_DRV.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_DRV.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_powerwindow_PW_Control_DRV_h_
#define powerwindow_RTW_HEADER_powerwindow_PW_Control_DRV_h_
#ifndef powerwindow_PW_Control_DRV_COMMON_INCLUDES_
#define powerwindow_PW_Control_DRV_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* powerwindow_PW_Control_DRV_COMMON_INCLUDES_ */
#include "../powerwindow_HeaderFiles/powerwindow_PW_Control_DRV_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Child system includes */
#include "../powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_PW_DRV_rtmGetErrorStatus
#define powerwindow_PW_DRV_rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef powerwindow_PW_DRV_rtmSetErrorStatus
#define powerwindow_PW_DRV_rtmSetErrorStatus(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#ifndef powerwindow_PW_DRV_rtmGetErrorStatusPointer
#define powerwindow_PW_DRV_rtmGetErrorStatusPointer(rtm) \
((const powerwindow_char_T **) (&((rtm)->errorStatus)))
#endif
/* Block states (auto storage) for system '<Root>' */
typedef struct {
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_DRV_DWORK1; /* '<S2>/Debounce_Up_DRV' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_DRV_DWORK1; /* '<S2>/Debounce_Down_DRV' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_PSG_BackL_DWORK1; /* '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_PSG_BackL_DWORK1; /* '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_PSG_Front_DWORK1; /* '<S2>/Debounce_Up_PSG_Front' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_PSG_Front_DWORK1; /* '<S2>/Debounce_Down_PSG_Front' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_PSG_BackR_DWORK1; /* '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_PSG_BackR_DWORK1; /* '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_rtMdlrefDWork_PowerWindow_contr
PW_DRV_DWORK1; /* '<S1>/PW_DRV' */
} powerwindow_D_Work_powerwindow_PW_Control_D;
/* External inputs (root inport signals with auto storage) */
typedef struct {
powerwindow_boolean_T In1; /* '<Root>/In1' */
powerwindow_boolean_T In2; /* '<Root>/In2' */
powerwindow_uint8_T In3; /* '<Root>/In3' */
powerwindow_boolean_T In4; /* '<Root>/In4' */
powerwindow_boolean_T In5; /* '<Root>/In5' */
powerwindow_boolean_T In6; /* '<Root>/In6' */
powerwindow_boolean_T In7; /* '<Root>/In7' */
powerwindow_boolean_T In8; /* '<Root>/In8' */
powerwindow_boolean_T In9; /* '<Root>/In9' */
powerwindow_boolean_T In10; /* '<Root>/In10' */
} powerwindow_ExternalInputs_powerwindow_PW_C;
/* External outputs (root outports fed by signals with auto storage) */
typedef struct {
powerwindow_boolean_T Out1; /* '<Root>/Out1' */
powerwindow_boolean_T Out2; /* '<Root>/Out2' */
powerwindow_boolean_T Out3; /* '<Root>/Out3' */
powerwindow_boolean_T Out4; /* '<Root>/Out4' */
powerwindow_boolean_T Out5; /* '<Root>/Out5' */
powerwindow_boolean_T Out6; /* '<Root>/Out6' */
powerwindow_boolean_T Out7; /* '<Root>/Out7' */
powerwindow_boolean_T Out8; /* '<Root>/Out8' */
powerwindow_boolean_T Out9; /* '<Root>/Out9' */
powerwindow_boolean_T Out10; /* '<Root>/Out10' */
powerwindow_boolean_T Out11; /* '<Root>/Out11' */
} powerwindow_ExternalOutputs_powerwindow_PW_;
struct powerwindow_tag_RTM_PW_Control_DRV {
const powerwindow_char_T *volatile errorStatus;
};
/* Block states (auto storage) */
extern powerwindow_D_Work_powerwindow_PW_Control_D
powerwindow_PW_Control_DR_DWork;
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_powerwindow_PW_C powerwindow_PW_Control_DRV_U;
/* External outputs (root outports fed by signals with auto storage) */
extern powerwindow_ExternalOutputs_powerwindow_PW_ powerwindow_PW_Control_DRV_Y;
/* Model entry point functions */
void powerwindow_PW_Control_DRV_initialize(void);
void powerwindow_PW_Control_DRV_main(void);
void powerwindow_PW_Control_DRV_terminate(void);
/* Real-time Model object */
extern powerwindow_RT_MODEL_PW_Control_DRV *const powerwindow_PW_Control_DRV_M;
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Note that this particular code originates from a subsystem build,
and has its own system numbers different from the parent model.
Refer to the system hierarchy for this subsystem below, and use the
MATLAB hilite_system command to trace the generated code back
to the parent model. For example,
hilite_system('PowerWindow/powerwindow_PW_Control_DRV') - opens subsystem
PowerWindow/powerwindow_PW_Control_DRV
hilite_system('PowerWindow/powerwindow_PW_Control_DRV/Kp') - opens and
selects block Kp
Here is the system hierarchy for this model
'<Root>' : 'PowerWindow'
'<S1>' : 'PowerWindow/powerwindow_PW_Control_DRV'
'<S2>' : 'PowerWindow/powerwindow_PW_Control_DRV/Debounce_DRV'
*/
#endif /* RTW_HEADER_powerwindow_PW_Control_DRV_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_DRV_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_DRV_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_powerwindow_PW_Control_DRV_private_h_
#define powerwindow_RTW_HEADER_powerwindow_PW_Control_DRV_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_powerwindow_PW_Control_DRV_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,34 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_DRV_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_DRV_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_DRV_types_h_
#define powerwindow_RTW_HEADER_PW_Control_DRV_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_PW_Control_DRV
powerwindow_RT_MODEL_PW_Control_DRV;
#endif /* RTW_HEADER_PW_Control_DRV_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,192 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackL.c
Author: CoSys-Lab, University of Antwerp
Function: PW_Control_DRV realizes the functionality of back-left passenger
side powerwindow. It connects the 3 smaller modules together.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow//powerwindow_powerwindow_control.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL_private.h"
#include "wcclib.h"
/*
Forward declaration of functions
*/
void powerwindow_PW_Control_PSG_BackL_initialize(void);
void powerwindow_PW_Control_PSG_BackL_terminate(void);
void powerwindow_PW_Control_PSG_BackL_main(void);
/* Block states (auto storage) */
powerwindow_D_Work_PW_Control_PSG_BackL powerwindow_PW_Control_PSG_BackL_DWork;
/* External inputs (root inport signals with auto storage) */
powerwindow_ExternalInputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_U;
/* External outputs (root outports fed by signals with auto storage) */
powerwindow_ExternalOutputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_Y;
/* Real-time model */
powerwindow_RT_MODEL_PW_Control_PSG_BackL powerwindow_PW_Control_PSG_BackL_M_;
powerwindow_RT_MODEL_PW_Control_PSG_BackL *const
powerwindow_PW_Control_PSG_BackL_M = &powerwindow_PW_Control_PSG_BackL_M_;
/* Model step function */
void
powerwindow_PW_Control_PSG_BackL_main(void) {
/* local block i/o variables */
powerwindow_boolean_T rtb_debounce_Up;
powerwindow_boolean_T rtb_debounce_Down;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_BackL_o1;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_BackL_o2;
/* ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_BackL_U.Up_PSG_BackL, &rtb_debounce_Up,
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtzce));
/* ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_BackL_U.Down_PSG_BackL, &rtb_debounce_Down,
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtzce));
/* ModelReference: '<S1>/ControlEx_PSG_BackL' */
powerwindow_controlexclusion_main(
&powerwindow_PW_Control_PSG_BackL_U.Up_DRV,
&powerwindow_PW_Control_PSG_BackL_U.Down_DRV, &rtb_debounce_Up,
&rtb_debounce_Down, &powerwindow_rtb_ControlEx_PSG_BackL_o1,
&powerwindow_rtb_ControlEx_PSG_BackL_o2);
/* ModelReference: '<S1>/PW_PSG_BackL' */
powerwindow_powerwindow_control_main(
&powerwindow_rtb_ControlEx_PSG_BackL_o1,
&powerwindow_rtb_ControlEx_PSG_BackL_o2,
&powerwindow_PW_Control_PSG_BackL_U.endofdetectionrange,
&powerwindow_PW_Control_PSG_BackL_U.currentsense,
&powerwindow_PW_Control_PSG_BackL_Y.window_up,
&powerwindow_PW_Control_PSG_BackL_Y.window_down,
&powerwindow_PW_Control_PSG_BackL_Y.overcurrent,
&powerwindow_PW_Control_PSG_BackL_Y.pinch,
&powerwindow_PW_Control_PSG_BackL_Y.wake,
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtzce));
}
/* Model initialize function */
void
powerwindow_PW_Control_PSG_BackL_initialize(void) {
/* Registration code */
/* initialize error status */
powerwindow_PW_PSG_BackL_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_BackL_M, (NULL));
/* states (dwork) */
(void) wcclib_memset((void *) &powerwindow_PW_Control_PSG_BackL_DWork, 0,
sizeof(powerwindow_D_Work_PW_Control_PSG_BackL));
/* external inputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_BackL_U, 0,
sizeof(powerwindow_ExternalInputs_PW_Control_PSG_BackL));
/* external outputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_BackL_Y, 0,
sizeof(powerwindow_ExternalOutputs_PW_Control_PSG_BackL));
/* Model Initialize fcn for ModelReference Block: '<S1>/ControlEx_PSG_BackL'
*/
powerwindow_controlexclusion_initialize();
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Down' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackL_M),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Up' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackL_M),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S1>/PW_PSG_BackL' */
powerwindow_powerwindow_control_initialize(
powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackL_M),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtzce));
/* Start for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtdw));
/* Start for ModelReference: '<S1>/PW_PSG_BackL' */
powerwindow_powerwindow_control_Start(
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S1>/PW_PSG_BackL' */
powerwindow_powerwindow_control_Init(
&powerwindow_PW_Control_PSG_BackL_Y.window_up,
&powerwindow_PW_Control_PSG_BackL_Y.window_down,
&powerwindow_PW_Control_PSG_BackL_Y.overcurrent,
&powerwindow_PW_Control_PSG_BackL_Y.pinch,
&powerwindow_PW_Control_PSG_BackL_Y.wake,
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtdw));
}
/* Model terminate function */
void
powerwindow_PW_Control_PSG_BackL_terminate(void) {
/* (no terminate code required) */
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,139 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackL.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackL_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackL_h_
#ifndef powerwindow_PW_Control_PSG_BackL_COMMON_INCLUDES_
#define powerwindow_PW_Control_PSG_BackL_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtw_solver.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* powerwindow_PW_Control_PSG_BackL_COMMON_INCLUDES_*/
#include "../powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Child system includes */
#include "../powerwindow_HeaderFiles/powerwindow_controlexclusion.h"
#include "../powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_PW_PSG_BackL_BackL_rtmGetErrorStatus
#define powerwindow_PW_PSG_BackL_rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef powerwindow_PW_PSG_BackL_rtmSetErrorStatus
#define powerwindow_PW_PSG_BackL_rtmSetErrorStatus(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#ifndef powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer
#define powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer(rtm) \
((const powerwindow_char_T **) (&((rtm)->errorStatus)))
#endif
/* Block states (auto storage) for system '<Root>' */
typedef struct {
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_DWORK1; /* '<S2>/Debounce_Up' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_DWORK1; /* '<S2>/Debounce_Down' */
powerwindow_rtMdlrefDWork_PowerWindow_contr
PW_PSG_BackL_DWORK1; /* '<S1>/PW_PSG_BackL' */
} powerwindow_D_Work_PW_Control_PSG_BackL;
/* External inputs (root inport signals with auto storage) */
typedef struct {
powerwindow_boolean_T Up_DRV; /* '<Root>/Up_DRV' */
powerwindow_boolean_T Down_DRV; /* '<Root>/Down_DRV' */
powerwindow_boolean_T
endofdetectionrange; /* '<Root>/end of detection range' */
powerwindow_uint8_T currentsense; /* '<Root>/current sense' */
powerwindow_boolean_T Up_PSG_BackL; /* '<Root>/Up_PSG_BackL' */
powerwindow_boolean_T Down_PSG_BackL; /* '<Root>/Down_PSG_BackL' */
} powerwindow_ExternalInputs_PW_Control_PSG_BackL;
/* External outputs (root outports fed by signals with auto storage) */
typedef struct {
powerwindow_boolean_T window_up; /* '<Root>/window_up' */
powerwindow_boolean_T window_down; /* '<Root>/window_down' */
powerwindow_boolean_T overcurrent; /* '<Root>/overcurrent' */
powerwindow_boolean_T pinch; /* '<Root>/pinch' */
powerwindow_boolean_T wake; /* '<Root>/wake' */
} powerwindow_ExternalOutputs_PW_Control_PSG_BackL;
/* Real-time Model Data Structure */
struct powerwindow_tag_RTM_PW_Control_PSG_BackL {
const powerwindow_char_T *volatile errorStatus;
};
/* Block states (auto storage) */
extern powerwindow_D_Work_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_DWork;
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_U;
/* External outputs (root outports fed by signals with auto storage) */
extern powerwindow_ExternalOutputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_Y;
/* Model entry point functions */
void powerwindow_PW_Control_PSG_BackL_initialize(void);
void powerwindow_PW_Control_PSG_BackL_main(void);
void powerwindow_PW_Control_PSG_BackL_terminate(void);
/* Real-time Model object */
extern powerwindow_RT_MODEL_PW_Control_PSG_BackL
*const powerwindow_PW_Control_PSG_BackL_M;
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Note that this particular code originates from a subsystem build,
and has its own system numbers different from the parent model.
Refer to the system hierarchy for this subsystem below, and use the
MATLAB hilite_system command to trace the generated code back
to the parent model. For example,
hilite_system('PowerWindow/PW_Control_PSG_BackL') - opens subsystem
PowerWindow/PW_Control_PSG_BackL
hilite_system('PowerWindow/PW_Control_PSG_BackL/Kp') - opens and selects
block Kp
Here is the system hierarchy for this model
'<Root>' : 'PowerWindow'
'<S1>' : 'PowerWindow/PW_Control_PSG_BackL'
'<S2>' : 'PowerWindow/PW_Control_PSG_BackL/Debounce_PSG_BackL'
*/
#endif /* RTW_HEADER_PW_Control_PSG_BackL_h_*/
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackL_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackL_private_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackL_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_PW_Control_PSG_BackL_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,34 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackL_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackL_types_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackL_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_PW_Control_PSG_BackL
powerwindow_RT_MODEL_PW_Control_PSG_BackL;
#endif /* RTW_HEADER_PW_Control_PSG_BackL_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,192 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackR.c
Author: CoSys-Lab, University of Antwerp
Function: PW_Control_DRV realizes the functionality of back-right passenger
side powerwindow. It connects the 3 smaller modules together.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow//powerwindow_PW_Control_PSG_BackR.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR_private.h"
#include "wcclib.h"
/*
Forward declaration of functions
*/
void powerwindow_PW_Control_PSG_BackR_initialize(void);
void powerwindow_PW_Control_PSG_BackR_terminate(void);
void powerwindow_PW_Control_PSG_BackR_main(void);
/* Block states (auto storage) */
powerwindow_D_Work_PW_Control_PSG_BackR powerwindow_PW_Control_PSG_BackR_DWork;
/* External inputs (root inport signals with auto storage) */
powerwindow_ExternalInputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_U;
/* External outputs (root outports fed by signals with auto storage) */
powerwindow_ExternalOutputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_Y;
/* Real-time model */
powerwindow_RT_MODEL_PW_Control_PSG_BackR powerwindow_PW_Control_PSG_BackR_M_;
powerwindow_RT_MODEL_PW_Control_PSG_BackR *const
powerwindow_PW_Control_PSG_BackR_M = &powerwindow_PW_Control_PSG_BackR_M_;
/* Model step function */
void
powerwindow_PW_Control_PSG_BackR_main(void) {
/* local block i/o variables */
powerwindow_boolean_T rtb_debounce_Up;
powerwindow_boolean_T rtb_debounce_Down;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_BackR_o1;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_BackR_o2;
/* ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_BackR_U.Up_PSG_BackR, &rtb_debounce_Up,
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtzce));
/* ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_BackR_U.Down_PSG_BackR, &rtb_debounce_Down,
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtzce));
/* ModelReference: '<S1>/ControlEx_PSG_BackR' */
powerwindow_controlexclusion_main(
&powerwindow_PW_Control_PSG_BackR_U.Up_DRV,
&powerwindow_PW_Control_PSG_BackR_U.Down_DRV, &rtb_debounce_Up,
&rtb_debounce_Down, &powerwindow_rtb_ControlEx_PSG_BackR_o1,
&powerwindow_rtb_ControlEx_PSG_BackR_o2);
/* ModelReference: '<S1>/PW_PSG_BackR' */
powerwindow_powerwindow_control_main(
&powerwindow_rtb_ControlEx_PSG_BackR_o1,
&powerwindow_rtb_ControlEx_PSG_BackR_o2,
&powerwindow_PW_Control_PSG_BackR_U.endofdetectionrange,
&powerwindow_PW_Control_PSG_BackR_U.currentsense,
&powerwindow_PW_Control_PSG_BackR_Y.window_up,
&powerwindow_PW_Control_PSG_BackR_Y.window_down,
&powerwindow_PW_Control_PSG_BackR_Y.overcurrent,
&powerwindow_PW_Control_PSG_BackR_Y.pinch,
&powerwindow_PW_Control_PSG_BackR_Y.wake,
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtzce));
}
/* Model initialize function */
void
powerwindow_PW_Control_PSG_BackR_initialize(void) {
/* Registration code */
/* initialize error status */
powerwindow_PW_PSG_BackR_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_BackR_M, (NULL));
/* states (dwork) */
(void) wcclib_memset((void *) &powerwindow_PW_Control_PSG_BackR_DWork, 0,
sizeof(powerwindow_D_Work_PW_Control_PSG_BackR));
/* external inputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_BackR_U, 0,
sizeof(powerwindow_ExternalInputs_PW_Control_PSG_BackR));
/* external outputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_BackR_Y, 0,
sizeof(powerwindow_ExternalOutputs_PW_Control_PSG_BackR));
/* Model Initialize fcn for ModelReference Block: '<S1>/ControlEx_PSG_BackR'
*/
powerwindow_controlexclusion_initialize();
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Down' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackR_M),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Up' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackR_M),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S1>/PW_PSG_BackR' */
powerwindow_powerwindow_control_initialize(
powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackR_M),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtzce));
/* Start for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtdw));
/* Start for ModelReference: '<S1>/PW_PSG_BackR' */
powerwindow_powerwindow_control_Start(
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S1>/PW_PSG_BackR' */
powerwindow_powerwindow_control_Init(
&powerwindow_PW_Control_PSG_BackR_Y.window_up,
&powerwindow_PW_Control_PSG_BackR_Y.window_down,
&powerwindow_PW_Control_PSG_BackR_Y.overcurrent,
&powerwindow_PW_Control_PSG_BackR_Y.pinch,
&powerwindow_PW_Control_PSG_BackR_Y.wake,
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtdw));
}
/* Model terminate function */
void
powerwindow_PW_Control_PSG_BackR_terminate(void) {
/* (no terminate code required) */
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,139 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackR.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackR_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackR_h_
#ifndef powerwindow_PW_Control_PSG_BackR_COMMON_INCLUDES_
#define powerwindow_PW_Control_PSG_BackR_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtw_solver.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* powerwindow_PW_Control_PSG_BackR_COMMON_INCLUDES_*/
#include "../powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Child system includes */
#include "../powerwindow_HeaderFiles/powerwindow_controlexclusion.h"
#include "../powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_PW_PSG_BackR_rtmGetErrorStatus
#define powerwindow_PW_PSG_BackR_rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef powerwindow_PW_PSG_BackR_rtmSetErrorStatus
#define powerwindow_PW_PSG_BackR_rtmSetErrorStatus(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#ifndef powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer
#define powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer(rtm) \
((const powerwindow_char_T **) (&((rtm)->errorStatus)))
#endif
/* Block states (auto storage) for system '<Root>' */
typedef struct {
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_DWORK1; /* '<S2>/Debounce_Up' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_DWORK1; /* '<S2>/Debounce_Down' */
powerwindow_rtMdlrefDWork_PowerWindow_contr
PW_PSG_BackR_DWORK1; /* '<S1>/PW_PSG_BackR' */
} powerwindow_D_Work_PW_Control_PSG_BackR;
/* External inputs (root inport signals with auto storage) */
typedef struct {
powerwindow_boolean_T Up_DRV; /* '<Root>/Up_DRV' */
powerwindow_boolean_T Down_DRV; /* '<Root>/Down_DRV' */
powerwindow_boolean_T
endofdetectionrange; /* '<Root>/end of detection range' */
powerwindow_uint8_T currentsense; /* '<Root>/current sense' */
powerwindow_boolean_T Up_PSG_BackR; /* '<Root>/Up_PSG_BackR' */
powerwindow_boolean_T Down_PSG_BackR; /* '<Root>/Down_PSG_BackR' */
} powerwindow_ExternalInputs_PW_Control_PSG_BackR;
/* External outputs (root outports fed by signals with auto storage) */
typedef struct {
powerwindow_boolean_T window_up; /* '<Root>/window_up' */
powerwindow_boolean_T window_down; /* '<Root>/window_down' */
powerwindow_boolean_T overcurrent; /* '<Root>/overcurrent' */
powerwindow_boolean_T pinch; /* '<Root>/pinch' */
powerwindow_boolean_T wake; /* '<Root>/wake' */
} powerwindow_ExternalOutputs_PW_Control_PSG_BackR;
/* Real-time Model Data Structure */
struct powerwindow_tag_RTM_PW_Control_PSG_BackR {
const powerwindow_char_T *volatile errorStatus;
};
/* Block states (auto storage) */
extern powerwindow_D_Work_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_DWork;
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_U;
/* External outputs (root outports fed by signals with auto storage) */
extern powerwindow_ExternalOutputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_Y;
/* Model entry point functions */
void powerwindow_PW_Control_PSG_BackR_initialize(void);
void powerwindow_PW_Control_PSG_BackR_main(void);
void powerwindow_PW_Control_PSG_BackR_terminate(void);
/* Real-time Model object */
extern powerwindow_RT_MODEL_PW_Control_PSG_BackR
*const powerwindow_PW_Control_PSG_BackR_M;
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Note that this particular code originates from a subsystem build,
and has its own system numbers different from the parent model.
Refer to the system hierarchy for this subsystem below, and use the
MATLAB hilite_system command to trace the generated code back
to the parent model. For example,
hilite_system('PowerWindow/PW_Control_PSG_BackR') - opens subsystem
PowerWindow/PW_Control_PSG_BackR
hilite_system('PowerWindow/PW_Control_PSG_BackR/Kp') - opens and selects
block Kp
Here is the system hierarchy for this model
'<Root>' : 'PowerWindow'
'<S1>' : 'PowerWindow/PW_Control_PSG_BackR'
'<S2>' : 'PowerWindow/PW_Control_PSG_BackR/Debounce_PSG'
*/
#endif /* RTW_HEADER_PW_Control_PSG_h_*/
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackR_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackR_private_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackR_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_PW_Control_PSG_BackR_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,34 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackR_tyoes.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackR_types_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackR_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_PW_Control_PSG_BackR
powerwindow_RT_MODEL_PW_Control_PSG_BackR;
#endif /* RTW_HEADER_PW_Control_PSG_BackR_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,198 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_Front.c
Author: CoSys-Lab, University of Antwerp
Function: PW_Control_DRV realizes the functionality of front passenger side
powerwindow. It connects the 3 smaller modules together.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow//powerwindow_powerwindow_control.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front_private.h"
#include "wcclib.h"
/*
Forward declaration of functions
*/
void powerwindow_PW_Control_PSG_Front_initialize(void);
void powerwindow_PW_Control_PSG_Front_terminate(void);
void powerwindow_PW_Control_PSG_Front_main(void);
/* Block states (auto storage) */
powerwindow_D_Work_PW_Control_PSG_Front powerwindow_PW_Control_PSG_Front_DWork;
/* External inputs (root inport signals with auto storage) */
powerwindow_ExternalInputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_U;
/* External outputs (root outports fed by signals with auto storage) */
powerwindow_ExternalOutputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_Y;
/* Real-time model */
powerwindow_RT_MODEL_PW_Control_PSG_Front powerwindow_PW_Control_PSG_Front_M_;
powerwindow_RT_MODEL_PW_Control_PSG_Front *const
powerwindow_PW_Control_PSG_Front_M = &powerwindow_PW_Control_PSG_Front_M_;
/* Model step function */
void
powerwindow_PW_Control_PSG_Front_main(void) {
/* local block i/o variables */
powerwindow_boolean_T rtb_debounce_Up;
powerwindow_boolean_T rtb_debounce_Down;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_Front_Front_o1;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_Front_Front_o2;
/* ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_Front_U.Up_PSG_Front, &rtb_debounce_Up,
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtzce));
/* ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_Front_U.Down_PSG_Front, &rtb_debounce_Down,
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtzce));
/* ModelReference: '<S1>/ControlEx_PSG_Front_Front' */
powerwindow_controlexclusion_main(
&powerwindow_PW_Control_PSG_Front_U.Up_DRV,
&powerwindow_PW_Control_PSG_Front_U.Down_DRV, &rtb_debounce_Up,
&rtb_debounce_Down, &powerwindow_rtb_ControlEx_PSG_Front_Front_o1,
&powerwindow_rtb_ControlEx_PSG_Front_Front_o2);
/* ModelReference: '<S1>/PW_PSG_Front_Front' */
powerwindow_powerwindow_control_main(
&powerwindow_rtb_ControlEx_PSG_Front_Front_o1,
&powerwindow_rtb_ControlEx_PSG_Front_Front_o2,
&powerwindow_PW_Control_PSG_Front_U.endofdetectionrange,
&powerwindow_PW_Control_PSG_Front_U.currentsense,
&powerwindow_PW_Control_PSG_Front_Y.window_up,
&powerwindow_PW_Control_PSG_Front_Y.window_down,
&powerwindow_PW_Control_PSG_Front_Y.overcurrent,
&powerwindow_PW_Control_PSG_Front_Y.pinch,
&powerwindow_PW_Control_PSG_Front_Y.wake,
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtzce));
}
/* Model initialize function */
void
powerwindow_PW_Control_PSG_Front_initialize(void) {
/* Registration code */
/* initialize error status */
powerwindow_PW_PSG_Front_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_Front_M, (NULL));
/* states (dwork) */
(void) wcclib_memset((void *) &powerwindow_PW_Control_PSG_Front_DWork, 0,
sizeof(powerwindow_D_Work_PW_Control_PSG_Front));
/* external inputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_Front_U, 0,
sizeof(powerwindow_ExternalInputs_PW_Control_PSG_Front));
/* external outputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_Front_Y, 0,
sizeof(powerwindow_ExternalOutputs_PW_Control_PSG_Front));
/* Model Initialize fcn for ModelReference Block:
* '<S1>/ControlEx_PSG_Front_Front' */
powerwindow_controlexclusion_initialize();
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Down' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_Front_M),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Up' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_Front_M),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S1>/PW_PSG_Front_Front'
*/
powerwindow_powerwindow_control_initialize(
powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_Front_M),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtzce));
/* Start for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtdw));
/* Start for ModelReference: '<S1>/PW_PSG_Front_Front' */
powerwindow_powerwindow_control_Start(&(
powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S1>/PW_PSG_Front_Front' */
powerwindow_powerwindow_control_Init(
&powerwindow_PW_Control_PSG_Front_Y.window_up,
&powerwindow_PW_Control_PSG_Front_Y.window_down,
&powerwindow_PW_Control_PSG_Front_Y.overcurrent,
&powerwindow_PW_Control_PSG_Front_Y.pinch,
&powerwindow_PW_Control_PSG_Front_Y.wake,
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtdw));
}
/* Model terminate function */
void
powerwindow_PW_Control_PSG_Front_terminate(void) {
/* (no terminate code required) */
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,139 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_Front.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_Front_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_Front_h_
#ifndef powerwindow_PW_Control_PSG_Front_COMMON_INCLUDES_
#define powerwindow_PW_Control_PSG_Front_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtw_solver.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* powerwindow_PW_Control_PSG_Front_COMMON_INCLUDES_*/
#include "../powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Child system includes */
#include "../powerwindow_HeaderFiles/powerwindow_controlexclusion.h"
#include "../powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_PW_PSG_Front_rtmGetErrorStatus
#define powerwindow_PW_PSG_Front_rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef powerwindow_PW_PSG_Front_rtmSetErrorStatus
#define powerwindow_PW_PSG_Front_rtmSetErrorStatus(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#ifndef powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer
#define powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer(rtm) \
((const powerwindow_char_T **) (&((rtm)->errorStatus)))
#endif
/* Block states (auto storage) for system '<Root>' */
typedef struct {
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_DWORK1; /* '<S2>/Debounce_Up' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_DWORK1; /* '<S2>/Debounce_Down' */
powerwindow_rtMdlrefDWork_PowerWindow_contr
PW_PSG_Front_Front_DWORK1; /* '<S1>/PW_PSG_Front_Front' */
} powerwindow_D_Work_PW_Control_PSG_Front;
/* External inputs (root inport signals with auto storage) */
typedef struct {
powerwindow_boolean_T Up_DRV; /* '<Root>/Up_DRV' */
powerwindow_boolean_T Down_DRV; /* '<Root>/Down_DRV' */
powerwindow_boolean_T
endofdetectionrange; /* '<Root>/end of detection range' */
powerwindow_uint8_T currentsense; /* '<Root>/current sense' */
powerwindow_boolean_T Up_PSG_Front; /* '<Root>/Up_PSG_Front' */
powerwindow_boolean_T Down_PSG_Front; /* '<Root>/Down_PSG_Front' */
} powerwindow_ExternalInputs_PW_Control_PSG_Front;
/* External outputs (root outports fed by signals with auto storage) */
typedef struct {
powerwindow_boolean_T window_up; /* '<Root>/window_up' */
powerwindow_boolean_T window_down; /* '<Root>/window_down' */
powerwindow_boolean_T overcurrent; /* '<Root>/overcurrent' */
powerwindow_boolean_T pinch; /* '<Root>/pinch' */
powerwindow_boolean_T wake; /* '<Root>/wake' */
} powerwindow_ExternalOutputs_PW_Control_PSG_Front;
/* Real-time Model Data Structure */
struct powerwindow_tag_RTM_PW_Control_PSG_Front {
const powerwindow_char_T *volatile errorStatus;
};
/* Block states (auto storage) */
extern powerwindow_D_Work_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_DWork;
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_U;
/* External outputs (root outports fed by signals with auto storage) */
extern powerwindow_ExternalOutputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_Y;
/* Model entry point functions */
void powerwindow_PW_Control_PSG_Front_initialize(void);
void powerwindow_PW_Control_PSG_Front_main(void);
void powerwindow_PW_Control_PSG_Front_terminate(void);
/* Real-time Model object */
extern powerwindow_RT_MODEL_PW_Control_PSG_Front
*const powerwindow_PW_Control_PSG_Front_M;
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Note that this particular code originates from a subsystem build,
and has its own system numbers different from the parent model.
Refer to the system hierarchy for this subsystem below, and use the
MATLAB hilite_system command to trace the generated code back
to the parent model. For example,
hilite_system('PowerWindow/PW_Control_PSG_Front') - opens subsystem
PowerWindow/PW_Control_PSG_Front
hilite_system('PowerWindow/PW_Control_PSG_Front/Kp') - opens and selects
block Kp
Here is the system hierarchy for this model
'<Root>' : 'PowerWindow'
'<S1>' : 'PowerWindow/PW_Control_PSG_Front'
'<S2>' : 'PowerWindow/PW_Control_PSG_Front/Debounce_PSG_Front_Front'
*/
#endif /* RTW_HEADER_PW_Control_PSG_Front_h_*/
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_Front_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_Front_private_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_Front_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_PW_Control_PSG_Front_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,34 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_Front_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_Front_types_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_Front_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_PW_Control_PSG_Front
powerwindow_RT_MODEL_PW_Control_PSG_Front;
#endif /* RTW_HEADER_PW_Control_PSG_Front_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,26 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_const_params.c
Author: CoSys-Lab, University of Antwerp
Function: the lookup table for stateflow chart in
powerwindow_powerwindow_control
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_const_params.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
extern const powerwindow_boolean_T powerwindow_rtCP_pooled_6bUUQf1tASYw[12];
const powerwindow_boolean_T powerwindow_rtCP_pooled_6bUUQf1tASYw[12] = {
1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0};

View File

@ -0,0 +1,89 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_controlexclusion
Author: CoSys-Lab, University of Antwerp
Function: powerwindow_controlexclusion is one functionality of the power
window benchmark. It takes the input signal from the driver and the passenger
to determine the final control signal.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_controlexclusion.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_controlexclusion.h"
#include "powerwindow_HeaderFiles/powerwindow_controlexclusion_private.h"
/*
Forward declaration of functions
*/
void powerwindow_controlexclusion_initialize(void);
void powerwindow_controlexclusion_terminate(void);
void
powerwindow_controlexclusion_main(const powerwindow_boolean_T *rtu_Up_DRV,
const powerwindow_boolean_T *rtu_Down_DRV,
const powerwindow_boolean_T *rtu_Up_PSG,
const powerwindow_boolean_T *rtu_Down_PSG,
powerwindow_boolean_T *rty_Up,
powerwindow_boolean_T *rty_Down);
/* Model initialize function */
void
powerwindow_controlexclusion_initialize(void) {
/* (no initialization code required) */
}
/* Model terminate function */
void
powerwindow_controlexclusion_terminate(void) {
/* (no terminate code required) */
}
/*
Algorithm core functions
*/
/* Output and update for referenced model: 'ControlExclusion' */
void
powerwindow_controlexclusion_main(const powerwindow_boolean_T *rtu_Up_DRV,
const powerwindow_boolean_T *rtu_Down_DRV,
const powerwindow_boolean_T *rtu_Up_PSG,
const powerwindow_boolean_T *rtu_Down_PSG,
powerwindow_boolean_T *rty_Up,
powerwindow_boolean_T *rty_Down) {
/* Logic: '<S2>/Logical Operator11' incorporates:
Logic: '<S2>/Logical Operator2'
Logic: '<S2>/Logical Operator3'
Logic: '<S2>/Logical Operator5'
Logic: '<S2>/Logical Operator6'
Logic: '<S2>/Logical Operator7'
*/
*rty_Up = !(((!*rtu_Up_DRV) && (*rtu_Down_DRV)) ||
((*rtu_Down_DRV) && (!*rtu_Up_PSG) && (*rtu_Down_PSG)));
/* Logic: '<S2>/Logical Operator12' incorporates:
Logic: '<S2>/Logical Operator1'
Logic: '<S2>/Logical Operator10'
Logic: '<S2>/Logical Operator4'
Logic: '<S2>/Logical Operator8'
Logic: '<S2>/Logical Operator9'
*/
*rty_Down = !(((*rtu_Up_DRV) && (!*rtu_Down_DRV)) ||
((*rtu_Up_DRV) && (*rtu_Up_PSG) && (!*rtu_Down_PSG)));
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,77 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_controlexclusion.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_controlexclusion.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_controlexclusion_h_
#define powerwindow_RTW_HEADER_controlexclusion_h_
#ifndef powerwindow_controlexclusion_COMMON_INCLUDES_
#define powerwindow_controlexclusion_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtw_solver.h"
#endif /* powerwindow_controlexclusion_COMMON_INCLUDES_ */
#include "../powerwindow_HeaderFiles/powerwindow_controlexclusion_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* user code (top of header file) */
/* Model reference registration function */
void powerwindow_controlexclusion_initialize(void);
void powerwindow_controlexclusion_terminate(void);
void
powerwindow_controlexclusion_main(const powerwindow_boolean_T *rtu_Up_DRV,
const powerwindow_boolean_T *rtu_Down_DRV,
const powerwindow_boolean_T *rtu_Up_PSG,
const powerwindow_boolean_T *rtu_Down_PSG,
powerwindow_boolean_T *rty_Up,
powerwindow_boolean_T *rty_Down);
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Use the MATLAB hilite_system command to trace the generated code back
to the model. For example,
hilite_system('<S3>') - opens system 3
hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
Here is the system hierarchy for this model
'<Root>' : 'ControlExclusion'
'<S1>' : 'ControlExclusion/Control_Clock_TicToc'
'<S2>' : 'ControlExclusion/Control_Clock_TicToc/ControlEx_PSG'
'<S3>' : 'ControlExclusion/Control_Clock_TicToc/Tic'
'<S4>' : 'powerwindow_controlexclusion_main/Control_Clock_TicToc/Toc'
'<S5>' : 'ControlExclusion/Control_Clock_TicToc/Tic/Tic_T'
'<S6>' : 'ControlExclusion/Control_Clock_TicToc/Toc/Toc_T'
*/
#endif /* RTW_HEADER_ControlExclusion_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_controlexclusion_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_controlexclusion_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_controlexclusion_private_h_
#define powerwindow_RTW_HEADER_controlexclusion_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_controlexclusion_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_controlexclusion_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_controlexclusion_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_controlexclusion_types_h_
#define powerwindow_RTW_HEADER_controlexclusion_types_h_
/* Forward declaration for rtModel */
#endif /* powerwindow_RTW_HEADER_controlexclusion_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,228 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_debounce.c
Author: CoSys-Lab, University of Antwerp
Function: powerwindow_debounce_main is used to powerwindow_debounce_main the
push-down button of the power window. In order to input a manual switch signal
into a digital circuit, debouncing is necessary so that a single press does
not appear like multiple presses. Without debouncing, pressing the button once
may cause unpredictable results. powerwindow_debounce_main.c defines all the
functions that will be used in debounce_PSG_Front which is a part of the Power
window.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_debounce.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "powerwindow_HeaderFiles/powerwindow_debounce_private.h"
#include "wcclib.h"
/* Named constants for Chart: '<Root>/Chart' */
#define debounce_IN_debounce ((powerwindow_uint8_T) 1U)
#define debounce_IN_NO_ACTIVE_CHILD ((powerwindow_uint8_T) 0U)
#define debounce_IN_Off ((powerwindow_uint8_T) 2U)
#define debounce_IN_Off_h ((powerwindow_uint8_T) 1U)
#define debounce_IN_On ((powerwindow_uint8_T) 3U)
#define debounce_IN_On_b ((powerwindow_uint8_T) 2U)
/*
Forward declaration of functions
*/
void powerwindow_debounce_Init(powerwindow_rtB_debounce_T *,
powerwindow_rtDW_debounce_T *);
void powerwindow_debounce_Start(powerwindow_rtDW_debounce_T *);
void powerwindow_debounce_initialize(const powerwindow_char_T **,
powerwindow_RT_MODEL_debounce_T *const,
powerwindow_rtB_debounce_T *,
powerwindow_rtDW_debounce_T *,
powerwindow_rtZCE_debounce_T *);
void powerwindow_debounce_main(const powerwindow_boolean_T *,
powerwindow_boolean_T *,
powerwindow_rtB_debounce_T *,
powerwindow_rtDW_debounce_T *,
powerwindow_rtZCE_debounce_T *);
/*
Initialization- and return-value-related functions
*/
/* Initial conditions for referenced model: 'powerwindow_debounce_main' */
void
powerwindow_debounce_Init(powerwindow_rtB_debounce_T *localB,
powerwindow_rtDW_debounce_T *localDW) {
/* InitializeConditions for Chart: '<Root>/Chart' */
localDW->is_debounce = debounce_IN_NO_ACTIVE_CHILD;
localDW->temporalCounter_i1 = 0U;
localDW->is_active_c3_debounce = 0U;
localDW->is_c3_debounce = debounce_IN_NO_ACTIVE_CHILD;
localB->Q = false;
}
/* Start for referenced model: 'powerwindow_debounce_main' */
void
powerwindow_debounce_Start(powerwindow_rtDW_debounce_T *localDW) {
/* Start for DiscretePulseGenerator: '<Root>/period of 10ms' */
localDW->clockTickCounter = 0L;
}
/* Model initialize function */
void
powerwindow_debounce_initialize(
const powerwindow_char_T **rt_errorStatus,
powerwindow_RT_MODEL_debounce_T *const debounce_M,
powerwindow_rtB_debounce_T *localB, powerwindow_rtDW_debounce_T *localDW,
powerwindow_rtZCE_debounce_T *localZCE) {
/* Registration code */
/* initialize error status */
powerwindow_rtmSetErrorStatusPointer(debounce_M, rt_errorStatus);
/* block I/O */
(void) wcclib_memset(((void *) localB), 0,
sizeof(powerwindow_rtB_debounce_T));
/* states (dwork) */
(void) wcclib_memset((void *) localDW, 0,
sizeof(powerwindow_rtDW_debounce_T));
localZCE->Chart_Trig_ZCE = powerwindow_POS_ZCSIG;
}
/*
Algorithm core functions
*/
/* Output and update for referenced model: 'powerwindow_debounce_main' */
void
powerwindow_debounce_main(const powerwindow_boolean_T *rtu_Switch,
powerwindow_boolean_T *rty_debounced_Switch,
powerwindow_rtB_debounce_T *localB,
powerwindow_rtDW_debounce_T *localDW,
powerwindow_rtZCE_debounce_T *localZCE) {
powerwindow_int16_T rtb_periodof10ms;
/* DiscretePulseGenerator: '<Root>/period of 10ms' */
rtb_periodof10ms =
(localDW->clockTickCounter < 1L) && (localDW->clockTickCounter >= 0L)
? 1
: 0;
if (localDW->clockTickCounter >= 1L)
localDW->clockTickCounter = 0L;
else
localDW->clockTickCounter++;
/* End of DiscretePulseGenerator: '<Root>/period of 10ms' */
/* Chart: '<Root>/Chart' incorporates:
TriggerPort: '<S1>/ticks'
*/
/* DataTypeConversion: '<Root>/Data Type Conversion' */
if ((rtb_periodof10ms != 0) &&
(localZCE->Chart_Trig_ZCE != powerwindow_POS_ZCSIG)) {
/* Gateway: Chart */
if (localDW->temporalCounter_i1 < 7U)
localDW->temporalCounter_i1++;
/* Event: '<S1>:13' */
/* During: Chart */
if (localDW->is_active_c3_debounce == 0U) {
/* Entry: Chart */
localDW->is_active_c3_debounce = 1U;
/* Entry Internal: Chart */
/* Transition: '<S1>:9' */
localDW->is_c3_debounce = debounce_IN_Off;
/* Entry 'Off': '<S1>:1' */
localB->Q = true;
} else {
switch (localDW->is_c3_debounce) {
case debounce_IN_debounce:
/* During 'powerwindow_debounce_main': '<S1>:6' */
if (localDW->is_debounce == debounce_IN_Off_h) {
/* During 'Off': '<S1>:8' */
if ((powerwindow_int16_T) *rtu_Switch < 1) {
/* Transition: '<S1>:12' */
localDW->is_debounce = debounce_IN_On_b;
localDW->temporalCounter_i1 = 0U;
} else {
if (localDW->temporalCounter_i1 >= 3) {
/* Transition: '<S1>:16' */
localDW->is_debounce = debounce_IN_NO_ACTIVE_CHILD;
localDW->is_c3_debounce = debounce_IN_Off;
/* Entry 'Off': '<S1>:1' */
localB->Q = true;
}
}
} else {
/* During 'On': '<S1>:7' */
if ((powerwindow_int16_T) *rtu_Switch > 0) {
/* Transition: '<S1>:11' */
localDW->is_debounce = debounce_IN_Off_h;
localDW->temporalCounter_i1 = 0U;
} else {
if (localDW->temporalCounter_i1 >= 3) {
/* Transition: '<S1>:14' */
localDW->is_debounce = debounce_IN_NO_ACTIVE_CHILD;
localDW->is_c3_debounce = debounce_IN_On;
/* Entry 'On': '<S1>:5' */
localB->Q = false;
}
}
}
break;
case debounce_IN_Off:
/* During 'Off': '<S1>:1' */
if ((powerwindow_int16_T) *rtu_Switch < 1) {
/* Transition: '<S1>:10' */
localDW->is_c3_debounce = debounce_IN_debounce;
localDW->is_debounce = debounce_IN_On_b;
localDW->temporalCounter_i1 = 0U;
}
break;
default:
/* During 'On': '<S1>:5' */
if ((powerwindow_int16_T) *rtu_Switch > 0) {
/* Transition: '<S1>:15' */
localDW->is_c3_debounce = debounce_IN_debounce;
localDW->is_debounce = debounce_IN_Off_h;
localDW->temporalCounter_i1 = 0U;
}
break;
}
}
}
localZCE->Chart_Trig_ZCE =
(powerwindow_uint8_T) (rtb_periodof10ms != 0
? (powerwindow_int16_T) powerwindow_POS_ZCSIG
: (powerwindow_int16_T)
powerwindow_ZERO_ZCSIG);
/* End of DataTypeConversion: '<Root>/Data Type Conversion' */
/* DataTypeConversion: '<Root>/Data Type Conversion2' */
*rty_debounced_Switch = localB->Q;
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,102 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_debounce.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_debounce.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_debounce_h_
#define powerwindow_RTW_HEADER_debounce_h_
#ifndef powerwindow_debounce_COMMON_INCLUDES_
#define powerwindow_debounce_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* debounce_COMMON_INCLUDES_ */
#include "../powerwindow_HeaderFiles/powerwindow_debounce_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Block signals for model 'powerwindow_debounce_main' */
typedef struct {
powerwindow_boolean_T Q; /* '<Root>/Chart' */
} powerwindow_rtB_debounce_T;
/* Block states (auto storage) for model 'powerwindow_debounce_main' */
typedef struct {
powerwindow_int32_T clockTickCounter; /* '<Root>/period of 10ms' */
powerwindow_uint8_T is_active_c3_debounce; /* '<Root>/Chart' */
powerwindow_uint8_T is_c3_debounce; /* '<Root>/Chart' */
powerwindow_uint8_T is_debounce; /* '<Root>/Chart' */
powerwindow_uint8_T temporalCounter_i1; /* '<Root>/Chart' */
} powerwindow_rtDW_debounce_T;
/* Zero-crossing (trigger) state for model 'powerwindow_debounce_main' */
typedef struct {
ZCSigState Chart_Trig_ZCE; /* '<Root>/Chart' */
} powerwindow_rtZCE_debounce_T;
/* Real-time Model Data Structure */
struct powerwindow_tag_RTM_debounce_T {
const powerwindow_char_T **errorStatus;
};
typedef struct {
powerwindow_rtB_debounce_T rtb;
powerwindow_rtDW_debounce_T rtdw;
powerwindow_RT_MODEL_debounce_T rtm;
powerwindow_rtZCE_debounce_T rtzce;
} powerwindow_rtMdlrefDWork_debounce_T;
/* Model reference registration function */
void powerwindow_debounce_initialize(
const powerwindow_char_T **rt_errorStatus,
powerwindow_RT_MODEL_debounce_T *const debounce_M,
powerwindow_rtB_debounce_T *localB, powerwindow_rtDW_debounce_T *localDW,
powerwindow_rtZCE_debounce_T *localZCE);
void powerwindow_debounce_Init(powerwindow_rtB_debounce_T *localB,
powerwindow_rtDW_debounce_T *localDW);
void powerwindow_debounce_Start(powerwindow_rtDW_debounce_T *localDW);
void powerwindow_debounce_main(const powerwindow_boolean_T *rtu_Switch,
powerwindow_boolean_T *rty_debounced_Switch,
powerwindow_rtB_debounce_T *localB,
powerwindow_rtDW_debounce_T *localDW,
powerwindow_rtZCE_debounce_T *localZCE);
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Use the MATLAB hilite_system command to trace the generated code back
to the model. For example,
hilite_system('<S3>') - opens system 3
hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
Here is the system hierarchy for this model
'<Root>' : 'powerwindow_debounce_main'
'<S1>' : 'powerwindow_debounce_main/Chart'
*/
#endif /* RTW_HEADER_debounce_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,49 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_debounce_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_debounce_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_debounce_private_h_
#define powerwindow_RTW_HEADER_debounce_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_rtmGetErrorStatus
#define powerwindow_rtmGetErrorStatus(rtm) (*((rtm)->errorStatus))
#endif
#ifndef powerwindow_rtmSetErrorStatus
#define powerwindow_rtmSetErrorStatus(rtm, val) (*((rtm)->errorStatus) = (val))
#endif
#ifndef powerwindow_rtmGetErrorStatusPointer
#define powerwindow_rtmGetErrorStatusPointer(rtm) (rtm)->errorStatus
#endif
#ifndef powerwindow_rtmSetErrorStatusPointer
#define powerwindow_rtmSetErrorStatusPointer(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#endif /* RTW_HEADER_debounce_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,33 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_debounce_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_debounce_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_debounce_types_h_
#define powerwindow_RTW_HEADER_debounce_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_debounce_T powerwindow_RT_MODEL_debounce_T;
#endif /* RTW_HEADER_debounce_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,52 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_model_reference_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_model_reference_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow___MODEL_REFERENCE_TYPES_H__
#define powerwindow___MODEL_REFERENCE_TYPES_H__
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#ifndef powerwindow___MODEL_REFERENCE_TYPES__
#define powerwindow___MODEL_REFERENCE_TYPES__
/*===========================================================================*
Model reference type definitions
===========================================================================*/
/*
This structure is used by model reference to
communicate timing information through the hierarchy.
*/
typedef struct powerwindow__rtTimingBridge_tag powerwindow_rtTimingBridge;
struct powerwindow__rtTimingBridge_tag {
powerwindow_uint32_T nTasks;
powerwindow_uint32_T **clockTick;
powerwindow_uint32_T **clockTickH;
powerwindow_uint32_T *taskCounter;
powerwindow_real_T **taskTime;
powerwindow_boolean_T **rateTransition;
powerwindow_boolean_T *firstInitCond;
};
#endif /* __MODEL_REFERENCE_TYPES__ */
#endif /* __MODEL_REFERENCE_TYPES_H__ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,591 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_powerwindow_control.c
Author: CoSys-Lab, University of Antwerp
Function: powerwindow_control is the main functionality of the power window
benchmark. It contains 3 states: System, EndReached and Pinch, which are used
to controll the position of the glass, if the window is fully closed and
sensing pinch force to realize the powerwindow function.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow//powerwindow_powerwindow_control.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_powerwindow_control.h"
#include "powerwindow_HeaderFiles/powerwindow_powerwindow_control_private.h"
#include "wcclib.h"
/* Named constants for Chart: '<S2>/stateflow control model' */
#define powerwindow_powerwindow__IN_NO_ACTIVE_CHILD ((powerwindow_uint8_T) 0U)
#define powerwindow_powerwindow_contr_IN_EndReached ((powerwindow_uint8_T) 1U)
#define powerwindow_powerwindow_contr_IN_SensePinch ((powerwindow_uint8_T) 2U)
#define powerwindow_powerwindow_control_IN_AutoDown ((powerwindow_uint8_T) 1U)
#define powerwindow_powerwindow_control_IN_AutoUp ((powerwindow_uint8_T) 1U)
#define powerwindow_powerwindow_control_IN_Down ((powerwindow_uint8_T) 2U)
#define powerwindow_powerwindow_control_IN_Down_d ((powerwindow_uint8_T) 1U)
#define powerwindow_powerwindow_control_IN_InitDown ((powerwindow_uint8_T) 3U)
#define powerwindow_powerwindow_control_IN_InitUp ((powerwindow_uint8_T) 2U)
#define powerwindow_powerwindow_control_IN_Neutral ((powerwindow_uint8_T) 2U)
#define powerwindow_powerwindow_control_IN_Pinch ((powerwindow_uint8_T) 2U)
#define powerwindow_powerwindow_control_IN_SenseEnd ((powerwindow_uint8_T) 1U)
#define powerwindow_powerwindow_control_IN_Start ((powerwindow_uint8_T) 3U)
#define powerwindow_powerwindow_control_IN_System ((powerwindow_uint8_T) 3U)
#define powerwindow_powerwindow_control_IN_Up ((powerwindow_uint8_T) 3U)
/* Forward declaration for local functions */
void powerwindow_powerwindow_control_Start(
powerwindow_rtDW_PowerWindow_control *localDW);
void powerwindow_powerwindow_control_Init(
powerwindow_boolean_T *rty_window_up,
powerwindow_boolean_T *rty_window_down,
powerwindow_boolean_T *rty_overcurrent, powerwindow_boolean_T *rty_pinch,
powerwindow_boolean_T *rty_wake,
powerwindow_rtDW_PowerWindow_control *localDW);
void powerwindow_powerwindow_control_Start(
powerwindow_rtDW_PowerWindow_control *localDW);
void powerwindow_powerwindow_control_initialize(
const powerwindow_char_T **rt_errorStatus,
powerwindow_RT_MODEL_PowerWindow_control *const PowerWindow_control_M,
powerwindow_rtB_PowerWindow_control *localB,
powerwindow_rtDW_PowerWindow_control *localDW,
powerwindow_rtZCE_PowerWindow_control *localZCE);
void powerwindow_powerwindow_control_main(
const powerwindow_boolean_T *rtu_up, const powerwindow_boolean_T *rtu_down,
const powerwindow_boolean_T *rtu_endofdetectionrange,
const powerwindow_uint8_T *rtu_currentsense,
powerwindow_boolean_T *rty_window_up,
powerwindow_boolean_T *rty_window_down,
powerwindow_boolean_T *rty_overcurrent, powerwindow_boolean_T *rty_pinch,
powerwindow_boolean_T *rty_wake,
powerwindow_rtB_PowerWindow_control *localB,
powerwindow_rtDW_PowerWindow_control *localDW,
powerwindow_rtZCE_PowerWindow_control *localZCE);
void powerwindow_powerwindow_con_broadcast_ticks(
powerwindow_boolean_T *rty_window_up,
powerwindow_boolean_T *rty_window_down,
powerwindow_boolean_T *rty_overcurrent, powerwindow_boolean_T *rty_pinch,
powerwindow_boolean_T *rty_wake,
powerwindow_rtB_PowerWindow_control *localB,
powerwindow_rtDW_PowerWindow_control *localDW);
/* Function for Chart: '<S2>/stateflow control model' */
void
powerwindow_powerwindow_con_broadcast_ticks(
powerwindow_boolean_T *rty_window_up,
powerwindow_boolean_T *rty_window_down,
powerwindow_boolean_T *rty_overcurrent, powerwindow_boolean_T *rty_pinch,
powerwindow_boolean_T *rty_wake,
powerwindow_rtB_PowerWindow_control *localB,
powerwindow_rtDW_PowerWindow_control *localDW) {
/* Event: '<S3>:30' */
/* During: PW_PSG/PWExternalClock/stateflow control model */
if (localDW->is_active_c2_PowerWindow_contro == 0U) {
/* Entry: PW_PSG/PWExternalClock/stateflow control model */
localDW->is_active_c2_PowerWindow_contro = 1U;
/* Entry Internal: PW_PSG/PWExternalClock/stateflow control model */
/* Transition: '<S3>:102' */
localDW->is_c2_PowerWindow_control =
powerwindow_powerwindow_control_IN_System;
/* Entry Internal 'System': '<S3>:94' */
localDW->is_active_Logic = 1U;
/* Entry Internal 'Logic': '<S3>:95' */
/* Transition: '<S3>:82' */
localDW->is_Logic = powerwindow_powerwindow_control_IN_Neutral;
/* Chart: '<S2>/stateflow control model' incorporates:
TriggerPort: '<S3>/ticks'
*/
/* Entry 'Neutral': '<S3>:16' */
*rty_window_up = false;
*rty_window_down = false;
*rty_wake = false;
localDW->is_active_Sensing = 1U;
/* Entry Internal 'Sensing': '<S3>:96' */
/* Transition: '<S3>:153' */
localDW->is_Sensing = powerwindow_powerwindow_control_IN_Start;
localDW->temporalCounter_i2 = 0U;
/* Chart: '<S2>/stateflow control model' incorporates:
TriggerPort: '<S3>/ticks'
*/
/* Entry 'Start': '<S3>:170' */
*rty_overcurrent = false;
*rty_pinch = false;
} else {
switch (localDW->is_c2_PowerWindow_control) {
case powerwindow_powerwindow_contr_IN_EndReached:
/* During 'EndReached': '<S3>:97' */
if (localDW->temporalCounter_i1 >= 10) {
/* Transition: '<S3>:101' */
localDW->is_c2_PowerWindow_control =
powerwindow_powerwindow_control_IN_System;
/* Entry Internal 'System': '<S3>:94' */
localDW->is_active_Logic = 1U;
/* Entry Internal 'Logic': '<S3>:95' */
/* Transition: '<S3>:82' */
localDW->is_Logic = powerwindow_powerwindow_control_IN_Neutral;
/* Chart: '<S2>/stateflow control model' incorporates:
TriggerPort: '<S3>/ticks'
*/
/* Entry 'Neutral': '<S3>:16' */
*rty_window_up = false;
*rty_window_down = false;
*rty_wake = false;
localDW->is_active_Sensing = 1U;
/* Entry Internal 'Sensing': '<S3>:96' */
/* Transition: '<S3>:153' */
localDW->is_Sensing = powerwindow_powerwindow_control_IN_Start;
localDW->temporalCounter_i2 = 0U;
/* Chart: '<S2>/stateflow control model' incorporates:
TriggerPort: '<S3>/ticks'
*/
/* Entry 'Start': '<S3>:170' */
*rty_overcurrent = false;
*rty_pinch = false;
}
break;
case powerwindow_powerwindow_control_IN_Pinch:
/* During 'Pinch': '<S3>:152' */
if (localDW->temporalCounter_i1 >= 40) {
/* Transition: '<S3>:157' */
localDW->is_c2_PowerWindow_control =
powerwindow_powerwindow_control_IN_System;
/* Entry Internal 'System': '<S3>:94' */
localDW->is_active_Logic = 1U;
/* Entry Internal 'Logic': '<S3>:95' */
/* Transition: '<S3>:82' */
localDW->is_Logic = powerwindow_powerwindow_control_IN_Neutral;
/* Chart: '<S2>/stateflow control model' incorporates:
TriggerPort: '<S3>/ticks'
*/
/* Entry 'Neutral': '<S3>:16' */
*rty_window_up = false;
*rty_window_down = false;
*rty_wake = false;
localDW->is_active_Sensing = 1U;
/* Entry Internal 'Sensing': '<S3>:96' */
/* Transition: '<S3>:153' */
localDW->is_Sensing = powerwindow_powerwindow_control_IN_Start;
localDW->temporalCounter_i2 = 0U;
/* Chart: '<S2>/stateflow control model' incorporates:
TriggerPort: '<S3>/ticks'
*/
/* Entry 'Start': '<S3>:170' */
*rty_overcurrent = false;
*rty_pinch = false;
}
break;
default:
/* Chart: '<S2>/stateflow control model' incorporates:
TriggerPort: '<S3>/ticks'
*/
/* During 'System': '<S3>:94' */
if (*rty_pinch == 1) {
/* Transition: '<S3>:155' */
/* Exit Internal 'System': '<S3>:94' */
/* Exit Internal 'Sensing': '<S3>:96' */
localDW->is_Sensing =
powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_active_Sensing = 0U;
/* Exit Internal 'Logic': '<S3>:95' */
/* Exit Internal 'Down': '<S3>:18' */
localDW->is_Down = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_Logic = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
/* Exit Internal 'Up': '<S3>:17' */
localDW->is_Up = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_active_Logic = 0U;
localDW->is_c2_PowerWindow_control =
powerwindow_powerwindow_control_IN_Pinch;
localDW->temporalCounter_i1 = 0U;
/* Entry 'Pinch': '<S3>:152' */
*rty_window_up = false;
*rty_window_down = true;
} else if (*rty_overcurrent == 1) {
/* Transition: '<S3>:100' */
/* Exit Internal 'System': '<S3>:94' */
/* Exit Internal 'Sensing': '<S3>:96' */
localDW->is_Sensing =
powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_active_Sensing = 0U;
/* Exit Internal 'Logic': '<S3>:95' */
/* Exit Internal 'Down': '<S3>:18' */
localDW->is_Down = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_Logic = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
/* Exit Internal 'Up': '<S3>:17' */
localDW->is_Up = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_active_Logic = 0U;
localDW->is_c2_PowerWindow_control =
powerwindow_powerwindow_contr_IN_EndReached;
localDW->temporalCounter_i1 = 0U;
/* Entry 'EndReached': '<S3>:97' */
*rty_window_up = false;
*rty_window_down = false;
} else {
/* During 'Logic': '<S3>:95' */
switch (localDW->is_Logic) {
case powerwindow_powerwindow_control_IN_Down_d:
/* During 'Down': '<S3>:18' */
if (localB->map[1]) {
/* Transition: '<S3>:169' */
/* Exit Internal 'Down': '<S3>:18' */
localDW->is_Down =
powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_Logic =
powerwindow_powerwindow_control_IN_Up;
/* Entry 'Up': '<S3>:17' */
*rty_window_up = true;
*rty_window_down = false;
*rty_wake = true;
localDW->is_Up = powerwindow_powerwindow_control_IN_Up;
} else {
switch (localDW->is_Down) {
case powerwindow_powerwindow_control_IN_AutoDown:
/* During 'AutoDown': '<S3>:111' */
break;
case powerwindow_powerwindow_control_IN_Down:
/* During 'Down': '<S3>:110' */
if (localB->map[0]) {
/* Transition: '<S3>:26' */
localDW->is_Down =
powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_Logic =
powerwindow_powerwindow_control_IN_Neutral;
/* Entry 'Neutral': '<S3>:16' */
*rty_window_up = false;
*rty_window_down = false;
*rty_wake = false;
}
break;
default:
/* During 'InitDown': '<S3>:109' */
if (localDW->temporalCounter_i1 >= 20) {
/* Transition: '<S3>:119' */
if (localB->map[0]) {
/* Transition: '<S3>:120' */
localDW->is_Down =
powerwindow_powerwindow_control_IN_AutoDown;
} else {
if (localB->map[2]) {
/* Transition: '<S3>:121' */
localDW->is_Down =
powerwindow_powerwindow_control_IN_Down;
}
}
}
break;
}
}
break;
case powerwindow_powerwindow_control_IN_Neutral:
/* During 'Neutral': '<S3>:16' */
if (localB->map[1]) {
/* Transition: '<S3>:24' */
localDW->is_Logic =
powerwindow_powerwindow_control_IN_Up;
/* Entry 'Up': '<S3>:17' */
*rty_window_up = true;
*rty_window_down = false;
*rty_wake = true;
localDW->is_Up =
powerwindow_powerwindow_control_IN_InitUp;
localDW->temporalCounter_i1 = 0U;
} else {
if (localB->map[2]) {
/* Transition: '<S3>:25' */
localDW->is_Logic =
powerwindow_powerwindow_control_IN_Down_d;
/* Entry 'Down': '<S3>:18' */
*rty_window_up = false;
*rty_window_down = true;
*rty_wake = true;
localDW->is_Down =
powerwindow_powerwindow_control_IN_InitDown;
localDW->temporalCounter_i1 = 0U;
}
}
break;
default:
/* During 'Up': '<S3>:17' */
if (localB->map[2]) {
/* Transition: '<S3>:166' */
/* Exit Internal 'Up': '<S3>:17' */
localDW->is_Up =
powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_Logic =
powerwindow_powerwindow_control_IN_Down_d;
/* Entry 'Down': '<S3>:18' */
*rty_window_up = false;
*rty_window_down = true;
*rty_wake = true;
localDW->is_Down =
powerwindow_powerwindow_control_IN_Down;
} else {
switch (localDW->is_Up) {
case powerwindow_powerwindow_control_IN_AutoUp:
/* During 'AutoUp': '<S3>:108' */
break;
case powerwindow_powerwindow_control_IN_InitUp:
/* During 'InitUp': '<S3>:106' */
if (localDW->temporalCounter_i1 >= 20) {
/* Transition: '<S3>:115' */
if (localB->map[0]) {
/* Transition: '<S3>:118' */
localDW->is_Up =
powerwindow_powerwindow_control_IN_AutoUp;
} else {
if (localB->map[1]) {
/* Transition: '<S3>:117' */
localDW->is_Up =
powerwindow_powerwindow_control_IN_Up;
}
}
}
break;
default:
/* During 'Up': '<S3>:107' */
if (localB->map[0]) {
/* Transition: '<S3>:23' */
localDW->is_Up =
powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_Logic =
powerwindow_powerwindow_control_IN_Neutral;
/* Entry 'Neutral': '<S3>:16' */
*rty_window_up = false;
*rty_window_down = false;
*rty_wake = false;
}
break;
}
}
break;
}
/* During 'Sensing': '<S3>:96' */
switch (localDW->is_Sensing) {
case powerwindow_powerwindow_control_IN_SenseEnd:
/* During 'SenseEnd': '<S3>:147' */
if ((localB->LogicalOperator == 0) &&
(*rty_window_up == 1)) {
/* Transition: '<S3>:173' */
localDW->is_Sensing =
powerwindow_powerwindow_control_IN_Start;
localDW->temporalCounter_i2 = 0U;
/* Entry 'Start': '<S3>:170' */
*rty_overcurrent = false;
*rty_pinch = false;
} else
*rty_overcurrent = (localB->RateTransition1 > 184);
break;
case powerwindow_powerwindow_contr_IN_SensePinch:
/* During 'SensePinch': '<S3>:148' */
if ((localB->LogicalOperator == 1) ||
(*rty_window_down == 1)) {
/* Transition: '<S3>:150' */
localDW->is_Sensing =
powerwindow_powerwindow_control_IN_SenseEnd;
} else
*rty_pinch = (localB->RateTransition1 > 92);
break;
default:
/* During 'Start': '<S3>:170' */
if (localDW->temporalCounter_i2 >= 6) {
/* Transition: '<S3>:171' */
localDW->is_Sensing =
powerwindow_powerwindow_contr_IN_SensePinch;
}
break;
}
}
break;
}
}
}
/* Initial conditions for referenced model: 'powerwindow_powerwindow_control' */
void
powerwindow_powerwindow_control_Init(
powerwindow_boolean_T *rty_window_up,
powerwindow_boolean_T *rty_window_down,
powerwindow_boolean_T *rty_overcurrent, powerwindow_boolean_T *rty_pinch,
powerwindow_boolean_T *rty_wake,
powerwindow_rtDW_PowerWindow_control *localDW) {
/* InitializeConditions for Chart: '<S2>/stateflow control model' */
localDW->is_active_Logic = 0U;
localDW->is_Logic = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_Down = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->is_Up = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->temporalCounter_i1 = 0U;
localDW->is_active_Sensing = 0U;
localDW->is_Sensing = powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
localDW->temporalCounter_i2 = 0U;
localDW->is_active_c2_PowerWindow_contro = 0U;
localDW->is_c2_PowerWindow_control =
powerwindow_powerwindow__IN_NO_ACTIVE_CHILD;
*rty_window_up = false;
*rty_window_down = false;
*rty_overcurrent = false;
*rty_pinch = false;
*rty_wake = false;
}
/* Start for referenced model: 'powerwindow_powerwindow_control' */
void
powerwindow_powerwindow_control_Start(
powerwindow_rtDW_PowerWindow_control *localDW) {
/* Start for DiscretePulseGenerator: '<S2>/period of 50ms' */
localDW->clockTickCounter = 0L;
}
/* Output and update for referenced model: 'powerwindow_powerwindow_control' */
void
powerwindow_powerwindow_control_main(
const powerwindow_boolean_T *rtu_up, const powerwindow_boolean_T *rtu_down,
const powerwindow_boolean_T *rtu_endofdetectionrange,
const powerwindow_uint8_T *rtu_currentsense,
powerwindow_boolean_T *rty_window_up,
powerwindow_boolean_T *rty_window_down,
powerwindow_boolean_T *rty_overcurrent, powerwindow_boolean_T *rty_pinch,
powerwindow_boolean_T *rty_wake,
powerwindow_rtB_PowerWindow_control *localB,
powerwindow_rtDW_PowerWindow_control *localDW,
powerwindow_rtZCE_PowerWindow_control *localZCE) {
powerwindow_int16_T rowIdx;
powerwindow_int16_T rtb_periodof50ms;
/* DiscretePulseGenerator: '<S2>/period of 50ms' */
rtb_periodof50ms =
(localDW->clockTickCounter < 5L) && (localDW->clockTickCounter >= 0L)
? 1
: 0;
if (localDW->clockTickCounter >= 9L)
localDW->clockTickCounter = 0L;
else
localDW->clockTickCounter++;
/* End of DiscretePulseGenerator: '<S2>/period of 50ms' */
/* Logic: '<S2>/Logical Operator' */
localB->LogicalOperator = !*rtu_endofdetectionrange;
/* RateTransition: '<S2>/Rate Transition1' */
localB->RateTransition1 = *rtu_currentsense;
/* CombinatorialLogic: '<S2>/map' */
rowIdx = (powerwindow_int16_T) (((powerwindow_uint16_T) *rtu_up << 1) +
*rtu_down);
localB->map[0U] = rtCP_map_table[(powerwindow_uint16_T) rowIdx];
localB->map[1U] = rtCP_map_table[rowIdx + 4U];
localB->map[2U] = rtCP_map_table[rowIdx + 8U];
/* Chart: '<S2>/stateflow control model' incorporates:
TriggerPort: '<S3>/ticks'
*/
/* DataTypeConversion: '<S2>/Data Type Conversion' */
if (((rtb_periodof50ms != 0) !=
(localZCE->stateflowcontrolmodel_Trig_ZCE == powerwindow_POS_ZCSIG)) &&
(localZCE->stateflowcontrolmodel_Trig_ZCE !=
powerwindow_UNINITIALIZED_ZCSIG)) {
/* Gateway: PW_PSG/PWExternalClock/stateflow control model */
if (localDW->temporalCounter_i1 < 63U)
localDW->temporalCounter_i1++;
if (localDW->temporalCounter_i2 < 7U)
localDW->temporalCounter_i2++;
powerwindow_powerwindow_con_broadcast_ticks(
rty_window_up, rty_window_down, rty_overcurrent, rty_pinch,
rty_wake, localB, localDW);
}
localZCE->stateflowcontrolmodel_Trig_ZCE =
(powerwindow_uint8_T) (rtb_periodof50ms != 0
? (powerwindow_int16_T) powerwindow_POS_ZCSIG
: (powerwindow_int16_T)
powerwindow_ZERO_ZCSIG);
/* End of DataTypeConversion: '<S2>/Data Type Conversion' */
}
/* Model initialize function */
void
powerwindow_powerwindow_control_initialize(
const powerwindow_char_T **rt_errorStatus,
powerwindow_RT_MODEL_PowerWindow_control *const PowerWindow_control_M,
powerwindow_rtB_PowerWindow_control *localB,
powerwindow_rtDW_PowerWindow_control *localDW,
powerwindow_rtZCE_PowerWindow_control *localZCE) {
/* Registration code */
/* initialize error status */
powerwindow_powerwindow_control_rtmSetErrorStatusPointer(
PowerWindow_control_M, rt_errorStatus);
/* block I/O */
(void) wcclib_memset(((void *) localB), 0,
sizeof(powerwindow_rtB_PowerWindow_control));
/* states (dwork) */
(void) wcclib_memset((void *) localDW, 0,
sizeof(powerwindow_rtDW_PowerWindow_control));
localZCE->stateflowcontrolmodel_Trig_ZCE = powerwindow_UNINITIALIZED_ZCSIG;
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,136 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_powerwindow_control.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_powerwindow_control.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PowerWindow_control_h_
#define powerwindow_RTW_HEADER_PowerWindow_control_h_
#ifndef powerwindow_powerWindow_control_COMMON_INCLUDES_
#define powerwindow_powerWindow_control_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtw_solver.h"
#endif /* PowerWindow_control_COMMON_INCLUDES_ */
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control_private.h"
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* user code (top of header file) */
/* Block signals for model 'PowerWindow_control' */
typedef struct {
powerwindow_uint8_T RateTransition1; /* '<S2>/Rate Transition1' */
powerwindow_boolean_T LogicalOperator; /* '<S2>/Logical Operator' */
powerwindow_boolean_T map[3]; /* '<S2>/map' */
} powerwindow_rtB_PowerWindow_control;
/* Block states (auto storage) for model 'PowerWindow_control' */
typedef struct {
powerwindow_int32_T clockTickCounter; /* '<S2>/period of 50ms' */
powerwindow_uint8_T
is_active_c2_PowerWindow_contro; /* '<S2>/stateflow control model' */
powerwindow_uint8_T
is_c2_PowerWindow_control; /* '<S2>/stateflow control model' */
powerwindow_uint8_T is_Up; /* '<S2>/stateflow control model' */
powerwindow_uint8_T is_Down; /* '<S2>/stateflow control model' */
powerwindow_uint8_T is_Logic; /* '<S2>/stateflow control model' */
powerwindow_uint8_T is_active_Logic; /* '<S2>/stateflow control model' */
powerwindow_uint8_T is_Sensing; /* '<S2>/stateflow control model' */
powerwindow_uint8_T is_active_Sensing; /* '<S2>/stateflow control model' */
powerwindow_uint8_T temporalCounter_i1; /* '<S2>/stateflow control model' */
powerwindow_uint8_T temporalCounter_i2; /* '<S2>/stateflow control model' */
} powerwindow_rtDW_PowerWindow_control;
/* Zero-crossing (trigger) state for model 'PowerWindow_control' */
typedef struct {
ZCSigState
stateflowcontrolmodel_Trig_ZCE; /* '<S2>/stateflow control model' */
} powerwindow_rtZCE_PowerWindow_control;
/* Real-time Model Data Structure */
struct powerwindow_tag_RTM_PowerWindow_control {
const powerwindow_char_T **errorStatus;
};
typedef struct {
powerwindow_rtB_PowerWindow_control rtb;
powerwindow_rtDW_PowerWindow_control rtdw;
powerwindow_RT_MODEL_PowerWindow_control rtm;
powerwindow_rtZCE_PowerWindow_control rtzce;
} powerwindow_rtMdlrefDWork_PowerWindow_contr;
/* Model reference registration function */
void powerwindow_powerwindow_control_initialize(
const powerwindow_char_T **rt_errorStatus,
powerwindow_RT_MODEL_PowerWindow_control *const PowerWindow_control_M,
powerwindow_rtB_PowerWindow_control *localB,
powerwindow_rtDW_PowerWindow_control *localDW,
powerwindow_rtZCE_PowerWindow_control *localZCE);
void powerwindow_powerwindow_control_Init(
powerwindow_boolean_T *rty_window_up,
powerwindow_boolean_T *rty_window_down,
powerwindow_boolean_T *rty_overcurrent, powerwindow_boolean_T *rty_pinch,
powerwindow_boolean_T *rty_wake,
powerwindow_rtDW_PowerWindow_control *localDW);
void powerwindow_powerwindow_control_Start(
powerwindow_rtDW_PowerWindow_control *localDW);
void powerwindow_powerwindow_control_main(
const powerwindow_boolean_T *rtu_up, const powerwindow_boolean_T *rtu_down,
const powerwindow_boolean_T *rtu_endofdetectionrange,
const powerwindow_uint8_T *rtu_currentsense,
powerwindow_boolean_T *rty_window_up,
powerwindow_boolean_T *rty_window_down,
powerwindow_boolean_T *rty_overcurrent, powerwindow_boolean_T *rty_pinch,
powerwindow_boolean_T *rty_wake,
powerwindow_rtB_PowerWindow_control *localB,
powerwindow_rtDW_PowerWindow_control *localDW,
powerwindow_rtZCE_PowerWindow_control *localZCE);
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Use the MATLAB hilite_system command to trace the generated code back
to the model. For example,
hilite_system('<S3>') - opens system 3
hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
Here is the system hierarchy for this model
'<Root>' : 'PowerWindow_control'
'<S1>' : 'PowerWindow_control/PW_PSG'
'<S2>' : 'PowerWindow_control/PW_PSG/PW_PSG'
'<S3>' : 'PowerWindow_control/PW_PSG/Tic'
'<S4>' : 'PowerWindow_control/PW_PSG/Toc'
'<S5>' : 'PowerWindow_control/PW_PSG/PW_PSG/stateflow control model'
'<S6>' : 'PowerWindow_control/PW_PSG/Tic/Tic_T'
'<S7>' : 'PowerWindow_control/PW_PSG/Toc/Toc_T'
*/
#endif /* powerwindow_RTW_HEADER_PowerWindow_control_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,59 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_powerwindow_control_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_powerwindow_control_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PowerWindow_control_private_h_
#define powerwindow_RTW_HEADER_PowerWindow_control_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_powerwindow_control_rtmGetErrorStatus
#define powerwindow_powerwindow_control_rtmGetErrorStatus(rtm) \
(*((rtm)->errorStatus))
#endif
#ifndef powerwindow_powerwindow_control_rtmSetErrorStatus
#define powerwindow_powerwindow_control_rtmSetErrorStatus(rtm, val) \
(*((rtm)->errorStatus) = (val))
#endif
#ifndef powerwindow_powerwindow_control_rtmGetErrorStatusPointer
#define powerwindow_powerwindow_control_rtmGetErrorStatusPointer(rtm) \
(rtm)->errorStatus
#endif
#ifndef powerwindow_powerwindow_control_rtmSetErrorStatusPointer
#define powerwindow_powerwindow_control_rtmSetErrorStatusPointer(rtm, val) \
((rtm)->errorStatus = (val))
#endif
extern const powerwindow_boolean_T powerwindow_rtCP_pooled_6bUUQf1tASYw[12];
#define rtCP_map_table \
powerwindow_rtCP_pooled_6bUUQf1tASYw /* Computed Parameter: map_table \
Referenced by: '<S2>/map' \
*/
#endif /* RTW_HEADER_PowerWindow_control_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,34 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_powerwindow_control_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_powerwindow_control_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_powerwindow_control_types_h_
#define powerwindow_RTW_HEADER_powerwindow_control_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_PowerWindow_control
powerwindow_RT_MODEL_PowerWindow_control;
#endif /* RTW_HEADER_powerwindow_control_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,127 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_rtw_continuous.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_rtw_continuous.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow___RTW_CONTINUOUS_H__
#define powerwindow___RTW_CONTINUOUS_H__
// #include "../powerwindow_HeaderFiles/powerwindow_tmwtypes.h"
/* For models registering MassMatrix */
typedef enum {
SS_MATRIX_NONE,
SS_MATRIX_CONSTANT,
SS_MATRIX_TIMEDEP,
SS_MATRIX_STATEDEP
} powerwindow_ssMatrixType;
typedef enum {
SOLVER_MODE_AUTO, /* only occurs in
mdlInitializeSizes/mdlInitializeSampleTimes */
SOLVER_MODE_SINGLETASKING,
SOLVER_MODE_MULTITASKING
} powerwindow_SolverMode;
typedef enum { MINOR_TIME_STEP, MAJOR_TIME_STEP } powerwindow_SimTimeStep;
/* =============================================================================
Model methods object
=============================================================================
*/
typedef void (*powerwindow_rtMdlInitializeSizesFcn)(void *rtModel);
typedef void (*powerwindow_rtMdlInitializeSampleTimesFcn)(void *rtModel);
typedef void (*powerwindow_rtMdlStartFcn)(void *rtModel);
typedef void (*powerwindow_rtMdlOutputsFcn)(void *rtModel,
powerwindow_int_T tid);
typedef void (*powerwindow_rtMdlUpdateFcn)(void *rtModel,
powerwindow_int_T tid);
typedef void (*powerwindow_rtMdlDerivativesFcn)(void *rtModel);
typedef void (*powerwindow_rtMdlProjectionFcn)(void *rtModel);
typedef void (*powerwindow_rtMdlMassMatrixFcn)(void *rtModel);
typedef void (*powerwindow_rtMdlForcingFunctionFcn)(void *rtModel);
typedef void (*powerwindow_rtMdlTerminateFcn)(void *rtModel);
#ifdef RT_MALLOC
typedef real_T (*rtMdlDiscreteEventsFcn)(
void *pModel, powerwindow_int_T rtmNumSampTimes, void *rtmTimingData,
powerwindow_int_T *rtmSampleHitPtr,
powerwindow_int_T *rtmPerTaskSampleHits);
#endif
typedef struct powerwindow__RTWRTModelMethodsInfo_tag {
void *rtModelPtr;
powerwindow_rtMdlInitializeSizesFcn rtmInitSizesFcn;
powerwindow_rtMdlInitializeSampleTimesFcn rtmInitSampTimesFcn;
powerwindow_rtMdlStartFcn rtmStartFcn;
powerwindow_rtMdlOutputsFcn rtmOutputsFcn;
powerwindow_rtMdlUpdateFcn rtmUpdateFcn;
powerwindow_rtMdlDerivativesFcn rtmDervisFcn;
powerwindow_rtMdlProjectionFcn rtmProjectionFcn;
powerwindow_rtMdlMassMatrixFcn rtmMassMatrixFcn;
powerwindow_rtMdlForcingFunctionFcn rtmForcingFunctionFcn;
powerwindow_rtMdlTerminateFcn rtmTerminateFcn;
#ifdef RT_MALLOC
rtMdlDiscreteEventsFcn rtmDiscreteEventsFcn;
#endif
} powerwindow_RTWRTModelMethodsInfo;
#define rtmiSetRTModelPtr(M, rtmp) ((M).rtModelPtr = (rtmp))
#define rtmiGetRTModelPtr(M) (M).rtModelPtr
#define rtmiSetInitSizesFcn(M, fp) \
((M).rtmInitSizesFcn = ((powerwindow_rtMdlInitializeSizesFcn) (fp)))
#define rtmiSetInitSampTimesFcn(M, fp) \
((M).rtmInitSampTimesFcn = \
((powerwindow_rtMdlInitializeSampleTimesFcn) (fp)))
#define rtmiSetStartFcn(M, fp) \
((M).rtmStartFcn = ((powerwindow_rtMdlStartFcn) (fp)))
#define rtmiSetOutputsFcn(M, fp) \
((M).rtmOutputsFcn = ((powerwindow_rtMdlOutputsFcn) (fp)))
#define rtmiSetUpdateFcn(M, fp) \
((M).rtmUpdateFcn = ((powerwindow_rtMdlUpdateFcn) (fp)))
#define rtmiSetDervisFcn(M, fp) \
((M).rtmDervisFcn = ((powerwindow_rtMdlDerivativesFcn) (fp)))
#define rtmiSetProjectionFcn(M, fp) \
((M).rtmProjectionFcn = ((powerwindow_rtMdlProjectionFcn) (fp)))
#define rtmiSetMassMatrixFcn(M, fp) \
((M).rtmMassMatrixFcn = ((powerwindow_rtMdlMassMatrixFcn) (fp)))
#define rtmiSetForcingFunctionFcn(M, fp) \
((M).rtmForcingFunctionFcn = ((powerwindow_rtMdlForcingFunctionFcn) (fp)))
#define rtmiSetTerminateFcn(M, fp) \
((M).rtmTerminateFcn = ((powerwindow_rtMdlTerminateFcn) (fp)))
#ifdef RT_MALLOC
#define rtmiSetDiscreteEventsFcn(M, fp) \
((M).rtmDiscreteEventsFcn = ((rtMdlDiscreteEventsFcn) (fp)))
#endif
#define rtmiInitializeSizes(M) ((*(M).rtmInitSizesFcn)((M).rtModelPtr))
#define rtmiInitializeSampleTimes(M) \
((*(M).rtmInitSampTimesFcn)((M).rtModelPtr))
#define rtmiStart(M) ((*(M).rtmStartFcn)((M).rtModelPtr))
#define rtmiOutputs(M, tid) ((*(M).rtmOutputsFcn)((M).rtModelPtr, tid))
#define rtmiUpdate(M, tid) ((*(M).rtmUpdateFcn)((M).rtModelPtr, tid))
#define rtmiDerivatives(M) ((*(M).rtmDervisFcn)((M).rtModelPtr))
#define rtmiProjection(M) ((*(M).rtmProjectionFcn)((M).rtModelPtr))
#define rtmiMassMatrix(M) ((*(M).rtmMassMatrixFcn)((M).rtModelPtr))
#define rtmiForcingFunction(M) ((*(M).rtmForcingFunctionFcn)((M).rtModelPtr))
#define rtmiTerminate(M) ((*(M).rtmTerminateFcn)((M).rtModelPtr))
#ifdef RT_MALLOC
#define rtmiDiscreteEvents(M, x1, x2, x3, x4) \
((*(M).rtmDiscreteEventsFcn)((M).rtModelPtr, (x1), (x2), (x3), (x4)))
#endif
#endif /* __RTW_CONTINUOUS_H__ */

View File

@ -0,0 +1,255 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_rtw_solver.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_rtw_solver.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow___RTW_SOLVER_H__
#define powerwindow___RTW_SOLVER_H__
/* =============================================================================
Solver object
=============================================================================
*/
#ifndef NO_FLOATS /* ERT integer-only */
/*
Enum for solver tolerance
*/
typedef enum {
SL_SOLVER_TOLERANCE_AUTO = 0, /* Set Automatically by Solver */
SL_SOLVER_TOLERANCE_LOCAL = 1, /* Set Locally, e.g., by Blocks */
SL_SOLVER_TOLERANCE_GLOBAL = 2, /* Set Globally, e.g., by Block Diagram */
SL_SOLVER_TOLERANCE_UNDEFINED = 255 /* Signal uninitialized */
} powerwindow_SL_SolverToleranceControlFlag_T;
/*
Enum for jacobian method control
*/
typedef enum {
SL_JM_BD_AUTO = 0,
SL_JM_BD_SPARSE_PERTURBATION,
SL_JM_BD_FULL_PERTURBATION,
SL_JM_BD_SPARSE_ANALYTICAL,
SL_JM_BD_FULL_ANALYTICAL
} powerwindow_slJmBdControl;
typedef struct _ssSolverInfo_tag {
void *rtModelPtr;
const char *solverName;
powerwindow_boolean_T isVariableStepSolver;
powerwindow_boolean_T solverNeedsReset;
powerwindow_time_T solverStopTime;
powerwindow_time_T *stepSizePtr;
powerwindow_time_T minStepSize;
powerwindow_time_T maxStepSize;
powerwindow_time_T fixedStepSize;
powerwindow_int_T solverShapePreserveControl;
powerwindow_int_T solverMaxConsecutiveMinStep;
powerwindow_int_T maxNumMinSteps;
powerwindow_int_T solverMaxOrder;
powerwindow_real_T solverConsecutiveZCsStepRelTol;
powerwindow_int_T solverMaxConsecutiveZCs;
powerwindow_int_T solverExtrapolationOrder;
powerwindow_int_T solverNumberNewtonIterations;
powerwindow_int_T solverRefineFactor;
powerwindow_real_T solverRelTol;
powerwindow_real_T unused_real_T_1;
powerwindow_real_T **dXPtr;
powerwindow_time_T **tPtr;
powerwindow_int_T *numContStatesPtr;
powerwindow_real_T **contStatesPtr;
powerwindow_real_T *zcSignalVector;
powerwindow_uint8_T *zcEventsVector;
powerwindow_uint8_T *zcSignalAttrib;
powerwindow_int_T zcSignalVectorLength;
powerwindow_uint8_T *reserved;
powerwindow_boolean_T foundContZcEvents;
powerwindow_boolean_T isAtLeftPostOfContZcEvent;
powerwindow_boolean_T isAtRightPostOfContZcEvent;
powerwindow_boolean_T adaptiveZcDetection;
powerwindow_int_T numZcSignals;
powerwindow_boolean_T stateProjection;
powerwindow_boolean_T robustResetMethod; /* user's preference */
powerwindow_boolean_T updateJacobianAtReset; /* S-Fcn request (sticky) */
powerwindow_boolean_T consistencyChecking;
powerwindow_int_T massMatrixNzMax;
powerwindow_int_T *massMatrixIr;
powerwindow_int_T *massMatrixJc;
powerwindow_real_T *massMatrixPr;
const powerwindow_char_T **errStatusPtr;
powerwindow_real_T zcThreshold;
powerwindow_int_T zeroCrossAlgorithm;
powerwindow_int_T consecutiveZCsError;
powerwindow_boolean_T isComputingJacobian;
powerwindow_slJmBdControl solverJacobianMethodControl;
powerwindow_int_T ignoredZcDiagnostic;
powerwindow_int_T maskedZcDiagnostic;
powerwindow_boolean_T isOutputMethodComputed;
} ssSolverInfo;
/* Support old name RTWSolverInfo */
typedef ssSolverInfo RTWSolverInfo;
#define rtsiSetRTModelPtr(S, rtmp) ((S)->rtModelPtr = (rtmp))
#define rtsiGetRTModelPtr(S) (S)->rtModelPtr
#define rtsiSetSimTimeStepPtr(S, stp) ((S)->simTimeStepPtr = (stp))
#define rtsiGetSimTimeStepPtr(S) ((S)->simTimeStepPtr)
#define rtsiGetSimTimeStep(S) *((S)->simTimeStepPtr)
#define rtsiSetSimTimeStep(S, st) (*((S)->simTimeStepPtr) = (st))
#define rtsiSetSolverData(S, sd) ((S)->solverData = (sd))
#define rtsiGetSolverData(S) (S)->solverData
#define rtsiSetSolverName(S, sn) ((S)->solverName = (sn))
#define rtsiGetSolverName(S) (S)->solverName
#define rtsiSetVariableStepSolver(S, vs) ((S)->isVariableStepSolver = (vs))
#define rtsiIsVariableStepSolver(S) (S)->isVariableStepSolver
#define rtsiSetSolverNeedsReset(S, sn) ((S)->solverNeedsReset = (sn))
#define rtsiGetSolverNeedsReset(S) (S)->solverNeedsReset
#define rtsiSetBlkStateChange(S, sn) ((S)->blkStateChange = (sn))
#define rtsiGetBlkStateChange(S) (S)->blkStateChange
#define rtsiSetSolverMode(S, sm) ((S)->solverMode = (sm))
#define rtsiGetSolverMode(S) (S)->solverMode
#define rtsiSetSolverStopTime(S, st) ((S)->solverStopTime = (st))
#define rtsiGetSolverStopTime(S) (S)->solverStopTime
#define rtsiSetStepSizePtr(S, ssp) ((S)->stepSizePtr = (ssp))
#define rtsiSetStepSize(S, ss) (*((S)->stepSizePtr) = (ss))
#define rtsiGetStepSize(S) *((S)->stepSizePtr)
#define rtsiSetMinStepSize(S, ss) (((S)->minStepSize = (ss)))
#define rtsiGetMinStepSize(S) (S)->minStepSize
#define rtsiSetMaxStepSize(S, ss) ((S)->maxStepSize = (ss))
#define rtsiGetMaxStepSize(S) (S)->maxStepSize
#define rtsiSetFixedStepSize(S, ss) ((S)->fixedStepSize = (ss))
#define rtsiGetFixedStepSize(S) (S)->fixedStepSize
#define rtsiSetMaxNumMinSteps(S, mns) ((S)->maxNumMinSteps = (mns))
#define rtsiGetMaxNumMinSteps(S) (S)->maxNumMinSteps
#define rtsiSetSolverMaxOrder(S, smo) ((S)->solverMaxOrder = (smo))
#define rtsiGetSolverMaxOrder(S) (S)->solverMaxOrder
#define rtsiSetSolverJacobianMethodControl(S, smcm) \
(ssGetSolverInfo(S)->solverJacobianMethodControl = (smcm))
#define rtsiGetSolverJacobianMethodControl(S) \
ssGetSolverInfo(S)->solverJacobianMethodControl
#define rtsiSetSolverShapePreserveControl(S, smcm) \
(ssGetSolverInfo(S)->solverShapePreserveControl = (smcm))
#define rtsiGetSolverShapePreserveControl(S) \
ssGetSolverInfo(S)->solverShapePreserveControl
#define rtsiSetSolverConsecutiveZCsStepRelTol(S, scr) \
(ssGetSolverInfo(S)->solverConsecutiveZCsStepRelTol = (scr))
#define rtsiGetSolverConsecutiveZCsStepRelTol(S) \
ssGetSolverInfo(S)->solverConsecutiveZCsStepRelTol
#define rtsiSetSolverMaxConsecutiveZCs(S, smcz) \
(ssGetSolverInfo(S)->solverMaxConsecutiveZCs = (smcz))
#define rtsiGetSolverMaxConsecutiveZCs(S) \
ssGetSolverInfo(S)->solverMaxConsecutiveZCs
#define rtsiSetSolverMaxConsecutiveMinStep(S, smcm) \
(ssGetSolverInfo(S)->solverMaxConsecutiveMinStep = (smcm))
#define rtsiGetSolverMaxConsecutiveMinStep(S) \
ssGetSolverInfo(S)->solverMaxConsecutiveMinStep
#define rtsiSetSolverExtrapolationOrder(S, seo) \
((S)->solverExtrapolationOrder = (seo))
#define rtsiGetSolverExtrapolationOrder(S) (S)->solverExtrapolationOrder
#define rtsiSetSolverNumberNewtonIterations(S, nni) \
((S)->solverNumberNewtonIterations = (nni))
#define rtsiGetSolverNumberNewtonIterations(S) (S)->solverNumberNewtonIterations
#define rtsiSetSolverRefineFactor(S, smo) ((S)->solverRefineFactor = (smo))
#define rtsiGetSolverRefineFactor(S) (S)->solverRefineFactor
#define rtsiSetSolverRelTol(S, smo) ((S)->solverRelTol = (smo))
#define rtsiGetSolverRelTol(S) (S)->solverRelTol
#define rtsiSetSolverMassMatrixType(S, type) ((S)->massMatrixType = (type))
#define rtsiGetSolverMassMatrixType(S) (S)->massMatrixType
#define rtsiSetSolverMassMatrixNzMax(S, nzMax) ((S)->massMatrixNzMax = (nzMax))
#define rtsiGetSolverMassMatrixNzMax(S) (S)->massMatrixNzMax
#define rtsiSetSolverMassMatrixIr(S, ir) ((S)->massMatrixIr = (ir))
#define rtsiGetSolverMassMatrixIr(S) (S)->massMatrixIr
#define rtsiSetSolverMassMatrixJc(S, jc) ((S)->massMatrixJc = (jc))
#define rtsiGetSolverMassMatrixJc(S) (S)->massMatrixJc
#define rtsiSetSolverMassMatrixPr(S, pr) ((S)->massMatrixPr = (pr))
#define rtsiGetSolverMassMatrixPr(S) (S)->massMatrixPr
#define rtsiSetdXPtr(S, dxp) ((S)->dXPtr = (dxp))
#define rtsiSetdX(S, dx) (*((S)->dXPtr) = (dx))
#define rtsiGetdX(S) *((S)->dXPtr)
#define rtsiSetTPtr(S, tp) ((S)->tPtr = (tp))
#define rtsiSetT(S, t) ((*((S)->tPtr))[0] = (t))
#define rtsiGetT(S) (*((S)->tPtr))[0]
#define rtsiSetContStatesPtr(S, cp) ((S)->contStatesPtr = (cp))
#define rtsiGetContStates(S) *((S)->contStatesPtr)
#define rtsiSetNumContStatesPtr(S, cp) ((S)->numContStatesPtr = (cp))
#define rtsiGetNumContStates(S) *((S)->numContStatesPtr)
#define rtsiSetErrorStatusPtr(S, esp) ((S)->errStatusPtr = (esp))
#define rtsiSetErrorStatus(S, es) (*((S)->errStatusPtr) = (es))
#define rtsiGetErrorStatus(S) *((S)->errStatusPtr)
#define rtsiSetModelMethodsPtr(S, mmp) ((S)->modelMethodsPtr = (mmp))
#define rtsiGetModelMethodsPtr(S) (S)->modelMethodsPtr
#define rtsiSetSolverComputingJacobian(S, val) \
((S)->isComputingJacobian = (val))
#define rtsiIsSolverComputingJacobian(S) (S)->isComputingJacobian
#define rtsiSetSolverOutputComputed(S, val) \
((S)->isOutputMethodComputed = (val))
#define rtsiIsSolverOutputComputed(S) (S)->isOutputMethodComputed
#endif /* !NO_FLOATS */
#endif /* powerwindow___RTW_SOLVER_H__ */

View File

@ -0,0 +1,201 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_rtwtypes.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_rtwtypes.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow__RTWTYPES_H__
#define powerwindow__RTWTYPES_H__
/* Logical type definitions */
#if (!defined(__cplusplus))
#ifndef false
#define false (0U)
#endif
#ifndef true
#define true (1U)
#endif
#endif
#define powerwindow__TMWTYPES__
/*=======================================================================*
Target hardware information
Number of bits: char: 8 short: 16 int: 16
long: 32
native word size: 8
Byte ordering: LittleEndian
Signed integer division rounds to: Zero
Shift right on a signed integer as arithmetic shift: on
=======================================================================*/
/*=======================================================================*
Fixed width word size data types:
powerwindow_int8_T, powerwindow_int16_T, powerwindow_int32_T - signed
8, 16, or 32 bit integers powerwindow_uint8_T, powerwindow_uint16_T,
powerwindow_uint32_T - unsigned 8, 16, or 32 bit integers
powerwindow_real32_T, powerwindow_real64_T - 32 and 64 bit
floating point numbers
=======================================================================*/
typedef signed char powerwindow_int8_T;
typedef unsigned char powerwindow_uint8_T;
typedef int powerwindow_int16_T;
typedef unsigned int powerwindow_uint16_T;
typedef long powerwindow_int32_T;
typedef unsigned long powerwindow_uint32_T;
typedef float powerwindow_real32_T;
typedef double powerwindow_real64_T;
/*===========================================================================*
Generic type definitions: powerwindow_real_T, powerwindow_time_T,
powerwindow_boolean_T, powerwindow_int_T, powerwindow_uint_T,
powerwindow_ulong_T, powerwindow_char_T and
powerwindow_byte_T.
===========================================================================*/
typedef double powerwindow_real_T;
typedef double powerwindow_time_T;
typedef unsigned char powerwindow_boolean_T;
typedef int powerwindow_int_T;
typedef unsigned int powerwindow_uint_T;
typedef unsigned long powerwindow_ulong_T;
typedef char powerwindow_char_T;
typedef unsigned char powerwindow_uchar_T;
typedef powerwindow_char_T powerwindow_byte_T;
/*===========================================================================*
Complex number type definitions
===========================================================================*/
#define powerwindow_CREAL_T
typedef struct {
powerwindow_real32_T re;
powerwindow_real32_T im;
} powerwindow_creal32_T;
typedef struct {
powerwindow_real64_T re;
powerwindow_real64_T im;
} powerwindow_creal64_T;
typedef struct {
powerwindow_real_T re;
powerwindow_real_T im;
} powerwindow_creal_T;
#define powerwindow_CINT8_T
typedef struct {
powerwindow_int8_T re;
powerwindow_int8_T im;
} powerwindow_cint8_T;
#define powerwindow_CUINT8_T
typedef struct {
powerwindow_uint8_T re;
powerwindow_uint8_T im;
} powerwindow_cuint8_T;
#define powerwindow_CINT16_T
typedef struct {
powerwindow_int16_T re;
powerwindow_int16_T im;
} powerwindow_cint16_T;
#define powerwindow_CUINT16_T
typedef struct {
powerwindow_uint16_T re;
powerwindow_uint16_T im;
} powerwindow_cuint16_T;
#define powerwindow_CINT32_T
typedef struct {
powerwindow_int32_T re;
powerwindow_int32_T im;
} powerwindow_cint32_T;
#define powerwindow_CUINT32_T
typedef struct {
powerwindow_uint32_T re;
powerwindow_uint32_T im;
} powerwindow_cuint32_T;
/*=======================================================================*
Min and Max:
powerwindow_int8_T, powerwindow_int16_T, powerwindow_int32_T - signed
8, 16, or 32 bit integers powerwindow_uint8_T, powerwindow_uint16_T,
powerwindow_uint32_T - unsigned 8, 16, or 32 bit integers
=======================================================================*/
#define powerwindow_MAX_int8_T ((powerwindow_int8_T) (127))
#define powerwindow_MIN_int8_T ((powerwindow_int8_T) (-128))
#define powerwindow_MAX_uint8_T ((powerwindow_uint8_T) (255U))
#define powerwindow_MIN_uint8_T ((powerwindow_uint8_T) (0U))
#define powerwindow_MAX_int16_T ((powerwindow_int16_T) (32767))
#define powerwindow_MIN_int16_T ((powerwindow_int16_T) (-32768))
#define powerwindow_MAX_uint16_T ((powerwindow_uint16_T) (65535U))
#define powerwindow_MIN_uint16_T ((powerwindow_uint16_T) (0U))
#define powerwindow_MAX_int32_T ((powerwindow_int32_T) (2147483647))
#define powerwindow_MIN_int32_T ((powerwindow_int32_T) (-2147483647 - 1))
#define powerwindow_MAX_uint32_T ((powerwindow_uint32_T) (0xFFFFFFFFU))
#define powerwindow_MIN_uint32_T ((powerwindow_uint32_T) (0U))
/* Block D-Work pointer type */
typedef void *powerwindow_pointer_T;
#define powerwindow_input_length 977
/* Simulink specific types */
#ifndef powerwindow___ZERO_CROSSING_TYPES__
#define powerwindow___ZERO_CROSSING_TYPES__
/* Trigger directions: falling, either, and rising */
typedef enum {
FALLING_ZERO_CROSSING = -1,
ANY_ZERO_CROSSING = 0,
RISING_ZERO_CROSSING = 1
} powerwindow_ZCDirection;
/* Previous state of a trigger signal */
typedef powerwindow_uint8_T ZCSigState;
/* Initial value of a trigger zero crossing signal */
#define powerwindow_UNINITIALIZED_ZCSIG 0x03U
#define powerwindow_NEG_ZCSIG 0x02U
#define powerwindow_POS_ZCSIG 0x01U
#define powerwindow_ZERO_ZCSIG 0x00U
/* Current state of a trigger signal */
typedef enum {
FALLING_ZCEVENT = -1,
NO_ZCEVENT = 0,
RISING_ZCEVENT = 1
} powerwindow_ZCEventType;
#endif /* powerwindow___ZERO_CROSSING_TYPES__ */
#endif /* powerwindow__RTWTYPES_H__ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,813 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_tmwtypes.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_tmwtypes.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#if defined(_MSC_VER)
#pragma once
#endif
#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3))
#pragma once
#endif
#ifndef powerwindow_tmwtypes_h
#define powerwindow_tmwtypes_h
#ifndef powerwindow__TMWTYPES__
#define powerwindow__TMWTYPES__
/*
File : tmwtypes.h
Abstract:
Data types for use with MATLAB/SIMULINK and the Real-Time Workshop.
When compiling stand-alone model code, data types can be overridden
via compiler switches.
Define NO_FLOATS to eliminate reference to powerwindow_real_T, etc.
*/
#define LOGICAL_IS_A_TYPE
#define SPARSE_GENERALIZATION
#ifdef NO_FLOATS
#define double double_not_allowed
#define float float_not_allowed
#endif /*NO_FLOATS*/
/*
The following data types cannot be overridden when building MEX files.
*/
#ifdef MATLAB_MEX_FILE
#undef CHARACTER_T
#undef INTEGER_T
#undef BOOLEAN_T
#undef REAL_T
#undef TIME_T
#endif
/*
The powerwindow_uchar_T, powerwindow_ushort_T and powerwindow_ulong_T types
are needed for compilers which do not allow defines to be specified, at the
command line, with spaces in them.
*/
typedef unsigned char powerwindow_uchar_T;
typedef unsigned short powerwindow_ushort_T;
typedef unsigned long powerwindow_ulong_T;
#if (defined(_MSC_VER) && _MSC_VER >= 1500) || defined(__x86_64__) || \
defined(__LP64__) || defined(__LCC64__)
typedef unsigned long long powerwindow_ulonglong_T;
#endif
/*=======================================================================*
Fixed width word size data types:
powerwindow_int8_T, powerwindow_int16_T, powerwindow_int32_T - signed
8, 16, or 32 bit integers powerwindow_uint8_T, powerwindow_uint16_T,
powerwindow_uint32_T - unsigned 8, 16, or 32 bit integers
powerwindow_real32_T, powerwindow_real64_T - 32 and 64 bit
floating point numbers
=======================================================================*/
/* When used with Real Time Workshop generated code, this
header file can be used with a variety of compilers.
The compiler could be for an 8 bit embedded processor that
only had 8 bits per integer and 16 bits per long.
In that example, a 32 bit integer size is not even available.
This header file should be robust to that.
For the case of an 8 bit processor, the preprocessor
may be limited to 16 bit math like its target. That limitation
would mean that 32 bit comparisons can't be done accurately.
To increase robustness to this, comparisons are done against
smaller values first. An inaccurate 32 bit comparison isn't
attempted if the 16 bit comparison has already succeeded.
Limitations on preprocessor math can also be stricter than
for the target. There are known cases where a compiler
targeting processors with 64 bit longs can't do accurate
preprocessor comparisons on more than 32 bits.
*/
/* Determine the number of bits for int, long, short, and char.
If one fails to be determined, set the number of bits to -1
*/
#ifndef TMW_BITS_PER_INT
#if INT_MAX == 0x7FL
#define TMW_BITS_PER_INT 8
#elif INT_MAX == 0x7FFFL
#define TMW_BITS_PER_INT 16
#elif INT_MAX == 0x7FFFFFFFL
#define TMW_BITS_PER_INT 32
#else
#define TMW_BITS_PER_INT -1
#endif
#endif
#ifndef TMW_BITS_PER_LONG
#if LONG_MAX == 0x7FL
#define TMW_BITS_PER_LONG 8
#elif LONG_MAX == 0x7FFFL
#define TMW_BITS_PER_LONG 16
#elif LONG_MAX == 0x7FFFFFFFL
#define TMW_BITS_PER_LONG 32
#else
#define TMW_BITS_PER_LONG -1
#endif
#endif
#ifndef TMW_BITS_PER_SHRT
#if SHRT_MAX == 0x7FL
#define TMW_BITS_PER_SHRT 8
#elif SHRT_MAX == 0x7FFFL
#define TMW_BITS_PER_SHRT 16
#elif SHRT_MAX == 0x7FFFFFFFL
#define TMW_BITS_PER_SHRT 32
#else
#define TMW_BITS_PER_SHRT -1
#endif
#endif
#ifndef TMW_BITS_PER_SCHAR
#if SCHAR_MAX == 0x7FL
#define TMW_BITS_PER_SCHAR 8
#elif SCHAR_MAX == 0x7FFFL
#define TMW_BITS_PER_SCHAR 16
#elif SCHAR_MAX == 0x7FFFFFFFL
#define TMW_BITS_PER_SCHAR 32
#else
#define TMW_BITS_PER_SCHAR -1
#endif
#endif
#ifndef TMW_CHAR_SIGNED
#if SCHAR_MAX == CHAR_MAX
#define TMW_CHAR_SIGNED 1
#else
#define TMW_CHAR_SIGNED 0
#endif
#endif
/* It is common for one or more of the integer types
to be the same size. For example, on many embedded
processors, both shorts and ints are 16 bits. On
processors used for workstations, it is quite common
for both int and long to be 32 bits.
When there is more than one choice for typdef'ing
a portable type like powerwindow_int16_T or powerwindow_uint32_T, in
concept, it should not matter which choice is made.
However, some style guides and some code checking
tools do identify and complain about seemingly
irrelevant differences. For example, a code
checking tool may complain about an implicit
conversion from int to short even though both
are 16 bits. To reduce these types of
complaints, it is best to make int the
preferred choice when more than one is available.
*/
#ifndef INT8_T
#if TMW_BITS_PER_INT == 8
#define INT8_T int
#elif TMW_BITS_PER_LONG == 8
#define INT8_T long
#elif TMW_BITS_PER_SCHAR == 8
#define INT8_T signed char
#elif TMW_BITS_PER_SHRT == 8
#define INT8_T short
#endif
#endif
#ifdef INT8_T
typedef INT8_T powerwindow_int8_T;
#endif
#ifndef UINT8_T
#if TMW_BITS_PER_INT == 8
#define UINT8_T unsigned int
#elif TMW_BITS_PER_LONG == 8
#define UINT8_T unsigned long
#elif TMW_BITS_PER_SCHAR == 8
#define UINT8_T unsigned char
#elif TMW_BITS_PER_SHRT == 8
#define UINT8_T unsigned short
#endif
#endif
#ifdef UINT8_T
typedef UINT8_T powerwindow_uint8_T;
#endif
#ifndef INT16_T
#if TMW_BITS_PER_INT == 16
#define INT16_T int
#elif TMW_BITS_PER_LONG == 16
#define INT16_T long
#elif TMW_BITS_PER_SCHAR == 16
#define INT16_T signed char
#elif TMW_BITS_PER_SHRT == 16
#define INT16_T short
#endif
#endif
#ifdef INT16_T
typedef INT16_T powerwindow_int16_T;
#endif
#ifndef UINT16_T
#if TMW_BITS_PER_INT == 16
#define UINT16_T unsigned int
#elif TMW_BITS_PER_LONG == 16
#define UINT16_T unsigned long
#elif TMW_BITS_PER_SCHAR == 16
#define UINT16_T unsigned char
#elif TMW_BITS_PER_SHRT == 16
#define UINT16_T unsigned short
#endif
#endif
#ifdef UINT16_T
typedef UINT16_T powerwindow_uint16_T;
#endif
#ifndef INT32_T
#if TMW_BITS_PER_INT == 32
#define INT32_T int
#elif TMW_BITS_PER_LONG == 32
#define INT32_T long
#elif TMW_BITS_PER_SCHAR == 32
#define INT32_T signed char
#elif TMW_BITS_PER_SHRT == 32
#define INT32_T short
#endif
#endif
#ifdef INT32_T
typedef INT32_T powerwindow_int32_T;
#endif
#ifndef UINT32_T
#if TMW_BITS_PER_INT == 32
#define UINT32_T unsigned int
#elif TMW_BITS_PER_LONG == 32
#define UINT32_T unsigned long
#elif TMW_BITS_PER_SCHAR == 32
#define UINT32_T unsigned char
#elif TMW_BITS_PER_SHRT == 32
#define UINT32_T unsigned short
#endif
#endif
#ifdef UINT32_T
typedef UINT32_T powerwindow_uint32_T;
#endif
/* The following is used to emulate smaller integer types when only
larger types are available. For example, compilers for TI C3x/C4x DSPs
define char and short to be 32 bits, so 8 and 16 bits are not directly
available. This target is commonly used with RTW rapid prototyping.
Other DSPs define char to be 16 bits, so 8 bits is not directly
available.
*/
#ifndef INT8_T
#ifdef INT16_T
#define INT8_T INT16_T
typedef INT8_T powerwindow_int8_T;
#else
#ifdef INT32_T
#define INT8_T INT32_T
typedef INT8_T powerwindow_int8_T;
#endif
#endif
#endif
#ifndef UINT8_T
#ifdef UINT16_T
#define UINT8_T UINT16_T
typedef UINT8_T powerwindow_uint8_T;
#else
#ifdef UINT32_T
#define UINT8_T UINT32_T
typedef UINT8_T powerwindow_uint8_T;
#endif
#endif
#endif
#ifndef INT16_T
#ifdef INT32_T
#define INT16_T INT32_T
typedef INT16_T powerwindow_int16_T;
#endif
#endif
#ifndef UINT16_T
#ifdef UINT32_T
#define UINT16_T UINT32_T
typedef UINT16_T powerwindow_uint16_T;
#endif
#endif
#ifndef NO_FLOATS
#ifndef REAL32_T
#ifndef __MWERKS__
#if FLT_MANT_DIG >= 23
#define REAL32_T float
#endif
#else
#define REAL32_T float
#endif
#endif
#ifdef REAL32_T
typedef REAL32_T powerwindow_real32_T;
#endif
#ifndef REAL64_T
#ifndef __MWERKS__
#if DBL_MANT_DIG >= 52
#define REAL64_T double
#endif
#else
#define REAL64_T double
#endif
#endif
#ifdef REAL64_T
typedef REAL64_T powerwindow_real64_T;
#endif
#endif /* NO_FLOATS*/
/*=======================================================================*
Fixed width word size data types:
powerwindow_int64_T - signed 64 bit integers
powerwindow_uint64_T - unsigned 64 bit integers
=======================================================================*/
#ifndef INT64_T
#if defined(__APPLE__)
#define INT64_T long long
#define FMT64 "ll"
#if defined(__LP64__) && !defined(INT_TYPE_64_IS_LONG)
#define INT_TYPE_64_IS_LONG
#endif
#elif defined(__x86_64__) || defined(__LP64__)
#define INT64_T long
#define FMT64 "l"
#if !defined(INT_TYPE_64_IS_LONG)
#define INT_TYPE_64_IS_LONG
#endif
#elif defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) || \
(defined(__WATCOMC__) && __WATCOMC__ >= 1100)
#define INT64_T __int64
#define FMT64 "I64"
#elif defined(__GNUC__) || defined(TMW_ENABLE_INT64) || defined(__LCC64__)
#define INT64_T long long
#define FMT64 "ll"
#endif
#endif
#if defined(INT64_T)
#if defined(__GNUC__) && \
((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9)))
__extension__
#endif
typedef INT64_T powerwindow_int64_T;
#endif
#ifndef UINT64_T
#if defined(__APPLE__)
#define UINT64_T unsigned long long
#define FMT64 "ll"
#if defined(__LP64__) && !defined(INT_TYPE_64_IS_LONG)
#define INT_TYPE_64_IS_LONG
#endif
#elif defined(__x86_64__) || defined(__LP64__)
#define UINT64_T unsigned long
#define FMT64 "l"
#if !defined(INT_TYPE_64_IS_LONG)
#define INT_TYPE_64_IS_LONG
#endif
#elif defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) || \
(defined(__WATCOMC__) && __WATCOMC__ >= 1100)
#define UINT64_T unsigned __int64
#define FMT64 "I64"
#elif defined(__GNUC__) || defined(TMW_ENABLE_INT64) || defined(__LCC64__)
#define UINT64_T unsigned long long
#define FMT64 "ll"
#endif
#endif
#if defined(_WIN64) || (defined(__APPLE__) && defined(__LP64__)) || \
defined(__x86_64__) || defined(__LP64__)
#define INT_TYPE_64_IS_SUPPORTED
#endif
#if defined(UINT64_T)
#if defined(__GNUC__) && \
((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9)))
__extension__
#endif
typedef UINT64_T powerwindow_uint64_T;
#endif
/*===========================================================================*
Format string modifiers for using powerwindow_size_t variables in printf
statements.
===========================================================================*/
#ifndef FMT_SIZE_T
#if defined(__GNUC__) || defined(_STDC_C99)
#define FMT_SIZE_T "z"
#elif defined(__WATCOMC__)
#define FMT_SIZE_T "l"
#elif defined(_WIN32)
#define FMT_SIZE_T "I"
#else
#define FMT_SIZE_T "l"
#endif
#endif
#ifndef FMT_PTRDIFF_T
#if defined(__APPLE__)
#define FMT_PTRDIFF_T "l"
#elif defined(__GNUC__) || defined(_STDC_C99)
#define FMT_PTRDIFF_T "t"
#elif defined(__WATCOMC__)
#define FMT_PTRDIFF_T "l"
#elif defined(_WIN32)
#define FMT_PTRDIFF_T "I"
#else
#define FMT_PTRDIFF_T "l"
#endif
#endif
/*===========================================================================*
General or logical data types where the word size is not guaranteed.
powerwindow_real_T - possible settings include powerwindow_real32_T or
powerwindow_real64_T powerwindow_time_T - possible settings include
powerwindow_real64_T or powerwindow_uint32_T powerwindow_boolean_T
powerwindow_char_T
powerwindow_int_T
powerwindow_uint_T
powerwindow_byte_T
===========================================================================*/
#ifndef NO_FLOATS
#ifndef REAL_T
#ifdef REAL64_T
#define REAL_T powerwindow_real64_T
#else
#ifdef REAL32_T
#define REAL_T powerwindow_real32_T
#endif
#endif
#endif
#ifdef REAL_T
typedef REAL_T powerwindow_real_T;
#endif
#ifndef TIME_T
#ifdef REAL_T
#define TIME_T powerwindow_real_T
#endif
#endif
#ifdef TIME_T
typedef TIME_T powerwindow_time_T;
#endif
#endif /* NO_FLOATS */
#ifndef BOOLEAN_T
#if defined(UINT8_T)
#define BOOLEAN_T UINT8_T
#else
#define BOOLEAN_T unsigned int
#endif
#endif
typedef BOOLEAN_T powerwindow_boolean_T;
#ifndef CHARACTER_T
#define CHARACTER_T char
#endif
typedef CHARACTER_T powerwindow_char_T;
#ifndef INTEGER_T
#define INTEGER_T int
#endif
typedef INTEGER_T powerwindow_int_T;
#ifndef UINTEGER_T
#define UINTEGER_T unsigned
#endif
typedef UINTEGER_T powerwindow_uint_T;
#ifndef BYTE_T
#define BYTE_T unsigned char
#endif
typedef BYTE_T powerwindow_byte_T;
/*===========================================================================*
Define Complex Structures
===========================================================================*/
#ifndef NO_FLOATS
#ifndef CREAL32_T
#ifdef REAL32_T
typedef struct {
powerwindow_real32_T re, im;
} powerwindow_creal32_T;
#define CREAL32_T creal32_T
#endif
#endif
#ifndef CREAL64_T
#ifdef REAL64_T
typedef struct {
powerwindow_real64_T re, im;
} powerwindow_creal64_T;
#define CREAL64_T powerwindow_creal64_T
#endif
#endif
#ifndef CREAL_T
#ifdef REAL_T
typedef struct {
powerwindow_real_T re, im;
} powerwindow_creal_T;
#define CREAL_T powerwindow_creal_T
#endif
#endif
#endif /* NO_FLOATS */
#ifndef CINT8_T
#ifdef INT8_T
typedef struct {
powerwindow_int8_T re, im;
} powerwindow_cint8_T;
#define CINT8_T powerwindow_cint8_T
#endif
#endif
#ifndef CUINT8_T
#ifdef UINT8_T
typedef struct {
powerwindow_uint8_T re, im;
} powerwindow_cuint8_T;
#define CUINT8_T powerwindow_cuint8_T
#endif
#endif
#ifndef CINT16_T
#ifdef INT16_T
typedef struct {
powerwindow_int16_T re, im;
} powerwindow_cint16_T;
#define CINT16_T powerwindow_cint16_T
#endif
#endif
#ifndef CUINT16_T
#ifdef UINT16_T
typedef struct {
powerwindow_uint16_T re, im;
} powerwindow_cuint16_T;
#define CUINT16_T powerwindow_cuint16_T
#endif
#endif
#ifndef CINT32_T
#ifdef INT32_T
typedef struct {
powerwindow_int32_T re, im;
} powerwindow_cint32_T;
#define CINT32_T powerwindow_cint32_T
#endif
#endif
#ifndef CUINT32_T
#ifdef UINT32_T
typedef struct {
powerwindow_uint32_T re, im;
} powerwindow_cuint32_T;
#define CUINT32_T powerwindow_cuint32_T
#endif
#endif
#ifndef CINT64_T
#ifdef INT64_T
typedef struct {
powerwindow_int64_T re, im;
} powerwindow_cint64_T;
#define CINT64_T powerwindow_cint64_T
#endif
#endif
#ifndef CUINT64_T
#ifdef UINT64_T
typedef struct {
powerwindow_uint64_T re, im;
} powerwindow_cuint64_T;
#define CUINT64_T powerwindow_cuint64_T
#endif
#endif
/*=======================================================================*
Min and Max:
powerwindow_int8_T, powerwindow_int16_T, powerwindow_int32_T - signed
8, 16, or 32 bit integers powerwindow_uint8_T, powerwindow_uint16_T,
powerwindow_uint32_T - unsigned 8, 16, or 32 bit integers
=======================================================================*/
#define powerwindow_MAX_int8_T ((powerwindow_int8_T) (127)) /* 127 */
#define powerwindow_MIN_int8_T ((powerwindow_int8_T) (-128)) /* -128 */
#define powerwindow_MAX_uint8_T ((powerwindow_uint8_T) (255)) /* 255 */
#define powerwindow_MIN_uint8_T ((powerwindow_uint8_T) (0))
#define powerwindow_MAX_int16_T ((powerwindow_int16_T) (32767)) /* 32767 */
#define powerwindow_MIN_int16_T ((powerwindow_int16_T) (-32768)) /* -32768 */
#define powerwindow_MAX_uint16_T ((powerwindow_uint16_T) (65535)) /* 65535 */
#define powerwindow_MIN_uint16_T ((powerwindow_uint16_T) (0))
#define powerwindow_MAX_int32_T \
((powerwindow_int32_T) (2147483647)) /* 2147483647 */
#define powerwindow_MIN_int32_T \
((powerwindow_int32_T) (-2147483647 - 1)) /* -2147483648 */
#define powerwindow_MAX_uint32_T \
((powerwindow_uint32_T) (0xFFFFFFFFU)) /* 4294967295 */
#define powerwindow_MIN_uint32_T ((powerwindow_uint32_T) (0))
#if defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) || \
(defined(__WATCOMC__) && __WATCOMC__ >= 1100) || defined(__LCC64__)
#ifdef INT64_T
#define powerwindow_MAX_int64_T ((powerwindow_int64_T) (9223372036854775807LL))
#define powerwindow_MIN_int64_T \
((powerwindow_int64_T) (-9223372036854775807LL - 1LL))
#endif
#ifdef UINT64_T
#define powerwindow_MAX_uint64_T \
((powerwindow_uint64_T) (0xFFFFFFFFFFFFFFFFULL))
#define powerwindow_MIN_uint64_T ((powerwindow_uint64_T) (0))
#endif
#else
#ifdef INT64_T
#ifdef INT_TYPE_64_IS_LONG
#define powerwindow_MAX_int64_T ((powerwindow_int64_T) (9223372036854775807L))
#define powerwindow_MIN_int64_T \
((powerwindow_int64_T) (-9223372036854775807L - 1L))
#else
#define powerwindow_MAX_int64_T ((powerwindow_int64_T) (9223372036854775807LL))
#define powerwindow_MIN_int64_T \
((powerwindow_int64_T) (-9223372036854775807LL - 1LL))
#endif
#endif
#ifdef UINT64_T
#ifdef INT_TYPE_64_IS_LONG
#define powerwindow_MAX_uint64_T ((powerwindow_uint64_T) (0xFFFFFFFFFFFFFFFFUL))
#define powerwindow_MIN_uint64_T ((powerwindow_uint64_T) (0))
#else
#define powerwindow_MAX_uint64_T \
((powerwindow_uint64_T) (0xFFFFFFFFFFFFFFFFULL))
#define powerwindow_MIN_uint64_T ((powerwindow_uint64_T) (0))
#endif
#endif
#endif
#ifdef _MSC_VER
/* Conversion from unsigned __int64 to double is not implemented in windows
and results in a compile error, thus the value must first be cast to
signed __int64, and then to double.
If the 64 bit int value is greater than 2^63-1, which is the signed int64
max, the macro below provides a workaround for casting a uint64 value to a
double in windows.
*/
#define uint64_to_double(u) \
(((u) > _I64_MAX) \
? (double) (__int64) ((u) - _I64_MAX - 1) + (double) _I64_MAX + 1 \
: (double) (__int64) (u))
/* The following inline function should only be used in the macro
double_to_uint64, as it only handles the specfic range of double between 2^63
and 2^64-1 */
__forceinline powerwindow_uint64_T double_to_uint64_helpe
r(double d) {
union double_to_uint64_union_type {
double dd;
powerwindow_uint64_T i64;
} di;
di.dd = d;
return (((di.i64 & 0x000fffffffffffff) | 0x0010000000000000) << 11);
}
/* The largest double value that can be cast to uint64 in windows is the
signed int64 max, which is 2^63-1. The macro below provides
a workaround for casting large double values to uint64 in windows.
*/
/* The magic number 18446744073709551616.0 is 2^64 */
/* The magic number 9223372036854775808.0 is 2^63 */
#define double_to_uint64(d) \
(((d) >= 18446744073709551616.0) ? 0xffffffffffffffffULL \
: ((d) < 0.0) ? 0ULL \
: ((d) >= 9223372036854775808.0) ? double_to_uint64_helper(d) \
: (unsigned __int64) (d))
#else
#define uint64_to_double(u) ((double) (u))
#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__TICCSC__)
/* double_to_uint64 defined only for MSVC and UNIX */
#else
#define double_to_uint64(d) \
(((d) > 0xffffffffffffffffULL) \
? (unsigned long long) 0xffffffffffffffffULL \
: ((d) < 0) ? (unsigned long long) 0 \
: (unsigned long long) (d))
#endif
#endif
#if !defined(__cplusplus) && !defined(__bool_true_false_are_defined)
#ifndef _bool_T
#define _bool_T
typedef powerwindow_boolean_T bool;
#ifndef false
#define false (0)
#endif
#ifndef true
#define true (1)
#endif
#endif /* _bool_T */
#endif /* !__cplusplus */
/*
This software assumes that the code is being compiled on a target using a
2's complement representation for signed integer values.
*/
#if ((SCHAR_MIN + 1) != -SCHAR_MAX)
#error \
"This code must be compiled using a 2's complement representation for signed integer values"
#endif
/*
Maximum length of a MATLAB identifier (function/variable/model)
including the null-termination character.
*/
#define TMW_NAME_LENGTH_MAX 64
#ifdef MX_COMPAT_32
typedef int powerwindow_mwSize;
typedef int powerwindow_mwIndex;
typedef int powerwindow_mwSignedIndex;
#else
typedef size_t powerwindow_mwSize; /* unsigned pointer-width integer */
typedef size_t powerwindow_mwIndex; /* unsigned pointer-width integer */
typedef ptrdiff_t
powerwindow_mwSignedIndex; /* a signed pointer-width integer */
#endif
#if (defined(_LP64) || defined(_WIN64)) && !defined(MX_COMPAT_32)
/* Currently 2^48 based on hardware limitations */
#define powerwindow_MWSIZE_MAX 281474976710655UL
#define powerwindow_MWINDEX_MAX 281474976710655UL
#define powerwindow_MWSINDEX_MAX 281474976710655L
#define powerwindow_MWSINDEX_MIN -281474976710655L
#else
#define powerwindow_MWSIZE_MAX 2147483647UL
#define powerwindow_MWINDEX_MAX 2147483647UL
#define powerwindow_MWSINDEX_MAX 2147483647L
#define powerwindow_MWSINDEX_MIN -2147483647L
#endif
#define powerwindow_MWSIZE_MIN 0UL
#define powerwindow_MWINDEX_MIN 0UL
/** UTF-16 character type */
#if (defined(__cplusplus) && (__cplusplus >= 201103L)) || \
(defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && \
_HAS_CHAR16_T_LANGUAGE_SUPPORT)
typedef char16_t powerwindow_CHAR16_T;
#elif defined(_MSC_VER)
typedef wchar_t powerwindow_CHAR16_T;
#else
typedef UINT16_T powerwindow_CHAR16_T;
#endif
#endif /* powerwindow__TMWTYPES__ */
#endif /* powerwindow_tmwtypes_h */

View File

@ -0,0 +1,16 @@
#include "wcclib.h"
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
void *
wcclib_memset(void *s, int c, size_t n) {
unsigned char *p = s;
__pragma_loopbound(1, 368);
while (n--)
*p++ = (unsigned char) c;
return (s);
}

View File

@ -0,0 +1,15 @@
#ifndef _WCCLIB
#define _WCCLIB
#define size_t unsigned long
#define int32_t int
#define uint32_t unsigned int
#define u_int16_t unsigned short
#define u_int32_t unsigned int
#define NULL ((void *) 0)
void *wcclib_memset(void *s, int c, size_t n);
#endif // _WCCLIB

View File

@ -0,0 +1,819 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow
Author: CoSys-Lab, University of Antwerp
Function: powerwindow implement the powerwindow that can be seen in cars
nowadays. The window can be controlled by either driver or passenger. When an
object is detected between the window frame and the glass during the raising
of the glass, the glass will lower down for some distance. This benchmark
contains 4 tasks which includes the driver side powerwindow, front passenger
side powerwindow, back-left passenger side powerwindow, back-right passenger
side powerwindow. These 4 tasks can be easily adjusted to execute in
sequential order parallel on single or muti core.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow.c
Changes: a brief summary of major functional changes and formatting)
* 2023-12-07: Added loop bounds
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_DRV.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front.h"
#include "powerwindow_HeaderFiles/powerwindow_controlexclusion.h" /* Control Model's header file */
#include "powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "powerwindow_HeaderFiles/powerwindow_powerwindow_control.h" /* PW passenger control Model's header file */
#include "powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
/*
Forward declaration of functions
*/
// Wasm loop bounds
#include "powerwindow_PW_Control_DRV.c"
#include "powerwindow_PW_Control_PSG_BackL.c"
#include "powerwindow_PW_Control_PSG_BackR.c"
#include "powerwindow_PW_Control_PSG_Front.c"
#include "powerwindow_const_params.c"
#include "powerwindow_controlexclusion.c"
#include "powerwindow_debounce.c"
#include "powerwindow_inputs.c"
#include "powerwindow_powerwindow_control.c"
#include "wcclib.c"
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
__attribute__((always_inline)) static inline void
powerwindow_Booleaninputarray_initialize(powerwindow_boolean_T *,
powerwindow_boolean_T *);
__attribute__((always_inline)) static inline void
powerwindow_Uint8inputarray_initialize(powerwindow_uint8_T *,
powerwindow_uint8_T *);
__attribute__((always_inline)) static inline void powerwindow_init();
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
powerwindow_main();
__attribute__((always_inline)) static inline int powerwindow_return();
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void);
// DRV
__attribute__((always_inline)) static inline void powerwindow_init_DRV(int);
__attribute__((always_inline)) static inline void
powerwindow_input_initialize_DRV(void);
__attribute__((always_inline)) static inline void
powerwindow_initialize_DRV(void);
__attribute__((always_inline)) static inline void powerwindow_return_DRV(void);
__attribute__((always_inline)) static inline void powerwindow_DRV_main(void);
// PSG_Front
__attribute__((always_inline)) static inline void
powerwindow_init_PSG_Front(int);
__attribute__((always_inline)) static inline void
powerwindow_input_initialize_PSG_Front(void);
__attribute__((always_inline)) static inline void
powerwindow_initialize_PSG_Front(void);
__attribute__((always_inline)) static inline void
powerwindow_return_PSG_Front(void);
__attribute__((always_inline)) static inline void
powerwindow_PSG_Front_main(void);
// PSG_BackL
__attribute__((always_inline)) static inline void
powerwindow_init_PSG_BackL(int);
__attribute__((always_inline)) static inline void
powerwindow_input_initialize_PSG_BackL(void);
__attribute__((always_inline)) static inline void
powerwindow_initialize_PSG_BackL(void);
__attribute__((always_inline)) static inline void
powerwindow_return_PSG_BackL(void);
__attribute__((always_inline)) static inline void
powerwindow_PSG_BackL_main(void);
// PSG_BackR
__attribute__((always_inline)) static inline void
powerwindow_init_PSG_BackR(int);
__attribute__((always_inline)) static inline void
powerwindow_input_initialize_PSG_BackR(void);
__attribute__((always_inline)) static inline void
powerwindow_initialize_PSG_BackR(void);
__attribute__((always_inline)) static inline void
powerwindow_return_PSG_BackR(void);
__attribute__((always_inline)) static inline void
powerwindow_PSG_BackR_main(void);
/*
Declaration of global variables
*/
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_powerwindow_PW_C powerwindow_PW_Control_DRV_U;
extern powerwindow_ExternalOutputs_powerwindow_PW_ powerwindow_PW_Control_DRV_Y;
extern powerwindow_ExternalInputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_U;
extern powerwindow_ExternalInputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_U;
extern powerwindow_ExternalInputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_U;
powerwindow_boolean_T
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_Front_U_Up_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_Front_U_Down_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_BackL_U_Up_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_BackL_U_Down_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_BackR_U_Up_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_Driver_BackR_U_Down_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Input_DRV
[powerwindow_input_length];
powerwindow_uint8_T powerwindow_powerwindow_control_U_currentsense_Input_DRV
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_Front_U_Up_Input_Front_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_Front_U_Down_Input_Front_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_BackL_U_Up_Input_BackL_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_BackR_U_Up_Input_BackR_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_Driver_BackR_U_Down_Input_BackR_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_DRV_Array
[powerwindow_input_length];
extern powerwindow_uint8_T
powerwindow_powerwindow_control_U_currentsense_DRV_Array
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_controlexclusion_U_Up_DRV_Input_Front
[powerwindow_input_length]; /* Here applied a push-down button, the signal
is high when the button is not pressed. */
powerwindow_boolean_T powerwindow_controlexclusion_U_Down_DRV_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_Front_U_Up_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_Front_U_Down_Input_Front
[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Input_Front
[powerwindow_input_length];
powerwindow_uint8_T powerwindow_powerwindow_control_U_currentsense_Input_Front
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_passenger_Front_U_Up_Front_Array
[powerwindow_input_length]; /* Here applied a push-down button, the
signal is high when the button is not
pressed. */
extern powerwindow_boolean_T
powerwindow_debounce_passenger_Front_U_Down_Front_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Front_Array
[powerwindow_input_length];
extern powerwindow_uint8_T
powerwindow_powerwindow_control_U_currentsense_Front_Array
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_controlexclusion_U_Up_DRV_Input_BackL
[powerwindow_input_length]; /* Here applied a push-down button, the signal
is high when the button is not pressed. */
powerwindow_boolean_T powerwindow_controlexclusion_U_Down_DRV_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_BackL_U_Up_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_BackL_U_Down_Input_BackL
[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackL
[powerwindow_input_length];
powerwindow_uint8_T powerwindow_powerwindow_control_U_currentsense_Input_BackL
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_passenger_BackL_U_Up_BackL_Array
[powerwindow_input_length]; /* Here applied a push-down button, the
signal is high when the button is not
pressed. */
extern powerwindow_boolean_T
powerwindow_debounce_passenger_BackL_U_Down_BackL_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_BackL_Array
[powerwindow_input_length];
extern powerwindow_uint8_T
powerwindow_powerwindow_control_U_currentsense_BackL_Array
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_controlexclusion_U_Up_DRV_Input_BackR
[powerwindow_input_length]; /* Here applied a push-down button, the signal
is high when the button is not pressed. */
powerwindow_boolean_T powerwindow_controlexclusion_U_Down_DRV_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_BackR_U_Up_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T powerwindow_debounce_passenger_BackR_U_Down_Input_BackR
[powerwindow_input_length];
powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackR
[powerwindow_input_length];
powerwindow_uint8_T powerwindow_powerwindow_control_U_currentsense_Input_BackR
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_debounce_passenger_BackR_U_Up_BackR_Array
[powerwindow_input_length]; /* Here applied a push-down button, the
signal is high when the button is not
pressed. */
extern powerwindow_boolean_T
powerwindow_debounce_passenger_BackR_U_Down_BackR_Array
[powerwindow_input_length];
extern powerwindow_boolean_T
powerwindow_powerwindow_control_U_endofdetectionrange_BackR_Array
[powerwindow_input_length];
extern powerwindow_uint8_T
powerwindow_powerwindow_control_U_currentsense_BackR_Array
[powerwindow_input_length];
int powerwindow_main_inputcyclecounter;
/*
Initialization- and return-value-related functions
*/
__attribute__((always_inline)) static inline void
powerwindow_init_DRV(int i) {
powerwindow_PW_Control_DRV_U.In1 =
powerwindow_powerwindow_control_U_endofdetectionrange_Input_DRV
[i]; /* The when the window reaches the end of the range, the
endofdetectionrange changes to 0. */
powerwindow_PW_Control_DRV_U.In3 =
powerwindow_powerwindow_control_U_currentsense_Input_DRV
[i]; /* When the currentsense is higher than 92 (based on
experiments), one object is stuck between the window and the
frame. Pinch is set to True.*/
powerwindow_PW_Control_DRV_U.In2 =
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In4 =
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In5 =
powerwindow_debounce_Driver_Front_U_Up_Input_Front
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In6 =
powerwindow_debounce_Driver_Front_U_Down_Input_Front
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In9 =
powerwindow_debounce_Driver_BackL_U_Up_Input_BackL
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In10 =
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In7 =
powerwindow_debounce_Driver_BackR_U_Up_Input_BackR
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_DRV_U.In8 =
powerwindow_debounce_Driver_BackR_U_Down_Input_BackR
[i]; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
}
__attribute__((always_inline)) static inline void
powerwindow_init_PSG_Front(int i) {
powerwindow_PW_Control_PSG_Front_U.Up_DRV =
powerwindow_PW_Control_DRV_Y
.Out6; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_PSG_Front_U.Down_DRV =
powerwindow_PW_Control_DRV_Y
.Out7; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lower the window. */
powerwindow_PW_Control_PSG_Front_U.Up_PSG_Front =
powerwindow_debounce_passenger_Front_U_Up_Input_Front[i];
powerwindow_PW_Control_PSG_Front_U.Down_PSG_Front =
powerwindow_debounce_passenger_Front_U_Down_Input_Front
[i]; /* '<Root>/Down'. Here applied a push-down button, the signal
is high when the button is not pressed. Change to 0 to lower
the window. */
powerwindow_PW_Control_PSG_Front_U.endofdetectionrange =
powerwindow_powerwindow_control_U_endofdetectionrange_Input_Front
[i]; /* The when the window reaches the end of the range, the
endofdetectionrange changes to 0. */
powerwindow_PW_Control_PSG_Front_U.currentsense =
powerwindow_powerwindow_control_U_currentsense_Input_Front
[i]; /* When the currentsense is higher than 92 (based on
experiments), one object is stuck between the window and the
frame. Pinch is set to True.*/
}
__attribute__((always_inline)) static inline void
powerwindow_init_PSG_BackL(int i) {
powerwindow_PW_Control_PSG_BackL_U.Up_DRV =
powerwindow_PW_Control_DRV_Y
.Out10; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_PSG_BackL_U.Down_DRV =
powerwindow_PW_Control_DRV_Y
.Out11; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lower the window.
*/
powerwindow_PW_Control_PSG_BackL_U.Up_PSG_BackL =
powerwindow_debounce_passenger_BackL_U_Up_Input_BackL[i];
powerwindow_PW_Control_PSG_BackL_U.Down_PSG_BackL =
powerwindow_debounce_passenger_BackL_U_Down_Input_BackL
[i]; /* '<Root>/Down'. Here applied a push-down button, the signal
is high when the button is not pressed. Change to 0 to lower
the window. */
powerwindow_PW_Control_PSG_BackL_U.endofdetectionrange =
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackL
[i]; /* The when the window reaches the end of the range, the
endofdetectionrange changes to 0. */
powerwindow_PW_Control_PSG_BackL_U.currentsense =
powerwindow_powerwindow_control_U_currentsense_Input_BackL
[i]; /* When the currentsense is higher than 92 (based on
experiments), one object is stuck between the window and the
frame. Pinch is set to True.*/
}
__attribute__((always_inline)) static inline void
powerwindow_init_PSG_BackR(int i) {
powerwindow_PW_Control_PSG_BackR_U.Up_DRV =
powerwindow_PW_Control_DRV_Y
.Out8; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lift the window. */
powerwindow_PW_Control_PSG_BackR_U.Down_DRV =
powerwindow_PW_Control_DRV_Y
.Out9; /* The debounced control signal from the driver. 1 when the
button is not pressed, change to 0 to lower the window. */
powerwindow_PW_Control_PSG_BackR_U.Up_PSG_BackR =
powerwindow_debounce_passenger_BackR_U_Up_Input_BackR[i];
powerwindow_PW_Control_PSG_BackR_U.Down_PSG_BackR =
powerwindow_debounce_passenger_BackR_U_Down_Input_BackR
[i]; /* '<Root>/Down'. Here applied a push-down button, the signal
is high when the button is not pressed. Change to 0 to lower
the window. */
powerwindow_PW_Control_PSG_BackR_U.endofdetectionrange =
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackR
[i]; /* The when the window reaches the end of the range, the
endofdetectionrange changes to 0. */
powerwindow_PW_Control_PSG_BackR_U.currentsense =
powerwindow_powerwindow_control_U_currentsense_Input_BackR
[i]; /* When the currentsense is higher than 92 (based on
experiments), one object is stuck between the window and the
frame. Pinch is set to True.*/
}
__attribute__((always_inline)) static inline void
powerwindow_input_initialize_DRV(void) {
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV,
powerwindow_debounce_Driver_DRV_U_Up_Input_DRV_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV,
powerwindow_debounce_Driver_DRV_U_Down_Input_DRV_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_Front_U_Up_Input_Front,
powerwindow_debounce_Driver_Front_U_Up_Input_Front_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_Front_U_Down_Input_Front,
powerwindow_debounce_Driver_Front_U_Down_Input_Front_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_BackL_U_Up_Input_BackL,
powerwindow_debounce_Driver_BackL_U_Up_Input_BackL_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL,
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_BackL_U_Down_Input_BackL,
powerwindow_debounce_Driver_BackR_U_Up_Input_BackR_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_Driver_BackR_U_Down_Input_BackR,
powerwindow_debounce_Driver_BackR_U_Down_Input_BackR_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_powerwindow_control_U_endofdetectionrange_Input_DRV,
powerwindow_powerwindow_control_U_endofdetectionrange_DRV_Array);
powerwindow_Uint8inputarray_initialize(
powerwindow_powerwindow_control_U_currentsense_DRV_Array,
powerwindow_powerwindow_control_U_currentsense_DRV_Array);
}
__attribute__((always_inline)) static inline void
powerwindow_input_initialize_PSG_Front(void) {
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_Front_U_Up_Input_Front,
powerwindow_debounce_passenger_Front_U_Up_Front_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_Front_U_Down_Input_Front,
powerwindow_debounce_passenger_Front_U_Down_Front_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_powerwindow_control_U_endofdetectionrange_Input_Front,
powerwindow_powerwindow_control_U_endofdetectionrange_Front_Array);
powerwindow_Uint8inputarray_initialize(
powerwindow_powerwindow_control_U_currentsense_Input_Front,
powerwindow_powerwindow_control_U_currentsense_Front_Array);
}
__attribute__((always_inline)) static inline void
powerwindow_input_initialize_PSG_BackL(void) {
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_BackL_U_Up_Input_BackL,
powerwindow_debounce_passenger_BackL_U_Up_BackL_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_BackL_U_Down_Input_BackL,
powerwindow_debounce_passenger_BackL_U_Down_BackL_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackL,
powerwindow_powerwindow_control_U_endofdetectionrange_BackL_Array);
powerwindow_Uint8inputarray_initialize(
powerwindow_powerwindow_control_U_currentsense_Input_BackL,
powerwindow_powerwindow_control_U_currentsense_BackL_Array);
}
__attribute__((always_inline)) static inline void
powerwindow_input_initialize_PSG_BackR(void) {
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_BackR_U_Up_Input_BackR,
powerwindow_debounce_passenger_BackR_U_Up_BackR_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_debounce_passenger_BackR_U_Down_Input_BackR,
powerwindow_debounce_passenger_BackR_U_Down_BackR_Array);
powerwindow_Booleaninputarray_initialize(
powerwindow_powerwindow_control_U_endofdetectionrange_Input_BackR,
powerwindow_powerwindow_control_U_endofdetectionrange_BackR_Array);
powerwindow_Uint8inputarray_initialize(
powerwindow_powerwindow_control_U_currentsense_Input_BackR,
powerwindow_powerwindow_control_U_currentsense_BackR_Array);
}
__attribute__((always_inline)) static inline void
powerwindow_Booleaninputarray_initialize(powerwindow_boolean_T *arrayA,
powerwindow_boolean_T *arrayB) {
register int i;
__pragma_loopbound(977, 977);
for (i = 0; i < powerwindow_input_length; i++)
arrayA[i] = arrayB[i];
}
__attribute__((always_inline)) static inline void
powerwindow_Uint8inputarray_initialize(powerwindow_uint8_T *arrayA,
powerwindow_uint8_T *arrayB) {
register int i;
__pragma_loopbound(977, 977);
for (i = 0; i < powerwindow_input_length; i++)
arrayA[i] = arrayB[i];
}
__attribute__((always_inline)) static inline void
powerwindow_initialize_DRV(void) {
/* Initialize model */
powerwindow_PW_Control_DRV_initialize();
}
__attribute__((always_inline)) static inline void
powerwindow_initialize_PSG_Front(void) {
/* Initialize model */
powerwindow_PW_Control_PSG_Front_initialize();
}
__attribute__((always_inline)) static inline void
powerwindow_initialize_PSG_BackL(void) {
/* Initialize model */
powerwindow_PW_Control_PSG_BackL_initialize();
}
__attribute__((always_inline)) static inline void
powerwindow_initialize_PSG_BackR(void) {
/* Initialize model */
powerwindow_PW_Control_PSG_BackR_initialize();
}
__attribute__((always_inline)) static inline void
powerwindow_return_DRV(void) {
/* Terminate model */
powerwindow_PW_Control_DRV_terminate();
}
__attribute__((always_inline)) static inline void
powerwindow_return_PSG_Front(void) {
/* Terminate model */
powerwindow_PW_Control_PSG_Front_terminate();
}
__attribute__((always_inline)) static inline void
powerwindow_return_PSG_BackL(void) {
/* Terminate model */
powerwindow_PW_Control_PSG_BackL_terminate();
}
__attribute__((always_inline)) static inline void
powerwindow_return_PSG_BackR(void) {
/* Terminate model */
powerwindow_PW_Control_PSG_BackR_terminate();
}
/*
Main functions
*/
/*
Associating powerwindow_main with a real-time clock or interrupt service
routine is what makes the generated code "real-time". The function
powerwindow_main is always associated with the base rate of the model.
Subrates are managed by the base rate from inside the generated code.
Enabling/disabling interrupts and floating point context switches are target
specific. This example code indicates where these should take place relative
to executing the generated code step function. Overrun behavior should be
tailored to your application needs. This example simply sets an error status
in the real-time model and returns from powerwindow_main.
*/
__attribute__((always_inline)) static inline void
powerwindow_DRV_main(void) {
static powerwindow_boolean_T OverrunFlag = 0;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
powerwindow_PW_DRV_rtmSetErrorStatus(powerwindow_PW_Control_DRV_M,
"Overrun"); //////////
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
powerwindow_PW_Control_DRV_main();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
/*
The example "main" function illustrates what is required by your
application code to initialize, execute, and terminate the generated code.
Attaching powerwindow_main to a real-time clock is target specific. This
example illustates how you do this relative to initializing the model.
*/
__attribute__((always_inline)) static inline void
powerwindow_PSG_Front_main(void) {
static powerwindow_boolean_T OverrunFlag = 0;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
powerwindow_PW_PSG_Front_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_Front_M, "Overrun");
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
powerwindow_PW_Control_PSG_Front_main();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
__attribute__((always_inline)) static inline void
powerwindow_PSG_BackL_main(void) {
static powerwindow_boolean_T OverrunFlag = 0;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
powerwindow_PW_PSG_BackL_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_BackL_M, "Overrun");
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
powerwindow_PW_Control_PSG_BackL_main();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
__attribute__((always_inline)) static inline void
powerwindow_PSG_BackR_main(void) {
static powerwindow_boolean_T OverrunFlag = 0;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
powerwindow_PW_PSG_BackR_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_BackR_M, "Overrun");
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
powerwindow_PW_Control_PSG_BackR_main();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
__attribute__((always_inline)) static inline void
powerwindow_init(void) {
powerwindow_initialize_DRV();
powerwindow_initialize_PSG_Front();
powerwindow_initialize_PSG_BackL();
powerwindow_initialize_PSG_BackR();
powerwindow_main_inputcyclecounter = 0;
}
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
powerwindow_main(void) {
/* Attach powerwindow_main to a timer or interrupt service routine with
period 0.005 seconds (the model's base sample time) here. The
call syntax for powerwindow_main is
powerwindow_main();
*/
// Task 1: Driver side window
powerwindow_input_initialize_DRV();
powerwindow_input_initialize_PSG_Front();
powerwindow_input_initialize_PSG_BackL();
powerwindow_input_initialize_PSG_BackR();
__pragma_loopbound(977, 977);
while (powerwindow_main_inputcyclecounter < powerwindow_input_length) {
powerwindow_init_DRV(powerwindow_main_inputcyclecounter);
powerwindow_DRV_main();
// Task 2: Front passenger side window
powerwindow_init_PSG_Front(powerwindow_main_inputcyclecounter);
powerwindow_PSG_Front_main();
// Task 3: Back left passenger side window
powerwindow_init_PSG_BackL(powerwindow_main_inputcyclecounter);
powerwindow_PSG_BackL_main();
// Task 4: Back right passenger side window
powerwindow_init_PSG_BackR(powerwindow_main_inputcyclecounter);
powerwindow_PSG_BackR_main();
powerwindow_main_inputcyclecounter++;
}
}
__attribute__((always_inline)) static inline int
powerwindow_return(void) {
powerwindow_return_DRV();
powerwindow_return_PSG_Front();
powerwindow_return_PSG_BackL();
powerwindow_return_PSG_BackR();
return 0;
}
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
powerwindow_init();
powerwindow_main();
return powerwindow_return();
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,23 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef NULL
#define NULL ((viod *) 0)
#endif

View File

@ -0,0 +1,331 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_DRV.c
Author: CoSys-Lab, University of Antwerp
Function: PW_Control_DRV realizes the functionality of driver side
powerwindow. It connects the 3 smaller modules together.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow//powerwindow_powerwindow_control.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_DRV.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_DRV_private.h"
#include "wcclib.h"
/*
Forward declaration of functions
*/
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_DRV_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_DRV_terminate(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_DRV_main(void);
/* Block states (auto storage) */
powerwindow_D_Work_powerwindow_PW_Control_D powerwindow_PW_Control_DR_DWork;
/* External inputs (root inport signals with auto storage) */
powerwindow_ExternalInputs_powerwindow_PW_C powerwindow_PW_Control_DRV_U;
/* External outputs (root outports fed by signals with auto storage) */
powerwindow_ExternalOutputs_powerwindow_PW_ powerwindow_PW_Control_DRV_Y;
/* Real-time model */
powerwindow_RT_MODEL_PW_Control_DRV powerwindow_PW_Control_DRV_M_;
powerwindow_RT_MODEL_PW_Control_DRV *const powerwindow_PW_Control_DRV_M =
&powerwindow_PW_Control_DRV_M_;
/* Model step function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_DRV_main(void) {
/* local block i/o variables */
powerwindow_boolean_T rtb_Debounce_Up_DRV;
powerwindow_boolean_T rtb_Debounce_Down_DRV;
/* ModelReference: '<S2>/Debounce_Up_DRV' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In2, &rtb_Debounce_Up_DRV,
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Down_DRV' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In4, &rtb_Debounce_Down_DRV,
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In9, &powerwindow_PW_Control_DRV_Y.Out10,
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In10, &powerwindow_PW_Control_DRV_Y.Out11,
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1
.rtzce));
/* ModelReference: '<S2>/Debounce_Up_PSG_Front' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In5, &powerwindow_PW_Control_DRV_Y.Out6,
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Down_PSG_Front' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In6, &powerwindow_PW_Control_DRV_Y.Out7,
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1
.rtzce));
/* ModelReference: '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In7, &powerwindow_PW_Control_DRV_Y.Out8,
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtzce));
/* ModelReference: '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_debounce_main(
&powerwindow_PW_Control_DRV_U.In8, &powerwindow_PW_Control_DRV_Y.Out9,
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1
.rtzce));
/* ModelReference: '<S1>/PW_DRV' */
powerwindow_powerwindow_control_main(
&rtb_Debounce_Up_DRV, &rtb_Debounce_Down_DRV,
&powerwindow_PW_Control_DRV_U.In1, &powerwindow_PW_Control_DRV_U.In3,
&powerwindow_PW_Control_DRV_Y.Out1, &powerwindow_PW_Control_DRV_Y.Out2,
&powerwindow_PW_Control_DRV_Y.Out3, &powerwindow_PW_Control_DRV_Y.Out4,
&powerwindow_PW_Control_DRV_Y.Out5,
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtzce));
}
/* Model initialize function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_DRV_initialize(void) {
/* Registration code */
/* states (dwork) */
(void) wcclib_memset((void *) &powerwindow_PW_Control_DR_DWork, 0,
sizeof(powerwindow_D_Work_powerwindow_PW_Control_D));
/* external inputs */
(void) wcclib_memset((void *) &powerwindow_PW_Control_DRV_U, 0,
sizeof(powerwindow_ExternalInputs_powerwindow_PW_C));
/* external outputs */
(void) wcclib_memset((void *) &powerwindow_PW_Control_DRV_Y, 0,
sizeof(powerwindow_ExternalOutputs_powerwindow_PW_));
/* Model Initialize fcn for ModelReference Block: '<S2>/Debounce_Down_DRV'
*/
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1
.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1
.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Down_PSG_Front' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1
.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S2>/Debounce_Up_DRV' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block:
* '<S2>/Debounce_Up_PSG_Front' */
powerwindow_debounce_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S1>/PW_DRV' */
powerwindow_powerwindow_control_initialize(
powerwindow_PW_DRV_rtmGetErrorStatusPointer(
powerwindow_PW_Control_DRV_M),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtm),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtdw),
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtzce));
/* Start for ModelReference: '<S2>/Debounce_Up_DRV' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Down_DRV' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Up_PSG_Front' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Down_PSG_Front' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtdw));
/* Start for ModelReference: '<S1>/PW_DRV' */
powerwindow_powerwindow_control_Start(
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Up_DRV' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_DRV_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Down_DRV' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_DRV_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackL_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackL_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Up_PSG_Front' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_Front_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Down_PSG_Front' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_Front_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Up_PSG_BackR_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_DR_DWork.Debounce_Down_PSG_BackR_DWORK1.rtdw));
/* SystemInitialize for ModelReference: '<S1>/PW_DRV' */
powerwindow_powerwindow_control_Init(
&powerwindow_PW_Control_DRV_Y.Out1, &powerwindow_PW_Control_DRV_Y.Out2,
&powerwindow_PW_Control_DRV_Y.Out3, &powerwindow_PW_Control_DRV_Y.Out4,
&powerwindow_PW_Control_DRV_Y.Out5,
&(powerwindow_PW_Control_DR_DWork.PW_DRV_DWORK1.rtdw));
}
/* Model terminate function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_DRV_terminate(void) {
/* (no terminate code required) */
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,157 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_DRV.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_DRV.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_powerwindow_PW_Control_DRV_h_
#define powerwindow_RTW_HEADER_powerwindow_PW_Control_DRV_h_
#ifndef powerwindow_PW_Control_DRV_COMMON_INCLUDES_
#define powerwindow_PW_Control_DRV_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* powerwindow_PW_Control_DRV_COMMON_INCLUDES_ */
#include "../powerwindow_HeaderFiles/powerwindow_PW_Control_DRV_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Child system includes */
#include "../powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_PW_DRV_rtmGetErrorStatus
#define powerwindow_PW_DRV_rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef powerwindow_PW_DRV_rtmSetErrorStatus
#define powerwindow_PW_DRV_rtmSetErrorStatus(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#ifndef powerwindow_PW_DRV_rtmGetErrorStatusPointer
#define powerwindow_PW_DRV_rtmGetErrorStatusPointer(rtm) \
((const powerwindow_char_T **) (&((rtm)->errorStatus)))
#endif
/* Block states (auto storage) for system '<Root>' */
typedef struct {
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_DRV_DWORK1; /* '<S2>/Debounce_Up_DRV' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_DRV_DWORK1; /* '<S2>/Debounce_Down_DRV' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_PSG_BackL_DWORK1; /* '<S2>/Debounce_Up_PSG_BackL' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_PSG_BackL_DWORK1; /* '<S2>/Debounce_Down_PSG_BackL' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_PSG_Front_DWORK1; /* '<S2>/Debounce_Up_PSG_Front' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_PSG_Front_DWORK1; /* '<S2>/Debounce_Down_PSG_Front' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_PSG_BackR_DWORK1; /* '<S2>/Debounce_Up_PSG_BackR' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_PSG_BackR_DWORK1; /* '<S2>/Debounce_Down_PSG_BackR' */
powerwindow_rtMdlrefDWork_PowerWindow_contr
PW_DRV_DWORK1; /* '<S1>/PW_DRV' */
} powerwindow_D_Work_powerwindow_PW_Control_D;
/* External inputs (root inport signals with auto storage) */
typedef struct {
powerwindow_boolean_T In1; /* '<Root>/In1' */
powerwindow_boolean_T In2; /* '<Root>/In2' */
powerwindow_uint8_T In3; /* '<Root>/In3' */
powerwindow_boolean_T In4; /* '<Root>/In4' */
powerwindow_boolean_T In5; /* '<Root>/In5' */
powerwindow_boolean_T In6; /* '<Root>/In6' */
powerwindow_boolean_T In7; /* '<Root>/In7' */
powerwindow_boolean_T In8; /* '<Root>/In8' */
powerwindow_boolean_T In9; /* '<Root>/In9' */
powerwindow_boolean_T In10; /* '<Root>/In10' */
} powerwindow_ExternalInputs_powerwindow_PW_C;
/* External outputs (root outports fed by signals with auto storage) */
typedef struct {
powerwindow_boolean_T Out1; /* '<Root>/Out1' */
powerwindow_boolean_T Out2; /* '<Root>/Out2' */
powerwindow_boolean_T Out3; /* '<Root>/Out3' */
powerwindow_boolean_T Out4; /* '<Root>/Out4' */
powerwindow_boolean_T Out5; /* '<Root>/Out5' */
powerwindow_boolean_T Out6; /* '<Root>/Out6' */
powerwindow_boolean_T Out7; /* '<Root>/Out7' */
powerwindow_boolean_T Out8; /* '<Root>/Out8' */
powerwindow_boolean_T Out9; /* '<Root>/Out9' */
powerwindow_boolean_T Out10; /* '<Root>/Out10' */
powerwindow_boolean_T Out11; /* '<Root>/Out11' */
} powerwindow_ExternalOutputs_powerwindow_PW_;
struct powerwindow_tag_RTM_PW_Control_DRV {
const powerwindow_char_T *volatile errorStatus;
};
/* Block states (auto storage) */
extern powerwindow_D_Work_powerwindow_PW_Control_D
powerwindow_PW_Control_DR_DWork;
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_powerwindow_PW_C powerwindow_PW_Control_DRV_U;
/* External outputs (root outports fed by signals with auto storage) */
extern powerwindow_ExternalOutputs_powerwindow_PW_ powerwindow_PW_Control_DRV_Y;
/* Model entry point functions */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_DRV_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_DRV_main(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_DRV_terminate(void);
/* Real-time Model object */
extern powerwindow_RT_MODEL_PW_Control_DRV *const powerwindow_PW_Control_DRV_M;
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Note that this particular code originates from a subsystem build,
and has its own system numbers different from the parent model.
Refer to the system hierarchy for this subsystem below, and use the
MATLAB hilite_system command to trace the generated code back
to the parent model. For example,
hilite_system('PowerWindow/powerwindow_PW_Control_DRV') - opens subsystem
PowerWindow/powerwindow_PW_Control_DRV
hilite_system('PowerWindow/powerwindow_PW_Control_DRV/Kp') - opens and
selects block Kp
Here is the system hierarchy for this model
'<Root>' : 'PowerWindow'
'<S1>' : 'PowerWindow/powerwindow_PW_Control_DRV'
'<S2>' : 'PowerWindow/powerwindow_PW_Control_DRV/Debounce_DRV'
*/
#endif /* RTW_HEADER_powerwindow_PW_Control_DRV_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_DRV_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_DRV_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_powerwindow_PW_Control_DRV_private_h_
#define powerwindow_RTW_HEADER_powerwindow_PW_Control_DRV_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_powerwindow_PW_Control_DRV_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,34 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_DRV_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_DRV_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_DRV_types_h_
#define powerwindow_RTW_HEADER_PW_Control_DRV_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_PW_Control_DRV
powerwindow_RT_MODEL_PW_Control_DRV;
#endif /* RTW_HEADER_PW_Control_DRV_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,195 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackL.c
Author: CoSys-Lab, University of Antwerp
Function: PW_Control_DRV realizes the functionality of back-left passenger
side powerwindow. It connects the 3 smaller modules together.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow//powerwindow_powerwindow_control.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL_private.h"
#include "wcclib.h"
/*
Forward declaration of functions
*/
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackL_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackL_terminate(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackL_main(void);
/* Block states (auto storage) */
powerwindow_D_Work_PW_Control_PSG_BackL powerwindow_PW_Control_PSG_BackL_DWork;
/* External inputs (root inport signals with auto storage) */
powerwindow_ExternalInputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_U;
/* External outputs (root outports fed by signals with auto storage) */
powerwindow_ExternalOutputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_Y;
/* Real-time model */
powerwindow_RT_MODEL_PW_Control_PSG_BackL powerwindow_PW_Control_PSG_BackL_M_;
powerwindow_RT_MODEL_PW_Control_PSG_BackL *const
powerwindow_PW_Control_PSG_BackL_M = &powerwindow_PW_Control_PSG_BackL_M_;
/* Model step function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackL_main(void) {
/* local block i/o variables */
powerwindow_boolean_T rtb_debounce_Up;
powerwindow_boolean_T rtb_debounce_Down;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_BackL_o1;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_BackL_o2;
/* ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_BackL_U.Up_PSG_BackL, &rtb_debounce_Up,
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtzce));
/* ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_BackL_U.Down_PSG_BackL, &rtb_debounce_Down,
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtzce));
/* ModelReference: '<S1>/ControlEx_PSG_BackL' */
powerwindow_controlexclusion_main(
&powerwindow_PW_Control_PSG_BackL_U.Up_DRV,
&powerwindow_PW_Control_PSG_BackL_U.Down_DRV, &rtb_debounce_Up,
&rtb_debounce_Down, &powerwindow_rtb_ControlEx_PSG_BackL_o1,
&powerwindow_rtb_ControlEx_PSG_BackL_o2);
/* ModelReference: '<S1>/PW_PSG_BackL' */
powerwindow_powerwindow_control_main(
&powerwindow_rtb_ControlEx_PSG_BackL_o1,
&powerwindow_rtb_ControlEx_PSG_BackL_o2,
&powerwindow_PW_Control_PSG_BackL_U.endofdetectionrange,
&powerwindow_PW_Control_PSG_BackL_U.currentsense,
&powerwindow_PW_Control_PSG_BackL_Y.window_up,
&powerwindow_PW_Control_PSG_BackL_Y.window_down,
&powerwindow_PW_Control_PSG_BackL_Y.overcurrent,
&powerwindow_PW_Control_PSG_BackL_Y.pinch,
&powerwindow_PW_Control_PSG_BackL_Y.wake,
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtzce));
}
/* Model initialize function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackL_initialize(void) {
/* Registration code */
/* initialize error status */
powerwindow_PW_PSG_BackL_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_BackL_M, (NULL));
/* states (dwork) */
(void) wcclib_memset((void *) &powerwindow_PW_Control_PSG_BackL_DWork, 0,
sizeof(powerwindow_D_Work_PW_Control_PSG_BackL));
/* external inputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_BackL_U, 0,
sizeof(powerwindow_ExternalInputs_PW_Control_PSG_BackL));
/* external outputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_BackL_Y, 0,
sizeof(powerwindow_ExternalOutputs_PW_Control_PSG_BackL));
/* Model Initialize fcn for ModelReference Block: '<S1>/ControlEx_PSG_BackL'
*/
powerwindow_controlexclusion_initialize();
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Down' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackL_M),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Up' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackL_M),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S1>/PW_PSG_BackL' */
powerwindow_powerwindow_control_initialize(
powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackL_M),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtzce));
/* Start for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtdw));
/* Start for ModelReference: '<S1>/PW_PSG_BackL' */
powerwindow_powerwindow_control_Start(
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Up_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackL_DWork.Debounce_Down_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S1>/PW_PSG_BackL' */
powerwindow_powerwindow_control_Init(
&powerwindow_PW_Control_PSG_BackL_Y.window_up,
&powerwindow_PW_Control_PSG_BackL_Y.window_down,
&powerwindow_PW_Control_PSG_BackL_Y.overcurrent,
&powerwindow_PW_Control_PSG_BackL_Y.pinch,
&powerwindow_PW_Control_PSG_BackL_Y.wake,
&(powerwindow_PW_Control_PSG_BackL_DWork.PW_PSG_BackL_DWORK1.rtdw));
}
/* Model terminate function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackL_terminate(void) {
/* (no terminate code required) */
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,142 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackL.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackL_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackL_h_
#ifndef powerwindow_PW_Control_PSG_BackL_COMMON_INCLUDES_
#define powerwindow_PW_Control_PSG_BackL_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtw_solver.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* powerwindow_PW_Control_PSG_BackL_COMMON_INCLUDES_*/
#include "../powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Child system includes */
#include "../powerwindow_HeaderFiles/powerwindow_controlexclusion.h"
#include "../powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_PW_PSG_BackL_BackL_rtmGetErrorStatus
#define powerwindow_PW_PSG_BackL_rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef powerwindow_PW_PSG_BackL_rtmSetErrorStatus
#define powerwindow_PW_PSG_BackL_rtmSetErrorStatus(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#ifndef powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer
#define powerwindow_PW_PSG_BackL_rtmGetErrorStatusPointer(rtm) \
((const powerwindow_char_T **) (&((rtm)->errorStatus)))
#endif
/* Block states (auto storage) for system '<Root>' */
typedef struct {
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_DWORK1; /* '<S2>/Debounce_Up' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_DWORK1; /* '<S2>/Debounce_Down' */
powerwindow_rtMdlrefDWork_PowerWindow_contr
PW_PSG_BackL_DWORK1; /* '<S1>/PW_PSG_BackL' */
} powerwindow_D_Work_PW_Control_PSG_BackL;
/* External inputs (root inport signals with auto storage) */
typedef struct {
powerwindow_boolean_T Up_DRV; /* '<Root>/Up_DRV' */
powerwindow_boolean_T Down_DRV; /* '<Root>/Down_DRV' */
powerwindow_boolean_T
endofdetectionrange; /* '<Root>/end of detection range' */
powerwindow_uint8_T currentsense; /* '<Root>/current sense' */
powerwindow_boolean_T Up_PSG_BackL; /* '<Root>/Up_PSG_BackL' */
powerwindow_boolean_T Down_PSG_BackL; /* '<Root>/Down_PSG_BackL' */
} powerwindow_ExternalInputs_PW_Control_PSG_BackL;
/* External outputs (root outports fed by signals with auto storage) */
typedef struct {
powerwindow_boolean_T window_up; /* '<Root>/window_up' */
powerwindow_boolean_T window_down; /* '<Root>/window_down' */
powerwindow_boolean_T overcurrent; /* '<Root>/overcurrent' */
powerwindow_boolean_T pinch; /* '<Root>/pinch' */
powerwindow_boolean_T wake; /* '<Root>/wake' */
} powerwindow_ExternalOutputs_PW_Control_PSG_BackL;
/* Real-time Model Data Structure */
struct powerwindow_tag_RTM_PW_Control_PSG_BackL {
const powerwindow_char_T *volatile errorStatus;
};
/* Block states (auto storage) */
extern powerwindow_D_Work_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_DWork;
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_U;
/* External outputs (root outports fed by signals with auto storage) */
extern powerwindow_ExternalOutputs_PW_Control_PSG_BackL
powerwindow_PW_Control_PSG_BackL_Y;
/* Model entry point functions */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackL_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackL_main(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackL_terminate(void);
/* Real-time Model object */
extern powerwindow_RT_MODEL_PW_Control_PSG_BackL
*const powerwindow_PW_Control_PSG_BackL_M;
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Note that this particular code originates from a subsystem build,
and has its own system numbers different from the parent model.
Refer to the system hierarchy for this subsystem below, and use the
MATLAB hilite_system command to trace the generated code back
to the parent model. For example,
hilite_system('PowerWindow/PW_Control_PSG_BackL') - opens subsystem
PowerWindow/PW_Control_PSG_BackL
hilite_system('PowerWindow/PW_Control_PSG_BackL/Kp') - opens and selects
block Kp
Here is the system hierarchy for this model
'<Root>' : 'PowerWindow'
'<S1>' : 'PowerWindow/PW_Control_PSG_BackL'
'<S2>' : 'PowerWindow/PW_Control_PSG_BackL/Debounce_PSG_BackL'
*/
#endif /* RTW_HEADER_PW_Control_PSG_BackL_h_*/
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackL_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackL_private_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackL_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_PW_Control_PSG_BackL_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,34 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackL_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackL_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackL_types_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackL_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_PW_Control_PSG_BackL
powerwindow_RT_MODEL_PW_Control_PSG_BackL;
#endif /* RTW_HEADER_PW_Control_PSG_BackL_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,195 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackR.c
Author: CoSys-Lab, University of Antwerp
Function: PW_Control_DRV realizes the functionality of back-right passenger
side powerwindow. It connects the 3 smaller modules together.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow//powerwindow_PW_Control_PSG_BackR.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR_private.h"
#include "wcclib.h"
/*
Forward declaration of functions
*/
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackR_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackR_terminate(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackR_main(void);
/* Block states (auto storage) */
powerwindow_D_Work_PW_Control_PSG_BackR powerwindow_PW_Control_PSG_BackR_DWork;
/* External inputs (root inport signals with auto storage) */
powerwindow_ExternalInputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_U;
/* External outputs (root outports fed by signals with auto storage) */
powerwindow_ExternalOutputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_Y;
/* Real-time model */
powerwindow_RT_MODEL_PW_Control_PSG_BackR powerwindow_PW_Control_PSG_BackR_M_;
powerwindow_RT_MODEL_PW_Control_PSG_BackR *const
powerwindow_PW_Control_PSG_BackR_M = &powerwindow_PW_Control_PSG_BackR_M_;
/* Model step function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackR_main(void) {
/* local block i/o variables */
powerwindow_boolean_T rtb_debounce_Up;
powerwindow_boolean_T rtb_debounce_Down;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_BackR_o1;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_BackR_o2;
/* ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_BackR_U.Up_PSG_BackR, &rtb_debounce_Up,
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtzce));
/* ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_BackR_U.Down_PSG_BackR, &rtb_debounce_Down,
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtzce));
/* ModelReference: '<S1>/ControlEx_PSG_BackR' */
powerwindow_controlexclusion_main(
&powerwindow_PW_Control_PSG_BackR_U.Up_DRV,
&powerwindow_PW_Control_PSG_BackR_U.Down_DRV, &rtb_debounce_Up,
&rtb_debounce_Down, &powerwindow_rtb_ControlEx_PSG_BackR_o1,
&powerwindow_rtb_ControlEx_PSG_BackR_o2);
/* ModelReference: '<S1>/PW_PSG_BackR' */
powerwindow_powerwindow_control_main(
&powerwindow_rtb_ControlEx_PSG_BackR_o1,
&powerwindow_rtb_ControlEx_PSG_BackR_o2,
&powerwindow_PW_Control_PSG_BackR_U.endofdetectionrange,
&powerwindow_PW_Control_PSG_BackR_U.currentsense,
&powerwindow_PW_Control_PSG_BackR_Y.window_up,
&powerwindow_PW_Control_PSG_BackR_Y.window_down,
&powerwindow_PW_Control_PSG_BackR_Y.overcurrent,
&powerwindow_PW_Control_PSG_BackR_Y.pinch,
&powerwindow_PW_Control_PSG_BackR_Y.wake,
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtzce));
}
/* Model initialize function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackR_initialize(void) {
/* Registration code */
/* initialize error status */
powerwindow_PW_PSG_BackR_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_BackR_M, (NULL));
/* states (dwork) */
(void) wcclib_memset((void *) &powerwindow_PW_Control_PSG_BackR_DWork, 0,
sizeof(powerwindow_D_Work_PW_Control_PSG_BackR));
/* external inputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_BackR_U, 0,
sizeof(powerwindow_ExternalInputs_PW_Control_PSG_BackR));
/* external outputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_BackR_Y, 0,
sizeof(powerwindow_ExternalOutputs_PW_Control_PSG_BackR));
/* Model Initialize fcn for ModelReference Block: '<S1>/ControlEx_PSG_BackR'
*/
powerwindow_controlexclusion_initialize();
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Down' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackR_M),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Up' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackR_M),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S1>/PW_PSG_BackR' */
powerwindow_powerwindow_control_initialize(
powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_BackR_M),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtzce));
/* Start for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtdw));
/* Start for ModelReference: '<S1>/PW_PSG_BackR' */
powerwindow_powerwindow_control_Start(
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Up_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_BackR_DWork.Debounce_Down_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S1>/PW_PSG_BackR' */
powerwindow_powerwindow_control_Init(
&powerwindow_PW_Control_PSG_BackR_Y.window_up,
&powerwindow_PW_Control_PSG_BackR_Y.window_down,
&powerwindow_PW_Control_PSG_BackR_Y.overcurrent,
&powerwindow_PW_Control_PSG_BackR_Y.pinch,
&powerwindow_PW_Control_PSG_BackR_Y.wake,
&(powerwindow_PW_Control_PSG_BackR_DWork.PW_PSG_BackR_DWORK1.rtdw));
}
/* Model terminate function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackR_terminate(void) {
/* (no terminate code required) */
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,142 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackR.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackR_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackR_h_
#ifndef powerwindow_PW_Control_PSG_BackR_COMMON_INCLUDES_
#define powerwindow_PW_Control_PSG_BackR_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtw_solver.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* powerwindow_PW_Control_PSG_BackR_COMMON_INCLUDES_*/
#include "../powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Child system includes */
#include "../powerwindow_HeaderFiles/powerwindow_controlexclusion.h"
#include "../powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_PW_PSG_BackR_rtmGetErrorStatus
#define powerwindow_PW_PSG_BackR_rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef powerwindow_PW_PSG_BackR_rtmSetErrorStatus
#define powerwindow_PW_PSG_BackR_rtmSetErrorStatus(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#ifndef powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer
#define powerwindow_PW_PSG_BackR_rtmGetErrorStatusPointer(rtm) \
((const powerwindow_char_T **) (&((rtm)->errorStatus)))
#endif
/* Block states (auto storage) for system '<Root>' */
typedef struct {
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_DWORK1; /* '<S2>/Debounce_Up' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_DWORK1; /* '<S2>/Debounce_Down' */
powerwindow_rtMdlrefDWork_PowerWindow_contr
PW_PSG_BackR_DWORK1; /* '<S1>/PW_PSG_BackR' */
} powerwindow_D_Work_PW_Control_PSG_BackR;
/* External inputs (root inport signals with auto storage) */
typedef struct {
powerwindow_boolean_T Up_DRV; /* '<Root>/Up_DRV' */
powerwindow_boolean_T Down_DRV; /* '<Root>/Down_DRV' */
powerwindow_boolean_T
endofdetectionrange; /* '<Root>/end of detection range' */
powerwindow_uint8_T currentsense; /* '<Root>/current sense' */
powerwindow_boolean_T Up_PSG_BackR; /* '<Root>/Up_PSG_BackR' */
powerwindow_boolean_T Down_PSG_BackR; /* '<Root>/Down_PSG_BackR' */
} powerwindow_ExternalInputs_PW_Control_PSG_BackR;
/* External outputs (root outports fed by signals with auto storage) */
typedef struct {
powerwindow_boolean_T window_up; /* '<Root>/window_up' */
powerwindow_boolean_T window_down; /* '<Root>/window_down' */
powerwindow_boolean_T overcurrent; /* '<Root>/overcurrent' */
powerwindow_boolean_T pinch; /* '<Root>/pinch' */
powerwindow_boolean_T wake; /* '<Root>/wake' */
} powerwindow_ExternalOutputs_PW_Control_PSG_BackR;
/* Real-time Model Data Structure */
struct powerwindow_tag_RTM_PW_Control_PSG_BackR {
const powerwindow_char_T *volatile errorStatus;
};
/* Block states (auto storage) */
extern powerwindow_D_Work_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_DWork;
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_U;
/* External outputs (root outports fed by signals with auto storage) */
extern powerwindow_ExternalOutputs_PW_Control_PSG_BackR
powerwindow_PW_Control_PSG_BackR_Y;
/* Model entry point functions */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackR_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackR_main(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_BackR_terminate(void);
/* Real-time Model object */
extern powerwindow_RT_MODEL_PW_Control_PSG_BackR
*const powerwindow_PW_Control_PSG_BackR_M;
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Note that this particular code originates from a subsystem build,
and has its own system numbers different from the parent model.
Refer to the system hierarchy for this subsystem below, and use the
MATLAB hilite_system command to trace the generated code back
to the parent model. For example,
hilite_system('PowerWindow/PW_Control_PSG_BackR') - opens subsystem
PowerWindow/PW_Control_PSG_BackR
hilite_system('PowerWindow/PW_Control_PSG_BackR/Kp') - opens and selects
block Kp
Here is the system hierarchy for this model
'<Root>' : 'PowerWindow'
'<S1>' : 'PowerWindow/PW_Control_PSG_BackR'
'<S2>' : 'PowerWindow/PW_Control_PSG_BackR/Debounce_PSG'
*/
#endif /* RTW_HEADER_PW_Control_PSG_h_*/
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackR_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackR_private_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackR_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_PW_Control_PSG_BackR_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,34 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_BackR_tyoes.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_BackR_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_BackR_types_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_BackR_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_PW_Control_PSG_BackR
powerwindow_RT_MODEL_PW_Control_PSG_BackR;
#endif /* RTW_HEADER_PW_Control_PSG_BackR_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,201 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_Front.c
Author: CoSys-Lab, University of Antwerp
Function: PW_Control_DRV realizes the functionality of front passenger side
powerwindow. It connects the 3 smaller modules together.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow//powerwindow_powerwindow_control.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front.h"
#include "powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front_private.h"
#include "wcclib.h"
/*
Forward declaration of functions
*/
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_Front_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_Front_terminate(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_Front_main(void);
/* Block states (auto storage) */
powerwindow_D_Work_PW_Control_PSG_Front powerwindow_PW_Control_PSG_Front_DWork;
/* External inputs (root inport signals with auto storage) */
powerwindow_ExternalInputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_U;
/* External outputs (root outports fed by signals with auto storage) */
powerwindow_ExternalOutputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_Y;
/* Real-time model */
powerwindow_RT_MODEL_PW_Control_PSG_Front powerwindow_PW_Control_PSG_Front_M_;
powerwindow_RT_MODEL_PW_Control_PSG_Front *const
powerwindow_PW_Control_PSG_Front_M = &powerwindow_PW_Control_PSG_Front_M_;
/* Model step function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_Front_main(void) {
/* local block i/o variables */
powerwindow_boolean_T rtb_debounce_Up;
powerwindow_boolean_T rtb_debounce_Down;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_Front_Front_o1;
powerwindow_boolean_T powerwindow_rtb_ControlEx_PSG_Front_Front_o2;
/* ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_Front_U.Up_PSG_Front, &rtb_debounce_Up,
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtzce));
/* ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_main(
&powerwindow_PW_Control_PSG_Front_U.Down_PSG_Front, &rtb_debounce_Down,
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtzce));
/* ModelReference: '<S1>/ControlEx_PSG_Front_Front' */
powerwindow_controlexclusion_main(
&powerwindow_PW_Control_PSG_Front_U.Up_DRV,
&powerwindow_PW_Control_PSG_Front_U.Down_DRV, &rtb_debounce_Up,
&rtb_debounce_Down, &powerwindow_rtb_ControlEx_PSG_Front_Front_o1,
&powerwindow_rtb_ControlEx_PSG_Front_Front_o2);
/* ModelReference: '<S1>/PW_PSG_Front_Front' */
powerwindow_powerwindow_control_main(
&powerwindow_rtb_ControlEx_PSG_Front_Front_o1,
&powerwindow_rtb_ControlEx_PSG_Front_Front_o2,
&powerwindow_PW_Control_PSG_Front_U.endofdetectionrange,
&powerwindow_PW_Control_PSG_Front_U.currentsense,
&powerwindow_PW_Control_PSG_Front_Y.window_up,
&powerwindow_PW_Control_PSG_Front_Y.window_down,
&powerwindow_PW_Control_PSG_Front_Y.overcurrent,
&powerwindow_PW_Control_PSG_Front_Y.pinch,
&powerwindow_PW_Control_PSG_Front_Y.wake,
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtzce));
}
/* Model initialize function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_Front_initialize(void) {
/* Registration code */
/* initialize error status */
powerwindow_PW_PSG_Front_rtmSetErrorStatus(
powerwindow_PW_Control_PSG_Front_M, (NULL));
/* states (dwork) */
(void) wcclib_memset((void *) &powerwindow_PW_Control_PSG_Front_DWork, 0,
sizeof(powerwindow_D_Work_PW_Control_PSG_Front));
/* external inputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_Front_U, 0,
sizeof(powerwindow_ExternalInputs_PW_Control_PSG_Front));
/* external outputs */
(void) wcclib_memset(
(void *) &powerwindow_PW_Control_PSG_Front_Y, 0,
sizeof(powerwindow_ExternalOutputs_PW_Control_PSG_Front));
/* Model Initialize fcn for ModelReference Block:
* '<S1>/ControlEx_PSG_Front_Front' */
powerwindow_controlexclusion_initialize();
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Down' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_Front_M),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S2>/debounce_Up' */
powerwindow_debounce_initialize(
powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_Front_M),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtzce));
/* Model Initialize fcn for ModelReference Block: '<S1>/PW_PSG_Front_Front'
*/
powerwindow_powerwindow_control_initialize(
powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer(
powerwindow_PW_Control_PSG_Front_M),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1.rtm),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtdw),
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtzce));
/* Start for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtdw));
/* Start for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Start(
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtdw));
/* Start for ModelReference: '<S1>/PW_PSG_Front_Front' */
powerwindow_powerwindow_control_Start(&(
powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Up' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Up_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S2>/debounce_Down' */
powerwindow_debounce_Init(
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtb),
&(powerwindow_PW_Control_PSG_Front_DWork.Debounce_Down_DWORK1.rtdw));
/* InitializeConditions for ModelReference: '<S1>/PW_PSG_Front_Front' */
powerwindow_powerwindow_control_Init(
&powerwindow_PW_Control_PSG_Front_Y.window_up,
&powerwindow_PW_Control_PSG_Front_Y.window_down,
&powerwindow_PW_Control_PSG_Front_Y.overcurrent,
&powerwindow_PW_Control_PSG_Front_Y.pinch,
&powerwindow_PW_Control_PSG_Front_Y.wake,
&(powerwindow_PW_Control_PSG_Front_DWork.PW_PSG_Front_Front_DWORK1
.rtdw));
}
/* Model terminate function */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_Front_terminate(void) {
/* (no terminate code required) */
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,142 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_Front.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_Front_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_Front_h_
#ifndef powerwindow_PW_Control_PSG_Front_COMMON_INCLUDES_
#define powerwindow_PW_Control_PSG_Front_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtw_solver.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* powerwindow_PW_Control_PSG_Front_COMMON_INCLUDES_*/
#include "../powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Child system includes */
#include "../powerwindow_HeaderFiles/powerwindow_controlexclusion.h"
#include "../powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "../powerwindow_HeaderFiles/powerwindow_powerwindow_control.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_PW_PSG_Front_rtmGetErrorStatus
#define powerwindow_PW_PSG_Front_rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef powerwindow_PW_PSG_Front_rtmSetErrorStatus
#define powerwindow_PW_PSG_Front_rtmSetErrorStatus(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#ifndef powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer
#define powerwindow_PW_PSG_Front_rtmGetErrorStatusPointer(rtm) \
((const powerwindow_char_T **) (&((rtm)->errorStatus)))
#endif
/* Block states (auto storage) for system '<Root>' */
typedef struct {
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Up_DWORK1; /* '<S2>/Debounce_Up' */
powerwindow_rtMdlrefDWork_debounce_T
Debounce_Down_DWORK1; /* '<S2>/Debounce_Down' */
powerwindow_rtMdlrefDWork_PowerWindow_contr
PW_PSG_Front_Front_DWORK1; /* '<S1>/PW_PSG_Front_Front' */
} powerwindow_D_Work_PW_Control_PSG_Front;
/* External inputs (root inport signals with auto storage) */
typedef struct {
powerwindow_boolean_T Up_DRV; /* '<Root>/Up_DRV' */
powerwindow_boolean_T Down_DRV; /* '<Root>/Down_DRV' */
powerwindow_boolean_T
endofdetectionrange; /* '<Root>/end of detection range' */
powerwindow_uint8_T currentsense; /* '<Root>/current sense' */
powerwindow_boolean_T Up_PSG_Front; /* '<Root>/Up_PSG_Front' */
powerwindow_boolean_T Down_PSG_Front; /* '<Root>/Down_PSG_Front' */
} powerwindow_ExternalInputs_PW_Control_PSG_Front;
/* External outputs (root outports fed by signals with auto storage) */
typedef struct {
powerwindow_boolean_T window_up; /* '<Root>/window_up' */
powerwindow_boolean_T window_down; /* '<Root>/window_down' */
powerwindow_boolean_T overcurrent; /* '<Root>/overcurrent' */
powerwindow_boolean_T pinch; /* '<Root>/pinch' */
powerwindow_boolean_T wake; /* '<Root>/wake' */
} powerwindow_ExternalOutputs_PW_Control_PSG_Front;
/* Real-time Model Data Structure */
struct powerwindow_tag_RTM_PW_Control_PSG_Front {
const powerwindow_char_T *volatile errorStatus;
};
/* Block states (auto storage) */
extern powerwindow_D_Work_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_DWork;
/* External inputs (root inport signals with auto storage) */
extern powerwindow_ExternalInputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_U;
/* External outputs (root outports fed by signals with auto storage) */
extern powerwindow_ExternalOutputs_PW_Control_PSG_Front
powerwindow_PW_Control_PSG_Front_Y;
/* Model entry point functions */
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_Front_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_Front_main(void);
__attribute__((always_inline)) static inline void
powerwindow_PW_Control_PSG_Front_terminate(void);
/* Real-time Model object */
extern powerwindow_RT_MODEL_PW_Control_PSG_Front
*const powerwindow_PW_Control_PSG_Front_M;
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Note that this particular code originates from a subsystem build,
and has its own system numbers different from the parent model.
Refer to the system hierarchy for this subsystem below, and use the
MATLAB hilite_system command to trace the generated code back
to the parent model. For example,
hilite_system('PowerWindow/PW_Control_PSG_Front') - opens subsystem
PowerWindow/PW_Control_PSG_Front
hilite_system('PowerWindow/PW_Control_PSG_Front/Kp') - opens and selects
block Kp
Here is the system hierarchy for this model
'<Root>' : 'PowerWindow'
'<S1>' : 'PowerWindow/PW_Control_PSG_Front'
'<S2>' : 'PowerWindow/PW_Control_PSG_Front/Debounce_PSG_Front_Front'
*/
#endif /* RTW_HEADER_PW_Control_PSG_Front_h_*/
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_Front_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_Front_private_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_Front_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_PW_Control_PSG_Front_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,34 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_PW_Control_PSG_Front_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_PW_Control_PSG_Front_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_PW_Control_PSG_Front_types_h_
#define powerwindow_RTW_HEADER_PW_Control_PSG_Front_types_h_
/* Forward declaration for rtModel */
typedef struct powerwindow_tag_RTM_PW_Control_PSG_Front
powerwindow_RT_MODEL_PW_Control_PSG_Front;
#endif /* RTW_HEADER_PW_Control_PSG_Front_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,26 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_const_params.c
Author: CoSys-Lab, University of Antwerp
Function: the lookup table for stateflow chart in
powerwindow_powerwindow_control
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_const_params.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
extern const powerwindow_boolean_T powerwindow_rtCP_pooled_6bUUQf1tASYw[12];
const powerwindow_boolean_T powerwindow_rtCP_pooled_6bUUQf1tASYw[12] = {
1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0};

View File

@ -0,0 +1,91 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_controlexclusion
Author: CoSys-Lab, University of Antwerp
Function: powerwindow_controlexclusion is one functionality of the power
window benchmark. It takes the input signal from the driver and the passenger
to determine the final control signal.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_controlexclusion.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_controlexclusion.h"
#include "powerwindow_HeaderFiles/powerwindow_controlexclusion_private.h"
/*
Forward declaration of functions
*/
__attribute__((always_inline)) static inline void
powerwindow_controlexclusion_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_controlexclusion_terminate(void);
__attribute__((always_inline)) static inline void
powerwindow_controlexclusion_main(const powerwindow_boolean_T *rtu_Up_DRV,
const powerwindow_boolean_T *rtu_Down_DRV,
const powerwindow_boolean_T *rtu_Up_PSG,
const powerwindow_boolean_T *rtu_Down_PSG,
powerwindow_boolean_T *rty_Up,
powerwindow_boolean_T *rty_Down);
/* Model initialize function */
__attribute__((always_inline)) static inline void
powerwindow_controlexclusion_initialize(void) {
/* (no initialization code required) */
}
/* Model terminate function */
__attribute__((always_inline)) static inline void
powerwindow_controlexclusion_terminate(void) {
/* (no terminate code required) */
}
/*
Algorithm core functions
*/
/* Output and update for referenced model: 'ControlExclusion' */
__attribute__((always_inline)) static inline void
powerwindow_controlexclusion_main(const powerwindow_boolean_T *rtu_Up_DRV,
const powerwindow_boolean_T *rtu_Down_DRV,
const powerwindow_boolean_T *rtu_Up_PSG,
const powerwindow_boolean_T *rtu_Down_PSG,
powerwindow_boolean_T *rty_Up,
powerwindow_boolean_T *rty_Down) {
/* Logic: '<S2>/Logical Operator11' incorporates:
Logic: '<S2>/Logical Operator2'
Logic: '<S2>/Logical Operator3'
Logic: '<S2>/Logical Operator5'
Logic: '<S2>/Logical Operator6'
Logic: '<S2>/Logical Operator7'
*/
*rty_Up = !(((!*rtu_Up_DRV) && (*rtu_Down_DRV)) ||
((*rtu_Down_DRV) && (!*rtu_Up_PSG) && (*rtu_Down_PSG)));
/* Logic: '<S2>/Logical Operator12' incorporates:
Logic: '<S2>/Logical Operator1'
Logic: '<S2>/Logical Operator10'
Logic: '<S2>/Logical Operator4'
Logic: '<S2>/Logical Operator8'
Logic: '<S2>/Logical Operator9'
*/
*rty_Down = !(((*rtu_Up_DRV) && (!*rtu_Down_DRV)) ||
((*rtu_Up_DRV) && (*rtu_Up_PSG) && (!*rtu_Down_PSG)));
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,79 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_controlexclusion.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_controlexclusion.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_controlexclusion_h_
#define powerwindow_RTW_HEADER_controlexclusion_h_
#ifndef powerwindow_controlexclusion_COMMON_INCLUDES_
#define powerwindow_controlexclusion_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtw_solver.h"
#endif /* powerwindow_controlexclusion_COMMON_INCLUDES_ */
#include "../powerwindow_HeaderFiles/powerwindow_controlexclusion_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* user code (top of header file) */
/* Model reference registration function */
__attribute__((always_inline)) static inline void
powerwindow_controlexclusion_initialize(void);
__attribute__((always_inline)) static inline void
powerwindow_controlexclusion_terminate(void);
__attribute__((always_inline)) static inline void
powerwindow_controlexclusion_main(const powerwindow_boolean_T *rtu_Up_DRV,
const powerwindow_boolean_T *rtu_Down_DRV,
const powerwindow_boolean_T *rtu_Up_PSG,
const powerwindow_boolean_T *rtu_Down_PSG,
powerwindow_boolean_T *rty_Up,
powerwindow_boolean_T *rty_Down);
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Use the MATLAB hilite_system command to trace the generated code back
to the model. For example,
hilite_system('<S3>') - opens system 3
hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
Here is the system hierarchy for this model
'<Root>' : 'ControlExclusion'
'<S1>' : 'ControlExclusion/Control_Clock_TicToc'
'<S2>' : 'ControlExclusion/Control_Clock_TicToc/ControlEx_PSG'
'<S3>' : 'ControlExclusion/Control_Clock_TicToc/Tic'
'<S4>' : 'powerwindow_controlexclusion_main/Control_Clock_TicToc/Toc'
'<S5>' : 'ControlExclusion/Control_Clock_TicToc/Tic/Tic_T'
'<S6>' : 'ControlExclusion/Control_Clock_TicToc/Toc/Toc_T'
*/
#endif /* RTW_HEADER_ControlExclusion_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_controlexclusion_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_controlexclusion_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_controlexclusion_private_h_
#define powerwindow_RTW_HEADER_controlexclusion_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* RTW_HEADER_controlexclusion_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_controlexclusion_types.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_controlexclusion_types.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_controlexclusion_types_h_
#define powerwindow_RTW_HEADER_controlexclusion_types_h_
/* Forward declaration for rtModel */
#endif /* powerwindow_RTW_HEADER_controlexclusion_types_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,231 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_debounce.c
Author: CoSys-Lab, University of Antwerp
Function: powerwindow_debounce_main is used to powerwindow_debounce_main the
push-down button of the power window. In order to input a manual switch signal
into a digital circuit, debouncing is necessary so that a single press does
not appear like multiple presses. Without debouncing, pressing the button once
may cause unpredictable results. powerwindow_debounce_main.c defines all the
functions that will be used in debounce_PSG_Front which is a part of the Power
window.
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_debounce.c
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#include "powerwindow_HeaderFiles/powerwindow_debounce.h"
#include "powerwindow_HeaderFiles/powerwindow_debounce_private.h"
#include "wcclib.h"
/* Named constants for Chart: '<Root>/Chart' */
#define debounce_IN_debounce ((powerwindow_uint8_T) 1U)
#define debounce_IN_NO_ACTIVE_CHILD ((powerwindow_uint8_T) 0U)
#define debounce_IN_Off ((powerwindow_uint8_T) 2U)
#define debounce_IN_Off_h ((powerwindow_uint8_T) 1U)
#define debounce_IN_On ((powerwindow_uint8_T) 3U)
#define debounce_IN_On_b ((powerwindow_uint8_T) 2U)
/*
Forward declaration of functions
*/
__attribute__((always_inline)) static inline void
powerwindow_debounce_Init(powerwindow_rtB_debounce_T *,
powerwindow_rtDW_debounce_T *);
__attribute__((always_inline)) static inline void
powerwindow_debounce_Start(powerwindow_rtDW_debounce_T *);
__attribute__((always_inline)) static inline void
powerwindow_debounce_initialize(const powerwindow_char_T **,
powerwindow_RT_MODEL_debounce_T *const,
powerwindow_rtB_debounce_T *,
powerwindow_rtDW_debounce_T *,
powerwindow_rtZCE_debounce_T *);
__attribute__((always_inline)) static inline void
powerwindow_debounce_main(const powerwindow_boolean_T *,
powerwindow_boolean_T *, powerwindow_rtB_debounce_T *,
powerwindow_rtDW_debounce_T *,
powerwindow_rtZCE_debounce_T *);
/*
Initialization- and return-value-related functions
*/
/* Initial conditions for referenced model: 'powerwindow_debounce_main' */
__attribute__((always_inline)) static inline void
powerwindow_debounce_Init(powerwindow_rtB_debounce_T *localB,
powerwindow_rtDW_debounce_T *localDW) {
/* InitializeConditions for Chart: '<Root>/Chart' */
localDW->is_debounce = debounce_IN_NO_ACTIVE_CHILD;
localDW->temporalCounter_i1 = 0U;
localDW->is_active_c3_debounce = 0U;
localDW->is_c3_debounce = debounce_IN_NO_ACTIVE_CHILD;
localB->Q = false;
}
/* Start for referenced model: 'powerwindow_debounce_main' */
__attribute__((always_inline)) static inline void
powerwindow_debounce_Start(powerwindow_rtDW_debounce_T *localDW) {
/* Start for DiscretePulseGenerator: '<Root>/period of 10ms' */
localDW->clockTickCounter = 0L;
}
/* Model initialize function */
__attribute__((always_inline)) static inline void
powerwindow_debounce_initialize(
const powerwindow_char_T **rt_errorStatus,
powerwindow_RT_MODEL_debounce_T *const debounce_M,
powerwindow_rtB_debounce_T *localB, powerwindow_rtDW_debounce_T *localDW,
powerwindow_rtZCE_debounce_T *localZCE) {
/* Registration code */
/* initialize error status */
powerwindow_rtmSetErrorStatusPointer(debounce_M, rt_errorStatus);
/* block I/O */
(void) wcclib_memset(((void *) localB), 0,
sizeof(powerwindow_rtB_debounce_T));
/* states (dwork) */
(void) wcclib_memset((void *) localDW, 0,
sizeof(powerwindow_rtDW_debounce_T));
localZCE->Chart_Trig_ZCE = powerwindow_POS_ZCSIG;
}
/*
Algorithm core functions
*/
/* Output and update for referenced model: 'powerwindow_debounce_main' */
__attribute__((always_inline)) static inline void
powerwindow_debounce_main(const powerwindow_boolean_T *rtu_Switch,
powerwindow_boolean_T *rty_debounced_Switch,
powerwindow_rtB_debounce_T *localB,
powerwindow_rtDW_debounce_T *localDW,
powerwindow_rtZCE_debounce_T *localZCE) {
powerwindow_int16_T rtb_periodof10ms;
/* DiscretePulseGenerator: '<Root>/period of 10ms' */
rtb_periodof10ms =
(localDW->clockTickCounter < 1L) && (localDW->clockTickCounter >= 0L)
? 1
: 0;
if (localDW->clockTickCounter >= 1L)
localDW->clockTickCounter = 0L;
else
localDW->clockTickCounter++;
/* End of DiscretePulseGenerator: '<Root>/period of 10ms' */
/* Chart: '<Root>/Chart' incorporates:
TriggerPort: '<S1>/ticks'
*/
/* DataTypeConversion: '<Root>/Data Type Conversion' */
if ((rtb_periodof10ms != 0) &&
(localZCE->Chart_Trig_ZCE != powerwindow_POS_ZCSIG)) {
/* Gateway: Chart */
if (localDW->temporalCounter_i1 < 7U)
localDW->temporalCounter_i1++;
/* Event: '<S1>:13' */
/* During: Chart */
if (localDW->is_active_c3_debounce == 0U) {
/* Entry: Chart */
localDW->is_active_c3_debounce = 1U;
/* Entry Internal: Chart */
/* Transition: '<S1>:9' */
localDW->is_c3_debounce = debounce_IN_Off;
/* Entry 'Off': '<S1>:1' */
localB->Q = true;
} else {
switch (localDW->is_c3_debounce) {
case debounce_IN_debounce:
/* During 'powerwindow_debounce_main': '<S1>:6' */
if (localDW->is_debounce == debounce_IN_Off_h) {
/* During 'Off': '<S1>:8' */
if ((powerwindow_int16_T) *rtu_Switch < 1) {
/* Transition: '<S1>:12' */
localDW->is_debounce = debounce_IN_On_b;
localDW->temporalCounter_i1 = 0U;
} else {
if (localDW->temporalCounter_i1 >= 3) {
/* Transition: '<S1>:16' */
localDW->is_debounce = debounce_IN_NO_ACTIVE_CHILD;
localDW->is_c3_debounce = debounce_IN_Off;
/* Entry 'Off': '<S1>:1' */
localB->Q = true;
}
}
} else {
/* During 'On': '<S1>:7' */
if ((powerwindow_int16_T) *rtu_Switch > 0) {
/* Transition: '<S1>:11' */
localDW->is_debounce = debounce_IN_Off_h;
localDW->temporalCounter_i1 = 0U;
} else {
if (localDW->temporalCounter_i1 >= 3) {
/* Transition: '<S1>:14' */
localDW->is_debounce = debounce_IN_NO_ACTIVE_CHILD;
localDW->is_c3_debounce = debounce_IN_On;
/* Entry 'On': '<S1>:5' */
localB->Q = false;
}
}
}
break;
case debounce_IN_Off:
/* During 'Off': '<S1>:1' */
if ((powerwindow_int16_T) *rtu_Switch < 1) {
/* Transition: '<S1>:10' */
localDW->is_c3_debounce = debounce_IN_debounce;
localDW->is_debounce = debounce_IN_On_b;
localDW->temporalCounter_i1 = 0U;
}
break;
default:
/* During 'On': '<S1>:5' */
if ((powerwindow_int16_T) *rtu_Switch > 0) {
/* Transition: '<S1>:15' */
localDW->is_c3_debounce = debounce_IN_debounce;
localDW->is_debounce = debounce_IN_Off_h;
localDW->temporalCounter_i1 = 0U;
}
break;
}
}
}
localZCE->Chart_Trig_ZCE =
(powerwindow_uint8_T) (rtb_periodof10ms != 0
? (powerwindow_int16_T) powerwindow_POS_ZCSIG
: (powerwindow_int16_T)
powerwindow_ZERO_ZCSIG);
/* End of DataTypeConversion: '<Root>/Data Type Conversion' */
/* DataTypeConversion: '<Root>/Data Type Conversion2' */
*rty_debounced_Switch = localB->Q;
}
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,106 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_debounce.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_debounce.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_debounce_h_
#define powerwindow_RTW_HEADER_debounce_h_
#ifndef powerwindow_debounce_COMMON_INCLUDES_
#define powerwindow_debounce_COMMON_INCLUDES_
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
#endif /* debounce_COMMON_INCLUDES_ */
#include "../powerwindow_HeaderFiles/powerwindow_debounce_types.h"
/* Shared type includes */
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
/* Block signals for model 'powerwindow_debounce_main' */
typedef struct {
powerwindow_boolean_T Q; /* '<Root>/Chart' */
} powerwindow_rtB_debounce_T;
/* Block states (auto storage) for model 'powerwindow_debounce_main' */
typedef struct {
powerwindow_int32_T clockTickCounter; /* '<Root>/period of 10ms' */
powerwindow_uint8_T is_active_c3_debounce; /* '<Root>/Chart' */
powerwindow_uint8_T is_c3_debounce; /* '<Root>/Chart' */
powerwindow_uint8_T is_debounce; /* '<Root>/Chart' */
powerwindow_uint8_T temporalCounter_i1; /* '<Root>/Chart' */
} powerwindow_rtDW_debounce_T;
/* Zero-crossing (trigger) state for model 'powerwindow_debounce_main' */
typedef struct {
ZCSigState Chart_Trig_ZCE; /* '<Root>/Chart' */
} powerwindow_rtZCE_debounce_T;
/* Real-time Model Data Structure */
struct powerwindow_tag_RTM_debounce_T {
const powerwindow_char_T **errorStatus;
};
typedef struct {
powerwindow_rtB_debounce_T rtb;
powerwindow_rtDW_debounce_T rtdw;
powerwindow_RT_MODEL_debounce_T rtm;
powerwindow_rtZCE_debounce_T rtzce;
} powerwindow_rtMdlrefDWork_debounce_T;
/* Model reference registration function */
__attribute__((always_inline)) static inline void
powerwindow_debounce_initialize(
const powerwindow_char_T **rt_errorStatus,
powerwindow_RT_MODEL_debounce_T *const debounce_M,
powerwindow_rtB_debounce_T *localB, powerwindow_rtDW_debounce_T *localDW,
powerwindow_rtZCE_debounce_T *localZCE);
__attribute__((always_inline)) static inline void
powerwindow_debounce_Init(powerwindow_rtB_debounce_T *localB,
powerwindow_rtDW_debounce_T *localDW);
__attribute__((always_inline)) static inline void
powerwindow_debounce_Start(powerwindow_rtDW_debounce_T *localDW);
__attribute__((always_inline)) static inline void
powerwindow_debounce_main(const powerwindow_boolean_T *rtu_Switch,
powerwindow_boolean_T *rty_debounced_Switch,
powerwindow_rtB_debounce_T *localB,
powerwindow_rtDW_debounce_T *localDW,
powerwindow_rtZCE_debounce_T *localZCE);
/*-
The generated code includes comments that allow you to trace directly
back to the appropriate location in the model. The basic format
is <system>/block_name, where system is the system number (uniquely
assigned by Simulink) and block_name is the name of the block.
Use the MATLAB hilite_system command to trace the generated code back
to the model. For example,
hilite_system('<S3>') - opens system 3
hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
Here is the system hierarchy for this model
'<Root>' : 'powerwindow_debounce_main'
'<S1>' : 'powerwindow_debounce_main/Chart'
*/
#endif /* RTW_HEADER_debounce_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

View File

@ -0,0 +1,49 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: powerwindow_debounce_private.h
Author: CoSys-Lab, University of Antwerp
Function: headerfile
Source:
https://github.com/tacle/tacle-bench/blob/master/bench/app/PowerWindow/powerwindow_HeaderFiles/powerwindow_debounce_private.h
Changes: a brief summary of major functional changes and formatting)
License: GNU General Public License
*/
#ifndef powerwindow_RTW_HEADER_debounce_private_h_
#define powerwindow_RTW_HEADER_debounce_private_h_
#include "../powerwindow_HeaderFiles/powerwindow_model_reference_types.h"
#include "../powerwindow_HeaderFiles/powerwindow_rtwtypes.h"
/* Macros for accessing real-time model data structure */
#ifndef powerwindow_rtmGetErrorStatus
#define powerwindow_rtmGetErrorStatus(rtm) (*((rtm)->errorStatus))
#endif
#ifndef powerwindow_rtmSetErrorStatus
#define powerwindow_rtmSetErrorStatus(rtm, val) (*((rtm)->errorStatus) = (val))
#endif
#ifndef powerwindow_rtmGetErrorStatusPointer
#define powerwindow_rtmGetErrorStatusPointer(rtm) (rtm)->errorStatus
#endif
#ifndef powerwindow_rtmSetErrorStatusPointer
#define powerwindow_rtmSetErrorStatusPointer(rtm, val) \
((rtm)->errorStatus = (val))
#endif
#endif /* RTW_HEADER_debounce_private_h_ */
/*
File trailer for generated code.
[ EOF ]
*/

Some files were not shown because too many files have changed in this diff Show More